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,492 @@
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.IssueSparesXlsxFileService = void 0;
27
+ const XLSX = __importStar(require("xlsx"));
28
+ const tr_utils_1 = require("../utils/tr-utils");
29
+ class IssueSparesXlsxFileService {
30
+ static GetInvoiceWiseExcelData(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 = 'Spares Issue';
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();
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: 20 }, { wch: 20 }, { wch: 10 }, { wch: 15 }, { wch: 20 }, { wch: 20 }, { wch: 10 }, { wch: 50 }, { wch: 40 }];
47
+ this.wb.SheetNames.push(ws_name);
48
+ this.wb.Sheets[ws_name] = this.ws;
49
+ return this.wb;
50
+ }
51
+ static GetTotals(MainData, WOTypes) {
52
+ MainData.forEach((InvoiceInfo) => {
53
+ if (InvoiceInfo.VIN == null) {
54
+ InvoiceInfo.VIN = '';
55
+ }
56
+ if (InvoiceInfo.Name == null) {
57
+ InvoiceInfo.Name = '';
58
+ }
59
+ if (InvoiceInfo.TeNa == null) {
60
+ InvoiceInfo.TeNa = '';
61
+ }
62
+ // if (InvoiceInfo.Type == null) {
63
+ // InvoiceInfo.TypeName = '';
64
+ // } else {
65
+ // InvoiceInfo.TypeName = this.GetWOTypeName(InvoiceInfo.Type, WOTypes);
66
+ // }
67
+ // InvoiceInfo.GSTAmount =
68
+ // InvoiceInfo.ItemsCGST + InvoiceInfo.ItemsSGST + InvoiceInfo.ItemsIGST;
69
+ // InvoiceInfo.TotalAmount = InvoiceInfo.GSTAmount + InvoiceInfo.ItemsNetAmt;
70
+ // InvoiceInfo.OpsGSTAmount =
71
+ // InvoiceInfo.OpsCGST + InvoiceInfo.OpsSGST + InvoiceInfo.OpsIGST;
72
+ // InvoiceInfo.TotalOpsAmount =
73
+ // InvoiceInfo.OpsGSTAmount + InvoiceInfo.OpsNetAmt;
74
+ });
75
+ return MainData;
76
+ }
77
+ static GetWOTypeName(Type, WOTypes) {
78
+ let Index = WOTypes.findIndex((wotype) => {
79
+ return Type === wotype._id;
80
+ });
81
+ if (Index !== -1) {
82
+ return WOTypes[Index].Name;
83
+ }
84
+ else {
85
+ return '';
86
+ }
87
+ }
88
+ static setHeadingInCell() {
89
+ // let MainHeadings: any[] = [
90
+ // {
91
+ // text: 'GSTIN/UIN',
92
+ // ColRange: 1,
93
+ // bold: true,
94
+ // ChildHeadings: []
95
+ // },
96
+ // {
97
+ // text: 'Name',
98
+ // ColRange: 1,
99
+ // bold: true,
100
+ // ChildHeadings: []
101
+ // },
102
+ // {
103
+ // text: 'Invoice Details',
104
+ // ColRange: 4,
105
+ // bold: true,
106
+ // ChildHeadings: [
107
+ // { text: 'No', ColRange: 1 },
108
+ // { text: 'Date', ColRange: 1 },
109
+ // { text: 'Invoice Total', ColRange: 1 }
110
+ // ]
111
+ // },
112
+ // {
113
+ // text: 'Rate',
114
+ // ColRange: 1,
115
+ // bold: true,
116
+ // ChildHeadings: []
117
+ // },
118
+ // {
119
+ // text: 'Taxable Value',
120
+ // ColRange: 1,
121
+ // bold: true,
122
+ // ChildHeadings: []
123
+ // },
124
+ // {
125
+ // text: 'Amount',
126
+ // ColRange: 3,
127
+ // bold: true,
128
+ // ChildHeadings: [
129
+ // { text: 'Central Tax', ColRange: 1 },
130
+ // { text: 'State Tax', ColRange: 1 },
131
+ // { text: 'IGST Tax', ColRange: 1 },
132
+ // ]
133
+ // }
134
+ // ]
135
+ let MainHeadings = [
136
+ // {
137
+ // text: 'Date',
138
+ // ColRange: 1,
139
+ // bold: true,
140
+ // ChildHeadings: [],
141
+ // },
142
+ // {
143
+ // text: 'Invoice No',
144
+ // ColRange: 1,
145
+ // bold: true
146
+ // },
147
+ {
148
+ text: 'Date',
149
+ ColRange: 1,
150
+ bold: true,
151
+ ChildHeadings: [],
152
+ },
153
+ {
154
+ text: 'RO No',
155
+ ColRange: 1,
156
+ bold: true,
157
+ ChildHeadings: [],
158
+ },
159
+ // {
160
+ // text: 'Customer',
161
+ // ColRange: 1,
162
+ // bold: true,
163
+ // ChildHeadings: [
164
+ // // { text: 'Central Tax', ColRange: 1 },
165
+ // // { text: 'State Tax', ColRange: 1 },
166
+ // // { text: 'IGST Tax', ColRange: 1 },
167
+ // ],
168
+ // },
169
+ {
170
+ text: 'Chassis No',
171
+ ColRange: 1,
172
+ bold: true,
173
+ ChildHeadings: [
174
+ // { text: 'Central Tax', ColRange: 1 },
175
+ // { text: 'State Tax', ColRange: 1 },
176
+ // { text: 'IGST Tax', ColRange: 1 },
177
+ ],
178
+ },
179
+ {
180
+ text: 'Vehicle',
181
+ ColRange: 1,
182
+ bold: true,
183
+ ChildHeadings: [
184
+ // { text: 'Central Tax', ColRange: 1 },
185
+ // { text: 'State Tax', ColRange: 1 },
186
+ // { text: 'IGST Tax', ColRange: 1 },
187
+ ],
188
+ },
189
+ // {
190
+ // text: 'Color',
191
+ // ColRange: 1,
192
+ // bold: true,
193
+ // ChildHeadings: [
194
+ // // { text: 'Central Tax', ColRange: 1 },
195
+ // // { text: 'State Tax', ColRange: 1 },
196
+ // // { text: 'IGST Tax', ColRange: 1 },
197
+ // ]
198
+ // },
199
+ {
200
+ text: 'Year Of Model',
201
+ ColRange: 1,
202
+ bold: true,
203
+ ChildHeadings: [
204
+ // { text: 'Central Tax', ColRange: 1 },
205
+ // { text: 'State Tax', ColRange: 1 },
206
+ // { text: 'IGST Tax', ColRange: 1 },
207
+ ],
208
+ },
209
+ {
210
+ text: 'Reg. No',
211
+ ColRange: 1,
212
+ bold: true,
213
+ ChildHeadings: [
214
+ // { text: 'Central Tax', ColRange: 1 },
215
+ // { text: 'State Tax', ColRange: 1 },
216
+ // { text: 'IGST Tax', ColRange: 1 },
217
+ ],
218
+ },
219
+ // {
220
+ // text: 'Supervisor',
221
+ // ColRange: 1,
222
+ // bold: true,
223
+ // ChildHeadings: [
224
+ // // { text: 'Central Tax', ColRange: 1 },
225
+ // // { text: 'State Tax', ColRange: 1 },
226
+ // // { text: 'IGST Tax', ColRange: 1 },
227
+ // ]
228
+ // },
229
+ {
230
+ text: 'Service Advisor',
231
+ ColRange: 1,
232
+ bold: true,
233
+ ChildHeadings: [
234
+ // { text: 'Central Tax', ColRange: 1 },
235
+ // { text: 'State Tax', ColRange: 1 },
236
+ // { text: 'IGST Tax', ColRange: 1 },
237
+ ],
238
+ },
239
+ {
240
+ text: 'Service Type',
241
+ ColRange: 1,
242
+ bold: true,
243
+ ChildHeadings: [
244
+ // { text: 'Central Tax', ColRange: 1 },
245
+ // { text: 'State Tax', ColRange: 1 },
246
+ // { text: 'IGST Tax', ColRange: 1 },
247
+ ],
248
+ },
249
+ {
250
+ text: 'Meter Reading',
251
+ ColRange: 1,
252
+ bold: true,
253
+ ChildHeadings: [
254
+ // { text: 'Central Tax', ColRange: 1 },
255
+ // { text: 'State Tax', ColRange: 1 },
256
+ // { text: 'IGST Tax', ColRange: 1 },
257
+ ],
258
+ },
259
+ {
260
+ text: 'Product',
261
+ ColRange: 1,
262
+ bold: true,
263
+ ChildHeadings: [
264
+ // { text: 'Central Tax', ColRange: 1 },
265
+ // { text: 'State Tax', ColRange: 1 },
266
+ // { text: 'IGST Tax', ColRange: 1 },
267
+ ],
268
+ },
269
+ {
270
+ text: 'Description',
271
+ ColRange: 1,
272
+ bold: true,
273
+ ChildHeadings: [
274
+ // { text: 'Central Tax', ColRange: 1 },
275
+ // { text: 'State Tax', ColRange: 1 },
276
+ // { text: 'IGST Tax', ColRange: 1 },
277
+ ],
278
+ },
279
+ {
280
+ text: 'Qty',
281
+ ColRange: 1,
282
+ bold: true,
283
+ ChildHeadings: [
284
+ // { text: 'Central Tax', ColRange: 1 },
285
+ // { text: 'State Tax', ColRange: 1 },
286
+ // { text: 'IGST Tax', ColRange: 1 },
287
+ ],
288
+ },
289
+ {
290
+ text: 'UoM',
291
+ ColRange: 1,
292
+ bold: true,
293
+ ChildHeadings: [
294
+ // { text: 'Central Tax', ColRange: 1 },
295
+ // { text: 'State Tax', ColRange: 1 },
296
+ // { text: 'IGST Tax', ColRange: 1 },
297
+ ],
298
+ },
299
+ {
300
+ text: 'Unit Price',
301
+ ColRange: 1,
302
+ bold: true,
303
+ ChildHeadings: [
304
+ // { text: 'Central Tax', ColRange: 1 },
305
+ // { text: 'State Tax', ColRange: 1 },
306
+ // { text: 'IGST Tax', ColRange: 1 },
307
+ ],
308
+ },
309
+ {
310
+ text: 'Gross Amount',
311
+ ColRange: 1,
312
+ bold: true,
313
+ ChildHeadings: [
314
+ // { text: 'Central Tax', ColRange: 1 },
315
+ // { text: 'State Tax', ColRange: 1 },
316
+ // { text: 'IGST Tax', ColRange: 1 },
317
+ ],
318
+ },
319
+ {
320
+ text: 'Technician',
321
+ ColRange: 1,
322
+ bold: true,
323
+ ChildHeadings: [
324
+ // { text: 'Central Tax', ColRange: 1 },
325
+ // { text: 'State Tax', ColRange: 1 },
326
+ // { text: 'IGST Tax', ColRange: 1 },
327
+ ],
328
+ },
329
+ ];
330
+ let MainColStart = 0;
331
+ MainHeadings.forEach((MainHeader) => {
332
+ this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
333
+ this.MergeArray.push({
334
+ s: { r: this.Row, c: MainColStart },
335
+ e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
336
+ });
337
+ MainColStart += MainHeader.ColRange;
338
+ });
339
+ this.Row += 2;
340
+ }
341
+ static setInvoiceDetailsInCell(MainData) {
342
+ MainData.forEach((InvoiceList) => {
343
+ this.SetInvoiceDataInExcel(InvoiceList);
344
+ });
345
+ }
346
+ static SetInvoiceDataInExcel(InvoiceInfo) {
347
+ InvoiceInfo.CrDate = this.ConvertDateToReadableFormat(InvoiceInfo.CrDate);
348
+ InvoiceInfo.WCrDate = this.ConvertDateToReadableFormat(InvoiceInfo.WCrDate);
349
+ if (tr_utils_1.TrUtils.IsNull(InvoiceInfo.Prod)) {
350
+ InvoiceInfo.Prod = {};
351
+ }
352
+ if (tr_utils_1.TrUtils.IsNull(InvoiceInfo.WOType)) {
353
+ InvoiceInfo.WOType = {};
354
+ }
355
+ let Product = '';
356
+ let Price = 0;
357
+ let UnAmt = 0;
358
+ if (!tr_utils_1.TrUtils.IsNull(InvoiceInfo.Parts)) {
359
+ if (!tr_utils_1.TrUtils.IsNull(InvoiceInfo.Parts.MPN)) {
360
+ Product = InvoiceInfo.Parts.MPN + ' - ' + InvoiceInfo.Parts.Desc;
361
+ }
362
+ else {
363
+ Product = InvoiceInfo.Parts.Desc;
364
+ }
365
+ if (!tr_utils_1.TrUtils.IsZero(InvoiceInfo.Parts.AssPr)) {
366
+ Price = tr_utils_1.TrUtils.FixPriceValue(InvoiceInfo.Parts.AssPr);
367
+ }
368
+ else {
369
+ Price = tr_utils_1.TrUtils.FixPriceValue(InvoiceInfo.Parts.UnPr);
370
+ }
371
+ if (!tr_utils_1.TrUtils.IsZero(InvoiceInfo.Parts.AssAmt)) {
372
+ UnAmt = tr_utils_1.TrUtils.FixPriceValue(InvoiceInfo.Parts.AssAmt);
373
+ }
374
+ else {
375
+ UnAmt = tr_utils_1.TrUtils.FixPriceValue(InvoiceInfo.Parts.UnAmt);
376
+ }
377
+ ;
378
+ }
379
+ if (tr_utils_1.TrUtils.IsNull(InvoiceInfo.Parts)) {
380
+ InvoiceInfo.Parts = {};
381
+ }
382
+ let InvoiceData = [
383
+ // { text: InvoiceInfo.CrDate, ColRange: 1, IsString: true },
384
+ // { text: InvoiceInfo.Code, ColRange: 1, IsString: true },
385
+ { text: InvoiceInfo.CrDate, ColRange: 1, IsString: true },
386
+ { text: InvoiceInfo.Code, ColRange: 1, IsString: true },
387
+ // { text: InvoiceInfo.CustName, ColRange: 1, IsString: true },
388
+ { text: InvoiceInfo.Prod.VIN, ColRange: 1, IsString: false },
389
+ { text: InvoiceInfo.Prod.Model, ColRange: 1, IsString: false },
390
+ { text: InvoiceInfo.Prod.Year, ColRange: 1, IsString: false },
391
+ { text: InvoiceInfo.Prod.RegNo, ColRange: 1, IsString: false },
392
+ { text: InvoiceInfo.Name, ColRange: 1, IsString: false },
393
+ { text: InvoiceInfo.WOType.Name, ColRange: 1, IsString: false },
394
+ { text: InvoiceInfo.MIn, ColRange: 1, IsString: false },
395
+ { text: Product, ColRange: 1, IsString: false },
396
+ { text: InvoiceInfo.Parts.Desc, ColRange: 1, IsString: false },
397
+ { text: InvoiceInfo.Parts.Qty, ColRange: 1, IsString: false },
398
+ { text: InvoiceInfo.Parts.UoM, ColRange: 1, IsString: false },
399
+ { text: Price, ColRange: 1, IsString: false },
400
+ { text: UnAmt, ColRange: 1, IsString: false },
401
+ { text: InvoiceInfo.TeNa, ColRange: 1, IsString: false },
402
+ ];
403
+ let ColStart = 0;
404
+ InvoiceData.forEach((InvData) => {
405
+ InvData.text = this.ConvertToString(InvData.text, InvData.IsString);
406
+ this.SetDataInCell(InvData.text, ColStart, this.Row);
407
+ this.MergeArray.push({
408
+ s: { r: this.Row, c: ColStart },
409
+ e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
410
+ });
411
+ ColStart += InvData.ColRange;
412
+ });
413
+ this.Row += 1;
414
+ }
415
+ static ConvertToString(Text, IsString) {
416
+ if (IsString) {
417
+ if (Text == null) {
418
+ Text = '';
419
+ }
420
+ }
421
+ else {
422
+ if (Text == null) {
423
+ Text = 0;
424
+ }
425
+ }
426
+ if (typeof Text === 'number') {
427
+ return Number(tr_utils_1.TrUtils.FixedTo(Text));
428
+ }
429
+ else {
430
+ return Text;
431
+ }
432
+ }
433
+ static SetDataInCell(Data, ColRange, RowNum) {
434
+ var cell = { v: Data };
435
+ var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
436
+ if (this.range.e.c < ColRange) {
437
+ this.range.e.c = ColRange;
438
+ }
439
+ if (this.range.e.r < RowNum) {
440
+ this.range.e.r = RowNum;
441
+ }
442
+ cell = this.getcelltype(cell);
443
+ this.ws[cell_ref] = cell;
444
+ }
445
+ static getcelltype(cell) {
446
+ if (typeof cell.v === 'number')
447
+ cell.t = 'n';
448
+ else if (typeof cell.v === 'boolean')
449
+ cell.t = 'b';
450
+ else
451
+ cell.t = 's';
452
+ return cell;
453
+ }
454
+ static ConvertDateToReadableFormat(DateObject) {
455
+ if (!tr_utils_1.TrUtils.IsEmpty(DateObject)) {
456
+ let date = new Date(DateObject);
457
+ let Month;
458
+ let Day;
459
+ let MonthName = new Array();
460
+ MonthName[0] = 'Jan';
461
+ MonthName[1] = 'Feb';
462
+ MonthName[2] = 'Mar';
463
+ MonthName[3] = 'Apr';
464
+ MonthName[4] = 'May';
465
+ MonthName[5] = 'Jun';
466
+ MonthName[6] = 'Jul';
467
+ MonthName[7] = 'Aug';
468
+ MonthName[8] = 'Sept';
469
+ MonthName[9] = 'Oct';
470
+ MonthName[10] = 'Nov';
471
+ MonthName[11] = 'Dec';
472
+ Month = MonthName[date.getMonth()];
473
+ if (date.getDate() < 10) {
474
+ Day = '0' + date.getDate();
475
+ }
476
+ else {
477
+ Day = date.getDate();
478
+ }
479
+ date = Day + '-' + Month + '-' + date.getFullYear();
480
+ return date;
481
+ }
482
+ else {
483
+ return null;
484
+ }
485
+ }
486
+ }
487
+ exports.IssueSparesXlsxFileService = IssueSparesXlsxFileService;
488
+ IssueSparesXlsxFileService.wb = {};
489
+ IssueSparesXlsxFileService.Row = 2;
490
+ IssueSparesXlsxFileService.MergeArray = [];
491
+ IssueSparesXlsxFileService.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
492
+ IssueSparesXlsxFileService.ws = {};