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,924 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PurchaseOrderPDFService = void 0;
4
+ const tr_utils_1 = require("../utils/tr-utils");
5
+ const shared_pdf_service_1 = require("./shared-pdf.service");
6
+ const shared_print_service_1 = require("./shared-print.service");
7
+ class PurchaseOrderPDFService {
8
+ static PurchaseOrder(ROPrintData) {
9
+ let dd = {
10
+ info: {
11
+ title: this.GetFileName(ROPrintData),
12
+ },
13
+ background: function (currentPage, pageSize) {
14
+ return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
15
+ },
16
+ header: function (currentPage, pageCount) {
17
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
18
+ },
19
+ pageMargins: [10, 15, 10, 15],
20
+ content: [
21
+ // SharedPDFService.MainHeading(ROPrintData.Entity.CName, ROPrintData.Entity.Header, ROPrintData.Image, ROPrintData.HColor, null),
22
+ shared_pdf_service_1.SharedPDFService.GetMainHeader(ROPrintData.Entity, ROPrintData.Image, ROPrintData.AColor, ROPrintData.HColor, null),
23
+ shared_pdf_service_1.SharedPDFService.GetPrintType(ROPrintData.HeaderName),
24
+ shared_pdf_service_1.SharedPDFService.HeaderAfterLine(),
25
+ this.GetVendorDetails(ROPrintData),
26
+ this.VendorDetailsAfterLine(),
27
+ this.GetDisplayTable(),
28
+ this.getPartsData(ROPrintData),
29
+ shared_pdf_service_1.SharedPDFService.GetUnderLine(),
30
+ this.GetPOTotalDetails(ROPrintData),
31
+ shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
32
+ shared_pdf_service_1.SharedPDFService.GetUnderLine(),
33
+ this.GetSignatures(ROPrintData.Entity.CName),
34
+ ],
35
+ styles: this.GetStyles()
36
+ };
37
+ return dd;
38
+ }
39
+ static GetFileName(ROPrintData) {
40
+ let fileName = ROPrintData.HeaderName;
41
+ return fileName;
42
+ }
43
+ static GetDisplayTable() {
44
+ return { text: '', fontSize: 10, bold: true, margin: [0, 0, 0, 5] };
45
+ }
46
+ static GetStyles() {
47
+ return {
48
+ temp2header: {
49
+ fontSize: 23,
50
+ bold: true,
51
+ alignment: 'left',
52
+ // margin: [0, 10, 0, 0],
53
+ },
54
+ header: {
55
+ fontSize: 26,
56
+ bold: true,
57
+ alignment: 'center',
58
+ // margin: [0, 10, 0, 0],
59
+ },
60
+ Cust_Adrs: {
61
+ fontSize: this.MediumFont,
62
+ lineHeight: 1.2,
63
+ },
64
+ WSHeader_Left: {
65
+ fontSize: 23,
66
+ bold: true,
67
+ alignment: 'left',
68
+ // margin: [0, 10, 0, 0],
69
+ },
70
+ WSHeader_Center: {
71
+ fontSize: 26,
72
+ bold: true,
73
+ alignment: 'center',
74
+ // margin: [0, 10, 0, 0],
75
+ },
76
+ ws_adrs_center: {
77
+ fontSize: this.MediumFont,
78
+ alignment: 'center',
79
+ },
80
+ ws_adrs_left: {
81
+ fontSize: this.MediumFont,
82
+ alignment: 'left',
83
+ },
84
+ table_data: {
85
+ margin: [0, 0.5, 0, 5],
86
+ fontSize: this.MediumFont
87
+ },
88
+ table_header: {
89
+ bold: true,
90
+ fontSize: this.LargeFont,
91
+ margin: [0, 1, 0, 5],
92
+ alignment: 'center'
93
+ },
94
+ vendor_font: {
95
+ fontSize: this.MediumFont,
96
+ margin: [0, 5, 0, 5],
97
+ },
98
+ PO_Status: {
99
+ fontSize: this.MediumFont,
100
+ lineHeight: 1.4,
101
+ margin: [10, 0, 0, 0],
102
+ },
103
+ po_status_font: {
104
+ fontSize: this.LargeFont,
105
+ // bold: true
106
+ },
107
+ totals_Styles: {
108
+ marginTop: 15,
109
+ lineHeight: 1.4,
110
+ fontSize: this.MediumFont,
111
+ margin: [15, 0, 0, 0],
112
+ },
113
+ total_margin: {
114
+ margin: [0, 5, 0, 0],
115
+ },
116
+ hed: {
117
+ fontSize: this.LargeFont,
118
+ bold: true
119
+ },
120
+ Receiptheader1: {
121
+ fontSize: 12,
122
+ bold: true,
123
+ alignment: 'center',
124
+ margin: [0, 0, 0, 3]
125
+ },
126
+ };
127
+ }
128
+ static MainHeading(CName, Header, Image, HColor, AColor) {
129
+ let headerstyle;
130
+ let MainHeaderStyle = this.GetMainHeaderStyleForLeftAlignHeader(CName);
131
+ if (Header === 1) {
132
+ headerstyle = 'WSHeader_Center';
133
+ }
134
+ else {
135
+ headerstyle = 'WSHeader_Left';
136
+ }
137
+ return [{ text: '' + CName + '', style: [headerstyle, MainHeaderStyle] }];
138
+ }
139
+ static GetMainHeaderStyleForLeftAlignHeader(WorkShopName) {
140
+ var wsname_fontSize;
141
+ if (tr_utils_1.TrUtils.IsNull(WorkShopName)) {
142
+ WorkShopName = '';
143
+ }
144
+ switch (true) {
145
+ case (WorkShopName.length < 30):
146
+ wsname_fontSize = 23;
147
+ break;
148
+ case (WorkShopName.length < 35):
149
+ wsname_fontSize = 20;
150
+ break;
151
+ case (WorkShopName.length < 50):
152
+ wsname_fontSize = 17;
153
+ break;
154
+ default:
155
+ wsname_fontSize = 14;
156
+ }
157
+ var WSHeaderFontSize = {
158
+ fontSize: wsname_fontSize,
159
+ bold: true,
160
+ };
161
+ return WSHeaderFontSize;
162
+ }
163
+ static GetHeader(Entity) {
164
+ let headerstyle;
165
+ if (Entity.Header === 1) {
166
+ headerstyle = 'ws_adrs_center';
167
+ }
168
+ else {
169
+ headerstyle = 'ws_adrs_left';
170
+ }
171
+ let SubHeader = [
172
+ { text: '' + Entity.Adrs1 + '', style: [headerstyle] },
173
+ { text: '' + Entity.City + this.GetPinCode(Entity.PIN) + ', ' + 'Ph: ' + Entity.Phone, style: headerstyle },
174
+ { text: '' + this.GetEmailName(Entity.Email) + '', style: headerstyle }
175
+ ];
176
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.Adrs2)) {
177
+ SubHeader.splice(1, 0, { text: '' + Entity.Adrs2 + '', style: [headerstyle] });
178
+ }
179
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.TLine)) {
180
+ SubHeader.unshift({ text: this.GetTagLine(Entity.TLine), fontSize: 10, bold: true, margin: [0, 0, 0, 2] });
181
+ }
182
+ return SubHeader;
183
+ }
184
+ static GetEntityDetails(Entity) {
185
+ return {
186
+ lineHeight: 0.7,
187
+ columns: [this.GetEntityTaxDetails(Entity)
188
+ ]
189
+ };
190
+ }
191
+ static GetTagLine(TLine) {
192
+ if (tr_utils_1.TrUtils.IsEmpty(TLine)) {
193
+ TLine = '';
194
+ }
195
+ return TLine;
196
+ }
197
+ static GetEmailName(email) {
198
+ let Email = '';
199
+ if (!tr_utils_1.TrUtils.IsNull(email)) {
200
+ Email = 'Email: ' + email;
201
+ }
202
+ return Email;
203
+ }
204
+ static GetPinCode(pin) {
205
+ let code = '';
206
+ if (!tr_utils_1.TrUtils.IsNull(pin)) {
207
+ code = ' - ' + pin;
208
+ }
209
+ return code;
210
+ }
211
+ static GetEntityTaxDetails(Entity) {
212
+ let EntityData = [];
213
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.GSTIN)) {
214
+ EntityData.push({ name: 'GSTIN', value: Entity.GSTIN });
215
+ }
216
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.PAN)) {
217
+ EntityData.push({ name: 'PAN No', value: Entity.PAN });
218
+ }
219
+ if (EntityData.length !== 0) {
220
+ return this.GetEntityeDataTable(EntityData);
221
+ }
222
+ else {
223
+ return shared_pdf_service_1.SharedPDFService.emptyObject();
224
+ }
225
+ }
226
+ static GetEntityeDataTable(EntityFields) {
227
+ return {
228
+ lineHeight: 0.7,
229
+ marginLeft: 25,
230
+ fontSize: this.SmallFont,
231
+ table: {
232
+ body: [
233
+ [{
234
+ table: {
235
+ fontSize: this.SmallFont,
236
+ widths: [37, 'auto', '*'],
237
+ body: this.DataCreateForTable(EntityFields)
238
+ },
239
+ layout: 'noBorders',
240
+ }]
241
+ ]
242
+ },
243
+ layout: 'noBorders',
244
+ };
245
+ }
246
+ static DataCreateForTable(EntityFields) {
247
+ var body = [];
248
+ EntityFields.forEach((row) => {
249
+ if (!tr_utils_1.TrUtils.IsFixedZero(row.value) && !tr_utils_1.TrUtils.IsEmpty(row.value)) {
250
+ var dataRow = [];
251
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
252
+ dataRow.push(':');
253
+ dataRow.push({ text: (row.value).toString(), noWrap: true });
254
+ body.push(dataRow);
255
+ }
256
+ });
257
+ return body;
258
+ }
259
+ static GetVendorDetails(PurchaseOrder) {
260
+ return {
261
+ style: 'vendor_font',
262
+ columns: [
263
+ { stack: [this.GetVendorData(PurchaseOrder.Vendor, PurchaseOrder.Type)], width: 120 }, { text: '', width: 250 },
264
+ this.GetVehicle(PurchaseOrder)
265
+ ],
266
+ // columnGap: 150
267
+ };
268
+ }
269
+ static GetVehicle(PurchaseOrder) {
270
+ return {
271
+ style: 'PO_Status',
272
+ lineHeight: 0.7,
273
+ columns: [
274
+ {
275
+ table: {
276
+ fontSize: 6,
277
+ widths: [37, 'auto', '*'],
278
+ body: [[{ text: 'ID', alignment: 'right', style: 'po_status_font' }, { text: ':', style: 'po_status_font' }, PurchaseOrder.Id],
279
+ [{ text: 'Date', alignment: 'right', style: 'po_status_font' }, { text: ':', style: 'po_status_font' }, PurchaseOrder.CrDate],
280
+ // [{ text: 'Status', alignment: 'right', style: 'po_status_font' }, { text: ':', style: 'po_status_font' }, PurchaseOrder.Status]
281
+ ]
282
+ },
283
+ layout: 'noBorders',
284
+ },
285
+ ]
286
+ };
287
+ }
288
+ static GetVendorData(Vendor, Type) {
289
+ if (tr_utils_1.TrUtils.IsNull(Vendor)) {
290
+ return shared_pdf_service_1.SharedPDFService.emptyObject();
291
+ }
292
+ return {
293
+ style: 'Cust_Adrs',
294
+ stack: [{ text: 'Vendor Name & Address:', style: 'hed' },
295
+ { text: Vendor.Name, marginTop: 2 },
296
+ { text: this.GetAddress(Vendor), marginTop: 3 },
297
+ this.GetVendorPhoneNumber(Vendor, Type), this.GetVendorGSTIN(Vendor)
298
+ ]
299
+ };
300
+ }
301
+ static GetAddress(Vendor) {
302
+ var Address = this.GetFormatAddress(Vendor);
303
+ if (Address.length !== 5) {
304
+ return Address;
305
+ }
306
+ else {
307
+ let a = '';
308
+ return a;
309
+ }
310
+ }
311
+ static GetFormatContact(CustomerObj) {
312
+ var contactnew = '';
313
+ CustomerObj.Contact.forEach((Contact) => {
314
+ contactnew = contactnew + '(' + Contact.Type + '):' + Contact.No + '\n';
315
+ });
316
+ return contactnew;
317
+ }
318
+ static GetFormatAddress(CustomerObj) {
319
+ var Addressnew = '';
320
+ if (!tr_utils_1.TrUtils.IsNull(CustomerObj) && !tr_utils_1.TrUtils.IsNull(CustomerObj.Address)) {
321
+ CustomerObj.Address.forEach((Adrs) => {
322
+ Addressnew = Addressnew + Adrs + '\n';
323
+ });
324
+ }
325
+ return Addressnew;
326
+ }
327
+ static GetVendorGSTIN(Vendor) {
328
+ let GSTIN = {};
329
+ if (!tr_utils_1.TrUtils.IsEmpty(Vendor.GSTIN)) {
330
+ let columns = [];
331
+ columns.push({ text: 'GSTIN :', width: 33, style: 'hed' });
332
+ columns.push({ text: Vendor.GSTIN, marginTop: 1.5 });
333
+ GSTIN.columns = columns;
334
+ return GSTIN;
335
+ }
336
+ else {
337
+ return GSTIN;
338
+ }
339
+ }
340
+ static GetVendorPhoneNumber(Vendor, Type) {
341
+ let PhoneNumber = {};
342
+ if (Type !== 'Technician Copy') {
343
+ var contact = this.GetFormatContact(Vendor);
344
+ if (contact.length !== 0) {
345
+ let columns = [];
346
+ columns.push({ text: 'Phone', width: 27, style: 'hed' });
347
+ columns.push(contact);
348
+ PhoneNumber.columns = columns;
349
+ return PhoneNumber;
350
+ }
351
+ else {
352
+ return PhoneNumber;
353
+ }
354
+ }
355
+ else {
356
+ return PhoneNumber;
357
+ }
358
+ }
359
+ static VendorDetailsAfterLine() {
360
+ return {
361
+ canvas: [
362
+ {
363
+ type: 'line',
364
+ lineColor: 'black',
365
+ x1: 0,
366
+ y1: 0,
367
+ x2: 575,
368
+ y2: 0,
369
+ lineWidth: 1
370
+ }
371
+ ]
372
+ };
373
+ }
374
+ static getPartsData(ROPrintData) {
375
+ if (ROPrintData.Entity.Body === 1) {
376
+ return this.GetPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.Items), ROPrintData.Entity.MPN);
377
+ }
378
+ else {
379
+ if (ROPrintData.Entity.Body === 2) {
380
+ return this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.Items), ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ShowDiscountColumn);
381
+ }
382
+ else {
383
+ return this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.Items), ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ShowDiscountColumn);
384
+ }
385
+ }
386
+ }
387
+ static GetWithOutDiscAndTaxFieldHeader(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
388
+ if (Items.length !== 0) {
389
+ if (ShowTaxColumn) {
390
+ return this.TaxDataTable(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
391
+ }
392
+ else {
393
+ return this.WithOutTaxDataTable(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
394
+ }
395
+ }
396
+ else {
397
+ let a = '';
398
+ return a;
399
+ }
400
+ }
401
+ static TaxDataTable(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
402
+ if (PrintPartNo) {
403
+ return this.TaxDataTableWithPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
404
+ }
405
+ else {
406
+ return this.TaxDataTableWithOutPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
407
+ }
408
+ }
409
+ static TaxDataTableWithPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
410
+ if (ShowIGST) {
411
+ return this.IGSTTaxDataTableWithPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
412
+ }
413
+ else {
414
+ return this.CGSTAndSGSTTaxDataTableWithPartNUmber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
415
+ }
416
+ }
417
+ static IGSTTaxDataTableWithPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
418
+ return {
419
+ style: 'table_data',
420
+ table: {
421
+ widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
422
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
423
+ },
424
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
425
+ };
426
+ }
427
+ static CGSTAndSGSTTaxDataTableWithPartNUmber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
428
+ return {
429
+ style: 'table_data',
430
+ table: {
431
+ widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
432
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
433
+ },
434
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
435
+ };
436
+ }
437
+ static TaxDataTableWithOutPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
438
+ if (ShowIGST) {
439
+ return this.IGSTTaxDataTableWithOutPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
440
+ }
441
+ else {
442
+ return this.CGSTAndSGSTTaxDataTableWithOutPartNUmber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn);
443
+ }
444
+ }
445
+ static IGSTTaxDataTableWithOutPartNumber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
446
+ return {
447
+ style: 'table_data',
448
+ table: {
449
+ widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
450
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
451
+ },
452
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
453
+ };
454
+ }
455
+ static CGSTAndSGSTTaxDataTableWithOutPartNUmber(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
456
+ return {
457
+ style: 'table_data',
458
+ table: {
459
+ widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
460
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
461
+ },
462
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
463
+ };
464
+ }
465
+ static WithOutTaxDataTable(PrintPartNo, ShowIGST, Items, Body, ShowTaxColumn, ShowDiscountColumn) {
466
+ if (PrintPartNo) {
467
+ return this.WithOutTaxDataTableWithPartNumber(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
468
+ }
469
+ else {
470
+ return this.WithOutTaxDataTableWithOutPartNumber(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
471
+ }
472
+ }
473
+ static WithOutTaxDataTableWithPartNumber(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
474
+ return {
475
+ style: 'table_data',
476
+ marginLeft: 20,
477
+ table: {
478
+ widths: [15, 70, 200, 25, 60, 40, 40, 55],
479
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
480
+ },
481
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
482
+ };
483
+ }
484
+ static WithOutTaxDataTableWithOutPartNumber(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
485
+ return {
486
+ style: 'table_data',
487
+ marginLeft: 20,
488
+ table: {
489
+ widths: [15, 274, 50, 72, 80],
490
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
491
+ },
492
+ layout: shared_print_service_1.PrintSharedService.LayOutStyle()
493
+ };
494
+ }
495
+ static GetPartsTableForView(Items, PrintPartNo) {
496
+ if (Items.length !== 0) {
497
+ if (PrintPartNo) {
498
+ return {
499
+ style: 'table_data',
500
+ marginLeft: 20,
501
+ table: {
502
+ widths: [15, 85, 170, 20, 50, 30, 30, 60],
503
+ // headerRows: 2,
504
+ body: this.PartsTableBody(Items, PrintPartNo)
505
+ },
506
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
507
+ };
508
+ }
509
+ else {
510
+ return {
511
+ style: 'table_data',
512
+ marginLeft: 20,
513
+ table: {
514
+ widths: [15, 250, 25, 50, 35, 35, 60],
515
+ // headerRows: 2,
516
+ body: this.PartsTableBody(Items, PrintPartNo)
517
+ },
518
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
519
+ };
520
+ }
521
+ }
522
+ else {
523
+ let a = '';
524
+ return a;
525
+ }
526
+ }
527
+ static WithOutDiscountFieldTable(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
528
+ if (Items.length !== 0) {
529
+ if (PrintPartNo) {
530
+ return {
531
+ style: 'table_data',
532
+ marginLeft: 20,
533
+ table: {
534
+ widths: [15, 67, 160, 25, 50, 60, 30, 53],
535
+ headerRows: 1,
536
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
537
+ },
538
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
539
+ };
540
+ }
541
+ else {
542
+ return {
543
+ style: 'table_data',
544
+ marginLeft: 20,
545
+ table: {
546
+ widths: [15, 215, 25, 50, 60, 45, 60],
547
+ headerRows: 1,
548
+ body: this.BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
549
+ },
550
+ layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
551
+ };
552
+ }
553
+ }
554
+ else {
555
+ let a = '';
556
+ return a;
557
+ }
558
+ }
559
+ static BuildTableBodyForLaborAndParts(Items, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn) {
560
+ var body = [];
561
+ let columns = shared_print_service_1.PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
562
+ // if (ShowTaxColumn) {
563
+ for (let i = 0; i < columns.length; i++) {
564
+ body.push(columns[i]);
565
+ }
566
+ columns = columns[1];
567
+ // } else {
568
+ // body.push(columns);
569
+ // }
570
+ let PartsTable = this.GetPartsDataTable(Items, columns, body);
571
+ return PartsTable;
572
+ }
573
+ static GetPartsDataTable(Items, columns, body) {
574
+ let SNo = 1;
575
+ Items.forEach((part) => {
576
+ var dataRow = [];
577
+ columns.forEach((column) => {
578
+ var _a, _b, _c, _d;
579
+ if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])
580
+ || column.text === 'Line Total' || column.text === 'Unit Price') {
581
+ if (part[column.Field] === 'Spare Items') {
582
+ dataRow.push({ text: (_a = part[column.Field]) === null || _a === void 0 ? void 0 : _a.toString(), marginLeft: 50, style: 'InlineHeader' });
583
+ }
584
+ else {
585
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM'
586
+ || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt') {
587
+ dataRow.push({ text: (_b = part[column.Field]) === null || _b === void 0 ? void 0 : _b.toString(), alignment: 'right', nowrap: true });
588
+ }
589
+ else if (column.Field1 === 'UnCo') {
590
+ dataRow.push({ text: (_c = part[column.Field1]) === null || _c === void 0 ? void 0 : _c.toString(), alignment: 'right', nowrap: true });
591
+ }
592
+ else {
593
+ // dataRow.push(part[column.Field].toString());
594
+ if (column.Field === 'Desc') {
595
+ let DescData = [];
596
+ DescData.push((_d = part[column.Field]) === null || _d === void 0 ? void 0 : _d.toString());
597
+ if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
598
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
599
+ }
600
+ dataRow.push({ stack: DescData });
601
+ }
602
+ else {
603
+ dataRow.push({ text: part[column.Field].toString() });
604
+ }
605
+ }
606
+ }
607
+ }
608
+ else {
609
+ if (column.Field === 'SNo') {
610
+ part[column.Field] = SNo;
611
+ SNo = SNo + 1;
612
+ }
613
+ else {
614
+ part[column.Field] = '';
615
+ }
616
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
617
+ }
618
+ });
619
+ body.push(dataRow);
620
+ });
621
+ return body;
622
+ }
623
+ static PartsTableBody(Items, PrintPartNo) {
624
+ var body = [];
625
+ let columns = shared_pdf_service_1.SharedPDFService.GetHeaders(PrintPartNo);
626
+ for (let i = 0; i < columns.length; i++) {
627
+ body.push(columns[i]);
628
+ }
629
+ let PartsTable = this.GetPartsDataTable(Items, columns[1], body);
630
+ return PartsTable;
631
+ }
632
+ static GetPOTotalDetails(ROPrintData) {
633
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.SubTotal)) {
634
+ ROPrintData.SubTotal = 0;
635
+ }
636
+ return {
637
+ columns: [
638
+ {
639
+ stack: [
640
+ this.GetTaxOnParts(ROPrintData.PartsTotalAfterDisc, ROPrintData.PartsTotalBeforeDisc, ROPrintData.PartCGST, ROPrintData.PartSGST, ROPrintData.PartIGST, ROPrintData.ShowIGST, ROPrintData.ShowAccParts, ROPrintData.ShowTaxColumn, ROPrintData.ShowDetailedPartTaxInfo),
641
+ this.PartsAmountGroupByTax(ROPrintData.PartsTaxInfo, ROPrintData.ShowAccParts, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn)
642
+ ]
643
+ }, { text: '', width: 200 }, this.GrandTotal(ROPrintData.LaborAfterGST, ROPrintData.PartAfterTax, ROPrintData.Total, ROPrintData.TotalRoundedBy, ROPrintData.RoundedTotal, ROPrintData.SubTotal, ROPrintData.TaxTotal, ROPrintData.PartsDiscTotal, ROPrintData.Adjust)
644
+ ],
645
+ marginLeft: 10
646
+ };
647
+ }
648
+ static GetTaxOnParts(BasicPartsTotal, PartsTotalBeforeDisc, PCGST, PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo) {
649
+ let istheretax = false;
650
+ let PartsTotal = [];
651
+ if (!tr_utils_1.TrUtils.IsFixedZero(BasicPartsTotal)) {
652
+ PartsTotal.push({ name: 'Total Taxable', value: BasicPartsTotal });
653
+ }
654
+ if (ShowTaxColumn) {
655
+ if (!tr_utils_1.TrUtils.IsFixedZero(PartsTotalBeforeDisc)) {
656
+ PartsTotal.unshift({ name: 'Items', value: PartsTotalBeforeDisc });
657
+ }
658
+ }
659
+ if (ShowTaxColumn && ShowDetailedPartTaxInfo) {
660
+ if (ShowIGST) {
661
+ PartsTotal.push({ name: 'IGST On Items', value: PIGST });
662
+ }
663
+ else {
664
+ PartsTotal.push({ name: 'CGST On Items', value: PCGST });
665
+ PartsTotal.push({ name: 'SGST On Items', value: PSGST });
666
+ }
667
+ }
668
+ if (PartsTotal.length !== 0) {
669
+ return {
670
+ style: ['total_margin', 'totals_Styles'],
671
+ lineHeight: 0.7,
672
+ fontSize: 7,
673
+ marginBottom: 5,
674
+ table: {
675
+ body: this.CreatePartsTotalsTable(PartsTotal, true)
676
+ },
677
+ layout: 'noBorders',
678
+ };
679
+ }
680
+ else {
681
+ return shared_pdf_service_1.SharedPDFService.emptyObject();
682
+ }
683
+ }
684
+ static GrandTotal(LaborAfterGST, PartsAfterGST, OverAllRecordTotal, Rounded, GrandTotal, SubTotal, TaxTotal, PartsDiscTotal, Adj) {
685
+ let AccountFields = [
686
+ // { name: 'Part Total', value: PartsAfterGST }
687
+ ];
688
+ let total = {
689
+ name: 'Total',
690
+ value: tr_utils_1.TrUtils.FixPriceValue(OverAllRecordTotal)
691
+ };
692
+ let Rounding = { name: 'Rounding', value: Rounded };
693
+ let FinalTotal = { name: 'Total', value: GrandTotal };
694
+ if (Rounding.value > 0) {
695
+ Rounding.value = '+' + Rounding.value;
696
+ }
697
+ if (!tr_utils_1.TrUtils.IsFixedZero(SubTotal)) {
698
+ AccountFields.push({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue(SubTotal) });
699
+ }
700
+ if (!tr_utils_1.TrUtils.IsEmpty(PartsDiscTotal)) {
701
+ AccountFields.push({ name: 'Total Disc.', value: '-' + PartsDiscTotal });
702
+ }
703
+ if (!tr_utils_1.TrUtils.IsEmpty(TaxTotal)) {
704
+ AccountFields.push({ name: 'Total Tax', value: TaxTotal });
705
+ }
706
+ if (!tr_utils_1.TrUtils.IsEmpty(Adj)) {
707
+ if (Adj > 0) {
708
+ Adj = '+' + tr_utils_1.TrUtils.FixPriceValue(Adj);
709
+ }
710
+ AccountFields.push({ name: 'Adjust', value: tr_utils_1.TrUtils.FixPriceValue(Adj) });
711
+ }
712
+ AccountFields.push(total);
713
+ AccountFields.push(Rounding);
714
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
715
+ AccountFields.push(FinalTotal);
716
+ }
717
+ return {
718
+ style: ['total_margin', 'totals_Styles'],
719
+ lineHeight: 0.7,
720
+ marginBottom: 5,
721
+ table: {
722
+ body: this.CreateGrandTotalTable(AccountFields)
723
+ },
724
+ layout: 'noBorders'
725
+ };
726
+ }
727
+ static PartsAmountGroupByTax(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
728
+ if (ShowTaxColumn) {
729
+ return {
730
+ stack: [this.PartsGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
731
+ };
732
+ }
733
+ else {
734
+ return '';
735
+ }
736
+ }
737
+ static PartsGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
738
+ if (ShowIGST) {
739
+ return {
740
+ style: 'table_data',
741
+ table: {
742
+ widths: [40, 30, 45, 45],
743
+ headerRows: 1,
744
+ body: this.CreateTableForGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
745
+ },
746
+ layout: this.HeaderLineStyle(),
747
+ };
748
+ }
749
+ else {
750
+ return {
751
+ style: 'table_data',
752
+ table: {
753
+ widths: [40, 15, 15, 45, 45],
754
+ headerRows: 1,
755
+ body: this.CreateTableForGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
756
+ },
757
+ layout: this.HeaderLineStyle(),
758
+ };
759
+ }
760
+ }
761
+ static PartsGroupByPercentage(PartsTaxInfo, ShowAccParts, ShowTaxColumn) {
762
+ return {
763
+ style: 'table_data',
764
+ table: {
765
+ widths: [20, 20, 40, 40],
766
+ body: this.CreateTableForGroupByPercentage(PartsTaxInfo, ShowAccParts, ShowTaxColumn)
767
+ },
768
+ layout: this.HeaderLineStyle(),
769
+ };
770
+ }
771
+ static GetSignatures(CName) {
772
+ return {
773
+ fontSize: this.MediumFont,
774
+ columns: [{
775
+ stack: [
776
+ this.CompanyName(CName),
777
+ { columns: [this.Authorizedsignature()] }
778
+ ]
779
+ }],
780
+ };
781
+ }
782
+ static CompanyName(CName) {
783
+ return {
784
+ style: 'forCompany',
785
+ text: ['For ', { text: CName, bold: 'true' }],
786
+ };
787
+ }
788
+ static Authorizedsignature() {
789
+ return {
790
+ style: 'Sign',
791
+ text: ['Authorized Signatory'],
792
+ };
793
+ }
794
+ static HeaderLineStyle() {
795
+ return {
796
+ hLineWidth: function (i, node) {
797
+ return (i === 1) ? 0.5 : 0;
798
+ },
799
+ vLineWidth: function (i, node) {
800
+ return (i === 0 || i === node.table.widths.length) ? 0 : 0;
801
+ },
802
+ };
803
+ }
804
+ static CreateHeaderForGroupByPercentage() {
805
+ let HeaderNames = [{ text: 'GST(%)', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'CombinedTaxPercentage' },
806
+ { text: 'Count', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
807
+ { text: 'Taxble Value', style: 'table_header', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
808
+ { text: 'Amount', style: 'table_header', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
809
+ ];
810
+ return HeaderNames;
811
+ }
812
+ static CreateHeaderForGroupByHSN(ShowIGST) {
813
+ let HeaderNames = [{ text: 'HSN', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'HSN' },
814
+ { text: 'Taxable Value', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
815
+ { text: 'Amount', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
816
+ ];
817
+ if (ShowIGST) {
818
+ HeaderNames.splice(1, 0, { text: 'IGST', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
819
+ }
820
+ else {
821
+ HeaderNames.splice(1, 0, { text: 'CGST', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
822
+ HeaderNames.splice(2, 0, { text: 'SGST', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'SGST' });
823
+ }
824
+ return HeaderNames;
825
+ }
826
+ static CreateTableForGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
827
+ if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
828
+ var body = [];
829
+ let columns = this.CreateHeaderForGroupByHSN(ShowIGST);
830
+ body.push(columns);
831
+ PartsTaxInfo.forEach((part) => {
832
+ var dataRow = [];
833
+ columns.forEach((column) => {
834
+ if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) &&
835
+ !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
836
+ || column.Field === 'TotalTaxAmount') {
837
+ if (column.Field === 'SGSTLaborAmt') {
838
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
839
+ }
840
+ else {
841
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
842
+ }
843
+ }
844
+ else {
845
+ part[column.Field] = '';
846
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
847
+ }
848
+ });
849
+ body.push(dataRow);
850
+ });
851
+ return body;
852
+ }
853
+ else {
854
+ return [{}];
855
+ }
856
+ }
857
+ static CreateTableForGroupByPercentage(PartsTaxInfo, ShowAccParts, ShowTaxColumn) {
858
+ if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
859
+ var body = [];
860
+ let columns = this.CreateHeaderForGroupByPercentage();
861
+ body.push(columns);
862
+ PartsTaxInfo.forEach((part) => {
863
+ var dataRow = [];
864
+ columns.forEach((column) => {
865
+ if (!tr_utils_1.TrUtils.IsNull(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])) {
866
+ if (column.Field === 'TotalTaxAmount' || column.Field === 'TotalTaxableAmount') {
867
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
868
+ }
869
+ else {
870
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
871
+ }
872
+ }
873
+ else {
874
+ part[column.Field] = '';
875
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
876
+ }
877
+ });
878
+ body.push(dataRow);
879
+ });
880
+ return body;
881
+ }
882
+ else {
883
+ return [{}];
884
+ }
885
+ }
886
+ static CreateGrandTotalTable(data) {
887
+ var body = [];
888
+ data.forEach((row) => {
889
+ if (!tr_utils_1.TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
890
+ var dataRow = [];
891
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
892
+ dataRow.push(':');
893
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
894
+ body.push(dataRow);
895
+ }
896
+ });
897
+ return body;
898
+ }
899
+ static CreatePartsTotalsTable(data, istotal) {
900
+ var body = [];
901
+ data.forEach((row) => {
902
+ var dataRow = [];
903
+ if (row.name === 'Items') {
904
+ dataRow.push({ text: [{ text: row.name, bold: 'true' }, ' Total'] });
905
+ }
906
+ else {
907
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
908
+ }
909
+ dataRow.push(':');
910
+ if (istotal) {
911
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
912
+ }
913
+ else {
914
+ dataRow.push({ text: (row.value).toString(), noWrap: true, });
915
+ }
916
+ body.push(dataRow);
917
+ });
918
+ return body;
919
+ }
920
+ }
921
+ exports.PurchaseOrderPDFService = PurchaseOrderPDFService;
922
+ PurchaseOrderPDFService.SmallFont = 6;
923
+ PurchaseOrderPDFService.MediumFont = 8;
924
+ PurchaseOrderPDFService.LargeFont = 9;