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,909 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvoiceLandscapePdfService = 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 InvoiceLandscapePdfService {
9
+ constructor() {
10
+ this.FontSize = 8;
11
+ }
12
+ static GetInvoiceLandscapePrint(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
+ styles: shared_pdf_service_1.SharedPDFService.GetStyles()
36
+ };
37
+ return dd;
38
+ }
39
+ static GetFileName(ROPrintData) {
40
+ let fileName = ROPrintData.HeaderName;
41
+ if (!tr_utils_1.TrUtils.IsNull(ROPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
42
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
43
+ }
44
+ return fileName;
45
+ }
46
+ static GetAddress(Entity) {
47
+ return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
48
+ }
49
+ static GetHeaderInfo(InvoicePDFData) {
50
+ let TaxInfo = [];
51
+ if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
52
+ TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' });
53
+ }
54
+ // if (!TrUtils.IsEmpty(InvoicePDFData.Entity.PAN)) {
55
+ // TaxInfo.push({ text: 'PAN : ' + InvoicePDFData.Entity.PAN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' },
56
+ // );
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: ROPrintData === null || ROPrintData === void 0 ? void 0 : ROPrintData.HeaderName, 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
+ // console.log('balaraju');
399
+ let DummyOps = [];
400
+ if (Parts.length !== 0) {
401
+ // let dummypartadding1: any = {};
402
+ // dummypartadding1.SNo = '';
403
+ // dummypartadding1.Desc = 'Spare Parts';
404
+ // dummypartadding1.Qty = '';
405
+ // dummypartadding1.UnPr = '';
406
+ // dummypartadding1.LineTotal = '';
407
+ // Parts.unshift(dummypartadding1);
408
+ if (Parts.length <= 15) {
409
+ let Count = 18 - Parts.length;
410
+ for (let i = 0; i < Count; i++) {
411
+ Parts.push({});
412
+ }
413
+ }
414
+ else {
415
+ let Count = 58 - Parts.length;
416
+ for (let i = 0; i < Count; i++) {
417
+ Parts.push({});
418
+ }
419
+ }
420
+ }
421
+ let SNo = 1;
422
+ Parts.forEach((part) => {
423
+ // console.log('part', part);
424
+ var dataRow = [];
425
+ columns.forEach((column) => {
426
+ if ((!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]))
427
+ || (column.text === 'Line Total' || column.text === 'Expiry')) {
428
+ if (part[column.Field] === 'Spare Parts') {
429
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
430
+ }
431
+ else {
432
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
433
+ && tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
434
+ part[column.Field] = '';
435
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
436
+ }
437
+ else {
438
+ if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'Batch' || column.Field === 'ExDate' || column.Field === 'QtyAndUoM'
439
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
440
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
441
+ if (column.Field === 'Disc') {
442
+ if (column.type === 'percentage') {
443
+ if (!tr_utils_1.TrUtils.IsEmpty(part[column.Field])) {
444
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
445
+ }
446
+ else {
447
+ dataRow.push({ text: '', noWrap: true });
448
+ }
449
+ }
450
+ else {
451
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
452
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
453
+ }
454
+ else {
455
+ dataRow.push({ text: '', noWrap: true });
456
+ }
457
+ }
458
+ }
459
+ else {
460
+ if (column.Field === 'Batch') {
461
+ if (!tr_utils_1.TrUtils.IsNull(part[column.Field])) {
462
+ dataRow.push({ text: part[column.Field].BN, nowrap: true });
463
+ }
464
+ else {
465
+ dataRow.push({ text: '', noWrap: true });
466
+ }
467
+ }
468
+ else if (column.Field === 'ExDate') {
469
+ if (!tr_utils_1.TrUtils.IsNull(part['Batch'])) {
470
+ dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadableExDate(part['Batch'].ExDt), nowrap: true });
471
+ }
472
+ else {
473
+ dataRow.push({ text: '', noWrap: true });
474
+ }
475
+ }
476
+ else {
477
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
478
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
479
+ }
480
+ else {
481
+ dataRow.push({ text: '', noWrap: true });
482
+ }
483
+ }
484
+ }
485
+ }
486
+ else {
487
+ // dataRow.push(part[column.Field].toString());
488
+ if (tr_utils_1.TrUtils.IsNull(part[column.Field])) {
489
+ part[column.Field] = '';
490
+ }
491
+ if (column.Field === 'Desc') {
492
+ let DescData = [];
493
+ DescData.push(part[column.Field].toString());
494
+ if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
495
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
496
+ }
497
+ dataRow.push({ stack: DescData });
498
+ }
499
+ else {
500
+ dataRow.push({ text: part[column.Field].toString() });
501
+ }
502
+ }
503
+ }
504
+ }
505
+ }
506
+ else {
507
+ if (column.Field === 'SNo' && !tr_utils_1.TrUtils.IsNull(part.Desc)) {
508
+ part[column.Field] = SNo;
509
+ SNo = SNo + 1;
510
+ }
511
+ else {
512
+ part[column.Field] = '';
513
+ }
514
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
515
+ }
516
+ });
517
+ body.push(dataRow);
518
+ });
519
+ // if (Labor.length !== 0) {
520
+ // let dummypartadding1: any = {};
521
+ // dummypartadding1.SNo = '';
522
+ // dummypartadding1.Desc = 'Labor';
523
+ // dummypartadding1.Qty = '';
524
+ // dummypartadding1.UnPr = '';
525
+ // dummypartadding1.LineTotal = '';
526
+ // Labor.unshift(dummypartadding1);
527
+ // // DummyOps.unshift(dummypartadding1);
528
+ // }
529
+ // if (Body === 2) {
530
+ // for (let i = 0; i < Labor.length; i++) {
531
+ // Labor[i].UnPr = '';
532
+ // }
533
+ // }
534
+ // Labor.forEach((Ops: any) => {
535
+ // var dataRow: any = [];
536
+ // columns.forEach((column: any) => {
537
+ // if ((!TrUtils.IsFixedZero(Ops[column.Field]) && !TrUtils.IsNull(Ops[column.Field]))
538
+ // || (column.text === 'Line Total')) {
539
+ // if (Ops[column.Field] === 'Labor') {
540
+ // dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
541
+ // } else {
542
+ // if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
543
+ // && TrUtils.CheckInvalidSelect(Ops.TCode))) {
544
+ // Ops[column.Field] = '';
545
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
546
+ // } else {
547
+ // if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
548
+ // || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
549
+ // || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
550
+ // if (column.Field === 'Disc') {
551
+ // if (column.type === 'percentage') {
552
+ // if (Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
553
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
554
+ // } else {
555
+ // dataRow.push({ text: '', noWrap: true });
556
+ // }
557
+ // } else {
558
+ // if (!Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
559
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
560
+ // } else {
561
+ // dataRow.push({ text: '', noWrap: true });
562
+ // }
563
+ // }
564
+ // } else {
565
+ // if (!TrUtils.IsZero(Ops[column.Field])) {
566
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true });
567
+ // } else {
568
+ // dataRow.push({ text: '', noWrap: true });
569
+ // }
570
+ // }
571
+ // } else {
572
+ // dataRow.push(Ops[column.Field].toString());
573
+ // }
574
+ // }
575
+ // }
576
+ // } else {
577
+ // if (column.Field === 'SNo') {
578
+ // Ops[column.Field] = SNo;
579
+ // SNo = SNo + 1;
580
+ // } else {
581
+ // Ops[column.Field] = '';
582
+ // }
583
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
584
+ // }
585
+ // });
586
+ // body.push(dataRow);
587
+ // });
588
+ return body;
589
+ }
590
+ static GetWithOutDiscAndTaxFieldHeader(Parts, ShowTaxColumn, PrintPartNo, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
591
+ if (Parts.length !== 0) {
592
+ if (ShowTaxColumn) {
593
+ return this.TaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
594
+ }
595
+ else {
596
+ if (ConsolidateGST) {
597
+ return this.ConsolidateDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
598
+ }
599
+ else {
600
+ return this.NoTaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
601
+ }
602
+ }
603
+ }
604
+ else {
605
+ let a = '';
606
+ return a;
607
+ }
608
+ }
609
+ static TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) {
610
+ if (PrintPartNo) {
611
+ if (ShowIGST) {
612
+ if (ShowDiscountColumn) {
613
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 20, 35, 45];
614
+ }
615
+ else {
616
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 51];
617
+ }
618
+ }
619
+ else {
620
+ if (ShowDiscountColumn) {
621
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 34, 20, 32, 20, 32, 48];
622
+ }
623
+ else {
624
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 32, 20, 32, 54];
625
+ }
626
+ }
627
+ }
628
+ else {
629
+ if (ShowIGST) {
630
+ if (ShowDiscountColumn) {
631
+ return [24, '*', 35, 41, 35, 30, 25, 40, 20, 35, 20, 35, 41];
632
+ }
633
+ else {
634
+ return [24, '*', 35, 50, 35, 30, 25, 40, 20, 40, 50];
635
+ }
636
+ }
637
+ else {
638
+ if (ShowDiscountColumn) {
639
+ return [24, '*', 35, 45, 35, 30, 22, 40, 20, 34, 20, 35, 20, 35, 45];
640
+ }
641
+ else {
642
+ return [24, '*', 35, 50, 35, 30, 22, 40, 20, 35, 20, 35, 50];
643
+ }
644
+ }
645
+ }
646
+ }
647
+ static TaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
648
+ if (PrintPartNo) {
649
+ if (ShowIGST) {
650
+ return {
651
+ style: 'tableExample',
652
+ marginTop: -6,
653
+ table: {
654
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
655
+ // headerRows: 2,
656
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
657
+ },
658
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
659
+ };
660
+ }
661
+ else {
662
+ return {
663
+ style: 'tableExample',
664
+ marginTop: -6,
665
+ table: {
666
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
667
+ // headerRows: 2,
668
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
669
+ },
670
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
671
+ };
672
+ }
673
+ }
674
+ else {
675
+ if (ShowIGST) {
676
+ return {
677
+ style: 'tableExample',
678
+ marginTop: -6,
679
+ table: {
680
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
681
+ // headerRows: 2,
682
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
683
+ },
684
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
685
+ };
686
+ }
687
+ else {
688
+ return {
689
+ style: 'tableExample',
690
+ marginTop: -6,
691
+ table: {
692
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
693
+ // headerRows: 2,
694
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
695
+ },
696
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
697
+ };
698
+ }
699
+ }
700
+ }
701
+ static LayOutStyle() {
702
+ return {
703
+ hLineWidth: function (i, node) {
704
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0;
705
+ },
706
+ vLineWidth: function (i, node) {
707
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0.7;
708
+ },
709
+ hLineColor: function (i, node) {
710
+ let color;
711
+ if (i === 0 || i === node.table.body.length) {
712
+ color = 'black';
713
+ }
714
+ else {
715
+ if (i === 1) {
716
+ color = 'gray';
717
+ }
718
+ else {
719
+ color = 'lightgray';
720
+ }
721
+ }
722
+ return color;
723
+ },
724
+ vLineColor: function (i, node) {
725
+ let color;
726
+ if (i === 0 || i === node.table.widths.length) {
727
+ color = 'black';
728
+ }
729
+ else {
730
+ color = 'lightgray';
731
+ }
732
+ return color;
733
+ },
734
+ };
735
+ }
736
+ static ConsolidateDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
737
+ if (PrintPartNo) {
738
+ return {
739
+ style: 'tableExample',
740
+ marginTop: -6,
741
+ table: {
742
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
743
+ // headerRows: 1,
744
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
745
+ },
746
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
747
+ };
748
+ }
749
+ else {
750
+ return {
751
+ style: 'tableExample',
752
+ marginTop: -6,
753
+ table: {
754
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
755
+ // headerRows: 1,
756
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
757
+ },
758
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
759
+ };
760
+ }
761
+ }
762
+ static WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo) {
763
+ // console.log('ShowDiscountColumn', ShowDiscountColumn);
764
+ if (PrintPartNo) {
765
+ if (ShowDiscountColumn) {
766
+ return [24, 70, '*', 25, 60, 45, 45, 50];
767
+ }
768
+ else {
769
+ return [25, 70, '*', 35, 60, 80];
770
+ }
771
+ }
772
+ else {
773
+ if (ShowDiscountColumn) {
774
+ return [25, '*', 70, 70, 70, 70, 70];
775
+ }
776
+ else {
777
+ return [25, '*', 40, 60, 80];
778
+ }
779
+ }
780
+ }
781
+ static NoTaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
782
+ if (PrintPartNo) {
783
+ return {
784
+ style: 'tableExample',
785
+ marginTop: -6,
786
+ table: {
787
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
788
+ // headerRows: 1,
789
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
790
+ },
791
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
792
+ };
793
+ }
794
+ else {
795
+ return {
796
+ style: 'tableExample',
797
+ marginTop: -6,
798
+ table: {
799
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
800
+ // headerRows: 1,
801
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
802
+ },
803
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
804
+ };
805
+ }
806
+ }
807
+ static CommonTotalDetails(ROPrintData, index, numberofCopies) {
808
+ let CommonDetails = [
809
+ // SharedPDFService.GetFinalTotalDetails('0.00', '0.00', '0.00',
810
+ // '0.00', '0.00', '0.00', ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
811
+ // ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
812
+ // ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts,
813
+ // '0.00', ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For,
814
+ // ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal,
815
+ // ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
816
+ // TrUtils.isTaxable(ROPrintData.Settings.Tax), '0.00',
817
+ // ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, null),
818
+ this.TotalDetails(ROPrintData),
819
+ // SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts),
820
+ shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
821
+ // SharedPDFService.GetUnderLine(),
822
+ this.GetSignatures(ROPrintData.Entity.CName, ROPrintData.Type, ROPrintData.For),
823
+ ];
824
+ // if (ROPrintData.Type !== 'Invoice') {
825
+ // CommonDetails.splice(2, 0, SharedPDFService.GetUnderLine());
826
+ // }
827
+ if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
828
+ CommonDetails.push({ text: '', pageBreak: 'after' });
829
+ }
830
+ return CommonDetails;
831
+ }
832
+ static GetSignatures(CName, For, Type) {
833
+ return {
834
+ columns: [{
835
+ stack: [
836
+ this.CompanyName(CName),
837
+ { columns: [this.Authorizedsignature(), shared_pdf_service_1.SharedPDFService.SurveyorSignature(For, Type), this.CustomerSignature()] }
838
+ ]
839
+ }],
840
+ };
841
+ }
842
+ static CompanyName(CName) {
843
+ return {
844
+ style: 'forCompany1',
845
+ text: ['For ', { text: CName, bold: 'true' }],
846
+ };
847
+ }
848
+ static Authorizedsignature() {
849
+ return {
850
+ style: 'Sign1',
851
+ text: ['Authorized Signatory'],
852
+ };
853
+ }
854
+ static CustomerSignature() {
855
+ return {
856
+ style: 'Sign1',
857
+ text: ['Customer Signature'], marginLeft: 90
858
+ };
859
+ }
860
+ static TotalDetails(ROPrintData) {
861
+ let totalDisc;
862
+ let totalTax;
863
+ if (!ROPrintData.Consolidate) {
864
+ totalTax = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartITax));
865
+ if (tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax)) {
866
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartsDiscTotal));
867
+ }
868
+ else {
869
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartsDiscTotal) + Number(ROPrintData.FixedDisc));
870
+ }
871
+ }
872
+ return [
873
+ {
874
+ style: 'tableExample',
875
+ marginTop: -6,
876
+ table: {
877
+ widths: ['*', '*', '*'],
878
+ heights: [105, 105, 105],
879
+ body: [
880
+ [
881
+ shared_pdf_service_1.SharedPDFService.PartsTaxAmounts(ROPrintData.CustTaxGroupData, true, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn),
882
+ // SharedPDFService.GetTaxOnParts(ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
883
+ // ROPrintData.CustPartSGST, ROPrintData.ShowAccParts, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
884
+ // ROPrintData.ShowTaxColumn, ROPrintData.From),
885
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
886
+ {
887
+ 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)]
888
+ }
889
+ // SharedPDFService.GetCustomer(ROPrintData.Customer, ROPrintData.Type, ROPrintData.For,
890
+ // ROPrintData.Product, ROPrintData.Settings, 'Customer Name & Address', false)
891
+ // , SharedPDFService.GetVehicleDetails(ROPrintData.Type, ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
892
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.IsProforma, ROPrintData.Settings, false, ROPrintData.BL)
893
+ ],
894
+ ]
895
+ },
896
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
897
+ },
898
+ // this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
899
+ // SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
900
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
901
+ // ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
902
+ // ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, null, false, ROPrintData.BL),
903
+ // SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
904
+ // SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
905
+ // SharedPDFService.GetDisplayTable(),
906
+ ];
907
+ }
908
+ }
909
+ exports.InvoiceLandscapePdfService = InvoiceLandscapePdfService;