shareneus 1.0.5

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.
Files changed (125) hide show
  1. package/dist/aggregation/aggregation.js +60 -0
  2. package/dist/enums/cache-enums.js +37 -0
  3. package/dist/enums/code-enums.js +288 -0
  4. package/dist/enums/enums.js +362 -0
  5. package/dist/enums/industry-enums.js +24 -0
  6. package/dist/excel-files/GSTR-RO-excel.service.js +935 -0
  7. package/dist/excel-files/GSTR1-excel.service.js +295 -0
  8. package/dist/excel-files/GSTR2-excel.service.js +295 -0
  9. package/dist/excel-files/analysis-excel.service.js +297 -0
  10. package/dist/excel-files/category-wise-item-excel.service.js +274 -0
  11. package/dist/excel-files/cust-balance-excel.service.js +287 -0
  12. package/dist/excel-files/cust-wise-sales-details.js +320 -0
  13. package/dist/excel-files/cust-wise-sales-summary-excel.service.js +302 -0
  14. package/dist/excel-files/expiring-drugs-excel.service.js +292 -0
  15. package/dist/excel-files/insurance-expire-excel.service.js +301 -0
  16. package/dist/excel-files/invoice-wise-excel.service.js +857 -0
  17. package/dist/excel-files/item-wise-doctor-sale-excel.service.js +258 -0
  18. package/dist/excel-files/item-wise-mout-details.js +292 -0
  19. package/dist/excel-files/item-wise-mout-summary.js +286 -0
  20. package/dist/excel-files/items-wise-sales-excel.service.js +314 -0
  21. package/dist/excel-files/manf-wise-sales-excel.service.js +276 -0
  22. package/dist/excel-files/operator-wise-details.js +265 -0
  23. package/dist/excel-files/operator-wise-summary.js +266 -0
  24. package/dist/excel-files/payment-receive-excel.service.js +225 -0
  25. package/dist/excel-files/payments-made-excel.service.js +302 -0
  26. package/dist/excel-files/repair-orders-excel.service.js +255 -0
  27. package/dist/excel-files/sa-wise-labor-sales-excel.service.js +232 -0
  28. package/dist/excel-files/sa-wise-part-sales-excel.service.js +232 -0
  29. package/dist/excel-files/sale-summary-excel.service.js +326 -0
  30. package/dist/excel-files/sales-by-service-details-excel.service.js +1 -0
  31. package/dist/excel-files/sales-by-service-summary-excel.service.js +422 -0
  32. package/dist/excel-files/scheduled-drug-summary-excel.service.js +367 -0
  33. package/dist/excel-files/scheduled-drugs-excel.service.js +366 -0
  34. package/dist/excel-files/spares-issue-excel.service.js +492 -0
  35. package/dist/excel-files/stock-excel.service.js +283 -0
  36. package/dist/excel-files/tally-sales-import.service.js +765 -0
  37. package/dist/excel-files/ven-balance-excel.service.js +293 -0
  38. package/dist/index.js +237 -0
  39. package/dist/services/analysis-pdf.service.js +105 -0
  40. package/dist/services/appointment-total.service.js +253 -0
  41. package/dist/services/auto-sales-receipt-pdf.service.js +539 -0
  42. package/dist/services/category-wise-item-pdf.service.js +98 -0
  43. package/dist/services/checklist-pdf.js +140 -0
  44. package/dist/services/checklists-pdf.js +124 -0
  45. package/dist/services/cn-print.service.js +211 -0
  46. package/dist/services/consultation-fee-receipt.service.js +378 -0
  47. package/dist/services/consultation-full-pdf.service.js +220 -0
  48. package/dist/services/consultation-pdf.service.js +360 -0
  49. package/dist/services/credit-note-pdf.service.js +578 -0
  50. package/dist/services/credit-note-totals.service.js +328 -0
  51. package/dist/services/cust-wise-sales-details-pdf.service.js +118 -0
  52. package/dist/services/cust-wise-sales-summary-pdf.service.js +111 -0
  53. package/dist/services/customer-balances-pdf.service.js +169 -0
  54. package/dist/services/dc-landscape-pdf.service.js +903 -0
  55. package/dist/services/dc-landscape-without-price-pdf.service.js +853 -0
  56. package/dist/services/dc-without-price-pdf.service.js +489 -0
  57. package/dist/services/debit-note-pdf.service.js +673 -0
  58. package/dist/services/debit-note-print.service.js +234 -0
  59. package/dist/services/debit-note-totals.service.js +293 -0
  60. package/dist/services/delivery-challan-pdf.service.js +434 -0
  61. package/dist/services/delivery-challan-print.service.js +177 -0
  62. package/dist/services/delivery-challan-totals.js +339 -0
  63. package/dist/services/equipment-design-pdf.service.js +144 -0
  64. package/dist/services/est.print-service.js +1053 -0
  65. package/dist/services/expiring-drugs-pdf.service.js +156 -0
  66. package/dist/services/hc-inv-pdf.service.js +837 -0
  67. package/dist/services/insurance-expire-pdf.service.js +99 -0
  68. package/dist/services/inv-pdf.service.js +785 -0
  69. package/dist/services/inv-print.service.js +415 -0
  70. package/dist/services/invoice-landscape-pdf.service.js +909 -0
  71. package/dist/services/invoice-total.service.js +659 -0
  72. package/dist/services/issue-parts-pdf.service.js +763 -0
  73. package/dist/services/item-detais-pdf.js +136 -0
  74. package/dist/services/item-wise-doctor-sale-pdf.service.js +164 -0
  75. package/dist/services/item-wise-mout-details-pdf.js +107 -0
  76. package/dist/services/item-wise-mout-summary-pdf.js +99 -0
  77. package/dist/services/item-wise-sales-pdf.service.js +178 -0
  78. package/dist/services/manf-wise-sales-pdf.service.js +173 -0
  79. package/dist/services/meeting-pdf.js +369 -0
  80. package/dist/services/mout-pdf.service.js +503 -0
  81. package/dist/services/operator-wise-details-pdf.service.js +103 -0
  82. package/dist/services/operator-wise-summary-pdf.js +101 -0
  83. package/dist/services/pack-ship-pdf.service.js +105 -0
  84. package/dist/services/pack-ship-print.service.js +167 -0
  85. package/dist/services/payment-pdf.service.js +373 -0
  86. package/dist/services/payment-report-pdf.service.js +106 -0
  87. package/dist/services/po-totals.service.js +279 -0
  88. package/dist/services/pos-receipt-pdf.js +438 -0
  89. package/dist/services/purchase-order-pdf.service.js +924 -0
  90. package/dist/services/purchase-order-print.service.js +150 -0
  91. package/dist/services/purchase-order-totals.service.js +280 -0
  92. package/dist/services/receipt-print.service.js +50 -0
  93. package/dist/services/reorder-point-pdf.service.js +151 -0
  94. package/dist/services/repair-orders-pdf.service.js +172 -0
  95. package/dist/services/ro-pdf.service.js +1764 -0
  96. package/dist/services/ro-print-service.js +737 -0
  97. package/dist/services/ro-totals.service.js +1241 -0
  98. package/dist/services/sales-by-service-pdf.service.js +116 -0
  99. package/dist/services/sales-pdf.service.js +630 -0
  100. package/dist/services/sales-print.service.js +305 -0
  101. package/dist/services/sales-receipt-pdf.service.js +611 -0
  102. package/dist/services/sales-receipt-print.service.js +425 -0
  103. package/dist/services/sales-totals.service.js +339 -0
  104. package/dist/services/scheduled-drug-pdf.service.js +176 -0
  105. package/dist/services/scheduled-drug-summary-pdf.service.js +188 -0
  106. package/dist/services/separate-wo-print.service.js +351 -0
  107. package/dist/services/shared-inv-pdf.service.js +763 -0
  108. package/dist/services/shared-pdf.service.js +2569 -0
  109. package/dist/services/shared-print.service.js +885 -0
  110. package/dist/services/task-pdf.service.js +220 -0
  111. package/dist/services/task-reports-pdf.service.js +296 -0
  112. package/dist/services/technician-pdf.service.js +238 -0
  113. package/dist/services/technician-print.service.js +87 -0
  114. package/dist/services/transfer-order-pdf.service.js +139 -0
  115. package/dist/services/vendor-balances-pdf.service.js +101 -0
  116. package/dist/services/vendor-credit-note-pdf.service.js +1007 -0
  117. package/dist/services/vendor-credit-note-print.service.js +104 -0
  118. package/dist/services/vendor-credit-note-totals.service.js +327 -0
  119. package/dist/services/vendor-debit-note-pdf.service.js +561 -0
  120. package/dist/services/vendor-debit-note-print.service.js +245 -0
  121. package/dist/services/vendor-debit-note-totals.service.js +305 -0
  122. package/dist/utils/my-date.js +652 -0
  123. package/dist/utils/tr-utils.js +354 -0
  124. package/package.json +24 -0
  125. package/tsconfig.json +109 -0
