Skip to content

Commit

Permalink
24174 - Supporting multiple payment methods on statement (#96)
Browse files Browse the repository at this point in the history
* Supporting multiple payment methods on statement

* further payment_method support

* check for staff payments
  • Loading branch information
rodrigo-barraza authored Dec 10, 2024
1 parent 816c404 commit 86a9048
Show file tree
Hide file tree
Showing 5 changed files with 524 additions and 569 deletions.
26 changes: 0 additions & 26 deletions report-api/report-templates/eft/eft_statement_details.html

This file was deleted.

30 changes: 30 additions & 0 deletions report-api/report-templates/statement_details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<table class="statement-details">
<tbody>
<tr>
<td colspan="2">
<div>
<div><span class="font-bold">Account Number:</span> {{ account.id }}</div>
{% if statement.is_interim_statement %}
{% set total_paid = invoices|selectattr("payment_method", "equalto", payment_method)|sum(attribute='paid') %}
<div><span class="font-bold">Total Amount Paid:</span> <span class="font-bold">${{ "{:,.2f}".format(total_paid)}}</span></div>
{% endif %}
{% if statement.is_interim_statement and payment_method_index.value == 0 %}
<div><span class="font-bold">Total Amount Owing:</span> <span class="font-bold">${{ "{:,.2f}".format(total.due) if total.due else '0.00' }}</span></div>
<div><span class="font-bold">Payment Received Date:</span>
{% if statementSummary.latestStatementPaymentDate %}
{{statementSummary.latestStatementPaymentDate | format_datetime('detail')}}
{% endif %}
</div>
{% else %}
{% if not statement.is_interim_statement and payment_method_index.value == 0 %}
<div><span class="font-bold">Payment Due Date:</span> {{statementSummary.dueDate | format_datetime('mmm dd,yyyy')}}</div>
{% endif %}
{% endif %}
{% if payment_method_index.value == 0 %}
<div><span class="font-bold">Statement Number:</span> {{statement.id}}</div>
{% endif %}
</div>
</td>
</tr>
</tbody>
</table>
123 changes: 42 additions & 81 deletions report-api/report-templates/statement_header.html

Large diffs are not rendered by default.

794 changes: 403 additions & 391 deletions report-api/report-templates/statement_report.html

Large diffs are not rendered by default.

120 changes: 49 additions & 71 deletions report-api/report-templates/statement_transactions.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,57 @@
<table>
<tr>
<td colspan="2">
<div class="section-title">
<div class="section-title no-border">
Transactions
</div>
</td>
</tr>
<tr>
<td colspan="2">
{% set filtered_invoices = invoices|selectattr("payment_method", "equalto", payment_method)|list %}
<div class="section-subtitle">
Number of Transactions: {{invoices|length}}
Number of Transactions: {{filtered_invoices|length}}
</div>
</td>
</tr>
</table>
{% if invoices %}
<table class="transaction-table">
<thead>
<th>Product Purchased</th>
<th>Folio</th>
<th class="two-line-head" style="width: 96px;">Date</th>
<th>Fee</th>
<th>GST</th>
<th class="two-line-head" style="width: 45px;">Service Charge</th>
<th>Total</th>
<th style="width: 120px;">Product Purchased</th>
<th class="two-line-head" style="width: 120px;">Date</th>
<th style="width: 60px;">Fee</th>
<th style="width: 60px;">GST</th>
<th class="two-line-head" style="width: 70px;">Service Fee</th>
<th style="width: 40px;">Total</th>
</thead>
{% for item in invoices %}
{% set totals = namespace(total=0, fees=0) %}
{% for invoice in invoices if invoice.payment_method == payment_method %}
<tr>
<!-- Product Name -->
<td class="product-purchased">
{% for lineItemProduct in item.line_items %}
<div class="font-bold">{{'(Cancelled) ' if (item.status_code == 'CANCELLED') else ''}}{{lineItemProduct.description}}</div>
{% for lineItemProduct in invoice.line_items %}
<div class="font-bold">{{'(Cancelled) ' if (invoice.status_code == 'CANCELLED') else ''}}{{lineItemProduct.description}}</div>
{% endfor %}
{% if item.details and item.details|length > 0 %}
{% if invoice.details and invoice.details|length > 0 %}
<div class="transaction-details">
{% for detail in item.details %}
{% for detail in invoice.details %}
<div>{{detail.label}} {{detail.value}}</div>
{% endfor %}
</div>
{% endif %}
</td>
<td>{{item.get('folio_number', '-')}}</td>
<td>{{item.created_on | format_datetime('mmm dd,yyyy')}}</td>
<td>${{"%.2f"|format((item.total - item.service_fees)) if (item.service_fees and item.total) else
'0.00'}}
</td>
<td>${{"%.2f"|format(item.gst) if item.gst else '0.00'}}</td>
<td>${{"%.2f"|format(item.service_fees) if item.service_fees else '0.00'}}</td>
<td class="font-bold">${{"%.2f"|format(item.total) if item.total else '0.00'}}</td>
<!-- Date -->
<td>{{invoice.created_on | format_datetime('mmm dd,yyyy')}}</td>
<!-- Fee -->
<td>${{"%.2f"|format((invoice.total - invoice.service_fees)) if (invoice.service_fees and invoice.total) else '0.00'}}</td>
<!-- GST -->
<td>${{"%.2f"|format(invoice.gst) if invoice.gst else '0.00'}}</td>
<!-- Service Fee -->
<td>${{"%.2f"|format(invoice.service_fees) if invoice.service_fees else '0.00'}}</td>
<!-- Grand Total -->
<td>${{"%.2f"|format(invoice.total) if invoice.total else '0.00'}}</td>
{% set totals.total = totals.total + invoice.total %}
</tr>
{% endfor %}
</table>
Expand All @@ -60,32 +65,28 @@
</div>
</td>
</tr>
{% if statement.payment_methods[0] == 'EFT' %}
{% if payment_method == 'EFT' %}
<tr>
<td colspan="2">
<div class="total-elements font-bold">
Statement Total:
<span class="total">${{"{:,.2f}".format(total.fees)}}</span>
<span class="total-elements-price font-bold">${{"{:,.2f}".format(totals.total)}}</span>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="total-elements">
Last Statement Total:
<span class="total">
${{"{:,.2f}".format(statementSummary.lastStatementTotal)}}
</span>
<span class="total-elements-price">${{"{:,.2f}".format(statementSummary.lastStatementTotal)}}</span>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="total-elements">
Payment Received for Last Statement:
<span class="total">
-${{"{:,.2f}".format(statementSummary.lastStatementPaidAmount)}}
</span>
<span class="total-elements-price">-${{"{:,.2f}".format(statementSummary.lastStatementPaidAmount)}}</span>
</div>
</td>
</tr>
Expand All @@ -94,7 +95,7 @@
<td colspan="2">
<div class="total-elements">
Cancelled Transactions:
<span class="total">-${{ "{:,.2f}".format(statementSummary.cancelledTransactions) }}</span>
<span class="total-elements-price">-${{ "{:,.2f}".format(statementSummary.cancelledTransactions) }}</span>
</div>
</td>
</tr>
Expand All @@ -105,10 +106,10 @@
<td colspan="2">
<div class="total-elements font-bold" style="border-bottom: none;">
Total Amount Paid:
<span class="total">${{ "{:,.2f}".format(total.paid) if total.paid else '0.00' }}</span>
<span class="total-elements-price font-bold">${{ "{:,.2f}".format(total.paid) if total.paid else '0.00' }}</span>
</div>
{% if statementSummary.latestStatementPaymentDate %}
<div class="font-14">Paid on {{ statementSummary.latestStatementPaymentDate | format_datetime('mmm dd,yyyy') }} </div>
<div class="total-elements font-14" style="border-bottom: none;">Paid on {{ statementSummary.latestStatementPaymentDate | format_datetime('detail') }}</div>
{% endif %}
</td>
</tr>
Expand All @@ -117,67 +118,36 @@
<td colspan="2">
<div class="total-elements font-bold" style="border-bottom: none;">
Total Amount Owing:
<span class="total">${{ "{:,.2f}".format(total.due) if total.due else '0.00' }}</span>
<span class="total-elements-price font-bold">${{ "{:,.2f}".format(total.due) if total.due else '0.00' }}</span>
</div>
{% if not statement.is_interim_statement %}
<div class="total-elements font-14" style="border-bottom: none;">Payment Due Date: {{ statementSummary.dueDate | format_datetime('mmm dd,yyyy') }}</div>
{% endif %}
</td>
</tr>
{% else %}
{% if total.statutoryFees %}
<tr>
<td colspan="2">
<div class="total-elements">
Transaction Fees:
<span class="total-elements-price font-bold">${{"%.2f"|format(total.statutoryFees)}}</span>
</div>
</td>
</tr>
{% endif %}
{% if total.gst %}
<tr>
<td colspan="2">
<div class="total-elements">
Goods & Services Tax (GST):
<span class="total-elements-price font-bold">${{"%.2f"|format(total.gst)}}</span>
</div>
</td>
</tr>
{% endif %}
{% if total.serviceFees %}
<tr>
<td colspan="2">
<div class="total-elements">
Service Charges:
<span class="total-elements-price font-bold">${{"%.2f"|format(total.serviceFees)}}</span>
</div>
</td>
</tr>
{% endif %}
{% if total.fees %}
<tr>
<td colspan="2">
<div class="total-elements font-bold">
Total Amount:
<span class="total-elements-price">${{"%.2f"|format(total.fees)}}</span>
<span class="total-elements-price font-bold">${{"{:,.2f}".format(totals.total)}}</span>
</div>
</td>
</tr>
{% endif %}
{% if total.paid is number%}
{% set total_paid = invoices|selectattr("payment_method", "equalto", payment_method)|sum(attribute='paid') %}
<tr>
<td colspan="2">
<div class="total-elements font-bold">
Total Amount Paid:
<span class="total-elements-price">${{"%.2f"|format(total.paid)}}</span>
<span class="total-elements-price font-bold">${{"%.2f"|format(total_paid)}}</span>
</div>
</td>
</tr>
{% endif %}
<tr>
<td colspan="2">
<div class="total-elements font-bold" style="border-bottom: none;">
<div class="total-elements" style="border-bottom: none;">
Total Amount Due:
<span class="total-elements-price">${{"%.2f"|format(total.due) if total.due else '0.00'}}</span>
</div>
Expand All @@ -194,7 +164,11 @@
alt="BC registries Logo" class="logo2">
</div>
<div class="footer-info">
<span>Statement #{{statement.id}}</span>
{% if statement.is_interim_statement %}
<span>Interim Account Statement #{{statement.id}}</span>
{% else %}
<span>Account Statement #{{statement.id}}</span>
{% endif %}
<pageinfo>Page i of x</pageinfo>
</div>
</td>
Expand All @@ -212,7 +186,11 @@
alt="BC registries Logo" class="logo2">
</div>
<div class="footer-info">
<span>Statement #{{statement.id}}</span>
{% if statement.is_interim_statement %}
<span>Interim Account Statement #{{statement.id}}</span>
{% else %}
<span>Account Statement #{{statement.id}}</span>
{% endif %}
<pageinfo>Page i of x</pageinfo>
</div>
</td>
Expand Down

0 comments on commit 86a9048

Please sign in to comment.