@sachin9822/reports-lib 0.0.213 → 0.0.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.mjs +240 -0
- package/esm2020/lib/components/accounting-report/accounting-report.component.mjs +596 -0
- package/esm2020/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.mjs +218 -0
- package/esm2020/lib/components/branch-activity-send-report/branch-activity-send-report.component.mjs +243 -0
- package/esm2020/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.mjs +700 -0
- package/esm2020/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.mjs +255 -0
- package/esm2020/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.mjs +192 -0
- package/esm2020/lib/components/funding-report/funding-report.component.mjs +198 -0
- package/esm2020/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.mjs +244 -0
- package/esm2020/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.mjs +776 -0
- package/esm2020/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.mjs +266 -0
- package/esm2020/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.mjs +311 -0
- package/esm2020/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.mjs +658 -0
- package/esm2020/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.mjs +2 -0
- package/esm2020/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.mjs +2 -0
- package/esm2020/lib/models/accounting-report/accounting-report-branch-group.mjs +2 -0
- package/esm2020/lib/models/accounting-report/accounting-report-entry-model.mjs +2 -0
- package/esm2020/lib/models/accounting-report/accounting-report-model.mjs +2 -0
- package/esm2020/lib/models/accounting-report/accounting-report-sub-group.mjs +2 -0
- package/esm2020/lib/models/app-config.model.mjs +2 -0
- package/esm2020/lib/models/branch-activity-receive-report/branch-activity-receive.model.mjs +2 -0
- package/esm2020/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.mjs +6 -0
- package/esm2020/lib/models/branch-activity-report/branch-activity-send-report.mjs +3 -0
- package/esm2020/lib/models/cancellation-transaction-report/cancellation-transaction.model.mjs +10 -0
- package/esm2020/lib/models/component-loading-states.mjs +7 -0
- package/esm2020/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.mjs +5 -0
- package/esm2020/lib/models/revenue-per-transaction-report/revenue-per-transaction.model.mjs +2 -0
- package/esm2020/lib/models/statement-of-account-report/statement-of-accounts.model.mjs +2 -0
- package/esm2020/lib/models/transaction-enquiry-report/transaction-enquiry.model.mjs +8 -0
- package/esm2020/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.mjs +6 -0
- package/esm2020/lib/models/transaction-monitoring-report/transaction-monitoring-report.mjs +5 -0
- package/esm2020/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.mjs +3 -0
- package/esm2020/lib/reports-lib-routing.module.mjs +24 -0
- package/esm2020/lib/reports-lib.component.mjs +22 -0
- package/esm2020/lib/reports-lib.module.mjs +172 -0
- package/esm2020/lib/reports-lib.service.mjs +14 -0
- package/esm2020/lib/services/config.service.mjs +39 -0
- package/esm2020/lib/services/report.service.mjs +374 -0
- package/esm2020/lib/shared/export-generic.service.mjs +443 -0
- package/esm2020/lib/shared/export.service.mjs +379 -0
- package/esm2020/lib/shared/loader/loader.component.mjs +11 -0
- package/esm2020/lib/shared/metadata/metadata.component.mjs +51 -0
- package/esm2020/lib/shared/page-size-selector/page-size-selector.component.mjs +44 -0
- package/esm2020/lib/shared/search-filter/search-filter.component.mjs +2134 -0
- package/esm2020/lib/shared/shared.module.mjs +21 -0
- package/esm2020/public-api.mjs +41 -0
- package/esm2020/sachin9822-reports-lib.mjs +5 -0
- package/fesm2015/sachin9822-reports-lib.mjs +8429 -0
- package/fesm2015/sachin9822-reports-lib.mjs.map +1 -0
- package/fesm2020/sachin9822-reports-lib.mjs +8411 -0
- package/fesm2020/sachin9822-reports-lib.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.d.ts +70 -0
- package/lib/components/accounting-report/accounting-report.component.d.ts +76 -0
- package/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.d.ts +58 -0
- package/lib/components/branch-activity-send-report/branch-activity-send-report.component.d.ts +69 -0
- package/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.d.ts +78 -0
- package/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.d.ts +95 -0
- package/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.d.ts +55 -0
- package/lib/components/funding-report/funding-report.component.d.ts +55 -0
- package/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.d.ts +57 -0
- package/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.d.ts +109 -0
- package/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.d.ts +76 -0
- package/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.d.ts +68 -0
- package/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.d.ts +72 -0
- package/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.d.ts +8 -0
- package/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.d.ts +18 -0
- package/lib/models/accounting-report/accounting-report-branch-group.d.ts +6 -0
- package/lib/models/accounting-report/accounting-report-entry-model.d.ts +24 -0
- package/lib/models/accounting-report/accounting-report-model.d.ts +6 -0
- package/{src/lib/models/accounting-report/accounting-report-sub-group.ts → lib/models/accounting-report/accounting-report-sub-group.d.ts} +2 -3
- package/{src/lib/models/app-config.model.ts → lib/models/app-config.model.d.ts} +7 -8
- package/lib/models/branch-activity-receive-report/branch-activity-receive.model.d.ts +18 -0
- package/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.d.ts +13 -0
- package/lib/models/branch-activity-report/branch-activity-send-report.d.ts +24 -0
- package/lib/models/cancellation-transaction-report/cancellation-transaction.model.d.ts +44 -0
- package/lib/models/component-loading-states.d.ts +5 -0
- package/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.d.ts +26 -0
- package/{src/lib/models/revenue-per-transaction-report/revenue-per-transaction.model.ts → lib/models/revenue-per-transaction-report/revenue-per-transaction.model.d.ts} +1 -1
- package/lib/models/statement-of-account-report/statement-of-accounts.model.d.ts +18 -0
- package/lib/models/transaction-enquiry-report/transaction-enquiry.model.d.ts +113 -0
- package/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.d.ts +13 -0
- package/lib/models/transaction-monitoring-report/transaction-monitoring-report.d.ts +23 -0
- package/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.d.ts +39 -0
- package/lib/reports-lib-routing.module.d.ts +7 -0
- package/lib/reports-lib.component.d.ts +8 -0
- package/lib/reports-lib.module.d.ts +33 -0
- package/lib/reports-lib.service.d.ts +6 -0
- package/lib/services/config.service.d.ts +20 -0
- package/lib/services/report.service.d.ts +80 -0
- package/lib/shared/export-generic.service.d.ts +50 -0
- package/lib/shared/export.service.d.ts +32 -0
- package/lib/shared/loader/loader.component.d.ts +5 -0
- package/lib/shared/metadata/metadata.component.d.ts +24 -0
- package/lib/shared/page-size-selector/page-size-selector.component.d.ts +15 -0
- package/lib/shared/search-filter/search-filter.component.d.ts +127 -0
- package/lib/shared/shared.module.d.ts +11 -0
- package/package.json +31 -16
- package/{src/public-api.ts → public-api.d.ts} +7 -17
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -17
- package/src/assets/images/BreadcrumbArrow.png +0 -0
- package/src/assets/images/XMCoral.png +0 -0
- package/src/lib/assets/images/Search.svg +0 -10
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.html +0 -27
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.scss +0 -46
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.spec.ts +0 -23
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.ts +0 -292
- package/src/lib/components/accounting-report/accounting-report.component.html +0 -64
- package/src/lib/components/accounting-report/accounting-report.component.scss +0 -24
- package/src/lib/components/accounting-report/accounting-report.component.spec.ts +0 -23
- package/src/lib/components/accounting-report/accounting-report.component.ts +0 -738
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.html +0 -46
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.scss +0 -2
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.spec.ts +0 -23
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.ts +0 -247
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.html +0 -46
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.scss +0 -3
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.spec.ts +0 -23
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.ts +0 -276
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.html +0 -51
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.scss +0 -7
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.spec.ts +0 -23
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.ts +0 -840
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.html +0 -68
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.scss +0 -65
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.spec.ts +0 -23
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.ts +0 -290
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.html +0 -25
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.scss +0 -1
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.spec.ts +0 -23
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.ts +0 -213
- package/src/lib/components/funding-report/funding-report.component.html +0 -49
- package/src/lib/components/funding-report/funding-report.component.scss +0 -1
- package/src/lib/components/funding-report/funding-report.component.spec.ts +0 -23
- package/src/lib/components/funding-report/funding-report.component.ts +0 -221
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.html +0 -26
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.scss +0 -1
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.spec.ts +0 -23
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.ts +0 -267
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.html +0 -95
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.scss +0 -54
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.spec.ts +0 -23
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.ts +0 -904
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.html +0 -49
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.scss +0 -2
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.spec.ts +0 -32
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.ts +0 -304
- package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.html +0 -46
- package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.scss +0 -7
- package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.ts +0 -343
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.html +0 -25
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.scss +0 -23
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.spec.ts +0 -23
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.ts +0 -745
- package/src/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.ts +0 -10
- package/src/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.ts +0 -20
- package/src/lib/models/accounting-report/accounting-report-branch-group.ts +0 -7
- package/src/lib/models/accounting-report/accounting-report-entry-model.ts +0 -25
- package/src/lib/models/accounting-report/accounting-report-model.ts +0 -7
- package/src/lib/models/branch-activity-receive-report/branch-activity-receive.model.ts +0 -18
- package/src/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.ts +0 -16
- package/src/lib/models/branch-activity-report/branch-activity-send-report.ts +0 -26
- package/src/lib/models/cancellation-transaction-report/cancellation-transaction.model.ts +0 -65
- package/src/lib/models/component-loading-states.ts +0 -5
- package/src/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.ts +0 -28
- package/src/lib/models/statement-of-account-report/statement-of-accounts.model.ts +0 -21
- package/src/lib/models/transaction-enquiry-report/transaction-enquiry.model.ts +0 -127
- package/src/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.ts +0 -16
- package/src/lib/models/transaction-monitoring-report/transaction-monitoring-report.ts +0 -29
- package/src/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.ts +0 -46
- package/src/lib/reports-lib-routing.module.ts +0 -20
- package/src/lib/reports-lib.component.spec.ts +0 -23
- package/src/lib/reports-lib.component.ts +0 -20
- package/src/lib/reports-lib.module.ts +0 -102
- package/src/lib/reports-lib.service.spec.ts +0 -16
- package/src/lib/reports-lib.service.ts +0 -9
- package/src/lib/services/config.service.ts +0 -43
- package/src/lib/services/report.service.spec.ts +0 -16
- package/src/lib/services/report.service.ts +0 -463
- package/src/lib/shared/export-generic.service.ts +0 -557
- package/src/lib/shared/export.service.spec.ts +0 -16
- package/src/lib/shared/export.service.ts +0 -457
- package/src/lib/shared/loader/loader.component.html +0 -8
- package/src/lib/shared/loader/loader.component.scss +0 -52
- package/src/lib/shared/loader/loader.component.ts +0 -10
- package/src/lib/shared/metadata/metadata.component.html +0 -42
- package/src/lib/shared/metadata/metadata.component.scss +0 -95
- package/src/lib/shared/metadata/metadata.component.spec.ts +0 -23
- package/src/lib/shared/metadata/metadata.component.ts +0 -38
- package/src/lib/shared/page-size-selector/page-size-selector.component.html +0 -7
- package/src/lib/shared/page-size-selector/page-size-selector.component.scss +0 -42
- package/src/lib/shared/page-size-selector/page-size-selector.component.spec.ts +0 -23
- package/src/lib/shared/page-size-selector/page-size-selector.component.ts +0 -38
- package/src/lib/shared/search-filter/search-filter.component.html +0 -601
- package/src/lib/shared/search-filter/search-filter.component.scss +0 -203
- package/src/lib/shared/search-filter/search-filter.component.spec.ts +0 -23
- package/src/lib/shared/search-filter/search-filter.component.ts +0 -2387
- package/src/lib/shared/shared.module.ts +0 -13
- package/src/styles/ag-grid-report-style.scss +0 -71
- package/src/styles/common-ag-grid-style.scss +0 -146
- package/src/styles/common-report-style.scss +0 -395
- package/src/styles/common-style.scss +0 -615
- package/src/test.ts +0 -27
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- /package/{src/lib → lib}/assets/config/app-config.json +0 -0
- /package/{src → lib}/assets/images/Search.svg +0 -0
- /package/{src/lib → lib}/assets/images/XMLogo.png +0 -0
- /package/{src/lib → lib}/assets/svg-loaders/blue-tail-spin.svg +0 -0
|
@@ -1,738 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { AccountingReportModel } from '../../models/accounting-report/accounting-report-model';
|
|
3
|
-
import { ColDef, ColumnApi, GridApi, GridReadyEvent } from 'ag-grid-community';
|
|
4
|
-
import { ReportService } from '../../services/report.service';
|
|
5
|
-
import { ExportService } from '../../shared/export.service';
|
|
6
|
-
import { formatDate } from '@angular/common';
|
|
7
|
-
import { ComponentLoadingStates } from '../../models/component-loading-states';
|
|
8
|
-
import { AccountingReportBranchGroup } from '../../models/accounting-report/accounting-report-branch-group';
|
|
9
|
-
import jsPDF from 'jspdf';
|
|
10
|
-
import 'jspdf-autotable';
|
|
11
|
-
import * as ExcelJS from 'exceljs';
|
|
12
|
-
import * as FileSaver from 'file-saver';
|
|
13
|
-
|
|
14
|
-
declare module 'jspdf' {
|
|
15
|
-
interface jsPDF {
|
|
16
|
-
autoTable: (options: any) => jsPDF;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface AccountingReportRequest {
|
|
21
|
-
startDate: string;
|
|
22
|
-
endDate: string;
|
|
23
|
-
sendCountryCode: string;
|
|
24
|
-
recvCountryCode: string;
|
|
25
|
-
businessPartnerCorrelationID: string;
|
|
26
|
-
transactionStatus: string;
|
|
27
|
-
payoutCurrency: string;
|
|
28
|
-
transactionType: string;
|
|
29
|
-
branchCode: string;
|
|
30
|
-
companyCode: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@Component({
|
|
34
|
-
selector: 'lib-accounting-report',
|
|
35
|
-
templateUrl: './accounting-report.component.html',
|
|
36
|
-
styleUrls: ['./accounting-report.component.scss'],
|
|
37
|
-
})
|
|
38
|
-
export class AccountingReportComponent implements OnInit {
|
|
39
|
-
|
|
40
|
-
ReportName: string = "Accounting";
|
|
41
|
-
reportUser: any;
|
|
42
|
-
reportTime: any;
|
|
43
|
-
reportPeriod: any;
|
|
44
|
-
branchNameAndCode: any;
|
|
45
|
-
subGroupColumn: any;
|
|
46
|
-
ComponentLoadingState = ComponentLoadingStates;
|
|
47
|
-
loadingState: ComponentLoadingStates = ComponentLoadingStates.Complete;
|
|
48
|
-
noDataFound: boolean = false;
|
|
49
|
-
|
|
50
|
-
leftData: Record<string, string>;
|
|
51
|
-
rightData: Record<string, string>;
|
|
52
|
-
searchCriteria: [string, string][];
|
|
53
|
-
|
|
54
|
-
searchText: string = '';
|
|
55
|
-
rowData = [];
|
|
56
|
-
accountingReportModel: AccountingReportModel;
|
|
57
|
-
pageSize: number = 15;
|
|
58
|
-
|
|
59
|
-
selectedExportOption: string = 'excel';
|
|
60
|
-
exportFormats = [{ formatName: "Excel", code: 'excel' }, { formatName: "PDF", code: 'pdf' }, { formatName: "CSV", code: 'csv' }]
|
|
61
|
-
isFormValid: boolean = false;
|
|
62
|
-
|
|
63
|
-
defaultColDef: ColDef = {
|
|
64
|
-
resizable: true,
|
|
65
|
-
sortable: true,
|
|
66
|
-
filter: true,
|
|
67
|
-
minWidth: 40,
|
|
68
|
-
suppressSizeToFit: false,
|
|
69
|
-
cellStyle: { userSelect: 'text', 'line-height': '1.2', 'white-space': 'normal', 'word-break': 'normal', 'overflow-wrap': 'break-word' },
|
|
70
|
-
|
|
71
|
-
// Header wrapping
|
|
72
|
-
wrapHeaderText: true,
|
|
73
|
-
autoHeaderHeight: true,
|
|
74
|
-
|
|
75
|
-
// Cell wrapping
|
|
76
|
-
wrapText: true,
|
|
77
|
-
autoHeight: true
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
columnDefs: ColDef[] = [
|
|
81
|
-
{ headerName: 'BusinessDate', field: 'businessDate', tooltipField: 'businessDate' },
|
|
82
|
-
{ headerName: 'TxnDate&Time', field: 'transactionDateAndTime', tooltipField: 'transactionDateAndTime', minWidth: 110, },
|
|
83
|
-
{ headerName: 'Transaction Number', field: 'transactionNumber', tooltipField: 'transactionNumber' },
|
|
84
|
-
{ headerName: 'SendClient', field: 'sendClient', tooltipField: 'sendClient' },
|
|
85
|
-
{ headerName: 'Principle SendClient (If Applicable)', field: 'principleSendClient', tooltipField: 'principleSendClient', width: 90, minWidth: 80, maxWidth: 110 },
|
|
86
|
-
{ headerName: 'ReceiveClient', field: 'receiveClient', tooltipField: 'receiveClient' },
|
|
87
|
-
{ headerName: 'Principle ReceiveClient (If Applicable)', field: 'principleReceiveClient', tooltipField: 'principleReceiveClient', width: 100, minWidth: 90, maxWidth: 120 },
|
|
88
|
-
{ headerName: 'ReceiveCcy', field: 'receiveCurrency', tooltipField: 'receiveCurrency' },
|
|
89
|
-
{ headerName: 'AmountPaid', field: 'amountPaid', tooltipField: 'amountPaid', cellClass: 'ag-right-aligned-cell' },
|
|
90
|
-
{ headerName: 'SendCcy', field: 'sendCurrency', tooltipField: 'sendCurrency', },
|
|
91
|
-
{ headerName: 'ServiceFee', field: 'serviceFee', tooltipField: 'serviceFee', cellClass: 'ag-right-aligned-cell' },
|
|
92
|
-
{ headerName: 'Tax', field: 'tax', tooltipField: 'tax', cellClass: 'ag-right-aligned-cell' },
|
|
93
|
-
{ headerName: 'PrincipleSend Amount', field: 'principleSendAmount', tooltipField: 'principleSendAmount', cellClass: 'ag-right-aligned-cell' },
|
|
94
|
-
{ headerName: 'Transaction Status', field: 'transactionStatus', tooltipField: 'transactionStatus' },
|
|
95
|
-
{ headerName: 'SettlementCcy', field: 'settlementCurrency', tooltipField: 'settlementCurrency', cellClass: 'ag-right-aligned-cell' },
|
|
96
|
-
{ headerName: 'ClientSettl (in SCcy)', field: 'clientSettlementInSCcy', tooltipField: 'clientSettlementInSCcy', cellClass: 'ag-right-aligned-cell' },
|
|
97
|
-
{ headerName: 'ClientSettl (in USD)', field: 'clientSettlementInUSD', tooltipField: 'clientSettlementInUSD', cellClass: 'ag-right-aligned-cell' },
|
|
98
|
-
{ headerName: 'ShareType', field: 'shareType', tooltipField: 'shareType' },
|
|
99
|
-
{ headerName: 'ShareValue', field: 'shareValue', tooltipField: 'shareValue', cellClass: 'ag-right-aligned-cell' },
|
|
100
|
-
{ headerName: 'Send/Receive FeeCcy', field: 'sendReceiveFeeCcy', tooltipField: 'sendReceiveFeeCcy' },
|
|
101
|
-
{ headerName: 'ShareAmt (in USD)', field: 'shareAmountInUSD', tooltipField: 'shareAmountInUSD', cellClass: 'ag-right-aligned-cell' },
|
|
102
|
-
{ headerName: 'Settlement Rate', field: 'settlementRate', tooltipField: 'settlementRate', cellClass: 'ag-right-aligned-cell' },
|
|
103
|
-
];
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
gridApis: GridApi[] = [];
|
|
107
|
-
gridColumnApis: ColumnApi[] = [];
|
|
108
|
-
|
|
109
|
-
paginationArray: any[];
|
|
110
|
-
ezremitUser: boolean = false;
|
|
111
|
-
originalGroupEntries: AccountingReportBranchGroup[] = [];
|
|
112
|
-
|
|
113
|
-
constructor(private reportService: ReportService, private exportService: ExportService) { }
|
|
114
|
-
|
|
115
|
-
ngOnInit(): void {
|
|
116
|
-
const ezremitusername = sessionStorage.getItem('ezremitusername');
|
|
117
|
-
if (ezremitusername) {
|
|
118
|
-
this.ezremitUser = true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public getAccountingReport(request?: AccountingReportRequest) {
|
|
123
|
-
this.loadingState = ComponentLoadingStates.Loading;
|
|
124
|
-
this.accountingReportModel = undefined;
|
|
125
|
-
this.branchNameAndCode = undefined;
|
|
126
|
-
this.subGroupColumn = undefined;
|
|
127
|
-
const finalReq = request;
|
|
128
|
-
|
|
129
|
-
this.reportService.getAccountingReport(finalReq).subscribe(data => {
|
|
130
|
-
this.accountingReportModel = data;
|
|
131
|
-
this.loadingState = ComponentLoadingStates.Complete;
|
|
132
|
-
this.noDataFound = Object.keys(this.accountingReportModel.accountingReportByBranchGroups).length == 0 ? true : false;
|
|
133
|
-
const branchCount = this.accountingReportModel.accountingReportByBranchGroups.length;
|
|
134
|
-
this.paginationArray = new Array(branchCount * 2).fill(15);
|
|
135
|
-
|
|
136
|
-
this.reportUser = this.accountingReportModel.reportUser;
|
|
137
|
-
this.reportTime = formatDate(new Date(), 'dd/MM/yyyy hh:mm a', 'en-US');
|
|
138
|
-
this.reportPeriod = `${formatDate(finalReq.startDate, 'dd/MM/yyyy', 'en-US')} - ${formatDate(finalReq.endDate, 'dd/MM/yyyy', 'en-US')}`;
|
|
139
|
-
|
|
140
|
-
this.leftData = {
|
|
141
|
-
'Report Period': `${this.reportPeriod}`,
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
this.rightData = {
|
|
145
|
-
'Report User & Time': `${this.reportUser} @ ${this.reportTime}`,
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Deep copy to preserve original data for search
|
|
149
|
-
this.originalGroupEntries = this.accountingReportModel.accountingReportByBranchGroups.map(group => ({
|
|
150
|
-
...group,
|
|
151
|
-
sendTransactions: {
|
|
152
|
-
...group.sendTransactions,
|
|
153
|
-
entries: [...group.sendTransactions.entries]
|
|
154
|
-
},
|
|
155
|
-
receiveTransactions: {
|
|
156
|
-
...group.receiveTransactions,
|
|
157
|
-
entries: [...group.receiveTransactions.entries]
|
|
158
|
-
}
|
|
159
|
-
}));
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}, error => {
|
|
163
|
-
console.log(error);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async handleExport(option: string) {
|
|
168
|
-
this.selectedExportOption = option;
|
|
169
|
-
switch (this.selectedExportOption) {
|
|
170
|
-
case 'excel':
|
|
171
|
-
this.exportToExcel();
|
|
172
|
-
break;
|
|
173
|
-
case 'pdf':
|
|
174
|
-
this.exportToPdf();
|
|
175
|
-
break;
|
|
176
|
-
case 'csv':
|
|
177
|
-
this.exportToCsv();
|
|
178
|
-
break;
|
|
179
|
-
default:
|
|
180
|
-
alert('Please select an export format.');
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
onSearch(text: string) {
|
|
185
|
-
const normalize = (str: any): string =>
|
|
186
|
-
str?.toString()
|
|
187
|
-
.toLowerCase()
|
|
188
|
-
.replace(/,/g, '')
|
|
189
|
-
.replace(/\s+/g, ' ')
|
|
190
|
-
.replace(/[\u200B-\u200D\uFEFF]/g, '')
|
|
191
|
-
.trim();
|
|
192
|
-
|
|
193
|
-
this.searchText = text;
|
|
194
|
-
const search = normalize(text);
|
|
195
|
-
|
|
196
|
-
if (!this.originalGroupEntries?.length) return;
|
|
197
|
-
|
|
198
|
-
// Build filtered branch groups
|
|
199
|
-
const filteredGroups = this.originalGroupEntries.map(group => {
|
|
200
|
-
const originalSendEntries = group.sendTransactions.entries || [];
|
|
201
|
-
const originalReceiveEntries = group.receiveTransactions.entries || [];
|
|
202
|
-
|
|
203
|
-
const filteredSend = search
|
|
204
|
-
? originalSendEntries.filter(entry =>
|
|
205
|
-
Object.values(entry).some(value => normalize(value).includes(search))
|
|
206
|
-
)
|
|
207
|
-
: [...originalSendEntries];
|
|
208
|
-
|
|
209
|
-
const filteredReceive = search
|
|
210
|
-
? originalReceiveEntries.filter(entry =>
|
|
211
|
-
Object.values(entry).some(value => normalize(value).includes(search))
|
|
212
|
-
)
|
|
213
|
-
: [...originalReceiveEntries];
|
|
214
|
-
|
|
215
|
-
return {
|
|
216
|
-
...group,
|
|
217
|
-
sendTransactions: { ...group.sendTransactions, entries: filteredSend },
|
|
218
|
-
receiveTransactions: { ...group.receiveTransactions, entries: filteredReceive }
|
|
219
|
-
};
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
// 🔹 Keep only branches that have any matching entries
|
|
223
|
-
this.accountingReportModel.accountingReportByBranchGroups =
|
|
224
|
-
filteredGroups.filter(g =>
|
|
225
|
-
g.sendTransactions.entries.length > 0 || g.receiveTransactions.entries.length > 0
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
// Reset grids for visible branches
|
|
229
|
-
this.accountingReportModel.accountingReportByBranchGroups.forEach((group, index) => {
|
|
230
|
-
[group.sendTransactions.entries, group.receiveTransactions.entries].forEach((entries, idx) => {
|
|
231
|
-
const gridApi = this.gridApis[index * 2 + idx];
|
|
232
|
-
if (gridApi) {
|
|
233
|
-
gridApi.setRowData(entries);
|
|
234
|
-
if (gridApi.paginationGoToFirstPage) gridApi.paginationGoToFirstPage();
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
onGridReady(params: GridReadyEvent, id: number) {
|
|
242
|
-
this.gridApis[id] = params.api;
|
|
243
|
-
this.gridColumnApis[id] = params.columnApi;
|
|
244
|
-
|
|
245
|
-
setTimeout(() => this.autoSizeAllColumns(id), 100);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
onGridSizeChanged(params: any, id: number) {
|
|
250
|
-
this.autoSizeAllColumns(id);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
autoSizeAllColumns(id: number, skipHeader: boolean = false) {
|
|
255
|
-
const columnApi = this.gridColumnApis[id];
|
|
256
|
-
if (!columnApi) return;
|
|
257
|
-
|
|
258
|
-
const allColumnIds: string[] = [];
|
|
259
|
-
columnApi.getColumns().forEach((column: any) => {
|
|
260
|
-
allColumnIds.push(column.getId());
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
columnApi.autoSizeColumns(allColumnIds, skipHeader);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
formatNumber(params: any): string {
|
|
268
|
-
if (params.value == null) return '';
|
|
269
|
-
|
|
270
|
-
const field = params.colDef.field;
|
|
271
|
-
|
|
272
|
-
if (field === 'settlementRate') {
|
|
273
|
-
return Number(params.value).toFixed(8);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return Number(params.value).toFixed(3);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
private exportToPdf() {
|
|
280
|
-
if (!this.accountingReportModel.accountingReportByBranchGroups?.length) return;
|
|
281
|
-
const title = 'Accounting Report';
|
|
282
|
-
const fileName = 'Accounting-Report.pdf';
|
|
283
|
-
|
|
284
|
-
const metadata: [string, string][] = [
|
|
285
|
-
['Report Period:', this.reportPeriod],
|
|
286
|
-
['Report User & Time : ', `${this.reportUser}@${this.reportTime}`],
|
|
287
|
-
];
|
|
288
|
-
// // --- search criteria ---
|
|
289
|
-
const searchCriteria = this.searchCriteria;
|
|
290
|
-
|
|
291
|
-
const doc = new jsPDF({ orientation: 'landscape', unit: 'mm', format: [700, 210] });
|
|
292
|
-
|
|
293
|
-
const logoWidth = 38.4, logoHeight = 17.5, logoX = 15, logoY = 8;
|
|
294
|
-
const pageWidth = doc.internal.pageSize.width;
|
|
295
|
-
const marginLeft = 15;
|
|
296
|
-
const titleY = 18;
|
|
297
|
-
|
|
298
|
-
// Logo
|
|
299
|
-
if (this.exportService['logoBase64']) {
|
|
300
|
-
doc.addImage(this.exportService['logoBase64'], 'PNG', logoX, logoY, logoWidth, logoHeight);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// Title
|
|
304
|
-
doc.setFontSize(15);
|
|
305
|
-
doc.setFont('helvetica', 'bold');
|
|
306
|
-
doc.text(title, pageWidth / 2, titleY, { align: 'center' });
|
|
307
|
-
|
|
308
|
-
let currentY = titleY + 14;
|
|
309
|
-
|
|
310
|
-
// Metadata
|
|
311
|
-
doc.setFontSize(10);
|
|
312
|
-
metadata.forEach(([label, value], i) => {
|
|
313
|
-
const y = currentY + i * 7;
|
|
314
|
-
doc.setFont('helvetica', 'bold');
|
|
315
|
-
doc.text(label, 15, y);
|
|
316
|
-
const labelWidth = doc.getTextWidth(label + ' ');
|
|
317
|
-
doc.setFont('helvetica', 'normal');
|
|
318
|
-
doc.text(value ?? '', 15 + labelWidth, y);
|
|
319
|
-
});
|
|
320
|
-
currentY += metadata.length * 7 + 5;
|
|
321
|
-
|
|
322
|
-
//==================================
|
|
323
|
-
// --- draw search criteria heading ---
|
|
324
|
-
doc.setFont('helvetica', 'bold');
|
|
325
|
-
doc.text('Search Criteria:-', marginLeft, currentY);
|
|
326
|
-
currentY += 8;
|
|
327
|
-
|
|
328
|
-
const rowHeightPerLine = 6;
|
|
329
|
-
const minGap = 2; // gap between key and value
|
|
330
|
-
const betweenColumnsGap = 15; // gap between left and right columns (you can tune this)
|
|
331
|
-
const pageContentWidth = doc.internal.pageSize.width - 2 * marginLeft;
|
|
332
|
-
|
|
333
|
-
// --- helper function to measure total width of a key-value pair ---
|
|
334
|
-
const measurePairWidth = (key: string, value: string): number => {
|
|
335
|
-
doc.setFont('helvetica', 'bold');
|
|
336
|
-
const keyWidth = doc.getTextWidth(key + ' ');
|
|
337
|
-
doc.setFont('helvetica', 'normal');
|
|
338
|
-
const valueWidth = doc.getTextWidth(value);
|
|
339
|
-
return keyWidth + minGap + valueWidth;
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
// --- calculate max width of left column pairs dynamically ---
|
|
343
|
-
let maxLeftPairWidth = 0;
|
|
344
|
-
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
345
|
-
if (searchCriteria[i]) {
|
|
346
|
-
const [key, value] = searchCriteria[i];
|
|
347
|
-
const width = measurePairWidth(key, value);
|
|
348
|
-
if (width > maxLeftPairWidth) maxLeftPairWidth = width;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// --- compute where right column should start ---
|
|
353
|
-
const leftColumnStart = marginLeft;
|
|
354
|
-
const rightColumnStart = leftColumnStart + maxLeftPairWidth + betweenColumnsGap;
|
|
355
|
-
|
|
356
|
-
// --- print search criteria dynamically ---
|
|
357
|
-
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
358
|
-
let maxLineCount = 1;
|
|
359
|
-
|
|
360
|
-
// Left column
|
|
361
|
-
if (searchCriteria[i]) {
|
|
362
|
-
const [key, value] = searchCriteria[i];
|
|
363
|
-
doc.setFont('helvetica', 'bold');
|
|
364
|
-
doc.text(key, leftColumnStart, currentY);
|
|
365
|
-
|
|
366
|
-
doc.setFont('helvetica', 'normal');
|
|
367
|
-
const keyWidth = doc.getTextWidth(key + ' ');
|
|
368
|
-
const valueX = leftColumnStart + keyWidth + minGap;
|
|
369
|
-
doc.text(value, valueX, currentY);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Right column
|
|
373
|
-
if (searchCriteria[i + 1]) {
|
|
374
|
-
const [key, value] = searchCriteria[i + 1];
|
|
375
|
-
doc.setFont('helvetica', 'bold');
|
|
376
|
-
doc.text(key, rightColumnStart, currentY);
|
|
377
|
-
|
|
378
|
-
doc.setFont('helvetica', 'normal');
|
|
379
|
-
const keyWidth = doc.getTextWidth(key + ' ');
|
|
380
|
-
const valueX = rightColumnStart + keyWidth + minGap;
|
|
381
|
-
doc.text(value, valueX, currentY);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
currentY += rowHeightPerLine;
|
|
385
|
-
}
|
|
386
|
-
currentY += 8;
|
|
387
|
-
//==================================
|
|
388
|
-
|
|
389
|
-
// Branches
|
|
390
|
-
this.accountingReportModel.accountingReportByBranchGroups.forEach(group => {
|
|
391
|
-
doc.setFontSize(10);
|
|
392
|
-
doc.setFont('helvetica', 'bold');
|
|
393
|
-
|
|
394
|
-
const branchText = `Branch (Name & Code): ${group.branchNameAndCode}`;
|
|
395
|
-
doc.text(branchText, 15, currentY);
|
|
396
|
-
currentY += 7;
|
|
397
|
-
|
|
398
|
-
// Loop subgroups (Send + Receive)
|
|
399
|
-
[group.sendTransactions, group.receiveTransactions].forEach(subGroup => {
|
|
400
|
-
if (!subGroup.entries?.length) return;
|
|
401
|
-
|
|
402
|
-
doc.setFont('helvetica', 'bold');
|
|
403
|
-
doc.text(`Sub Group: ${subGroup.subGroupName}`, 15, currentY);
|
|
404
|
-
currentY += 5;
|
|
405
|
-
|
|
406
|
-
const { headers, rows } = this.prepareAccountingTable(subGroup.entries);
|
|
407
|
-
|
|
408
|
-
(doc as any).autoTable({
|
|
409
|
-
head: [headers],
|
|
410
|
-
body: rows,
|
|
411
|
-
startY: currentY,
|
|
412
|
-
theme: 'grid',
|
|
413
|
-
headStyles: {
|
|
414
|
-
fillColor: [220, 220, 220], textColor: 0,
|
|
415
|
-
fontStyle: 'bold', fontSize: 9, halign: 'center',
|
|
416
|
-
},
|
|
417
|
-
bodyStyles: { fontSize: 8, fillColor: [255, 255, 255], textColor: [0, 0, 0] },
|
|
418
|
-
styles: { cellPadding: 2, overflow: 'linebreak', minCellHeight: 6 },
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
currentY = (doc as any).lastAutoTable.finalY + 10;
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
const pageCount = (doc as any).internal.getNumberOfPages();
|
|
426
|
-
for (let i = 1; i <= pageCount; i++) {
|
|
427
|
-
doc.setFont("helvetica", "bold");
|
|
428
|
-
doc.setPage(i);
|
|
429
|
-
doc.setFontSize(9);
|
|
430
|
-
doc.setTextColor(100);
|
|
431
|
-
|
|
432
|
-
const footerY = doc.internal.pageSize.height - 6;
|
|
433
|
-
|
|
434
|
-
doc.text(
|
|
435
|
-
`Page ${i} of ${pageCount}`,
|
|
436
|
-
pageWidth - 15,
|
|
437
|
-
footerY,
|
|
438
|
-
{ align: 'right' }
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
doc.save(fileName);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
private exportToExcel() {
|
|
446
|
-
if (!this.accountingReportModel.accountingReportByBranchGroups?.length) return;
|
|
447
|
-
const title = 'Accounting Report';
|
|
448
|
-
const fileName = 'Accounting-Report.xlsx';
|
|
449
|
-
|
|
450
|
-
const workbook = new ExcelJS.Workbook();
|
|
451
|
-
const worksheet = workbook.addWorksheet('Accounting Report');
|
|
452
|
-
let currentRow = 1;
|
|
453
|
-
|
|
454
|
-
// Logo
|
|
455
|
-
if (this.exportService.logoBase64) {
|
|
456
|
-
const base64Data = this.exportService.logoBase64.replace(/^data:image\/\w+;base64,/, '');
|
|
457
|
-
const imageId = workbook.addImage({
|
|
458
|
-
base64: base64Data,
|
|
459
|
-
extension: 'png',
|
|
460
|
-
});
|
|
461
|
-
worksheet.addImage(imageId, { tl: { col: 0, row: 0 }, ext: { width: 145, height: 66 }, editAs: 'oneCell' });
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
// Title
|
|
465
|
-
const titleRow = worksheet.getRow(currentRow);
|
|
466
|
-
titleRow.getCell(6).value = title;
|
|
467
|
-
titleRow.getCell(6).font = { bold: true, size: 16 };
|
|
468
|
-
titleRow.getCell(6).alignment = { vertical: 'middle', horizontal: 'left' };
|
|
469
|
-
worksheet.mergeCells(`F${currentRow}:J${currentRow}`);
|
|
470
|
-
currentRow += 3;
|
|
471
|
-
|
|
472
|
-
// Metadata
|
|
473
|
-
const metadata: [string, string][] = [
|
|
474
|
-
['Report Period', this.reportPeriod],
|
|
475
|
-
['Report User & Time : ', `${this.reportUser}@${this.reportTime}`],
|
|
476
|
-
];
|
|
477
|
-
metadata.forEach(([label, value]) => {
|
|
478
|
-
const row = worksheet.getRow(currentRow++);
|
|
479
|
-
row.getCell(1).value = {
|
|
480
|
-
richText: [
|
|
481
|
-
{ text: `${label}: `, font: { bold: true } },
|
|
482
|
-
{ text: value ?? '', font: { bold: false } }
|
|
483
|
-
]
|
|
484
|
-
};
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
worksheet.addRow([]); currentRow++;
|
|
488
|
-
|
|
489
|
-
// --- search criteria ---
|
|
490
|
-
const searchCriteria = this.searchCriteria;
|
|
491
|
-
// --- search criteria heading ---
|
|
492
|
-
// --- Heading ---
|
|
493
|
-
worksheet.mergeCells(currentRow, 1, currentRow, 8);
|
|
494
|
-
const headingCell = worksheet.getCell(currentRow, 1);
|
|
495
|
-
headingCell.value = 'Search Criteria:-';
|
|
496
|
-
headingCell.font = { bold: true, size: 12 };
|
|
497
|
-
headingCell.alignment = { vertical: 'middle', horizontal: 'left' };
|
|
498
|
-
currentRow += 2;
|
|
499
|
-
|
|
500
|
-
// --- Draw pairs dynamically (two per row) ---
|
|
501
|
-
const leftColEnd = 4; // columns 1–4 for left pair
|
|
502
|
-
const rightColStart = 5; // columns 5–8 for right pair
|
|
503
|
-
|
|
504
|
-
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
505
|
-
const row = worksheet.getRow(currentRow++);
|
|
506
|
-
|
|
507
|
-
// Left pair
|
|
508
|
-
if (searchCriteria[i]) {
|
|
509
|
-
const [key, value] = searchCriteria[i];
|
|
510
|
-
worksheet.mergeCells(row.number, 1, row.number, leftColEnd);
|
|
511
|
-
const leftCell = row.getCell(1);
|
|
512
|
-
leftCell.value = { richText: [{ text: key + ' ', font: { bold: true } }, { text: value }] };
|
|
513
|
-
leftCell.alignment = { vertical: 'middle', wrapText: true };
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// Right pair
|
|
517
|
-
if (searchCriteria[i + 1]) {
|
|
518
|
-
const [key, value] = searchCriteria[i + 1];
|
|
519
|
-
worksheet.mergeCells(row.number, rightColStart, row.number, rightColStart + 3);
|
|
520
|
-
const rightCell = row.getCell(rightColStart);
|
|
521
|
-
rightCell.value = { richText: [{ text: key + ' ', font: { bold: true } }, { text: value }] };
|
|
522
|
-
rightCell.alignment = { vertical: 'middle', wrapText: true };
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
currentRow++;
|
|
526
|
-
|
|
527
|
-
// Branches
|
|
528
|
-
this.accountingReportModel.accountingReportByBranchGroups.forEach(group => {
|
|
529
|
-
const branchRow = worksheet.getRow(currentRow++);
|
|
530
|
-
branchRow.getCell(1).value = {
|
|
531
|
-
richText: [
|
|
532
|
-
{ text: 'Branch (Name & Code): ', font: { bold: true } },
|
|
533
|
-
{ text: group.branchNameAndCode ?? '', font: { bold: false } }
|
|
534
|
-
]
|
|
535
|
-
};
|
|
536
|
-
worksheet.addRow([]); currentRow++;
|
|
537
|
-
|
|
538
|
-
// Loop subgroups
|
|
539
|
-
[group.sendTransactions, group.receiveTransactions].forEach(subGroup => {
|
|
540
|
-
if (!subGroup.entries?.length) return;
|
|
541
|
-
|
|
542
|
-
const subGroupRow = worksheet.getRow(currentRow++);
|
|
543
|
-
subGroupRow.getCell(1).value = {
|
|
544
|
-
richText: [
|
|
545
|
-
{ text: 'Sub Group: ', font: { bold: true } },
|
|
546
|
-
{ text: subGroup.subGroupName ?? '', font: { bold: false } }
|
|
547
|
-
]
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
worksheet.addRow([]); currentRow++;
|
|
551
|
-
|
|
552
|
-
// Headers
|
|
553
|
-
const { headers, rows } = this.prepareAccountingTable(subGroup.entries);
|
|
554
|
-
const headerRow = worksheet.getRow(currentRow++);
|
|
555
|
-
headers.forEach((header, i) => {
|
|
556
|
-
const cell = headerRow.getCell(i + 1);
|
|
557
|
-
cell.value = header;
|
|
558
|
-
cell.font = { bold: true };
|
|
559
|
-
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'D9D9D9' } };
|
|
560
|
-
cell.alignment = { vertical: 'middle', horizontal: 'center' };
|
|
561
|
-
cell.border = { top: { style: 'thin' }, bottom: { style: 'thin' }, left: { style: 'thin' }, right: { style: 'thin' } };
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
// Rows
|
|
565
|
-
rows.forEach(r => {
|
|
566
|
-
const row = worksheet.getRow(currentRow++);
|
|
567
|
-
r.forEach((val, i) => {
|
|
568
|
-
const cell = row.getCell(i + 1);
|
|
569
|
-
cell.value = val;
|
|
570
|
-
cell.border = { top: { style: 'thin' }, bottom: { style: 'thin' }, left: { style: 'thin' }, right: { style: 'thin' } };
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
|
|
574
|
-
worksheet.addRow([]); currentRow++;
|
|
575
|
-
});
|
|
576
|
-
});
|
|
577
|
-
|
|
578
|
-
// Auto-adjust column widths (including Sr No)
|
|
579
|
-
const allHeaders = ['Sr No', ...this.columnDefs.map(c => c.headerName)];
|
|
580
|
-
allHeaders.forEach((header, i) => {
|
|
581
|
-
let maxLength = header.length; // start with header length
|
|
582
|
-
|
|
583
|
-
this.accountingReportModel.accountingReportByBranchGroups.forEach(group => {
|
|
584
|
-
[group.sendTransactions, group.receiveTransactions].forEach(subGroup => {
|
|
585
|
-
subGroup.entries.forEach(entry => {
|
|
586
|
-
// Sr No column (i = 0) is just numbers
|
|
587
|
-
let val = i === 0 ? (subGroup.entries.indexOf(entry) + 1).toString() : (entry[this.columnDefs[i - 1]?.field] ?? '');
|
|
588
|
-
const len = val.toString().length;
|
|
589
|
-
if (len > maxLength) maxLength = len;
|
|
590
|
-
});
|
|
591
|
-
});
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
worksheet.getColumn(i + 1).width = maxLength + 5; // padding
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
workbook.xlsx.writeBuffer().then(buffer => {
|
|
598
|
-
const blob = new Blob([buffer], {
|
|
599
|
-
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
600
|
-
});
|
|
601
|
-
FileSaver.saveAs(blob, fileName);
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
private prepareAccountingTable(data: any[]): { headers: string[], rows: any[][] } {
|
|
610
|
-
const currencyFields = ['amountPaid', 'serviceFee', 'tax', 'principleSendAmount', 'clientSettlementInSCcy'];
|
|
611
|
-
const headers = ['Sr No', ...this.columnDefs.map(c => c.headerName)];
|
|
612
|
-
|
|
613
|
-
if (!data || data.length === 0) {
|
|
614
|
-
return { headers, rows: [] }; // return headers only, empty rows
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
const rows = data.map((row, i) => {
|
|
618
|
-
return [
|
|
619
|
-
i + 1,
|
|
620
|
-
...this.columnDefs.map(col => {
|
|
621
|
-
let val = row[col.field];
|
|
622
|
-
if (val == null) return '';
|
|
623
|
-
if (currencyFields.includes(col.field)) return parseFloat(val).toFixed(3);
|
|
624
|
-
if (col.field === 'settlementRate') return parseFloat(val).toFixed(8);
|
|
625
|
-
return val;
|
|
626
|
-
})
|
|
627
|
-
];
|
|
628
|
-
});
|
|
629
|
-
|
|
630
|
-
return { headers, rows };
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
private exportToCsv() {
|
|
634
|
-
if (!this.accountingReportModel.accountingReportByBranchGroups?.length) return;
|
|
635
|
-
const fileName = 'Accounting-Report.csv';
|
|
636
|
-
const rows: string[] = [];
|
|
637
|
-
|
|
638
|
-
rows.push('Report Title: Accounting Report');
|
|
639
|
-
rows.push('');
|
|
640
|
-
rows.push(`Report Period: ${this.reportPeriod}`);
|
|
641
|
-
rows.push(`Report User & Time: ${this.reportUser}@${this.reportTime}`);
|
|
642
|
-
rows.push('');
|
|
643
|
-
|
|
644
|
-
// // --- search criteria ---
|
|
645
|
-
const searchCriteria = this.searchCriteria;
|
|
646
|
-
|
|
647
|
-
if (searchCriteria?.length) {
|
|
648
|
-
rows.push('Search Criteria:-');
|
|
649
|
-
|
|
650
|
-
// calculate max length of left key-value pairs for padding
|
|
651
|
-
const maxLeftLength = Math.max(...searchCriteria.map(([k, v]) => (k + ' ' + v).length));
|
|
652
|
-
|
|
653
|
-
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
654
|
-
const left = searchCriteria[i];
|
|
655
|
-
const right = searchCriteria[i + 1];
|
|
656
|
-
|
|
657
|
-
const leftText = left ? `${left[0]} ${left[1]}`.padEnd(maxLeftLength + 5, ' ') : '';
|
|
658
|
-
const rightText = right ? `${right[0]} ${right[1]}` : '';
|
|
659
|
-
|
|
660
|
-
// Each row in single CSV row; first and second pair separated by a column
|
|
661
|
-
rows.push(`"${leftText}${rightText}"`);
|
|
662
|
-
}
|
|
663
|
-
rows.push(''); // blank line after search criteria
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
this.accountingReportModel.accountingReportByBranchGroups.forEach(group => {
|
|
667
|
-
rows.push(`Branch (Name & Code): ${group.branchNameAndCode}`);
|
|
668
|
-
|
|
669
|
-
[group.sendTransactions, group.receiveTransactions].forEach(subGroup => {
|
|
670
|
-
if (!subGroup.entries?.length) return;
|
|
671
|
-
|
|
672
|
-
rows.push(`Sub Group: ${subGroup.subGroupName}`);
|
|
673
|
-
|
|
674
|
-
// Add "Sr No" at the beginning of headers
|
|
675
|
-
rows.push(['"Sr No"', ...this.columnDefs.map(col => `"${col.headerName}"`)].join(','));
|
|
676
|
-
|
|
677
|
-
subGroup.entries.forEach((entry, idx) => {
|
|
678
|
-
// Add serial number at start of each row
|
|
679
|
-
const row = [
|
|
680
|
-
(idx + 1).toString(),
|
|
681
|
-
...this.columnDefs.map(col => {
|
|
682
|
-
const val = entry[col.field];
|
|
683
|
-
if (val == null) return '';
|
|
684
|
-
if (['amountPaid', 'serviceFee', 'tax', 'principleSendAmount', 'clientSettlementInSCcy'].includes(col.field)) {
|
|
685
|
-
return parseFloat(val).toFixed(3);
|
|
686
|
-
}
|
|
687
|
-
if (col.field === 'settlementRate') {
|
|
688
|
-
return parseFloat(val).toFixed(8);
|
|
689
|
-
}
|
|
690
|
-
return `"${val}"`;
|
|
691
|
-
})
|
|
692
|
-
].join(',');
|
|
693
|
-
rows.push(row);
|
|
694
|
-
});
|
|
695
|
-
|
|
696
|
-
rows.push('');
|
|
697
|
-
});
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
const blob = new Blob([rows.join('\n')], { type: 'text/csv;charset=utf-8;' });
|
|
701
|
-
const link = document.createElement('a');
|
|
702
|
-
link.href = URL.createObjectURL(blob);
|
|
703
|
-
link.setAttribute('download', fileName);
|
|
704
|
-
document.body.appendChild(link);
|
|
705
|
-
link.click();
|
|
706
|
-
document.body.removeChild(link);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
getReport(payload: any) {
|
|
714
|
-
const modal = payload?.modal || payload;
|
|
715
|
-
|
|
716
|
-
const req: AccountingReportRequest = {
|
|
717
|
-
startDate: modal.fromDate, // yyyy-MM-dd from the filter
|
|
718
|
-
endDate: modal.toDate,
|
|
719
|
-
sendCountryCode: modal.sendCountry ?? 'ALL',
|
|
720
|
-
recvCountryCode: modal.receiveCountry ?? 'ALL',
|
|
721
|
-
businessPartnerCorrelationID: modal.client ?? 'ALL',
|
|
722
|
-
transactionStatus: modal.transactionStatus.join(","),
|
|
723
|
-
payoutCurrency: modal.currency ?? 'ALL',
|
|
724
|
-
transactionType: modal.product ?? 'ALL',
|
|
725
|
-
branchCode: modal.branch ?? 'ALL',
|
|
726
|
-
companyCode: 'ALL' // or 'BH' if your API requires it specifically
|
|
727
|
-
};
|
|
728
|
-
|
|
729
|
-
this.searchCriteria = payload.searchCriteria;
|
|
730
|
-
|
|
731
|
-
this.getAccountingReport(req);
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
handleFormValid(isValid: boolean): void {
|
|
735
|
-
this.isFormValid = isValid;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
}
|