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,903 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DCLandscapePdfService = void 0;
4
+ const my_date_1 = require("../utils/my-date");
5
+ const tr_utils_1 = require("../utils/tr-utils");
6
+ const shared_pdf_service_1 = require("./shared-pdf.service");
7
+ const shared_print_service_1 = require("./shared-print.service");
8
+ class DCLandscapePdfService {
9
+ constructor() {
10
+ this.FontSize = 8;
11
+ }
12
+ static GetDeliveryChallanPrint(ROPrintData, numberofCopies) {
13
+ var contents = [];
14
+ if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
15
+ contents.push(this.CommonHeaderDetails(ROPrintData, null), this.PreparesparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, null, numberofCopies));
16
+ }
17
+ else {
18
+ numberofCopies.forEach((text, index) => {
19
+ contents.push(this.CommonHeaderDetails(ROPrintData, text), this.PreparesparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, index, numberofCopies));
20
+ });
21
+ }
22
+ var dd = {
23
+ info: {
24
+ title: this.GetFileName(ROPrintData),
25
+ },
26
+ background: function (currentPage, pageSize) {
27
+ return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
28
+ },
29
+ header: function (currentPage, pageCount) {
30
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
31
+ },
32
+ pageMargins: [10, 15, 10, 15],
33
+ pageOrientation: 'landscape',
34
+ content: contents,
35
+ // footer:footers,
36
+ // footer: {
37
+ // columns: this.CommonTotalDetails(ROPrintData, null, numberofCopies)
38
+ // },
39
+ styles: shared_pdf_service_1.SharedPDFService.GetStyles()
40
+ };
41
+ return dd;
42
+ }
43
+ static GetFileName(ROPrintData) {
44
+ let fileName = ROPrintData.HeaderName;
45
+ if (!tr_utils_1.TrUtils.IsNull(ROPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
46
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
47
+ }
48
+ return fileName;
49
+ }
50
+ static GetAddress(Entity) {
51
+ return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
52
+ }
53
+ static GetHeaderInfo(InvoicePDFData) {
54
+ let TaxInfo = [];
55
+ if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
56
+ TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' });
57
+ }
58
+ if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
59
+ TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' });
60
+ }
61
+ TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
62
+ return TaxInfo;
63
+ }
64
+ static GetBillofSupplyName(Settings) {
65
+ return { text: Settings.Tax === 'BS' ? 'Bill of Supply' : null, alignment: 'right', marginRight: 5, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
66
+ }
67
+ static CommonHeaderDetails(ROPrintData, text) {
68
+ return [
69
+ { text: 'DELIVERY CHALLAN', alignment: 'center', bold: true, fontSize: 10 },
70
+ { text: text, color: 'grey', alignment: 'right', width: 100, marginTop: (text !== null) ? -11 : 0, fontSize: 10 },
71
+ {
72
+ style: 'tableExample',
73
+ table: {
74
+ widths: ['*', '*', '*'],
75
+ body: [
76
+ [
77
+ {
78
+ stack: [
79
+ { text: ROPrintData.Entity.CName, alignment: 'center', bold: true, fontSize: 13 },
80
+ // this.GetAddresDetailsAndLogo(ROPrintData.Entity, ROPrintData.Image, ROPrintData.AColor, ROPrintData.HColor, text)
81
+ { text: this.GetAddress(ROPrintData.Entity), alignment: 'center', style: ['headerstyle'] },
82
+ {
83
+ stack: this.GetHeaderInfo(ROPrintData)
84
+ },
85
+ ]
86
+ },
87
+ shared_pdf_service_1.SharedPDFService.GetCustomer(ROPrintData.Customer, ROPrintData.Type, ROPrintData.For, ROPrintData.Product, ROPrintData.Settings, 'Customer Name & Address', false),
88
+ shared_pdf_service_1.SharedPDFService.GetVehicleDetails(ROPrintData.Type, ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate, ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.IsProforma, ROPrintData.Settings, false, ROPrintData.BL, null, null, null)
89
+ ],
90
+ ]
91
+ },
92
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
93
+ },
94
+ // this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
95
+ // SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
96
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
97
+ // ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
98
+ // ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, null, false, ROPrintData.BL),
99
+ // SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
100
+ // SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
101
+ // SharedPDFService.GetDisplayTable(),
102
+ ];
103
+ }
104
+ static MainHeading(CName, Entity, Image, HColor, CopyName) {
105
+ let headerstyle;
106
+ let MainHeaderStyle = shared_pdf_service_1.SharedPDFService.GetMainHeaderStyleForLeftAlignHeader(CName);
107
+ // if (Header === 1) {
108
+ headerstyle = 'header2';
109
+ // } else {
110
+ // headerstyle = 'temp2header';
111
+ // }
112
+ return shared_pdf_service_1.SharedPDFService.HeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName);
113
+ }
114
+ static GetAddresDetailsAndLogo(Entity, Image, AColor, HColor, text) {
115
+ let Details = [
116
+ {
117
+ stack: [
118
+ { columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
119
+ {
120
+ columns: [{
121
+ width: 150,
122
+ margin: [0, 0, 0, 5],
123
+ stack: shared_pdf_service_1.SharedPDFService.GetHeader(Entity, HColor),
124
+ color: AColor,
125
+ style: 'header'
126
+ },
127
+ shared_pdf_service_1.SharedPDFService.GetEntityDetails(Entity)]
128
+ }
129
+ ]
130
+ }
131
+ ];
132
+ if (!tr_utils_1.TrUtils.IsNull(Image)) {
133
+ // Details.unshift({ text: '', width: 120 });
134
+ if (Entity.CName.length < 28) {
135
+ Details[0].stack[0].columns.push({ text: '', width: 140 });
136
+ }
137
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
138
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
139
+ }
140
+ Details.unshift({ image: Image, width: 120, height: 80 });
141
+ }
142
+ else {
143
+ Details[0].stack[1].columns.unshift({ text: '', width: 130 });
144
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
145
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
146
+ }
147
+ }
148
+ return Details;
149
+ }
150
+ static GetMainHeaderDetails(Entity, HeaderName, Image, HColor, AColor, text) {
151
+ return [
152
+ // SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, text),
153
+ shared_pdf_service_1.SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
154
+ shared_pdf_service_1.SharedPDFService.GetPrintType(HeaderName),
155
+ shared_pdf_service_1.SharedPDFService.HeaderAfterLine()
156
+ ];
157
+ }
158
+ static PreparesparePartsTable(ROPrintData) {
159
+ let List = [];
160
+ if (ROPrintData.Entity.Body === 1) {
161
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
162
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
163
+ ROPrintData.PrintInfo[i].Text = '';
164
+ }
165
+ // List.push(ROPrintData.PrintInfo[i].Text,
166
+ // this.GetLaborPartsTableForView(ROPrintData.PrintInfo[i].Items)
167
+ // );
168
+ }
169
+ }
170
+ else {
171
+ if (ROPrintData.Entity.Body === 2) {
172
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
173
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
174
+ ROPrintData.PrintInfo[i].Text = '';
175
+ }
176
+ List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
177
+ }
178
+ }
179
+ else {
180
+ if (ROPrintData.Summary) {
181
+ // List.push('',
182
+ // this.GetLaborPartsTableForView(ROPrintData.Items)
183
+ // );
184
+ }
185
+ else {
186
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
187
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
188
+ ROPrintData.PrintInfo[i].Text = '';
189
+ }
190
+ List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
191
+ }
192
+ }
193
+ }
194
+ }
195
+ return List;
196
+ }
197
+ static WithOutDiscountFieldTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
198
+ if (Parts.length !== 0) {
199
+ if (PrintPartNo) {
200
+ return {
201
+ style: 'tableExample',
202
+ marginLeft: 20,
203
+ table: {
204
+ widths: [15, 67, 160, 25, 50, 60, 30, 53],
205
+ headerRows: 1,
206
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
207
+ },
208
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
209
+ };
210
+ }
211
+ else {
212
+ return {
213
+ style: 'tableExample',
214
+ marginLeft: 20,
215
+ table: {
216
+ widths: [15, 215, 25, 50, 60, 45, 60],
217
+ headerRows: 1,
218
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
219
+ },
220
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
221
+ };
222
+ }
223
+ }
224
+ else {
225
+ let a = '';
226
+ return a;
227
+ }
228
+ }
229
+ static GetWithOutDiscountFieldHeader1(permission, Body, ShowIGST, ShowDiscountColumn) {
230
+ let headersNames;
231
+ if (permission) {
232
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
233
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
234
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
235
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
236
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
237
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
238
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
239
+ { text: 'Offer Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
240
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center', },
241
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tabFleheader' }
242
+ ],
243
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
244
+ { text: '', Field: 'Desc', lineHeight: 0.5 }, { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
245
+ { text: '', Field: 'Batch', lineHeight: 0.5 }, { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
246
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'OfQty', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
247
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
248
+ ]
249
+ ];
250
+ let Count = 9;
251
+ if (ShowDiscountColumn) {
252
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
253
+ headersNames[0].splice(Count + 1, 0, {});
254
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
255
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
256
+ Count = 11;
257
+ }
258
+ if (ShowIGST) {
259
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
260
+ headersNames[0].splice(Count + 1, 0, {});
261
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
262
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
263
+ }
264
+ else {
265
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
266
+ headersNames[0].splice(Count + 1, 0, {});
267
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
268
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.7 });
269
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
270
+ headersNames[0].splice(Count + 3, 0, {});
271
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
272
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
273
+ }
274
+ }
275
+ else {
276
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
277
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
278
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
279
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
280
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
281
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
282
+ { text: 'Offer Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
283
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'center', lineHeight: 0.6 },
284
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
285
+ ],
286
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 },
287
+ { text: '', Field: 'Desc', lineHeight: 0.5 }, { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
288
+ { text: '', Field: 'Batch', lineHeight: 0.5 }, { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
289
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'OfQty', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
290
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
291
+ ]];
292
+ let Count = 8;
293
+ if (ShowDiscountColumn) {
294
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
295
+ headersNames[0].splice(Count + 1, 0, {});
296
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
297
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
298
+ Count = 10;
299
+ }
300
+ if (ShowIGST) {
301
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
302
+ headersNames[0].splice(Count + 1, 0, {});
303
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
304
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
305
+ }
306
+ else {
307
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
308
+ headersNames[0].splice(Count + 1, 0, {});
309
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
310
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.5 });
311
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
312
+ headersNames[0].splice(Count + 3, 0, {});
313
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
314
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
315
+ }
316
+ }
317
+ return headersNames;
318
+ }
319
+ static GetWithOutDiscountFieldHeader2(permission, Body, ShowDiscountColumn) {
320
+ let headersNames = [[
321
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
322
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
323
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
324
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
325
+ ],
326
+ [
327
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
328
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
329
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
330
+ ]];
331
+ if (permission) {
332
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
333
+ let MPN = { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
334
+ let sno1 = { text: '', Field: 'SNo', lineHeight: 0.5 };
335
+ let MPN1 = { text: '', Field: 'MPN', lineHeight: 0.5 };
336
+ headersNames[0].unshift(sno, MPN);
337
+ headersNames[1].unshift(sno1, MPN1);
338
+ if (ShowDiscountColumn) {
339
+ headersNames[0].splice(5, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
340
+ headersNames[0].splice(6, 0, {});
341
+ headersNames[1].splice(5, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
342
+ headersNames[1].splice(6, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
343
+ }
344
+ }
345
+ else {
346
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
347
+ let sno1 = { text: '', Field: 'SNo', lineHeight: 0.5 };
348
+ headersNames[0].unshift(sno);
349
+ headersNames[1].unshift(sno1);
350
+ if (ShowDiscountColumn) {
351
+ headersNames[0].splice(4, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
352
+ headersNames[0].splice(5, 0, {});
353
+ headersNames[1].splice(4, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
354
+ headersNames[1].splice(5, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
355
+ }
356
+ }
357
+ return headersNames;
358
+ }
359
+ static GetWithOutDiscountFieldHeader(permission, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
360
+ if (Body === 2) {
361
+ let headersNames = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
362
+ { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
363
+ { text: 'Unit Price', style: 'tableheader', Field: 'UnPr' },
364
+ { text: 'Labor Charges', style: 'tableheader', Field: 'Price' },
365
+ { text: 'Tax', style: 'tableheader', Field: 'TaxAmount' },
366
+ { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
367
+ if (permission) {
368
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
369
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
370
+ headersNames.unshift(sno, MPN);
371
+ }
372
+ else {
373
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
374
+ headersNames.unshift(sno);
375
+ }
376
+ return headersNames;
377
+ }
378
+ else {
379
+ if (ShowTaxColumn) {
380
+ return this.GetWithOutDiscountFieldHeader1(permission, Body, ShowIGST, ShowDiscountColumn);
381
+ }
382
+ else {
383
+ return this.GetWithOutDiscountFieldHeader2(permission, Body, ShowDiscountColumn);
384
+ }
385
+ }
386
+ }
387
+ static BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
388
+ var body = [];
389
+ let columns = this.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
390
+ // if (ShowTaxColumn) {
391
+ for (let i = 0; i < columns.length; i++) {
392
+ body.push(columns[i]);
393
+ }
394
+ columns = columns[1];
395
+ // } else {
396
+ // body.push(columns);
397
+ // }
398
+ let DummyOps = [];
399
+ if (Parts.length !== 0) {
400
+ // let dummypartadding1: any = {};
401
+ // dummypartadding1.SNo = '';
402
+ // dummypartadding1.Desc = 'Spare Parts';
403
+ // dummypartadding1.Qty = '';
404
+ // dummypartadding1.UnPr = '';
405
+ // dummypartadding1.LineTotal = '';
406
+ // Parts.unshift(dummypartadding1);
407
+ if (Parts.length <= 15) {
408
+ let Count = 18 - Parts.length;
409
+ for (let i = 0; i < Count; i++) {
410
+ Parts.push({});
411
+ }
412
+ }
413
+ else {
414
+ let Count = 58 - Parts.length;
415
+ for (let i = 0; i < Count; i++) {
416
+ Parts.push({});
417
+ }
418
+ }
419
+ }
420
+ let SNo = 1;
421
+ Parts.forEach((part) => {
422
+ var dataRow = [];
423
+ columns.forEach((column) => {
424
+ if ((!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]))
425
+ || (column.text === 'Line Total' || column.text === 'Expiry')) {
426
+ if (part[column.Field] === 'Spare Parts') {
427
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
428
+ }
429
+ else {
430
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
431
+ && tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
432
+ part[column.Field] = '';
433
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
434
+ }
435
+ else {
436
+ if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'Batch' || column.Field === 'ExDate' || column.Field === 'QtyAndUoM'
437
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
438
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
439
+ if (column.Field === 'Disc') {
440
+ if (column.type === 'percentage') {
441
+ if (!tr_utils_1.TrUtils.IsEmpty(part[column.Field])) {
442
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
443
+ }
444
+ else {
445
+ dataRow.push({ text: '', noWrap: true });
446
+ }
447
+ }
448
+ else {
449
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
450
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
451
+ }
452
+ else {
453
+ dataRow.push({ text: '', noWrap: true });
454
+ }
455
+ }
456
+ }
457
+ else {
458
+ if (column.Field === 'Batch') {
459
+ if (!tr_utils_1.TrUtils.IsNull(part[column.Field])) {
460
+ dataRow.push({ text: part[column.Field].BN, nowrap: true });
461
+ }
462
+ else {
463
+ dataRow.push({ text: '', noWrap: true });
464
+ }
465
+ }
466
+ else if (column.Field === 'ExDate') {
467
+ if (!tr_utils_1.TrUtils.IsNull(part['Batch'])) {
468
+ dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadableExDate(part['Batch'].ExDt), nowrap: true });
469
+ }
470
+ else {
471
+ dataRow.push({ text: '', noWrap: true });
472
+ }
473
+ }
474
+ else {
475
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
476
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
477
+ }
478
+ else {
479
+ dataRow.push({ text: '', noWrap: true });
480
+ }
481
+ }
482
+ }
483
+ }
484
+ else {
485
+ // dataRow.push(part[column.Field].toString());
486
+ if (column.Field === 'Desc') {
487
+ let DescData = [];
488
+ DescData.push(part[column.Field].toString());
489
+ if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
490
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
491
+ }
492
+ dataRow.push({ stack: DescData });
493
+ }
494
+ else {
495
+ dataRow.push({ text: part[column.Field].toString() });
496
+ }
497
+ }
498
+ }
499
+ }
500
+ }
501
+ else {
502
+ if (column.Field === 'SNo' && !tr_utils_1.TrUtils.IsNull(part.Desc)) {
503
+ part[column.Field] = SNo;
504
+ SNo = SNo + 1;
505
+ }
506
+ else {
507
+ part[column.Field] = '';
508
+ }
509
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
510
+ }
511
+ });
512
+ body.push(dataRow);
513
+ });
514
+ // if (Labor.length !== 0) {
515
+ // let dummypartadding1: any = {};
516
+ // dummypartadding1.SNo = '';
517
+ // dummypartadding1.Desc = 'Labor';
518
+ // dummypartadding1.Qty = '';
519
+ // dummypartadding1.UnPr = '';
520
+ // dummypartadding1.LineTotal = '';
521
+ // Labor.unshift(dummypartadding1);
522
+ // // DummyOps.unshift(dummypartadding1);
523
+ // }
524
+ // if (Body === 2) {
525
+ // for (let i = 0; i < Labor.length; i++) {
526
+ // Labor[i].UnPr = '';
527
+ // }
528
+ // }
529
+ // Labor.forEach((Ops: any) => {
530
+ // var dataRow: any = [];
531
+ // columns.forEach((column: any) => {
532
+ // if ((!TrUtils.IsFixedZero(Ops[column.Field]) && !TrUtils.IsNull(Ops[column.Field]))
533
+ // || (column.text === 'Line Total')) {
534
+ // if (Ops[column.Field] === 'Labor') {
535
+ // dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
536
+ // } else {
537
+ // if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
538
+ // && TrUtils.CheckInvalidSelect(Ops.TCode))) {
539
+ // Ops[column.Field] = '';
540
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
541
+ // } else {
542
+ // if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
543
+ // || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
544
+ // || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
545
+ // if (column.Field === 'Disc') {
546
+ // if (column.type === 'percentage') {
547
+ // if (Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
548
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
549
+ // } else {
550
+ // dataRow.push({ text: '', noWrap: true });
551
+ // }
552
+ // } else {
553
+ // if (!Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
554
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
555
+ // } else {
556
+ // dataRow.push({ text: '', noWrap: true });
557
+ // }
558
+ // }
559
+ // } else {
560
+ // if (!TrUtils.IsZero(Ops[column.Field])) {
561
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true });
562
+ // } else {
563
+ // dataRow.push({ text: '', noWrap: true });
564
+ // }
565
+ // }
566
+ // } else {
567
+ // dataRow.push(Ops[column.Field].toString());
568
+ // }
569
+ // }
570
+ // }
571
+ // } else {
572
+ // if (column.Field === 'SNo') {
573
+ // Ops[column.Field] = SNo;
574
+ // SNo = SNo + 1;
575
+ // } else {
576
+ // Ops[column.Field] = '';
577
+ // }
578
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
579
+ // }
580
+ // });
581
+ // body.push(dataRow);
582
+ // });
583
+ return body;
584
+ }
585
+ static GetWithOutDiscAndTaxFieldHeader(Parts, ShowTaxColumn, PrintPartNo, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
586
+ if (Parts.length !== 0) {
587
+ if (ShowTaxColumn) {
588
+ return this.TaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
589
+ }
590
+ else {
591
+ if (ConsolidateGST) {
592
+ return this.ConsolidateDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
593
+ }
594
+ else {
595
+ return this.NoTaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
596
+ }
597
+ }
598
+ }
599
+ else {
600
+ let a = '';
601
+ return a;
602
+ }
603
+ }
604
+ static TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) {
605
+ if (PrintPartNo) {
606
+ if (ShowIGST) {
607
+ if (ShowDiscountColumn) {
608
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 20, 35, 45];
609
+ }
610
+ else {
611
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 51];
612
+ }
613
+ }
614
+ else {
615
+ if (ShowDiscountColumn) {
616
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 34, 20, 32, 20, 32, 48];
617
+ }
618
+ else {
619
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 32, 20, 32, 54];
620
+ }
621
+ }
622
+ }
623
+ else {
624
+ if (ShowIGST) {
625
+ if (ShowDiscountColumn) {
626
+ return [24, '*', 35, 41, 35, 30, 25, 40, 20, 35, 20, 35, 41];
627
+ }
628
+ else {
629
+ return [24, '*', 35, 50, 35, 30, 25, 40, 20, 40, 50];
630
+ }
631
+ }
632
+ else {
633
+ if (ShowDiscountColumn) {
634
+ return [24, '*', 35, 45, 35, 30, 22, 40, 20, 34, 20, 35, 20, 35, 45];
635
+ }
636
+ else {
637
+ return [24, '*', 35, 50, 35, 30, 22, 40, 20, 35, 20, 35, 50];
638
+ }
639
+ }
640
+ }
641
+ }
642
+ static TaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
643
+ if (PrintPartNo) {
644
+ if (ShowIGST) {
645
+ return {
646
+ style: 'tableExample',
647
+ marginTop: -6,
648
+ table: {
649
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
650
+ // headerRows: 2,
651
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
652
+ },
653
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
654
+ };
655
+ }
656
+ else {
657
+ return {
658
+ style: 'tableExample',
659
+ marginTop: -6,
660
+ table: {
661
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
662
+ // headerRows: 2,
663
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
664
+ },
665
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
666
+ };
667
+ }
668
+ }
669
+ else {
670
+ if (ShowIGST) {
671
+ return {
672
+ style: 'tableExample',
673
+ marginTop: -6,
674
+ table: {
675
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
676
+ // headerRows: 2,
677
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
678
+ },
679
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
680
+ };
681
+ }
682
+ else {
683
+ return {
684
+ style: 'tableExample',
685
+ marginTop: -6,
686
+ table: {
687
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
688
+ // headerRows: 2,
689
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
690
+ },
691
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
692
+ };
693
+ }
694
+ }
695
+ }
696
+ static LayOutStyle() {
697
+ return {
698
+ hLineWidth: function (i, node) {
699
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0;
700
+ },
701
+ vLineWidth: function (i, node) {
702
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0.7;
703
+ },
704
+ hLineColor: function (i, node) {
705
+ let color;
706
+ if (i === 0 || i === node.table.body.length) {
707
+ color = 'black';
708
+ }
709
+ else {
710
+ if (i === 1) {
711
+ color = 'gray';
712
+ }
713
+ else {
714
+ color = 'lightgray';
715
+ }
716
+ }
717
+ return color;
718
+ },
719
+ vLineColor: function (i, node) {
720
+ let color;
721
+ if (i === 0 || i === node.table.widths.length) {
722
+ color = 'black';
723
+ }
724
+ else {
725
+ color = 'lightgray';
726
+ }
727
+ return color;
728
+ },
729
+ };
730
+ }
731
+ static ConsolidateDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
732
+ if (PrintPartNo) {
733
+ return {
734
+ style: 'tableExample',
735
+ marginTop: -6,
736
+ table: {
737
+ widths: [15, 70, 273, 25, 60, 80, 10, 40],
738
+ // headerRows: 1,
739
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
740
+ },
741
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
742
+ };
743
+ }
744
+ else {
745
+ return {
746
+ style: 'tableExample',
747
+ marginTop: -6,
748
+ table: {
749
+ widths: [20, 300, 50, 80, 80, 10, 40],
750
+ // headerRows: 1,
751
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
752
+ },
753
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
754
+ };
755
+ }
756
+ }
757
+ static WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo) {
758
+ if (PrintPartNo) {
759
+ if (ShowDiscountColumn) {
760
+ return [24, 70, '*', 25, 60, 45, 45, 50];
761
+ }
762
+ else {
763
+ return [25, 70, '*', 35, 60, 80];
764
+ }
765
+ }
766
+ else {
767
+ if (ShowDiscountColumn) {
768
+ return [25, '*', 70, 70, 70, 70, 70];
769
+ }
770
+ else {
771
+ return [25, '*', 40, 60, 80];
772
+ }
773
+ }
774
+ }
775
+ static NoTaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
776
+ if (PrintPartNo) {
777
+ return {
778
+ style: 'tableExample',
779
+ marginTop: -6,
780
+ table: {
781
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
782
+ // headerRows: 1,
783
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
784
+ },
785
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
786
+ };
787
+ }
788
+ else {
789
+ return {
790
+ style: 'tableExample',
791
+ marginTop: -6,
792
+ table: {
793
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
794
+ // headerRows: 1,
795
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
796
+ },
797
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
798
+ };
799
+ }
800
+ }
801
+ static CommonTotalDetails(ROPrintData, index, numberofCopies) {
802
+ let CommonDetails = [
803
+ // SharedPDFService.GetFinalTotalDetails('0.00', '0.00', '0.00',
804
+ // '0.00', '0.00', '0.00', ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
805
+ // ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
806
+ // ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts,
807
+ // '0.00', ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For,
808
+ // ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal,
809
+ // ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
810
+ // TrUtils.isTaxable(ROPrintData.Settings.Tax), '0.00',
811
+ // ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, null),
812
+ this.TotalDetails(ROPrintData),
813
+ // SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts),
814
+ shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
815
+ // SharedPDFService.GetUnderLine(),
816
+ this.GetSignatures(ROPrintData.Entity.CName, ROPrintData.Type, ROPrintData.For),
817
+ ];
818
+ // if (ROPrintData.Type !== 'Invoice') {
819
+ // CommonDetails.splice(2, 0, SharedPDFService.GetUnderLine());
820
+ // }
821
+ if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
822
+ CommonDetails.push({ text: '', pageBreak: 'after' });
823
+ }
824
+ return CommonDetails;
825
+ }
826
+ static GetSignatures(CName, For, Type) {
827
+ return {
828
+ columns: [{
829
+ stack: [
830
+ this.CompanyName(CName),
831
+ { columns: [this.Authorizedsignature(), shared_pdf_service_1.SharedPDFService.SurveyorSignature(For, Type), this.CustomerSignature()] }
832
+ ]
833
+ }],
834
+ };
835
+ }
836
+ static CompanyName(CName) {
837
+ return {
838
+ style: 'forCompany1',
839
+ text: ['For ', { text: CName, bold: 'true' }],
840
+ };
841
+ }
842
+ static Authorizedsignature() {
843
+ return {
844
+ style: 'Sign1',
845
+ text: ['Authorized Signatory'],
846
+ };
847
+ }
848
+ static CustomerSignature() {
849
+ return {
850
+ style: 'Sign1',
851
+ text: ['Customer Signature'], marginLeft: 90
852
+ };
853
+ }
854
+ static TotalDetails(ROPrintData) {
855
+ let totalDisc;
856
+ let totalTax;
857
+ if (!ROPrintData.Consolidate) {
858
+ totalTax = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartITax));
859
+ if (tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax)) {
860
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartsDiscTotal));
861
+ }
862
+ else {
863
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartsDiscTotal) + Number(ROPrintData.FixedDisc));
864
+ }
865
+ }
866
+ return [
867
+ {
868
+ style: 'tableExample',
869
+ marginTop: -6,
870
+ table: {
871
+ widths: ['*', '*', '*'],
872
+ heights: [105, 105, 105],
873
+ body: [
874
+ [
875
+ shared_pdf_service_1.SharedPDFService.PartsTaxAmounts(ROPrintData.CustTaxGroupData, true, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn),
876
+ // SharedPDFService.GetTaxOnParts(ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
877
+ // ROPrintData.CustPartSGST, ROPrintData.ShowAccParts, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
878
+ // ROPrintData.ShowTaxColumn, ROPrintData.From),
879
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
880
+ {
881
+ columns: [{ text: '', width: 175 }, shared_pdf_service_1.SharedPDFService.GrandTotal('0.00', ROPrintData.CustPartsTotalBeforeDisc, totalDisc, totalTax, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, null, ROPrintData.Consolidate, null)]
882
+ }
883
+ // SharedPDFService.GetCustomer(ROPrintData.Customer, ROPrintData.Type, ROPrintData.For,
884
+ // ROPrintData.Product, ROPrintData.Settings, 'Customer Name & Address', false)
885
+ // , SharedPDFService.GetVehicleDetails(ROPrintData.Type, ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
886
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.IsProforma, ROPrintData.Settings, false, ROPrintData.BL)
887
+ ],
888
+ ]
889
+ },
890
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
891
+ },
892
+ // this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
893
+ // SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
894
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
895
+ // ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
896
+ // ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, null, false, ROPrintData.BL),
897
+ // SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
898
+ // SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
899
+ // SharedPDFService.GetDisplayTable(),
900
+ ];
901
+ }
902
+ }
903
+ exports.DCLandscapePdfService = DCLandscapePdfService;