shareneus 1.7.4 → 1.7.6
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/README.md +1 -0
- package/dist/accounting/invoice/invoice-pdf/invoice-pdf.service.js +18 -45
- package/dist/accounting/invoice/reports/excel/analysis-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/category-wise-item-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/cust-wise-sales-details.js +17 -7
- package/dist/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/invoice-wise-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/items-wise-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/manf-wise-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/operator-wise-details.js +17 -7
- package/dist/accounting/invoice/reports/excel/operator-wise-summary.js +17 -7
- package/dist/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sale-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.js +17 -7
- package/dist/accounting/invoice/reports/excel/scheduled-drugs-excel.service.js +17 -7
- package/dist/accounting/invoice/unified-invoice-pdf.service.d.ts +1 -1
- package/dist/accounting/payment-receive/reports/excel/cust-balance-excel.service.js +17 -7
- package/dist/accounting/payment-receive/reports/excel/payment-receive-excel.service.js +17 -7
- package/dist/common/reports/excel/product-without-owner-excel.service.js +17 -7
- package/dist/gst/excel/GSTR-RO-excel.service.js +17 -7
- package/dist/gst/excel/GSTR1-excel.service.js +17 -7
- package/dist/gst/excel/GSTR2-excel.service.js +17 -7
- package/dist/gst/excel/hsn-summary.js +17 -7
- package/dist/gst/excel/tally-sales-import.service.js +17 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/inventory/items/reports/excel/expiring-drugs-excel.service.js +17 -7
- package/dist/inventory/items/reports/excel/item-wise-mout-details.js +17 -7
- package/dist/inventory/items/reports/excel/item-wise-mout-summary.js +17 -7
- package/dist/inventory/items/reports/excel/spares-issue-excel.service.js +17 -7
- package/dist/inventory/items/reports/excel/stock-excel.service.js +17 -7
- package/dist/purchases/payment-made/reports/excel/payments-made-excel.service.js +17 -7
- package/dist/purchases/payment-made/reports/excel/ven-balance-excel.service.js +17 -7
- package/dist/services/reports/excel/insurance-expire-excel.service.js +17 -7
- package/dist/services/reports/excel/next-service-date-excel.service.js +17 -7
- package/dist/services/reports/excel/repair-orders-excel.service.js +17 -7
- package/dist/shared/table-section/pdf-table.header.d.ts +1 -1
- package/dist/shared/table-section/pdf-table.header.js +14 -2
- package/dist/shared/table-section/pdf-table.section.js +6 -13
- package/dist/{accounting/invoice/invoice-pdf.service.js → shared/transactions-pdf.service.js} +15 -15
- package/package.json +1 -1
- package/src/accounting/counter-sales/auto-sales-receipt-pdf.service.ts +569 -0
- package/src/accounting/counter-sales/pos-receipt-pdf.ts +577 -0
- package/src/accounting/counter-sales/sales-receipt-pdf.service.ts +628 -0
- package/src/accounting/counter-sales/sales-receipt-print.service.ts +506 -0
- package/src/accounting/credit-note/cn-print.service.ts +264 -0
- package/src/accounting/credit-note/credit-note-pdf.service.ts +602 -0
- package/src/accounting/credit-note/credit-note-totals.service.ts +424 -0
- package/src/accounting/debit-note/debit-note-pdf.service.ts +681 -0
- package/src/accounting/debit-note/debit-note-print.service.ts +276 -0
- package/src/accounting/debit-note/debit-note-totals.service.ts +361 -0
- package/src/accounting/invoice/hc-inv-pdf.service.ts +880 -0
- package/src/accounting/invoice/inv-pdf.service.ts +812 -0
- package/src/accounting/invoice/inv-print.service.ts +532 -0
- package/src/accounting/invoice/invoice-landscape-pdf.service.ts +947 -0
- package/src/accounting/invoice/invoice-letterhead-pdf.service.ts +813 -0
- package/src/accounting/invoice/invoice-pdf/invoice-pdf.service.ts +359 -0
- package/src/accounting/invoice/invoice-portrait-pdf.ts +972 -0
- package/src/accounting/invoice/invoice-print.service.ts +2906 -0
- package/src/accounting/invoice/invoice-total.service.ts +834 -0
- package/src/accounting/invoice/reports/excel/analysis-excel.service.ts +291 -0
- package/src/accounting/invoice/reports/excel/category-wise-item-excel.service.ts +267 -0
- package/src/accounting/invoice/reports/excel/cust-wise-sales-details.ts +321 -0
- package/src/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.ts +300 -0
- package/src/accounting/invoice/reports/excel/invoice-wise-excel.service.ts +859 -0
- package/src/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.ts +255 -0
- package/src/accounting/invoice/reports/excel/items-wise-sales-excel.service.ts +312 -0
- package/src/accounting/invoice/reports/excel/manf-wise-sales-excel.service.ts +273 -0
- package/src/accounting/invoice/reports/excel/operator-wise-details.ts +258 -0
- package/src/accounting/invoice/reports/excel/operator-wise-summary.ts +259 -0
- package/src/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.ts +230 -0
- package/src/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.ts +231 -0
- package/src/accounting/invoice/reports/excel/sale-summary-excel.service.ts +326 -0
- package/src/accounting/invoice/reports/excel/sales-by-service-details-excel.service.ts +0 -0
- package/src/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.ts +432 -0
- package/src/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.ts +373 -0
- package/src/accounting/invoice/reports/excel/scheduled-drugs-excel.service.ts +372 -0
- package/src/accounting/invoice/reports/pdf/analysis-pdf.service.ts +113 -0
- package/src/accounting/invoice/reports/pdf/category-wise-item-pdf.service.ts +107 -0
- package/src/accounting/invoice/reports/pdf/cust-wise-sales-details-pdf.service.ts +125 -0
- package/src/accounting/invoice/reports/pdf/cust-wise-sales-summary-pdf.service.ts +119 -0
- package/src/accounting/invoice/reports/pdf/item-wise-doctor-sale-pdf.service.ts +180 -0
- package/src/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.ts +193 -0
- package/src/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.ts +188 -0
- package/src/accounting/invoice/reports/pdf/operator-wise-details-pdf.service.ts +118 -0
- package/src/accounting/invoice/reports/pdf/operator-wise-summary-pdf.ts +116 -0
- package/src/accounting/invoice/reports/pdf/sales-by-service-pdf.service.ts +132 -0
- package/src/accounting/invoice/reports/pdf/scheduled-drug-pdf.service.ts +191 -0
- package/src/accounting/invoice/reports/pdf/scheduled-drug-summary-pdf.service.ts +202 -0
- package/src/accounting/invoice/shared-inv-pdf.service.ts +787 -0
- package/src/accounting/invoice/unified-invoice-pdf.service.ts +937 -0
- package/src/accounting/payment-receive/payment-pdf.service.ts +410 -0
- package/src/accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service.ts +470 -0
- package/src/accounting/payment-receive/receipt-print.service.ts +71 -0
- package/src/accounting/payment-receive/reports/excel/cust-balance-excel.service.ts +298 -0
- package/src/accounting/payment-receive/reports/excel/payment-receive-excel.service.ts +221 -0
- package/src/accounting/payment-receive/reports/pdf/customer-balances-pdf.service.ts +182 -0
- package/src/accounting/payment-receive/reports/pdf/payment-report-pdf.service.ts +116 -0
- package/src/aggregation/aggregation.ts +58 -0
- package/src/appointments/appointments/appointment-total.service.ts +298 -0
- package/src/appointments/consultations/consultation-fee-receipt.service.ts +407 -0
- package/src/appointments/consultations/consultation-full-pdf.service.ts +238 -0
- package/src/appointments/consultations/consultation-letterhead-pdf.service.ts +430 -0
- package/src/appointments/consultations/consultation-pdf.service.ts +417 -0
- package/src/common/reports/excel/product-without-owner-excel.service.ts +308 -0
- package/src/common/reports/pdf/product-without-owner-pdf.service.ts +146 -0
- package/src/enums/cache-enums.ts +33 -0
- package/src/enums/code-enums.ts +291 -0
- package/src/enums/country-enums.ts +9 -0
- package/src/enums/enums.ts +364 -0
- package/src/enums/industry-enums.ts +26 -0
- package/src/enums/treatment-enums.ts +9 -0
- package/src/gst/excel/GSTR-RO-excel.service.ts +926 -0
- package/src/gst/excel/GSTR1-excel.service.ts +313 -0
- package/src/gst/excel/GSTR2-excel.service.ts +314 -0
- package/src/gst/excel/hsn-summary.ts +314 -0
- package/src/gst/excel/tally-sales-import.service.ts +767 -0
- package/src/gst/pdf/hsn-summary-pdf.ts +176 -0
- package/src/index.ts +194 -0
- package/src/inventory/items/adjustment-pdf.service.ts +177 -0
- package/src/inventory/items/issue-parts-pdf.service.ts +795 -0
- package/src/inventory/items/item-bar-code-label-pdf.ts +194 -0
- package/src/inventory/items/item-detais-pdf.ts +141 -0
- package/src/inventory/items/item-price-for-pricelist.ts +368 -0
- package/src/inventory/items/reports/excel/expiring-drugs-excel.service.ts +290 -0
- package/src/inventory/items/reports/excel/item-wise-mout-details.ts +284 -0
- package/src/inventory/items/reports/excel/item-wise-mout-summary.ts +279 -0
- package/src/inventory/items/reports/excel/spares-issue-excel.service.ts +494 -0
- package/src/inventory/items/reports/excel/stock-excel.service.ts +319 -0
- package/src/inventory/items/reports/pdf/expiring-drugs-pdf.service.ts +172 -0
- package/src/inventory/items/reports/pdf/item-wise-mout-details-pdf.ts +122 -0
- package/src/inventory/items/reports/pdf/item-wise-mout-summary-pdf.ts +115 -0
- package/src/inventory/items/reports/pdf/reorder-point-pdf.service.ts +163 -0
- package/src/inventory/material-out/mout-pdf.service.ts +545 -0
- package/src/inventory/transfer-order/transfer-order-pdf.service.ts +154 -0
- package/src/purchases/bills/bill-pdf/bill-pdf.service.ts +211 -0
- package/src/purchases/bills/bill-pdf.service.ts +21 -0
- package/src/purchases/payment-made/reports/excel/payments-made-excel.service.ts +313 -0
- package/src/purchases/payment-made/reports/excel/ven-balance-excel.service.ts +307 -0
- package/src/purchases/payment-made/reports/pdf/vendor-balances-pdf.service.ts +114 -0
- package/src/purchases/purchase-order/po-totals.service.ts +343 -0
- package/src/purchases/purchase-order/purchase-order-pdf.service.ts +1016 -0
- package/src/purchases/purchase-order/purchase-order-print.service.ts +279 -0
- package/src/purchases/purchase-order/purchase-order-totals.service.ts +637 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-pdf.service.ts +1055 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-print.service.ts +145 -0
- package/src/purchases/vendor-credit-note/vendor-credit-note-totals.service.ts +399 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-pdf.service.ts +582 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-print.service.ts +295 -0
- package/src/purchases/vendor-debit-note/vendor-debit-note-totals.service.ts +377 -0
- package/src/sales/delivery-challan/dc-landscape-pdf.service.ts +922 -0
- package/src/sales/delivery-challan/dc-landscape-without-price-pdf.service.ts +869 -0
- package/src/sales/delivery-challan/dc-without-price-pdf.service.ts +505 -0
- package/src/sales/delivery-challan/delivery-challan-pdf.service.ts +461 -0
- package/src/sales/delivery-challan/delivery-challan-print.service.ts +229 -0
- package/src/sales/delivery-challan/delivery-challan-totals.ts +466 -0
- package/src/sales/sales/equipment-design-pdf.service.ts +153 -0
- package/src/sales/sales/pack-ship-pdf.service.ts +128 -0
- package/src/sales/sales/pack-ship-print.service.ts +198 -0
- package/src/sales/sales/sales-pdf.service.ts +658 -0
- package/src/sales/sales/sales-print.service.ts +376 -0
- package/src/sales/sales/sales-totals.service.ts +500 -0
- package/src/sales-receive/sales-receive-pdf.service.ts +602 -0
- package/src/sales-receive/sales-receive-print.service.ts +242 -0
- package/src/sales-receive/sales-receive-totals.service.ts +651 -0
- package/src/services/checklist-pdf.ts +151 -0
- package/src/services/checklists-pdf.ts +133 -0
- package/src/services/est.print-service.ts +1155 -0
- package/src/services/reports/excel/insurance-expire-excel.service.ts +292 -0
- package/src/services/reports/excel/next-service-date-excel.service.ts +317 -0
- package/src/services/reports/excel/repair-orders-excel.service.ts +249 -0
- package/src/services/reports/pdf/insurance-expire-pdf.service.ts +115 -0
- package/src/services/reports/pdf/next-service-date-pdf.service.ts +198 -0
- package/src/services/reports/pdf/repair-orders-pdf.service.ts +184 -0
- package/src/services/ro-pdf.service.ts +1917 -0
- package/src/services/ro-print-service.ts +881 -0
- package/src/services/ro-totals.service.ts +1314 -0
- package/src/services/separate-wo-print.service.ts +396 -0
- package/src/services/service-history-pdf.service.ts +145 -0
- package/src/services/service-price-for-pricelist.ts +649 -0
- package/src/services/technician-pdf.service.ts +234 -0
- package/src/services/technician-print.service.ts +95 -0
- package/src/shared/header-footer-section/pdf-header-footer.section.ts +519 -0
- package/src/shared/header-footer-section/pdf-shared.utils.ts +46 -0
- package/src/shared/math-operations.ts +208 -0
- package/src/shared/party-details-section/pdf-party-details.section.ts +602 -0
- package/src/shared/shared-pdf.service.ts +3042 -0
- package/src/shared/shared-print.service.ts +879 -0
- package/src/shared/table-section/pdf-table.config.ts +8 -0
- package/src/shared/table-section/pdf-table.header.ts +396 -0
- package/src/shared/table-section/pdf-table.row.ts +248 -0
- package/src/shared/table-section/pdf-table.section.ts +447 -0
- package/src/shared/totals-section/pdf-totals.section.ts +921 -0
- package/src/shared/transactions-pdf.service.ts +191 -0
- package/src/shared/util.ts +101 -0
- package/src/tasks/meetings/meeting-pdf.ts +410 -0
- package/src/tasks/tasks/task-pdf.service.ts +238 -0
- package/src/tasks/tasks/task-reports-pdf.service.ts +313 -0
- package/src/tax/index.ts +86 -0
- package/src/tax/tax-calculator.ts +1025 -0
- package/src/tax/tax.types.ts +535 -0
- package/src/transaction-calculations/discounts-distribution.ts +343 -0
- package/src/transaction-calculations/index.ts +3 -0
- package/src/transaction-calculations/total-calculation.ts +443 -0
- package/src/transaction-calculations/transaction-calculation-engine.ts +903 -0
- package/src/utils/my-date.ts +111 -0
- package/src/utils/tr-utils.ts +104 -0
- package/tsconfig.json +2 -2
- /package/dist/{accounting/invoice/invoice-pdf.service.d.ts → shared/transactions-pdf.service.d.ts} +0 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import * as XLSX from 'xlsx';
|
|
2
|
+
import { TrUtils } from '../../../../utils/tr-utils';
|
|
3
|
+
|
|
4
|
+
export class CustBalanceXlsxFileService {
|
|
5
|
+
static wb: any = {};
|
|
6
|
+
static Row: any = 2;
|
|
7
|
+
static MergeArray: any[] = [];
|
|
8
|
+
static range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
|
|
9
|
+
static ws: any = {};
|
|
10
|
+
|
|
11
|
+
static GetInvoiceWiseExcelData(MainData: any, isPhar: boolean, WOTypes: any, EntitySettings: any) {
|
|
12
|
+
this.wb = {};
|
|
13
|
+
this.ws = {};
|
|
14
|
+
this.Row = 0;
|
|
15
|
+
this.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
|
|
16
|
+
this.MergeArray = [];
|
|
17
|
+
let ws_name = 'OUT STANDING REPORT';
|
|
18
|
+
this.wb.Sheets = {};
|
|
19
|
+
this.wb.Props = {};
|
|
20
|
+
this.wb.SSF = {};
|
|
21
|
+
this.wb.SheetNames = [];
|
|
22
|
+
if (!TrUtils.IsNull(WOTypes) && WOTypes?.length !== 0) {
|
|
23
|
+
MainData = this.GetTotals(MainData, WOTypes);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.setHeadingInCell(isPhar);
|
|
27
|
+
|
|
28
|
+
this.setInvoiceDetailsInCell(MainData, isPhar, EntitySettings.DecimalsNumber);
|
|
29
|
+
|
|
30
|
+
this.ws['!ref'] = XLSX.utils.encode_range(this.range);
|
|
31
|
+
|
|
32
|
+
this.ws['!merges'] = this.MergeArray;
|
|
33
|
+
this.ws["!cols"] = [{ wch: 10 }, { wch: 15 }, { wch: 15 }, { wch: 35 }, { wch: 15 }, { wch: 15 }, { wch: 20 }, { wch: 15 }, { wch: 15 }, { wch: 20 }];
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
this.wb.SheetNames.push(ws_name);
|
|
37
|
+
|
|
38
|
+
this.wb.Sheets[ws_name] = this.ws;
|
|
39
|
+
|
|
40
|
+
return this.wb;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static GetTotals(MainData: any, WOTypes: any) {
|
|
44
|
+
MainData.forEach((InvoiceInfo: any) => {
|
|
45
|
+
// if (InvoiceInfo.VIN == null) {
|
|
46
|
+
// InvoiceInfo.VIN = '';
|
|
47
|
+
// }
|
|
48
|
+
// if (InvoiceInfo.Name == null) {
|
|
49
|
+
// InvoiceInfo.Name = '';
|
|
50
|
+
// }
|
|
51
|
+
// if (InvoiceInfo.TeNa == null) {
|
|
52
|
+
// InvoiceInfo.TeNa = '';
|
|
53
|
+
// }
|
|
54
|
+
// if (InvoiceInfo.Type == null) {
|
|
55
|
+
// InvoiceInfo.TypeName = '';
|
|
56
|
+
// } else {
|
|
57
|
+
InvoiceInfo.TypeName = this.GetWOTypeName(InvoiceInfo.Type, WOTypes);
|
|
58
|
+
// }
|
|
59
|
+
// InvoiceInfo.GSTAmount =
|
|
60
|
+
// InvoiceInfo.ItemsCGST + InvoiceInfo.ItemsSGST + InvoiceInfo.ItemsIGST;
|
|
61
|
+
// InvoiceInfo.TotalAmount = InvoiceInfo.GSTAmount + InvoiceInfo.ItemsNetAmt;
|
|
62
|
+
|
|
63
|
+
// InvoiceInfo.OpsGSTAmount =
|
|
64
|
+
// InvoiceInfo.OpsCGST + InvoiceInfo.OpsSGST + InvoiceInfo.OpsIGST;
|
|
65
|
+
// InvoiceInfo.TotalOpsAmount =
|
|
66
|
+
// InvoiceInfo.OpsGSTAmount + InvoiceInfo.OpsNetAmt;
|
|
67
|
+
});
|
|
68
|
+
return MainData;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static GetWOTypeName(Type: any, WOTypes: any) {
|
|
72
|
+
let Index: any = WOTypes.findIndex((wotype: any) => {
|
|
73
|
+
return Type === wotype._id;
|
|
74
|
+
});
|
|
75
|
+
if (Index !== -1) {
|
|
76
|
+
return WOTypes[Index].Name;
|
|
77
|
+
} else {
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static setHeadingInCell(isPhar: boolean) {
|
|
83
|
+
|
|
84
|
+
let MainHeadings: any[] = [
|
|
85
|
+
|
|
86
|
+
{
|
|
87
|
+
text: 'SNo',
|
|
88
|
+
ColRange: 1,
|
|
89
|
+
bold: true,
|
|
90
|
+
ChildHeadings: [],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
text: 'Date',
|
|
94
|
+
ColRange: 1,
|
|
95
|
+
bold: true,
|
|
96
|
+
ChildHeadings: [],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
text: isPhar ? 'Counter Sale No.' : 'Invoice No.',
|
|
100
|
+
ColRange: 1,
|
|
101
|
+
bold: true,
|
|
102
|
+
ChildHeadings: [
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
text: 'Customer Name',
|
|
107
|
+
ColRange: 1,
|
|
108
|
+
bold: true,
|
|
109
|
+
ChildHeadings: [
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
text: 'Amount',
|
|
115
|
+
ColRange: 1,
|
|
116
|
+
bold: true,
|
|
117
|
+
ChildHeadings: [],
|
|
118
|
+
},
|
|
119
|
+
// {
|
|
120
|
+
// text: 'Due',
|
|
121
|
+
// ColRange: 1,
|
|
122
|
+
// bold: true,
|
|
123
|
+
// ChildHeadings: [
|
|
124
|
+
// ],
|
|
125
|
+
// },
|
|
126
|
+
];
|
|
127
|
+
if (!isPhar) {
|
|
128
|
+
MainHeadings.splice(4, 0, {
|
|
129
|
+
text: 'Vehicle Reg No',
|
|
130
|
+
ColRange: 1,
|
|
131
|
+
bold: true,
|
|
132
|
+
ChildHeadings: [
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
text: 'Model',
|
|
137
|
+
ColRange: 1,
|
|
138
|
+
bold: true,
|
|
139
|
+
ChildHeadings: [
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
text: 'Advisor Name',
|
|
144
|
+
ColRange: 1,
|
|
145
|
+
bold: true,
|
|
146
|
+
ChildHeadings: [
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
text: 'RO NO.',
|
|
151
|
+
ColRange: 1,
|
|
152
|
+
bold: true,
|
|
153
|
+
ChildHeadings: [
|
|
154
|
+
],
|
|
155
|
+
}, {
|
|
156
|
+
text: 'RO Type',
|
|
157
|
+
ColRange: 1,
|
|
158
|
+
bold: true,
|
|
159
|
+
ChildHeadings: [
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let MainColStart: any = 0;
|
|
165
|
+
MainHeadings.forEach((MainHeader: any) => {
|
|
166
|
+
this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
|
|
167
|
+
this.MergeArray.push({
|
|
168
|
+
s: { r: this.Row, c: MainColStart },
|
|
169
|
+
e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
|
|
170
|
+
});
|
|
171
|
+
MainColStart += MainHeader.ColRange;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
this.Row += 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static setInvoiceDetailsInCell(MainData: any, isPhar: boolean, DecimalsNumber: number) {
|
|
178
|
+
MainData.forEach((Record: any, index: any) => {
|
|
179
|
+
// this.setHeading1InCell(Record.Name);
|
|
180
|
+
// this.setHeadingInCell();
|
|
181
|
+
this.SetInvoiceDataInExcel(Record, index, isPhar, DecimalsNumber);
|
|
182
|
+
// Record.Invoices.forEach((Invoice:any, index:any)=>{
|
|
183
|
+
// this.SetInvoiceDataInExcel(Invoice, index);
|
|
184
|
+
// if (Record.Invoices.length === (index + 1)) {
|
|
185
|
+
// this.setInvoiceFinalRowInCell(Record.Balance);
|
|
186
|
+
// }
|
|
187
|
+
// });
|
|
188
|
+
// this.Row += 1;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
static SetInvoiceDataInExcel(InvoiceInfo: any, index: any, isPhar: boolean, DecimalsNumber: number) {
|
|
193
|
+
// InvoiceInfo.CrDate = this.ConvertDateToReadableFormat(InvoiceInfo.CrDate);
|
|
194
|
+
InvoiceInfo.CrDate = this.ConvertDateToReadableFormat(InvoiceInfo.CrDate);
|
|
195
|
+
|
|
196
|
+
let InvoiceData: any = [
|
|
197
|
+
{ text: index + 1, ColRange: 1, IsString: true },
|
|
198
|
+
{ text: InvoiceInfo.CrDate, ColRange: 1, IsString: true },
|
|
199
|
+
{ text: InvoiceInfo.Code, ColRange: 1, IsString: true },
|
|
200
|
+
{ text: InvoiceInfo.BillTo?.Name, ColRange: 1, IsString: true },
|
|
201
|
+
|
|
202
|
+
{ text: TrUtils.FixPriceValue(InvoiceInfo.Total, DecimalsNumber), ColRange: 1, IsString: false },
|
|
203
|
+
// { text: InvoiceInfo.Due, ColRange: 1, IsString: false },
|
|
204
|
+
];
|
|
205
|
+
if (!isPhar) {
|
|
206
|
+
InvoiceData.splice(4, 0, { text: InvoiceInfo.Prod?.RegNo, ColRange: 1, IsString: true },
|
|
207
|
+
{ text: InvoiceInfo.Prod?.Model, ColRange: 1, IsString: true },
|
|
208
|
+
{ text: InvoiceInfo.Name, ColRange: 1, IsString: true },
|
|
209
|
+
{ text: InvoiceInfo.WCode, ColRange: 1, IsString: true }, { text: InvoiceInfo.TypeName, ColRange: 1, IsString: true });
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
let ColStart: any = 0;
|
|
213
|
+
InvoiceData.forEach((InvData: any) => {
|
|
214
|
+
InvData.text = this.ConvertToString(InvData.text, InvData.IsString, DecimalsNumber);
|
|
215
|
+
this.SetDataInCell(InvData.text, ColStart, this.Row);
|
|
216
|
+
this.MergeArray.push({
|
|
217
|
+
s: { r: this.Row, c: ColStart },
|
|
218
|
+
e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
|
|
219
|
+
});
|
|
220
|
+
ColStart += InvData.ColRange;
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
this.Row += 1;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static ConvertToString(Text: any, IsString: any, DecimalsNumber: number) {
|
|
227
|
+
if (IsString) {
|
|
228
|
+
if (Text == null) {
|
|
229
|
+
Text = '';
|
|
230
|
+
}
|
|
231
|
+
} else {
|
|
232
|
+
if (Text == null) {
|
|
233
|
+
Text = 0;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (typeof Text === 'number') {
|
|
237
|
+
return Number(TrUtils.FixedTo(Text, DecimalsNumber));
|
|
238
|
+
} else {
|
|
239
|
+
return Text;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
static SetDataInCell(Data: any, ColRange: number, RowNum: any) {
|
|
244
|
+
var cell = { v: Data };
|
|
245
|
+
var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
|
|
246
|
+
if (this.range.e.c < ColRange) {
|
|
247
|
+
this.range.e.c = ColRange;
|
|
248
|
+
}
|
|
249
|
+
if (this.range.e.r < RowNum) {
|
|
250
|
+
this.range.e.r = RowNum;
|
|
251
|
+
}
|
|
252
|
+
cell = this.getcelltype(cell);
|
|
253
|
+
this.ws[cell_ref] = cell;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
static getcelltype(cell: any) {
|
|
257
|
+
if (typeof cell.v === 'number') cell.t = 'n';
|
|
258
|
+
else if (typeof cell.v === 'boolean') cell.t = 'b';
|
|
259
|
+
else cell.t = 's';
|
|
260
|
+
return cell;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
static ConvertDateToReadableFormat(DateObject: any) {
|
|
264
|
+
if (!TrUtils.IsEmpty(DateObject)) {
|
|
265
|
+
let date: any = new Date(DateObject);
|
|
266
|
+
let Month: any;
|
|
267
|
+
let Day: any;
|
|
268
|
+
|
|
269
|
+
let MonthName = new Array();
|
|
270
|
+
MonthName[0] = 'Jan';
|
|
271
|
+
MonthName[1] = 'Feb';
|
|
272
|
+
MonthName[2] = 'Mar';
|
|
273
|
+
MonthName[3] = 'Apr';
|
|
274
|
+
MonthName[4] = 'May';
|
|
275
|
+
MonthName[5] = 'Jun';
|
|
276
|
+
MonthName[6] = 'Jul';
|
|
277
|
+
MonthName[7] = 'Aug';
|
|
278
|
+
MonthName[8] = 'Sept';
|
|
279
|
+
MonthName[9] = 'Oct';
|
|
280
|
+
MonthName[10] = 'Nov';
|
|
281
|
+
MonthName[11] = 'Dec';
|
|
282
|
+
|
|
283
|
+
Month = MonthName[date.getMonth()];
|
|
284
|
+
|
|
285
|
+
if (date.getDate() < 10) {
|
|
286
|
+
Day = '0' + date.getDate();
|
|
287
|
+
} else {
|
|
288
|
+
Day = date.getDate();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
date = Day + '-' + Month + '-' + date.getFullYear();
|
|
292
|
+
return date;
|
|
293
|
+
} else {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import * as XLSX from 'xlsx';
|
|
2
|
+
import { MyDate } from '../../../../utils/my-date';
|
|
3
|
+
import { TrUtils } from '../../../../utils/tr-utils';
|
|
4
|
+
|
|
5
|
+
export class PaymentReceiveXlsxFileService {
|
|
6
|
+
static wb: any = {};
|
|
7
|
+
static Row: any = 2;
|
|
8
|
+
static MergeArray: any[] = [];
|
|
9
|
+
static range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
|
|
10
|
+
static ws: any = {};
|
|
11
|
+
|
|
12
|
+
static GetRepairOrdersExcelData(MainData: any, EntitySettings: any) {
|
|
13
|
+
this.wb={};
|
|
14
|
+
this.ws = {};
|
|
15
|
+
this.Row=0;
|
|
16
|
+
this.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
|
|
17
|
+
this.MergeArray=[];
|
|
18
|
+
let ws_name = 'RECEIPTS';
|
|
19
|
+
this.wb.Sheets = {};
|
|
20
|
+
this.wb.Props = {};
|
|
21
|
+
this.wb.SSF = {};
|
|
22
|
+
this.wb.SheetNames = [];
|
|
23
|
+
|
|
24
|
+
MainData = this.GetTotals(MainData, EntitySettings.DecimalsNumber);
|
|
25
|
+
|
|
26
|
+
this.setHeadingInCell();
|
|
27
|
+
|
|
28
|
+
this.setWorkOrderDetailsInCell(MainData, EntitySettings.DecimalsNumber);
|
|
29
|
+
|
|
30
|
+
this.ws['!ref'] = XLSX.utils.encode_range(this.range);
|
|
31
|
+
|
|
32
|
+
this.ws['!merges'] = this.MergeArray;
|
|
33
|
+
|
|
34
|
+
this.wb.SheetNames.push(ws_name);
|
|
35
|
+
|
|
36
|
+
this.wb.Sheets[ws_name] = this.ws;
|
|
37
|
+
|
|
38
|
+
return this.wb;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static GetTotals(MainData: any, DecimalsNumber: number) {
|
|
42
|
+
MainData.forEach((WorkOrder: any) => {
|
|
43
|
+
// if (TrUtils.IsNull(WorkOrder.Prod?.VIN)) {
|
|
44
|
+
// WorkOrder.Prod.VIN = '';
|
|
45
|
+
// }
|
|
46
|
+
// if (TrUtils.IsNull(WorkOrder.Name)) {
|
|
47
|
+
// WorkOrder.Name = '';
|
|
48
|
+
// }
|
|
49
|
+
// if (TrUtils.IsNull(WorkOrder.TeNa)) {
|
|
50
|
+
// WorkOrder.TeNa = '';
|
|
51
|
+
// }
|
|
52
|
+
// if (TrUtils.IsNull(WorkOrder.Type)) {
|
|
53
|
+
// WorkOrder.TypeName = '';
|
|
54
|
+
// } else {
|
|
55
|
+
// WorkOrder.TypeName = WorkOrder.WOType.Name;
|
|
56
|
+
// }
|
|
57
|
+
if (!TrUtils.IsNull(WorkOrder.Amt)) {
|
|
58
|
+
WorkOrder.Total = TrUtils.FixPriceValue(WorkOrder.Amt, DecimalsNumber)
|
|
59
|
+
} else {
|
|
60
|
+
WorkOrder.Total = '0.00';
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return MainData;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static setHeadingInCell() {
|
|
67
|
+
let MainHeadings: any[] = [
|
|
68
|
+
{
|
|
69
|
+
text: 'SNo',
|
|
70
|
+
ColRange: 1,
|
|
71
|
+
bold: true,
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
text: 'Payment No',
|
|
76
|
+
ColRange: 1,
|
|
77
|
+
bold: true,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
text: 'Date',
|
|
81
|
+
ColRange: 1,
|
|
82
|
+
bold: true,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
text: 'Customer Name',
|
|
86
|
+
ColRange: 1,
|
|
87
|
+
bold: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
text: 'Payment Mode',
|
|
91
|
+
ColRange: 1,
|
|
92
|
+
bold: true,
|
|
93
|
+
|
|
94
|
+
},
|
|
95
|
+
// {
|
|
96
|
+
// text: 'Reg. No',
|
|
97
|
+
// ColRange: 1,
|
|
98
|
+
// bold: true,
|
|
99
|
+
|
|
100
|
+
// },
|
|
101
|
+
{
|
|
102
|
+
text: 'Invoice No\'s',
|
|
103
|
+
ColRange: 1,
|
|
104
|
+
bold: true,
|
|
105
|
+
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
{
|
|
109
|
+
text: 'Amount',
|
|
110
|
+
ColRange: 1,
|
|
111
|
+
bold: true,
|
|
112
|
+
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
let MainColStart: any = 0;
|
|
116
|
+
MainHeadings.forEach((MainHeader: any) => {
|
|
117
|
+
this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
|
|
118
|
+
this.MergeArray.push({
|
|
119
|
+
s: { r: this.Row, c: MainColStart },
|
|
120
|
+
e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
|
|
121
|
+
});
|
|
122
|
+
MainColStart += MainHeader.ColRange;
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
this.Row += 2;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static setWorkOrderDetailsInCell(MainData: any, DecimalsNumber: number) {
|
|
129
|
+
MainData.forEach((InvoiceList: any, index: any) => {
|
|
130
|
+
this.SetWorkOrderDataInExcel(InvoiceList, index, DecimalsNumber);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static SetWorkOrderDataInExcel(WorkOrder: any, index: any, DecimalsNumber: number) {
|
|
135
|
+
WorkOrder.Date = MyDate.ConvertUTCDateToReadable(WorkOrder.Date);
|
|
136
|
+
WorkOrder.InvCodes = this.GetInvoiceCodes(WorkOrder);
|
|
137
|
+
|
|
138
|
+
let InvoiceData: any = [
|
|
139
|
+
{ text: index + 1, ColRange: 1, IsString: true },
|
|
140
|
+
{ text: WorkOrder.Code, ColRange: 1, IsString: true },
|
|
141
|
+
{ text: WorkOrder.Date, ColRange: 1, IsString: true },
|
|
142
|
+
{ text: WorkOrder.Name, ColRange: 1, IsString: true },
|
|
143
|
+
{ text: WorkOrder.PType, ColRange: 1, IsString: true },
|
|
144
|
+
// { text: WorkOrder.RegNo, ColRange: 1, IsString: true },
|
|
145
|
+
{ text: WorkOrder.InvCodes, ColRange: 1, IsString: true },
|
|
146
|
+
// { text: WorkOrder.CBillTo?.Ph, ColRange: 1, IsString: true },
|
|
147
|
+
// { text: WorkOrder.Prod?.RegNo, ColRange: 1, IsString: false },
|
|
148
|
+
// { text: WorkOrder.Prod?.VIN, ColRange: 1, IsString: false },
|
|
149
|
+
// { text: WorkOrder.Prod?.Model, ColRange: 1, IsString: false },
|
|
150
|
+
// { text: WorkOrder.Prod?.MIn, ColRange: 1, IsString: false },
|
|
151
|
+
// { text: WorkOrder.TypeName, ColRange: 1, IsString: false },
|
|
152
|
+
// { text: WorkOrder.Name, ColRange: 1, IsString: false },
|
|
153
|
+
// { text: WorkOrder.TeNa, ColRange: 1, IsString: false },
|
|
154
|
+
{ text: WorkOrder.Total, ColRange: 1, IsString: false },
|
|
155
|
+
];
|
|
156
|
+
let ColStart: any = 0;
|
|
157
|
+
InvoiceData.forEach((InvData: any) => {
|
|
158
|
+
InvData.text = this.ConvertToString(InvData.text, InvData.IsString, DecimalsNumber);
|
|
159
|
+
this.SetDataInCell(InvData.text, ColStart, this.Row);
|
|
160
|
+
this.MergeArray.push({
|
|
161
|
+
s: { r: this.Row, c: ColStart },
|
|
162
|
+
e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
|
|
163
|
+
});
|
|
164
|
+
ColStart += InvData.ColRange;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
this.Row += 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static GetInvoiceCodes(PaymentData: any) {
|
|
171
|
+
let InvoiceCodes: string = '';
|
|
172
|
+
if (!TrUtils.IsNull(PaymentData.Invs)) {
|
|
173
|
+
PaymentData.Invs.forEach((inv: any, index: any) => {
|
|
174
|
+
InvoiceCodes = InvoiceCodes + inv.Code;
|
|
175
|
+
if (PaymentData.Invs.length !== (index + 1)) {
|
|
176
|
+
InvoiceCodes = InvoiceCodes + ', ';
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return InvoiceCodes;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static ConvertToString(Text: any, IsString: any, DecimalsNumber: number) {
|
|
185
|
+
if (IsString) {
|
|
186
|
+
if (Text == null) {
|
|
187
|
+
Text = '';
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
if (Text == null) {
|
|
191
|
+
Text = 0;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (typeof Text === 'number') {
|
|
195
|
+
return Number(TrUtils.FixedTo(Text, DecimalsNumber));
|
|
196
|
+
} else {
|
|
197
|
+
return Text;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
static SetDataInCell(Data: any, ColRange: number, RowNum: any) {
|
|
202
|
+
var cell = { v: Data };
|
|
203
|
+
var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
|
|
204
|
+
if (this.range.e.c < ColRange) {
|
|
205
|
+
this.range.e.c = ColRange;
|
|
206
|
+
}
|
|
207
|
+
if (this.range.e.r < RowNum) {
|
|
208
|
+
this.range.e.r = RowNum;
|
|
209
|
+
}
|
|
210
|
+
cell = this.getcelltype(cell);
|
|
211
|
+
this.ws[cell_ref] = cell;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
static getcelltype(cell: any) {
|
|
215
|
+
if (typeof cell.v === 'number') cell.t = 'n';
|
|
216
|
+
else if (typeof cell.v === 'boolean') cell.t = 'b';
|
|
217
|
+
else cell.t = 's';
|
|
218
|
+
return cell;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
|
|
2
|
+
import { SharedPDFService } from '../../../../shared/shared-pdf.service';
|
|
3
|
+
import { MyDate } from '../../../../utils/my-date';
|
|
4
|
+
import { TrUtils } from '../../../../utils/tr-utils';
|
|
5
|
+
declare var pdfMake: any;
|
|
6
|
+
|
|
7
|
+
export class CustomerBalancesService {
|
|
8
|
+
|
|
9
|
+
static GetCustomerBalancesPrint(InvoicesData: any, EntityData: any, isPhar: boolean, isHC: boolean) {
|
|
10
|
+
var dd = {
|
|
11
|
+
info: {
|
|
12
|
+
title: 'CustomerBalances',
|
|
13
|
+
},
|
|
14
|
+
header: function (currentPage: any, pageCount: any) {
|
|
15
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
16
|
+
},
|
|
17
|
+
pageMargins: [10, 15, 10, 15],
|
|
18
|
+
content: [
|
|
19
|
+
{ text: '' + EntityData.Entity.DName + '', style: ['header'] },
|
|
20
|
+
{ text: 'Customer Balances', alignment: 'center', fontSize: 15, bold: true },
|
|
21
|
+
{ text: 'As of ' + MyDate.ConvertUTCDateToReadable(MyDate.GetDateTimeNowInUTC(EntityData.User.TZ)), alignment: 'center', fontSize: 10 },
|
|
22
|
+
// SharedPDFService.HeaderAfterLine(),
|
|
23
|
+
this.GetInvoiceDataTable(InvoicesData, isPhar, isHC, EntityData.Entity.Settings.DecimalsNumber),
|
|
24
|
+
|
|
25
|
+
],
|
|
26
|
+
styles: SharedPDFService.GetStyles()
|
|
27
|
+
};
|
|
28
|
+
return dd;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static GetInvoiceDataTable(InvoicesData: any, isPhar: boolean, isHC: boolean, DecimalsNumber: number) {
|
|
33
|
+
let Data: any = []
|
|
34
|
+
InvoicesData.forEach((invoice: any) => {
|
|
35
|
+
Data.push(this.GetItemsTable(invoice, isPhar, isHC, DecimalsNumber));
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return Data;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static getTableWidths(isHC: any) {
|
|
42
|
+
if (isHC) {
|
|
43
|
+
return [25, '*', '*', '*', '*'];
|
|
44
|
+
} else {
|
|
45
|
+
return [25, 60, 70, '*',70, 80, 50, 50];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static GetItemsTable(InvoiceData: any, isPhar: boolean, isHC: boolean, DecimalsNumber: number) {
|
|
50
|
+
// InvoicesData.forEach((InvoiceData: any) => {
|
|
51
|
+
return {
|
|
52
|
+
style: 'tableExample',
|
|
53
|
+
marginTop: 3,
|
|
54
|
+
marginBottom: 5,
|
|
55
|
+
table: {
|
|
56
|
+
widths: this.getTableWidths(isHC),
|
|
57
|
+
headerRows: 2,
|
|
58
|
+
body: this.BuildTableBodyForLaborAndParts(InvoiceData, isPhar, isHC, DecimalsNumber)
|
|
59
|
+
// body:[['fsdfsdf','asfafdas','asdasdas','asdasdasd','asddass']]
|
|
60
|
+
},
|
|
61
|
+
layout: {
|
|
62
|
+
hLineWidth: function (i:any, node:any) {
|
|
63
|
+
|
|
64
|
+
return (i === 0 || i === 1 || i === 2 || i === node.table.body.length - 1 || i === node.table.body.length) ? 1 : 0.5;
|
|
65
|
+
},
|
|
66
|
+
vLineWidth: function (i:any, node:any) {
|
|
67
|
+
return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
|
|
68
|
+
},
|
|
69
|
+
// hLineStyle: function (i, node) {
|
|
70
|
+
// return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
|
|
71
|
+
// },
|
|
72
|
+
hLineColor: function (i: any, node: any) {
|
|
73
|
+
return (i === 0 || i === 1 || i === 2 || i === node.table.body.length - 1 || i === node.table.body.length) ? 'gray' : 'lightgrey';
|
|
74
|
+
|
|
75
|
+
},
|
|
76
|
+
vLineColor: function (i: any, node: any) {
|
|
77
|
+
return 'gray';
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
// });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static BuildTableBodyForLaborAndParts(InvoiceData: any, isPhar: boolean, isHC: boolean, DecimalsNumber: number) {
|
|
85
|
+
let body: any = this.GetHeaderNames(isPhar, isHC);
|
|
86
|
+
let Row: any = [{ text: InvoiceData.Name, alignment: 'left', colSpan: isHC ? 5 : 8, bold: true, fontSize: 12 }, {}, {}, {}, {}];
|
|
87
|
+
if (!isHC) {
|
|
88
|
+
Row.push({});
|
|
89
|
+
Row.push({});
|
|
90
|
+
Row.push({});
|
|
91
|
+
}
|
|
92
|
+
body.unshift(Row);
|
|
93
|
+
// InvoicesData.forEach((InvoiceData: any) => {
|
|
94
|
+
InvoiceData.Invoices.forEach((invoice: any, index: any) => {
|
|
95
|
+
let dataRow: any = [];
|
|
96
|
+
if (isHC) {
|
|
97
|
+
dataRow.push({ text: index + 1 });
|
|
98
|
+
dataRow.push({ text: invoice.Code });
|
|
99
|
+
if (!isHC) {
|
|
100
|
+
dataRow.push({ text: invoice.Prod?.RegNo });
|
|
101
|
+
dataRow.push({ text: TrUtils.IsNull(invoice.Prod) ? '' : invoice.Prod?.Model + ' ' + invoice.Prod?.Var });
|
|
102
|
+
}
|
|
103
|
+
// dataRow.push({ text: invoice.BFrom.Name, alignment: 'left', style: ['headerstyle'], });
|
|
104
|
+
dataRow.push({ text: MyDate.ConvertUTCDateToReadable(invoice.CrDate), alignment: 'center', style: ['headerstyle'], });
|
|
105
|
+
dataRow.push({ text: TrUtils.FixPriceValue(invoice.Total, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
|
|
106
|
+
dataRow.push({ text: TrUtils.FixPriceValue(invoice.Due, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
|
|
107
|
+
|
|
108
|
+
body.push(dataRow);
|
|
109
|
+
if (InvoiceData.Invoices.length === (index + 1)) {
|
|
110
|
+
let Row: any = [{ text: 'Total Due ', alignment: 'right', colSpan: isHC ? 4 : 6, bold: true, fontSize: 9 }, {}, {}, {}, { text: TrUtils.FixPriceValue(InvoiceData.Balance, DecimalsNumber), fontSize: 9, alignment: 'right', bold: true }];
|
|
111
|
+
if (!isHC) {
|
|
112
|
+
Row.splice(2, 0, {}, {});
|
|
113
|
+
// Row.push({});
|
|
114
|
+
}
|
|
115
|
+
body.push(Row);
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
dataRow.push({ text: index + 1 });
|
|
119
|
+
dataRow.push({ text: MyDate.ConvertUTCDateToReadable(invoice.CrDate), alignment: 'center', style: ['headerstyle'], });
|
|
120
|
+
dataRow.push({ text: invoice.Code });
|
|
121
|
+
dataRow.push({ text: invoice.BillTo?.Name });
|
|
122
|
+
// if(!isHC){
|
|
123
|
+
dataRow.push({ text: invoice.Prod?.RegNo });
|
|
124
|
+
dataRow.push({ text: invoice.Name });
|
|
125
|
+
dataRow.push({ text: invoice.WCode });
|
|
126
|
+
// dataRow.push({ text: TrUtils.IsNull(invoice.Prod) ? '' : invoice.Prod?.Model + ' ' + invoice.Prod?.Var });
|
|
127
|
+
// }
|
|
128
|
+
// dataRow.push({ text: invoice.BFrom.Name, alignment: 'left', style: ['headerstyle'], });
|
|
129
|
+
dataRow.push({ text: TrUtils.FixPriceValue(invoice.Total, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
|
|
130
|
+
// dataRow.push({ text: TrUtils.FixPriceValue(invoice.Due), alignment: 'right', style: ['headerstyle'], });
|
|
131
|
+
|
|
132
|
+
body.push(dataRow);
|
|
133
|
+
// if (InvoiceData.Invoices.length === (index + 1)) {
|
|
134
|
+
// let Row: any = [{ text: 'Total Due ', alignment: 'right', colSpan: isHC?4:6, bold: true, fontSize: 9 }, {}, {}, {}, { text: TrUtils.FixPriceValue(InvoiceData.Balance), fontSize: 9, alignment: 'right', bold: true }];
|
|
135
|
+
// if(!isHC){
|
|
136
|
+
// Row.splice(2, 0,{},{});
|
|
137
|
+
// // Row.push({});
|
|
138
|
+
// }
|
|
139
|
+
// body.push(Row);
|
|
140
|
+
// }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
});
|
|
144
|
+
// });
|
|
145
|
+
return body;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static GetHeaderNames(isPhar: boolean, isHC: boolean) {
|
|
149
|
+
let HeadingNames: any;
|
|
150
|
+
if (isHC) {
|
|
151
|
+
HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', line: true },
|
|
152
|
+
{ text: isPhar ? 'Counter Sale Number' : 'Invoice Number', style: 'tableheader1', Field: 'BNo', alignment: 'left' },
|
|
153
|
+
{ text: 'Create Date', style: 'tableheader1', Field: 'CrDate' },
|
|
154
|
+
{ text: 'Total', style: 'tableheader1', Field: 'Total', alignment: 'right' },
|
|
155
|
+
{ text: 'Due', style: 'tableheader1', Field: 'Due', alignment: 'right' }]];
|
|
156
|
+
if (!isHC) {
|
|
157
|
+
HeadingNames[0].splice(2, 0, { text: 'Reg No', style: 'tableheader1', Field: 'Reg No', alignment: 'left' }
|
|
158
|
+
, { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
159
|
+
// HeadingNames.splice(3, 0, { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', line: true },
|
|
163
|
+
{ text: 'Date', style: 'tableheader1', Field: 'CrDate' },
|
|
164
|
+
{ text: isPhar ? 'Counter Sale Number' : 'Invoice No', style: 'tableheader1', Field: 'BNo', alignment: 'left' },
|
|
165
|
+
{ text: 'Customer', style: 'tableheader1', Field: 'Cust' },
|
|
166
|
+
{ text: 'Vehicle Reg No', style: 'tableheader1', Field: 'RegNo' },
|
|
167
|
+
{ text: 'Advisor Name', style: 'tableheader1', Field: 'Name' },
|
|
168
|
+
{ text: 'RO No', style: 'tableheader1', Field: 'WCode' },
|
|
169
|
+
{ text: 'Amount', style: 'tableheader1', Field: 'Total', alignment: 'right' }]];
|
|
170
|
+
// { text: 'Due', style: 'tableheader1', Field: 'Due', alignment: 'right' }]];
|
|
171
|
+
// if (!isHC) {
|
|
172
|
+
// HeadingNames[0].splice(2, 0, { text: 'Reg No', style: 'tableheader1', Field: 'Reg No', alignment: 'left' }
|
|
173
|
+
// , { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
174
|
+
// // HeadingNames.splice(3, 0, { text: 'Vehicle', style: 'tableheader1', Field: 'Vehicle', alignment: 'left' });
|
|
175
|
+
// }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
return HeadingNames;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
}
|