diff --git a/report-api/report-templates/generic_footer.html b/report-api/report-templates/generic_footer.html index 8f028fe2..bfc48d5c 100644 --- a/report-api/report-templates/generic_footer.html +++ b/report-api/report-templates/generic_footer.html @@ -33,7 +33,7 @@ {% endif %} {% endif %} {% endif %} - {% elif statement and statement.is_interim_statement %} + {% elif statement and statement.isInterimStatement %} Interim Account Statement #{{statement.id}} {% elif statement %} Account Statement #{{statement.id}} diff --git a/report-api/report-templates/statement_details.html b/report-api/report-templates/statement_details.html index eb3e53d8..184ff2ab 100644 --- a/report-api/report-templates/statement_details.html +++ b/report-api/report-templates/statement_details.html @@ -4,34 +4,6 @@
|
-
- Transactions
-
- |
- |
|
-
- Number of Transactions: {{ transactions|length }}
-
- |
-
| Product Purchased | -Folio | -Date | -Fee | -Service Fee | -GST | -Total | - - {% for row in transactions %} +||
|---|---|---|---|---|---|---|---|---|
|
- {% for product in row.products %}
- {{ product }}
- {% endfor %}
- {% if row.details %}
-
- {% for detail in row.details %}
-
- {% endif %}
- {{ detail }}
- {% endfor %}
- |
- {{ row.folio }} | -{{ row.created_on }} | -${{ row.fee }} | -${{ row.service_fee }} | -${{ row.gst }} | -
- ${{ row.total }}
- {% if row.status_code == 'APPROVED' %}
- (Pending) - {% endif %} - |
+
+ Previous Statement
+ |
|
|
+
+ Previous Balance:
+ ${{ statementSummary.lastStatementTotal if statementSummary.lastStatementTotal else '0.00' }}
+
+ |
+ |||||||
|
+
+ Payments received ({{ statementSummary.latestStatementPaymentDate or statement.duration }})
+ {{ '$0.00' if not statementSummary.lastStatementPaidAmount or statementSummary.lastStatementPaidAmount == '0.00' else '-$' + statementSummary.lastStatementPaidAmount }}
+
+ |
+ |||||||
|
+
+ Balance Forward (From {{ statement.toDate }}):
+ ${{ statementSummary.balanceForward }}
+
+ |
+ |||||||
|
-
- {% if payment_method == 'PAD' %}
- Pre-Authorized Debit Totals
- {% elif payment_method == 'ONLINE_BANKING' %}
- Online Banking Totals
- {% elif payment_method == 'CC' or pm == 'DIRECT_PAY' %}
- Credit Card Totals
- {% elif payment_method == 'DRAWDOWN' %}
- BC OnLine Totals
- {% elif payment_method == 'EJV' %}
- Electronic Journal Voucher Totals
- {% elif payment_method == 'EFT' %}
- Electronic Funds Transfer Totals
- {% else %}
- Totals
- {% endif %}
-
+ Current Statement
|
|||||||
|
-
+
Fees:
- ${{ '%.2f' % (data.fees_total if data else 0.0) }}
+ ${{ data.fees if data else '0.0' }}
|
|||||||
|
-
+
Service Fees:
- ${{ '%.2f' % (data.service_fees_total if data else 0.0) }}
+ ${{ data.serviceFees if data else '0.0' }}
|
|||||||
|
-
- GST:
- ${{ '%.2f' % (data.gst_total if data else 0.0) }}
+
+ GST (Reg Number 107864738):
+ ${{ data.gst if data else '0.0' }}
|
|||||||
|
+
+ {{ refund_label }} (from {{ statement.duration }}):
+ {{ '$0.00' if not data or data.countedRefund == '0.00' else '-$' + data.countedRefund }}
+
+ |
+ |||||||
|
-
- Refunds Received:
- ${{ '%.2f' % (data.refunds_total if data else 0.0) }}
+
+ Credits applied (from {{statement.duration}}):
+ {{ '$0.00' if not data or data.creditsApplied == '0.00' else '-$' + data.creditsApplied }}
|
|||||||
|
-
- Credits Received:
- ${{ '%.2f' % (data.credits_total if data else 0.0) }}
+
+ Current Statement Total:
+ ${{ data.totals if data else '0.0' }}
|
|||||||
|
+
+ Pre-Authorized Debit Amount Processed:
+ {{ '$0.00' if not data or data.paid == '0.00' else '-$' + data.paid }}
+
+ |
+ |||||||
|
-
- Total:
- ${{ '%.2f' % (data.totals_summary if data else 0.0) }}
+
+ Current Statement Total:
+ ${{ data.totals if data else '0.0' }}
|
|||||||
|
-
- Last Statement Total:
- ${{ statementSummary.lastStatementTotal }}
+ {% endif %}
+ {% if data.due and payment_method in ['EFT', 'PAD'] %}
+
+ |
-
+ Total Amount Due:
+ ${{ data.due }}
+
+ {% if payment_method == 'EFT' %}
+
+ Payment Due Date:
+ {{ data.dueDate }}
-
- |
-
- Payment Received for Last Statement:
- -${{ statementSummary.lastStatementPaidAmount }}
+ {% else %}
+
+ Will be withdrawn within 1-3 business days after the transaction date.
-
- |
-
- Cancelled Transactions:
- -${{ statementSummary.cancelledTransactions }}
-
- |
+ ||||
|
Total Amount Paid:
- ${{ data.paid_summary }}
+ ${{ data.paid }}
{% if statementSummary.latestStatementPaymentDate %}
Paid on {{ statementSummary.latestStatementPaymentDate }}
@@ -170,70 +145,193 @@
|
|||||||
|
-
- Total Amount Owing:
- ${{ '%.2f' % data.due_summary }}
-
- {% if not statement.is_interim_statement %}
- Payment Due Date: {{ statementSummary.dueDate }}
- {% endif %}
- |
- |||||||
|
-
- Amount Paid:
- ${{ '%.2f' % (data.paid_summary if data else 0.0) }}
-
- |
- |||||||
|
Total Amount Due:
- ${{ '%.2f' % (data.due_summary if data else 0.0) }}
+ ${{ data.due if data else '0.0' }}
|
|||||||
|
+
+ CREDIT CARD TOTAL:
+ ${{ data.totals if data else '0.0' }}
+
+
+ Fees charged to credit card
+
+ |
+ |||||||
|
+
+ ONLINE BANKING TOTAL:
+ ${{ data.totals if data else '0.0' }}
+
+
+ Fees paid by online banking
+
+ |
+ |||||||
|
+
+ BC ONLINE TOTAL:
+ ${{ data.totals if data else '0.0' }}
+
+
+ Fees for BC Registries and Online Services are deducted from the BC Online account.
+
+ |
+
|
+
+ Transactions from {{ statement.duration }}
+
+ |
+ |
|
+
+ Number of Transactions: {{ transactions|length }}
+
+ |
+
| Product Purchased | +Folio | +Date | +Fee | +Service Fee | +GST | +Total | + + {% for row in transactions %}|
|---|---|---|---|---|---|---|---|
|
-
- Total Amount Owing:
- ${{ '%.2f' % data.due_summary }}
-
+ |
+ {% for product in row.products %}
+ {{ product }}
+ {% endfor %}
+ {% if row.details %}
+
+ {% for detail in row.details %}
+
+ {% endif %}
{{ detail }}
+ {% endfor %}
+ |
- ||||||
|
-
- Payment Received for Pending Transactions on Last Statement:
- -${{ '%.2f' % statementSummary.lastPADStatementPaidAmount }}
-
+ | {{ row.folio }} | +{{ row.createdOn }} | +${{ row.fee }} | +${{ row.serviceFee }} | +${{ row.gst }} | +
+ ${{ row.total }}
+ {% if row.statusCode == 'APPROVED' and payment_method == 'PAD' %}
+ (Pending) + {% endif %} |
|
|
+ Account Credit Applied
+ |
+ + | + |
+ {% if row.isFullAppliedCredits %}
+ {{ '$0.00' if row.fee == '0.00' else '-$' + row.fee }}
+ {% else %}
+ {{ '$0.00' if row.appliedCreditsAmount == '0.00' else '-$' + row.appliedCreditsAmount }}
+ {% endif %}
+ |
+
+ {% if row.isFullAppliedCredits %}
+ {{ '$0.00' if row.serviceFee == '0.00' else '-$' + row.serviceFee }}
+ {% endif %}
+ |
+
+ {% if row.isFullAppliedCredits %}
+ {{ '$0.00' if row.gst == '0.00' else '-$' + row.gst }}
+ {% endif %}
+ |
+
+ {{ '$0.00' if row.appliedCreditsAmount == '0.00' else '-$' + row.appliedCreditsAmount }}
+ |
+ |
|
+ {% for product in row.products %}
+ {{ product }} ({{ status_text[row.statusCode] }})
+ {% endfor %}
+ {% if row.details %}
+
+ {% for detail in row.details %}
+
+ {% endif %}
+ {% if row.statusCode in ['REFUNDED', 'CREDITED', 'PARTIALLY_REFUNDED', 'PARTIALLY_CREDITED'] %}
+ {{ detail }}
+ {% endfor %}
+ Refund Transaction ID: {{ row.refundId }}
+ {% endif %}
+ |
+ {{ row.folio }} | +{{ row.refundDate }} | +{{ '$0.00' if row.refundFee == '0.00' else '-$' + row.refundFee }} | +{{ '$0.00' if row.refundServiceFee == '0.00' else '-$' + row.refundServiceFee }} | +{{ '$0.00' if row.refundGst == '0.00' else '-$' + row.refundGst }} | +{{ '$0.00' if row.refundTotal == '0.00' else '-$' + row.refundTotal }} | +|
|
This statement lists only the products and services provided. To view the status of all transactions, please refer to the transaction page in your account settings. -The 'Total Amount Owing' indicates the amount that will be automatically debited from your PAD bank account within 1-3 business days. Please ensure sufficient funds are available. If a payment fails, a non-sufficient funds (NSF) fee of $30.00 may be applied for each failed attempt. +The 'Pre-Authorized Debit Amount' indicates the amount that will be automatically debited from your PAD bank account within 1-3 business days. Please ensure sufficient funds are available. If a payment fails, a non-sufficient funds (NSF) fee of $30.00 may be applied for each failed attempt. |
|
| diff --git a/report-api/src/api/services/chunk_report_service.py b/report-api/src/api/services/chunk_report_service.py index 78db2825..b9cb208b 100644 --- a/report-api/src/api/services/chunk_report_service.py +++ b/report-api/src/api/services/chunk_report_service.py @@ -83,7 +83,7 @@ def _build_chunk_html( chunk_info: 'ChunkReportService.ChunkInfo', ) -> str: chunk_vars = template_vars.copy() - chunk_vars['groupedInvoices'] = [invoice_copy] + chunk_vars['grouped_invoices'] = [invoice_copy] chunk_vars['_chunk_info'] = asdict(chunk_info) sanitized_name = sanitize_template_name(template_name) @@ -144,7 +144,7 @@ def create_chunk_report( if chunk_size is None: chunk_size = 500 # the optimal chunk size is 500 after testing - grouped_invoices = template_vars.get('groupedInvoices', []) + grouped_invoices = template_vars.get('grouped_invoices', []) temp_files: List[str] = [] # Build all chunk HTMLs ahead of time (keep order id) diff --git a/report-api/src/api/services/report_service.py b/report-api/src/api/services/report_service.py index 415d8adf..28198e65 100644 --- a/report-api/src/api/services/report_service.py +++ b/report-api/src/api/services/report_service.py @@ -64,9 +64,9 @@ def _finalize_pdf( html_out: str, generate_page_number: bool, ) -> bytes: - """Route to chunk only when statement_report has groupedInvoices; else render directly.""" + """Route to chunk only when statement_report has grouped_invoices; else render directly.""" is_statement = 'statement_report' in (template_name or '') - has_grouped_invoices = bool((template_args or {}).get('groupedInvoices')) + has_grouped_invoices = bool((template_args or {}).get('grouped_invoices')) if is_statement and has_grouped_invoices: return ChunkReportService.create_chunk_report( diff --git a/report-api/tests/unit/api/test_reports.py b/report-api/tests/unit/api/test_reports.py index 873ce610..c4eaa773 100644 --- a/report-api/tests/unit/api/test_reports.py +++ b/report-api/tests/unit/api/test_reports.py @@ -194,7 +194,7 @@ def test_statement_grouped_invoices(client, jwt, app, monkeypatch): data = { 'template': _inline_tpl(), 'templateVars': { - 'groupedInvoices': [{'transactions': [1]}], + 'grouped_invoices': [{'transactions': [1]}], 'reportName': 'statement_report', }, 'reportName': 'statement_report', |