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,438 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PosReceiptPrintService = void 0;
4
+ const tr_utils_1 = require("../utils/tr-utils");
5
+ class PosReceiptPrintService {
6
+ static GetPrint(InvoicePDFData, size) {
7
+ // console.log('InvoicePDFData', InvoicePDFData);
8
+ if (tr_utils_1.TrUtils.IsNull(InvoicePDFData.Name)) {
9
+ InvoicePDFData.Name = '';
10
+ }
11
+ let dd = {
12
+ // info: {
13
+ // title: this.GetFileName(ROPrintData),
14
+ // },
15
+ info: {
16
+ title: 'CounterSale',
17
+ },
18
+ header: function (currentPage, pageCount, pageSize) {
19
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 25, fontSize: 8, marginTop: 2 };
20
+ },
21
+ pageMargins: this.GetMarginsBasedOnPaperSize(size),
22
+ pageSize: 'A4',
23
+ // pageSize: {
24
+ // width: 595.28,
25
+ // height: 420.945
26
+ // },
27
+ // pageOrientation: 'portrait',
28
+ content: [
29
+ { text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'center', fontSize: 20 },
30
+ { text: this.GetAddress(InvoicePDFData.Entity), alignment: 'center', style: ['headerstyle'] },
31
+ {
32
+ columns: this.GetHeaderInfo(InvoicePDFData)
33
+ },
34
+ // this.CustomerAndVehicleDetailsAfterLine(size),
35
+ // {
36
+ // columns: [{
37
+ // width: '*',
38
+ // // marginTop: 4,
39
+ // marginLeft: 5,
40
+ // stack: [{ text: 'Name : ' + InvoicePDFData.Customer.Name, style: ['headerstyle'] },
41
+ // { text: 'Doctor : ' + InvoicePDFData.Name, style: ['headerstyle'] }]
42
+ // }, {
43
+ // width: 'auto',
44
+ // // marginTop: 4,
45
+ // marginRight: 5,
46
+ // stack: [{ text: 'Bill No : ' + InvoicePDFData._id, style: ['headerstyle'] },
47
+ // { text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
48
+ // }],
49
+ // columnGap: 10,
50
+ // marginTop: 5
51
+ // },
52
+ {
53
+ style: 'tableExample',
54
+ table: {
55
+ widths: ['*', '*'],
56
+ body: [
57
+ [{
58
+ // marginTop: 4,
59
+ marginLeft: 5,
60
+ stack: [{ text: 'Name : ' + InvoicePDFData.Customer.Name, style: ['headerstyle'] },
61
+ { text: 'Doctor : ' + InvoicePDFData.Name, style: ['headerstyle'] }]
62
+ }, {
63
+ // marginTop: 4,
64
+ marginRight: 5,
65
+ marginLeft: 130,
66
+ // alignment: 'right',
67
+ stack: [{ text: 'Bill No : ' + InvoicePDFData._id, style: ['headerstyle'] },
68
+ { text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
69
+ }]
70
+ ]
71
+ },
72
+ layout: this.HeaderLayOut()
73
+ },
74
+ this.GetItemsTable(InvoicePDFData.Items, InvoicePDFData.ShowTaxColumn, size),
75
+ // { text: 'SubTotal : ' + InvoicePDFData.FixedSubTotal, style: ['headerstyle'], alignment: 'right' },
76
+ // { text: 'Discount : -' + InvoicePDFData.FixedDisc, style: ['headerstyle'], alignment: 'right' },
77
+ // { text: 'Adjust : ' + this.GetAdjustValue(InvoicePDFData.Adj), style: ['headerstyle'], alignment: 'right' },
78
+ {
79
+ columns: [{ text: '', width: '*' }, { text: this.finalReturnTotal(InvoicePDFData), width: '*', bold: true, fontSize: 10, alignment: 'center' },
80
+ this.GetTotalDeetails(InvoicePDFData, size)]
81
+ },
82
+ // { text: '' , fontSize: 8, alignment: 'left' },
83
+ {
84
+ stack: ['* Goods once sold will not be taken back or exchanged',
85
+ '* PLEASE GET YOUR MEDICINES CHECKED BY YOUR DOCTOR BEFORE USE *'],
86
+ fontSize: 7,
87
+ marginLeft: 5
88
+ },
89
+ this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.Type, InvoicePDFData.For),
90
+ ],
91
+ styles: {
92
+ headerstyle: {
93
+ fontFamily: 'Calibri',
94
+ fontSize: 9
95
+ },
96
+ Sign: {
97
+ fontSize: 8,
98
+ margin: [0, 30, 0, 5]
99
+ },
100
+ forCompany: {
101
+ // margin: [0, 10, 30, 0],
102
+ marginRight: 5,
103
+ marginTop: 10,
104
+ fontSize: 9,
105
+ alignment: 'right'
106
+ },
107
+ tableheader: {
108
+ bold: true,
109
+ fontFamily: 'Calibri',
110
+ margin: [0, 1, 0, 5],
111
+ alignment: 'center'
112
+ },
113
+ tableheader1: {
114
+ bold: true,
115
+ fontFamily: 'Calibri',
116
+ margin: [0, 2, 0, 2],
117
+ alignment: 'center'
118
+ },
119
+ tableExample: {
120
+ fontSize: 9
121
+ }
122
+ }
123
+ };
124
+ return dd;
125
+ }
126
+ static HeaderLayOut() {
127
+ return {
128
+ hLineWidth: function (i, node) {
129
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
130
+ },
131
+ vLineWidth: function (i, node) {
132
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0;
133
+ },
134
+ // hLineStyle: function (i, node) {
135
+ // return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
136
+ // },
137
+ hLineColor: function (i, node) {
138
+ return 'gray';
139
+ },
140
+ vLineColor: function (i, node) {
141
+ return 'gray';
142
+ },
143
+ };
144
+ }
145
+ static GetHeaderInfo(InvoicePDFData) {
146
+ let TaxInfo = [];
147
+ if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
148
+ TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' });
149
+ }
150
+ // if (!TrUtils.IsEmpty(InvoicePDFData.Entity.PAN)) {
151
+ // TaxInfo.push({ text: 'PAN : ' + InvoicePDFData.Entity.PAN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' },
152
+ // );
153
+ // }
154
+ if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
155
+ TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' });
156
+ }
157
+ TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
158
+ return TaxInfo;
159
+ }
160
+ static finalReturnTotal(InvoicePDFData) {
161
+ // if (!TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
162
+ // return 'Returns Total : ' + InvoicePDFData.CustRetRoundedTotal
163
+ // } else {
164
+ return '';
165
+ // }
166
+ }
167
+ static GetMarginsBasedOnPaperSize(size) {
168
+ if (size === 'full') {
169
+ return [25, 15, 25, 15];
170
+ }
171
+ else {
172
+ return [25, 15, 25, 435.945];
173
+ }
174
+ }
175
+ static GetTotalDeetails(InvoicePDFData, size) {
176
+ let TotalData = [];
177
+ if (!tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.STotal)) {
178
+ // TotalData.push({ text: 'Sub Total : ' + InvoicePDFData.STotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, })
179
+ TotalData.push({ name: 'Sub Total', value: InvoicePDFData.STotal });
180
+ }
181
+ if (!tr_utils_1.TrUtils.IsFixedZero(this.GetDiscountOverall(InvoicePDFData))) {
182
+ // TotalData.push({ text: 'Discount : -' + this.GetDiscountOverall(InvoicePDFData), style: ['headerstyle'], alignment: 'right', marginRight: 5, });
183
+ TotalData.push({ name: 'Discount', value: this.GetDiscountOverall(InvoicePDFData) });
184
+ }
185
+ if (!tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.CustPartITax) && tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
186
+ TotalData.push({ name: 'Tax Amount', value: tr_utils_1.TrUtils.FixPriceValue(InvoicePDFData.CustPartITax) });
187
+ }
188
+ if (!tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.Round) && tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
189
+ TotalData.push({ name: 'Round off', value: tr_utils_1.TrUtils.FixPriceValue(InvoicePDFData.Round) });
190
+ }
191
+ if (!tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
192
+ // TotalData.push({ text: 'Total : ' + InvoicePDFData.CustRoundedTotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, });
193
+ TotalData.push({ name: 'Total', value: InvoicePDFData.CustNonRetRoundedTotal });
194
+ TotalData.push({ name: 'Returns Total', value: InvoicePDFData.CustRetRoundedTotal });
195
+ }
196
+ if (!tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.CustRoundedTotal)) {
197
+ // TotalData.push({ text: 'Total : ' + InvoicePDFData.CustRoundedTotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, });
198
+ TotalData.push({ name: 'Final Total', value: InvoicePDFData.CustRoundedTotal });
199
+ }
200
+ if (!tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.Due)) {
201
+ // TotalData.push({ text: 'Total : ' + InvoicePDFData.CustRoundedTotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, });
202
+ TotalData.push({ name: 'Due', value: InvoicePDFData.Due });
203
+ }
204
+ return {
205
+ style: ['columnheader', 'TotalsStyles'],
206
+ lineHeight: 0.7,
207
+ marginBottom: 5,
208
+ width: 'auto',
209
+ table: {
210
+ body: this.GrandTotalTable(TotalData)
211
+ },
212
+ layout: 'noBorders'
213
+ // layout: {
214
+ // hLineWidth: function (i: any, node: any) {
215
+ // return (i === 0) ? 1 : 0;
216
+ // },
217
+ // vLineWidth: function (i: any, node: any) {
218
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
219
+ // }
220
+ // },
221
+ };
222
+ // return TotalData;
223
+ }
224
+ static GrandTotalTable(data) {
225
+ var body = [];
226
+ data.forEach((row) => {
227
+ if (!tr_utils_1.TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
228
+ var dataRow = [];
229
+ dataRow.push({ text: (row.name).toString(), noWrap: true, bold: true, style: ['headerstyle'], fontSize: 10 });
230
+ dataRow.push({ text: ':', style: ['headerstyle'], bold: true, fontSize: 10 });
231
+ if (!tr_utils_1.TrUtils.IsNull(row.value)) {
232
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right', bold: true, style: ['headerstyle'], fontSize: 10, marginRight: 5 });
233
+ }
234
+ else {
235
+ dataRow.push({ text: '', noWrap: true, alignment: 'right', style: ['headerstyle'] });
236
+ }
237
+ body.push(dataRow);
238
+ }
239
+ });
240
+ return body;
241
+ }
242
+ static GetBillofSupplyName(Settings) {
243
+ return { text: Settings.Tax === 'BS' ? ' Bill of Supply' : null, alignment: 'center', marginLeft: 15, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
244
+ }
245
+ static GetDiscountOverall(InvoicePDFData) {
246
+ // let OveralDisc: number = TrUtils.SetValueToZeroIfNull(Number(InvoicePDFData.Disc)) +
247
+ // TrUtils.SetValueToZeroIfNull(Number(InvoicePDFData.CustPartsDiscTotal));
248
+ // console.log(InvoicePDFData.Disc,InvoicePDFData.CustPartsDiscTotal);
249
+ return tr_utils_1.TrUtils.FixPriceValue(Number(InvoicePDFData.FixedDisc));
250
+ }
251
+ static CustomerAndVehicleDetailsAfterLine(size) {
252
+ let length = 575;
253
+ if (size === 'A3') {
254
+ length = 820;
255
+ }
256
+ else if (size === 'Custom') {
257
+ length = 575;
258
+ }
259
+ return {
260
+ canvas: [
261
+ {
262
+ type: 'line',
263
+ lineColor: 'gray',
264
+ x1: 0,
265
+ y1: 0,
266
+ x2: 540,
267
+ y2: 0,
268
+ lineWidth: 1
269
+ }
270
+ ]
271
+ };
272
+ }
273
+ static GetSignatures(CName, For, Type) {
274
+ return {
275
+ columns: [{
276
+ stack: [
277
+ this.CompanyName(CName),
278
+ // { columns: [this.Authorizedsignature(), this.SurveyorSignature(For, Type), this.CustomerSignature()] }
279
+ ]
280
+ }],
281
+ };
282
+ }
283
+ static CompanyName(CName) {
284
+ return {
285
+ style: 'forCompany',
286
+ text: ['For ', { text: CName, }],
287
+ };
288
+ }
289
+ static Authorizedsignature() {
290
+ return {
291
+ style: 'Sign',
292
+ text: ['Authorized Signatory'],
293
+ };
294
+ }
295
+ static CustomerSignature() {
296
+ return {
297
+ style: 'Sign',
298
+ text: ['Customer Signature'], marginLeft: 90
299
+ };
300
+ }
301
+ static GetItemsTable(Items, ShowTaxColumn, size) {
302
+ return {
303
+ style: 'tableExample',
304
+ marginTop: 3,
305
+ marginBottom: 5,
306
+ table: {
307
+ widths: this.GetWidths(ShowTaxColumn),
308
+ headerRows: 1,
309
+ body: this.BuildTableBodyForLaborAndParts(Items, ShowTaxColumn, size)
310
+ },
311
+ layout: {
312
+ hLineWidth: function (i, node) {
313
+ // || (i === 20 && size !== 'full')
314
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
315
+ },
316
+ vLineWidth: function (i, node) {
317
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
318
+ },
319
+ // hLineStyle: function (i, node) {
320
+ // return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
321
+ // },
322
+ hLineColor: function (i, node) {
323
+ return 'gray';
324
+ },
325
+ vLineColor: function (i, node) {
326
+ return 'gray';
327
+ },
328
+ }
329
+ };
330
+ }
331
+ static GetWidths(ShowTaxColumn) {
332
+ if (ShowTaxColumn) {
333
+ return [18, '*', 40, 50, 25, 25, 18, 20, 45, 45, 50];
334
+ }
335
+ else {
336
+ return [22, '*', 60, 30, 25, 18, 20, 50, 50];
337
+ }
338
+ }
339
+ static GetAddress(Entity) {
340
+ return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
341
+ }
342
+ static BuildTableBodyForLaborAndParts(Items, ShowTaxColumn, size) {
343
+ let body = this.GetHeaderNames(ShowTaxColumn);
344
+ let j = 1;
345
+ Items.forEach((item, index) => {
346
+ let dataRow = [];
347
+ dataRow.push({ text: index + 1, });
348
+ dataRow.push({ text: item.Desc, });
349
+ if (ShowTaxColumn) {
350
+ dataRow.push({ text: item.HSN, alignment: 'center', style: ['headerstyle'], });
351
+ }
352
+ dataRow.push({ text: item.Batch, alignment: 'center', style: ['headerstyle'], });
353
+ dataRow.push({ text: item.ExDt, alignment: 'center', style: ['headerstyle'], });
354
+ dataRow.push({ text: item.Make, alignment: 'center', style: ['headerstyle'], });
355
+ dataRow.push({ text: item.Sch, alignment: 'center', style: ['headerstyle'], });
356
+ dataRow.push({ text: item.Ret ? -item.Qty : item.Qty, alignment: 'right', style: ['headerstyle'], });
357
+ dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(item.UnPr), alignment: 'right', style: ['headerstyle'], });
358
+ if (ShowTaxColumn) {
359
+ dataRow.push({ text: item.TaxName, alignment: 'center', style: ['headerstyle'], });
360
+ }
361
+ dataRow.push({ text: item.Ret ? '-' + tr_utils_1.TrUtils.FixPriceValue(item.LineTotal) : tr_utils_1.TrUtils.FixPriceValue(item.LineTotal), alignment: 'right', style: ['headerstyle'], });
362
+ body.push(dataRow);
363
+ if (index + 1 === j * 9) {
364
+ j++;
365
+ if (size === 'diff') {
366
+ // let dataRow1: any = [{ text: '' }, '', '', '', '', ''];
367
+ // if (ShowTaxColumn) {
368
+ // dataRow1.push('');
369
+ // dataRow1.push('');
370
+ // }
371
+ // body.push(dataRow1);
372
+ // let dataRow2: any = [{ text: '' }, '', '', '', '', ''];
373
+ // if (ShowTaxColumn) {
374
+ // dataRow2.push('');
375
+ // dataRow2.push('');
376
+ // }
377
+ // body.push(dataRow2);
378
+ // let dataRow3: any = [{ text: '' }, '', '', '', '', ''];
379
+ // if (ShowTaxColumn) {
380
+ // dataRow3.push('');
381
+ // dataRow3.push('');
382
+ // }
383
+ // body.push(dataRow3);
384
+ // let dataRow4: any = [{ text: '' }, '', '', '', '', ''];
385
+ // if (ShowTaxColumn) {
386
+ // dataRow4.push('');
387
+ // dataRow4.push('');
388
+ // }
389
+ // body.push(dataRow4);
390
+ // let dataRow5: any = [{ text: '' }, '', '', '', '', ''];
391
+ // if (ShowTaxColumn) {
392
+ // dataRow5.push('');
393
+ // dataRow5.push('');
394
+ // }
395
+ // body.push(dataRow5);
396
+ // body.push(this.GetHeaderNames(ShowTaxColumn)[0]);
397
+ // } else {
398
+ let dataRow1 = [{ text: '', pageBreak: 'after' }, '', '', '', '', ''];
399
+ if (ShowTaxColumn) {
400
+ dataRow1.push('');
401
+ dataRow1.push('');
402
+ }
403
+ body.push(dataRow1);
404
+ }
405
+ }
406
+ });
407
+ return body;
408
+ }
409
+ static GetHeaderNames(ShowTaxColumn) {
410
+ let HeadingNames;
411
+ if (ShowTaxColumn) {
412
+ HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', fontSize: 8 },
413
+ { text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
414
+ { text: 'HSN', style: 'tableheader1', Field: 'HSN' },
415
+ { text: 'Batch No.', style: 'tableheader1', Field: 'Batches' },
416
+ { text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate' },
417
+ { text: 'Manf', style: 'tableheader1', Field: 'Manf' },
418
+ { text: 'Sch', style: 'tableheader1', Field: 'Sch' },
419
+ { text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
420
+ { text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
421
+ { text: 'Tax', style: 'tableheader1', Field: 'TaxAmount' },
422
+ { text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
423
+ }
424
+ else {
425
+ HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left' },
426
+ { text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
427
+ { text: 'Batch No.', style: 'tableheader1', Field: 'Batches', alignment: 'left' },
428
+ { text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate', alignment: 'left' },
429
+ { text: 'Manf', style: 'tableheader1', Field: 'Manf', alignment: 'right' },
430
+ { text: 'Sch', style: 'tableheader1', Field: 'Sch', alignment: 'right' },
431
+ { text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
432
+ { text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
433
+ { text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
434
+ }
435
+ return HeadingNames;
436
+ }
437
+ }
438
+ exports.PosReceiptPrintService = PosReceiptPrintService;