Skip to content

Commit

Permalink
feat: ORV2-1562 Financial Reports - Detailed and Summary (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
praju-aot authored Nov 28, 2023
1 parent 589a3a0 commit 86ad992
Show file tree
Hide file tree
Showing 18 changed files with 978 additions and 775 deletions.
6 changes: 6 additions & 0 deletions dops/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dops/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"cache-manager": "^5.2.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"dayjs": "^1.11.8",
"dotenv": "^16.1.4",
"handlebars": "^4.7.8",
"jwks-rsa": "^3.0.1",
Expand Down
3 changes: 2 additions & 1 deletion dops/src/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Inject, Injectable } from '@nestjs/common';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { Cache } from 'cache-manager';
import { DgenService } from './modules/dgen/dgen.service';

import { CacheKey } from './enum/cache-key.enum';
import { DocumentTemplate } from './modules/dgen/entities/document-template.entity';
import { DmsService } from './modules/dms/dms.service';
Expand All @@ -11,6 +11,7 @@ import { S3Service } from './modules/common/s3.service';
import { createFile } from './helper/file.helper';
import { addToCache } from './helper/cache.helper';
import * as fs from 'fs';
import { DgenService } from './modules/dgen/dgen.service';

@Injectable()
export class AppService {
Expand Down
175 changes: 92 additions & 83 deletions dops/src/assets/templates/payment-refund-detailed.report.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,37 @@
</thead>
<tbody>
{{#each payments}}
{{#if this.subTotalAmount}}

<tr class="table-row">
<td class="table-cell issued-on">
<p>{{convertUtcToPt this.issuedOn}}</p>
</td>
<td class="table-cell provider-transaction-id">
<p>{{this.providerTransactionId}}</p>
</td>
<td class="table-cell orbc-transaction-id">
<p>{{this.orbcTransactionId}}</p>
</td>
<td class="table-cell payment-method">
<p>{{this.paymentMethod}}</p>
</td>
<td class="table-cell receipt-number">
<p>{{this.receiptNo}}</p>
</td>
<td class="table-cell permit-number">
<p>{{this.permitNo}}</p>
</td>
<td class="table-cell permit-type">
<p>{{this.permitType}}</p>
</td>
<td class="table-cell user">
<p>{{this.users}}</p>
</td>
<td class="table-cell amount table-cell-right">
<p>{{formatAmount this.amount}}</p>
</td>
</tr>
{{#displayPaymentMethodSubTotal 'payment'}}
<tr class="table-row">
<td class="table-cell table-cell-background issued-on">
</td>
Expand All @@ -295,10 +325,12 @@
<td class="table-cell table-cell-background user">
</td>
<td class="table-cell table-cell-background amount table-cell-right bold">
<p>${{this.subTotalAmount}}</p>
<p>{{formatAmount (amountLookup ../summaryPaymentsAndRefunds this.paymentMethod 'payment')}}</p>
</td>

</tr>
{{else if this.totalAmount}}
{{/displayPaymentMethodSubTotal}}
{{#if @last}}
<tr class="table-row"></tr>
<tr class="table-row">
<td class="table-cell table-cell-background issued-on">
Expand All @@ -319,37 +351,10 @@
<td class="table-cell table-cell-background user">
</td>
<td class="table-cell table-cell-background amount table-cell-right bold">
<p style="font-size:10.0pt">${{this.totalAmount}}</p>
</td>
</tr>
{{else}}
<tr class="table-row">
<td class="table-cell issued-on">
<p>{{this.issuedOn}}</p>
</td>
<td class="table-cell provider-transaction-id">
<p>{{this.providerTransactionId}}</p>
</td>
<td class="table-cell orbc-transaction-id">
<p>{{this.orbcTransactionId}}</p>
</td>
<td class="table-cell payment-method">
<p>{{this.paymentMethod}}</p>
</td>
<td class="table-cell receipt-number">
<p>{{this.receiptNo}}</p>
</td>
<td class="table-cell permit-number">
<p>{{this.permitNo}}</p>
</td>
<td class="table-cell permit-type">
<p>{{this.permitType}}</p>
</td>
<td class="table-cell user">
<p>{{this.user}}</p>
</td>
<td class="table-cell amount table-cell-right">
<p>${{this.amount}}</p>
<p style="font-size:10.0pt">{{formatAmount (amountLookup ../summaryPaymentsAndRefunds
this.paymentMethod
'totalPayment')}}
</p>
</td>
</tr>
{{/if}}
Expand Down Expand Up @@ -402,31 +407,37 @@
</thead>
<tbody>
{{#each refunds}}
{{#if this.subTotalAmount}}
<tr class="table-row">
<td class="table-cell table-cell-background issued-on">
<td class="table-cell issued-on">
<p>{{convertUtcToPt this.issuedOn}}</p>
</td>
<td class="table-cell table-cell-background provider-transaction-id">
<td class="table-cell provider-transaction-id">
<p>{{this.providerTransactionId}}</p>
</td>
<td class="table-cell table-cell-background orbc-transaction-id">
<td class="table-cell orbc-transaction-id">
<p>{{this.orbcTransactionId}}</p>
</td>
<td class="table-cell table-cell-background payment-method bold">
<p>SUB TOTAL</p>
<td class="table-cell payment-method">
<p>{{this.paymentMethod}}</p>
</td>
<td class="table-cell table-cell-background receipt-number">
<td class="table-cell receipt-number">
<p>{{this.receiptNo}}</p>
</td>
<td class="table-cell table-cell-background permit-number">
<td class="table-cell permit-number">
<p>{{this.permitNo}}</p>
</td>
<td class="table-cell table-cell-background permit-type">
<td class="table-cell permit-type">
<p>{{this.permitType}}</p>
</td>
<td class="table-cell table-cell-background user">
<td class="table-cell user">
<p>{{this.users}}</p>
</td>
<td class="table-cell table-cell-background amount table-cell-right bold">
<p>-${{this.subTotalAmount}}</p>
<td class="table-cell amount table-cell-right">
<p>{{formatRefundAmount this.amount}}</p>
</td>
</tr>
{{else if this.totalAmount}}
<tr class="table-row"></tr>

{{#displayPaymentMethodSubTotal 'refund'}}
<tr class="table-row">
<td class="table-cell table-cell-background issued-on">
</td>
Expand All @@ -435,7 +446,7 @@
<td class="table-cell table-cell-background orbc-transaction-id">
</td>
<td class="table-cell table-cell-background payment-method bold">
<p style="font-size:10.0pt">TOTAL REFUNDS</p>
<p>SUB TOTAL</p>
</td>
<td class="table-cell table-cell-background receipt-number">
</td>
Expand All @@ -446,49 +457,48 @@
<td class="table-cell table-cell-background user">
</td>
<td class="table-cell table-cell-background amount table-cell-right bold">
<p style="font-size:10.0pt">-${{this.totalAmount}}</p>
<p>{{formatRefundAmount (amountLookup ../summaryPaymentsAndRefunds this.paymentMethod 'refund')}}
</p>
</td>

</tr>
{{else}}
{{/displayPaymentMethodSubTotal}}
{{#if @last}}
<tr class="table-row"></tr>
<tr class="table-row">
<td class="table-cell issued-on">
<p>{{this.issuedOn}}</p>
<td class="table-cell table-cell-background issued-on">
</td>
<td class="table-cell provider-transaction-id">
<p>{{this.providerTransactionId}}</p>
<td class="table-cell table-cell-background provider-transaction-id">
</td>
<td class="table-cell orbc-transaction-id">
<p>{{this.orbcTransactionId}}</p>
<td class="table-cell table-cell-background orbc-transaction-id">
</td>
<td class="table-cell payment-method">
<p>{{this.paymentMethod}}</p>
<td class="table-cell table-cell-background payment-method bold">
<p style="font-size:10.0pt">TOTAL AMOUNT</p>
</td>
<td class="table-cell receipt-number">
<p>{{this.receiptNo}}</p>
<td class="table-cell table-cell-background receipt-number">
</td>
<td class="table-cell permit-number">
<p>{{this.permitNo}}</p>
<td class="table-cell table-cell-background permit-number">
</td>
<td class="table-cell permit-type">
<p>{{this.permitType}}</p>
<td class="table-cell table-cell-background permit-type">
</td>
<td class="table-cell user">
<p>{{this.user}}</p>
<td class="table-cell table-cell-background user">
</td>
<td class="table-cell amount table-cell-right">
<p>-${{this.amount}}</p>
<td class="table-cell table-cell-background amount table-cell-right bold">
<p style="font-size:10.0pt">{{formatRefundAmount (amountLookup ../summaryPaymentsAndRefunds
this.paymentMethod
'totalRefund')}}
</p>
</td>
</tr>
{{/if}}
{{/each}}

</tbody>
</table>
{{/if}}
</div>


{{#if summaryPayments}}
{{#if summaryPaymentsAndRefunds}}
<div style="page-break-before: always;">
<table class="table">
<thead>
Expand All @@ -508,24 +518,23 @@
</tr>
</thead>
<tbody>
{{#each summaryPayments}}
{{#if this.subTotalPaymentAmount}}
{{#each summaryPaymentsAndRefunds}}
{{#if @last}}
<tr class="table-row">
<td class="table-cell table-cell-background summary-payment-payment-method bold">
<p>TOTAL</p>
</td>
<td class="table-cell table-cell-background summary-payment-payment table-cell-right bold">
<p>${{this.subTotalPaymentAmount}}</p>
<p>{{formatAmount this.payment}}</p>
</td>

<td class="table-cell table-cell-background summary-payment-refund table-cell-right bold">
<p>-${{this.subTotalRefundAmount}}</p>
<p>{{formatAmount this.refund}}</p>
</td>
<td class="table-cell table-cell-background summary-payment-deposit table-cell-right bold">
<p>${{this.subTotalDepositAmount}}</p>
<p>{{formatAmount this.deposit}}</p>
</td>
</tr>
{{else if this.grandTotalAmount}}
<tr class="table-row"></tr>
<tr class="table-row">
<td class="table-cell table-cell-background summary-payment-payment-method bold">
Expand All @@ -536,7 +545,7 @@
<td class="table-cell table-cell-background summary-payment-refund">
</td>
<td class="table-cell table-cell-background summary-payment-deposit table-cell-right bold">
<p style="font-size:10.0pt">${{this.grandTotalAmount}}</p>
<p style="font-size:10.0pt">{{formatAmount this.deposit}}</p>
</td>
</tr>
{{else}}
Expand All @@ -545,13 +554,13 @@
<p>{{this.paymentMethod}}</p>
</td>
<td class="table-cell table-cell-right table-cell-bottom-border summary-payment-payment">
<p>${{this.payment}}</p>
<p>{{formatAmount this.payment}}</p>
</td>
<td class="table-cell table-cell-right table-cell-bottom-border summary-payment-refund">
<p>-${{this.refund}}</p>
<p>{{formatAmount this.refund}}</p>
</td>
<td class="table-cell table-cell-right table-cell-bottom-border summary-payment-deposit">
<p>${{this.deposit}}</p>
<p>{{formatAmount this.deposit}}</p>
</td>
</tr>
{{/if}}
Expand Down Expand Up @@ -579,15 +588,15 @@
</thead>
<tbody>
{{#each summaryPermits}}
{{#if this.totalPermits}}
{{#if @last}}
<tr class="table-row"></tr>
<tr class="table-row"></tr>
<tr class="table-row">
<td class="table-cell table-cell-background summary-permit-permit-type bold">
<p style="font-size:10.0pt">TOTAL PERMITS</p>
</td>
<td class="table-cell table-cell-background summary-permit-count table-cell-right">
<p style="font-size:10.0pt">{{this.totalPermits}}</p>
<p style="font-size:10.0pt">{{this.permitCount}}</p>
</td>
</tr>
{{else}}
Expand Down
Loading

0 comments on commit 86ad992

Please sign in to comment.