@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
package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.ts
DELETED
|
@@ -1,745 +0,0 @@
|
|
|
1
|
-
import { formatDate } from '@angular/common';
|
|
2
|
-
import { Component, HostListener, OnInit } from '@angular/core';
|
|
3
|
-
import { ColDef, ColumnApi, GridApi, GridReadyEvent } from 'ag-grid-community';
|
|
4
|
-
import { ComponentLoadingStates } from '../../models/component-loading-states';
|
|
5
|
-
import { AccountDetail, TrialBalanceReport } from '../../models/trial-balance-accounts-report/trial-balance-accounts.models';
|
|
6
|
-
import { ReportService } from '../../services/report.service';
|
|
7
|
-
import jsPDF from 'jspdf';
|
|
8
|
-
import 'jspdf-autotable';
|
|
9
|
-
import * as ExcelJS from 'exceljs';
|
|
10
|
-
import * as FileSaver from 'file-saver';
|
|
11
|
-
import { ExportService } from '../../shared/export.service';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare module 'jspdf' {
|
|
15
|
-
interface jsPDF {
|
|
16
|
-
autoTable: (options: any) => jsPDF;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface TrialBalanceAccountsReportRequestDTO {
|
|
21
|
-
year: number;
|
|
22
|
-
dateType: string;
|
|
23
|
-
fromDate: string;
|
|
24
|
-
toDate: string;
|
|
25
|
-
accountStatus: string;
|
|
26
|
-
businessUnit: string;
|
|
27
|
-
currency: string;
|
|
28
|
-
companyCode: string;
|
|
29
|
-
reportPeriod: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@Component({
|
|
33
|
-
selector: 'lib-trial-balance-accounts-report',
|
|
34
|
-
templateUrl: './trial-balance-accounts-report.component.html',
|
|
35
|
-
styleUrls: ['./trial-balance-accounts-report.component.scss']
|
|
36
|
-
})
|
|
37
|
-
export class TrialBalanceAccountsReportComponent implements OnInit {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
ReportName: string = "Trial Balance - Accounts"
|
|
41
|
-
gridApi: GridApi;
|
|
42
|
-
metaDataOne: Record<string, string>;
|
|
43
|
-
metaDataTwo: Record<string, string>;
|
|
44
|
-
ComponentLoadingState = ComponentLoadingStates;
|
|
45
|
-
loadingState: ComponentLoadingStates = ComponentLoadingStates.Complete;
|
|
46
|
-
trialBalanceReport: TrialBalanceReport;
|
|
47
|
-
selectedExportOption: string = 'excel';
|
|
48
|
-
pageSize: number = 15;
|
|
49
|
-
dataReady: boolean = false;
|
|
50
|
-
searchCriteria: [string, string][];
|
|
51
|
-
|
|
52
|
-
accountStatus: string = '';
|
|
53
|
-
currency: string = '';
|
|
54
|
-
dateType: string = '';
|
|
55
|
-
fromDate: string = '';
|
|
56
|
-
toDate: string = '';
|
|
57
|
-
businessUnit: string = '';
|
|
58
|
-
|
|
59
|
-
reportUser: string = '';
|
|
60
|
-
reportTime: string = '';
|
|
61
|
-
reportPeriod: string = '';
|
|
62
|
-
isFormValid: boolean = false;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
defaultColDef: ColDef = {
|
|
66
|
-
resizable: true,
|
|
67
|
-
sortable: true,
|
|
68
|
-
filter: true,
|
|
69
|
-
suppressSizeToFit: false,
|
|
70
|
-
cellStyle: {
|
|
71
|
-
userSelect: 'text',
|
|
72
|
-
'line-height': '1.2',
|
|
73
|
-
'white-space': 'normal',
|
|
74
|
-
'word-break': 'normal',
|
|
75
|
-
'overflow-wrap': 'break-word',
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
wrapHeaderText: true,
|
|
79
|
-
autoHeaderHeight: true,
|
|
80
|
-
wrapText: true,
|
|
81
|
-
autoHeight: true,
|
|
82
|
-
|
|
83
|
-
cellClassRules: {
|
|
84
|
-
'total-positive': params => params.data?.isTotalRow && params.value >= 0,
|
|
85
|
-
'total-negative': params => params.data?.isTotalRow && params.value < 0,
|
|
86
|
-
'positive-value': params => !params.data?.isTotalRow && params.value >= 0,
|
|
87
|
-
'negative-value': params => !params.data?.isTotalRow && params.value < 0,
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
rowClassRules = {
|
|
92
|
-
'total-row': params => params.data?.isTotalRow
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
columnDefs: ColDef[] =
|
|
96
|
-
[
|
|
97
|
-
{ headerName: 'Business Unit', field: 'companyFullName', tooltipField: 'companyFullName', minWidth: 70, maxWidth: 100 },
|
|
98
|
-
{ headerName: 'COA Code', field: 'coaCode', tooltipField: 'coaCode', minWidth: 60, maxWidth: 100 },
|
|
99
|
-
{ headerName: 'Account Code', field: 'accountCode', tooltipField: 'accountCode', minWidth: 80, maxWidth: 100 },
|
|
100
|
-
{ headerName: 'Account Description', field: 'accountDescription', tooltipField: 'accountDescription', minWidth: 180, maxWidth: 230 },
|
|
101
|
-
{ headerName: 'Opening Balance Local Amount', field: 'openingBalance', type: 'numericColumn', tooltipField: 'openingBalance' },
|
|
102
|
-
{ headerName: 'Debits Local Amount', field: 'debit', type: 'numericColumn', tooltipField: 'debit' },
|
|
103
|
-
{ headerName: 'Credits Local Amount', field: 'credit', type: 'numericColumn', tooltipField: 'credit' },
|
|
104
|
-
{ headerName: 'Net Movement Local Amount', field: 'netMovement', type: 'numericColumn', tooltipField: 'netMovement' },
|
|
105
|
-
{ headerName: 'Closing Balance Local Amount', field: 'closingBalance', type: 'numericColumn', tooltipField: 'closingBalance' }
|
|
106
|
-
];
|
|
107
|
-
|
|
108
|
-
rowData: AccountDetail[] = [];
|
|
109
|
-
gridColumnApi: ColumnApi;
|
|
110
|
-
|
|
111
|
-
constructor(private reportService: ReportService, private exportService: ExportService) { }
|
|
112
|
-
|
|
113
|
-
ngOnInit(): void { }
|
|
114
|
-
|
|
115
|
-
getTrialBalanceAccountsReport(req: any) {
|
|
116
|
-
|
|
117
|
-
this.dataReady = false;
|
|
118
|
-
this.trialBalanceReport = null;
|
|
119
|
-
this.loadingState = ComponentLoadingStates.Loading;
|
|
120
|
-
|
|
121
|
-
this.reportService.getTrialBalanceAccountsReport(req).subscribe({
|
|
122
|
-
next: (report: TrialBalanceReport) => {
|
|
123
|
-
this.trialBalanceReport = report;
|
|
124
|
-
this.dataReady = true;
|
|
125
|
-
this.reportUser = this.trialBalanceReport.reportUser;
|
|
126
|
-
this.reportTime = formatDate(new Date(), 'dd/MM/yyyy hh:mm a', 'en-US');
|
|
127
|
-
this.reportPeriod = req.reportPeriod;
|
|
128
|
-
|
|
129
|
-
this.accountStatus = req.accountStatus;
|
|
130
|
-
this.currency = req.currency;
|
|
131
|
-
this.dateType = req.dateType == "VD" ? "Value Date" : "Posting Date";
|
|
132
|
-
this.businessUnit = req.businessUnit;
|
|
133
|
-
|
|
134
|
-
this.rowData = this.flattenReport(report).map(acc => ({
|
|
135
|
-
...acc,
|
|
136
|
-
openingBalance: Number(acc.openingBalance).toFixed(3),
|
|
137
|
-
debit: Number(acc.debit).toFixed(3),
|
|
138
|
-
credit: Number(acc.credit).toFixed(3),
|
|
139
|
-
netMovement: Number(acc.netMovement).toFixed(3),
|
|
140
|
-
closingBalance: Number(acc.closingBalance).toFixed(3)
|
|
141
|
-
}));
|
|
142
|
-
|
|
143
|
-
this.metaDataOne = {
|
|
144
|
-
'Report Period': this.reportPeriod,
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
this.metaDataTwo = {
|
|
148
|
-
'Report User & Time': `${this.reportUser} @ ${this.reportTime}`,
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const searchCriteria: [string, string][] = [
|
|
152
|
-
['Account Status:', this.accountStatus],
|
|
153
|
-
['Currency:', this.currency],
|
|
154
|
-
['Date Type:', this.dateType],
|
|
155
|
-
['From Date:', this.fromDate],
|
|
156
|
-
['Business Unit:', this.businessUnit],
|
|
157
|
-
['To Date:', this.toDate],
|
|
158
|
-
];
|
|
159
|
-
|
|
160
|
-
this.searchCriteria = searchCriteria;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.loadingState = ComponentLoadingStates.Complete;
|
|
164
|
-
},
|
|
165
|
-
error: (err) => {
|
|
166
|
-
console.error('Error fetching trial balance report:', err);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
flattenReport(report: TrialBalanceReport): AccountDetail[] {
|
|
172
|
-
const rows: AccountDetail[] = [];
|
|
173
|
-
|
|
174
|
-
report.mainCOAGroups.forEach(main => {
|
|
175
|
-
main.subCOAGroups.forEach(sub => {
|
|
176
|
-
sub.coaGroups.forEach(coa => {
|
|
177
|
-
coa.accounts.forEach(account => rows.push(account));
|
|
178
|
-
|
|
179
|
-
rows.push({
|
|
180
|
-
companyFullName: '',
|
|
181
|
-
coaCode: '',
|
|
182
|
-
accountCode: 'Total:',
|
|
183
|
-
accountDescription: `${coa.coaDescription}`,
|
|
184
|
-
openingBalance: Number(coa.totals.openingBalance).toFixed(3),
|
|
185
|
-
debit: Number(coa.totals.debit).toFixed(3),
|
|
186
|
-
credit: Number(coa.totals.credit).toFixed(3),
|
|
187
|
-
netMovement: Number(coa.totals.netMovement).toFixed(3),
|
|
188
|
-
closingBalance: Number(coa.totals.closingBalance).toFixed(3),
|
|
189
|
-
isTotalRow: true
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
rows.push({
|
|
194
|
-
companyFullName: '',
|
|
195
|
-
coaCode: '',
|
|
196
|
-
accountCode: 'Total:',
|
|
197
|
-
accountDescription: `${sub.subCOADescription}`,
|
|
198
|
-
openingBalance: Number(sub.totals.openingBalance).toFixed(3),
|
|
199
|
-
debit: Number(sub.totals.debit).toFixed(3),
|
|
200
|
-
credit: Number(sub.totals.credit).toFixed(3),
|
|
201
|
-
netMovement: Number(sub.totals.netMovement).toFixed(3),
|
|
202
|
-
closingBalance: Number(sub.totals.closingBalance).toFixed(3),
|
|
203
|
-
isTotalRow: true
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
rows.push({
|
|
208
|
-
companyFullName: '',
|
|
209
|
-
coaCode: '',
|
|
210
|
-
accountCode: 'Total:',
|
|
211
|
-
accountDescription: `${main.mainCOADescription}`,
|
|
212
|
-
openingBalance: Number(main.totals.openingBalance).toFixed(3),
|
|
213
|
-
debit: Number(main.totals.debit).toFixed(3),
|
|
214
|
-
credit: Number(main.totals.credit).toFixed(3),
|
|
215
|
-
netMovement: Number(main.totals.netMovement).toFixed(3),
|
|
216
|
-
closingBalance: Number(main.totals.closingBalance).toFixed(3),
|
|
217
|
-
isTotalRow: true
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
rows.push({
|
|
222
|
-
companyFullName: '',
|
|
223
|
-
coaCode: 'TOTAL:',
|
|
224
|
-
accountCode: '',
|
|
225
|
-
accountDescription: '',
|
|
226
|
-
openingBalance: Number(report.grandTotal.openingBalance).toFixed(3),
|
|
227
|
-
debit: Number(report.grandTotal.debit).toFixed(3),
|
|
228
|
-
credit: Number(report.grandTotal.credit).toFixed(3),
|
|
229
|
-
netMovement: Number(report.grandTotal.netMovement).toFixed(3),
|
|
230
|
-
closingBalance: Number(report.grandTotal.closingBalance).toFixed(3),
|
|
231
|
-
isTotalRow: true
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
return rows;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
onGridReady(params: GridReadyEvent) {
|
|
238
|
-
this.gridApi = params.api;
|
|
239
|
-
this.gridColumnApi = params.columnApi;
|
|
240
|
-
|
|
241
|
-
const allColumnIds: string[] = [];
|
|
242
|
-
params.columnApi.getColumns().forEach((column: any) => {
|
|
243
|
-
allColumnIds.push(column.getColId());
|
|
244
|
-
});
|
|
245
|
-
params.columnApi.autoSizeColumns(allColumnIds);
|
|
246
|
-
this.onResize();
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
@HostListener('window:resize', ['$event'])
|
|
250
|
-
onResize() {
|
|
251
|
-
if (this.gridApi && this.gridApi.sizeColumnsToFit) {
|
|
252
|
-
this.gridApi.sizeColumnsToFit();
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
onSearch(text: string): void {
|
|
257
|
-
const normalize = (str: any): string =>
|
|
258
|
-
str
|
|
259
|
-
?.toString()
|
|
260
|
-
.toLowerCase()
|
|
261
|
-
.replace(/,/g, '')
|
|
262
|
-
.replace(/\s+/g, ' ')
|
|
263
|
-
.replace(/[\u200B-\u200D\uFEFF]/g, '')
|
|
264
|
-
.trim();
|
|
265
|
-
|
|
266
|
-
const search = normalize(text);
|
|
267
|
-
|
|
268
|
-
if (search) {
|
|
269
|
-
// filter from already formatted rowData
|
|
270
|
-
this.rowData = this.flattenReport(this.trialBalanceReport)
|
|
271
|
-
.map(acc => ({
|
|
272
|
-
...acc,
|
|
273
|
-
openingBalance: Number(acc.openingBalance).toFixed(3),
|
|
274
|
-
debit: Number(acc.debit).toFixed(3),
|
|
275
|
-
credit: Number(acc.credit).toFixed(3),
|
|
276
|
-
netMovement: Number(acc.netMovement).toFixed(3),
|
|
277
|
-
closingBalance: Number(acc.closingBalance).toFixed(3)
|
|
278
|
-
}))
|
|
279
|
-
.filter(item =>
|
|
280
|
-
Object.values(item).some(value => normalize(value).includes(search))
|
|
281
|
-
);
|
|
282
|
-
} else {
|
|
283
|
-
this.rowData = this.flattenReport(this.trialBalanceReport)
|
|
284
|
-
.map(acc => ({
|
|
285
|
-
...acc,
|
|
286
|
-
openingBalance: Number(acc.openingBalance).toFixed(3),
|
|
287
|
-
debit: Number(acc.debit).toFixed(3),
|
|
288
|
-
credit: Number(acc.credit).toFixed(3),
|
|
289
|
-
netMovement: Number(acc.netMovement).toFixed(3),
|
|
290
|
-
closingBalance: Number(acc.closingBalance).toFixed(3)
|
|
291
|
-
}));
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
handleExport(option: string): void {
|
|
296
|
-
this.selectedExportOption = option;
|
|
297
|
-
switch (this.selectedExportOption) {
|
|
298
|
-
case 'excel':
|
|
299
|
-
this.exportToExcel();
|
|
300
|
-
break;
|
|
301
|
-
case 'pdf':
|
|
302
|
-
this.exportToPdf();
|
|
303
|
-
break;
|
|
304
|
-
case 'csv':
|
|
305
|
-
this.exportToCsv();
|
|
306
|
-
break;
|
|
307
|
-
default:
|
|
308
|
-
alert('Please select an export format.');
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
exportToPdf(): void {
|
|
313
|
-
if (!this.trialBalanceReport?.mainCOAGroups?.length) return;
|
|
314
|
-
|
|
315
|
-
const title = 'Xpress Money - MI Accounts';
|
|
316
|
-
const fileName = 'Trial-Balance-Accounts-Raw.pdf';
|
|
317
|
-
|
|
318
|
-
// --- page & layout ---
|
|
319
|
-
const doc = new jsPDF({ orientation: 'landscape', unit: 'mm', format: [312, 210] });
|
|
320
|
-
const pageWidth = doc.internal.pageSize.getWidth();
|
|
321
|
-
const marginLeft = 15;
|
|
322
|
-
const logoWidth = 38.4, logoHeight = 17.5, logoX = marginLeft, logoY = 8;
|
|
323
|
-
const titleY = 18;
|
|
324
|
-
let currentY = titleY + 14;
|
|
325
|
-
|
|
326
|
-
const labelValueGap = 2;
|
|
327
|
-
const pairGap = 15;
|
|
328
|
-
|
|
329
|
-
// --- metadata ---
|
|
330
|
-
const metadata: [string, string][] = [
|
|
331
|
-
['Report Period:', this.reportPeriod],
|
|
332
|
-
['Report User & Time : ', `${this.reportUser}@${this.reportTime}`],
|
|
333
|
-
];
|
|
334
|
-
|
|
335
|
-
// --- search criteria ---
|
|
336
|
-
const searchCriteria = this.searchCriteria;
|
|
337
|
-
|
|
338
|
-
// --- draw logo + title ---
|
|
339
|
-
if (this.exportService?.logoBase64) {
|
|
340
|
-
try {
|
|
341
|
-
doc.addImage(this.exportService.logoBase64, 'PNG', logoX, logoY, logoWidth, logoHeight);
|
|
342
|
-
} catch { }
|
|
343
|
-
}
|
|
344
|
-
doc.setFontSize(15);
|
|
345
|
-
doc.setFont('helvetica', 'bold');
|
|
346
|
-
doc.text(title, pageWidth / 2, titleY, { align: 'center' });
|
|
347
|
-
|
|
348
|
-
// --- draw metadata ---
|
|
349
|
-
doc.setFontSize(10);
|
|
350
|
-
metadata.forEach(([label, value], i) => {
|
|
351
|
-
const y = currentY + i * 6;
|
|
352
|
-
doc.setFont('helvetica', 'bold');
|
|
353
|
-
doc.text(label, marginLeft, y);
|
|
354
|
-
doc.setFont('helvetica', 'normal');
|
|
355
|
-
const labelWidth = doc.getTextWidth(label + ' ');
|
|
356
|
-
doc.text(value, marginLeft + labelWidth + labelValueGap, y);
|
|
357
|
-
});
|
|
358
|
-
currentY += metadata.length * 6 + 6;
|
|
359
|
-
|
|
360
|
-
// --- draw search criteria heading ---
|
|
361
|
-
doc.setFont('helvetica', 'bold');
|
|
362
|
-
doc.text('Search Criteria:-', marginLeft, currentY);
|
|
363
|
-
currentY += 8;
|
|
364
|
-
|
|
365
|
-
// --- draw search criteria pairs ---
|
|
366
|
-
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
367
|
-
const left = searchCriteria[i];
|
|
368
|
-
const right = searchCriteria[i + 1]; // may be undefined
|
|
369
|
-
|
|
370
|
-
// --- Left side ---
|
|
371
|
-
if (left) {
|
|
372
|
-
doc.setFont('helvetica', 'bold');
|
|
373
|
-
doc.text(left[0], marginLeft, currentY);
|
|
374
|
-
doc.setFont('helvetica', 'normal');
|
|
375
|
-
const leftLabelWidth = doc.getTextWidth(left[0] + ' ');
|
|
376
|
-
doc.text(left[1] ?? '', marginLeft + leftLabelWidth + labelValueGap, currentY);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// --- Right side (if available) ---
|
|
380
|
-
if (right) {
|
|
381
|
-
doc.setFont('helvetica', 'bold');
|
|
382
|
-
doc.text(right[0], pageWidth / 2, currentY);
|
|
383
|
-
doc.setFont('helvetica', 'normal');
|
|
384
|
-
const rightLabelWidth = doc.getTextWidth(right[0] + ' ');
|
|
385
|
-
doc.text(right[1] ?? '', pageWidth / 2 + rightLabelWidth + labelValueGap, currentY);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
currentY += 6; // move down for next line
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
currentY += 4;
|
|
392
|
-
|
|
393
|
-
// --- headers ---
|
|
394
|
-
const headers = [
|
|
395
|
-
'Sr No',
|
|
396
|
-
'COA Code', 'Account Code', 'Account Description',
|
|
397
|
-
'Opening Balance Local Amt', 'Debits Local Amt', 'Credits Local Amt',
|
|
398
|
-
'Net Movement Local Amt', 'Closing Balance Local Amt'
|
|
399
|
-
];
|
|
400
|
-
|
|
401
|
-
const flatReport = this.flattenReport(this.trialBalanceReport);
|
|
402
|
-
|
|
403
|
-
// --- rows ---
|
|
404
|
-
const rows: any[][] = flatReport.map((acc, i) => [
|
|
405
|
-
i + 1,
|
|
406
|
-
acc.coaCode,
|
|
407
|
-
acc.accountCode,
|
|
408
|
-
acc.accountDescription,
|
|
409
|
-
acc.openingBalance != null ? Number(acc.openingBalance).toFixed(3) : "",
|
|
410
|
-
acc.debit != null ? Number(acc.debit).toFixed(3) : "",
|
|
411
|
-
acc.credit != null ? Number(acc.credit).toFixed(3) : "",
|
|
412
|
-
acc.netMovement != null ? Number(acc.netMovement).toFixed(3) : "",
|
|
413
|
-
acc.closingBalance != null ? Number(acc.closingBalance).toFixed(3) : ""
|
|
414
|
-
]);
|
|
415
|
-
|
|
416
|
-
// --- column widths ---
|
|
417
|
-
const columnStyles: { [key: number]: any } = {
|
|
418
|
-
0: { cellWidth: 15 },
|
|
419
|
-
1: { cellWidth: 25 },
|
|
420
|
-
2: { cellWidth: 25 },
|
|
421
|
-
3: { cellWidth: 70 },
|
|
422
|
-
4: { cellWidth: 30 },
|
|
423
|
-
5: { cellWidth: 30 },
|
|
424
|
-
6: { cellWidth: 30 },
|
|
425
|
-
7: { cellWidth: 30 },
|
|
426
|
-
8: { cellWidth: 30 },
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
// --- draw table ---
|
|
430
|
-
(doc as any).autoTable({
|
|
431
|
-
head: [headers],
|
|
432
|
-
body: rows,
|
|
433
|
-
startY: currentY,
|
|
434
|
-
theme: 'grid',
|
|
435
|
-
headStyles: {
|
|
436
|
-
fillColor: [220, 220, 220],
|
|
437
|
-
textColor: 0,
|
|
438
|
-
fontStyle: 'bold',
|
|
439
|
-
fontSize: 9,
|
|
440
|
-
halign: 'center',
|
|
441
|
-
cellWidth: 'wrap',
|
|
442
|
-
minCellHeight: 10
|
|
443
|
-
},
|
|
444
|
-
bodyStyles: {
|
|
445
|
-
fontSize: 8,
|
|
446
|
-
fillColor: [255, 255, 255],
|
|
447
|
-
textColor: [0, 0, 0]
|
|
448
|
-
},
|
|
449
|
-
styles: { cellPadding: 2, overflow: 'linebreak', minCellHeight: 6 },
|
|
450
|
-
columnStyles,
|
|
451
|
-
didParseCell: (data: any) => {
|
|
452
|
-
const rowIndex = data.row.index;
|
|
453
|
-
const rowData = flatReport[rowIndex];
|
|
454
|
-
const isTotalRow = rowData.isTotalRow;
|
|
455
|
-
|
|
456
|
-
if (isTotalRow) data.cell.styles.fontStyle = 'bold';
|
|
457
|
-
|
|
458
|
-
// highlight negatives in red
|
|
459
|
-
if (data.column.index > 3) {
|
|
460
|
-
const keyMap = ["openingBalance", "debit", "credit", "netMovement", "closingBalance"];
|
|
461
|
-
const key = keyMap[data.column.index - 4];
|
|
462
|
-
const raw = rowData[key];
|
|
463
|
-
const num = Number(raw);
|
|
464
|
-
if (!isNaN(num) && num < 0) {
|
|
465
|
-
data.cell.styles.textColor = [255, 0, 0];
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// --- page numbers ---
|
|
472
|
-
const totalPages = (doc as any).internal.getNumberOfPages();
|
|
473
|
-
for (let i = 1; i <= totalPages; i++) {
|
|
474
|
-
doc.setPage(i);
|
|
475
|
-
doc.setFontSize(9);
|
|
476
|
-
const footerY = doc.internal.pageSize.height - 6;
|
|
477
|
-
doc.text(`Page ${i} of ${totalPages}`, pageWidth - 15, footerY, { align: 'right' });
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// --- save PDF ---
|
|
481
|
-
doc.save(fileName);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
exportToExcel(): void {
|
|
485
|
-
if (!this.trialBalanceReport?.mainCOAGroups?.length) return;
|
|
486
|
-
|
|
487
|
-
const fileName = 'Trial-Balance-Accounts-Raw.xlsx';
|
|
488
|
-
const workbook = new ExcelJS.Workbook();
|
|
489
|
-
const sheet = workbook.addWorksheet('Trial Balance');
|
|
490
|
-
|
|
491
|
-
let currentRow = 1;
|
|
492
|
-
|
|
493
|
-
// --- add logo if available ---
|
|
494
|
-
if (this.exportService?.logoBase64) {
|
|
495
|
-
const base64Data = this.exportService.logoBase64.replace(/^data:image\/\w+;base64,/, '');
|
|
496
|
-
const imageId = workbook.addImage({ base64: base64Data, extension: 'png' });
|
|
497
|
-
sheet.addImage(imageId, { tl: { col: 0, row: 0 }, ext: { width: 120, height: 60 }, editAs: 'oneCell' });
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// --- title ---
|
|
501
|
-
const title = 'Xpress Money - MI Accounts';
|
|
502
|
-
sheet.mergeCells(1, 3, 1, 9);
|
|
503
|
-
const titleCell = sheet.getCell('C1');
|
|
504
|
-
titleCell.value = title;
|
|
505
|
-
titleCell.font = { size: 15, bold: true };
|
|
506
|
-
titleCell.alignment = { horizontal: 'center', vertical: 'middle' };
|
|
507
|
-
currentRow = 4;
|
|
508
|
-
|
|
509
|
-
// --- metadata ---
|
|
510
|
-
const metadata: [string, string][] = [
|
|
511
|
-
['Report Period:', this.reportPeriod],
|
|
512
|
-
['Report User & Time : ', `${this.reportUser}@${this.reportTime}`],
|
|
513
|
-
];
|
|
514
|
-
metadata.forEach(([label, value]) => {
|
|
515
|
-
sheet.mergeCells(currentRow, 1, currentRow, 6);
|
|
516
|
-
const row = sheet.getRow(currentRow++);
|
|
517
|
-
row.getCell(1).value = { richText: [{ text: label + ' ', font: { bold: true } }, { text: value }] };
|
|
518
|
-
row.getCell(1).alignment = { vertical: 'middle', wrapText: true };
|
|
519
|
-
});
|
|
520
|
-
currentRow++;
|
|
521
|
-
|
|
522
|
-
// --- search criteria heading ---
|
|
523
|
-
sheet.mergeCells(currentRow, 1, currentRow, 6);
|
|
524
|
-
sheet.getCell(currentRow, 1).value = 'Search Criteria:-';
|
|
525
|
-
sheet.getCell(currentRow, 1).font = { bold: true };
|
|
526
|
-
currentRow += 2;
|
|
527
|
-
|
|
528
|
-
// --- search criteria ---
|
|
529
|
-
const searchCriteria = this.searchCriteria;
|
|
530
|
-
|
|
531
|
-
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
532
|
-
const left = searchCriteria[i];
|
|
533
|
-
const right = searchCriteria[i + 1]; // may be undefined
|
|
534
|
-
const row = sheet.getRow(currentRow++);
|
|
535
|
-
|
|
536
|
-
// Left cell
|
|
537
|
-
sheet.mergeCells(row.number, 1, row.number, 3);
|
|
538
|
-
row.getCell(1).value = {
|
|
539
|
-
richText: [
|
|
540
|
-
{ text: (left?.[0] ?? '') + ' ', font: { bold: true } },
|
|
541
|
-
{ text: left?.[1] ?? '' }
|
|
542
|
-
]
|
|
543
|
-
};
|
|
544
|
-
row.getCell(1).alignment = { wrapText: true, vertical: 'middle' };
|
|
545
|
-
|
|
546
|
-
// Right cell (only if present)
|
|
547
|
-
if (right) {
|
|
548
|
-
sheet.mergeCells(row.number, 4, row.number, 6);
|
|
549
|
-
row.getCell(4).value = {
|
|
550
|
-
richText: [
|
|
551
|
-
{ text: (right?.[0] ?? '') + ' ', font: { bold: true } },
|
|
552
|
-
{ text: right?.[1] ?? '' }
|
|
553
|
-
]
|
|
554
|
-
};
|
|
555
|
-
row.getCell(4).alignment = { wrapText: true, vertical: 'middle' };
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
currentRow++;
|
|
559
|
-
|
|
560
|
-
// --- headers ---
|
|
561
|
-
const headers = [
|
|
562
|
-
'Sr No',
|
|
563
|
-
'COA Code', 'Account Code', 'Account Description',
|
|
564
|
-
'Opening Balance Local Amt', 'Debits Local Amt', 'Credits Local Amt',
|
|
565
|
-
'Net Movement Local Amt', 'Closing Balance Local Amt'
|
|
566
|
-
];
|
|
567
|
-
const headerRow = sheet.getRow(currentRow++);
|
|
568
|
-
headers.forEach((h, i) => {
|
|
569
|
-
const cell = headerRow.getCell(i + 1);
|
|
570
|
-
cell.value = h;
|
|
571
|
-
cell.font = { bold: true };
|
|
572
|
-
cell.alignment = { horizontal: 'center', vertical: 'middle', wrapText: true };
|
|
573
|
-
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'DCDCDC' } };
|
|
574
|
-
cell.border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
|
|
575
|
-
});
|
|
576
|
-
|
|
577
|
-
// --- rows with 3 decimals for numeric columns ---
|
|
578
|
-
const rows = this.flattenReport(this.trialBalanceReport).map((acc, idx) => {
|
|
579
|
-
const numericColumns = ['openingBalance', 'debit', 'credit', 'netMovement', 'closingBalance'];
|
|
580
|
-
const rowData = numericColumns.map(col => {
|
|
581
|
-
const val = Number(acc[col]);
|
|
582
|
-
return !isNaN(val) ? val.toFixed(3) : '';
|
|
583
|
-
});
|
|
584
|
-
return [
|
|
585
|
-
idx + 1,
|
|
586
|
-
acc.coaCode,
|
|
587
|
-
acc.accountCode,
|
|
588
|
-
acc.accountDescription,
|
|
589
|
-
...rowData,
|
|
590
|
-
acc.isTotalRow || false
|
|
591
|
-
];
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
rows.forEach(r => {
|
|
595
|
-
const row = sheet.getRow(currentRow++);
|
|
596
|
-
r.slice(0, 9).forEach((val, i) => {
|
|
597
|
-
const cell = row.getCell(i + 1);
|
|
598
|
-
// convert back to number for Excel math but show 3 decimals
|
|
599
|
-
if (i > 3 && val !== '') cell.value = parseFloat(val.toString());
|
|
600
|
-
else cell.value = val;
|
|
601
|
-
|
|
602
|
-
cell.border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
|
|
603
|
-
|
|
604
|
-
// bold total rows
|
|
605
|
-
if (r[9]) cell.font = { bold: true };
|
|
606
|
-
|
|
607
|
-
// negative numbers red
|
|
608
|
-
if (i > 3 && typeof cell.value === 'number' && cell.value < 0) {
|
|
609
|
-
cell.font = { color: { argb: 'FF0000' }, bold: r[9] ? true : undefined };
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
// set number format to show 3 decimals
|
|
613
|
-
if (i > 3) cell.numFmt = '0.000';
|
|
614
|
-
});
|
|
615
|
-
});
|
|
616
|
-
|
|
617
|
-
// --- column widths ---
|
|
618
|
-
const widths = [8, 15, 15, 40, 20, 20, 20, 20, 20];
|
|
619
|
-
widths.forEach((w, i) => sheet.getColumn(i + 1).width = w);
|
|
620
|
-
|
|
621
|
-
// --- save file ---
|
|
622
|
-
workbook.xlsx.writeBuffer().then(buffer => {
|
|
623
|
-
const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
624
|
-
FileSaver.saveAs(blob, fileName);
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
exportToCsv(): void {
|
|
629
|
-
if (!this.trialBalanceReport?.mainCOAGroups?.length) return;
|
|
630
|
-
|
|
631
|
-
const fileName = 'Trial-Balance-Accounts-Raw.csv';
|
|
632
|
-
|
|
633
|
-
// --- metadata ---
|
|
634
|
-
const metadata: [string, string][] = [
|
|
635
|
-
['Report Title:', 'Xpress Money - MI Accounts'],
|
|
636
|
-
['Report Period:', this.reportPeriod],
|
|
637
|
-
['Report User & Time : ', `${this.reportUser}@${this.reportTime}`],
|
|
638
|
-
];
|
|
639
|
-
|
|
640
|
-
// --- search criteria ---
|
|
641
|
-
const searchCriteria = this.searchCriteria;
|
|
642
|
-
|
|
643
|
-
// --- table headers (add Sr No at start) ---
|
|
644
|
-
const headers = [
|
|
645
|
-
'Sr No',
|
|
646
|
-
'COA Code', 'Account Code', 'Account Description',
|
|
647
|
-
'Opening Balance Local Amt', 'Debits Local Amt', 'Credits Local Amt',
|
|
648
|
-
'Net Movement Local Amt', 'Closing Balance Local Amt'
|
|
649
|
-
];
|
|
650
|
-
|
|
651
|
-
// --- table rows (prepend Sr No) ---
|
|
652
|
-
const rows: any[][] = this.flattenReport(this.trialBalanceReport).map((acc, index) => [
|
|
653
|
-
index + 1, // Sr No
|
|
654
|
-
acc.coaCode,
|
|
655
|
-
acc.accountCode,
|
|
656
|
-
acc.accountDescription,
|
|
657
|
-
Number(acc.openingBalance).toFixed(3),
|
|
658
|
-
Number(acc.debit).toFixed(3),
|
|
659
|
-
Number(acc.credit).toFixed(3),
|
|
660
|
-
Number(acc.netMovement).toFixed(3),
|
|
661
|
-
Number(acc.closingBalance).toFixed(3)
|
|
662
|
-
]);
|
|
663
|
-
|
|
664
|
-
// --- helper to escape CSV values ---
|
|
665
|
-
const escapeCsv = (value: any) => {
|
|
666
|
-
if (value === null || value === undefined) return '';
|
|
667
|
-
const str = value.toString();
|
|
668
|
-
return str.includes(',') || str.includes('"') || str.includes('\n')
|
|
669
|
-
? `"${str.replace(/"/g, '""')}"`
|
|
670
|
-
: str;
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
// --- build CSV content ---
|
|
674
|
-
let csvContent = '';
|
|
675
|
-
|
|
676
|
-
// metadata
|
|
677
|
-
metadata.forEach(([label, value]) => {
|
|
678
|
-
csvContent += `${escapeCsv(label)}${escapeCsv(value)},\n`;
|
|
679
|
-
});
|
|
680
|
-
csvContent += '\n'; // gap
|
|
681
|
-
|
|
682
|
-
// --- search criteria heading ---
|
|
683
|
-
csvContent += 'Search Criteria:-\n';
|
|
684
|
-
|
|
685
|
-
// --- search criteria (2 per row, dynamic) ---
|
|
686
|
-
for (let i = 0; i < searchCriteria.length; i += 2) {
|
|
687
|
-
const left = searchCriteria[i];
|
|
688
|
-
const right = searchCriteria[i + 1];
|
|
689
|
-
|
|
690
|
-
// Left side
|
|
691
|
-
if (left) csvContent += `${escapeCsv(left[0])} ${escapeCsv(left[1])},`;
|
|
692
|
-
|
|
693
|
-
// Right side
|
|
694
|
-
if (right) csvContent += ` ${escapeCsv(right[0])} ${escapeCsv(right[1])},`;
|
|
695
|
-
|
|
696
|
-
csvContent += '\n';
|
|
697
|
-
}
|
|
698
|
-
csvContent += '\n'; // blank line after criteria
|
|
699
|
-
|
|
700
|
-
// table headers
|
|
701
|
-
csvContent += headers.map(h => escapeCsv(h)).join(',') + '\n';
|
|
702
|
-
|
|
703
|
-
// table rows
|
|
704
|
-
rows.forEach(row => {
|
|
705
|
-
csvContent += row.map(cell => escapeCsv(cell)).join(',') + '\n';
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
// --- trigger download ---
|
|
709
|
-
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
710
|
-
const link = document.createElement('a');
|
|
711
|
-
const url = URL.createObjectURL(blob);
|
|
712
|
-
link.setAttribute('href', url);
|
|
713
|
-
link.setAttribute('download', fileName);
|
|
714
|
-
link.style.visibility = 'hidden';
|
|
715
|
-
document.body.appendChild(link);
|
|
716
|
-
link.click();
|
|
717
|
-
document.body.removeChild(link);
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
getReport(payload: any) {
|
|
721
|
-
const modal = payload?.modal || payload;
|
|
722
|
-
|
|
723
|
-
this.fromDate = formatDate(modal.fromDate, 'dd/MM/yyyy', 'en-US');
|
|
724
|
-
this.toDate = formatDate(modal.toDate, 'dd/MM/yyyy', 'en-US');
|
|
725
|
-
|
|
726
|
-
const req: TrialBalanceAccountsReportRequestDTO = {
|
|
727
|
-
year: Number(modal.financialYear),
|
|
728
|
-
dateType: modal.dateType,
|
|
729
|
-
fromDate: modal.fromDay,
|
|
730
|
-
toDate: modal.toDay,
|
|
731
|
-
accountStatus: modal.accountStatus.join(','),
|
|
732
|
-
businessUnit: modal.businessUnit,
|
|
733
|
-
currency: modal.currency,
|
|
734
|
-
companyCode: modal.businessUnit,
|
|
735
|
-
reportPeriod: `${formatDate(modal.fromDate, 'dd/MM/yyyy', 'en-US')} - ${formatDate(modal.toDate, 'dd/MM/yyyy', 'en-US')}`,
|
|
736
|
-
};
|
|
737
|
-
|
|
738
|
-
this.getTrialBalanceAccountsReport(req);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
handleFormValid(isValid: boolean): void {
|
|
742
|
-
this.isFormValid = isValid;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
}
|