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,2569 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharedPDFService = void 0;
4
+ const enums_1 = require("../enums/enums");
5
+ const my_date_1 = require("../utils/my-date");
6
+ const tr_utils_1 = require("../utils/tr-utils");
7
+ class SharedPDFService {
8
+ static MainHeading(CName, Entity, Image, HColor, CopyName) {
9
+ let headerstyle;
10
+ let MainHeaderStyle = this.GetMainHeaderStyleForLeftAlignHeader(CName);
11
+ if (Entity.Header === 1) {
12
+ headerstyle = 'header';
13
+ }
14
+ else {
15
+ headerstyle = 'temp2header';
16
+ }
17
+ return this.HeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName);
18
+ }
19
+ static HeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName) {
20
+ let HeaderDetails = [];
21
+ // HeaderDetails.push({ text: 'Original', color: 'grey', alignment: 'right' });
22
+ if (!tr_utils_1.TrUtils.IsNull(Image) && Entity.PrLogo) {
23
+ if (Entity.Header === 1) {
24
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: this.GetLeftMArgin(CName) });
25
+ }
26
+ else {
27
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: 'left', margin: [10, 0, 0, 0] });
28
+ }
29
+ }
30
+ else {
31
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor });
32
+ }
33
+ // if (!TrUtils.IsNull(CopyName)) {
34
+ // HeaderDetails.push({ text: CopyName, color: 'grey', alignment: 'right', width: 100, marginTop: -15, fontSize: 10 });
35
+ // }
36
+ return HeaderDetails;
37
+ }
38
+ static GetLeftMArgin(WorkShopName) {
39
+ if (WorkShopName.length < 28) {
40
+ return 'center';
41
+ }
42
+ else {
43
+ return 'left';
44
+ }
45
+ }
46
+ static GetMainHeader(Entity, Image, AColor, HColor, text) {
47
+ if (Entity.Header === 1) {
48
+ return {
49
+ columns: this.GetAddresDetailsAndLogo(Entity, Image, AColor, HColor, text)
50
+ };
51
+ }
52
+ else {
53
+ return {
54
+ columns: this.GetLeftAlignmentHeader(Entity, Image, AColor, HColor, text)
55
+ };
56
+ }
57
+ }
58
+ static GetConsultationMainHeader(Entity, Image, AColor, HColor, text) {
59
+ return {
60
+ columns: this.GetConsultationLeftAlignmentHeader(Entity, Image, AColor, HColor, text), width: '60%'
61
+ };
62
+ }
63
+ static ConsultationMainHeading(CName, Entity, Image, HColor, CopyName) {
64
+ let headerstyle;
65
+ let MainHeaderStyle = {
66
+ fontSize: 15,
67
+ bold: true,
68
+ };
69
+ // if (Entity.Header === 1) {
70
+ // headerstyle = 'header';
71
+ // } else {
72
+ headerstyle = 'temp2header';
73
+ // }
74
+ return this.ConsultHeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName);
75
+ }
76
+ static ConsultHeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName) {
77
+ let HeaderDetails = [];
78
+ // HeaderDetails.push({ text: 'Original', color: 'grey', alignment: 'right' });
79
+ if (!tr_utils_1.TrUtils.IsNull(Image) && Entity.PrLogo) {
80
+ // if (Entity.Header === 1) {
81
+ // HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: this.GetLeftMArgin(CName) })
82
+ // } else {
83
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: 'left', margin: [10, 0, 0, 0] });
84
+ // }
85
+ }
86
+ else {
87
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor });
88
+ }
89
+ // if (!TrUtils.IsNull(CopyName)) {
90
+ // HeaderDetails.push({ text: CopyName, color: 'grey', alignment: 'right', width: 100, marginTop: -15, fontSize: 10 });
91
+ // }
92
+ return HeaderDetails;
93
+ }
94
+ static GetConsultationLeftAlignmentHeader(Entity, Image, AColor, HColor, text) {
95
+ let Details = [
96
+ {
97
+ stack: [{ columns: [this.ConsultationMainHeading(Entity.CName, Entity, Image, HColor, text)], marginTop: 15 },
98
+ {
99
+ columns: [
100
+ this.GetEntityDetails(Entity)
101
+ ]
102
+ }
103
+ ]
104
+ }
105
+ ];
106
+ if (!tr_utils_1.TrUtils.IsNull(Image) && Entity.PrLogo) {
107
+ Details[0].stack[1].columns.unshift({
108
+ width: 290,
109
+ margin: [10, 0, 0, 5],
110
+ stack: this.GetHeader(Entity, HColor),
111
+ color: AColor,
112
+ style: 'temp2header'
113
+ });
114
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
115
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
116
+ }
117
+ Details.unshift({ image: Image, width: 120, height: 80 });
118
+ }
119
+ else {
120
+ Details[0].stack[1].columns.unshift({
121
+ width: 420,
122
+ margin: [0, 0, 0, 5],
123
+ stack: this.GetHeader(Entity, HColor),
124
+ color: AColor,
125
+ style: 'temp2header'
126
+ });
127
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
128
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
129
+ }
130
+ }
131
+ return Details;
132
+ }
133
+ static GetWatermarkImage(Image, pageSize, Wmark) {
134
+ if (!tr_utils_1.TrUtils.IsNull(Image) && Wmark) {
135
+ return {
136
+ margun: [10, 15, 10, 15],
137
+ image: Image,
138
+ width: pageSize.width,
139
+ alignment: 'center',
140
+ height: pageSize.height,
141
+ opacity: 0.04,
142
+ };
143
+ }
144
+ else {
145
+ return this.emptyObject();
146
+ }
147
+ }
148
+ static GetLeftAlignmentHeader(Entity, Image, AColor, HColor, text) {
149
+ let Details = [
150
+ {
151
+ stack: [{ columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
152
+ {
153
+ columns: [
154
+ this.emptyObject()
155
+ ]
156
+ }
157
+ ]
158
+ }
159
+ ];
160
+ if (!tr_utils_1.TrUtils.IsNull(Image) && Entity.PrLogo) {
161
+ Details[0].stack[1].columns.unshift({
162
+ width: 290,
163
+ margin: [10, 0, 0, 5],
164
+ stack: this.GetHeader(Entity, HColor),
165
+ color: AColor,
166
+ style: 'temp2header'
167
+ });
168
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
169
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
170
+ }
171
+ Details.unshift({ image: Image, width: 120, height: 80 });
172
+ }
173
+ else {
174
+ Details[0].stack[1].columns.unshift({
175
+ width: 420,
176
+ margin: [0, 0, 0, 5],
177
+ stack: this.GetHeader(Entity, HColor),
178
+ color: AColor,
179
+ style: 'temp2header'
180
+ });
181
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
182
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
183
+ }
184
+ }
185
+ return Details;
186
+ }
187
+ static GetAddresDetailsAndLogo(Entity, Image, AColor, HColor, text) {
188
+ let Details = [
189
+ {
190
+ stack: [
191
+ { columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
192
+ {
193
+ columns: [{
194
+ width: 300,
195
+ margin: [0, 0, 0, 5],
196
+ stack: this.GetHeader(Entity, HColor),
197
+ color: AColor,
198
+ style: 'header'
199
+ },
200
+ this.emptyObject()]
201
+ }
202
+ ]
203
+ }
204
+ ];
205
+ if (!tr_utils_1.TrUtils.IsNull(Image) && Entity.PrLogo) {
206
+ // Details.unshift({ text: '', width: 120 });
207
+ if (Entity.CName.length < 28) {
208
+ Details[0].stack[0].columns.push({ text: '', width: 150 });
209
+ }
210
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
211
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 7 });
212
+ }
213
+ Details.unshift({ image: Image, width: 120, height: 80 });
214
+ }
215
+ else {
216
+ Details[0].stack[1].columns.unshift({ text: '', width: 130 });
217
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
218
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 7 });
219
+ }
220
+ }
221
+ return Details;
222
+ }
223
+ static GetHeader(Entity, HColor) {
224
+ let headerstyle;
225
+ if (Entity.Header === 1) {
226
+ headerstyle = 'ws_adrs_center';
227
+ }
228
+ else {
229
+ headerstyle = 'ws_adrs_left';
230
+ }
231
+ let SubHeader = [
232
+ { text: '' + Entity.Adrs1 + '', style: [headerstyle] },
233
+ { text: '' + Entity.City + this.getPinCode(Entity.PIN) + ', ' + 'Ph: ' + Entity.Phone, style: headerstyle },
234
+ { text: '' + this.GetEmail(Entity.Email) + '', style: headerstyle },
235
+ // { text: 'GSTIN:' + Entity.GSTIN + ', ' + 'PAN: ' + Entity.PAN, style: headerstyle },
236
+ ];
237
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.Adrs2)) {
238
+ SubHeader.splice(1, 0, { text: '' + Entity.Adrs2 + '', style: [headerstyle] });
239
+ }
240
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.TLine)) {
241
+ SubHeader.unshift({ text: this.GetTagLine(Entity.TLine), fontSize: 10, bold: true, color: HColor, margin: [0, 0, 0, 2] });
242
+ }
243
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.GSTIN) || !tr_utils_1.TrUtils.IsEmpty(Entity.PAN)) {
244
+ let Data = '';
245
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.GSTIN)) {
246
+ Data = 'GSTIN:' + Entity.GSTIN;
247
+ }
248
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.GSTIN) && !tr_utils_1.TrUtils.IsEmpty(Entity.PAN)) {
249
+ Data = Data + ', ';
250
+ }
251
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.PAN)) {
252
+ Data = Data + 'PAN:' + Entity.PAN;
253
+ }
254
+ SubHeader.push({ text: Data, style: headerstyle, fontSize: this.TermsandCond });
255
+ }
256
+ if (Entity.GSTType === 2) {
257
+ SubHeader.push({ text: '* under composition scheme', fontSize: this.TermsandCond });
258
+ }
259
+ return SubHeader;
260
+ }
261
+ static GetMainHeaderStyleForLeftAlignHeader(WorkShopName) {
262
+ var wsname_fontSize;
263
+ if (tr_utils_1.TrUtils.IsNull(WorkShopName)) {
264
+ WorkShopName = '';
265
+ }
266
+ switch (true) {
267
+ case (WorkShopName.length < 30):
268
+ wsname_fontSize = 20;
269
+ break;
270
+ case (WorkShopName.length < 35):
271
+ wsname_fontSize = 20;
272
+ break;
273
+ case (WorkShopName.length < 50):
274
+ wsname_fontSize = 17;
275
+ break;
276
+ default:
277
+ wsname_fontSize = 14;
278
+ }
279
+ var HeaderSize = {
280
+ fontSize: wsname_fontSize,
281
+ bold: true,
282
+ };
283
+ return HeaderSize;
284
+ }
285
+ static GetEntityDetails(Entity) {
286
+ let SetData = [];
287
+ if (Entity.PrUPI && !Entity.IsProforma) {
288
+ SetData.push({ qr: Entity.UPI, fit: '100', marginLeft: 150 });
289
+ SetData.push({ text: 'Scan To Pay', fontSize: this.TermsandCond, marginLeft: 151, bold: true, marginTop: 2 });
290
+ }
291
+ // SetData.push({ columns: [this.GetEntityTax(Entity)] })
292
+ return {
293
+ lineHeight: 0.7,
294
+ stack: SetData
295
+ };
296
+ }
297
+ static GetEntityTax(Entity) {
298
+ let EntityData = [];
299
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.GSTIN)) {
300
+ EntityData.push({ name: 'GSTIN', value: Entity.GSTIN });
301
+ }
302
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.PAN)) {
303
+ EntityData.push({ name: 'PAN No', value: Entity.PAN });
304
+ }
305
+ if (EntityData.length !== 0) {
306
+ return this.GetEntityeDataTable(EntityData, Entity);
307
+ }
308
+ else {
309
+ return this.emptyObject();
310
+ }
311
+ }
312
+ static GetEntityeDataTable(EntityFields, Entity) {
313
+ return {
314
+ lineHeight: 0.7,
315
+ marginTop: 5,
316
+ marginLeft: 10,
317
+ fontSize: this.TermsandCond,
318
+ // fontSize: this.SubHeaderSize,
319
+ table: {
320
+ body: [
321
+ [{
322
+ table: {
323
+ fontSize: this.TermsandCond,
324
+ widths: ['auto', 'auto', '*'],
325
+ body: this.EntityTableDataDetails(EntityFields, Entity)
326
+ },
327
+ layout: 'noBorders',
328
+ }]
329
+ ]
330
+ },
331
+ layout: 'noBorders',
332
+ };
333
+ }
334
+ static EntityTableDataDetails(EntityFields, Entity) {
335
+ var body = [];
336
+ EntityFields.forEach((row) => {
337
+ if (!tr_utils_1.TrUtils.IsFixedZero(row.value) && !tr_utils_1.TrUtils.IsEmpty(row.value)) {
338
+ var dataRow = [];
339
+ dataRow.push({ text: (row.name).toString(), noWrap: true, fontSize: 8 });
340
+ dataRow.push(':');
341
+ dataRow.push({ text: (row.value).toString(), noWrap: true, fontSize: 9 });
342
+ body.push(dataRow);
343
+ if (row.name === 'GSTIN' && Entity.GSTType === 2) {
344
+ let data = [];
345
+ data.push({ text: '* under composition scheme', colSpan: 3, fontSize: 7, marginLeft: 10 }, {}, {});
346
+ body.push(data);
347
+ }
348
+ }
349
+ // else {
350
+ // var a: any = [];
351
+ // a.push({ text: '', lineHeight: 0.1 });
352
+ // a.push({ text: '', lineHeight: 0.1 });
353
+ // a.push({ text: '', lineHeight: 0.1 });
354
+ // body.push(a);
355
+ // }
356
+ });
357
+ return body;
358
+ }
359
+ static GetTagLine(TLine) {
360
+ if (!tr_utils_1.TrUtils.IsEmpty(TLine)) {
361
+ return TLine;
362
+ }
363
+ else {
364
+ let TagLine = '';
365
+ return TagLine;
366
+ }
367
+ }
368
+ static GetEmail(email) {
369
+ let Email = '';
370
+ if (!tr_utils_1.TrUtils.IsNull(email)) {
371
+ return 'Email: ' + email;
372
+ }
373
+ else {
374
+ return Email;
375
+ }
376
+ }
377
+ static getPinCode(pin) {
378
+ let code = '';
379
+ if (!tr_utils_1.TrUtils.IsNull(pin)) {
380
+ return ' - ' + pin;
381
+ }
382
+ else {
383
+ return code;
384
+ }
385
+ }
386
+ static GetPrintType(type) {
387
+ return {
388
+ // marginLeft: 10,
389
+ columns: [{ text: '', width: 120 },
390
+ { text: type, alignment: 'center' }, { text: '', width: 140 }
391
+ ],
392
+ style: 'Receiptheader1'
393
+ };
394
+ }
395
+ static GetUnderLine() {
396
+ return {
397
+ marginTop: 10,
398
+ canvas: [
399
+ {
400
+ type: 'line',
401
+ color: 'grey',
402
+ x1: 0,
403
+ y1: 0,
404
+ x2: 575,
405
+ y2: 0,
406
+ lineWidth: 0.9
407
+ }
408
+ ]
409
+ };
410
+ }
411
+ static GetUnderLine1(withPass) {
412
+ if (withPass) {
413
+ return {
414
+ marginTop: 10,
415
+ canvas: [
416
+ {
417
+ type: 'line',
418
+ color: 'grey',
419
+ x1: 0,
420
+ y1: 0,
421
+ x2: 575,
422
+ y2: 0,
423
+ dash: { length: 5, space: 10 },
424
+ lineWidth: 0.9
425
+ }
426
+ ]
427
+ };
428
+ }
429
+ else {
430
+ return this.emptyObject();
431
+ }
432
+ }
433
+ static GetLightUnderLine(width, color) {
434
+ return {
435
+ canvas: [
436
+ {
437
+ type: 'line',
438
+ color: color,
439
+ x1: 0,
440
+ y1: 0,
441
+ x2: width,
442
+ y2: 0,
443
+ lineWidth: 0.3
444
+ }
445
+ ]
446
+ };
447
+ }
448
+ static HeaderAfterLine() {
449
+ return {
450
+ canvas: [
451
+ {
452
+ type: 'line',
453
+ lineColor: 'grey',
454
+ x1: 0,
455
+ y1: 0,
456
+ x2: 575,
457
+ y2: 0,
458
+ lineWidth: 1.5
459
+ }
460
+ ]
461
+ };
462
+ }
463
+ static HeaderAfterLine2() {
464
+ return {
465
+ canvas: [
466
+ {
467
+ type: 'line',
468
+ lineColor: 'grey',
469
+ x1: 0,
470
+ y1: 0,
471
+ x2: 545,
472
+ y2: 0,
473
+ lineWidth: 1.5
474
+ }
475
+ ]
476
+ };
477
+ }
478
+ static HeaderAfterLine1() {
479
+ return {
480
+ canvas: [
481
+ {
482
+ type: 'line',
483
+ lineColor: 'grey',
484
+ x1: 0,
485
+ y1: 0,
486
+ x2: 545,
487
+ y2: 0,
488
+ lineWidth: 1.5
489
+ }
490
+ ]
491
+ };
492
+ }
493
+ static CustomerAndVehicleDetailsAfterLine() {
494
+ return {
495
+ canvas: [
496
+ {
497
+ type: 'line',
498
+ lineColor: 'grey',
499
+ x1: 0,
500
+ y1: 0,
501
+ x2: 575,
502
+ y2: 0,
503
+ lineWidth: 1
504
+ }
505
+ ]
506
+ };
507
+ }
508
+ static convertImgToBase64URL(url, callback, outputFormat) {
509
+ var canvas = document.createElement('CANVAS'), ctx = canvas.getContext('2d'), img = new Image;
510
+ img.crossOrigin = 'Anonymous';
511
+ img.onload = function () {
512
+ var dataURL;
513
+ canvas.height = img.height;
514
+ canvas.width = img.width;
515
+ ctx.drawImage(img, 0, 0);
516
+ dataURL = canvas.toDataURL(outputFormat);
517
+ callback(dataURL);
518
+ canvas = null;
519
+ };
520
+ img.onerror = outputFormat;
521
+ img.src = url;
522
+ }
523
+ static GetShowLine(ROData) {
524
+ if (ROData.Parts.length !== 0 || ROData.Ops.length !== 0) {
525
+ return this.GetUnderLine();
526
+ }
527
+ else {
528
+ return this.emptyObject();
529
+ }
530
+ }
531
+ static GetTemsAndConditions(Terms) {
532
+ if (!tr_utils_1.TrUtils.IsNull(Terms)) {
533
+ return {
534
+ text: '' + Terms + '', marginTop: 5, marginBottom: 5,
535
+ fontSize: this.TermsandCond, alignment: 'justify'
536
+ };
537
+ }
538
+ else {
539
+ return this.emptyObject();
540
+ }
541
+ }
542
+ static GetSearchValueDetails(searchValue) {
543
+ let showSearch = [];
544
+ for (const key in searchValue) {
545
+ if (!tr_utils_1.TrUtils.IsNull(searchValue[key]) && !tr_utils_1.TrUtils.CheckInvalidSelect(searchValue[key]) && key !== 'Date' && key !== 'CustCntrlId' && key !== 'DescCntrlId' && key !== 'ManfCntrlId' && key !== 'VenCntrlId') {
546
+ showSearch.push({
547
+ name: (key === 'StDate') ? 'Start Date' : (key === 'EnDate') ? 'End Date' : (key === 'CustCntrl') ? 'Customer' : (key === 'DescCntrl') ? 'Item' : (key === 'ManfCntrl') ? 'Manufacturer' : (key === 'VenCntrl') ? 'Vendor' : key,
548
+ value: (key === 'StDate') ? my_date_1.MyDate.ConvertUTCDateToReadable(searchValue[key]) : (key === 'EnDate') ? my_date_1.MyDate.ConvertUTCDateToReadable(searchValue[key]) : searchValue[key],
549
+ });
550
+ }
551
+ // console.log('showSearch', showSearch);
552
+ // console.log(`${key}: ${searchValue[key]}`);
553
+ }
554
+ return {
555
+ style: ['columnheader', 'TotalsStyles'],
556
+ lineHeight: 1,
557
+ fontSize: this.SubHeaderSize,
558
+ marginBottom: 5,
559
+ table: {
560
+ body: this.GetBankDataTable(showSearch, false)
561
+ },
562
+ layout: 'noBorders',
563
+ };
564
+ }
565
+ static GetBankDetials(Bankinfo, isPrint) {
566
+ if (isPrint && !tr_utils_1.TrUtils.IsNull(Bankinfo)) {
567
+ let AccountFields = [];
568
+ let BANK = { name: 'BANK', value: Bankinfo.Name };
569
+ let Acc = { name: 'A/C NO', value: Bankinfo.ACNo };
570
+ let AccHolderName = { name: 'Account Holder Name', value: Bankinfo.ACName };
571
+ let Branch = { name: 'Branch', value: tr_utils_1.TrUtils.IsNull(Bankinfo.Bran) ? '' : Bankinfo.Bran };
572
+ let IFSC = { name: 'IFSC NO', value: Bankinfo.IFSC };
573
+ // let TotalPartsAmount = { name: 'Final Labor Amount', value: this.LabourtotalAmount(ROPrintData.LaborInsTotal) };
574
+ AccountFields.push(BANK);
575
+ // if (!TrUtils.IsNull(ROPrintData.OverAllLaborDiscount) && ROPrintData.OverAllLaborDiscount !== 0) {
576
+ AccountFields.push(Acc);
577
+ AccountFields.push(AccHolderName);
578
+ // }
579
+ AccountFields.push(Branch);
580
+ AccountFields.push(IFSC);
581
+ // AccountFields.push(TotalPartsAmount);
582
+ return {
583
+ style: ['columnheader', 'TotalsStyles'],
584
+ lineHeight: 1,
585
+ fontSize: this.SubHeaderSize,
586
+ marginBottom: 5,
587
+ table: {
588
+ body: this.GetBankDataTable(AccountFields, true)
589
+ },
590
+ layout: 'noBorders',
591
+ };
592
+ }
593
+ else {
594
+ return this.emptyObject();
595
+ }
596
+ }
597
+ static GetBankDataTable(data, isBank) {
598
+ var body = [];
599
+ if (isBank) {
600
+ body = [[{ text: 'Bank Details', bold: true, colSpan: 3 }, {}, {}]];
601
+ ;
602
+ }
603
+ data.forEach((row) => {
604
+ // if ((!TrUtils.IsFixedZero(row.value) && !TrUtils.IsNull(row.value)) || row.name === 'Total') {
605
+ var dataRow = [];
606
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
607
+ dataRow.push(':');
608
+ dataRow.push({ text: (row.value).toString(), noWrap: true, });
609
+ body.push(dataRow);
610
+ // }
611
+ // else {
612
+ // var a: any = [];
613
+ // a.push({ text: '', lineHeight: 0.1 });
614
+ // a.push({ text: '', lineHeight: 0.1 });
615
+ // a.push({ text: '', lineHeight: 0.1 });
616
+ // body.push(a);
617
+ // }
618
+ });
619
+ return body;
620
+ }
621
+ //Not Use This Function any where
622
+ static LaborTotalTable(ROPrintData) {
623
+ let AccountFields = [];
624
+ if (ROPrintData.For === enums_1.PayTypeEnum.Insurance) {
625
+ let LaborTotal = { name: 'Labor Total', value: ROPrintData.BasicLaborTotal };
626
+ let Disc = { name: 'Labor Discount', value: ROPrintData.OverAllLaborDiscount };
627
+ let VAT = { name: 'Service Tax', value: ROPrintData.OverAllLaborTaxAmount };
628
+ // let TotalPartsAmount = { name: 'Final Labor Amount', value: this.LabourtotalAmount(ROPrintData.LaborInsTotal) };
629
+ AccountFields.push(LaborTotal);
630
+ // if (!TrUtils.IsNull(ROPrintData.OverAllLaborDiscount) && ROPrintData.OverAllLaborDiscount !== 0) {
631
+ AccountFields.push(Disc);
632
+ // }
633
+ AccountFields.push(VAT);
634
+ // AccountFields.push(TotalPartsAmount);
635
+ }
636
+ else {
637
+ let LaborTotal = { name: 'Labor Total', value: ROPrintData.BasicLaborTotal };
638
+ let Disc = { name: 'Labor Discount', value: ROPrintData.OverAllLaborDiscount };
639
+ let VAT = { name: 'Service Tax ', value: ROPrintData.OverAllLaborTaxAmount };
640
+ // let TotalPartsAmount = { name: 'Final Labor Amount', value: this.LabourtotalAmount(ROPrintData.LaborTotal) }
641
+ AccountFields.push(LaborTotal);
642
+ // if (!TrUtils.IsNull(ROPrintData.OverAllLaborDiscount) && ROPrintData.OverAllLaborDiscount !== 0) {
643
+ AccountFields.push(Disc);
644
+ // }
645
+ AccountFields.push(VAT);
646
+ // AccountFields.push(TotalPartsAmount);
647
+ }
648
+ return {
649
+ style: ['columnheader', 'TotalsStyles'],
650
+ lineHeight: 1,
651
+ fontSize: this.SubHeaderSize,
652
+ marginBottom: 5,
653
+ table: {
654
+ body: this.GetDataTable(AccountFields, true)
655
+ },
656
+ layout: 'noBorders',
657
+ };
658
+ }
659
+ //Not Use This Function any where
660
+ static PartsTotalTables(ROPrintData) {
661
+ let AccountFields = [];
662
+ if (ROPrintData.For === enums_1.PayTypeEnum.Insurance) {
663
+ let PartsTotal = { name: 'Parts Total', value: ROPrintData.BasicPartsTotal };
664
+ let Disc = { name: 'Parts Discount', value: ROPrintData.OverAllPartsDiscount };
665
+ let VAT = { name: 'Parts Tax', value: ROPrintData.OverAllPartsTaxAmount };
666
+ // let TotalPartsAmount = { name: 'Final Parts Amount', value: this.PartstotalAmount(ROPrintData.PartsInsTotal)};
667
+ AccountFields.push(PartsTotal);
668
+ AccountFields.push(Disc);
669
+ AccountFields.push(VAT);
670
+ // AccountFields.push(TotalPartsAmount);
671
+ }
672
+ else {
673
+ let PartsTotal = { name: 'Parts Total', value: ROPrintData.BasicPartsTotal };
674
+ let Disc = { name: 'Parts Discount', value: ROPrintData.OverAllPartsDiscount };
675
+ let VAT = { name: 'Parts Tax', value: ROPrintData.OverAllPartsTaxAmount };
676
+ // let TotalPartsAmount = { name: 'Final Parts Amount', value: this.PartstotalAmount(ROPrintData.PartsTotal) }
677
+ AccountFields.push(PartsTotal);
678
+ AccountFields.push(Disc);
679
+ AccountFields.push(VAT);
680
+ // AccountFields.push(TotalPartsAmount);
681
+ }
682
+ return {
683
+ style: ['columnheader', 'TotalsStyles'],
684
+ lineHeight: 1,
685
+ fontSize: this.SubHeaderSize,
686
+ marginBottom: 5,
687
+ table: {
688
+ body: this.GetDataTable(AccountFields, true)
689
+ },
690
+ layout: 'noBorders',
691
+ };
692
+ }
693
+ static GetDataTable(data, istotal) {
694
+ var body = [];
695
+ data.forEach((row) => {
696
+ // if ((!TrUtils.IsFixedZero(row.value) && !TrUtils.IsNull(row.value)) || row.name === 'Total') {
697
+ if (tr_utils_1.TrUtils.IsNull(row.value)) {
698
+ row.value = '';
699
+ }
700
+ var dataRow = [];
701
+ if (row.name === 'Labor' || row.name === 'Parts') {
702
+ dataRow.push({ text: [{ text: row.name, bold: 'true' }, ' Total(Before Tax)'] });
703
+ }
704
+ else {
705
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
706
+ }
707
+ dataRow.push(':');
708
+ if (row.name === 'Vehicle') {
709
+ dataRow.push({ text: (row.value).toString(), width: 'auto', lineHeight: 1 });
710
+ }
711
+ else {
712
+ if (istotal) {
713
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
714
+ }
715
+ else {
716
+ dataRow.push({ text: (row.value).toString(), noWrap: true, bold: row.bold });
717
+ }
718
+ }
719
+ body.push(dataRow);
720
+ // }
721
+ // else {
722
+ // var a: any = [];
723
+ // a.push({ text: '', lineHeight: 0.1 });
724
+ // a.push({ text: '', lineHeight: 0.1 });
725
+ // a.push({ text: '', lineHeight: 0.1 });
726
+ // body.push(a);
727
+ // }
728
+ });
729
+ return body;
730
+ }
731
+ static GetCustomerAndVehicleDetails(Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Customer, IsProforma, Settings, Location, isOtherIndustry, BL, ROCode, TypeName, AdmNo) {
732
+ return {
733
+ style: 'textcust',
734
+ marginLeft: 5,
735
+ columns: [
736
+ this.GetCustomer(Customer, Type, For, Vehicle, Settings, 'Bill To', isOtherIndustry),
737
+ this.GetInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Location, isOtherIndustry),
738
+ this.GetVehicle(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo)
739
+ ],
740
+ };
741
+ }
742
+ static GetReceiptCustomerAndVehicleDetails(Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Customer, IsProforma, Settings, Location, isOtherIndustry) {
743
+ return {
744
+ style: 'textcust',
745
+ marginLeft: 5,
746
+ columns: [
747
+ this.GetReceiptCustomer(Customer, Type, For, Vehicle, Settings, 'Patient Name & Address', isOtherIndustry),
748
+ this.GetInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Location, isOtherIndustry),
749
+ this.GetReceiptVehicle(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, IsProforma, Settings, isOtherIndustry)
750
+ ],
751
+ };
752
+ }
753
+ static GetSOCustomerAndOthDetails(Id, CrDate, PrDate, PrintType, For, SurName, SurPhone, Type, SurEmail, Shipment, PolNo, PolType, Customer, Settings, RefNo, IsPackage, PackId, PackedDate, ShipId, ShippedDate) {
754
+ return {
755
+ style: 'textcust',
756
+ marginLeft: 5,
757
+ stack: [{
758
+ columns: [{ text: 'SO# : ' + this.CheckAndSetString(Id) },
759
+ { text: 'Date : ' + this.CheckAndSetString(CrDate) },
760
+ { text: 'Place Of Supply : ' + this.GetStateName(Settings.PoS) }]
761
+ },
762
+ this.CustomerDetails(Customer, Type, For, null, null, Shipment)],
763
+ };
764
+ }
765
+ static CustomerDetails(Customer, Type, For, Vehicle, Settings, Shipment) {
766
+ return {
767
+ columns: [
768
+ this.GetCustomerSO(Customer, Type, For, null, null, 'Bill To'),
769
+ this.GetCustomerSO(Shipment, Type, For, null, null, 'Ship To'),
770
+ // this.GetInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType),
771
+ // this.GetOtherDtails(Type, Id, CrDate, PrDate, PrintType, Settings, RefNo, IsPackage, PackId, PackedDate, ShipId, ShippedDate)
772
+ ], marginTop: 10
773
+ };
774
+ }
775
+ static GetCustomerSO(Customer, Type, For, Vehicle, Settings, Headding) {
776
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 300, marginLeft: 4 };
777
+ }
778
+ static GetOwnerDetails(Customer, Type, For) {
779
+ if (For === enums_1.PayTypeEnum.Insurance && Type === 'Invoice') {
780
+ return {
781
+ style: 'colum1',
782
+ stack: [this.GetUnderLine(),
783
+ {
784
+ columns: [{ text: 'Owner Details : ', style: 'hed', width: 70 },
785
+ { text: Customer.Name },
786
+ { text: this.GetAddress(Customer), },
787
+ this.GetCustPhoneNumber(Customer, Type), this.GetCustomerGSTIN(Customer)], margin: [0, 5, 0, 5],
788
+ }
789
+ ]
790
+ };
791
+ }
792
+ else {
793
+ return this.emptyObject();
794
+ }
795
+ }
796
+ static GetReceiptCustomer(Customer, Type, For, Vehicle, Settings, Headding, isOtherIndustry) {
797
+ return { stack: [this.GetReceiptCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 170, marginLeft: 2 };
798
+ }
799
+ static GetReceiptCustomerDetails(Customer, Type, Vehicle, Settings, CustHeader) {
800
+ if (tr_utils_1.TrUtils.IsNull(Customer)) {
801
+ return this.emptyObject();
802
+ }
803
+ return {
804
+ style: 'colum1',
805
+ stack: [{ text: CustHeader + ':', style: 'hed' },
806
+ { text: Customer.Name, marginTop: 2 },
807
+ { text: this.GetAddress(Customer), marginTop: 3 },
808
+ this.GetCustPhoneNumber(Customer, Type), this.GetCustomerGSTIN(Customer),
809
+ { text: 'Doctor : ' + Customer.Doctor, marginTop: 2 },]
810
+ };
811
+ }
812
+ static GetCustomer(Customer, Type, For, Vehicle, Settings, Headding, isOtherIndustry) {
813
+ if (For === enums_1.PayTypeEnum.Insurance || isOtherIndustry) {
814
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 170, marginLeft: 2 };
815
+ }
816
+ else {
817
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 230, marginLeft: 4 };
818
+ }
819
+ }
820
+ static GetInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Location, isOtherIndustry) {
821
+ if (isOtherIndustry || ((For === enums_1.PayTypeEnum.Insurance) && Type !== 'Invoice')) {
822
+ return { stack: [this.GetInsurenceDetails(For, SurName, SurPhone, SurEmail, InsComp, PolNo, PolType, Type, Location, isOtherIndustry)], width: 210, marginRight: 2 };
823
+ }
824
+ else {
825
+ return { text: '', width: 70 };
826
+ }
827
+ }
828
+ static GetVehicle(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo) {
829
+ if (For === enums_1.PayTypeEnum.Insurance) {
830
+ return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo)], width: 200 };
831
+ }
832
+ else {
833
+ return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo)], width: 250 };
834
+ }
835
+ }
836
+ static GetReceiptVehicle(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, IsProforma, Settings, isOtherIndustry) {
837
+ // if (For === PayTypeEnum.Insurance) {
838
+ // return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry)], width: 200 };
839
+ // } else {
840
+ return { stack: [this.GetReceiptVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry)], width: 250 };
841
+ // }
842
+ }
843
+ static GetReceiptVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry) {
844
+ let id;
845
+ let vehicleData;
846
+ vehicleData = [
847
+ { name: 'Bill#', value: this.CheckAndSetString(Id) },
848
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
849
+ ];
850
+ return this.GetVehicleDataTable(vehicleData);
851
+ }
852
+ static GetInsurenceDetails(For, SurName, SurPhone, SurEmail, InsComp, PolNo, PolType, Type, Location, isOtherIndustry) {
853
+ let InsuranceFields = [
854
+ { name: 'Name', value: SurName },
855
+ { name: 'Phone', value: SurPhone },
856
+ { name: 'Email', value: SurEmail }
857
+ ];
858
+ if (!isOtherIndustry && For === enums_1.PayTypeEnum.Insurance) {
859
+ return {
860
+ columns: [
861
+ {
862
+ stack: [
863
+ this.GetInsuranceDetailsTable(InsuranceFields, SurName, SurPhone, SurEmail, InsComp, PolNo, PolType),
864
+ // this.getServeyorEmail(RepairOrder),
865
+ ]
866
+ }
867
+ ]
868
+ };
869
+ }
870
+ else if (isOtherIndustry) {
871
+ let Head = (Type !== 'Invoice' && Type !== 'SalesReceipt') ? 'Service Location' : 'Ship To';
872
+ return {
873
+ columns: [
874
+ {
875
+ stack: [
876
+ this.GetCustomerDetails(Location, 'Sales Order', null, null, Head),
877
+ ]
878
+ }
879
+ ]
880
+ };
881
+ }
882
+ else {
883
+ return this.emptyObject();
884
+ }
885
+ }
886
+ static GetInsuranceDetailsTable(InsuranceFields, SurName, SurPhone, SurEmail, InsComp, PolNo, PolType) {
887
+ var List = [];
888
+ if (tr_utils_1.TrUtils.CheckInvalidSelect(PolType)) {
889
+ PolType = null;
890
+ }
891
+ List.push(this.InsCompany(InsComp), { text: InsComp, marginTop: 5 }, this.GetPolicyInfo(PolNo, PolType), this.GetSurveyor(SurName, SurPhone, SurEmail), this.GetInsuranceDetails(InsuranceFields));
892
+ return List;
893
+ }
894
+ static GetPolicyInfo(PolNo, PolType) {
895
+ let isFieldThere = false;
896
+ let InsuranceFields = [
897
+ { name: 'Policy No', value: PolNo },
898
+ { name: 'Policy Type', value: PolType },
899
+ ];
900
+ for (let i = 0; i < InsuranceFields.length; i++) {
901
+ if (!tr_utils_1.TrUtils.IsEmpty(InsuranceFields[i].value)) {
902
+ isFieldThere = true;
903
+ }
904
+ }
905
+ if (isFieldThere) {
906
+ return {
907
+ fontSize: this.BodySize,
908
+ lineHeight: 0.7,
909
+ table: {
910
+ body: this.GetInsuranceTable(InsuranceFields)
911
+ },
912
+ layout: 'noBorders',
913
+ };
914
+ }
915
+ else {
916
+ return this.emptyObject();
917
+ }
918
+ }
919
+ static GetSurveyor(SurName, SurPhone, SurEmail) {
920
+ if (SurName || SurEmail || SurName) {
921
+ return { text: 'Surveyor :', bold: true, fontSize: this.SubHeaderSize, marginTop: 2 };
922
+ }
923
+ else {
924
+ return this.emptyObject();
925
+ }
926
+ }
927
+ static emptyObject() {
928
+ let a = {};
929
+ return a;
930
+ }
931
+ static InsCompany(InsComp) {
932
+ if (InsComp) {
933
+ return { text: 'Insurance Company :', bold: true, fontSize: this.SubHeaderSize };
934
+ }
935
+ else {
936
+ return this.emptyObject();
937
+ }
938
+ }
939
+ static GetInsuranceDetails(data) {
940
+ return {
941
+ fontSize: this.BodySize,
942
+ lineHeight: 0.7,
943
+ // widths:['*','*',10],
944
+ table: {
945
+ body: this.GetInsuranceTable(data)
946
+ },
947
+ layout: 'noBorders',
948
+ };
949
+ }
950
+ static GetInsuranceTable(data) {
951
+ var body = [];
952
+ data.forEach((row) => {
953
+ if (!tr_utils_1.TrUtils.IsEmpty(row.value)) {
954
+ var dataRow = [];
955
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
956
+ dataRow.push(':');
957
+ dataRow.push({ text: (row.value).toString(), lineHeight: 0.8 });
958
+ body.push(dataRow);
959
+ }
960
+ else {
961
+ var a = [];
962
+ a.push('');
963
+ a.push('');
964
+ a.push('');
965
+ body.push(a);
966
+ }
967
+ });
968
+ return body;
969
+ }
970
+ static GetCustomerDetails(Customer, Type, Vehicle, Settings, CustHeader) {
971
+ if (tr_utils_1.TrUtils.IsNull(Customer)) {
972
+ return this.emptyObject();
973
+ }
974
+ let Data = [{ text: CustHeader + ':', style: 'hed' },
975
+ { text: Customer.Name, marginTop: 2 },
976
+ { text: this.GetAddress(Customer), marginTop: 3 },
977
+ this.GetCustPhoneNumber(Customer, Type), this.GetCustomerGSTIN(Customer), this.GetCustomerDLNo(Customer),
978
+ ,
979
+ this.GetCustomerName(Customer.CustName)];
980
+ // if(!TrUtils.IsNull(Customer.CustName)){
981
+ // Data.splice(1,0,{ text: Customer.CustName, marginTop: 2 });
982
+ // Data.splice(2,0,{ text: 'Bill To :', style: 'hed', marginTop: 2 });
983
+ // }
984
+ return {
985
+ style: 'colum1',
986
+ stack: Data
987
+ };
988
+ }
989
+ static GetNameAndAddress(RepairOrder) {
990
+ if (RepairOrder.Type === 'Invoice' || RepairOrder.Type === 'SalesReceipt') {
991
+ if (RepairOrder.AsInsuranceBilling) {
992
+ return 'Insurance Company Name & Address:';
993
+ }
994
+ else {
995
+ return 'Customer Name & Address:';
996
+ }
997
+ }
998
+ else {
999
+ if (RepairOrder.Type === 'Sales Order') {
1000
+ return 'Location:';
1001
+ }
1002
+ else {
1003
+ return 'Customer Name & Address:';
1004
+ }
1005
+ }
1006
+ }
1007
+ static GetCustomerName(Customer) {
1008
+ if (!tr_utils_1.TrUtils.IsEmpty(Customer)) {
1009
+ let GSTIN = { columns: [{ text: 'Customer Name :', width: 65, bold: true }, { text: Customer }] };
1010
+ return GSTIN;
1011
+ }
1012
+ else {
1013
+ return this.emptyObject();
1014
+ }
1015
+ }
1016
+ static GetCustomerGSTIN(Customer) {
1017
+ if (!tr_utils_1.TrUtils.IsEmpty(Customer.GSTIN)) {
1018
+ let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: Customer.GSTIN, marginTop: 1.5 }] };
1019
+ return GSTIN;
1020
+ }
1021
+ else {
1022
+ return this.emptyObject();
1023
+ }
1024
+ }
1025
+ static GetCustomerDLNo(Customer) {
1026
+ if (!tr_utils_1.TrUtils.IsEmpty(Customer.DLNo)) {
1027
+ let GSTIN = { columns: [{ text: 'DL No :', width: 33, style: 'hed' }, { text: Customer.DLNo, marginTop: 1.5 }] };
1028
+ return GSTIN;
1029
+ }
1030
+ else {
1031
+ return this.emptyObject();
1032
+ }
1033
+ }
1034
+ static GetPlaceofSupply(Vehicle, Settings) {
1035
+ if (!tr_utils_1.TrUtils.IsNull(Vehicle) && !tr_utils_1.TrUtils.IsNull(Settings) && Settings.Tax === 'TI' &&
1036
+ !tr_utils_1.TrUtils.IsNull(Settings.PoS) && !tr_utils_1.TrUtils.IsEmpty(Settings.PoS.Name)) {
1037
+ let PoS = { columns: [{ text: 'Place Of Supply :', width: 75, style: 'hed' }, { text: this.GetStateName(Settings.PoS), marginTop: 1.5 }] };
1038
+ return PoS;
1039
+ }
1040
+ else {
1041
+ return this.emptyObject();
1042
+ }
1043
+ }
1044
+ static GetCustPhoneNumber(Customer, Type) {
1045
+ if (Type !== 'Technician Copy') {
1046
+ var contact = this.GetFormatContact(Customer);
1047
+ if (contact.length !== 0) {
1048
+ return { columns: [{ text: 'Phone', width: 27, style: 'hed' }, contact] };
1049
+ }
1050
+ else {
1051
+ return this.emptyObject();
1052
+ }
1053
+ }
1054
+ else {
1055
+ return this.emptyObject();
1056
+ }
1057
+ }
1058
+ static GetAddress(Customer) {
1059
+ var Address = this.GetFormatAddress(Customer);
1060
+ if (Address.length !== 5) {
1061
+ return Address;
1062
+ }
1063
+ else {
1064
+ let a = '';
1065
+ return a;
1066
+ }
1067
+ }
1068
+ static GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo) {
1069
+ let id;
1070
+ let vehicleData;
1071
+ if (Type === 'Work Order' || Type === 'Technician Copy') {
1072
+ id = 'WO#';
1073
+ }
1074
+ else if (Type === 'SalesOrder') {
1075
+ id = 'SO#';
1076
+ }
1077
+ else if (Type === 'Sales Estimate') {
1078
+ id = 'Estimate#';
1079
+ }
1080
+ else if (Type === 'Debit Notes') {
1081
+ id = 'Debit Note#';
1082
+ }
1083
+ else if (Type === 'Credit Notes') {
1084
+ id = 'Credit Note#';
1085
+ }
1086
+ else if (Type === 'Delivery Challan') {
1087
+ id = 'Delivery Challan#';
1088
+ }
1089
+ else if (Type === 'Invoice' || Type === 'Tax Invoice' || Type === 'SalesReceipt') {
1090
+ id = 'Invoice#';
1091
+ }
1092
+ else {
1093
+ id = 'Estimate#';
1094
+ }
1095
+ if (PrintType === 'Parts Order' || tr_utils_1.TrUtils.IsNull(Vehicle)) {
1096
+ vehicleData = [
1097
+ { name: id, value: this.CheckAndSetString(Id), bold: true },
1098
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1099
+ ];
1100
+ if (!tr_utils_1.TrUtils.IsNull(AdmNo)) {
1101
+ vehicleData.push({ name: 'Admission No', value: AdmNo });
1102
+ }
1103
+ if (!tr_utils_1.TrUtils.IsNull(Settings) && Settings.Tax === 'TI' && !tr_utils_1.TrUtils.IsNull(Settings.PoS) && !tr_utils_1.TrUtils.IsEmpty(Settings.PoS.Name)) {
1104
+ vehicleData.push({ name: 'Place Of Supply', value: this.GetStateName(Settings.PoS) });
1105
+ }
1106
+ if (Type === 'Delivery Challan' || isOtherIndustry) {
1107
+ if (Type === 'Delivery Challan') {
1108
+ vehicleData.push({ name: 'Challan Type', value: '' });
1109
+ }
1110
+ else {
1111
+ vehicleData.push({ name: 'Ref. No', value: BL === null || BL === void 0 ? void 0 : BL.RefNo });
1112
+ }
1113
+ vehicleData.push({ name: 'Carrier Name/Agent', value: BL === null || BL === void 0 ? void 0 : BL.Cour });
1114
+ vehicleData.push({ name: 'Bill of Lading/LR-RR No', value: BL === null || BL === void 0 ? void 0 : BL.No });
1115
+ vehicleData.push({ name: 'Motor Vehicle No ', value: BL === null || BL === void 0 ? void 0 : BL.VNo });
1116
+ vehicleData.push({ name: 'E-Way Bill No', value: BL === null || BL === void 0 ? void 0 : BL.EWay });
1117
+ }
1118
+ }
1119
+ else {
1120
+ vehicleData = [
1121
+ { name: id, value: this.CheckAndSetString(Id) },
1122
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1123
+ ];
1124
+ if (!tr_utils_1.TrUtils.IsNull(PrDate) && Type !== 'Invoice' && Type !== 'Estimate' && Type !== 'Supplementary Estimate' && Type !== 'Tax Invoice') {
1125
+ vehicleData.push({ name: 'Delivery Date', value: this.CheckAndSetString(PrDate) });
1126
+ }
1127
+ // if (!TrUtils.IsNull(Settings) && Settings.Tax === 'TI' && !TrUtils.IsNull(Settings.PoS) && !TrUtils.IsEmpty(Settings.PoS.Name)) {
1128
+ // vehicleData.push({ name: 'Place Of Supply', value: this.GetStateName(Settings.PoS) });
1129
+ // }
1130
+ if (isOtherIndustry) {
1131
+ vehicleData.push({ name: 'Serial No', value: this.CheckAndSetString(Vehicle.SNo) });
1132
+ }
1133
+ else {
1134
+ vehicleData.push({ name: 'Regn. No', value: this.CheckAndSetString(Vehicle.RegNo) });
1135
+ if (Type === 'Invoice' && !IsProforma) {
1136
+ vehicleData.push({ name: 'Mileage', value: this.CheckAndSetString(MOut) });
1137
+ }
1138
+ else {
1139
+ vehicleData.push({ name: 'Mileage', value: this.CheckAndSetString(MIn) });
1140
+ }
1141
+ if (Type === 'Invoice' && !tr_utils_1.TrUtils.IsNull(TypeName)) {
1142
+ vehicleData.push({ name: 'RO Type', value: TypeName });
1143
+ }
1144
+ if (Type === 'Invoice' && !tr_utils_1.TrUtils.IsNull(ROCode)) {
1145
+ vehicleData.push({ name: 'RO#', value: ROCode });
1146
+ }
1147
+ }
1148
+ let Product;
1149
+ let ProdType = 'Equipment';
1150
+ Product = this.CheckAndSetString(Vehicle.Make) + ' ' + this.CheckAndSetString(Vehicle.Model);
1151
+ if (!isOtherIndustry) {
1152
+ ProdType = 'Vehicle';
1153
+ Product = Product + ' ' + this.CheckAndSetString(Vehicle.Var);
1154
+ }
1155
+ let a = [
1156
+ { name: ProdType, value: Product },
1157
+ ];
1158
+ if (!isOtherIndustry) {
1159
+ if (!tr_utils_1.TrUtils.IsEmpty(Vehicle.VIN)) {
1160
+ a.push({ name: 'Chassis No', value: this.CheckAndSetString(Vehicle.VIN) });
1161
+ }
1162
+ if (!tr_utils_1.TrUtils.IsEmpty(Vehicle.EngNo)) {
1163
+ a.push({ name: 'Engine No', value: this.CheckAndSetString(Vehicle.EngNo) });
1164
+ }
1165
+ }
1166
+ for (let i = 0; i < a.length; i++) {
1167
+ vehicleData.push(a[i]);
1168
+ }
1169
+ }
1170
+ return this.GetVehicleDataTable(vehicleData);
1171
+ }
1172
+ static GetStateName(PlaceofSupply) {
1173
+ if (tr_utils_1.TrUtils.IsNull(PlaceofSupply)) {
1174
+ return '';
1175
+ }
1176
+ let supplyName = PlaceofSupply.Name + ' (' + PlaceofSupply.GCode + ')';
1177
+ return supplyName;
1178
+ }
1179
+ static GetOtherDtails(Type, Id, CrDate, PrDate, PrintType, Settings, RefNo, IsPackage, PackId, PackedDate, ShipId, ShippedDate) {
1180
+ let id;
1181
+ let vehicleData;
1182
+ if (Type === 'SalesOrder') {
1183
+ id = 'SO#';
1184
+ }
1185
+ else {
1186
+ id = 'Estimate#';
1187
+ }
1188
+ if (PrintType === 'Parts Order') {
1189
+ vehicleData = [
1190
+ { name: id, value: this.CheckAndSetString(Id) },
1191
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1192
+ ];
1193
+ }
1194
+ else {
1195
+ vehicleData = [
1196
+ { name: id, value: this.CheckAndSetString(Id) },
1197
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1198
+ ];
1199
+ if (!tr_utils_1.TrUtils.IsNull(Settings) && Settings.Tax === 'TI' && !tr_utils_1.TrUtils.IsNull(Settings.PoS) && !tr_utils_1.TrUtils.IsEmpty(Settings.PoS.Name)) {
1200
+ vehicleData.push({ name: 'Place Of Supply', value: this.GetStateName(Settings.PoS) });
1201
+ }
1202
+ if (!tr_utils_1.TrUtils.IsNull(RefNo)) {
1203
+ vehicleData.push({ name: 'Reference#', value: RefNo });
1204
+ }
1205
+ if (IsPackage) {
1206
+ if (!tr_utils_1.TrUtils.IsNull(PackId)) {
1207
+ vehicleData.push({ name: 'Package#', value: PackId });
1208
+ }
1209
+ if (!tr_utils_1.TrUtils.IsNull(PackedDate)) {
1210
+ vehicleData.push({ name: 'Packed Date', value: this.CheckAndSetString(PackedDate) });
1211
+ }
1212
+ }
1213
+ else {
1214
+ if (!tr_utils_1.TrUtils.IsNull(ShipId)) {
1215
+ vehicleData.push({ name: 'Shipment#', value: ShipId });
1216
+ }
1217
+ if (!tr_utils_1.TrUtils.IsNull(ShippedDate)) {
1218
+ vehicleData.push({ name: 'Shipped Date', value: this.CheckAndSetString(ShippedDate) });
1219
+ }
1220
+ }
1221
+ // if (!TrUtils.IsNull(PrDate) && Type !== 'Invoice' && Type !== 'Tax Invoice') {
1222
+ // vehicleData.push({ name: 'Delivery Date', value: this.CheckAndSetString(PrDate) });
1223
+ // }
1224
+ }
1225
+ return this.GetVehicleDataTable(vehicleData);
1226
+ }
1227
+ static CheckAndSetString(Value) {
1228
+ if (tr_utils_1.TrUtils.IsNull(Value)) {
1229
+ Value = '';
1230
+ }
1231
+ return Value;
1232
+ }
1233
+ static GetVehicleDataTable(vehicleData) {
1234
+ return {
1235
+ lineHeight: 0.7,
1236
+ fontSize: this.BodySize,
1237
+ table: {
1238
+ body: this.GetDataTable(vehicleData, false)
1239
+ },
1240
+ layout: 'noBorders',
1241
+ };
1242
+ }
1243
+ static GetFormatContact(CustomerObj) {
1244
+ var contactnew = '';
1245
+ if (!tr_utils_1.TrUtils.IsNull(CustomerObj.Cons)) {
1246
+ CustomerObj.Cons.forEach((Contact) => {
1247
+ contactnew = contactnew + '(' + Contact.Type + '):' + Contact.No + '\n';
1248
+ });
1249
+ }
1250
+ return contactnew;
1251
+ }
1252
+ static GetFormatAddress(CustomerObj) {
1253
+ var Addressnew = '';
1254
+ if (!tr_utils_1.TrUtils.IsNull(CustomerObj.Adrs)) {
1255
+ CustomerObj.Adrs.forEach((Adrs) => {
1256
+ Addressnew = Addressnew + Adrs + '\n';
1257
+ });
1258
+ }
1259
+ return Addressnew;
1260
+ }
1261
+ static GetDisplayTable() {
1262
+ return { text: '', fontSize: 10, bold: true, margin: [0, 0, 0, 5] };
1263
+ }
1264
+ static GetHeaders(PrintPartNumber) {
1265
+ let headersNames;
1266
+ if (PrintPartNumber) {
1267
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
1268
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
1269
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
1270
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
1271
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
1272
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 }, {},
1273
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
1274
+ ],
1275
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
1276
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
1277
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
1278
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
1279
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
1280
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
1281
+ ]];
1282
+ }
1283
+ else {
1284
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
1285
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
1286
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
1287
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'right', lineHeight: 0.6 },
1288
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.6 }, {},
1289
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
1290
+ ],
1291
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'Desc', lineHeight: 0.5 },
1292
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
1293
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
1294
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
1295
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
1296
+ ]];
1297
+ }
1298
+ return headersNames;
1299
+ }
1300
+ static PartsTaxAmounts1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1301
+ if (ShowTaxColumn) {
1302
+ return {
1303
+ stack: [this.AllHSNPartCGSTTaxListTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
1304
+ };
1305
+ }
1306
+ else {
1307
+ return '';
1308
+ }
1309
+ }
1310
+ static PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1311
+ if (ShowTaxColumn) {
1312
+ return {
1313
+ stack: [this.AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
1314
+ };
1315
+ }
1316
+ else {
1317
+ return '';
1318
+ }
1319
+ }
1320
+ static AllHSNPartCGSTTaxListTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1321
+ if (ShowIGST) {
1322
+ return {
1323
+ style: 'tableExample',
1324
+ table: {
1325
+ widths: [40, 30, 45, 45],
1326
+ headerRows: 1,
1327
+ body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1328
+ },
1329
+ layout: this.HeaderLineStyle(),
1330
+ };
1331
+ }
1332
+ else {
1333
+ return {
1334
+ style: 'tableExample',
1335
+ table: {
1336
+ widths: [50, 25, 45, 25, 45, 50],
1337
+ headerRows: 1,
1338
+ body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1339
+ },
1340
+ layout: this.HeaderLineStyle(),
1341
+ };
1342
+ }
1343
+ }
1344
+ static AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1345
+ if (ShowIGST) {
1346
+ return {
1347
+ style: 'tableExample',
1348
+ table: {
1349
+ widths: [40, 30, 45, 45],
1350
+ headerRows: 1,
1351
+ body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1352
+ },
1353
+ layout: this.HeaderLineStyle(),
1354
+ };
1355
+ }
1356
+ else {
1357
+ return {
1358
+ style: 'tableExample',
1359
+ table: {
1360
+ widths: [30, 20, 20, 45, 45],
1361
+ headerRows: 1,
1362
+ body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1363
+ },
1364
+ layout: this.HeaderLineStyle(),
1365
+ };
1366
+ }
1367
+ }
1368
+ static AllPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowTaxColumn) {
1369
+ return {
1370
+ style: 'tableExample',
1371
+ table: {
1372
+ widths: [20, 20, 40, 40],
1373
+ body: this.ALLPartsCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowTaxColumn)
1374
+ },
1375
+ layout: this.HeaderLineStyle(),
1376
+ };
1377
+ }
1378
+ static HeaderLineStyle() {
1379
+ return {
1380
+ hLineWidth: function (i, node) {
1381
+ return (i === 1) ? 0.1 : 0;
1382
+ },
1383
+ vLineWidth: function (i, node) {
1384
+ return (i === 0 || i === node.table.widths.length) ? 0 : 0;
1385
+ },
1386
+ hLineColor: function (i, node) {
1387
+ let color;
1388
+ if (i === 0 || i === node.table.body.length) {
1389
+ color = 'black';
1390
+ }
1391
+ else {
1392
+ if (i === 1) {
1393
+ color = 'lightgray';
1394
+ }
1395
+ else {
1396
+ color = 'lightgray';
1397
+ }
1398
+ }
1399
+ return color;
1400
+ },
1401
+ };
1402
+ }
1403
+ static CreateHeadingAllPartCGSTTaxList() {
1404
+ let HeaderNames = [{ text: 'GST(%)', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CombinedTaxPercentage' },
1405
+ // { text: 'SGST', style: 'tableheader', fontSize: 6,lineHeight:0.3, Field: 'SGST' },
1406
+ { text: 'Count', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
1407
+ { text: 'Taxble Value', style: 'tableheader', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
1408
+ { text: 'Amount', style: 'tableheader', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
1409
+ ];
1410
+ return HeaderNames;
1411
+ }
1412
+ static ALLPartsCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowTaxColumn) {
1413
+ if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1414
+ var body = [];
1415
+ let columns = this.CreateHeadingAllPartCGSTTaxList();
1416
+ body.push(columns);
1417
+ PartsTaxInfo.forEach((part) => {
1418
+ var dataRow = [];
1419
+ columns.forEach((column) => {
1420
+ if (!tr_utils_1.TrUtils.IsNull(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])) {
1421
+ if (column.Field === 'TotalTaxAmount' || column.Field === 'TotalTaxableAmount') {
1422
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
1423
+ }
1424
+ else {
1425
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
1426
+ }
1427
+ }
1428
+ else {
1429
+ part[column.Field] = '';
1430
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
1431
+ }
1432
+ });
1433
+ body.push(dataRow);
1434
+ });
1435
+ return body;
1436
+ }
1437
+ else {
1438
+ return [{}];
1439
+ }
1440
+ }
1441
+ static CreateHeadingAllHSNTaxList(ShowIGST) {
1442
+ let HeaderNames = [{ text: 'HSN', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'HSN' },
1443
+ // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1444
+ // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
1445
+ // { text: 'Count', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
1446
+ { text: 'Taxable Value', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
1447
+ { text: 'Amount', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
1448
+ ];
1449
+ if (ShowIGST) {
1450
+ HeaderNames.splice(1, 0, { text: 'IGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
1451
+ }
1452
+ else {
1453
+ HeaderNames.splice(1, 0, { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1454
+ HeaderNames.splice(2, 0, { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' });
1455
+ }
1456
+ return HeaderNames;
1457
+ }
1458
+ static CreateHeadingAllTaxList(ShowIGST) {
1459
+ let HeaderNames = [
1460
+ // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1461
+ // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
1462
+ // { text: 'Count', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
1463
+ { text: 'Taxable Value', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
1464
+ { text: 'Tax Amount', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
1465
+ ];
1466
+ if (ShowIGST) {
1467
+ HeaderNames.splice(1, 0, { text: 'IGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
1468
+ HeaderNames.splice(2, 0, { text: 'IGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGSTAmt' });
1469
+ }
1470
+ else {
1471
+ HeaderNames.splice(1, 0, { text: 'CGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1472
+ HeaderNames.splice(2, 0, { text: 'CGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGSTAmt' });
1473
+ HeaderNames.splice(3, 0, { text: 'SGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1474
+ HeaderNames.splice(4, 0, { text: 'SGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'SGSTAmt' });
1475
+ }
1476
+ return HeaderNames;
1477
+ }
1478
+ static CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1479
+ if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1480
+ var body = [];
1481
+ let columns = this.CreateHeadingAllTaxList(ShowIGST);
1482
+ body.push(columns);
1483
+ PartsTaxInfo.forEach((part) => {
1484
+ var dataRow = [];
1485
+ columns.forEach((column) => {
1486
+ if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) &&
1487
+ !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt'
1488
+ || column.Field === 'TotalTaxAmount') {
1489
+ if (column.Field === 'SGSTLaborAmt') {
1490
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', opacity: 0.7, nowrap: true, fontSize: 6 });
1491
+ }
1492
+ else {
1493
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', opacity: 0.7, nowrap: true, fontSize: 6 });
1494
+ }
1495
+ }
1496
+ else {
1497
+ part[column.Field] = '';
1498
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', opacity: 0.7, fontSize: 6 });
1499
+ }
1500
+ });
1501
+ body.push(dataRow);
1502
+ });
1503
+ return body;
1504
+ }
1505
+ else {
1506
+ return [{}];
1507
+ }
1508
+ }
1509
+ static CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1510
+ if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1511
+ var body = [];
1512
+ let columns = this.CreateHeadingAllHSNTaxList(ShowIGST);
1513
+ body.push(columns);
1514
+ PartsTaxInfo.forEach((part) => {
1515
+ var dataRow = [];
1516
+ columns.forEach((column) => {
1517
+ if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) &&
1518
+ !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
1519
+ || column.Field === 'TotalTaxAmount') {
1520
+ if (column.Field === 'SGSTLaborAmt') {
1521
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
1522
+ }
1523
+ else {
1524
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
1525
+ }
1526
+ }
1527
+ else {
1528
+ part[column.Field] = '';
1529
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
1530
+ }
1531
+ });
1532
+ body.push(dataRow);
1533
+ });
1534
+ return body;
1535
+ }
1536
+ else {
1537
+ return [{}];
1538
+ }
1539
+ }
1540
+ static GetHCFinalTotalDetails(BasicLaborTotal, OverAllMainLaborDiscount, LCGST, LSGST, LIGST, PIGST, ShowIGST, ShowTaxColumn, BasicPartsTotal, OverAllMainPartsDiscount, PCGST, PSGST, PartsTaxInfo, ShowAccParts, LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, For, OverAllRecordTotal, Rounded, GrandTotal, ShowDetailedLaborTaxInfo, ShowDetailedPartTaxInfo, istaxable, LaborTotalTax, PartTotalTax, Consolidate, From, Adj, STotal) {
1541
+ let totalDisc;
1542
+ let totalTax;
1543
+ if (!Consolidate) {
1544
+ totalTax = tr_utils_1.TrUtils.FixPriceValue(Number(LaborTotalTax) + Number(PartTotalTax));
1545
+ if (istaxable) {
1546
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount));
1547
+ }
1548
+ else {
1549
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount) + Number(OverAllRecordDiscount));
1550
+ }
1551
+ }
1552
+ return {
1553
+ columns: [
1554
+ // this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST,
1555
+ // LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo),
1556
+ { text: '', width: 225 },
1557
+ // {
1558
+ // stack: [
1559
+ // this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST,
1560
+ // PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From),
1561
+ // this.PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST,
1562
+ // ShowTaxColumn)
1563
+ // ]
1564
+ // },
1565
+ { text: '', width: 230 },
1566
+ // this.GrandTotal(LaborAfterGST, PartsAfterGST, totalDisc, For, OverAllRecordTotal, Rounded, GrandTotal)
1567
+ this.GrandTotal(BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal)
1568
+ ]
1569
+ // columnGap: 40
1570
+ ,
1571
+ marginLeft: 10
1572
+ };
1573
+ }
1574
+ static GetFinalTotalDetails1(BasicLaborTotal, OverAllMainLaborDiscount, LCGST, LSGST, LIGST, PIGST, ShowIGST, ShowTaxColumn, BasicPartsTotal, OverAllMainPartsDiscount, PCGST, PSGST, PartsTaxInfo, ShowAccParts, LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, For, OverAllRecordTotal, Rounded, GrandTotal, ShowDetailedLaborTaxInfo, ShowDetailedPartTaxInfo, istaxable, LaborTotalTax, PartTotalTax, Consolidate, From, Adj, CustLaborTaxGroupDataByPerc, STotal, isAuto) {
1575
+ let totalDisc;
1576
+ let totalTax;
1577
+ if (!Consolidate) {
1578
+ totalTax = tr_utils_1.TrUtils.FixPriceValue(Number(LaborTotalTax) + Number(PartTotalTax));
1579
+ if (istaxable) {
1580
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount));
1581
+ }
1582
+ else {
1583
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount) + Number(OverAllRecordDiscount));
1584
+ }
1585
+ }
1586
+ let serviceName;
1587
+ let itemName;
1588
+ if (isAuto) {
1589
+ serviceName = 'Labor Tax';
1590
+ itemName = 'Parts Tax';
1591
+ }
1592
+ else {
1593
+ serviceName = 'Service Tax';
1594
+ itemName = 'Items Tax';
1595
+ }
1596
+ return {
1597
+ columns: [
1598
+ // this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST,
1599
+ // LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo),
1600
+ // { text: '', width: 10 },
1601
+ {
1602
+ stack: [
1603
+ // this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST,
1604
+ // PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From),
1605
+ { text: (istaxable && CustLaborTaxGroupDataByPerc.length !== 0) ? serviceName : '', fontSize: 7, opacity: 0.8 },
1606
+ this.PartsTaxAmounts1(CustLaborTaxGroupDataByPerc, ShowAccParts, ShowIGST, ShowTaxColumn),
1607
+ { text: (istaxable && PartsTaxInfo.length !== 0) ? itemName : '', fontSize: 7, opacity: 0.8 },
1608
+ this.PartsTaxAmounts1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1609
+ ]
1610
+ },
1611
+ // { text: '', width: 60 },
1612
+ // this.GrandTotal(LaborAfterGST, PartsAfterGST, totalDisc, For, OverAllRecordTotal, Rounded, GrandTotal)
1613
+ this.GrandTotal1(BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal)
1614
+ ]
1615
+ // columnGap: 40
1616
+ ,
1617
+ marginLeft: 10
1618
+ };
1619
+ }
1620
+ static GrandTotal1(LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal) {
1621
+ let AccountFields = [
1622
+ // { name: 'Labor Total', value: LaborAfterGST },
1623
+ // { name: 'Part Total', value: PartsAfterGST },
1624
+ { name: 'Total Disc.', value: OverAllRecordDiscount },
1625
+ ];
1626
+ if (!Consolidate) {
1627
+ AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue(STotal) });
1628
+ }
1629
+ if (!tr_utils_1.TrUtils.IsEmpty(totalTax)) {
1630
+ AccountFields.push({ name: 'Total Tax', value: totalTax });
1631
+ }
1632
+ if (!tr_utils_1.TrUtils.IsEmpty(Adj)) {
1633
+ if (Adj > 0) {
1634
+ Adj = '+' + tr_utils_1.TrUtils.FixPriceValue(Adj);
1635
+ }
1636
+ AccountFields.push({ name: 'Adjust', value: Adj });
1637
+ }
1638
+ if (For === enums_1.PayTypeEnum.Insurance) {
1639
+ let total = {
1640
+ name: 'Total',
1641
+ value: OverAllRecordTotal
1642
+ };
1643
+ let Rounding = { name: 'Rounding', value: Rounded };
1644
+ if (Rounding.value > 0) {
1645
+ Rounding.value = '+' + Rounding.value;
1646
+ }
1647
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
1648
+ AccountFields.push(total);
1649
+ AccountFields.push(Rounding);
1650
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
1651
+ AccountFields.push(FinalTotal);
1652
+ }
1653
+ }
1654
+ else {
1655
+ let total = {
1656
+ name: 'Total',
1657
+ value: OverAllRecordTotal
1658
+ };
1659
+ let Rounding = { name: 'Rounding', value: Rounded };
1660
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
1661
+ if (Rounding.value > 0) {
1662
+ Rounding.value = '+' + Rounding.value;
1663
+ }
1664
+ AccountFields.push(total);
1665
+ AccountFields.push(Rounding);
1666
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
1667
+ AccountFields.push(FinalTotal);
1668
+ }
1669
+ }
1670
+ return {
1671
+ style: ['columnheader', 'TotalsStyles'],
1672
+ lineHeight: 0.7,
1673
+ marginBottom: 5,
1674
+ width: 'auto',
1675
+ table: {
1676
+ body: this.GrandTotalTable(AccountFields)
1677
+ },
1678
+ layout: 'noBorders'
1679
+ // layout: {
1680
+ // hLineWidth: function (i: any, node: any) {
1681
+ // return (i === 0) ? 1 : 0;
1682
+ // },
1683
+ // vLineWidth: function (i: any, node: any) {
1684
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
1685
+ // }
1686
+ // },
1687
+ };
1688
+ }
1689
+ static GetFinalTotalDetails(BasicLaborTotal, OverAllMainLaborDiscount, LCGST, LSGST, LIGST, PIGST, ShowIGST, ShowTaxColumn, BasicPartsTotal, OverAllMainPartsDiscount, PCGST, PSGST, PartsTaxInfo, ShowAccParts, LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, For, OverAllRecordTotal, Rounded, GrandTotal, ShowDetailedLaborTaxInfo, ShowDetailedPartTaxInfo, istaxable, LaborTotalTax, PartTotalTax, Consolidate, From, Adj, STotal) {
1690
+ let totalDisc;
1691
+ let totalTax;
1692
+ if (!Consolidate) {
1693
+ totalTax = tr_utils_1.TrUtils.FixPriceValue(Number(LaborTotalTax) + Number(PartTotalTax));
1694
+ if (istaxable) {
1695
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount));
1696
+ }
1697
+ else {
1698
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount) + Number(OverAllRecordDiscount));
1699
+ }
1700
+ }
1701
+ return {
1702
+ columns: [
1703
+ this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST, LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo, Consolidate),
1704
+ { text: '', width: 10 },
1705
+ {
1706
+ stack: [
1707
+ this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST, PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From, Consolidate),
1708
+ this.PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1709
+ ]
1710
+ },
1711
+ { text: '', width: 60 },
1712
+ // this.GrandTotal(LaborAfterGST, PartsAfterGST, totalDisc, For, OverAllRecordTotal, Rounded, GrandTotal)
1713
+ this.GrandTotal(BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal)
1714
+ ]
1715
+ // columnGap: 40
1716
+ ,
1717
+ marginLeft: 10
1718
+ };
1719
+ }
1720
+ static GetDebitTotalDetails(BasicLaborTotal, OverAllMainLaborDiscount, LCGST, LSGST, LIGST, PIGST, ShowIGST, ShowTaxColumn, BasicPartsTotal, OverAllMainPartsDiscount, PCGST, PSGST, PartsTaxInfo, ShowAccParts, LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, For, OverAllRecordTotal, Rounded, GrandTotal, ShowDetailedLaborTaxInfo, ShowDetailedPartTaxInfo, istaxable, LaborTotalTax, PartTotalTax, Consolidate, From) {
1721
+ let totalDisc;
1722
+ let totalTax;
1723
+ if (!Consolidate) {
1724
+ totalTax = tr_utils_1.TrUtils.FixPriceValue(Number(PartTotalTax));
1725
+ if (istaxable) {
1726
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainPartsDiscount));
1727
+ }
1728
+ else {
1729
+ totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(OverAllMainPartsDiscount));
1730
+ }
1731
+ }
1732
+ return {
1733
+ columns: [
1734
+ // this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST,
1735
+ // LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo),
1736
+ { text: '', width: 100 },
1737
+ {
1738
+ stack: [
1739
+ this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST, PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From, Consolidate),
1740
+ this.PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1741
+ ]
1742
+ },
1743
+ { text: '', width: 100 },
1744
+ { text: '', width: 80 },
1745
+ this.DebitGrandTotal(BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal)
1746
+ ]
1747
+ // columnGap: 40
1748
+ ,
1749
+ marginLeft: 10
1750
+ };
1751
+ }
1752
+ static DebitGrandTotal(LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal) {
1753
+ let AccountFields = [
1754
+ // { name: 'Labor Total', value: LaborAfterGST },
1755
+ // { name: 'Part Total', value: PartsAfterGST },
1756
+ { name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))) },
1757
+ { name: 'Total Disc.', value: OverAllRecordDiscount },
1758
+ ];
1759
+ if (!tr_utils_1.TrUtils.IsEmpty(totalTax)) {
1760
+ AccountFields.push({ name: 'Total Tax', value: totalTax });
1761
+ }
1762
+ if (For === enums_1.PayTypeEnum.Insurance) {
1763
+ let total = {
1764
+ name: 'Total',
1765
+ value: OverAllRecordTotal
1766
+ };
1767
+ let Rounding = { name: 'Rounding', value: Rounded };
1768
+ if (Rounding.value > 0) {
1769
+ Rounding.value = '+' + Rounding.value;
1770
+ }
1771
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
1772
+ AccountFields.push(total);
1773
+ AccountFields.push(Rounding);
1774
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
1775
+ AccountFields.push(FinalTotal);
1776
+ }
1777
+ }
1778
+ else {
1779
+ let total = {
1780
+ name: 'Total',
1781
+ value: OverAllRecordTotal
1782
+ };
1783
+ let Rounding = { name: 'Rounding', value: Rounded };
1784
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
1785
+ if (Rounding.value > 0) {
1786
+ Rounding.value = '+' + Rounding.value;
1787
+ }
1788
+ AccountFields.push(total);
1789
+ AccountFields.push(Rounding);
1790
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
1791
+ AccountFields.push(FinalTotal);
1792
+ }
1793
+ }
1794
+ return {
1795
+ style: ['columnheader', 'TotalsStyles'],
1796
+ lineHeight: 0.7,
1797
+ marginBottom: 5,
1798
+ fontSize: 7,
1799
+ table: {
1800
+ body: this.GrandTotalTable(AccountFields)
1801
+ },
1802
+ layout: 'noBorders'
1803
+ // layout: {
1804
+ // hLineWidth: function (i: any, node: any) {
1805
+ // return (i === 0) ? 1 : 0;
1806
+ // },
1807
+ // vLineWidth: function (i: any, node: any) {
1808
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
1809
+ // }
1810
+ // },
1811
+ };
1812
+ }
1813
+ static GetPOTotalDetails(ROPrintData) {
1814
+ return {
1815
+ columns: [
1816
+ {
1817
+ stack: [
1818
+ this.GetTaxOnParts(ROPrintData.BasicPartsTotal, ROPrintData.OverAllMainPartsDiscount, ROPrintData.PCGST, ROPrintData.PSGST, ROPrintData.PIGST, ROPrintData.ShowIGST, ROPrintData.ShowAccParts, ROPrintData.ShowTaxColumn, ROPrintData.ShowDetailedPartTaxInfo, ROPrintData.Type, ROPrintData.Consolidate),
1819
+ this.PartsTaxAmounts(ROPrintData.PartsTaxInfo, ROPrintData.ShowAccParts, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn)
1820
+ ]
1821
+ }, { text: '', width: 200 }, this.GrandTotal(ROPrintData.LaborAfterGST, ROPrintData.PartsAfterGST, ROPrintData.OverAllRecordDiscount, null, ROPrintData.For, ROPrintData.OverAllRecordTotal, ROPrintData.Rounded, ROPrintData.GrandTotal, ROPrintData.Adj, ROPrintData.Consolidate, null)
1822
+ ]
1823
+ // columnGap: 40
1824
+ ,
1825
+ marginLeft: 10
1826
+ };
1827
+ }
1828
+ static GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST, PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From, Consolidate) {
1829
+ let istheretax = false;
1830
+ let PartsTotal = [];
1831
+ // if (!TrUtils.IsFixedZero(OverAllMainPartsDiscount)) {
1832
+ // PartsTotal.push({ name: 'Discount On Parts', value: OverAllMainPartsDiscount });
1833
+ // }
1834
+ if (!Consolidate) {
1835
+ if (!tr_utils_1.TrUtils.IsFixedZero(BasicPartsTotal) && (From !== 'Countersale')) {
1836
+ PartsTotal.unshift({ name: 'Parts Total', value: BasicPartsTotal });
1837
+ }
1838
+ }
1839
+ if (!ShowAccParts && ShowTaxColumn && ShowDetailedPartTaxInfo) {
1840
+ if (From === 'Sales' || From === 'Countersale') {
1841
+ if (ShowIGST) {
1842
+ PartsTotal.push({ name: 'IGST', value: PIGST });
1843
+ }
1844
+ else {
1845
+ PartsTotal.push({ name: 'CGST', value: PCGST });
1846
+ PartsTotal.push({ name: 'SGST', value: PSGST });
1847
+ }
1848
+ }
1849
+ else {
1850
+ if (ShowIGST) {
1851
+ PartsTotal.push({ name: 'IGST On Parts', value: PIGST });
1852
+ }
1853
+ else {
1854
+ PartsTotal.push({ name: 'CGST On Parts', value: PCGST });
1855
+ PartsTotal.push({ name: 'SGST On Parts', value: PSGST });
1856
+ }
1857
+ }
1858
+ }
1859
+ if (PartsTotal.length !== 0) {
1860
+ return {
1861
+ style: ['columnheader', 'TotalsStyles'],
1862
+ lineHeight: 0.7,
1863
+ fontSize: 7,
1864
+ marginBottom: 5,
1865
+ table: {
1866
+ body: this.GetDataTable(PartsTotal, true)
1867
+ },
1868
+ layout: 'noBorders',
1869
+ };
1870
+ }
1871
+ else {
1872
+ return this.emptyObject();
1873
+ }
1874
+ }
1875
+ static GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST, LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo, Consolidate) {
1876
+ let istheretax = false;
1877
+ let LaborTotal = [];
1878
+ // if (!TrUtils.IsFixedZero(OverAllMainLaborDiscount)) {
1879
+ // LaborTotal.push({ name: 'Discount On Labor', value: OverAllMainLaborDiscount });
1880
+ // }
1881
+ //consolidate and no-tax i want show labor discount
1882
+ if (!Consolidate) {
1883
+ if (!tr_utils_1.TrUtils.IsFixedZero(BasicLaborTotal)) {
1884
+ LaborTotal.unshift({ name: 'Labor Total', value: BasicLaborTotal });
1885
+ }
1886
+ }
1887
+ if (ShowTaxColumn && ShowDetailedLaborTaxInfo
1888
+ && (!tr_utils_1.TrUtils.IsFixedZero(LIGST) || (!tr_utils_1.TrUtils.IsFixedZero(LCGST) || !tr_utils_1.TrUtils.IsFixedZero(LSGST)))) {
1889
+ if (ShowIGST) {
1890
+ LaborTotal.push({ name: 'IGST On Labor', value: LIGST });
1891
+ }
1892
+ else {
1893
+ LaborTotal.push({ name: 'CGST On Labor', value: LCGST });
1894
+ LaborTotal.push({ name: 'SGST On Labor', value: LSGST });
1895
+ }
1896
+ }
1897
+ if (LaborTotal.length !== 0) {
1898
+ return {
1899
+ style: ['columnheader', 'TotalsStyles'],
1900
+ lineHeight: 0.7,
1901
+ fontSize: 7,
1902
+ marginBottom: 5,
1903
+ table: {
1904
+ body: this.GetDataTable(LaborTotal, true)
1905
+ },
1906
+ layout: 'noBorders',
1907
+ };
1908
+ }
1909
+ else {
1910
+ return this.emptyObject();
1911
+ }
1912
+ }
1913
+ static GrandTotal(LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, subTotal) {
1914
+ let AccountFields = [
1915
+ // { name: 'Labor Total', value: LaborAfterGST },
1916
+ // { name: 'Part Total', value: PartsAfterGST },
1917
+ { name: 'Total Disc.', value: OverAllRecordDiscount },
1918
+ ];
1919
+ if (!Consolidate && !tr_utils_1.TrUtils.IsNull(subTotal)) {
1920
+ AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(subTotal))) });
1921
+ }
1922
+ else {
1923
+ if (!Consolidate) {
1924
+ AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))) });
1925
+ }
1926
+ }
1927
+ if (!tr_utils_1.TrUtils.IsEmpty(totalTax)) {
1928
+ AccountFields.push({ name: 'Total Tax', value: totalTax });
1929
+ }
1930
+ if (!tr_utils_1.TrUtils.IsEmpty(Adj)) {
1931
+ if (Adj > 0) {
1932
+ Adj = '+' + tr_utils_1.TrUtils.FixPriceValue(Adj);
1933
+ }
1934
+ AccountFields.push({ name: 'Adjust', value: Adj });
1935
+ }
1936
+ if (For === enums_1.PayTypeEnum.Insurance) {
1937
+ let total = {
1938
+ name: 'Total',
1939
+ value: OverAllRecordTotal
1940
+ };
1941
+ let Rounding = { name: 'Rounding', value: Rounded };
1942
+ if (Rounding.value > 0) {
1943
+ Rounding.value = '+' + Rounding.value;
1944
+ }
1945
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
1946
+ AccountFields.push(total);
1947
+ AccountFields.push(Rounding);
1948
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
1949
+ AccountFields.push(FinalTotal);
1950
+ }
1951
+ }
1952
+ else {
1953
+ let total = {
1954
+ name: 'Total',
1955
+ value: OverAllRecordTotal
1956
+ };
1957
+ let Rounding = { name: 'Rounding', value: Rounded };
1958
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
1959
+ if (Rounding.value > 0) {
1960
+ Rounding.value = '+' + Rounding.value;
1961
+ }
1962
+ AccountFields.push(total);
1963
+ AccountFields.push(Rounding);
1964
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
1965
+ AccountFields.push(FinalTotal);
1966
+ }
1967
+ }
1968
+ return {
1969
+ style: ['columnheader', 'TotalsStyles'],
1970
+ lineHeight: 0.7,
1971
+ marginBottom: 5,
1972
+ width: 'auto',
1973
+ table: {
1974
+ body: this.GrandTotalTable(AccountFields)
1975
+ },
1976
+ layout: 'noBorders'
1977
+ // layout: {
1978
+ // hLineWidth: function (i: any, node: any) {
1979
+ // return (i === 0) ? 1 : 0;
1980
+ // },
1981
+ // vLineWidth: function (i: any, node: any) {
1982
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
1983
+ // }
1984
+ // },
1985
+ };
1986
+ }
1987
+ static SalesGrandTotal(LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, For, OverAllRecordTotal, Rounded, GrandTotal) {
1988
+ let AccountFields = [
1989
+ // { name: 'Labor Total', value: LaborAfterGST },
1990
+ // { name: 'Part Total', value: PartsAfterGST },
1991
+ { name: 'Disc.', value: OverAllRecordDiscount }
1992
+ ];
1993
+ if (For === enums_1.PayTypeEnum.Insurance) {
1994
+ let total = {
1995
+ name: 'Total',
1996
+ value: OverAllRecordTotal
1997
+ };
1998
+ let Rounding = { name: 'Rounding', value: Rounded };
1999
+ if (Rounding.value > 0) {
2000
+ Rounding.value = '+' + Rounding.value;
2001
+ }
2002
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2003
+ AccountFields.push(total);
2004
+ AccountFields.push(Rounding);
2005
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
2006
+ AccountFields.push(FinalTotal);
2007
+ }
2008
+ }
2009
+ else {
2010
+ let total = {
2011
+ name: 'Total',
2012
+ value: OverAllRecordTotal
2013
+ };
2014
+ let Rounding = { name: 'Rounding', value: Rounded };
2015
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2016
+ if (Rounding.value > 0) {
2017
+ Rounding.value = '+' + Rounding.value;
2018
+ }
2019
+ AccountFields.push(total);
2020
+ AccountFields.push(Rounding);
2021
+ if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
2022
+ AccountFields.push(FinalTotal);
2023
+ }
2024
+ }
2025
+ return {
2026
+ style: ['columnheader', 'TotalsStyles'],
2027
+ lineHeight: 0.7,
2028
+ marginBottom: 5,
2029
+ table: {
2030
+ body: this.GrandTotalTable(AccountFields)
2031
+ },
2032
+ layout: 'noBorders'
2033
+ };
2034
+ }
2035
+ static GrandTotalTable(data) {
2036
+ var body = [];
2037
+ data.forEach((row) => {
2038
+ if (!tr_utils_1.TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
2039
+ var dataRow = [];
2040
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
2041
+ dataRow.push(':');
2042
+ if (!tr_utils_1.TrUtils.IsNull(row.value)) {
2043
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
2044
+ }
2045
+ else {
2046
+ dataRow.push({ text: '', noWrap: true, alignment: 'right' });
2047
+ }
2048
+ body.push(dataRow);
2049
+ }
2050
+ });
2051
+ return body;
2052
+ }
2053
+ static InvoiceDueStatus(Type, Paid, Due, Status, isCounter) {
2054
+ if (Type === 'Invoice' && !isCounter) {
2055
+ return {
2056
+ // lineHeight: 0.7,
2057
+ fontSize: this.TableHeaders,
2058
+ marginTop: 10,
2059
+ marginBottom: 5,
2060
+ table: {
2061
+ widths: [200, 174, 174],
2062
+ body: [[{ text: 'Paid : ' + Paid },
2063
+ { text: 'Due : ' + Due },
2064
+ { text: 'Status : ' + Status }]]
2065
+ },
2066
+ layout: this.LayOutStyle(),
2067
+ };
2068
+ }
2069
+ else {
2070
+ return this.emptyObject();
2071
+ }
2072
+ }
2073
+ static DebitDueStatus(Type, Paid, Due, Status) {
2074
+ // if (Type === 'Invoice') {
2075
+ return {
2076
+ // lineHeight: 0.7,
2077
+ fontSize: this.TableHeaders,
2078
+ marginTop: 10,
2079
+ marginBottom: 5,
2080
+ table: {
2081
+ widths: [200, 174, 174],
2082
+ body: [[{ text: 'Paid : ' + Paid },
2083
+ { text: 'Due : ' + Due },
2084
+ { text: 'Status : ' + Status }]]
2085
+ },
2086
+ layout: this.LayOutStyle(),
2087
+ };
2088
+ // } else {
2089
+ // return this.emptyObject();
2090
+ // }
2091
+ }
2092
+ static LayOutStyle() {
2093
+ return {
2094
+ hLineColor: function (i, node) {
2095
+ return (i === 0 || i === 1 || i === 2 || i === node.table.body.length) ? 'gray' : 'white';
2096
+ },
2097
+ vLineColor: function (i, node) {
2098
+ return (i === 0 || i === node.table.widths.length) ? 'gray' : 'white';
2099
+ }
2100
+ };
2101
+ }
2102
+ //Not use this function any where
2103
+ static LayOutStyle1() {
2104
+ return {
2105
+ hLineColor: function (i, node) {
2106
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 'gray' : 'white';
2107
+ },
2108
+ vLineColor: function (i, node) {
2109
+ return (i === 0 || i === node.table.widths.length) ? 'gray' : 'white';
2110
+ }
2111
+ };
2112
+ }
2113
+ static GetImage(Image, PrLogo) {
2114
+ if (!tr_utils_1.TrUtils.IsNull(Image) && PrLogo) {
2115
+ return { image: Image, width: 120, height: 80 };
2116
+ }
2117
+ else {
2118
+ return { text: '', width: 150, height: 100 };
2119
+ }
2120
+ }
2121
+ static FooterContent(CnstData) {
2122
+ var _a, _b;
2123
+ if (CnstData.Entity.Header === 2) {
2124
+ if (!tr_utils_1.TrUtils.IsEmpty(CnstData.Entity.FootText)) {
2125
+ return {
2126
+ table: {
2127
+ widths: ['auto'],
2128
+ body: [
2129
+ [{
2130
+ text: CnstData.Entity.FootText, alignment: 'center', fontSize: 9
2131
+ }]
2132
+ ]
2133
+ },
2134
+ margin: [35, 0, 15, 10]
2135
+ };
2136
+ }
2137
+ else {
2138
+ return this.emptyObject();
2139
+ }
2140
+ }
2141
+ else {
2142
+ return {
2143
+ stack: [{ text: ((_a = CnstData.Doc) === null || _a === void 0 ? void 0 : _a.Sltn) + ' ' + ((_b = CnstData.Doc) === null || _b === void 0 ? void 0 : _b.Name), bold: true, alignment: 'right', marginBottom: 10 }, SharedPDFService.HeaderAfterLine1(), { columns: [this.GetEntityAddress(CnstData.Entity)] }],
2144
+ margin: [35, 0, 15, 10]
2145
+ };
2146
+ }
2147
+ }
2148
+ static GetEntityAddress(Entity) {
2149
+ let Addres = Entity.CName + ', ' + Entity.Adrs1;
2150
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.Adrs2)) {
2151
+ Addres = Addres + ',' + Entity.Adrs2;
2152
+ }
2153
+ Addres = Addres + ',' + Entity.City + SharedPDFService.getPinCode(Entity.PIN);
2154
+ return {
2155
+ style: 'tableExample',
2156
+ table: {
2157
+ widths: [80, '*'],
2158
+ body: [
2159
+ [{ text: 'Address -', bold: true }, { text: Addres, marginLeft: -45 }],
2160
+ [{ text: 'For Appointments' }, { text: 'Call: ' + Entity.Phone + ', ' + this.GetEmail(Entity.Email), marginLeft: -12 }],
2161
+ ]
2162
+ }, layout: 'noBorders',
2163
+ };
2164
+ }
2165
+ static GetSignatures(CName, For, Type) {
2166
+ return {
2167
+ columns: [{
2168
+ stack: [
2169
+ this.CompanyName(CName),
2170
+ { columns: [this.Authorizedsignature(), this.SurveyorSignature(For, Type), this.CustomerSignature()] }
2171
+ ]
2172
+ }],
2173
+ };
2174
+ }
2175
+ static GetInvSignatures(CName, isCounterSale) {
2176
+ return {
2177
+ columns: [{
2178
+ stack: [
2179
+ this.CompanyName(CName),
2180
+ { columns: [this.Authorizedsignature(), this.SparesSignature(isCounterSale), this.CustomerSignature()] }
2181
+ ]
2182
+ }],
2183
+ };
2184
+ }
2185
+ static GetHCInvSignatures(CName, isCounterSale) {
2186
+ return {
2187
+ columns: [{
2188
+ stack: [
2189
+ this.CompanyName(CName),
2190
+ { columns: [this.Authorizedsignature(), this.SparesSignature(isCounterSale), this.PatientSignature()] }
2191
+ ]
2192
+ }],
2193
+ };
2194
+ }
2195
+ static SparesSignature(CounterSale) {
2196
+ if (CounterSale) {
2197
+ return {
2198
+ style: 'Sign',
2199
+ text: ['Parts Incharge Signature'], marginLeft: 90
2200
+ };
2201
+ }
2202
+ else {
2203
+ let Sur = [];
2204
+ return Sur;
2205
+ }
2206
+ }
2207
+ static CompanyName(CName) {
2208
+ return {
2209
+ style: 'forCompany',
2210
+ text: ['For ', { text: CName, bold: 'true' }],
2211
+ };
2212
+ }
2213
+ static Authorizedsignature() {
2214
+ return {
2215
+ style: 'Sign',
2216
+ text: ['Authorized Signature'],
2217
+ };
2218
+ }
2219
+ static Accountantsignature() {
2220
+ return {
2221
+ style: 'Sign',
2222
+ text: ['Accountant Signature'],
2223
+ marginLeft: 90
2224
+ };
2225
+ }
2226
+ static CustomerSignature() {
2227
+ return {
2228
+ style: 'Sign',
2229
+ text: ['Customer Signature'], marginLeft: 90
2230
+ };
2231
+ }
2232
+ static PatientSignature() {
2233
+ return {
2234
+ style: 'Sign',
2235
+ text: ['Patient Signature'], marginLeft: 90
2236
+ };
2237
+ }
2238
+ static SurveyorSignature(For, Type) {
2239
+ if (For === enums_1.PayTypeEnum.Insurance && Type === 'Estimate') {
2240
+ return {
2241
+ style: 'Sign',
2242
+ text: ['Surveyor Signature'], marginLeft: 90
2243
+ };
2244
+ }
2245
+ else {
2246
+ let Sur = [];
2247
+ return Sur;
2248
+ }
2249
+ }
2250
+ //Not Use this function any where
2251
+ static GetHeadersWithDiffDisc(ROData, PrintPartNumber) {
2252
+ let headersNames;
2253
+ if (PrintPartNumber) {
2254
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
2255
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
2256
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
2257
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
2258
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
2259
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 }, {},
2260
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
2261
+ ],
2262
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
2263
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
2264
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
2265
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
2266
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
2267
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
2268
+ ]];
2269
+ }
2270
+ else {
2271
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
2272
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
2273
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
2274
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'right', lineHeight: 0.5 },
2275
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 }, {},
2276
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 }
2277
+ ],
2278
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'Desc', lineHeight: 0.5 },
2279
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
2280
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
2281
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
2282
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
2283
+ ]];
2284
+ }
2285
+ return headersNames;
2286
+ }
2287
+ static GetStyles() {
2288
+ return {
2289
+ temp2header: {
2290
+ fontSize: 23,
2291
+ bold: true,
2292
+ alignment: 'left',
2293
+ // margin: [0, 10, 0, 0],
2294
+ },
2295
+ tableheader1: {
2296
+ bold: true,
2297
+ fontFamily: 'Calibri',
2298
+ margin: [0, 2, 0, 2],
2299
+ alignment: 'center'
2300
+ },
2301
+ header: {
2302
+ fontSize: 26,
2303
+ bold: true,
2304
+ alignment: 'center',
2305
+ // margin: [0, 10, 0, 0],
2306
+ },
2307
+ // header2: {
2308
+ // fontSize: 13,
2309
+ // bold: true,
2310
+ // alignment: 'center',
2311
+ // // margin: [0, 10, 0, 0],
2312
+ // },
2313
+ meetingHeader: {
2314
+ fontSize: 16,
2315
+ bold: true,
2316
+ // alignment: 'center',
2317
+ },
2318
+ Receiptheader: {
2319
+ fontSize: 26,
2320
+ bold: true,
2321
+ alignment: 'center',
2322
+ margin: [0, 10, 0, 0],
2323
+ },
2324
+ InlineHeader: {
2325
+ fontSize: this.TableHeaders,
2326
+ bold: true,
2327
+ alignment: 'center',
2328
+ // decoration: 'underline',
2329
+ margin: [100, 2, 0, 2],
2330
+ },
2331
+ TaskHeading: {
2332
+ fontSize: 10,
2333
+ bold: true,
2334
+ margin: [30, 10, 0, 0],
2335
+ },
2336
+ lettersSize: {
2337
+ fontSize: this.SubHeaderSize,
2338
+ margin: [30, 0, 0, 0],
2339
+ },
2340
+ tablexample: {
2341
+ margin: [0, 5, 0, 0]
2342
+ },
2343
+ hedstyl: {
2344
+ margin: [0, 0, 0, 0]
2345
+ },
2346
+ header2: {
2347
+ fontSize: 12,
2348
+ bold: true,
2349
+ alignment: 'center',
2350
+ margin: [0, 0, 0, 0],
2351
+ },
2352
+ header1: {
2353
+ fontSize: 18,
2354
+ bold: true,
2355
+ alignment: 'center',
2356
+ decoration: 'underline',
2357
+ margin: [0, 0, 0, 0]
2358
+ },
2359
+ ws_adrs_center: {
2360
+ fontSize: this.BodySize,
2361
+ alignment: 'center',
2362
+ },
2363
+ ws_adrs_left: {
2364
+ fontSize: this.BodySize,
2365
+ alignment: 'left',
2366
+ },
2367
+ columnheader: {
2368
+ margin: [0, 5, 0, 0],
2369
+ },
2370
+ tableExample: {
2371
+ margin: [0, 0.5, 0, 5],
2372
+ fontSize: this.BodySize
2373
+ },
2374
+ tableExamplemargin: {
2375
+ margin: [25, 10, 20, 0],
2376
+ fontSize: this.BodySize
2377
+ },
2378
+ textcust: {
2379
+ fontSize: this.BodySize,
2380
+ margin: [0, 5, 0, 5],
2381
+ },
2382
+ column: {
2383
+ margin: [15, 0, 0, 0]
2384
+ },
2385
+ tableheader: {
2386
+ bold: true,
2387
+ fontSize: this.TableHeaders,
2388
+ margin: [0, 1, 0, 5],
2389
+ alignment: 'center'
2390
+ },
2391
+ tableheader2: {
2392
+ fontSize: this.TableHeaders,
2393
+ margin: [0, 1, 0, 5],
2394
+ alignment: 'center',
2395
+ // color: 'grey'
2396
+ opacity: 0.7
2397
+ },
2398
+ hed: {
2399
+ fontSize: this.SubHeaderSize,
2400
+ bold: true
2401
+ },
2402
+ hed2: {
2403
+ fontSize: this.SubHeaderSize,
2404
+ // bold: true
2405
+ },
2406
+ TotalsStyles: {
2407
+ marginTop: 15,
2408
+ lineHeight: 1.4,
2409
+ fontSize: this.BodySize,
2410
+ margin: [15, 0, 0, 0],
2411
+ },
2412
+ colum1: {
2413
+ fontSize: this.BodySize,
2414
+ lineHeight: 1.2,
2415
+ },
2416
+ colum2: {
2417
+ fontSize: this.BodySize,
2418
+ lineHeight: 1.4,
2419
+ margin: [10, 0, 0, 0],
2420
+ },
2421
+ colum3: {
2422
+ lineHeight: 0.7
2423
+ },
2424
+ Receiptheader1: {
2425
+ fontSize: 10,
2426
+ bold: true,
2427
+ alignment: 'center',
2428
+ margin: [0, 0, 0, 3]
2429
+ },
2430
+ Row1: {
2431
+ fontSize: this.TableHeaders,
2432
+ margin: [0, 5, 0, 5],
2433
+ },
2434
+ rowdata: {
2435
+ margin: [0, 10, 0, 0],
2436
+ fontSize: this.TableHeaders
2437
+ },
2438
+ forCompany: {
2439
+ margin: [0, 10, 30, 0],
2440
+ fontSize: '9'
2441
+ },
2442
+ forCompany1: {
2443
+ margin: [0, 5, 15, 0],
2444
+ fontSize: '9'
2445
+ },
2446
+ Rupees: {
2447
+ margin: [0, 40, 0, 0],
2448
+ fontSize: '10',
2449
+ },
2450
+ Signature: {
2451
+ margin: [0, 40, 50, 0],
2452
+ alignment: 'right',
2453
+ fontSize: '10'
2454
+ },
2455
+ withApp: {
2456
+ alignment: 'center',
2457
+ lineHeight: 0.7
2458
+ },
2459
+ withOutApp: {
2460
+ alignment: 'center',
2461
+ lineHeight: 0.5
2462
+ },
2463
+ Sign: {
2464
+ fontSize: this.BodySize,
2465
+ margin: [0, 30, 0, 5]
2466
+ },
2467
+ Sign1: {
2468
+ fontSize: this.BodySize,
2469
+ margin: [0, 15, 0, 5]
2470
+ },
2471
+ // 'html-font': {
2472
+ // fontSize: this.TermsandCond,
2473
+ // },
2474
+ // 'html-ol': {
2475
+ // fontSize: this.TermsandCond,
2476
+ // },
2477
+ 'margin-all': {
2478
+ margin: [0, 5, 0, 5],
2479
+ },
2480
+ 'margin-top': {
2481
+ margin: [0, 5, 0, 0],
2482
+ },
2483
+ 'margin-bottom': {
2484
+ margin: [0, 0, 0, 5],
2485
+ },
2486
+ 'fontSize': {
2487
+ fontSize: this.TermsandCond,
2488
+ },
2489
+ // 'html-u': {
2490
+ // fontSize: 16,
2491
+ // },
2492
+ // 'html-b': {
2493
+ // },
2494
+ // 'html-li': {
2495
+ // },
2496
+ // 'html-span': {
2497
+ // fontSize: this.TermsandCond,
2498
+ // }
2499
+ };
2500
+ }
2501
+ static convertNumberToWords(value) {
2502
+ var fraction = Math.round(this.frac(value) * 100);
2503
+ let f_text = '';
2504
+ if (fraction > 0) {
2505
+ let paisa = (this.convert_number(fraction) === 'ONE') ? 'PAISA' : ' PAISE';
2506
+ f_text = 'AND ' + this.convert_number(fraction) + paisa;
2507
+ }
2508
+ return this.convert_number(value) + ' RUPEE(S) ' + f_text + ' ONLY';
2509
+ }
2510
+ static frac(f) {
2511
+ return f % 1;
2512
+ }
2513
+ static convert_number(number) {
2514
+ if ((number < 0) || (number > 999999999)) {
2515
+ return 'NUMBER OUT OF RANGE!';
2516
+ }
2517
+ var Gn = Math.floor(number / 10000000); /* Crore */
2518
+ number -= Gn * 10000000;
2519
+ var kn = Math.floor(number / 100000); /* lakhs */
2520
+ number -= kn * 100000;
2521
+ var Hn = Math.floor(number / 1000); /* thousand */
2522
+ number -= Hn * 1000;
2523
+ var Dn = Math.floor(number / 100); /* Tens (deca) */
2524
+ number = number % 100; /* Ones */
2525
+ var tn = Math.floor(number / 10);
2526
+ var one = Math.floor(number % 10);
2527
+ var res = '';
2528
+ if (Gn > 0) {
2529
+ res += (this.convert_number(Gn) + ' CRORE');
2530
+ }
2531
+ if (kn > 0) {
2532
+ res += (((res === '') ? '' : ' ') +
2533
+ this.convert_number(kn) + ' LAKH');
2534
+ }
2535
+ if (Hn > 0) {
2536
+ res += (((res === '') ? '' : ' ') +
2537
+ this.convert_number(Hn) + ' THOUSAND');
2538
+ }
2539
+ if (Dn) {
2540
+ res += (((res === '') ? '' : ' ') +
2541
+ this.convert_number(Dn) + ' HUNDRED');
2542
+ }
2543
+ var ones = Array('', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'TEN', 'ELEVEN', 'TWELVE', 'THIRTEEN', 'FOURTEEN', 'FIFTEEN', 'SIXTEEN', 'SEVENTEEN', 'EIGHTEEN', 'NINETEEN');
2544
+ var tens = Array('', '', 'TWENTY', 'THIRTY', 'FOURTY', 'FIFTY', 'SIXTY', 'SEVENTY', 'EIGHTY', 'NINETY');
2545
+ if (tn > 0 || one > 0) {
2546
+ if (!(res === '')) {
2547
+ res += ' AND ';
2548
+ }
2549
+ if (tn < 2) {
2550
+ res += ones[tn * 10 + one];
2551
+ }
2552
+ else {
2553
+ res += tens[tn];
2554
+ if (one > 0) {
2555
+ res += ('-' + ones[one]);
2556
+ }
2557
+ }
2558
+ }
2559
+ if (res === '') {
2560
+ res = 'ZERO';
2561
+ }
2562
+ return res;
2563
+ }
2564
+ }
2565
+ exports.SharedPDFService = SharedPDFService;
2566
+ SharedPDFService.BodySize = 8;
2567
+ SharedPDFService.TableHeaders = 9;
2568
+ SharedPDFService.SubHeaderSize = 9;
2569
+ SharedPDFService.TermsandCond = 6;