Skip to content

Commit

Permalink
11550 - AmalgamaTING and TED Business Summary PDF (#2398)
Browse files Browse the repository at this point in the history
* AmalTED pdf

* Amalgamating pdf

* remove Dissolution/Restoration Information section

* fix lint error

* lint with flake8

* lint
  • Loading branch information
tshyun24 authored Jan 19, 2024
1 parent 3f24919 commit 3037c60
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 5 deletions.
1 change: 1 addition & 0 deletions legal-api/report-templates/businessSummary.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
[[business-summary/stateTransition.html]]
[[business-summary/recordKeeper.html]]
[[business-summary/amalgamations.html]]
[[business-summary/amalgamating.html]]
[[common/addresses.html]]
{% if business.legalType in ['GP', 'SP'] %}
[[business-summary/parties.html]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% if business.isAmalgamating %}
<div class="no-page-break">
<div class="separator mt-4"></div>
<div class="section-title mt-4">Amalgamated Into</div>
</div>

<div class="mt-2">
<span class="section-sub-title">Name of Amalgamated Company: </span>
{% if business.amalgamatedInto is defined %}
<span class="section-data">{{business.amalgamatedInto.legalName}}</span>
{% else %}
<span class="section-data">Not Available</span>
{% endif %}
</div>

<div class="mt-2">
<span class="section-sub-title">Incorporation Number: </span>
{% if business.amalgamatedInto is defined %}
<span class="section-data">{{business.amalgamatedInto.identifier}}</span>
{% else %}
<span class="section-data">Not Available</span>
{% endif %}
</div>
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% if business.amalgamatedEntity %}
<div class="no-page-break">
<div class="separator mt-4"></div>
<div class="section-title mt-4">Amalgamating {{ entityShortDescription }}s Information</div>
<div class="section-title mt-4">Amalgamating Corporation(s) Information</div>
</div>
<table class="section-data amalgamation-table mt-4" role="presentation">
<tr class="no-page-break">
<td class="col-50">
<div class="section-sub-title">Name</div>
<div class="section-sub-title">Amalgamating Corporation</div>
</td>
<td class="col-50">
<div class="section-sub-title">Incorporation Number in B.C.</div>
<div class="section-sub-title">Incorporation Number</div>
</td>
</tr>
{% for entity in amalgamatedEntities %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if stateFilings|length > 0 %}
{% if stateFilings|length > 0 and not business.isAmalgamating %}
<div class="no-page-break">
<div class="separator mt-4"></div>
<div class="section-title mt-4">
Expand Down
37 changes: 36 additions & 1 deletion legal-api/src/legal_api/reports/business_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from flask import current_app, jsonify

from legal_api.models import Alias, Business, CorpType, Filing
from legal_api.models.amalgamation import Amalgamation
from legal_api.reports.registrar_meta import RegistrarInfo
from legal_api.resources.v2.business import get_addresses, get_directors
from legal_api.resources.v2.business.business_parties import get_parties
Expand Down Expand Up @@ -85,6 +86,7 @@ def _substitute_template_parts(template_code):
template_parts = [
'business-summary/alterations',
'business-summary/amalgamations',
'business-summary/amalgamating',
'business-summary/businessDetails',
'business-summary/liquidation',
'business-summary/nameChanges',
Expand Down Expand Up @@ -134,6 +136,7 @@ def _get_template_data(self, get_json=False):
self._set_name_translations(business_json)
self._set_business_changes(business_json)
self._set_amalgamation_details(business_json)
self._set_amalgamating_details(business_json)
self._set_liquidation_details(business_json)

if self._business.legal_type in ['SP', 'GP']:
Expand Down Expand Up @@ -309,6 +312,14 @@ def _set_business_state_changes(self, business: dict):
'voluntaryLiquidation', 'putBackOn',
'continuationOut']):
state_filings.append(self._format_state_filing(filing))
# If it is amalgamating business
if ((business.get('business').get('state') == 'HISTORICAL')
and (business.get('business').get('amalgamatedInto'))):
amalgamating_business_temp = Business.find_by_identifier(business.get('business').get('identifier'))
amalgamating_business = amalgamating_business_temp.amalgamating_businesses.one_or_none()
amalgamation = Amalgamation.find_by_id(amalgamating_business.amalgamation_id)
filing = Filing.find_by_id(amalgamation.filing_id)
state_filings.append(self._format_state_filing(filing))
business['stateFilings'] = state_filings

def _set_record_keepers(self, business: dict):
Expand Down Expand Up @@ -412,6 +423,8 @@ def _format_state_filing(self, filing: Filing) -> dict:
continuation_out_date = LegislationDatetime.as_legislation_timezone_from_date_str(
filing_meta['continuationOut']['continuationOutDate'])
filing_info['continuationOutDate'] = continuation_out_date.strftime(OUTPUT_DATE_FORMAT)
elif filing.filing_type == 'amalgamationApplication':
filing_info['filingName'] = 'Amalgamation'
else:
filing_info['filingName'] = BusinessDocument.\
_get_summary_display_name(filing.filing_type, None, None)
Expand All @@ -423,15 +436,37 @@ def _set_amalgamation_details(self, business: dict):
amalgamation_application = Filing.get_filings_by_types(self._business.id, ['amalgamationApplication'])
if amalgamation_application:
business['business']['amalgamatedEntity'] = True
# else condition will have to be added when we do amalgamation in the new system
amalgamation_json = amalgamation_application[0].filing_json.get('filing', {})\
.get('amalgamationApplication', {})
# if it's future effective
if self._epoch_filing_date and amalgamation_application[0].effective_date < self._epoch_filing_date:
amalgamated_businesses_info = {
'legalName': 'Not Available',
'identifier': 'Not Available'
}
amalgamated_businesses.append(amalgamated_businesses_info)
else:
amalgamating_businesses = amalgamation_json.get('amalgamatingBusinesses', {})
while amalgamating_businesses:
if len(amalgamating_businesses[0].get('foreignJurisdiction', {})) == 0:
identifier = amalgamating_businesses[0].get('identifier', {})
else:
identifier = amalgamating_businesses[0].get('corpNumber', {})
amalgamating_business = Business.find_by_identifier(identifier)
business_legal_name = amalgamating_business.legal_name
amalgamated_businesses_info = {
'legalName': business_legal_name,
'identifier': identifier
}
amalgamated_businesses.append(amalgamated_businesses_info)
amalgamating_businesses.remove(amalgamating_businesses[0])
business['amalgamatedEntities'] = amalgamated_businesses

def _set_amalgamating_details(self, business: dict):
amalgamating_info = business.get('business', {}).get('amalgamatedInto')
if amalgamating_info:
business['business']['isAmalgamating'] = True

def _set_liquidation_details(self, business: dict):
"""Set partial liquidation filing data."""
liquidation_info = {}
Expand Down

0 comments on commit 3037c60

Please sign in to comment.