@sachin9822/reports-lib 0.0.211 → 0.0.213
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/karma.conf.js +44 -0
- package/ng-package.json +17 -0
- package/package.json +16 -31
- package/src/assets/images/BreadcrumbArrow.png +0 -0
- package/src/lib/assets/images/Search.svg +10 -0
- package/src/lib/assets/images/XMLogo.png +0 -0
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.html +27 -0
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.scss +46 -0
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.spec.ts +23 -0
- package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.ts +292 -0
- package/src/lib/components/accounting-report/accounting-report.component.html +64 -0
- package/src/lib/components/accounting-report/accounting-report.component.scss +24 -0
- package/src/lib/components/accounting-report/accounting-report.component.spec.ts +23 -0
- package/src/lib/components/accounting-report/accounting-report.component.ts +738 -0
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.html +46 -0
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.scss +2 -0
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.spec.ts +23 -0
- package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.ts +247 -0
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.html +46 -0
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.scss +3 -0
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.spec.ts +23 -0
- package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.ts +276 -0
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.html +51 -0
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.scss +7 -0
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.spec.ts +23 -0
- package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.ts +840 -0
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.html +68 -0
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.scss +65 -0
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.spec.ts +23 -0
- package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.ts +290 -0
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.html +25 -0
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.scss +1 -0
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.spec.ts +23 -0
- package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.ts +213 -0
- package/src/lib/components/funding-report/funding-report.component.html +49 -0
- package/src/lib/components/funding-report/funding-report.component.scss +1 -0
- package/src/lib/components/funding-report/funding-report.component.spec.ts +23 -0
- package/src/lib/components/funding-report/funding-report.component.ts +221 -0
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.html +26 -0
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.scss +1 -0
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.spec.ts +23 -0
- package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.ts +267 -0
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.html +95 -0
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.scss +54 -0
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.spec.ts +23 -0
- package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.ts +904 -0
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.html +49 -0
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.scss +2 -0
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.spec.ts +32 -0
- package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.ts +304 -0
- package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.html +46 -0
- package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.scss +7 -0
- package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.ts +343 -0
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.html +25 -0
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.scss +23 -0
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.spec.ts +23 -0
- package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.ts +745 -0
- package/src/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.ts +10 -0
- package/src/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.ts +20 -0
- package/src/lib/models/accounting-report/accounting-report-branch-group.ts +7 -0
- package/src/lib/models/accounting-report/accounting-report-entry-model.ts +25 -0
- package/src/lib/models/accounting-report/accounting-report-model.ts +7 -0
- package/{lib/models/accounting-report/accounting-report-sub-group.d.ts → src/lib/models/accounting-report/accounting-report-sub-group.ts} +3 -2
- package/{lib/models/app-config.model.d.ts → src/lib/models/app-config.model.ts} +8 -7
- package/src/lib/models/branch-activity-receive-report/branch-activity-receive.model.ts +18 -0
- package/src/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.ts +16 -0
- package/src/lib/models/branch-activity-report/branch-activity-send-report.ts +26 -0
- package/src/lib/models/cancellation-transaction-report/cancellation-transaction.model.ts +65 -0
- package/src/lib/models/component-loading-states.ts +5 -0
- package/src/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.ts +28 -0
- package/{lib/models/revenue-per-transaction-report/revenue-per-transaction.model.d.ts → src/lib/models/revenue-per-transaction-report/revenue-per-transaction.model.ts} +1 -1
- package/src/lib/models/statement-of-account-report/statement-of-accounts.model.ts +21 -0
- package/src/lib/models/transaction-enquiry-report/transaction-enquiry.model.ts +127 -0
- package/src/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.ts +16 -0
- package/src/lib/models/transaction-monitoring-report/transaction-monitoring-report.ts +29 -0
- package/src/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.ts +46 -0
- package/src/lib/reports-lib-routing.module.ts +20 -0
- package/src/lib/reports-lib.component.spec.ts +23 -0
- package/src/lib/reports-lib.component.ts +20 -0
- package/src/lib/reports-lib.module.ts +102 -0
- package/src/lib/reports-lib.service.spec.ts +16 -0
- package/src/lib/reports-lib.service.ts +9 -0
- package/src/lib/services/config.service.ts +43 -0
- package/src/lib/services/report.service.spec.ts +16 -0
- package/src/lib/services/report.service.ts +463 -0
- package/src/lib/shared/export-generic.service.ts +557 -0
- package/src/lib/shared/export.service.spec.ts +16 -0
- package/src/lib/shared/export.service.ts +457 -0
- package/src/lib/shared/loader/loader.component.html +8 -0
- package/src/lib/shared/loader/loader.component.scss +52 -0
- package/src/lib/shared/loader/loader.component.ts +10 -0
- package/src/lib/shared/metadata/metadata.component.html +42 -0
- package/src/lib/shared/metadata/metadata.component.scss +95 -0
- package/src/lib/shared/metadata/metadata.component.spec.ts +23 -0
- package/src/lib/shared/metadata/metadata.component.ts +38 -0
- package/src/lib/shared/page-size-selector/page-size-selector.component.html +7 -0
- package/src/lib/shared/page-size-selector/page-size-selector.component.scss +42 -0
- package/src/lib/shared/page-size-selector/page-size-selector.component.spec.ts +23 -0
- package/src/lib/shared/page-size-selector/page-size-selector.component.ts +38 -0
- package/src/lib/shared/search-filter/search-filter.component.html +601 -0
- package/src/lib/shared/search-filter/search-filter.component.scss +203 -0
- package/src/lib/shared/search-filter/search-filter.component.spec.ts +23 -0
- package/src/lib/shared/search-filter/search-filter.component.ts +2387 -0
- package/src/lib/shared/shared.module.ts +13 -0
- package/{public-api.d.ts → src/public-api.ts} +17 -7
- package/src/styles/ag-grid-report-style.scss +71 -0
- package/src/styles/common-ag-grid-style.scss +146 -0
- package/src/styles/common-report-style.scss +395 -0
- package/src/styles/common-style.scss +615 -0
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/esm2020/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.mjs +0 -240
- package/esm2020/lib/components/accounting-report/accounting-report.component.mjs +0 -596
- package/esm2020/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.mjs +0 -218
- package/esm2020/lib/components/branch-activity-send-report/branch-activity-send-report.component.mjs +0 -243
- package/esm2020/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.mjs +0 -700
- package/esm2020/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.mjs +0 -255
- package/esm2020/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.mjs +0 -192
- package/esm2020/lib/components/funding-report/funding-report.component.mjs +0 -198
- package/esm2020/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.mjs +0 -244
- package/esm2020/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.mjs +0 -776
- package/esm2020/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.mjs +0 -266
- package/esm2020/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.mjs +0 -311
- package/esm2020/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.mjs +0 -631
- package/esm2020/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.mjs +0 -2
- package/esm2020/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.mjs +0 -2
- package/esm2020/lib/models/accounting-report/accounting-report-branch-group.mjs +0 -2
- package/esm2020/lib/models/accounting-report/accounting-report-entry-model.mjs +0 -2
- package/esm2020/lib/models/accounting-report/accounting-report-model.mjs +0 -2
- package/esm2020/lib/models/accounting-report/accounting-report-sub-group.mjs +0 -2
- package/esm2020/lib/models/app-config.model.mjs +0 -2
- package/esm2020/lib/models/branch-activity-receive-report/branch-activity-receive.model.mjs +0 -2
- package/esm2020/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.mjs +0 -6
- package/esm2020/lib/models/branch-activity-report/branch-activity-send-report.mjs +0 -3
- package/esm2020/lib/models/cancellation-transaction-report/cancellation-transaction.model.mjs +0 -10
- package/esm2020/lib/models/component-loading-states.mjs +0 -7
- package/esm2020/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.mjs +0 -5
- package/esm2020/lib/models/revenue-per-transaction-report/revenue-per-transaction.model.mjs +0 -2
- package/esm2020/lib/models/statement-of-account-report/statement-of-accounts.model.mjs +0 -2
- package/esm2020/lib/models/transaction-enquiry-report/transaction-enquiry.model.mjs +0 -8
- package/esm2020/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.mjs +0 -6
- package/esm2020/lib/models/transaction-monitoring-report/transaction-monitoring-report.mjs +0 -5
- package/esm2020/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.mjs +0 -3
- package/esm2020/lib/reports-lib-routing.module.mjs +0 -24
- package/esm2020/lib/reports-lib.component.mjs +0 -22
- package/esm2020/lib/reports-lib.module.mjs +0 -172
- package/esm2020/lib/reports-lib.service.mjs +0 -14
- package/esm2020/lib/services/config.service.mjs +0 -39
- package/esm2020/lib/services/report.service.mjs +0 -374
- package/esm2020/lib/shared/export-generic.service.mjs +0 -443
- package/esm2020/lib/shared/export.service.mjs +0 -379
- package/esm2020/lib/shared/loader/loader.component.mjs +0 -11
- package/esm2020/lib/shared/metadata/metadata.component.mjs +0 -51
- package/esm2020/lib/shared/page-size-selector/page-size-selector.component.mjs +0 -44
- package/esm2020/lib/shared/search-filter/search-filter.component.mjs +0 -2134
- package/esm2020/lib/shared/shared.module.mjs +0 -21
- package/esm2020/public-api.mjs +0 -41
- package/esm2020/sachin9822-reports-lib.mjs +0 -5
- package/fesm2015/sachin9822-reports-lib.mjs +0 -8402
- package/fesm2015/sachin9822-reports-lib.mjs.map +0 -1
- package/fesm2020/sachin9822-reports-lib.mjs +0 -8384
- package/fesm2020/sachin9822-reports-lib.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.d.ts +0 -70
- package/lib/components/accounting-report/accounting-report.component.d.ts +0 -76
- package/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.d.ts +0 -58
- package/lib/components/branch-activity-send-report/branch-activity-send-report.component.d.ts +0 -69
- package/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.d.ts +0 -78
- package/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.d.ts +0 -95
- package/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.d.ts +0 -55
- package/lib/components/funding-report/funding-report.component.d.ts +0 -55
- package/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.d.ts +0 -57
- package/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.d.ts +0 -109
- package/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.d.ts +0 -76
- package/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.d.ts +0 -68
- package/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.d.ts +0 -71
- package/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.d.ts +0 -8
- package/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.d.ts +0 -18
- package/lib/models/accounting-report/accounting-report-branch-group.d.ts +0 -6
- package/lib/models/accounting-report/accounting-report-entry-model.d.ts +0 -24
- package/lib/models/accounting-report/accounting-report-model.d.ts +0 -6
- package/lib/models/branch-activity-receive-report/branch-activity-receive.model.d.ts +0 -18
- package/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.d.ts +0 -13
- package/lib/models/branch-activity-report/branch-activity-send-report.d.ts +0 -24
- package/lib/models/cancellation-transaction-report/cancellation-transaction.model.d.ts +0 -44
- package/lib/models/component-loading-states.d.ts +0 -5
- package/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.d.ts +0 -26
- package/lib/models/statement-of-account-report/statement-of-accounts.model.d.ts +0 -18
- package/lib/models/transaction-enquiry-report/transaction-enquiry.model.d.ts +0 -113
- package/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.d.ts +0 -13
- package/lib/models/transaction-monitoring-report/transaction-monitoring-report.d.ts +0 -23
- package/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.d.ts +0 -38
- package/lib/reports-lib-routing.module.d.ts +0 -7
- package/lib/reports-lib.component.d.ts +0 -8
- package/lib/reports-lib.module.d.ts +0 -33
- package/lib/reports-lib.service.d.ts +0 -6
- package/lib/services/config.service.d.ts +0 -20
- package/lib/services/report.service.d.ts +0 -80
- package/lib/shared/export-generic.service.d.ts +0 -50
- package/lib/shared/export.service.d.ts +0 -32
- package/lib/shared/loader/loader.component.d.ts +0 -5
- package/lib/shared/metadata/metadata.component.d.ts +0 -24
- package/lib/shared/page-size-selector/page-size-selector.component.d.ts +0 -15
- package/lib/shared/search-filter/search-filter.component.d.ts +0 -127
- package/lib/shared/shared.module.d.ts +0 -11
- /package/{lib → src}/assets/images/Search.svg +0 -0
- /package/{lib/assets/images/XMLogo.png → src/assets/images/XMCoral.png} +0 -0
- /package/{lib → src/lib}/assets/config/app-config.json +0 -0
- /package/{lib → src/lib}/assets/svg-loaders/blue-tail-spin.svg +0 -0
|
@@ -0,0 +1,840 @@
|
|
|
1
|
+
import { Component, NgZone, OnInit, inject } from '@angular/core';
|
|
2
|
+
// import { Component, ElementRef, HostListener, ViewChild } from '@angular/core';
|
|
3
|
+
import { ColDef, GridApi, GridReadyEvent } from 'ag-grid-community';
|
|
4
|
+
import { themeAlpine } from '@ag-grid-community/theming';
|
|
5
|
+
import { BranchActivityReport } from '../../models/branch-activity-report/branch-activity-send-report';
|
|
6
|
+
import { ComponentLoadingStates } from '../../models/component-loading-states';
|
|
7
|
+
import { ExportOptions, GenericExportService } from '../../shared/export-generic.service';
|
|
8
|
+
import { ReportService } from '../../services/report.service';
|
|
9
|
+
// import { formatDate } from '@angular/common';
|
|
10
|
+
// import { ComponentLoadingStates } from 'src/app/models/component-loading-states';
|
|
11
|
+
// import { GenericExportService } from 'src/app/shared/export-generic.service';
|
|
12
|
+
// import { ExportOptions } from 'projects/reports-lib/src/lib/shared/export-generic.service';
|
|
13
|
+
// import { Injectable } from '@angular/core';
|
|
14
|
+
// import jsPDF from 'jspdf';
|
|
15
|
+
// import 'jspdf-autotable';
|
|
16
|
+
import * as ExcelJS from 'exceljs';
|
|
17
|
+
import * as FileSaver from 'file-saver';
|
|
18
|
+
import { formatDate } from '@angular/common';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'lib-branch-activity-send-summary-report',
|
|
22
|
+
templateUrl: './branch-activity-send-summary-report.component.html',
|
|
23
|
+
styleUrls: ['./branch-activity-send-summary-report.component.scss']
|
|
24
|
+
})
|
|
25
|
+
export class BranchActivitySendSummaryReportComponent implements OnInit {
|
|
26
|
+
dataMap: Record<string, BranchActivityReport[]> = {}
|
|
27
|
+
filteredData: Record<string, BranchActivityReport[]> = {}
|
|
28
|
+
proxyData: Record<string, BranchActivityReport[]> = {}
|
|
29
|
+
showReport: boolean;
|
|
30
|
+
paginationArray: any[];
|
|
31
|
+
selectedExportOption = 'excel';
|
|
32
|
+
gridApis: GridApi[] = [];
|
|
33
|
+
gridColumnApi;
|
|
34
|
+
user: string = "";
|
|
35
|
+
reportDate: string;
|
|
36
|
+
fromDate: string;
|
|
37
|
+
toDate: string;
|
|
38
|
+
searchText: string;
|
|
39
|
+
buffer: any;
|
|
40
|
+
sysUserId: string;
|
|
41
|
+
private logoBase64: string | undefined;
|
|
42
|
+
ComponentLoadingState = ComponentLoadingStates;
|
|
43
|
+
loadingState: ComponentLoadingStates = ComponentLoadingStates.Loading;
|
|
44
|
+
ReportName: string = "Branch Activity Send Summary";
|
|
45
|
+
leftData: Record<string, string>;
|
|
46
|
+
metaDataTwo: Record<string, string>;
|
|
47
|
+
exportService: GenericExportService = inject(GenericExportService);
|
|
48
|
+
searchCriteria: [string, string][] = [];
|
|
49
|
+
|
|
50
|
+
// flags
|
|
51
|
+
showMessage: boolean = false;
|
|
52
|
+
noDataFound: boolean = false;
|
|
53
|
+
isFormValid: boolean = false;
|
|
54
|
+
clearSearch: boolean = false;
|
|
55
|
+
isTotalSummary: boolean = false;
|
|
56
|
+
columnDefs: ColDef<BranchActivityReport>[] = [
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
field: 'businessDateTime', headerName: 'Business Date', flex: 1, wrapText: true, autoHeight: true, headerClass: 'ag-left-aligned-header', minWidth: 70, width: 70, tooltipField: 'businessDateTime',
|
|
60
|
+
valueFormatter: (params) => {
|
|
61
|
+
const row = params.data as BranchActivityReport | null;
|
|
62
|
+
|
|
63
|
+
if (row && row.payinCCcode === 'Total') {
|
|
64
|
+
return ''; // hide date for total row
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return params.value;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ field: 'product', headerName: 'Product', flex: 1, wrapText: true, autoHeight: true, minWidth: 80, width: 120, tooltipField: 'product' },
|
|
71
|
+
{ field: 'payoutCCcode', headerName: 'Receive Currency', flex: 1, wrapText: true, autoHeight: true, minWidth: 90, width: 110, tooltipField: 'payoutCCcode' },
|
|
72
|
+
{ field: 'payoutAmount', headerName: 'Receive Amount', flex: 1, wrapText: true, autoHeight: true, minWidth: 90, maxWidth: 120, cellClass: 'ag-right-aligned-cell compact-cell', tooltipField: 'payoutAmount' },
|
|
73
|
+
{ field: 'payinCCcode', headerName: 'Send Currency', flex: 1, wrapText: true, autoHeight: true, minWidth: 90, maxWidth: 90, tooltipField: 'payinCCcode' },
|
|
74
|
+
{ field: 'payinAmount', headerName: 'Send Amount', flex: 1, wrapText: true, autoHeight: true, minWidth: 80, maxWidth: 120, cellClass: 'ag-right-aligned-cell compact-cell', tooltipField: 'payinAmount' },
|
|
75
|
+
{ field: 'transactionCommissionAmount', headerName: 'Service Fee', flex: 1, wrapText: true, autoHeight: true, minWidth: 90, maxWidth: 100, cellClass: 'ag-right-aligned-cell compact-cell', tooltipField: 'transactionCommissionAmount' },
|
|
76
|
+
{ field: 'tax', headerName: 'Tax', flex: 1, wrapText: true, autoHeight: true, minWidth: 80, maxWidth: 100, cellClass: 'ag-right-aligned-cell compact-cell', tooltipField: 'tax' },
|
|
77
|
+
{ field: 'totalPayinAmount', headerName: 'Total Send Amount', minWidth: 100, flex: 1, wrapText: true, autoHeight: true, cellClass: 'ag-right-aligned-cell compact-cell', tooltipField: 'totalPayinAmount' },
|
|
78
|
+
{ field: 'transactionCount', headerName: 'Transaction Count', flex: 1, wrapText: true, autoHeight: true, minWidth: 80, maxWidth: 100, cellClass: 'ag-right-aligned-cell compact-cell', tooltipField: 'txnCount' },
|
|
79
|
+
{ field: 'status', headerName: 'Transaction Status', minWidth: 100, flex: 1, wrapText: true, autoHeight: true, tooltipField: 'status' }
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
defaultColDef = {
|
|
84
|
+
sortable: true,
|
|
85
|
+
filter: true,
|
|
86
|
+
resizable: true,
|
|
87
|
+
minwidth: 40,
|
|
88
|
+
wrapHeaderText: true,
|
|
89
|
+
autoHeaderHeight: true,
|
|
90
|
+
suppressSizeToFit: false,
|
|
91
|
+
wrapText: true
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// rowClassRules = {
|
|
95
|
+
// debugger
|
|
96
|
+
// 'total-row': params => params.data?.isTotalRow
|
|
97
|
+
// };
|
|
98
|
+
|
|
99
|
+
rowClassRules = {
|
|
100
|
+
'total-row': (params) => {
|
|
101
|
+
console.log('Row Data:', params.data.isTotalRow);
|
|
102
|
+
if (params.data.isTotalRow) {
|
|
103
|
+
return params.data?.isTotalRow;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
rowData: BranchActivityReport[] = [];
|
|
110
|
+
|
|
111
|
+
constructor(private reportService: ReportService, private ngZone: NgZone) { }
|
|
112
|
+
|
|
113
|
+
reportTheme = themeAlpine.withParams({
|
|
114
|
+
headerFontSize: '10px',
|
|
115
|
+
fontFamily: ['Arial', 'sans-serif'],
|
|
116
|
+
fontSize: '9px'
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
ngOnInit(): void {
|
|
120
|
+
this.loadingState = ComponentLoadingStates.Complete;
|
|
121
|
+
// Check if User is falcon user or fossilUser
|
|
122
|
+
if (sessionStorage.getItem('fossilusername')) {
|
|
123
|
+
this.sysUserId = sessionStorage.getItem('fossilusername')
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this.sysUserId = sessionStorage.getItem('ezremitusername');
|
|
127
|
+
}
|
|
128
|
+
this.sysUserId = this.sysUserId.replace(/^["'](.*)["']$/, '$1');
|
|
129
|
+
this.user = this.sysUserId;
|
|
130
|
+
console.log("System User Id : " + this.sysUserId);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
filter(text: string) {
|
|
134
|
+
this.searchText = text;
|
|
135
|
+
if (this.searchText == null) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (this.searchText?.length === 0) {
|
|
139
|
+
this.filteredData = structuredClone(this.dataMap);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.searchText = this.searchText?.trim()?.toLowerCase();
|
|
143
|
+
for (const [key, entries] of Object.entries(this.proxyData)) {
|
|
144
|
+
const filteredData = entries.filter(entry => Object.values(entry)
|
|
145
|
+
.some(val => {
|
|
146
|
+
let a: string = val?.toString().toLowerCase();
|
|
147
|
+
if(a == null){
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return a?.search(this.searchText) == -1 ? false : true;
|
|
151
|
+
}))
|
|
152
|
+
|
|
153
|
+
this.filteredData[key] = filteredData;
|
|
154
|
+
}
|
|
155
|
+
this.filteredData;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
onGridReady(params: GridReadyEvent, id: number) {
|
|
159
|
+
params.api.sizeColumnsToFit();
|
|
160
|
+
this.gridColumnApi = params.columnApi;
|
|
161
|
+
this.gridApis[id] = params.api;
|
|
162
|
+
params.columnApi.setColumnVisible('businessDateTime', !this.isTotalSummary);
|
|
163
|
+
params.api.sizeColumnsToFit();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
handleExport(option: string): void {
|
|
167
|
+
this.selectedExportOption = option;
|
|
168
|
+
if (!this.hasAnyGroups()) {
|
|
169
|
+
alert("There is no data to export based on your current filter.");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
// If no data, do nothing.
|
|
173
|
+
if (!this.filteredData || Object.keys(this.filteredData).length === 0) {
|
|
174
|
+
alert("No data to export");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const title = "Branch Activity Send Summary";
|
|
178
|
+
const reportTimeFormatter = this.dateValueFormatter('dd/MM/yyyy hh:mm a');
|
|
179
|
+
const metadata: [string, string][] = [
|
|
180
|
+
['Report Period ', this.fromDate + " - " + this.toDate],
|
|
181
|
+
['Report User & Time', this.user ? this.user + " @ " + this.reportDate : '' + " @ " + this.reportDate],
|
|
182
|
+
];
|
|
183
|
+
// --- search criteria ---
|
|
184
|
+
const searchCriteria: [string, string][] = this.searchCriteria;
|
|
185
|
+
//const columns = this.columnDefs;
|
|
186
|
+
|
|
187
|
+
//exclude Business Date col for Total Summary Report.
|
|
188
|
+
let columns = [...this.columnDefs];
|
|
189
|
+
const summaryReport = this.searchCriteria.find(x => x[0] === 'Summary Report:')?.[1];
|
|
190
|
+
|
|
191
|
+
if (summaryReport === 'Total Summary') {
|
|
192
|
+
columns = columns.filter(col => col.field !== 'businessDateTime');
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// const data = this.dataMap;
|
|
196
|
+
const cleanedData = {};
|
|
197
|
+
|
|
198
|
+
Object.keys(this.dataMap).forEach(key => {
|
|
199
|
+
cleanedData[key] = this.dataMap[key].map(row => {
|
|
200
|
+
if (row.isTotalRow) {
|
|
201
|
+
return {
|
|
202
|
+
...row,
|
|
203
|
+
businessDateTime: '',
|
|
204
|
+
product: '',
|
|
205
|
+
receiveCurrency: '',
|
|
206
|
+
receiveAmount: ''
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return row;
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const data = cleanedData;
|
|
214
|
+
const options = {
|
|
215
|
+
currencyFields: [
|
|
216
|
+
'payoutAmount', 'payinAmount', 'transactionCommissionAmount', 'tax', 'totalPayinAmount'
|
|
217
|
+
],
|
|
218
|
+
// specify all date fields expected
|
|
219
|
+
dateFields: [],
|
|
220
|
+
|
|
221
|
+
dateFieldFormats: {
|
|
222
|
+
txnDateAndTime: 'dd/MM/yyyy hh:mm a',
|
|
223
|
+
cancellationBranchDateTime: 'dd/MM/yyyy HH:mm',
|
|
224
|
+
cancellationBusinessDate: 'dd/MM/yyyy'
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
specialDecimalFields: {
|
|
228
|
+
rate: 8 // future field with 8 decimal places
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
groupByKey: true
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
switch (this.selectedExportOption) {
|
|
235
|
+
case 'excel':
|
|
236
|
+
this.exportToExcel({ title, metadata, searchCriteria, columns, data, options });
|
|
237
|
+
break;
|
|
238
|
+
case 'pdf':
|
|
239
|
+
this.exportService.exportToPdf({ title, metadata, searchCriteria, columns, data, options });
|
|
240
|
+
break;
|
|
241
|
+
case 'csv':
|
|
242
|
+
this.exportService.exportToCsv({ title, metadata, searchCriteria, columns, data, options });
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
alert("Please select an export format.");
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async exportToExcel({
|
|
250
|
+
title,
|
|
251
|
+
metadata,
|
|
252
|
+
searchCriteria,
|
|
253
|
+
columns,
|
|
254
|
+
data,
|
|
255
|
+
options = {}
|
|
256
|
+
}: {
|
|
257
|
+
title: string;
|
|
258
|
+
metadata: [string, string][];
|
|
259
|
+
searchCriteria: [string, string][];
|
|
260
|
+
columns: any[];
|
|
261
|
+
data: any[] | Record<string, any[]>;
|
|
262
|
+
options?: ExportOptions;
|
|
263
|
+
}): Promise<void> {
|
|
264
|
+
|
|
265
|
+
const workbook = new ExcelJS.Workbook();
|
|
266
|
+
const worksheet = workbook.addWorksheet(title);
|
|
267
|
+
|
|
268
|
+
// ===================== PRE CALC =====================
|
|
269
|
+
const headerLabels = ['Sr No', ...columns.map(col => col.headerName || col.field)];
|
|
270
|
+
const totalCols = headerLabels.length;
|
|
271
|
+
|
|
272
|
+
const titleStartCol = 4;
|
|
273
|
+
const titleColLetter = String.fromCharCode(64 + titleStartCol);
|
|
274
|
+
const titleMergeEnd = String.fromCharCode(64 + totalCols);
|
|
275
|
+
|
|
276
|
+
// ===================== LOGO =====================
|
|
277
|
+
if (this.logoBase64) {
|
|
278
|
+
const base64Data = this.logoBase64.replace(/^data:image\/\w+;base64,/, '');
|
|
279
|
+
|
|
280
|
+
const imageId = workbook.addImage({
|
|
281
|
+
base64: base64Data,
|
|
282
|
+
extension: 'png',
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
worksheet.addImage(imageId, {
|
|
286
|
+
tl: { col: 0, row: 0 },
|
|
287
|
+
ext: { width: 145, height: 66 }
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
worksheet.getRow(1).height = 24;
|
|
291
|
+
worksheet.getRow(2).height = 22;
|
|
292
|
+
worksheet.getRow(3).height = 22;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ===================== TITLE =====================
|
|
296
|
+
worksheet.mergeCells(`${titleColLetter}1:${titleMergeEnd}1`);
|
|
297
|
+
const titleCell = worksheet.getRow(1).getCell(titleStartCol);
|
|
298
|
+
titleCell.value = title;
|
|
299
|
+
titleCell.font = { bold: true, size: 16 };
|
|
300
|
+
titleCell.alignment = { vertical: 'middle', horizontal: 'left' };
|
|
301
|
+
|
|
302
|
+
// ===================== METADATA =====================
|
|
303
|
+
let metaRowStart = 4;
|
|
304
|
+
|
|
305
|
+
metadata.forEach(([label, value], idx) => {
|
|
306
|
+
const row = worksheet.getRow(metaRowStart + idx);
|
|
307
|
+
|
|
308
|
+
row.getCell(1).value = {
|
|
309
|
+
richText: [
|
|
310
|
+
{ text: `${label} : `, font: { bold: true } },
|
|
311
|
+
{ text: value ?? '', font: { bold: false } }
|
|
312
|
+
]
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
worksheet.mergeCells(`A${row.number}:${titleMergeEnd}${row.number}`);
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
let currentRow = metaRowStart + metadata.length;
|
|
319
|
+
|
|
320
|
+
worksheet.getRow(++currentRow).height = 6;
|
|
321
|
+
currentRow++;
|
|
322
|
+
|
|
323
|
+
// ===================== SEARCH CRITERIA =====================
|
|
324
|
+
worksheet.mergeCells(currentRow, 1, currentRow, 6);
|
|
325
|
+
worksheet.getCell(currentRow, 1).value = 'Search Criteria:-';
|
|
326
|
+
worksheet.getCell(currentRow, 1).font = { bold: true };
|
|
327
|
+
currentRow += 2;
|
|
328
|
+
|
|
329
|
+
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
330
|
+
const left = searchCriteria[i];
|
|
331
|
+
const right = searchCriteria[i + 1];
|
|
332
|
+
|
|
333
|
+
const row = worksheet.getRow(currentRow++);
|
|
334
|
+
|
|
335
|
+
worksheet.mergeCells(row.number, 1, row.number, 3);
|
|
336
|
+
row.getCell(1).value = {
|
|
337
|
+
richText: [
|
|
338
|
+
{ text: (left?.[0] ?? '') + ' ', font: { bold: true } },
|
|
339
|
+
{ text: left?.[1] ?? '' }
|
|
340
|
+
]
|
|
341
|
+
};
|
|
342
|
+
row.getCell(1).alignment = { wrapText: true, vertical: 'middle' };
|
|
343
|
+
|
|
344
|
+
if (right) {
|
|
345
|
+
worksheet.mergeCells(row.number, 4, row.number, 6);
|
|
346
|
+
row.getCell(4).value = {
|
|
347
|
+
richText: [
|
|
348
|
+
{ text: (right?.[0] ?? '') + ' ', font: { bold: true } },
|
|
349
|
+
{ text: right?.[1] ?? '' }
|
|
350
|
+
]
|
|
351
|
+
};
|
|
352
|
+
row.getCell(4).alignment = { wrapText: true, vertical: 'middle' };
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
currentRow++;
|
|
357
|
+
|
|
358
|
+
// ===================== HEADER ROW =====================
|
|
359
|
+
const headerRow = worksheet.getRow(currentRow++);
|
|
360
|
+
|
|
361
|
+
headerLabels.forEach((header, i) => {
|
|
362
|
+
const cell = headerRow.getCell(i + 1);
|
|
363
|
+
cell.value = header;
|
|
364
|
+
cell.font = { bold: true };
|
|
365
|
+
cell.fill = {
|
|
366
|
+
type: 'pattern',
|
|
367
|
+
pattern: 'solid',
|
|
368
|
+
fgColor: { argb: 'D9D9D9' }
|
|
369
|
+
};
|
|
370
|
+
cell.alignment = { vertical: 'middle', horizontal: 'center' };
|
|
371
|
+
cell.border = {
|
|
372
|
+
top: { style: 'thin' },
|
|
373
|
+
bottom: { style: 'thin' },
|
|
374
|
+
left: { style: 'thin' },
|
|
375
|
+
right: { style: 'thin' }
|
|
376
|
+
};
|
|
377
|
+
});
|
|
378
|
+
headerRow.eachCell((cell) => {
|
|
379
|
+
if (cell.value === 'Transaction Count') {
|
|
380
|
+
cell.value = 'Transaction\nCount';
|
|
381
|
+
cell.alignment = {
|
|
382
|
+
horizontal: 'center',
|
|
383
|
+
vertical: 'middle',
|
|
384
|
+
wrapText: true
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
// ===================== DATA SECTION =====================
|
|
389
|
+
let rowIdx = currentRow;
|
|
390
|
+
let serialNumber = 1;
|
|
391
|
+
|
|
392
|
+
if (options.groupByKey && !Array.isArray(data)) {
|
|
393
|
+
|
|
394
|
+
for (const [group, items] of Object.entries(data)) {
|
|
395
|
+
|
|
396
|
+
const groupRow = worksheet.getRow(rowIdx++);
|
|
397
|
+
groupRow.getCell(1).value = group;
|
|
398
|
+
groupRow.font = { bold: true };
|
|
399
|
+
worksheet.mergeCells(`A${groupRow.number}:${titleMergeEnd}${groupRow.number}`);
|
|
400
|
+
|
|
401
|
+
items.forEach((item) => {
|
|
402
|
+
|
|
403
|
+
const rowData = this.prepareTableRows([item], columns, options)[0];
|
|
404
|
+
const dataRow = worksheet.getRow(rowIdx++);
|
|
405
|
+
|
|
406
|
+
const fullRow = [
|
|
407
|
+
!item?.isTotalRow ? serialNumber++ : '',
|
|
408
|
+
...rowData
|
|
409
|
+
];
|
|
410
|
+
|
|
411
|
+
fullRow.forEach((val, cIdx) => {
|
|
412
|
+
const cell = dataRow.getCell(cIdx + 1);
|
|
413
|
+
// cell.value = val;
|
|
414
|
+
//added by bharati for
|
|
415
|
+
const field = columns[cIdx - 1]?.field;
|
|
416
|
+
|
|
417
|
+
// ✅ Amount fields (Receive Amount, Send Amount, Total Send Amount etc.)
|
|
418
|
+
/*
|
|
419
|
+
if (
|
|
420
|
+
field=='totalPayinAmount'||
|
|
421
|
+
field=='payinAmount'||
|
|
422
|
+
field === 'transactionCommissionAmount' ||
|
|
423
|
+
field === 'tax'
|
|
424
|
+
) {
|
|
425
|
+
if (val !== '' && val !== null && val !== undefined) {
|
|
426
|
+
cell.value = Number(val);
|
|
427
|
+
cell.numFmt = '#,##0.000';
|
|
428
|
+
cell.alignment = { horizontal: 'right', vertical: 'middle' };
|
|
429
|
+
} else {
|
|
430
|
+
cell.value = '';
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
cell.value = val;
|
|
435
|
+
} */
|
|
436
|
+
|
|
437
|
+
if (item?.isTotalRow && field === 'receiveAmount') {
|
|
438
|
+
cell.value = '';
|
|
439
|
+
}
|
|
440
|
+
else if (
|
|
441
|
+
field?.toLowerCase().includes('amount') ||
|
|
442
|
+
field === 'serviceFee' ||
|
|
443
|
+
field === 'tax'
|
|
444
|
+
) {
|
|
445
|
+
if (val !== '' && val !== null && val !== undefined) {
|
|
446
|
+
cell.value = val; // already number
|
|
447
|
+
cell.numFmt = '#,##0.000'; // Excel formatting
|
|
448
|
+
cell.alignment = { horizontal: 'right', vertical: 'middle' };
|
|
449
|
+
} else {
|
|
450
|
+
cell.value = '';
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
cell.value = val;
|
|
455
|
+
}
|
|
456
|
+
cell.border = {
|
|
457
|
+
top: { style: 'thin' },
|
|
458
|
+
bottom: { style: 'thin' },
|
|
459
|
+
left: { style: 'thin' },
|
|
460
|
+
right: { style: 'thin' }
|
|
461
|
+
};
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
if (item?.isTotalRow) {
|
|
465
|
+
dataRow.eachCell(cell => {
|
|
466
|
+
cell.font = {
|
|
467
|
+
...cell.font,
|
|
468
|
+
bold: true,
|
|
469
|
+
size: 12
|
|
470
|
+
};
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
} else {
|
|
477
|
+
|
|
478
|
+
this.prepareTableRows(data as any[], columns, options)
|
|
479
|
+
.forEach((rowData, index) => {
|
|
480
|
+
|
|
481
|
+
const dataRow = worksheet.getRow(rowIdx++);
|
|
482
|
+
const originalItem = (data as any[])[index];
|
|
483
|
+
|
|
484
|
+
const fullRow = [
|
|
485
|
+
!originalItem?.isTotalRow ? serialNumber++ : '',
|
|
486
|
+
...rowData
|
|
487
|
+
];
|
|
488
|
+
|
|
489
|
+
fullRow.forEach((val, cIdx) => {
|
|
490
|
+
const cell = dataRow.getCell(cIdx + 1);
|
|
491
|
+
//cell.value = val;
|
|
492
|
+
/* if (cIdx === 0) {
|
|
493
|
+
cell.value = val;
|
|
494
|
+
} else {
|
|
495
|
+
|
|
496
|
+
const field = columns[cIdx - 1]?.field;
|
|
497
|
+
|
|
498
|
+
if (
|
|
499
|
+
field=='totalPayinAmount'||
|
|
500
|
+
field=='payinAmount'||
|
|
501
|
+
field === 'transactionCommissionAmount' ||
|
|
502
|
+
field === 'tax'
|
|
503
|
+
) {
|
|
504
|
+
cell.value = Number(val);
|
|
505
|
+
cell.numFmt = '#,##0.000';
|
|
506
|
+
cell.alignment = { horizontal: 'right', vertical: 'middle' };
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
cell.value = val;
|
|
510
|
+
}
|
|
511
|
+
} */
|
|
512
|
+
|
|
513
|
+
const field = columns[cIdx - 1]?.field;
|
|
514
|
+
|
|
515
|
+
if (cIdx === 0) {
|
|
516
|
+
cell.value = val;
|
|
517
|
+
}
|
|
518
|
+
else if (originalItem?.isTotalRow && field === 'receiveAmount') {
|
|
519
|
+
cell.value = '';
|
|
520
|
+
}
|
|
521
|
+
else if (
|
|
522
|
+
field?.toLowerCase().includes('amount') ||
|
|
523
|
+
field === 'serviceFee' ||
|
|
524
|
+
field === 'tax'
|
|
525
|
+
) {
|
|
526
|
+
if (val !== '' && val !== null && val !== undefined) {
|
|
527
|
+
cell.value = val; // already number
|
|
528
|
+
cell.numFmt = '#,##0.000'; // Excel formatting
|
|
529
|
+
cell.alignment = { horizontal: 'right', vertical: 'middle' };
|
|
530
|
+
} else {
|
|
531
|
+
cell.value = '';
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
cell.value = val;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
cell.border = {
|
|
539
|
+
top: { style: 'thin' },
|
|
540
|
+
bottom: { style: 'thin' },
|
|
541
|
+
left: { style: 'thin' },
|
|
542
|
+
right: { style: 'thin' }
|
|
543
|
+
};
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
if (originalItem?.isTotalRow) {
|
|
547
|
+
dataRow.eachCell(cell => {
|
|
548
|
+
cell.font = {
|
|
549
|
+
...cell.font,
|
|
550
|
+
bold: true,
|
|
551
|
+
size: 12
|
|
552
|
+
};
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// ===================== AUTO WIDTH =====================
|
|
559
|
+
for (let i = 1; i <= totalCols; i++) {
|
|
560
|
+
let maxLength = 10;
|
|
561
|
+
|
|
562
|
+
worksheet.eachRow({ includeEmpty: true }, (row) => {
|
|
563
|
+
const cell = row.getCell(i);
|
|
564
|
+
if (cell.isMerged) return;
|
|
565
|
+
|
|
566
|
+
let cellValue = '';
|
|
567
|
+
|
|
568
|
+
if (cell.value == null) {
|
|
569
|
+
cellValue = '';
|
|
570
|
+
} else if (typeof cell.value === 'object' && 'richText' in cell.value) {
|
|
571
|
+
cellValue = cell.value.richText.map(rt => rt.text).join('');
|
|
572
|
+
} else {
|
|
573
|
+
cellValue = cell.value.toString();
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
maxLength = Math.max(maxLength, cellValue.length);
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
worksheet.getColumn(i).width = Math.min(maxLength, 50);
|
|
580
|
+
}
|
|
581
|
+
//new code:bharati
|
|
582
|
+
|
|
583
|
+
worksheet.columns.forEach((column, index) => {
|
|
584
|
+
|
|
585
|
+
if (index === 0) return; // skip Sr No
|
|
586
|
+
|
|
587
|
+
const field = columns[index - 1]?.field;
|
|
588
|
+
|
|
589
|
+
if (field === 'payinAmount') {
|
|
590
|
+
column.width = 14;
|
|
591
|
+
}
|
|
592
|
+
if (field === 'payoutAmount') {
|
|
593
|
+
column.width = 15;
|
|
594
|
+
}
|
|
595
|
+
if (field === 'transactionCount') {
|
|
596
|
+
column.width = 14;
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
// worksheet.columns.forEach((column) => {
|
|
601
|
+
// if (column.header === 'Send Amount') {
|
|
602
|
+
// column.width = 25;
|
|
603
|
+
// }
|
|
604
|
+
// });
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
// ===================== SAVE FILE =====================
|
|
608
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
609
|
+
|
|
610
|
+
FileSaver.saveAs(
|
|
611
|
+
new Blob([buffer], {
|
|
612
|
+
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
613
|
+
}),
|
|
614
|
+
title.replace(/\s/g, '-') + '.xlsx'
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// private prepareTableRows(data: any[], columns: any[], options: ExportOptions = {}): any[][] {
|
|
619
|
+
// const {
|
|
620
|
+
// excludeFields = [],
|
|
621
|
+
// currencyFields = [],
|
|
622
|
+
// dateFields = [],
|
|
623
|
+
// dateFieldFormats = {},
|
|
624
|
+
// specialDecimalFields = {}
|
|
625
|
+
// } = options;
|
|
626
|
+
|
|
627
|
+
// const filtered = columns.filter(c =>
|
|
628
|
+
// c.field && !excludeFields.some(f => c.field.toLowerCase().includes(f))
|
|
629
|
+
// );
|
|
630
|
+
|
|
631
|
+
// return data.map((row) => ([
|
|
632
|
+
// ...filtered.map(col => {
|
|
633
|
+
// let value = row[col.field];
|
|
634
|
+
// // Format date fields with custom formats if specified
|
|
635
|
+
// if (col.field && (dateFields.includes(col.field) || col.field in dateFieldFormats)) {
|
|
636
|
+
// const format = dateFieldFormats[col.field] || 'dd/MM/yyyy';
|
|
637
|
+
// value = this.formatDateByFormat(value, format);
|
|
638
|
+
// }
|
|
639
|
+
// // Format special decimal fields with specific decimals
|
|
640
|
+
// else if (col.field && col.field in specialDecimalFields && value != null) {
|
|
641
|
+
// const decimals = specialDecimalFields[col.field];
|
|
642
|
+
// value = parseFloat(value).toFixed(decimals);
|
|
643
|
+
// }
|
|
644
|
+
// // Format regular currency fields with 3 decimals
|
|
645
|
+
// else if (col.field && currencyFields.includes(col.field) && value != null) {
|
|
646
|
+
// value = parseFloat(value).toFixed(3);
|
|
647
|
+
// }
|
|
648
|
+
|
|
649
|
+
// return value ?? '';
|
|
650
|
+
// })
|
|
651
|
+
// ]));
|
|
652
|
+
// }
|
|
653
|
+
private prepareTableRows(
|
|
654
|
+
data: any[],
|
|
655
|
+
columns: any[],
|
|
656
|
+
options: ExportOptions = {}
|
|
657
|
+
): any[][] {
|
|
658
|
+
|
|
659
|
+
const {
|
|
660
|
+
excludeFields = [],
|
|
661
|
+
currencyFields = [],
|
|
662
|
+
dateFields = [],
|
|
663
|
+
dateFieldFormats = {},
|
|
664
|
+
specialDecimalFields = {}
|
|
665
|
+
} = options;
|
|
666
|
+
|
|
667
|
+
const filtered = columns.filter(c =>
|
|
668
|
+
c.field && !excludeFields.some(f => c.field.toLowerCase().includes(f))
|
|
669
|
+
);
|
|
670
|
+
|
|
671
|
+
return data.map((row) => ([
|
|
672
|
+
...filtered.map(col => {
|
|
673
|
+
|
|
674
|
+
let value = row[col.field];
|
|
675
|
+
|
|
676
|
+
// ✅ Date formatting (keep as string)
|
|
677
|
+
if (
|
|
678
|
+
col.field &&
|
|
679
|
+
(dateFields.includes(col.field) || col.field in dateFieldFormats)
|
|
680
|
+
) {
|
|
681
|
+
const format = dateFieldFormats[col.field] || 'dd/MM/yyyy';
|
|
682
|
+
value = this.formatDateByFormat(value, format);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// ✅ Special decimal fields → return NUMBER (no toFixed)
|
|
686
|
+
else if (
|
|
687
|
+
col.field &&
|
|
688
|
+
col.field in specialDecimalFields &&
|
|
689
|
+
value != null
|
|
690
|
+
) {
|
|
691
|
+
value = Number(value);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// ✅ Currency fields → return NUMBER (no toFixed)
|
|
695
|
+
else if (
|
|
696
|
+
col.field &&
|
|
697
|
+
currencyFields.includes(col.field) &&
|
|
698
|
+
value != null
|
|
699
|
+
) {
|
|
700
|
+
value = Number(value);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
return value ?? '';
|
|
704
|
+
})
|
|
705
|
+
]));
|
|
706
|
+
}
|
|
707
|
+
private formatDateByFormat(val: any, format: string): string {
|
|
708
|
+
// Helper to pad single digits
|
|
709
|
+
const pad = (n: number) => n.toString().padStart(2, '0');
|
|
710
|
+
|
|
711
|
+
// Parse date for "DD/MM/YYYY hh:mm AM/PM" format manually
|
|
712
|
+
if (typeof val === 'string' && /^\d{2}\/\d{2}\/\d{4} \d{2}:\d{2} [AP]M$/.test(val)) {
|
|
713
|
+
|
|
714
|
+
const parts = val.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}) ([AP]M)$/);
|
|
715
|
+
if (!parts) return '';
|
|
716
|
+
let [, dd, mm, yyyy, hh, min, ampm] = parts;
|
|
717
|
+
let hours = parseInt(hh, 10);
|
|
718
|
+
if (ampm === 'PM' && hours !== 12) hours += 12;
|
|
719
|
+
if (ampm === 'AM' && hours === 12) hours = 0;
|
|
720
|
+
val = new Date(parseInt(yyyy, 10), parseInt(mm, 10) - 1, parseInt(dd, 10), hours, parseInt(min, 10));
|
|
721
|
+
} else {
|
|
722
|
+
val = new Date(val);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
if (isNaN(val.getTime())) return '';
|
|
726
|
+
|
|
727
|
+
const dt = val;
|
|
728
|
+
|
|
729
|
+
switch (format) {
|
|
730
|
+
case 'dd/MM/yyyy hh:mm a': { // 11/07/2025 10:56 PM
|
|
731
|
+
let hours12 = dt.getHours() % 12 || 12;
|
|
732
|
+
let ampm = dt.getHours() >= 12 ? 'PM' : 'AM';
|
|
733
|
+
return `${pad(dt.getDate())}/${pad(dt.getMonth() + 1)}/${dt.getFullYear()} ${pad(hours12)}:${pad(dt.getMinutes())} ${ampm}`;
|
|
734
|
+
}
|
|
735
|
+
case 'dd/MM/yyyy HH:mm': { // 28/07/2025 13:08
|
|
736
|
+
return `${pad(dt.getDate())}/${pad(dt.getMonth() + 1)}/${dt.getFullYear()} ${pad(dt.getHours())}:${pad(dt.getMinutes())}`;
|
|
737
|
+
}
|
|
738
|
+
case 'dd/MM/yyyy': { // 28/07/2025
|
|
739
|
+
return `${pad(dt.getDate())}/${pad(dt.getMonth() + 1)}/${dt.getFullYear()}`;
|
|
740
|
+
}
|
|
741
|
+
default:
|
|
742
|
+
return dt.toLocaleString();
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
dateValueFormatter(format: string) {
|
|
747
|
+
return (params: any) => {
|
|
748
|
+
if (!params.value) return '';
|
|
749
|
+
try {
|
|
750
|
+
return formatDate(params.value, format, 'en-US');
|
|
751
|
+
} catch {
|
|
752
|
+
return '';
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
getKeys(obj: Record<string, unknown>): string[] {
|
|
758
|
+
return obj ? Object.keys(obj) : [];
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
hasAnyGroups(): boolean {
|
|
762
|
+
return this.filteredData && this.getKeys(this.filteredData).length > 0;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
formatAmount(params: any): string {
|
|
766
|
+
const value = params?.value;
|
|
767
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
768
|
+
const num = Number(value);
|
|
769
|
+
return (Math.trunc(num * 1000) / 1000).toFixed(3);
|
|
770
|
+
}
|
|
771
|
+
return '';
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
handleSearch(criteria: any): void {
|
|
775
|
+
this.searchCriteria = criteria.searchCriteria;
|
|
776
|
+
this.reportDate = new Date().toISOString();
|
|
777
|
+
this.reportDate = formatDate(this.reportDate, 'dd/MM/yyyy hh:mm a', 'en-US');
|
|
778
|
+
const modal = criteria.modal;
|
|
779
|
+
this.user = criteria.sysUserID;
|
|
780
|
+
this.fromDate = formatDate(modal.fromDate, 'dd/MM/yyyy hh:mm a', 'en-US').slice(0, 10);
|
|
781
|
+
this.toDate = formatDate(modal.toDate, 'dd/MM/yyyy hh:mm a', 'en-US').slice(0, 10);
|
|
782
|
+
console.log(modal);
|
|
783
|
+
// Code For Meta Data
|
|
784
|
+
this.leftData = {
|
|
785
|
+
'Report Period': this.fromDate + " - " + this.toDate,
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
this.metaDataTwo = {
|
|
789
|
+
'Report User & Time': this.user + " @ " + this.reportDate,
|
|
790
|
+
}
|
|
791
|
+
const isTotalSummary = modal.summaryReport === 'Total Summary';
|
|
792
|
+
this.isTotalSummary = isTotalSummary;
|
|
793
|
+
|
|
794
|
+
const searchData = {
|
|
795
|
+
"StartDate": modal.fromDate,
|
|
796
|
+
"EndDate": modal.toDate,
|
|
797
|
+
"SendCountryCode": modal.sendCountry,
|
|
798
|
+
"RecvCountryCode": modal.receiveCountry,
|
|
799
|
+
"BusinessPartnerCode": modal.client,
|
|
800
|
+
"TransactionStatus": modal.transactionStatus.join(","),
|
|
801
|
+
"PayoutCurrency": modal.receiveCurrency,
|
|
802
|
+
"TransactionType": modal.product,
|
|
803
|
+
"BranchCode": modal.branch,
|
|
804
|
+
"SummaryReport": modal.summaryReport
|
|
805
|
+
|
|
806
|
+
};
|
|
807
|
+
this.showMessage = true;
|
|
808
|
+
this.clearSearch = true;
|
|
809
|
+
this.loadingState = ComponentLoadingStates.Loading;
|
|
810
|
+
this.reportService.getBranchActivitySendSummaryReport(searchData).subscribe({
|
|
811
|
+
next: (data) => {
|
|
812
|
+
console.log(data);
|
|
813
|
+
this.dataMap = JSON.parse(JSON.stringify(data));
|
|
814
|
+
this.filteredData = data;
|
|
815
|
+
this.noDataFound = Object.keys(this.filteredData).length == 0 ? true : false;
|
|
816
|
+
this.proxyData = structuredClone(data);
|
|
817
|
+
this.paginationArray = new Array(Object.keys(this.filteredData).length).fill(15);
|
|
818
|
+
this.showMessage = Object.keys(this.filteredData).length == 0 ? true : false;
|
|
819
|
+
this.showReport = true;
|
|
820
|
+
},
|
|
821
|
+
|
|
822
|
+
error: (err) => {
|
|
823
|
+
this.loadingState = ComponentLoadingStates.Complete;
|
|
824
|
+
this.clearSearch = false;
|
|
825
|
+
},
|
|
826
|
+
|
|
827
|
+
complete: () => {
|
|
828
|
+
this.loadingState = ComponentLoadingStates.Complete;
|
|
829
|
+
this.showReport = true;
|
|
830
|
+
this.clearSearch = false;
|
|
831
|
+
}
|
|
832
|
+
})
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
handleFormValid(isValid: boolean): void {
|
|
836
|
+
this.isFormValid = isValid;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
}
|
|
840
|
+
|