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.
Files changed (212) hide show
  1. package/README.md +1 -0
  2. package/dist/accounting/invoice/invoice-pdf/invoice-pdf.service.js +18 -45
  3. package/dist/accounting/invoice/reports/excel/analysis-excel.service.js +17 -7
  4. package/dist/accounting/invoice/reports/excel/category-wise-item-excel.service.js +17 -7
  5. package/dist/accounting/invoice/reports/excel/cust-wise-sales-details.js +17 -7
  6. package/dist/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.js +17 -7
  7. package/dist/accounting/invoice/reports/excel/invoice-wise-excel.service.js +17 -7
  8. package/dist/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.js +17 -7
  9. package/dist/accounting/invoice/reports/excel/items-wise-sales-excel.service.js +17 -7
  10. package/dist/accounting/invoice/reports/excel/manf-wise-sales-excel.service.js +17 -7
  11. package/dist/accounting/invoice/reports/excel/operator-wise-details.js +17 -7
  12. package/dist/accounting/invoice/reports/excel/operator-wise-summary.js +17 -7
  13. package/dist/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.js +17 -7
  14. package/dist/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.js +17 -7
  15. package/dist/accounting/invoice/reports/excel/sale-summary-excel.service.js +17 -7
  16. package/dist/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.js +17 -7
  17. package/dist/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.js +17 -7
  18. package/dist/accounting/invoice/reports/excel/scheduled-drugs-excel.service.js +17 -7
  19. package/dist/accounting/invoice/unified-invoice-pdf.service.d.ts +1 -1
  20. package/dist/accounting/payment-receive/reports/excel/cust-balance-excel.service.js +17 -7
  21. package/dist/accounting/payment-receive/reports/excel/payment-receive-excel.service.js +17 -7
  22. package/dist/common/reports/excel/product-without-owner-excel.service.js +17 -7
  23. package/dist/gst/excel/GSTR-RO-excel.service.js +17 -7
  24. package/dist/gst/excel/GSTR1-excel.service.js +17 -7
  25. package/dist/gst/excel/GSTR2-excel.service.js +17 -7
  26. package/dist/gst/excel/hsn-summary.js +17 -7
  27. package/dist/gst/excel/tally-sales-import.service.js +17 -7
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +6 -6
  30. package/dist/inventory/items/reports/excel/expiring-drugs-excel.service.js +17 -7
  31. package/dist/inventory/items/reports/excel/item-wise-mout-details.js +17 -7
  32. package/dist/inventory/items/reports/excel/item-wise-mout-summary.js +17 -7
  33. package/dist/inventory/items/reports/excel/spares-issue-excel.service.js +17 -7
  34. package/dist/inventory/items/reports/excel/stock-excel.service.js +17 -7
  35. package/dist/purchases/payment-made/reports/excel/payments-made-excel.service.js +17 -7
  36. package/dist/purchases/payment-made/reports/excel/ven-balance-excel.service.js +17 -7
  37. package/dist/services/reports/excel/insurance-expire-excel.service.js +17 -7
  38. package/dist/services/reports/excel/next-service-date-excel.service.js +17 -7
  39. package/dist/services/reports/excel/repair-orders-excel.service.js +17 -7
  40. package/dist/shared/table-section/pdf-table.header.d.ts +1 -1
  41. package/dist/shared/table-section/pdf-table.header.js +14 -2
  42. package/dist/shared/table-section/pdf-table.section.js +6 -13
  43. package/dist/{accounting/invoice/invoice-pdf.service.js → shared/transactions-pdf.service.js} +15 -15
  44. package/package.json +1 -1
  45. package/src/accounting/counter-sales/auto-sales-receipt-pdf.service.ts +569 -0
  46. package/src/accounting/counter-sales/pos-receipt-pdf.ts +577 -0
  47. package/src/accounting/counter-sales/sales-receipt-pdf.service.ts +628 -0
  48. package/src/accounting/counter-sales/sales-receipt-print.service.ts +506 -0
  49. package/src/accounting/credit-note/cn-print.service.ts +264 -0
  50. package/src/accounting/credit-note/credit-note-pdf.service.ts +602 -0
  51. package/src/accounting/credit-note/credit-note-totals.service.ts +424 -0
  52. package/src/accounting/debit-note/debit-note-pdf.service.ts +681 -0
  53. package/src/accounting/debit-note/debit-note-print.service.ts +276 -0
  54. package/src/accounting/debit-note/debit-note-totals.service.ts +361 -0
  55. package/src/accounting/invoice/hc-inv-pdf.service.ts +880 -0
  56. package/src/accounting/invoice/inv-pdf.service.ts +812 -0
  57. package/src/accounting/invoice/inv-print.service.ts +532 -0
  58. package/src/accounting/invoice/invoice-landscape-pdf.service.ts +947 -0
  59. package/src/accounting/invoice/invoice-letterhead-pdf.service.ts +813 -0
  60. package/src/accounting/invoice/invoice-pdf/invoice-pdf.service.ts +359 -0
  61. package/src/accounting/invoice/invoice-portrait-pdf.ts +972 -0
  62. package/src/accounting/invoice/invoice-print.service.ts +2906 -0
  63. package/src/accounting/invoice/invoice-total.service.ts +834 -0
  64. package/src/accounting/invoice/reports/excel/analysis-excel.service.ts +291 -0
  65. package/src/accounting/invoice/reports/excel/category-wise-item-excel.service.ts +267 -0
  66. package/src/accounting/invoice/reports/excel/cust-wise-sales-details.ts +321 -0
  67. package/src/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.ts +300 -0
  68. package/src/accounting/invoice/reports/excel/invoice-wise-excel.service.ts +859 -0
  69. package/src/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.ts +255 -0
  70. package/src/accounting/invoice/reports/excel/items-wise-sales-excel.service.ts +312 -0
  71. package/src/accounting/invoice/reports/excel/manf-wise-sales-excel.service.ts +273 -0
  72. package/src/accounting/invoice/reports/excel/operator-wise-details.ts +258 -0
  73. package/src/accounting/invoice/reports/excel/operator-wise-summary.ts +259 -0
  74. package/src/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.ts +230 -0
  75. package/src/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.ts +231 -0
  76. package/src/accounting/invoice/reports/excel/sale-summary-excel.service.ts +326 -0
  77. package/src/accounting/invoice/reports/excel/sales-by-service-details-excel.service.ts +0 -0
  78. package/src/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.ts +432 -0
  79. package/src/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.ts +373 -0
  80. package/src/accounting/invoice/reports/excel/scheduled-drugs-excel.service.ts +372 -0
  81. package/src/accounting/invoice/reports/pdf/analysis-pdf.service.ts +113 -0
  82. package/src/accounting/invoice/reports/pdf/category-wise-item-pdf.service.ts +107 -0
  83. package/src/accounting/invoice/reports/pdf/cust-wise-sales-details-pdf.service.ts +125 -0
  84. package/src/accounting/invoice/reports/pdf/cust-wise-sales-summary-pdf.service.ts +119 -0
  85. package/src/accounting/invoice/reports/pdf/item-wise-doctor-sale-pdf.service.ts +180 -0
  86. package/src/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.ts +193 -0
  87. package/src/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.ts +188 -0
  88. package/src/accounting/invoice/reports/pdf/operator-wise-details-pdf.service.ts +118 -0
  89. package/src/accounting/invoice/reports/pdf/operator-wise-summary-pdf.ts +116 -0
  90. package/src/accounting/invoice/reports/pdf/sales-by-service-pdf.service.ts +132 -0
  91. package/src/accounting/invoice/reports/pdf/scheduled-drug-pdf.service.ts +191 -0
  92. package/src/accounting/invoice/reports/pdf/scheduled-drug-summary-pdf.service.ts +202 -0
  93. package/src/accounting/invoice/shared-inv-pdf.service.ts +787 -0
  94. package/src/accounting/invoice/unified-invoice-pdf.service.ts +937 -0
  95. package/src/accounting/payment-receive/payment-pdf.service.ts +410 -0
  96. package/src/accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service.ts +470 -0
  97. package/src/accounting/payment-receive/receipt-print.service.ts +71 -0
  98. package/src/accounting/payment-receive/reports/excel/cust-balance-excel.service.ts +298 -0
  99. package/src/accounting/payment-receive/reports/excel/payment-receive-excel.service.ts +221 -0
  100. package/src/accounting/payment-receive/reports/pdf/customer-balances-pdf.service.ts +182 -0
  101. package/src/accounting/payment-receive/reports/pdf/payment-report-pdf.service.ts +116 -0
  102. package/src/aggregation/aggregation.ts +58 -0
  103. package/src/appointments/appointments/appointment-total.service.ts +298 -0
  104. package/src/appointments/consultations/consultation-fee-receipt.service.ts +407 -0
  105. package/src/appointments/consultations/consultation-full-pdf.service.ts +238 -0
  106. package/src/appointments/consultations/consultation-letterhead-pdf.service.ts +430 -0
  107. package/src/appointments/consultations/consultation-pdf.service.ts +417 -0
  108. package/src/common/reports/excel/product-without-owner-excel.service.ts +308 -0
  109. package/src/common/reports/pdf/product-without-owner-pdf.service.ts +146 -0
  110. package/src/enums/cache-enums.ts +33 -0
  111. package/src/enums/code-enums.ts +291 -0
  112. package/src/enums/country-enums.ts +9 -0
  113. package/src/enums/enums.ts +364 -0
  114. package/src/enums/industry-enums.ts +26 -0
  115. package/src/enums/treatment-enums.ts +9 -0
  116. package/src/gst/excel/GSTR-RO-excel.service.ts +926 -0
  117. package/src/gst/excel/GSTR1-excel.service.ts +313 -0
  118. package/src/gst/excel/GSTR2-excel.service.ts +314 -0
  119. package/src/gst/excel/hsn-summary.ts +314 -0
  120. package/src/gst/excel/tally-sales-import.service.ts +767 -0
  121. package/src/gst/pdf/hsn-summary-pdf.ts +176 -0
  122. package/src/index.ts +194 -0
  123. package/src/inventory/items/adjustment-pdf.service.ts +177 -0
  124. package/src/inventory/items/issue-parts-pdf.service.ts +795 -0
  125. package/src/inventory/items/item-bar-code-label-pdf.ts +194 -0
  126. package/src/inventory/items/item-detais-pdf.ts +141 -0
  127. package/src/inventory/items/item-price-for-pricelist.ts +368 -0
  128. package/src/inventory/items/reports/excel/expiring-drugs-excel.service.ts +290 -0
  129. package/src/inventory/items/reports/excel/item-wise-mout-details.ts +284 -0
  130. package/src/inventory/items/reports/excel/item-wise-mout-summary.ts +279 -0
  131. package/src/inventory/items/reports/excel/spares-issue-excel.service.ts +494 -0
  132. package/src/inventory/items/reports/excel/stock-excel.service.ts +319 -0
  133. package/src/inventory/items/reports/pdf/expiring-drugs-pdf.service.ts +172 -0
  134. package/src/inventory/items/reports/pdf/item-wise-mout-details-pdf.ts +122 -0
  135. package/src/inventory/items/reports/pdf/item-wise-mout-summary-pdf.ts +115 -0
  136. package/src/inventory/items/reports/pdf/reorder-point-pdf.service.ts +163 -0
  137. package/src/inventory/material-out/mout-pdf.service.ts +545 -0
  138. package/src/inventory/transfer-order/transfer-order-pdf.service.ts +154 -0
  139. package/src/purchases/bills/bill-pdf/bill-pdf.service.ts +211 -0
  140. package/src/purchases/bills/bill-pdf.service.ts +21 -0
  141. package/src/purchases/payment-made/reports/excel/payments-made-excel.service.ts +313 -0
  142. package/src/purchases/payment-made/reports/excel/ven-balance-excel.service.ts +307 -0
  143. package/src/purchases/payment-made/reports/pdf/vendor-balances-pdf.service.ts +114 -0
  144. package/src/purchases/purchase-order/po-totals.service.ts +343 -0
  145. package/src/purchases/purchase-order/purchase-order-pdf.service.ts +1016 -0
  146. package/src/purchases/purchase-order/purchase-order-print.service.ts +279 -0
  147. package/src/purchases/purchase-order/purchase-order-totals.service.ts +637 -0
  148. package/src/purchases/vendor-credit-note/vendor-credit-note-pdf.service.ts +1055 -0
  149. package/src/purchases/vendor-credit-note/vendor-credit-note-print.service.ts +145 -0
  150. package/src/purchases/vendor-credit-note/vendor-credit-note-totals.service.ts +399 -0
  151. package/src/purchases/vendor-debit-note/vendor-debit-note-pdf.service.ts +582 -0
  152. package/src/purchases/vendor-debit-note/vendor-debit-note-print.service.ts +295 -0
  153. package/src/purchases/vendor-debit-note/vendor-debit-note-totals.service.ts +377 -0
  154. package/src/sales/delivery-challan/dc-landscape-pdf.service.ts +922 -0
  155. package/src/sales/delivery-challan/dc-landscape-without-price-pdf.service.ts +869 -0
  156. package/src/sales/delivery-challan/dc-without-price-pdf.service.ts +505 -0
  157. package/src/sales/delivery-challan/delivery-challan-pdf.service.ts +461 -0
  158. package/src/sales/delivery-challan/delivery-challan-print.service.ts +229 -0
  159. package/src/sales/delivery-challan/delivery-challan-totals.ts +466 -0
  160. package/src/sales/sales/equipment-design-pdf.service.ts +153 -0
  161. package/src/sales/sales/pack-ship-pdf.service.ts +128 -0
  162. package/src/sales/sales/pack-ship-print.service.ts +198 -0
  163. package/src/sales/sales/sales-pdf.service.ts +658 -0
  164. package/src/sales/sales/sales-print.service.ts +376 -0
  165. package/src/sales/sales/sales-totals.service.ts +500 -0
  166. package/src/sales-receive/sales-receive-pdf.service.ts +602 -0
  167. package/src/sales-receive/sales-receive-print.service.ts +242 -0
  168. package/src/sales-receive/sales-receive-totals.service.ts +651 -0
  169. package/src/services/checklist-pdf.ts +151 -0
  170. package/src/services/checklists-pdf.ts +133 -0
  171. package/src/services/est.print-service.ts +1155 -0
  172. package/src/services/reports/excel/insurance-expire-excel.service.ts +292 -0
  173. package/src/services/reports/excel/next-service-date-excel.service.ts +317 -0
  174. package/src/services/reports/excel/repair-orders-excel.service.ts +249 -0
  175. package/src/services/reports/pdf/insurance-expire-pdf.service.ts +115 -0
  176. package/src/services/reports/pdf/next-service-date-pdf.service.ts +198 -0
  177. package/src/services/reports/pdf/repair-orders-pdf.service.ts +184 -0
  178. package/src/services/ro-pdf.service.ts +1917 -0
  179. package/src/services/ro-print-service.ts +881 -0
  180. package/src/services/ro-totals.service.ts +1314 -0
  181. package/src/services/separate-wo-print.service.ts +396 -0
  182. package/src/services/service-history-pdf.service.ts +145 -0
  183. package/src/services/service-price-for-pricelist.ts +649 -0
  184. package/src/services/technician-pdf.service.ts +234 -0
  185. package/src/services/technician-print.service.ts +95 -0
  186. package/src/shared/header-footer-section/pdf-header-footer.section.ts +519 -0
  187. package/src/shared/header-footer-section/pdf-shared.utils.ts +46 -0
  188. package/src/shared/math-operations.ts +208 -0
  189. package/src/shared/party-details-section/pdf-party-details.section.ts +602 -0
  190. package/src/shared/shared-pdf.service.ts +3042 -0
  191. package/src/shared/shared-print.service.ts +879 -0
  192. package/src/shared/table-section/pdf-table.config.ts +8 -0
  193. package/src/shared/table-section/pdf-table.header.ts +396 -0
  194. package/src/shared/table-section/pdf-table.row.ts +248 -0
  195. package/src/shared/table-section/pdf-table.section.ts +447 -0
  196. package/src/shared/totals-section/pdf-totals.section.ts +921 -0
  197. package/src/shared/transactions-pdf.service.ts +191 -0
  198. package/src/shared/util.ts +101 -0
  199. package/src/tasks/meetings/meeting-pdf.ts +410 -0
  200. package/src/tasks/tasks/task-pdf.service.ts +238 -0
  201. package/src/tasks/tasks/task-reports-pdf.service.ts +313 -0
  202. package/src/tax/index.ts +86 -0
  203. package/src/tax/tax-calculator.ts +1025 -0
  204. package/src/tax/tax.types.ts +535 -0
  205. package/src/transaction-calculations/discounts-distribution.ts +343 -0
  206. package/src/transaction-calculations/index.ts +3 -0
  207. package/src/transaction-calculations/total-calculation.ts +443 -0
  208. package/src/transaction-calculations/transaction-calculation-engine.ts +903 -0
  209. package/src/utils/my-date.ts +111 -0
  210. package/src/utils/tr-utils.ts +104 -0
  211. package/tsconfig.json +2 -2
  212. /package/dist/{accounting/invoice/invoice-pdf.service.d.ts → shared/transactions-pdf.service.d.ts} +0 -0