@@ -0,0 +1,765 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.TallySalesImportXlsxFileService = void 0;
27
+ const XLSX = __importStar(require("xlsx"));
28
+ const tr_utils_1 = require("../utils/tr-utils");
29
+ class TallySalesImportXlsxFileService {
30
+ static GetGSTROExcelData(MainData, WOTypes) {
31
+ this.wb = {};
32
+ this.ws = {};
33
+ this.Row = 0;
34
+ this.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
35
+ this.MergeArray = [];
36
+ let ws_name = 'Sales Import';
37
+ this.wb.Sheets = {};
38
+ this.wb.Props = {};
39
+ this.wb.SSF = {};
40
+ this.wb.SheetNames = [];
41
+ MainData = this.GetTotals(MainData, WOTypes);
42
+ this.setHeadingInCell(MainData);
43
+ this.setInvoiceDetailsInCell(MainData);
44
+ this.ws['!ref'] = XLSX.utils.encode_range(this.range);
45
+ this.ws['!merges'] = this.MergeArray;
46
+ this.ws["!cols"] = [{ wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 50 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 },
47
+ { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 },
48
+ { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }];
49
+ this.wb.SheetNames.push(ws_name);
50
+ this.wb.Sheets[ws_name] = this.ws;
51
+ return this.wb;
52
+ }
53
+ static GetTotals(MainData, WOTypes) {
54
+ MainData.forEach((InvoiceInfo) => {
55
+ if (InvoiceInfo.VIN == null) {
56
+ InvoiceInfo.VIN = '';
57
+ }
58
+ if (InvoiceInfo.Name == null) {
59
+ InvoiceInfo.Name = '';
60
+ }
61
+ if (InvoiceInfo.TeNa == null) {
62
+ InvoiceInfo.TeNa = '';
63
+ }
64
+ if (InvoiceInfo.Type == null) {
65
+ InvoiceInfo.TypeName = '';
66
+ }
67
+ else {
68
+ InvoiceInfo.TypeName = this.GetWOTypeName(InvoiceInfo.WOType, WOTypes);
69
+ }
70
+ InvoiceInfo.Invoices.forEach((invoice) => {
71
+ var _a;
72
+ let CGSTAmt = 0;
73
+ let SGSTAmt = 0;
74
+ let IGSTAmt = 0;
75
+ invoice.TypeName = (_a = invoice === null || invoice === void 0 ? void 0 : invoice.WOType) === null || _a === void 0 ? void 0 : _a.Name;
76
+ invoice.ItemsArray.forEach((item) => {
77
+ CGSTAmt = CGSTAmt + item.CGST;
78
+ SGSTAmt = SGSTAmt + item.SGST;
79
+ IGSTAmt = IGSTAmt + item.IGST;
80
+ });
81
+ invoice.LaborArray.forEach((item) => {
82
+ CGSTAmt = CGSTAmt + item.CGST;
83
+ SGSTAmt = SGSTAmt + item.SGST;
84
+ IGSTAmt = IGSTAmt + item.IGST;
85
+ });
86
+ invoice.CGSTAmt = CGSTAmt;
87
+ invoice.SGSTAmt = SGSTAmt;
88
+ invoice.IGSTAmt = IGSTAmt;
89
+ });
90
+ // let CGST18: number = 0;
91
+ // let SGST18: number = 0;
92
+ // let CGST28: number = 0;
93
+ // let SGST28: number = 0;
94
+ // let Total18perc: number = 0;
95
+ // let Total18perctax: number = 0;
96
+ // let Total28perc: number = 0;
97
+ // let Total28perctax: number = 0;
98
+ // if(!TrUtils.IsNull(InvoiceInfo.Parts) && InvoiceInfo.Parts.length !==0){
99
+ // InvoiceInfo.Parts.forEach((item: any) => {
100
+ // if (item.TCode === 106) {
101
+ // Total18perc=Total18perc+TrUtils.SetValueToZeroIfNull(item.UnAmt);
102
+ // CGST18 = CGST18 + TrUtils.SetValueToZeroIfNull(item.CGST);
103
+ // SGST18 = SGST18 + TrUtils.SetValueToZeroIfNull(item.SGST);
104
+ // Total18perctax=Total18perctax+Total18perc+CGST18+SGST18;
105
+ // } else if (item.TCode === 107) {
106
+ // Total28perc=Total28perc+TrUtils.SetValueToZeroIfNull(item.UnAmt);
107
+ // CGST28 = CGST28 + TrUtils.SetValueToZeroIfNull(item.CGST);
108
+ // SGST28 = SGST28 + TrUtils.SetValueToZeroIfNull(item.SGST);
109
+ // Total28perctax=Total28perctax+Total28perc+CGST28+SGST28;
110
+ // }
111
+ // });
112
+ // }
113
+ // InvoiceInfo.Total18perctax = TrUtils.FixPriceValue(Total18perctax);
114
+ // InvoiceInfo.Total28perctax = TrUtils.FixPriceValue(Total28perctax);
115
+ // InvoiceInfo.Total18perc = TrUtils.FixPriceValue(Total18perc);
116
+ // InvoiceInfo.Total28perc = TrUtils.FixPriceValue(Total28perc);
117
+ // InvoiceInfo.Items18CGST = TrUtils.FixPriceValue(CGST18);
118
+ // InvoiceInfo.Items18SGST = TrUtils.FixPriceValue(SGST18);
119
+ // InvoiceInfo.Items28CGST = TrUtils.FixPriceValue(CGST28);
120
+ // InvoiceInfo.Items28SGST = TrUtils.FixPriceValue(SGST28);
121
+ // InvoiceInfo.TotalCGST = TrUtils.FixPriceValue(CGST18+CGST28);
122
+ // InvoiceInfo.TotalSGST = TrUtils.FixPriceValue(SGST18+SGST28);
123
+ // InvoiceInfo.Items18GST = TrUtils.FixPriceValue(CGST18+SGST18);
124
+ // InvoiceInfo.Items28GST = TrUtils.FixPriceValue(CGST28+SGST28);
125
+ InvoiceInfo.GSTAmount =
126
+ InvoiceInfo.ItemsCGST + InvoiceInfo.ItemsSGST + InvoiceInfo.ItemsIGST;
127
+ InvoiceInfo.TotalAmount = InvoiceInfo.GSTAmount + InvoiceInfo.ItemsNetAmt;
128
+ InvoiceInfo.OpsGSTAmount =
129
+ InvoiceInfo.OpsCGST + InvoiceInfo.OpsSGST + InvoiceInfo.OpsIGST;
130
+ InvoiceInfo.TotalOpsAmount =
131
+ InvoiceInfo.OpsGSTAmount + InvoiceInfo.OpsNetAmt;
132
+ });
133
+ return MainData;
134
+ }
135
+ static GetWOTypeName(Type, WOTypes) {
136
+ let Index = WOTypes.findIndex((wotype) => {
137
+ return Type === wotype._id;
138
+ });
139
+ if (Index !== -1) {
140
+ return WOTypes[Index].Name;
141
+ }
142
+ else {
143
+ return '';
144
+ }
145
+ }
146
+ static setHeadingInCell(MainData) {
147
+ this.MainHeadings = [
148
+ {
149
+ text: 'date',
150
+ ColRange: 1,
151
+ field: 'CrDate',
152
+ bold: true,
153
+ ChildHeadings: []
154
+ },
155
+ // {
156
+ // text: 'Invoice No',
157
+ // ColRange: 1,
158
+ // field: 'Code',
159
+ // bold: true,
160
+ // ChildHeadings: [
161
+ // // { text: 'No', ColRange: 1 },
162
+ // // { text: 'Date', ColRange: 1 },
163
+ // // { text: 'InvoiceInfo Total', ColRange: 1 }
164
+ // ],
165
+ // },
166
+ // {
167
+ // text: 'Invoice Date',
168
+ // ColRange: 1,
169
+ // field: 'CrDate',
170
+ // bold: true,
171
+ // ChildHeadings: [],
172
+ // },
173
+ {
174
+ text: 'party name',
175
+ ColRange: 1,
176
+ field: 'Name',
177
+ bold: true,
178
+ ChildHeadings: [
179
+ // { text: 'Central Tax', ColRange: 1 },
180
+ // { text: 'State Tax', ColRange: 1 },
181
+ // { text: 'IGST Tax', ColRange: 1 },
182
+ ],
183
+ },
184
+ {
185
+ text: 'voucher number',
186
+ ColRange: 1,
187
+ field: 'Code',
188
+ bold: true,
189
+ ChildHeadings: [
190
+ // { text: 'Central Tax', ColRange: 1 },
191
+ // { text: 'State Tax', ColRange: 1 },
192
+ // { text: 'IGST Tax', ColRange: 1 },
193
+ ],
194
+ },
195
+ {
196
+ text: 'party alias name',
197
+ ColRange: 1,
198
+ field: 'Name',
199
+ bold: true,
200
+ ChildHeadings: [
201
+ // { text: 'Central Tax', ColRange: 1 },
202
+ // { text: 'State Tax', ColRange: 1 },
203
+ // { text: 'IGST Tax', ColRange: 1 },
204
+ ],
205
+ },
206
+ {
207
+ text: 'total amount',
208
+ ColRange: 1,
209
+ field: 'Total',
210
+ bold: true,
211
+ ChildHeadings: [],
212
+ },
213
+ // {
214
+ // text: 'Total Amount excluding GST',
215
+ // ColRange: 1,
216
+ // field: 'SubTotal',
217
+ // bold: true,
218
+ // ChildHeadings: [],
219
+ // },
220
+ // {
221
+ // text: 'Parts Taxable Amt',
222
+ // ColRange: 1,
223
+ // field: 'Taxable',
224
+ // bold: true,
225
+ // ChildHeadings: [],
226
+ // },
227
+ ];
228
+ MainData.forEach((InvoiceList) => {
229
+ InvoiceList.Invoices.forEach((invoice) => {
230
+ invoice.ItemsArray.forEach((item) => {
231
+ if (item.Rate === 0.25) {
232
+ let Index = this.MainHeadings.findIndex((Header) => {
233
+ return Header.Rate === 'I0.25';
234
+ });
235
+ if (Index === -1) {
236
+ this.MainHeadings.push({
237
+ text: 'spare sales @ 0.25%',
238
+ ColRange: 1,
239
+ Rate: 'I0.25',
240
+ field: 0.25,
241
+ Parts: 'Parts',
242
+ bold: true,
243
+ ChildHeadings: [],
244
+ });
245
+ }
246
+ }
247
+ else if (item.Rate === 3) {
248
+ let Index = this.MainHeadings.findIndex((Header) => {
249
+ return Header.Rate === 'I3';
250
+ });
251
+ if (Index === -1) {
252
+ this.MainHeadings.push({
253
+ text: 'spare sales @ 3%',
254
+ ColRange: 1,
255
+ Rate: 'I3',
256
+ field: 3,
257
+ Parts: 'Parts',
258
+ bold: true,
259
+ ChildHeadings: [],
260
+ });
261
+ }
262
+ }
263
+ else if (item.Rate === 5) {
264
+ let Index = this.MainHeadings.findIndex((Header) => {
265
+ return Header.Rate === 'I5';
266
+ });
267
+ if (Index === -1) {
268
+ this.MainHeadings.push({
269
+ text: 'spare sales @ 5%',
270
+ ColRange: 1,
271
+ Rate: 'I5',
272
+ field: 5,
273
+ Parts: 'Parts',
274
+ bold: true,
275
+ ChildHeadings: [],
276
+ });
277
+ }
278
+ }
279
+ else if (item.Rate === 12) {
280
+ let Index = this.MainHeadings.findIndex((Header) => {
281
+ return Header.Rate === 'I12';
282
+ });
283
+ if (Index === -1) {
284
+ this.MainHeadings.push({
285
+ text: 'spare sales @ 12%',
286
+ ColRange: 1,
287
+ Rate: 'I12',
288
+ field: 12,
289
+ Parts: 'Parts',
290
+ bold: true,
291
+ ChildHeadings: [],
292
+ });
293
+ }
294
+ }
295
+ else if (item.Rate === 18) {
296
+ let Index = this.MainHeadings.findIndex((Header) => {
297
+ return Header.Rate === 'I18';
298
+ });
299
+ if (Index === -1) {
300
+ this.MainHeadings.push({
301
+ text: 'spare sales @ 18%',
302
+ ColRange: 1,
303
+ Rate: 'I18',
304
+ field: 18,
305
+ Parts: 'Parts',
306
+ bold: true,
307
+ ChildHeadings: [],
308
+ });
309
+ }
310
+ }
311
+ else if (item.Rate === 28) {
312
+ let Index = this.MainHeadings.findIndex((Header) => {
313
+ return Header.Rate === 'I28';
314
+ });
315
+ if (Index === -1) {
316
+ this.MainHeadings.push({
317
+ text: 'spare sales @ 28%',
318
+ ColRange: 1,
319
+ Rate: 'I28',
320
+ field: 28,
321
+ Parts: 'Parts',
322
+ bold: true,
323
+ ChildHeadings: [],
324
+ });
325
+ }
326
+ }
327
+ });
328
+ });
329
+ });
330
+ this.MainHeadings.push({
331
+ text: 'Labour charges',
332
+ ColRange: 1,
333
+ field: 'LaborTaxable',
334
+ bold: true,
335
+ ChildHeadings: [],
336
+ });
337
+ // MainData.forEach((InvoiceList: any) => {
338
+ // InvoiceList.Invoices.forEach((invoice: any) => {
339
+ // invoice.LaborArray.forEach((labor: any) => {
340
+ // if (labor.Rate === 0.25) {
341
+ // let Index: any = this.MainHeadings.findIndex((Header: any) => {
342
+ // return Header.Rate === 'L0.25'
343
+ // });
344
+ // if (Index === -1) {
345
+ // this.MainHeadings.push({
346
+ // text: 'Labor 0.25%',
347
+ // ColRange: 1,
348
+ // bold: true,
349
+ // field: 0.25,
350
+ // Labor: 'Labor',
351
+ // Rate: 'L0.25',
352
+ // ChildHeadings: [],
353
+ // });
354
+ // this.MainHeadings.push({
355
+ // text: 'Labor CGST 0.25%',
356
+ // ColRange: 1,
357
+ // Rate: 'L0.25',
358
+ // bold: true,
359
+ // ChildHeadings: [],
360
+ // });
361
+ // this.MainHeadings.push({
362
+ // text: 'Labor SGST 0.25%',
363
+ // ColRange: 1,
364
+ // Rate: 'L0.25',
365
+ // bold: true,
366
+ // ChildHeadings: [],
367
+ // });
368
+ // this.MainHeadings.push({
369
+ // text: 'Labor IGST 0.25%',
370
+ // ColRange: 1,
371
+ // Rate: 'L0.25',
372
+ // bold: true,
373
+ // ChildHeadings: [],
374
+ // });
375
+ // }
376
+ // } else if (labor.Rate === 3) {
377
+ // let Index: any = this.MainHeadings.findIndex((Header: any) => {
378
+ // return Header.Rate === 'L3'
379
+ // });
380
+ // if (Index === -1) {
381
+ // this.MainHeadings.push({
382
+ // text: 'Labor 3%',
383
+ // ColRange: 1,
384
+ // Rate: 'L3',
385
+ // field: 3,
386
+ // Labor: 'Labor',
387
+ // bold: true,
388
+ // ChildHeadings: [],
389
+ // });
390
+ // this.MainHeadings.push({
391
+ // text: 'Labor CGST 3%',
392
+ // ColRange: 1,
393
+ // Rate: 'L3',
394
+ // bold: true,
395
+ // ChildHeadings: [],
396
+ // });
397
+ // this.MainHeadings.push({
398
+ // text: 'Labor SGST 3%',
399
+ // ColRange: 1,
400
+ // Rate: 'L3',
401
+ // bold: true,
402
+ // ChildHeadings: [],
403
+ // });
404
+ // this.MainHeadings.push({
405
+ // text: 'Labor IGST 3%',
406
+ // ColRange: 1,
407
+ // Rate: 'L3',
408
+ // bold: true,
409
+ // ChildHeadings: [],
410
+ // });
411
+ // }
412
+ // } else if (labor.Rate === 5) {
413
+ // let Index: any = this.MainHeadings.findIndex((Header: any) => {
414
+ // return Header.Rate === 'L5'
415
+ // });
416
+ // if (Index === -1) {
417
+ // this.MainHeadings.push({
418
+ // text: 'Labor 5%',
419
+ // ColRange: 1,
420
+ // bold: true,
421
+ // field: 5,
422
+ // Labor: 'Labor',
423
+ // Rate: 'L5',
424
+ // ChildHeadings: [],
425
+ // });
426
+ // this.MainHeadings.push({
427
+ // text: 'Labor CGST 5%',
428
+ // ColRange: 1,
429
+ // Rate: 'L5',
430
+ // bold: true,
431
+ // ChildHeadings: [],
432
+ // });
433
+ // this.MainHeadings.push({
434
+ // text: 'Labor SGST 5%',
435
+ // ColRange: 1,
436
+ // Rate: 'L5',
437
+ // bold: true,
438
+ // ChildHeadings: [],
439
+ // });
440
+ // this.MainHeadings.push({
441
+ // text: 'Labor IGST 5%',
442
+ // ColRange: 1,
443
+ // Rate: 'L5',
444
+ // bold: true,
445
+ // ChildHeadings: [],
446
+ // });
447
+ // }
448
+ // } else if (labor.Rate === 12) {
449
+ // let Index: any = this.MainHeadings.findIndex((Header: any) => {
450
+ // return Header.Rate === 'L12'
451
+ // });
452
+ // if (Index === -1) {
453
+ // this.MainHeadings.push({
454
+ // text: 'Labor 12%',
455
+ // ColRange: 1,
456
+ // Rate: 'L12',
457
+ // field: 12,
458
+ // Labor: 'Labor',
459
+ // bold: true,
460
+ // ChildHeadings: [],
461
+ // });
462
+ // this.MainHeadings.push({
463
+ // text: 'Labor CGST 12%',
464
+ // ColRange: 1,
465
+ // Rate: 'L12',
466
+ // bold: true,
467
+ // ChildHeadings: [],
468
+ // });
469
+ // this.MainHeadings.push({
470
+ // text: 'Labor SGST 12%',
471
+ // ColRange: 1,
472
+ // Rate: 'L12',
473
+ // bold: true,
474
+ // ChildHeadings: [],
475
+ // });
476
+ // this.MainHeadings.push({
477
+ // text: 'Labor IGST 12%',
478
+ // ColRange: 1,
479
+ // Rate: 'L12',
480
+ // bold: true,
481
+ // ChildHeadings: [],
482
+ // });
483
+ // }
484
+ // } else if (labor.Rate === 18) {
485
+ // let Index: any = this.MainHeadings.findIndex((Header: any) => {
486
+ // return Header.Rate === 'L18'
487
+ // });
488
+ // if (Index === -1) {
489
+ // this.MainHeadings.push({
490
+ // text: 'Labor 18%',
491
+ // ColRange: 1,
492
+ // Rate: 'L18',
493
+ // field: 18,
494
+ // Labor: 'Labor',
495
+ // bold: true,
496
+ // ChildHeadings: [],
497
+ // });
498
+ // this.MainHeadings.push({
499
+ // text: 'Labor CGST 18%',
500
+ // ColRange: 1,
501
+ // Rate: 'L18',
502
+ // bold: true,
503
+ // ChildHeadings: [],
504
+ // });
505
+ // this.MainHeadings.push({
506
+ // text: 'Labor SGST 18%',
507
+ // ColRange: 1,
508
+ // Rate: 'L18',
509
+ // bold: true,
510
+ // ChildHeadings: [],
511
+ // });
512
+ // this.MainHeadings.push({
513
+ // text: 'Labor IGST 18%',
514
+ // ColRange: 1,
515
+ // Rate: 'L18',
516
+ // bold: true,
517
+ // ChildHeadings: [],
518
+ // });
519
+ // }
520
+ // } else if (labor.Rate === 28) {
521
+ // let Index: any = this.MainHeadings.findIndex((Header: any) => {
522
+ // return Header.Rate === 'L28'
523
+ // });
524
+ // if (Index === -1) {
525
+ // this.MainHeadings.push({
526
+ // text: 'Labor 28%',
527
+ // ColRange: 1,
528
+ // Rate: 'L28',
529
+ // field: 28,
530
+ // Labor: 'Labor',
531
+ // bold: true,
532
+ // ChildHeadings: [],
533
+ // });
534
+ // this.MainHeadings.push({
535
+ // text: 'Labor CGST 28%',
536
+ // ColRange: 1,
537
+ // Rate: 'L28',
538
+ // bold: true,
539
+ // ChildHeadings: [],
540
+ // });
541
+ // this.MainHeadings.push({
542
+ // text: 'Labor SGST 28%',
543
+ // ColRange: 1,
544
+ // Rate: 'L28',
545
+ // bold: true,
546
+ // ChildHeadings: [],
547
+ // });
548
+ // this.MainHeadings.push({
549
+ // text: 'Labor IGST 28%',
550
+ // ColRange: 1,
551
+ // Rate: 'L28',
552
+ // bold: true,
553
+ // ChildHeadings: [],
554
+ // });
555
+ // }
556
+ // }
557
+ // });
558
+ // });
559
+ // });
560
+ this.MainHeadings.push({
561
+ text: 'Output CGST',
562
+ ColRange: 1,
563
+ field: 'CGSTAmt',
564
+ bold: true,
565
+ ChildHeadings: [],
566
+ });
567
+ this.MainHeadings.push({
568
+ text: 'Output SGST',
569
+ ColRange: 1,
570
+ field: 'SGSTAmt',
571
+ bold: true,
572
+ ChildHeadings: [],
573
+ });
574
+ this.MainHeadings.push({
575
+ text: 'Round off',
576
+ ColRange: 1,
577
+ field: 'Round',
578
+ bold: true,
579
+ ChildHeadings: [],
580
+ });
581
+ this.MainHeadings.push({
582
+ text: 'Narration',
583
+ ColRange: 1,
584
+ field: 'TypeName',
585
+ bold: true,
586
+ ChildHeadings: [],
587
+ });
588
+ let MainColStart = 0;
589
+ this.MainHeadings.forEach((MainHeader) => {
590
+ this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
591
+ this.MergeArray.push({
592
+ s: { r: this.Row, c: MainColStart },
593
+ e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
594
+ });
595
+ MainColStart += MainHeader.ColRange;
596
+ });
597
+ this.Row += 2;
598
+ }
599
+ static setInvoiceDetailsInCell(MainData) {
600
+ let SNO = 0;
601
+ MainData.forEach((InvoiceList) => {
602
+ InvoiceList.Invoices.forEach((invoice, Index) => {
603
+ SNO = SNO + 1;
604
+ this.SetInvoiceDataInExcel(invoice, SNO);
605
+ });
606
+ });
607
+ }
608
+ static SetInvoiceDataInExcel(InvoiceInfo, Index) {
609
+ // console.log(InvoiceInfo);
610
+ InvoiceInfo.CrDate = this.ConvertDateToReadableFormat(InvoiceInfo.CrDate);
611
+ let InvoiceData = [];
612
+ this.MainHeadings.forEach((Header) => {
613
+ if (Header.field === 'SNo') {
614
+ InvoiceData.push({ text: Index, ColRange: 1, IsString: true });
615
+ }
616
+ else if (Header.field === 'Code' || Header.field === 'CrDate' || Header.field === 'Name'
617
+ || Header.field === 'GSTIN' || Header.field === 'Total' || Header.field === 'SubTotal' || Header.field === 'Round'
618
+ || Header.field === 'CGSTAmt' || Header.field === 'SGSTAmt' || Header.field === 'IGSTAmt' || Header.field === 'TypeName') {
619
+ InvoiceData.push({ text: InvoiceInfo[Header.field], ColRange: 1, IsString: true });
620
+ }
621
+ else if (Header.Parts === 'Parts') {
622
+ let PIndex = InvoiceInfo.ItemsArray.findIndex((item) => {
623
+ return item.Rate === Header.field;
624
+ });
625
+ if (PIndex !== -1) {
626
+ // let TaxResult: number = InvoiceInfo.ItemsArray[PIndex].CGST + InvoiceInfo.ItemsArray[PIndex].SGST + InvoiceInfo.ItemsArray[PIndex].IGST;
627
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].Taxable, ColRange: 1, IsString: true });
628
+ // InvoiceData.push({ text: TaxResult, ColRange: 1, IsString: true });
629
+ // InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].CGST, ColRange: 1, IsString: true });
630
+ // InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].SGST, ColRange: 1, IsString: true });
631
+ // InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].IGST, ColRange: 1, IsString: true });
632
+ }
633
+ else {
634
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
635
+ // InvoiceData.push({ text: '', ColRange: 1, IsString: true });
636
+ // InvoiceData.push({ text: '', ColRange: 1, IsString: true });
637
+ // InvoiceData.push({ text: '', ColRange: 1, IsString: true });
638
+ // InvoiceData.push({ text: '', ColRange: 1, IsString: true });
639
+ }
640
+ }
641
+ else if (Header.Labor === 'Labor') {
642
+ let LIndex = InvoiceInfo.LaborArray.findIndex((labor) => {
643
+ return labor.Rate === Header.field;
644
+ });
645
+ if (LIndex !== -1) {
646
+ let TaxResult = InvoiceInfo.LaborArray[LIndex].CGST + InvoiceInfo.LaborArray[LIndex].SGST + InvoiceInfo.LaborArray[LIndex].IGST;
647
+ InvoiceData.push({ text: TaxResult, ColRange: 1, IsString: true });
648
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].CGST, ColRange: 1, IsString: true });
649
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].SGST, ColRange: 1, IsString: true });
650
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].IGST, ColRange: 1, IsString: true });
651
+ }
652
+ else {
653
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
654
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
655
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
656
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
657
+ }
658
+ }
659
+ else if (Header.field === 'LaborTaxable') {
660
+ let Taxable = 0;
661
+ InvoiceInfo.LaborArray.forEach((item) => {
662
+ Taxable = Taxable + item.Taxable;
663
+ });
664
+ InvoiceData.push({ text: Taxable, ColRange: 1, IsString: true });
665
+ }
666
+ else if (Header.field === 'Taxable') {
667
+ let Taxable = 0;
668
+ InvoiceInfo.ItemsArray.forEach((item) => {
669
+ Taxable = Taxable + item.Taxable;
670
+ });
671
+ InvoiceData.push({ text: Taxable, ColRange: 1, IsString: true });
672
+ }
673
+ });
674
+ let ColStart = 0;
675
+ InvoiceData.forEach((InvData) => {
676
+ InvData.text = this.ConvertToString(InvData.text, InvData.IsString);
677
+ this.SetDataInCell(InvData.text, ColStart, this.Row);
678
+ this.MergeArray.push({
679
+ s: { r: this.Row, c: ColStart },
680
+ e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
681
+ });
682
+ ColStart += InvData.ColRange;
683
+ });
684
+ this.Row += 1;
685
+ }
686
+ static ConvertToString(Text, IsString) {
687
+ if (IsString) {
688
+ if (Text == null) {
689
+ Text = '';
690
+ }
691
+ }
692
+ else {
693
+ if (Text == null) {
694
+ Text = 0;
695
+ }
696
+ }
697
+ if (typeof Text === 'number') {
698
+ return Number(tr_utils_1.TrUtils.FixedTo(Text));
699
+ }
700
+ else {
701
+ return Text;
702
+ }
703
+ }
704
+ static SetDataInCell(Data, ColRange, RowNum) {
705
+ var cell = { v: Data };
706
+ var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
707
+ if (this.range.e.c < ColRange) {
708
+ this.range.e.c = ColRange;
709
+ }
710
+ if (this.range.e.r < RowNum) {
711
+ this.range.e.r = RowNum;
712
+ }
713
+ cell = this.getcelltype(cell);
714
+ this.ws[cell_ref] = cell;
715
+ }
716
+ static getcelltype(cell) {
717
+ if (typeof cell.v === 'number')
718
+ cell.t = 'n';
719
+ else if (typeof cell.v === 'boolean')
720
+ cell.t = 'b';
721
+ else
722
+ cell.t = 's';
723
+ return cell;
724
+ }
725
+ static ConvertDateToReadableFormat(DateObject) {
726
+ if (!tr_utils_1.TrUtils.IsEmpty(DateObject)) {
727
+ let date = new Date(DateObject);
728
+ let Month;
729
+ let Day;
730
+ let MonthName = new Array();
731
+ MonthName[0] = 'Jan';
732
+ MonthName[1] = 'Feb';
733
+ MonthName[2] = 'Mar';
734
+ MonthName[3] = 'Apr';
735
+ MonthName[4] = 'May';
736
+ MonthName[5] = 'Jun';
737
+ MonthName[6] = 'Jul';
738
+ MonthName[7] = 'Aug';
739
+ MonthName[8] = 'Sept';
740
+ MonthName[9] = 'Oct';
741
+ MonthName[10] = 'Nov';
742
+ MonthName[11] = 'Dec';
743
+ // Month = MonthName[date.getMonth()];
744
+ Month = date.getMonth() + 1;
745
+ if (date.getDate() < 10) {
746
+ Day = '0' + date.getDate();
747
+ }
748
+ else {
749
+ Day = date.getDate();
750
+ }
751
+ date = Day + '.' + Month + '.' + date.getFullYear();
752
+ return date;
753
+ }
754
+ else {
755
+ return null;
756
+ }
757
+ }
758
+ }
759
+ exports.TallySalesImportXlsxFileService = TallySalesImportXlsxFileService;
760
+ TallySalesImportXlsxFileService.wb = {};
761
+ TallySalesImportXlsxFileService.Row = 2;
762
+ TallySalesImportXlsxFileService.MergeArray = [];
763
+ TallySalesImportXlsxFileService.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
764
+ TallySalesImportXlsxFileService.ws = {};
765
+ TallySalesImportXlsxFileService.MainHeadings = [];