From 86a9048c4ab66d47c841efebe6fbfaf0d12440e4 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Tue, 10 Dec 2024 13:07:17 -0800 Subject: [PATCH] 24174 - Supporting multiple payment methods on statement (#96) * Supporting multiple payment methods on statement * further payment_method support * check for staff payments --- .../eft/eft_statement_details.html | 26 - .../report-templates/statement_details.html | 30 + .../report-templates/statement_header.html | 123 +-- .../report-templates/statement_report.html | 794 +++++++++--------- .../statement_transactions.html | 120 ++- 5 files changed, 524 insertions(+), 569 deletions(-) delete mode 100644 report-api/report-templates/eft/eft_statement_details.html create mode 100644 report-api/report-templates/statement_details.html diff --git a/report-api/report-templates/eft/eft_statement_details.html b/report-api/report-templates/eft/eft_statement_details.html deleted file mode 100644 index 6c3dd7b5..00000000 --- a/report-api/report-templates/eft/eft_statement_details.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -
-
-
Account Number: {{account.id}}
- {% if statement.is_interim_statement %} -
Total Amount Paid: ${{ "{:,.2f}".format(total.paid)}}
- {% endif %} -
Total Amount Owing: ${{ "{:,.2f}".format(total.due) if total.due else '0.00' }}
- {% if statement.is_interim_statement%} -
Payment Received Date: - {% if statementSummary.latestStatementPaymentDate %} - {{statementSummary.latestStatementPaymentDate | format_datetime('mmm dd,yyyy')}} - {% endif %} -
- {% else %} -
Payment Due Date: {{statementSummary.dueDate | format_datetime('mmm dd,yyyy')}}
- {% endif %} - -
Statement Number: {{statement.id}}
-
-
diff --git a/report-api/report-templates/statement_details.html b/report-api/report-templates/statement_details.html new file mode 100644 index 00000000..aaadf3ce --- /dev/null +++ b/report-api/report-templates/statement_details.html @@ -0,0 +1,30 @@ + + + + + + +
+
+
Account Number: {{ account.id }}
+ {% if statement.is_interim_statement %} + {% set total_paid = invoices|selectattr("payment_method", "equalto", payment_method)|sum(attribute='paid') %} +
Total Amount Paid: ${{ "{:,.2f}".format(total_paid)}}
+ {% endif %} + {% if statement.is_interim_statement and payment_method_index.value == 0 %} +
Total Amount Owing: ${{ "{:,.2f}".format(total.due) if total.due else '0.00' }}
+
Payment Received Date: + {% if statementSummary.latestStatementPaymentDate %} + {{statementSummary.latestStatementPaymentDate | format_datetime('detail')}} + {% endif %} +
+ {% else %} + {% if not statement.is_interim_statement and payment_method_index.value == 0 %} +
Payment Due Date: {{statementSummary.dueDate | format_datetime('mmm dd,yyyy')}}
+ {% endif %} + {% endif %} + {% if payment_method_index.value == 0 %} +
Statement Number: {{statement.id}}
+ {% endif %} +
+
diff --git a/report-api/report-templates/statement_header.html b/report-api/report-templates/statement_header.html index f7fa1752..84ec1d15 100644 --- a/report-api/report-templates/statement_header.html +++ b/report-api/report-templates/statement_header.html @@ -1,106 +1,67 @@ + {% if is_payment_instructions %} + + {% else %} + {% endif %} - - {% if statement.payment_methods[0] == 'EFT' %} - - - - - - - {% else %} - - - + {% endif %} + + - + {% if not is_payment_instructions %} + - + + + + {% endif %}
BC registries Logo - {% if statement.payment_methods[0] != 'EFT' %} -
-
BC Registries and Online Services
-
161 - 4000 Seymour Place
-
Victoria BC V8X 4S8
-
-
Toll Free: 1-800-663-6102
-
Email: bcolhelp@gov.bc.ca
-
- {% endif %}
- {% if statement.payment_methods[0] == 'EFT' %} - Account Statement + {% if is_payment_instructions %} + ELECTRONIC FUNDS TRANSFER INSTRUCTIONS + {% elif payment_method == 'EFT' %} + ACCOUNT STATEMENT - ELECTRONIC FUNDS TRANSFER + {% elif payment_method == 'PAD' %} + ACCOUNT STATEMENT - PRE-AUTHORIZED DEBIT + {% elif payment_method == 'ONLINE_BANKING' %} + ACCOUNT STATEMENT - ONLINE BANKING + {% elif payment_method == 'CC' %} + ACCOUNT STATEMENT - CREDIT CARD + {% elif payment_method == 'EJV' %} + ACCOUNT STATEMENT - ELECTRONIC JOURNAL VOUCHER + {% elif payment_method == 'DRAWDOWN' %} + ACCOUNT STATEMENT - BC ONLINE + {% elif payment_method == 'DIRECT_PAY' %} + ACCOUNT STATEMENT - DIRECT PAY + {% elif payment_method == 'INTERNAL' and is_staff_payment %} + ACCOUNT STATEMENT - STAFF PAYMENT + {% elif payment_method == 'INTERNAL' %} + ACCOUNT STATEMENT - ROUTING SLIP {% else %} - Deposit Account Statement + ACCOUNT STATEMENT {% endif %}
- {% if statement.from_date or statement.to_date %} -
- {% if 'DAILY' == statement.frequency %} - {{statement.from_date}} - {% else %} - {{statement.from_date}} to {{statement.to_date}} - {% endif %} -
- {% endif %} -
-
-
{{ account.name|upper }}
-
-
-
-
-
Total Amount:
-
${{"%.2f"|format(total.fees) if total.fees else '0.00'}}
-
+
{{ account.name|upper }}
+
+
diff --git a/report-api/report-templates/statement_report.html b/report-api/report-templates/statement_report.html index a7fa5054..fe320fe9 100644 --- a/report-api/report-templates/statement_report.html +++ b/report-api/report-templates/statement_report.html @@ -1,405 +1,417 @@ + - - - - - - - - - - - {% include 'report-templates/statement_header.html' %} - {% if statement.payment_methods[0] == 'EFT' %} - {% include 'report-templates/eft/eft_statement_details.html' %} + } + + .thick-spacer, .thin-spacer { + margin: 0 auto; + } + + .thin-spacer { + height: 20px; + border-bottom: 1px solid #e2e7ed; + width: 95%; + } + + .thick-spacer { + height: 0px; + border-bottom: 3px solid #234075; + width: 100%; + } + + .letterhead-banner td > div { + background: #234075; + color: #fff; + padding: 16px 24px; + font-size: 16px; + font-family: 'BCSans-Bold', sans-serif; + margin: 0; + } + + .inner-wrap { + width: 100%; + padding: 0 24px; + box-sizing: border-box; + } + + .org-account-info-row { + border-top: 3px solid #234075; + } + + .org-account-info-row .org-address-column { + padding: 24px; + width: 310px; + white-space: normal; + padding-right: 12px; + padding-bottom: 18px; + } + + .org-account-info-row .account-info { + width: 100%; + padding: 24px; + padding-left: 12px; + } + + .org-account-info-row .account-info .account-info-title { + font-family: 'BCSans-Bold', sans-serif; + display: inline-block; + width: 48%; + } + + .org-account-info-row .account-info .account-info-value { + text-align: right; + display: inline-block; + width: 50%; + } + + .section-subtitle { + padding-left: 24px; + margin-top: 16px; + margin-bottom: 16px; + font-size: 16px; + font-weight: 800; + font-family: 'BCSans-Bold', sans-serif; + } + + .transaction-table { + width: 100%; + border-top: 1px solid #b3bac3; + } + + .line-height-reg { + margin-bottom: 4px; + } + + .total-amount-due-row { + background: #234075; + color: #fff; + padding: 16px 24px; + font-size: 16px; + font-family: 'BCSans-Bold', sans-serif; + margin: 4px 0 10px; + } + + .total-amount-due-row .total-amount-due-div1{ + display: inline-block; + width: 48%; + } + + .total-amount-due-row .total-amount-due-div2{ + text-align: right; + display: inline-block; + width: 50%; + } + + .section-title { + margin: 10px 24px 0px; + padding-bottom: 16px; + font-family: 'BCSans-Bold', sans-serif; + font-size: 18px; + color: #234075; + } + + .no-border { + border: none; + padding: 12px 0 0 0; + } + + .mb-0 { + margin-bottom: 0px; + } + + .transaction-table { + margin: 0px 24px 16px; + width: 690px; + } + + .transaction-table thead tr, + .transaction-table tbody tr { + line-height: 3; + font-size: 12px; + border-bottom: 1px solid #bcbec5; + } + + .transaction-table thead tr, + .transaction-table tbody tr.row-border { + border-bottom: 1px solid #b3bac3; + } + + .transaction-table thead th { + text-align: left; + vertical-align: top; + font-family: 'BCSans-Bold', sans-serif; + font-weight: bold; + padding-bottom: 2px; + } + .transaction-table thead th:last-child { + text-align: right; + } + .transaction-table tbody td:last-child { + text-align: right; + } + + .transaction-table tbody .product-purchased { + line-height: 1.5; + padding-top: 10px; + padding-bottom: 10px; + max-width: 135px; + } + + .transaction-table thead .two-line-head { + line-height: 1.5; + padding-top: 10px; + padding-bottom: 10px; + } + + .total-elements { + margin: 0px 24px; + padding: 10px 0; + font-size: 14px; + border-bottom: 1px solid #b3bac3; + } + + .total-elements-price { + float: right; + font-family: 'BCSans-Regular', sans-serif; + } + + .statement-footer { + padding: 10px 24px 20px; + position: fixed; + bottom: 0px; + left: -24px; + width: 100%; + margin-bottom: -130px; + } + + .footer-bcrs-logo { + display: inline-block; + padding-bottom: 16px; + padding-left: 16px; + float: left !important; + } + + .footer-bcrs-logo img { + width: 180px; + } + + .statement-footer .footer-info { + font-size: 13px; + display: inline-block; + vertical-align: middle; + text-align: right !important; + float: right; + padding-right: 34px; + margin-top: 30px; + color: #234075; + } + + .statement-footer .footer-info span { + padding: 2px 7px; + border-right: 1px solid #868686; + display: inline-block; + text-align: right; + margin-right: 3px; + } + + .statement-footer .footer-info span:last-child { + border-right: none; + color: #234075; + } + + .font-bold { + font-family: 'BCSans-Bold', sans-serif; + font-weight: bold; + } + + .page-break-before { + page-break-before: always; + } + + .no-margin { + margin-top: 0!important; + } + + + + +{% set payment_methods = ['EFT', 'PAD', 'CC', 'DRAWDOWN', 'INTERNAL', 'DIRECT_PAY', 'ONLINE_BANKING', 'EJV'] %} +{% set payment_method_index = namespace(value=-1) %} +{% for payment_method in payment_methods %} + {% if payment_method in invoices|map(attribute='payment_method')|list %} +
+ {% set payment_method_index.value = payment_method_index.value + 1 %} + {% if payment_method == 'INTERNAL' and invoices|selectattr('payment_method', 'equalto', 'INTERNAL')|selectattr('routing_slip', 'undefined')|list %} + {% set is_staff_payment = 'true' %} {% endif %} - {% include 'report-templates/statement_transactions.html' %} - {% if statement.payment_methods[0] == 'EFT' %} -
- {% include 'report-templates/statement_header.html' %} -

Payment Instructions

-
- {% include 'report-templates/eft/eft_instructions_details.html' %} - {% include 'report-templates/eft/eft_instructions_charges.html' %} - {% endif %} - - + {% include 'report-templates/statement_header.html' with context %} +
+ {% include 'report-templates/statement_details.html' with context %} + {% include 'report-templates/statement_transactions.html' with context %} + {% endif %} +{% endfor %} + + + {% if 'EFT' in invoices|map(attribute='payment_method')|list %} + {% set payment_method = 'EFT' %} + {% set is_payment_instructions = true %} +
+ {% include 'report-templates/statement_header.html' %} +

Payment Instructions

+
+ {% include 'report-templates/eft/eft_instructions_details.html' %} + {% include 'report-templates/eft/eft_instructions_charges.html' %} + {% endif %} + diff --git a/report-api/report-templates/statement_transactions.html b/report-api/report-templates/statement_transactions.html index 613e5837..14b5a1e9 100644 --- a/report-api/report-templates/statement_transactions.html +++ b/report-api/report-templates/statement_transactions.html @@ -2,15 +2,16 @@ @@ -18,36 +19,40 @@ {% if invoices %}
-
+
Transactions
+ {% set filtered_invoices = invoices|selectattr("payment_method", "equalto", payment_method)|list %}
- Number of Transactions: {{invoices|length}} + Number of Transactions: {{filtered_invoices|length}}
- - - - - - - + + + + + + - {% for item in invoices %} + {% set totals = namespace(total=0, fees=0) %} + {% for invoice in invoices if invoice.payment_method == payment_method %} + - - - - - - + + + + + + + + + + + {% set totals.total = totals.total + invoice.total %} {% endfor %}
Product PurchasedFolioDateFeeGSTService ChargeTotalProduct PurchasedDateFeeGSTService FeeTotal
- {% for lineItemProduct in item.line_items %} -
{{'(Cancelled) ' if (item.status_code == 'CANCELLED') else ''}}{{lineItemProduct.description}}
+ {% for lineItemProduct in invoice.line_items %} +
{{'(Cancelled) ' if (invoice.status_code == 'CANCELLED') else ''}}{{lineItemProduct.description}}
{% endfor %} - {% if item.details and item.details|length > 0 %} + {% if invoice.details and invoice.details|length > 0 %}
- {% for detail in item.details %} + {% for detail in invoice.details %}
{{detail.label}} {{detail.value}}
{% endfor %}
{% endif %}
{{item.get('folio_number', '-')}}{{item.created_on | format_datetime('mmm dd,yyyy')}}${{"%.2f"|format((item.total - item.service_fees)) if (item.service_fees and item.total) else - '0.00'}} - ${{"%.2f"|format(item.gst) if item.gst else '0.00'}}${{"%.2f"|format(item.service_fees) if item.service_fees else '0.00'}}${{"%.2f"|format(item.total) if item.total else '0.00'}}{{invoice.created_on | format_datetime('mmm dd,yyyy')}}${{"%.2f"|format((invoice.total - invoice.service_fees)) if (invoice.service_fees and invoice.total) else '0.00'}}${{"%.2f"|format(invoice.gst) if invoice.gst else '0.00'}}${{"%.2f"|format(invoice.service_fees) if invoice.service_fees else '0.00'}}${{"%.2f"|format(invoice.total) if invoice.total else '0.00'}}
@@ -60,12 +65,12 @@ - {% if statement.payment_methods[0] == 'EFT' %} + {% if payment_method == 'EFT' %}
Statement Total: - ${{"{:,.2f}".format(total.fees)}} + ${{"{:,.2f}".format(totals.total)}}
@@ -73,9 +78,7 @@
Last Statement Total: - - ${{"{:,.2f}".format(statementSummary.lastStatementTotal)}} - + ${{"{:,.2f}".format(statementSummary.lastStatementTotal)}}
@@ -83,9 +86,7 @@
Payment Received for Last Statement: - - -${{"{:,.2f}".format(statementSummary.lastStatementPaidAmount)}} - + -${{"{:,.2f}".format(statementSummary.lastStatementPaidAmount)}}
@@ -94,7 +95,7 @@
Cancelled Transactions: - -${{ "{:,.2f}".format(statementSummary.cancelledTransactions) }} + -${{ "{:,.2f}".format(statementSummary.cancelledTransactions) }}
@@ -105,10 +106,10 @@
Total Amount Paid: - ${{ "{:,.2f}".format(total.paid) if total.paid else '0.00' }} + ${{ "{:,.2f}".format(total.paid) if total.paid else '0.00' }}
{% if statementSummary.latestStatementPaymentDate %} -
Paid on {{ statementSummary.latestStatementPaymentDate | format_datetime('mmm dd,yyyy') }}
+
Paid on {{ statementSummary.latestStatementPaymentDate | format_datetime('detail') }}
{% endif %} @@ -117,7 +118,7 @@
Total Amount Owing: - ${{ "{:,.2f}".format(total.due) if total.due else '0.00' }} + ${{ "{:,.2f}".format(total.due) if total.due else '0.00' }}
{% if not statement.is_interim_statement %}
Payment Due Date: {{ statementSummary.dueDate | format_datetime('mmm dd,yyyy') }}
@@ -125,59 +126,28 @@ {% else %} - {% if total.statutoryFees %} - - -
- Transaction Fees: - ${{"%.2f"|format(total.statutoryFees)}} -
- - - {% endif %} - {% if total.gst %} - - -
- Goods & Services Tax (GST): - ${{"%.2f"|format(total.gst)}} -
- - - {% endif %} - {% if total.serviceFees %} - - -
- Service Charges: - ${{"%.2f"|format(total.serviceFees)}} -
- - - {% endif %} {% if total.fees %}
Total Amount: - ${{"%.2f"|format(total.fees)}} + ${{"{:,.2f}".format(totals.total)}}
{% endif %} - {% if total.paid is number%} + {% set total_paid = invoices|selectattr("payment_method", "equalto", payment_method)|sum(attribute='paid') %}
Total Amount Paid: - ${{"%.2f"|format(total.paid)}} + ${{"%.2f"|format(total_paid)}}
- {% endif %} -
+
Total Amount Due: ${{"%.2f"|format(total.due) if total.due else '0.00'}}
@@ -194,7 +164,11 @@ alt="BC registries Logo" class="logo2">
@@ -212,7 +186,11 @@ alt="BC registries Logo" class="logo2">