@@ -0,0 +1,926 @@
1
+ import * as XLSX from 'xlsx';
2
+ import { TrUtils } from '../../utils/tr-utils';
3
+
4
+ export class GSTROXlsxFileService {
5
+
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
+ static MainHeadings: any[] = [];
12
+
13
+ static GetGSTROExcelData(MainData: any, WOTypes: any, EntitySettings: any) {
14
+ this.wb = {};
15
+ this.ws = {};
16
+ this.Row = 0;
17
+ this.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
18
+ this.MergeArray = [];
19
+ let ws_name = 'GST RO';
20
+ this.wb.Sheets = {};
21
+ this.wb.Props = {};
22
+ this.wb.SSF = {};
23
+ this.wb.SheetNames = [];
24
+
25
+ MainData = this.GetTotals(MainData, WOTypes);
26
+
27
+ this.setHeadingInCell(MainData);
28
+
29
+ this.setInvoiceDetailsInCell(MainData, EntitySettings);
30
+
31
+ this.ws['!ref'] = XLSX.utils.encode_range(this.range);
32
+
33
+ this.ws['!merges'] = this.MergeArray;
34
+ 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 }
35
+ , { 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 }
36
+ , { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }];
37
+
38
+ this.wb.SheetNames.push(ws_name);
39
+
40
+ this.wb.Sheets[ws_name] = this.ws;
41
+
42
+ return this.wb;
43
+ }
44
+
45
+ static GetTotals(MainData: any, WOTypes: any) {
46
+ MainData.forEach((InvoiceInfo: any) => {
47
+ if (InvoiceInfo.VIN == null) {
48
+ InvoiceInfo.VIN = '';
49
+ }
50
+ if (InvoiceInfo.Name == null) {
51
+ InvoiceInfo.Name = '';
52
+ }
53
+ if (InvoiceInfo.TeNa == null) {
54
+ InvoiceInfo.TeNa = '';
55
+ }
56
+ if (InvoiceInfo.Type == null) {
57
+ InvoiceInfo.TypeName = '';
58
+ } else {
59
+ InvoiceInfo.TypeName = this.GetWOTypeName(InvoiceInfo.WOType, WOTypes);
60
+ }
61
+
62
+ InvoiceInfo.Invoices.forEach((invoice:any)=>{
63
+ let CGSTAmt:any=0;
64
+ let SGSTAmt:any=0;
65
+ let IGSTAmt:any=0;
66
+ invoice.ItemsArray.forEach((item:any)=>{
67
+ CGSTAmt=CGSTAmt+item.CGST;
68
+ SGSTAmt=SGSTAmt+item.SGST;
69
+ IGSTAmt=IGSTAmt+item.IGST;
70
+ });
71
+ invoice.LaborArray.forEach((item:any)=>{
72
+ CGSTAmt=CGSTAmt+item.CGST;
73
+ SGSTAmt=SGSTAmt+item.SGST;
74
+ IGSTAmt=IGSTAmt+item.IGST;
75
+ });
76
+ invoice.CGSTAmt=CGSTAmt;
77
+ invoice.SGSTAmt=SGSTAmt;
78
+ invoice.IGSTAmt=IGSTAmt;
79
+ });
80
+
81
+ // let CGST18: number = 0;
82
+ // let SGST18: number = 0;
83
+ // let CGST28: number = 0;
84
+ // let SGST28: number = 0;
85
+ // let Total18perc: number = 0;
86
+ // let Total18perctax: number = 0;
87
+ // let Total28perc: number = 0;
88
+ // let Total28perctax: number = 0;
89
+ // if(!TrUtils.IsNull(InvoiceInfo.Parts) && InvoiceInfo.Parts.length !==0){
90
+ // InvoiceInfo.Parts.forEach((item: any) => {
91
+ // if (item.TCode === 106) {
92
+ // Total18perc=Total18perc+TrUtils.SetValueToZeroIfNull(item.UnAmt);
93
+ // CGST18 = CGST18 + TrUtils.SetValueToZeroIfNull(item.CGST);
94
+ // SGST18 = SGST18 + TrUtils.SetValueToZeroIfNull(item.SGST);
95
+ // Total18perctax=Total18perctax+Total18perc+CGST18+SGST18;
96
+ // } else if (item.TCode === 107) {
97
+ // Total28perc=Total28perc+TrUtils.SetValueToZeroIfNull(item.UnAmt);
98
+ // CGST28 = CGST28 + TrUtils.SetValueToZeroIfNull(item.CGST);
99
+ // SGST28 = SGST28 + TrUtils.SetValueToZeroIfNull(item.SGST);
100
+ // Total28perctax=Total28perctax+Total28perc+CGST28+SGST28;
101
+ // }
102
+ // });
103
+ // }
104
+
105
+ // InvoiceInfo.Total18perctax = TrUtils.FixPriceValue(Total18perctax);
106
+ // InvoiceInfo.Total28perctax = TrUtils.FixPriceValue(Total28perctax);
107
+
108
+ // InvoiceInfo.Total18perc = TrUtils.FixPriceValue(Total18perc);
109
+ // InvoiceInfo.Total28perc = TrUtils.FixPriceValue(Total28perc);
110
+
111
+ // InvoiceInfo.Items18CGST = TrUtils.FixPriceValue(CGST18);
112
+ // InvoiceInfo.Items18SGST = TrUtils.FixPriceValue(SGST18);
113
+ // InvoiceInfo.Items28CGST = TrUtils.FixPriceValue(CGST28);
114
+ // InvoiceInfo.Items28SGST = TrUtils.FixPriceValue(SGST28);
115
+
116
+ // InvoiceInfo.TotalCGST = TrUtils.FixPriceValue(CGST18+CGST28);
117
+ // InvoiceInfo.TotalSGST = TrUtils.FixPriceValue(SGST18+SGST28);
118
+
119
+ // InvoiceInfo.Items18GST = TrUtils.FixPriceValue(CGST18+SGST18);
120
+ // InvoiceInfo.Items28GST = TrUtils.FixPriceValue(CGST28+SGST28);
121
+
122
+ InvoiceInfo.GSTAmount =
123
+ InvoiceInfo.ItemsCGST + InvoiceInfo.ItemsSGST + InvoiceInfo.ItemsIGST;
124
+ InvoiceInfo.TotalAmount = InvoiceInfo.GSTAmount + InvoiceInfo.ItemsNetAmt;
125
+
126
+ InvoiceInfo.OpsGSTAmount =
127
+ InvoiceInfo.OpsCGST + InvoiceInfo.OpsSGST + InvoiceInfo.OpsIGST;
128
+ InvoiceInfo.TotalOpsAmount =
129
+ InvoiceInfo.OpsGSTAmount + InvoiceInfo.OpsNetAmt;
130
+ });
131
+ return MainData;
132
+ }
133
+
134
+ static GetWOTypeName(Type: any, WOTypes: any) {
135
+ let Index: any = WOTypes.findIndex((wotype: any) => {
136
+ return Type === wotype._id;
137
+ });
138
+ if (Index !== -1) {
139
+ return WOTypes[Index].Name;
140
+ } else {
141
+ return '';
142
+ }
143
+ }
144
+
145
+ static setHeadingInCell(MainData: any) {
146
+
147
+ this.MainHeadings = [
148
+ {
149
+ text: 'SNo',
150
+ ColRange: 1,
151
+ field: 'SNo',
152
+ bold: true,
153
+ ChildHeadings: []
154
+ },
155
+
156
+ {
157
+ text: 'Invoice No',
158
+ ColRange: 1,
159
+ field: 'Code',
160
+ bold: true,
161
+ ChildHeadings: [
162
+ // { text: 'No', ColRange: 1 },
163
+ // { text: 'Date', ColRange: 1 },
164
+ // { text: 'InvoiceInfo Total', ColRange: 1 }
165
+ ],
166
+ },
167
+ {
168
+ text: 'Invoice Date',
169
+ ColRange: 1,
170
+ field: 'CrDate',
171
+ bold: true,
172
+ ChildHeadings: [],
173
+ },
174
+
175
+ {
176
+ text: 'Customer',
177
+ ColRange: 1,
178
+ field: 'Name',
179
+ bold: true,
180
+ ChildHeadings: [
181
+ // { text: 'Central Tax', ColRange: 1 },
182
+ // { text: 'State Tax', ColRange: 1 },
183
+ // { text: 'IGST Tax', ColRange: 1 },
184
+ ],
185
+ },
186
+ {
187
+ text: 'GSTIN',
188
+ ColRange: 1,
189
+ field: 'GSTIN',
190
+ bold: true,
191
+ ChildHeadings: [
192
+ // { text: 'Central Tax', ColRange: 1 },
193
+ // { text: 'State Tax', ColRange: 1 },
194
+ // { text: 'IGST Tax', ColRange: 1 },
195
+ ],
196
+ },
197
+
198
+ {
199
+ text: 'Total Amt',
200
+ ColRange: 1,
201
+ field: 'Total',
202
+ bold: true,
203
+ ChildHeadings: [],
204
+ },
205
+ {
206
+ text: 'Total Amount excluding GST',
207
+ ColRange: 1,
208
+ field: 'SubTotal',
209
+ bold: true,
210
+ ChildHeadings: [],
211
+ },
212
+ {
213
+ text: 'Parts Taxable Amt',
214
+ ColRange: 1,
215
+ field: 'Taxable',
216
+ bold: true,
217
+ ChildHeadings: [],
218
+ },
219
+ ];
220
+ MainData.forEach((InvoiceList: any) => {
221
+ InvoiceList.Invoices.forEach((invoice: any) => {
222
+ invoice.ItemsArray.forEach((item: any) => {
223
+ if (item.Rate === 0.25) {
224
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
225
+ return Header.Rate === 'I0.25'
226
+ });
227
+ if (Index === -1) {
228
+ this.MainHeadings.push({
229
+ text: 'Taxable value spare sales @ 0.25%',
230
+ ColRange: 1,
231
+ Rate: 'I0.25',
232
+ field: 'Taxable0.25',
233
+ bold: true,
234
+ ChildHeadings: [],
235
+ });
236
+ this.MainHeadings.push({
237
+ text: 'Parts 0.25%',
238
+ ColRange: 1,
239
+ Rate: 'I0.25',
240
+ field: 0.25,
241
+ Parts: 'Parts',
242
+ bold: true,
243
+ ChildHeadings: [],
244
+ });
245
+ this.MainHeadings.push({
246
+ text: 'Parts CGST 0.25%',
247
+ ColRange: 1,
248
+ Rate: 'I0.25',
249
+ field: 'CGST',
250
+ bold: true,
251
+ ChildHeadings: [],
252
+ });
253
+ this.MainHeadings.push({
254
+ text: 'Parts SGST 0.25%',
255
+ ColRange: 1,
256
+ Rate: 'I0.25',
257
+ field: 'SGST',
258
+ bold: true,
259
+ ChildHeadings: [],
260
+ });
261
+ this.MainHeadings.push({
262
+ text: 'Parts IGST 0.25%',
263
+ ColRange: 1,
264
+ Rate: 'I0.25',
265
+ field: 'IGST',
266
+ bold: true,
267
+ ChildHeadings: [],
268
+ });
269
+ }
270
+ } else if (item.Rate === 3) {
271
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
272
+ return Header.Rate === 'I3'
273
+ });
274
+ if (Index === -1) {
275
+ this.MainHeadings.push({
276
+ text: 'Taxable value spare sales @ 3%',
277
+ ColRange: 1,
278
+ Rate: 'I3',
279
+ field: 'Taxable3',
280
+ bold: true,
281
+ ChildHeadings: [],
282
+ });
283
+ this.MainHeadings.push({
284
+ text: 'Parts 3%',
285
+ ColRange: 1,
286
+ Rate: 'I3',
287
+ field: 3,
288
+ Parts: 'Parts',
289
+ bold: true,
290
+ ChildHeadings: [],
291
+ });
292
+ this.MainHeadings.push({
293
+ text: 'Parts CGST 3%',
294
+ ColRange: 1,
295
+ Rate: 'I3',
296
+ bold: true,
297
+ ChildHeadings: [],
298
+ });
299
+ this.MainHeadings.push({
300
+ text: 'Parts SGST 3%',
301
+ ColRange: 1,
302
+ Rate: 'I3',
303
+ bold: true,
304
+ ChildHeadings: [],
305
+ });
306
+ this.MainHeadings.push({
307
+ text: 'Parts IGST 3%',
308
+ ColRange: 1,
309
+ Rate: 'I3',
310
+ bold: true,
311
+ ChildHeadings: [],
312
+ });
313
+ }
314
+ } else if (item.Rate === 5) {
315
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
316
+ return Header.Rate === 'I5'
317
+ });
318
+ if (Index === -1) {
319
+ this.MainHeadings.push({
320
+ text: 'Taxable value spare sales @ 5%',
321
+ ColRange: 1,
322
+ Rate: 'I5',
323
+ field: 'Taxable5',
324
+ bold: true,
325
+ ChildHeadings: [],
326
+ });
327
+ this.MainHeadings.push({
328
+ text: 'Parts 5%',
329
+ ColRange: 1,
330
+ Rate: 'I5',
331
+ field: 5,
332
+ Parts: 'Parts',
333
+ bold: true,
334
+ ChildHeadings: [],
335
+ });
336
+ this.MainHeadings.push({
337
+ text: 'Parts CGST 5%',
338
+ ColRange: 1,
339
+ Rate: 'I5',
340
+ bold: true,
341
+ ChildHeadings: [],
342
+ });
343
+ this.MainHeadings.push({
344
+ text: 'Parts SGST 5%',
345
+ ColRange: 1,
346
+ Rate: 'I5',
347
+ bold: true,
348
+ ChildHeadings: [],
349
+ });
350
+ this.MainHeadings.push({
351
+ text: 'Parts IGST 5%',
352
+ ColRange: 1,
353
+ Rate: 'I5',
354
+ bold: true,
355
+ ChildHeadings: [],
356
+ });
357
+ }
358
+ } else if (item.Rate === 12) {
359
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
360
+ return Header.Rate === 'I12'
361
+ });
362
+ if (Index === -1) {
363
+ this.MainHeadings.push({
364
+ text: 'Taxable value spare sales @ 12%',
365
+ ColRange: 1,
366
+ Rate: 'I12',
367
+ field: 'Taxable12',
368
+ bold: true,
369
+ ChildHeadings: [],
370
+ });
371
+ this.MainHeadings.push({
372
+ text: 'Parts 12%',
373
+ ColRange: 1,
374
+ Rate: 'I12',
375
+ field: 12,
376
+ Parts: 'Parts',
377
+ bold: true,
378
+ ChildHeadings: [],
379
+ });
380
+ this.MainHeadings.push({
381
+ text: 'Parts CGST 12%',
382
+ ColRange: 1,
383
+ Rate: 'I12',
384
+ bold: true,
385
+ ChildHeadings: [],
386
+ });
387
+ this.MainHeadings.push({
388
+ text: 'Parts SGST 12%',
389
+ ColRange: 1,
390
+ Rate: 'I12',
391
+ bold: true,
392
+ ChildHeadings: [],
393
+ });
394
+ this.MainHeadings.push({
395
+ text: 'Parts IGST 12%',
396
+ ColRange: 1,
397
+ Rate: 'I12',
398
+ bold: true,
399
+ ChildHeadings: [],
400
+ });
401
+ }
402
+ } else if (item.Rate === 18) {
403
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
404
+ return Header.Rate === 'I18'
405
+ });
406
+ if (Index === -1) {
407
+ this.MainHeadings.push({
408
+ text: 'Taxable value spare sales @ 18%',
409
+ ColRange: 1,
410
+ Rate: 'I18',
411
+ field: 'Taxable18',
412
+ bold: true,
413
+ ChildHeadings: [],
414
+ });
415
+ this.MainHeadings.push({
416
+ text: 'Parts 18%',
417
+ ColRange: 1,
418
+ Rate: 'I18',
419
+ field: 18,
420
+ Parts: 'Parts',
421
+ bold: true,
422
+ ChildHeadings: [],
423
+ });
424
+ this.MainHeadings.push({
425
+ text: 'Parts CGST 18%',
426
+ ColRange: 1,
427
+ Rate: 'I18',
428
+ bold: true,
429
+ ChildHeadings: [],
430
+ });
431
+ this.MainHeadings.push({
432
+ text: 'Parts SGST 18%',
433
+ ColRange: 1,
434
+ Rate: 'I18',
435
+ bold: true,
436
+ ChildHeadings: [],
437
+ });
438
+ this.MainHeadings.push({
439
+ text: 'Parts IGST 18%',
440
+ ColRange: 1,
441
+ Rate: 'I18',
442
+ bold: true,
443
+ ChildHeadings: [],
444
+ });
445
+ }
446
+ } else if (item.Rate === 28) {
447
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
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: any) => {
504
+ InvoiceList.Invoices.forEach((invoice: any) => {
505
+ invoice.LaborArray.forEach((labor: any) => {
506
+
507
+ if (labor.Rate === 0.25) {
508
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
509
+ return Header.Rate === 'L0.25'
510
+ });
511
+ if (Index === -1) {
512
+ this.MainHeadings.push({
513
+ text: 'Labor 0.25%',
514
+ ColRange: 1,
515
+ bold: true,
516
+ field: 0.25,
517
+ Labor: 'Labor',
518
+ Rate: 'L0.25',
519
+ ChildHeadings: [],
520
+ });
521
+ this.MainHeadings.push({
522
+ text: 'Labor CGST 0.25%',
523
+ ColRange: 1,
524
+ Rate: 'L0.25',
525
+ bold: true,
526
+ ChildHeadings: [],
527
+ });
528
+ this.MainHeadings.push({
529
+ text: 'Labor SGST 0.25%',
530
+ ColRange: 1,
531
+ Rate: 'L0.25',
532
+ bold: true,
533
+ ChildHeadings: [],
534
+ });
535
+ this.MainHeadings.push({
536
+ text: 'Labor IGST 0.25%',
537
+ ColRange: 1,
538
+ Rate: 'L0.25',
539
+ bold: true,
540
+ ChildHeadings: [],
541
+ });
542
+ }
543
+
544
+ } else if (labor.Rate === 3) {
545
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
546
+ return Header.Rate === 'L3'
547
+ });
548
+ if (Index === -1) {
549
+ this.MainHeadings.push({
550
+ text: 'Labor 3%',
551
+ ColRange: 1,
552
+ Rate: 'L3',
553
+ field: 3,
554
+ Labor: 'Labor',
555
+ bold: true,
556
+ ChildHeadings: [],
557
+ });
558
+ this.MainHeadings.push({
559
+ text: 'Labor CGST 3%',
560
+ ColRange: 1,
561
+ Rate: 'L3',
562
+ bold: true,
563
+ ChildHeadings: [],
564
+ });
565
+ this.MainHeadings.push({
566
+ text: 'Labor SGST 3%',
567
+ ColRange: 1,
568
+ Rate: 'L3',
569
+ bold: true,
570
+ ChildHeadings: [],
571
+ });
572
+ this.MainHeadings.push({
573
+ text: 'Labor IGST 3%',
574
+ ColRange: 1,
575
+ Rate: 'L3',
576
+ bold: true,
577
+ ChildHeadings: [],
578
+ });
579
+ }
580
+ } else if (labor.Rate === 5) {
581
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
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
+ } else if (labor.Rate === 12) {
617
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
618
+ return Header.Rate === 'L12'
619
+ });
620
+ if (Index === -1) {
621
+ this.MainHeadings.push({
622
+ text: 'Labor 12%',
623
+ ColRange: 1,
624
+ Rate: 'L12',
625
+ field: 12,
626
+ Labor: 'Labor',
627
+ bold: true,
628
+ ChildHeadings: [],
629
+ });
630
+ this.MainHeadings.push({
631
+ text: 'Labor CGST 12%',
632
+ ColRange: 1,
633
+ Rate: 'L12',
634
+ bold: true,
635
+ ChildHeadings: [],
636
+ });
637
+ this.MainHeadings.push({
638
+ text: 'Labor SGST 12%',
639
+ ColRange: 1,
640
+ Rate: 'L12',
641
+ bold: true,
642
+ ChildHeadings: [],
643
+ });
644
+ this.MainHeadings.push({
645
+ text: 'Labor IGST 12%',
646
+ ColRange: 1,
647
+ Rate: 'L12',
648
+ bold: true,
649
+ ChildHeadings: [],
650
+ });
651
+ }
652
+ } else if (labor.Rate === 18) {
653
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
654
+ return Header.Rate === 'L18'
655
+ });
656
+ if (Index === -1) {
657
+ this.MainHeadings.push({
658
+ text: 'Labor 18%',
659
+ ColRange: 1,
660
+ Rate: 'L18',
661
+ field: 18,
662
+ Labor: 'Labor',
663
+ bold: true,
664
+ ChildHeadings: [],
665
+ });
666
+ this.MainHeadings.push({
667
+ text: 'Labor CGST 18%',
668
+ ColRange: 1,
669
+ Rate: 'L18',
670
+ bold: true,
671
+ ChildHeadings: [],
672
+ });
673
+ this.MainHeadings.push({
674
+ text: 'Labor SGST 18%',
675
+ ColRange: 1,
676
+ Rate: 'L18',
677
+ bold: true,
678
+ ChildHeadings: [],
679
+ });
680
+ this.MainHeadings.push({
681
+ text: 'Labor IGST 18%',
682
+ ColRange: 1,
683
+ Rate: 'L18',
684
+ bold: true,
685
+ ChildHeadings: [],
686
+ });
687
+ }
688
+ } else if (labor.Rate === 28) {
689
+ let Index: any = this.MainHeadings.findIndex((Header: any) => {
690
+ return Header.Rate === 'L28'
691
+ });
692
+ if (Index === -1) {
693
+ this.MainHeadings.push({
694
+ text: 'Labor 28%',
695
+ ColRange: 1,
696
+ Rate: 'L28',
697
+ field: 28,
698
+ Labor: 'Labor',
699
+ bold: true,
700
+ ChildHeadings: [],
701
+ });
702
+ this.MainHeadings.push({
703
+ text: 'Labor CGST 28%',
704
+ ColRange: 1,
705
+ Rate: 'L28',
706
+ bold: true,
707
+ ChildHeadings: [],
708
+ });
709
+ this.MainHeadings.push({
710
+ text: 'Labor SGST 28%',
711
+ ColRange: 1,
712
+ Rate: 'L28',
713
+ bold: true,
714
+ ChildHeadings: [],
715
+ });
716
+ this.MainHeadings.push({
717
+ text: 'Labor IGST 28%',
718
+ ColRange: 1,
719
+ Rate: 'L28',
720
+ bold: true,
721
+ ChildHeadings: [],
722
+ });
723
+ }
724
+ }
725
+ });
726
+ });
727
+ });
728
+ this.MainHeadings.push({
729
+ text: 'Output CGST',
730
+ ColRange: 1,
731
+ field: 'CGSTAmt',
732
+ bold: true,
733
+ ChildHeadings: [],
734
+ });
735
+ this.MainHeadings.push({
736
+ text: 'Output SGST',
737
+ ColRange: 1,
738
+ field: 'SGSTAmt',
739
+ bold: true,
740
+ ChildHeadings: [],
741
+ });
742
+ this.MainHeadings.push({
743
+ text: 'Output IGST',
744
+ ColRange: 1,
745
+ field: 'IGSTAmt',
746
+ bold: true,
747
+ ChildHeadings: [],
748
+ });
749
+ this.MainHeadings.push({
750
+ text: 'Round off',
751
+ ColRange: 1,
752
+ field: 'Round',
753
+ bold: true,
754
+ ChildHeadings: [],
755
+ });
756
+ let MainColStart: any = 0;
757
+ this.MainHeadings.forEach((MainHeader: any) => {
758
+ this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
759
+ this.MergeArray.push({
760
+ s: { r: this.Row, c: MainColStart },
761
+ e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
762
+ });
763
+ MainColStart += MainHeader.ColRange;
764
+ });
765
+
766
+ this.Row += 2;
767
+ }
768
+
769
+ static setInvoiceDetailsInCell(MainData: any, DecimalsNumber:number) {
770
+ let SNO: number = 0;
771
+ MainData.forEach((InvoiceList: any) => {
772
+ InvoiceList.Invoices.forEach((invoice: any, Index: any) => {
773
+ SNO = SNO + 1;
774
+ this.SetInvoiceDataInExcel(invoice, SNO, DecimalsNumber);
775
+ })
776
+ });
777
+ }
778
+
779
+ static SetInvoiceDataInExcel(InvoiceInfo: any, Index: any, DecimalsNumber:number) {
780
+ // console.log(InvoiceInfo);
781
+ InvoiceInfo.CrDate = this.ConvertDateToReadableFormat(InvoiceInfo.CrDate);
782
+ let InvoiceData: any = [];
783
+ this.MainHeadings.forEach((Header: any) => {
784
+ if (Header.field === 'SNo') {
785
+ InvoiceData.push({ text: Index, ColRange: 1, IsString: true });
786
+ } else if (Header.field === 'Code' || Header.field === 'CrDate' || Header.field === 'Name'
787
+ || Header.field === 'GSTIN' || Header.field === 'Total' || Header.field === 'SubTotal' || Header.field === 'Round'
788
+ || Header.field === 'CGSTAmt' || Header.field === 'SGSTAmt' || Header.field === 'IGSTAmt') {
789
+ InvoiceData.push({ text: InvoiceInfo[Header.field], ColRange: 1, IsString: true });
790
+ } else if (Header.Parts === 'Parts') {
791
+ let PIndex: any = InvoiceInfo.ItemsArray.findIndex((item: any) => {
792
+ return item.Rate === Header.field;
793
+ });
794
+ if (PIndex !== -1) {
795
+ let TaxResult: number = InvoiceInfo.ItemsArray[PIndex].CGST + InvoiceInfo.ItemsArray[PIndex].SGST + InvoiceInfo.ItemsArray[PIndex].IGST;
796
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].Taxable, ColRange: 1, IsString: true });
797
+ InvoiceData.push({ text: TaxResult, ColRange: 1, IsString: true });
798
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].CGST, ColRange: 1, IsString: true });
799
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].SGST, ColRange: 1, IsString: true });
800
+ InvoiceData.push({ text: InvoiceInfo.ItemsArray[PIndex].IGST, ColRange: 1, IsString: true });
801
+ } else {
802
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
803
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
804
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
805
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
806
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
807
+ }
808
+ } else if (Header.Labor === 'Labor') {
809
+ let LIndex: any = InvoiceInfo.LaborArray.findIndex((labor: any) => {
810
+ return labor.Rate === Header.field;
811
+ });
812
+
813
+ if (LIndex !== -1) {
814
+ let TaxResult: number = InvoiceInfo.LaborArray[LIndex].CGST + InvoiceInfo.LaborArray[LIndex].SGST + InvoiceInfo.LaborArray[LIndex].IGST;
815
+ InvoiceData.push({ text: TaxResult, ColRange: 1, IsString: true });
816
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].CGST, ColRange: 1, IsString: true });
817
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].SGST, ColRange: 1, IsString: true });
818
+ InvoiceData.push({ text: InvoiceInfo.LaborArray[LIndex].IGST, ColRange: 1, IsString: true });
819
+ } else {
820
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
821
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
822
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
823
+ InvoiceData.push({ text: '', ColRange: 1, IsString: true });
824
+ }
825
+ } else if(Header.field === 'LaborTaxable'){
826
+ let Taxable: number = 0;
827
+ InvoiceInfo.LaborArray.forEach((item: any) => {
828
+ Taxable = Taxable + item.Taxable;
829
+ });
830
+ InvoiceData.push({ text: Taxable, ColRange: 1, IsString: true });
831
+ }else if(Header.field === 'Taxable'){
832
+ let Taxable: number = 0;
833
+ InvoiceInfo.ItemsArray.forEach((item: any) => {
834
+ Taxable = Taxable + item.Taxable;
835
+ });
836
+ InvoiceData.push({ text: Taxable, ColRange: 1, IsString: true });
837
+ }
838
+ })
839
+
840
+ let ColStart: any = 0;
841
+ InvoiceData.forEach((InvData: any) => {
842
+ InvData.text = this.ConvertToString(InvData.text, InvData.IsString, DecimalsNumber);
843
+ this.SetDataInCell(InvData.text, ColStart, this.Row);
844
+ this.MergeArray.push({
845
+ s: { r: this.Row, c: ColStart },
846
+ e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
847
+ });
848
+ ColStart += InvData.ColRange;
849
+ });
850
+
851
+ this.Row += 1;
852
+ }
853
+
854
+ static ConvertToString(Text: any, IsString: any, DecimalsNumber: number) {
855
+ if (IsString) {
856
+ if (Text == null) {
857
+ Text = '';
858
+ }
859
+ } else {
860
+ if (Text == null) {
861
+ Text = 0;
862
+ }
863
+ }
864
+ if (typeof Text === 'number') {
865
+ return Number(TrUtils.FixedTo(Text, DecimalsNumber));
866
+ } else {
867
+ return Text;
868
+ }
869
+ }
870
+
871
+ static SetDataInCell(Data: any, ColRange: number, RowNum: any) {
872
+ var cell = { v: Data };
873
+ var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
874
+ if (this.range.e.c < ColRange) {
875
+ this.range.e.c = ColRange;
876
+ }
877
+ if (this.range.e.r < RowNum) {
878
+ this.range.e.r = RowNum;
879
+ }
880
+ cell = this.getcelltype(cell);
881
+ this.ws[cell_ref] = cell;
882
+ }
883
+
884
+ static getcelltype(cell: any) {
885
+ if (typeof cell.v === 'number') cell.t = 'n';
886
+ else if (typeof cell.v === 'boolean') cell.t = 'b';
887
+ else cell.t = 's';
888
+ return cell;
889
+ }
890
+
891
+ static ConvertDateToReadableFormat(DateObject: any) {
892
+ if (!TrUtils.IsEmpty(DateObject)) {
893
+ let date: any = new Date(DateObject);
894
+ let Month: any;
895
+ let Day: any;
896
+
897
+ let MonthName = new Array();
898
+ MonthName[0] = 'Jan';
899
+ MonthName[1] = 'Feb';
900
+ MonthName[2] = 'Mar';
901
+ MonthName[3] = 'Apr';
902
+ MonthName[4] = 'May';
903
+ MonthName[5] = 'Jun';
904
+ MonthName[6] = 'Jul';
905
+ MonthName[7] = 'Aug';
906
+ MonthName[8] = 'Sept';
907
+ MonthName[9] = 'Oct';
908
+ MonthName[10] = 'Nov';
909
+ MonthName[11] = 'Dec';
910
+
911
+ Month = MonthName[date.getMonth()];
912
+
913
+ if (date.getDate() < 10) {
914
+ Day = '0' + date.getDate();
915
+ } else {
916
+ Day = date.getDate();
917
+ }
918
+
919
+ date = Day + '-' + Month + '-' + date.getFullYear();
920
+ return date;
921
+ } else {
922
+ return null;
923
+ }
924
+ }
925
+
926
+ }