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,935 @@
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.GSTROXlsxFileService = void 0;
27
+ const XLSX = __importStar(require("xlsx"));
28
+ const tr_utils_1 = require("../utils/tr-utils");
29
+ class GSTROXlsxFileService {
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 = 'GST RO';
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
+ let CGSTAmt = 0;
72
+ let SGSTAmt = 0;
73
+ let IGSTAmt = 0;
74
+ invoice.ItemsArray.forEach((item) => {
75
+ CGSTAmt = CGSTAmt + item.CGST;
76
+ SGSTAmt = SGSTAmt + item.SGST;
77
+ IGSTAmt = IGSTAmt + item.IGST;
78
+ });
79
+ invoice.LaborArray.forEach((item) => {
80
+ CGSTAmt = CGSTAmt + item.CGST;
81
+ SGSTAmt = SGSTAmt + item.SGST;
82
+ IGSTAmt = IGSTAmt + item.IGST;
83
+ });
84
+ invoice.CGSTAmt = CGSTAmt;
85
+ invoice.SGSTAmt = SGSTAmt;
86
+ invoice.IGSTAmt = IGSTAmt;
87
+ });
88
+ // let CGST18: number = 0;
89
+ // let SGST18: number = 0;
90
+ // let CGST28: number = 0;
91
+ // let SGST28: number = 0;
92
+ // let Total18perc: number = 0;
93
+ // let Total18perctax: number = 0;
94
+ // let Total28perc: number = 0;
95
+ // let Total28perctax: number = 0;
96
+ // if(!TrUtils.IsNull(InvoiceInfo.Parts) && InvoiceInfo.Parts.length !==0){
97
+ // InvoiceInfo.Parts.forEach((item: any) => {
98
+ // if (item.TCode === 106) {
99
+ // Total18perc=Total18perc+TrUtils.SetValueToZeroIfNull(item.UnAmt);
100
+ // CGST18 = CGST18 + TrUtils.SetValueToZeroIfNull(item.CGST);
101
+ // SGST18 = SGST18 + TrUtils.SetValueToZeroIfNull(item.SGST);
102
+ // Total18perctax=Total18perctax+Total18perc+CGST18+SGST18;
103
+ // } else if (item.TCode === 107) {
104
+ // Total28perc=Total28perc+TrUtils.SetValueToZeroIfNull(item.UnAmt);
105
+ // CGST28 = CGST28 + TrUtils.SetValueToZeroIfNull(item.CGST);
106
+ // SGST28 = SGST28 + TrUtils.SetValueToZeroIfNull(item.SGST);
107
+ // Total28perctax=Total28perctax+Total28perc+CGST28+SGST28;
108
+ // }
109
+ // });
110
+ // }
111
+ // InvoiceInfo.Total18perctax = TrUtils.FixPriceValue(Total18perctax);
112
+ // InvoiceInfo.Total28perctax = TrUtils.FixPriceValue(Total28perctax);
113
+ // InvoiceInfo.Total18perc = TrUtils.FixPriceValue(Total18perc);
114
+ // InvoiceInfo.Total28perc = TrUtils.FixPriceValue(Total28perc);
115
+ // InvoiceInfo.Items18CGST = TrUtils.FixPriceValue(CGST18);
116
+ // InvoiceInfo.Items18SGST = TrUtils.FixPriceValue(SGST18);
117
+ // InvoiceInfo.Items28CGST = TrUtils.FixPriceValue(CGST28);
118
+ // InvoiceInfo.Items28SGST = TrUtils.FixPriceValue(SGST28);
119
+ // InvoiceInfo.TotalCGST = TrUtils.FixPriceValue(CGST18+CGST28);
120
+ // InvoiceInfo.TotalSGST = TrUtils.FixPriceValue(SGST18+SGST28);
121
+ // InvoiceInfo.Items18GST = TrUtils.FixPriceValue(CGST18+SGST18);
122
+ // InvoiceInfo.Items28GST = TrUtils.FixPriceValue(CGST28+SGST28);
123
+ InvoiceInfo.GSTAmount =
124
+ InvoiceInfo.ItemsCGST + InvoiceInfo.ItemsSGST + InvoiceInfo.ItemsIGST;
125
+ InvoiceInfo.TotalAmount = InvoiceInfo.GSTAmount + InvoiceInfo.ItemsNetAmt;
126
+ InvoiceInfo.OpsGSTAmount =
127
+ InvoiceInfo.OpsCGST + InvoiceInfo.OpsSGST + InvoiceInfo.OpsIGST;
128
+ InvoiceInfo.TotalOpsAmount =
129
+ InvoiceInfo.OpsGSTAmount + InvoiceInfo.OpsNetAmt;
130
+ });
131
+ return MainData;
132
+ }
133
+ static GetWOTypeName(Type, WOTypes) {
134
+ let Index = WOTypes.findIndex((wotype) => {
135
+ return Type === wotype._id;
136
+ });
137
+ if (Index !== -1) {
138
+ return WOTypes[Index].Name;
139
+ }
140
+ else {
141
+ return '';
142
+ }
143
+ }
144
+ static setHeadingInCell(MainData) {
145
+ this.MainHeadings = [
146
+ {
147
+ text: 'SNo',
148
+ ColRange: 1,
149
+ field: 'SNo',
150
+ bold: true,
151
+ ChildHeadings: []
152
+ },
153
+ {
154
+ text: 'Invoice No',
155
+ ColRange: 1,
156
+ field: 'Code',
157
+ bold: true,
158
+ ChildHeadings: [
159
+ // { text: 'No', ColRange: 1 },
160
+ // { text: 'Date', ColRange: 1 },
161
+ // { text: 'InvoiceInfo Total', ColRange: 1 }
162
+ ],
163
+ },
164
+ {
165
+ text: 'Invoice Date',
166
+ ColRange: 1,
167
+ field: 'CrDate',
168
+ bold: true,
169
+ ChildHeadings: [],
170
+ },
171
+ {
172
+ text: 'Customer',
173
+ ColRange: 1,
174
+ field: 'Name',
175
+ bold: true,
176
+ ChildHeadings: [
177
+ // { text: 'Central Tax', ColRange: 1 },
178
+ // { text: 'State Tax', ColRange: 1 },
179
+ // { text: 'IGST Tax', ColRange: 1 },
180
+ ],
181
+ },
182
+ {
183
+ text: 'GSTIN',
184
+ ColRange: 1,
185
+ field: 'GSTIN',
186
+ bold: true,
187
+ ChildHeadings: [
188
+ // { text: 'Central Tax', ColRange: 1 },
189
+ // { text: 'State Tax', ColRange: 1 },
190
+ // { text: 'IGST Tax', ColRange: 1 },
191
+ ],
192
+ },
193
+ {
194
+ text: 'Total Amt',
195
+ ColRange: 1,
196
+ field: 'Total',
197
+ bold: true,
198
+ ChildHeadings: [],
199
+ },
200
+ {
201
+ text: 'Total Amount excluding GST',
202
+ ColRange: 1,
203
+ field: 'SubTotal',
204
+ bold: true,
205
+ ChildHeadings: [],
206
+ },
207
+ {
208
+ text: 'Parts Taxable Amt',
209
+ ColRange: 1,
210
+ field: 'Taxable',
211
+ bold: true,
212
+ ChildHeadings: [],
213
+ },
214
+ ];
215
+ MainData.forEach((InvoiceList) => {
216
+ InvoiceList.Invoices.forEach((invoice) => {
217
+ invoice.ItemsArray.forEach((item) => {
218
+ if (item.Rate === 0.25) {
219
+ let Index = this.MainHeadings.findIndex((Header) => {
220
+ return Header.Rate === 'I0.25';
221
+ });
222
+ if (Index === -1) {
223
+ this.MainHeadings.push({
224
+ text: 'Taxable value spare sales @ 0.25%',
225
+ ColRange: 1,
226
+ Rate: 'I0.25',
227
+ field: 'Taxable0.25',
228
+ bold: true,
229
+ ChildHeadings: [],
230
+ });
231
+ this.MainHeadings.push({
232
+ text: 'Parts 0.25%',
233
+ ColRange: 1,
234
+ Rate: 'I0.25',
235
+ field: 0.25,
236
+ Parts: 'Parts',
237
+ bold: true,
238
+ ChildHeadings: [],
239
+ });
240
+ this.MainHeadings.push({
241
+ text: 'Parts CGST 0.25%',
242
+ ColRange: 1,
243
+ Rate: 'I0.25',
244
+ field: 'CGST',
245
+ bold: true,
246
+ ChildHeadings: [],
247
+ });
248
+ this.MainHeadings.push({
249
+ text: 'Parts SGST 0.25%',
250
+ ColRange: 1,
251
+ Rate: 'I0.25',
252
+ field: 'SGST',
253
+ bold: true,
254
+ ChildHeadings: [],
255
+ });
256
+ this.MainHeadings.push({
257
+ text: 'Parts IGST 0.25%',
258
+ ColRange: 1,
259
+ Rate: 'I0.25',
260
+ field: 'IGST',
261
+ bold: true,
262
+ ChildHeadings: [],
263
+ });
264
+ }
265
+ }
266
+ else if (item.Rate === 3) {
267
+ let Index = this.MainHeadings.findIndex((Header) => {
268
+ return Header.Rate === 'I3';
269
+ });
270
+ if (Index === -1) {
271
+ this.MainHeadings.push({
272
+ text: 'Taxable value spare sales @ 3%',
273
+ ColRange: 1,
274
+ Rate: 'I3',
275
+ field: 'Taxable3',
276
+ bold: true,
277
+ ChildHeadings: [],
278
+ });
279
+ this.MainHeadings.push({
280
+ text: 'Parts 3%',
281
+ ColRange: 1,
282
+ Rate: 'I3',
283
+ field: 3,
284
+ Parts: 'Parts',
285
+ bold: true,
286
+ ChildHeadings: [],
287
+ });
288
+ this.MainHeadings.push({
289
+ text: 'Parts CGST 3%',
290
+ ColRange: 1,
291
+ Rate: 'I3',
292
+ bold: true,
293
+ ChildHeadings: [],
294
+ });
295
+ this.MainHeadings.push({
296
+ text: 'Parts SGST 3%',
297
+ ColRange: 1,
298
+ Rate: 'I3',
299
+ bold: true,
300
+ ChildHeadings: [],
301
+ });
302
+ this.MainHeadings.push({
303
+ text: 'Parts IGST 3%',
304
+ ColRange: 1,
305
+ Rate: 'I3',
306
+ bold: true,
307
+ ChildHeadings: [],
308
+ });
309
+ }
310
+ }
311
+ else if (item.Rate === 5) {
312
+ let Index = this.MainHeadings.findIndex((Header) => {
313
+ return Header.Rate === 'I5';
314
+ });
315
+ if (Index === -1) {
316
+ this.MainHeadings.push({
317
+ text: 'Taxable value spare sales @ 5%',
318
+ ColRange: 1,
319
+ Rate: 'I5',
320
+ field: 'Taxable5',
321
+ bold: true,
322
+ ChildHeadings: [],
323
+ });
324
+ this.MainHeadings.push({
325
+ text: 'Parts 5%',
326
+ ColRange: 1,
327
+ Rate: 'I5',
328
+ field: 5,
329
+ Parts: 'Parts',
330
+ bold: true,
331
+ ChildHeadings: [],
332
+ });
333
+ this.MainHeadings.push({
334
+ text: 'Parts CGST 5%',
335
+ ColRange: 1,
336
+ Rate: 'I5',
337
+ bold: true,
338
+ ChildHeadings: [],
339
+ });
340
+ this.MainHeadings.push({
341
+ text: 'Parts SGST 5%',
342
+ ColRange: 1,
343
+ Rate: 'I5',
344
+ bold: true,
345
+ ChildHeadings: [],
346
+ });
347
+ this.MainHeadings.push({
348
+ text: 'Parts IGST 5%',
349
+ ColRange: 1,
350
+ Rate: 'I5',
351
+ bold: true,
352
+ ChildHeadings: [],
353
+ });
354
+ }
355
+ }
356
+ else if (item.Rate === 12) {
357
+ let Index = this.MainHeadings.findIndex((Header) => {
358
+ return Header.Rate === 'I12';
359
+ });
360
+ if (Index === -1) {
361
+ this.MainHeadings.push({
362
+ text: 'Taxable value spare sales @ 12%',
363
+ ColRange: 1,
364
+ Rate: 'I12',
365
+ field: 'Taxable12',
366
+ bold: true,
367
+ ChildHeadings: [],
368
+ });
369
+ this.MainHeadings.push({
370
+ text: 'Parts 12%',
371
+ ColRange: 1,
372
+ Rate: 'I12',
373
+ field: 12,
374
+ Parts: 'Parts',
375
+ bold: true,
376
+ ChildHeadings: [],
377
+ });
378
+ this.MainHeadings.push({
379
+ text: 'Parts CGST 12%',
380
+ ColRange: 1,
381
+ Rate: 'I12',
382
+ bold: true,
383
+ ChildHeadings: [],
384
+ });
385
+ this.MainHeadings.push({
386
+ text: 'Parts SGST 12%',
387
+ ColRange: 1,
388
+ Rate: 'I12',
389
+ bold: true,
390
+ ChildHeadings: [],
391
+ });
392
+ this.MainHeadings.push({
393
+ text: 'Parts IGST 12%',
394
+ ColRange: 1,
395
+ Rate: 'I12',
396
+ bold: true,
397
+ ChildHeadings: [],
398
+ });
399
+ }
400
+ }
401
+ else if (item.Rate === 18) {
402
+ let Index = this.MainHeadings.findIndex((Header) => {
403
+ return Header.Rate === 'I18';
404
+ });
405
+ if (Index === -1) {
406
+ this.MainHeadings.push({
407
+ text: 'Taxable value spare sales @ 18%',
408
+ ColRange: 1,
409
+ Rate: 'I18',
410
+ field: 'Taxable18',
411
+ bold: true,
412
+ ChildHeadings: [],
413
+ });
414
+ this.MainHeadings.push({
415
+ text: 'Parts 18%',
416
+ ColRange: 1,
417
+ Rate: 'I18',
418
+ field: 18,
419
+ Parts: 'Parts',
420
+ bold: true,
421
+ ChildHeadings: [],
422
+ });
423
+ this.MainHeadings.push({
424
+ text: 'Parts CGST 18%',
425
+ ColRange: 1,
426
+ Rate: 'I18',
427
+ bold: true,
428
+ ChildHeadings: [],
429
+ });
430
+ this.MainHeadings.push({
431
+ text: 'Parts SGST 18%',
432
+ ColRange: 1,
433
+ Rate: 'I18',
434
+ bold: true,
435
+ ChildHeadings: [],
436
+ });
437
+ this.MainHeadings.push({
438
+ text: 'Parts IGST 18%',
439
+ ColRange: 1,
440
+ Rate: 'I18',
441
+ bold: true,
442
+ ChildHeadings: [],
443
+ });
444
+ }
445
+ }
446
+ else if (item.Rate === 28) {
447
+ let Index = this.MainHeadings.findIndex((Header) => {
448
+ return Header.Rate === 'I28';
449
+ });
450
+ if (Index === -1) {
451
+ this.MainHeadings.push({
452
+ text: 'Taxable value spare sales @ 28%',
453
+ ColRange: 1,
454
+ Rate: 'I28',
455
+ field: 'Taxable28',
456
+ bold: true,
457
+ ChildHeadings: [],
458
+ });
459
+ this.MainHeadings.push({
460
+ text: 'Parts 28%',
461
+ ColRange: 1,
462
+ Rate: 'I28',
463
+ bold: true,
464
+ field: 28,
465
+ Parts: 'Parts',
466
+ ChildHeadings: [],
467
+ });
468
+ this.MainHeadings.push({
469
+ text: 'Parts CGST 28%',
470
+ ColRange: 1,
471
+ Rate: 'I28',
472
+ bold: true,
473
+ ChildHeadings: [],
474
+ });
475
+ this.MainHeadings.push({
476
+ text: 'Parts SGST 28%',
477
+ ColRange: 1,
478
+ Rate: 'I28',
479
+ field: 28,
480
+ bold: true,
481
+ ChildHeadings: [],
482
+ });
483
+ this.MainHeadings.push({
484
+ text: 'Parts IGST 28%',
485
+ ColRange: 1,
486
+ Rate: 'I28',
487
+ field: 28,
488
+ bold: true,
489
+ ChildHeadings: [],
490
+ });
491
+ }
492
+ }
493
+ });
494
+ });
495
+ });
496
+ this.MainHeadings.push({
497
+ text: 'Labor Taxable Amt',
498
+ ColRange: 1,
499
+ field: 'LaborTaxable',
500
+ bold: true,
501
+ ChildHeadings: [],
502
+ });
503
+ MainData.forEach((InvoiceList) => {
504
+ InvoiceList.Invoices.forEach((invoice) => {
505
+ invoice.LaborArray.forEach((labor) => {
506
+ if (labor.Rate === 0.25) {
507
+ let Index = this.MainHeadings.findIndex((Header) => {
508
+ return Header.Rate === 'L0.25';
509
+ });
510
+ if (Index === -1) {
511
+ this.MainHeadings.push({
512
+ text: 'Labor 0.25%',
513
+ ColRange: 1,
514
+ bold: true,
515
+ field: 0.25,
516
+ Labor: 'Labor',
517
+ Rate: 'L0.25',
518
+ ChildHeadings: [],
519
+ });
520
+ this.MainHeadings.push({
521
+ text: 'Labor CGST 0.25%',
522
+ ColRange: 1,
523
+ Rate: 'L0.25',
524
+ bold: true,
525
+ ChildHeadings: [],
526
+ });
527
+ this.MainHeadings.push({
528
+ text: 'Labor SGST 0.25%',
529
+ ColRange: 1,
530
+ Rate: 'L0.25',
531
+ bold: true,
532
+ ChildHeadings: [],
533
+ });
534
+ this.MainHeadings.push({
535
+ text: 'Labor IGST 0.25%',
536
+ ColRange: 1,
537
+ Rate: 'L0.25',
538
+ bold: true,
539
+ ChildHeadings: [],
540
+ });
541
+ }
542
+ }
543
+ else if (labor.Rate === 3) {
544
+ let Index = this.MainHeadings.findIndex((Header) => {
545
+ return Header.Rate === 'L3';
546
+ });
547
+ if (Index === -1) {
548
+ this.MainHeadings.push({
549
+ text: 'Labor 3%',
550
+ ColRange: 1,
551
+ Rate: 'L3',
552
+ field: 3,
553
+ Labor: 'Labor',
554
+ bold: true,
555
+ ChildHeadings: [],
556
+ });
557
+ this.MainHeadings.push({
558
+ text: 'Labor CGST 3%',
559
+ ColRange: 1,
560
+ Rate: 'L3',
561
+ bold: true,
562
+ ChildHeadings: [],
563
+ });
564
+ this.MainHeadings.push({
565
+ text: 'Labor SGST 3%',
566
+ ColRange: 1,
567
+ Rate: 'L3',
568
+ bold: true,
569
+ ChildHeadings: [],
570
+ });
571
+ this.MainHeadings.push({
572
+ text: 'Labor IGST 3%',
573
+ ColRange: 1,
574
+ Rate: 'L3',
575
+ bold: true,
576
+ ChildHeadings: [],
577
+ });
578
+ }
579
+ }
580
+ else if (labor.Rate === 5) {
581
+ let Index = this.MainHeadings.findIndex((Header) => {
582
+ return Header.Rate === 'L5';
583
+ });
584
+ if (Index === -1) {
585
+ this.MainHeadings.push({
586
+ text: 'Labor 5%',
587
+ ColRange: 1,
588
+ bold: true,
589
+ field: 5,
590
+ Labor: 'Labor',
591
+ Rate: 'L5',
592
+ ChildHeadings: [],
593
+ });
594
+ this.MainHeadings.push({
595
+ text: 'Labor CGST 5%',
596
+ ColRange: 1,
597
+ Rate: 'L5',
598
+ bold: true,
599
+ ChildHeadings: [],
600
+ });
601
+ this.MainHeadings.push({
602
+ text: 'Labor SGST 5%',
603
+ ColRange: 1,
604
+ Rate: 'L5',
605
+ bold: true,
606
+ ChildHeadings: [],
607
+ });
608
+ this.MainHeadings.push({
609
+ text: 'Labor IGST 5%',
610
+ ColRange: 1,
611
+ Rate: 'L5',
612
+ bold: true,
613
+ ChildHeadings: [],
614
+ });
615
+ }
616
+ }
617
+ else if (labor.Rate === 12) {
618
+ let Index = this.MainHeadings.findIndex((Header) => {
619
+ return Header.Rate === 'L12';
620
+ });
621
+ if (Index === -1) {
622
+ this.MainHeadings.push({
623
+ text: 'Labor 12%',
624
+ ColRange: 1,
625
+ Rate: 'L12',
626
+ field: 12,
627
+ Labor: 'Labor',
628
+ bold: true,
629
+ ChildHeadings: [],
630
+ });
631
+ this.MainHeadings.push({
632
+ text: 'Labor CGST 12%',
633
+ ColRange: 1,
634
+ Rate: 'L12',
635
+ bold: true,
636
+ ChildHeadings: [],
637
+ });
638
+ this.MainHeadings.push({
639
+ text: 'Labor SGST 12%',
640
+ ColRange: 1,
641
+ Rate: 'L12',
642
+ bold: true,
643
+ ChildHeadings: [],
644
+ });
645
+ this.MainHeadings.push({
646
+ text: 'Labor IGST 12%',
647
+ ColRange: 1,
648
+ Rate: 'L12',
649
+ bold: true,
650
+ ChildHeadings: [],
651
+ });
652
+ }
653
+ }
654
+ else if (labor.Rate === 18) {
655
+ let Index = this.MainHeadings.findIndex((Header) => {
656
+ return Header.Rate === 'L18';
657
+ });
658
+ if (Index === -1) {
659
+ this.MainHeadings.push({
660
+ text: 'Labor 18%',
661
+ ColRange: 1,
662
+ Rate: 'L18',
663
+ field: 18,
664
+ Labor: 'Labor',
665
+ bold: true,
666
+ ChildHeadings: [],
667
+ });
668
+ this.MainHeadings.push({
669
+ text: 'Labor CGST 18%',
670
+ ColRange: 1,
671
+ Rate: 'L18',
672
+ bold: true,
673
+ ChildHeadings: [],
674
+ });
675
+ this.MainHeadings.push({
676
+ text: 'Labor SGST 18%',
677
+ ColRange: 1,
678
+ Rate: 'L18',
679
+ bold: true,
680
+ ChildHeadings: [],
681
+ });
682
+ this.MainHeadings.push({
683
+ text: 'Labor IGST 18%',
684
+ ColRange: 1,
685
+ Rate: 'L18',
686
+ bold: true,
687
+ ChildHeadings: [],
688
+ });
689
+ }
690
+ }
691
+ else if (labor.Rate === 28) {
692
+ let Index = this.MainHeadings.findIndex((Header) => {
693
+ return Header.Rate === 'L28';
694
+ });
695
+ if (Index === -1) {
696
+ this.MainHeadings.push({
697
+ text: 'Labor 28%',
698
+ ColRange: 1,
699
+ Rate: 'L28',
700
+ field: 28,
701
+ Labor: 'Labor',
702
+ bold: true,
703
+ ChildHeadings: [],
704
+ });
705
+ this.MainHeadings.push({
706
+ text: 'Labor CGST 28%',
707
+ ColRange: 1,
708
+ Rate: 'L28',
709
+ bold: true,
710
+ ChildHeadings: [],
711
+ });
712
+ this.MainHeadings.push({
713
+ text: 'Labor SGST 28%',
714
+ ColRange: 1,
715
+ Rate: 'L28',
716
+ bold: true,
717
+ ChildHeadings: [],
718
+ });
719
+ this.MainHeadings.push({
720
+ text: 'Labor IGST 28%',
721
+ ColRange: 1,
722
+ Rate: 'L28',
723
+ bold: true,
724
+ ChildHeadings: [],
725
+ });
726
+ }
727
+ }
728
+ });
729
+ });
730
+ });
731
+ this.MainHeadings.push({
732
+ text: 'Output CGST',
733
+ ColRange: 1,
734
+ field: 'CGSTAmt',
735
+ bold: true,
736
+ ChildHeadings: [],
737
+ });
738
+ this.MainHeadings.push({
739
+ text: 'Output SGST',
740
+ ColRange: 1,
741
+ field: 'SGSTAmt',
742
+ bold: true,
743
+ ChildHeadings: [],
744
+ });
745
+ this.MainHeadings.push({
746
+ text: 'Output IGST',
747
+ ColRange: 1,
748
+ field: 'IGSTAmt',
749
+ bold: true,
750
+ ChildHeadings: [],
751
+ });
752
+ this.MainHeadings.push({
753
+ text: 'Round off',
754
+ ColRange: 1,
755
+ field: 'Round',
756
+ bold: true,
757
+ ChildHeadings: [],
758
+ });
759
+ let MainColStart = 0;
760
+ this.MainHeadings.forEach((MainHeader) => {
761
+ this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
762
+ this.MergeArray.push({
763
+ s: { r: this.Row, c: MainColStart },
764
+ e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
765
+ });
766
+ MainColStart += MainHeader.ColRange;
767
+ });
768
+ this.Row += 2;
769
+ }
770
+ static setInvoiceDetailsInCell(MainData) {
771
+ let SNO = 0;
772
+ MainData.forEach((InvoiceList) => {
773
+ InvoiceList.Invoices.forEach((invoice, Index) => {
774
+ SNO = SNO + 1;
775
+ this.SetInvoiceDataInExcel(invoice, SNO);
776
+ });
777
+ });
778
+ }
779
+ static SetInvoiceDataInExcel(InvoiceInfo, Index) {
780
+ // console.log(InvoiceInfo);
781
+ InvoiceInfo.CrDate = this.ConvertDateToReadableFormat(InvoiceInfo.CrDate);
782
+ let InvoiceData = [];
783
+ this.MainHeadings.forEach((Header) => {
784
+ if (Header.field === 'SNo') {
785
+ InvoiceData.push({ text: Index, ColRange: 1, IsString: true });
786
+ }
787
+ else if (Header.field === 'Code' || Header.field === 'CrDate' || Header.field === 'Name'
788
+ || Header.field === 'GSTIN' || Header.field === 'Total' || Header.field === 'SubTotal' || Header.field === 'Round'
789
+ || Header.field === 'CGSTAmt' || Header.field === 'SGSTAmt' || Header.field === 'IGSTAmt') {
790
+ InvoiceData.push({ text: InvoiceInfo[Header.field], ColRange: 1, IsString: true });
791
+ }
792
+ else if (Header.Parts === 'Parts') {
793
+ let PIndex = InvoiceInfo.ItemsArray.findIndex((item) => {
794
+ return item.Rate === Header.field;
795
+ });
796
+ if (PIndex !== -1) {
797
+ let TaxResult = InvoiceInfo.ItemsArray[PIndex].CGST + InvoiceInfo.ItemsArray[PIndex].SGST + InvoiceInfo.ItemsArray[PIndex].IGST;
798
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].Taxable, ColRange: 1, IsString: true });
799
+ InvoiceData.push({ text: TaxResult, ColRange: 1, IsString: true });
800
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].CGST, ColRange: 1, IsString: true });
801
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].SGST, ColRange: 1, IsString: true });
802
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].IGST, ColRange: 1, IsString: true });
803
+ }
804
+ else {
805
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
806
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
807
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
808
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
809
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
810
+ }
811
+ }
812
+ else if (Header.Labor === 'Labor') {
813
+ let LIndex = InvoiceInfo.LaborArray.findIndex((labor) => {
814
+ return labor.Rate === Header.field;
815
+ });
816
+ if (LIndex !== -1) {
817
+ let TaxResult = InvoiceInfo.LaborArray[LIndex].CGST + InvoiceInfo.LaborArray[LIndex].SGST + InvoiceInfo.LaborArray[LIndex].IGST;
818
+ InvoiceData.push({ text: TaxResult, ColRange: 1, IsString: true });
819
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].CGST, ColRange: 1, IsString: true });
820
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].SGST, ColRange: 1, IsString: true });
821
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].IGST, ColRange: 1, IsString: true });
822
+ }
823
+ else {
824
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
825
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
826
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
827
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
828
+ }
829
+ }
830
+ else if (Header.field === 'LaborTaxable') {
831
+ let Taxable = 0;
832
+ InvoiceInfo.LaborArray.forEach((item) => {
833
+ Taxable = Taxable + item.Taxable;
834
+ });
835
+ InvoiceData.push({ text: Taxable, ColRange: 1, IsString: true });
836
+ }
837
+ else if (Header.field === 'Taxable') {
838
+ let Taxable = 0;
839
+ InvoiceInfo.ItemsArray.forEach((item) => {
840
+ Taxable = Taxable + item.Taxable;
841
+ });
842
+ InvoiceData.push({ text: Taxable, ColRange: 1, IsString: true });
843
+ }
844
+ });
845
+ let ColStart = 0;
846
+ InvoiceData.forEach((InvData) => {
847
+ InvData.text = this.ConvertToString(InvData.text, InvData.IsString);
848
+ this.SetDataInCell(InvData.text, ColStart, this.Row);
849
+ this.MergeArray.push({
850
+ s: { r: this.Row, c: ColStart },
851
+ e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
852
+ });
853
+ ColStart += InvData.ColRange;
854
+ });
855
+ this.Row += 1;
856
+ }
857
+ static ConvertToString(Text, IsString) {
858
+ if (IsString) {
859
+ if (Text == null) {
860
+ Text = '';
861
+ }
862
+ }
863
+ else {
864
+ if (Text == null) {
865
+ Text = 0;
866
+ }
867
+ }
868
+ if (typeof Text === 'number') {
869
+ return Number(tr_utils_1.TrUtils.FixedTo(Text));
870
+ }
871
+ else {
872
+ return Text;
873
+ }
874
+ }
875
+ static SetDataInCell(Data, ColRange, RowNum) {
876
+ var cell = { v: Data };
877
+ var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
878
+ if (this.range.e.c < ColRange) {
879
+ this.range.e.c = ColRange;
880
+ }
881
+ if (this.range.e.r < RowNum) {
882
+ this.range.e.r = RowNum;
883
+ }
884
+ cell = this.getcelltype(cell);
885
+ this.ws[cell_ref] = cell;
886
+ }
887
+ static getcelltype(cell) {
888
+ if (typeof cell.v === 'number')
889
+ cell.t = 'n';
890
+ else if (typeof cell.v === 'boolean')
891
+ cell.t = 'b';
892
+ else
893
+ cell.t = 's';
894
+ return cell;
895
+ }
896
+ static ConvertDateToReadableFormat(DateObject) {
897
+ if (!tr_utils_1.TrUtils.IsEmpty(DateObject)) {
898
+ let date = new Date(DateObject);
899
+ let Month;
900
+ let Day;
901
+ let MonthName = new Array();
902
+ MonthName[0] = 'Jan';
903
+ MonthName[1] = 'Feb';
904
+ MonthName[2] = 'Mar';
905
+ MonthName[3] = 'Apr';
906
+ MonthName[4] = 'May';
907
+ MonthName[5] = 'Jun';
908
+ MonthName[6] = 'Jul';
909
+ MonthName[7] = 'Aug';
910
+ MonthName[8] = 'Sept';
911
+ MonthName[9] = 'Oct';
912
+ MonthName[10] = 'Nov';
913
+ MonthName[11] = 'Dec';
914
+ Month = MonthName[date.getMonth()];
915
+ if (date.getDate() < 10) {
916
+ Day = '0' + date.getDate();
917
+ }
918
+ else {
919
+ Day = date.getDate();
920
+ }
921
+ date = Day + '-' + Month + '-' + date.getFullYear();
922
+ return date;
923
+ }
924
+ else {
925
+ return null;
926
+ }
927
+ }
928
+ }
929
+ exports.GSTROXlsxFileService = GSTROXlsxFileService;
930
+ GSTROXlsxFileService.wb = {};
931
+ GSTROXlsxFileService.Row = 2;
932
+ GSTROXlsxFileService.MergeArray = [];
933
+ GSTROXlsxFileService.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
934
+ GSTROXlsxFileService.ws = {};
935
+ GSTROXlsxFileService.MainHeadings = [];