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