shareneus 1.1.6 → 1.1.7
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.
|
@@ -53,7 +53,9 @@ class InvPrintService {
|
|
|
53
53
|
}
|
|
54
54
|
InvoicePrintData.Consolidate = ConsolidateGST;
|
|
55
55
|
InvoicePrintData.ShowDiscountColumn = false;
|
|
56
|
+
console.log(ForInsurance, ConsolidateGST);
|
|
56
57
|
if (!ForInsurance && !ConsolidateGST) {
|
|
58
|
+
console.log(shared_print_service_1.PrintSharedService.CheckItemIndexWithDisc(InvoicePrintData));
|
|
57
59
|
if (shared_print_service_1.PrintSharedService.CheckItemIndexWithDisc(InvoicePrintData) !== -1) {
|
|
58
60
|
// InvoicePrintData.ShowDiscountColumn = (InvoicePrintData.Settings.DiscLvl === 'ITM' || InvoicePrintData.Settings.DiscLvl === 'RECITM') ? true : false;
|
|
59
61
|
InvoicePrintData.ShowDiscountColumn = true;
|
|
@@ -267,6 +269,12 @@ class InvPrintService {
|
|
|
267
269
|
else {
|
|
268
270
|
Item.QtyAndUoM = Item.Qty + '';
|
|
269
271
|
}
|
|
272
|
+
if (!tr_utils_1.TrUtils.IsZero(Item.OfQty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
|
|
273
|
+
Item.OfQtyAndUoM = Item.OfQty + ' ' + Item.UoM;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
Item.OfQtyAndUoM = Item.OfQty + '';
|
|
277
|
+
}
|
|
270
278
|
});
|
|
271
279
|
return Items;
|
|
272
280
|
}
|
|
@@ -156,6 +156,7 @@ class InvoiceLandscapePdfService {
|
|
|
156
156
|
];
|
|
157
157
|
}
|
|
158
158
|
static PreparesparePartsTable(ROPrintData) {
|
|
159
|
+
console.log('ROPrintData', ROPrintData);
|
|
159
160
|
let List = [];
|
|
160
161
|
if (ROPrintData.Entity.Body === 1) {
|
|
161
162
|
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvoicePortraitPrintService = 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 InvoicePortraitPrintService {
|
|
8
|
+
static GetPrint(InvoicePDFData, size, printOptions) {
|
|
9
|
+
// console.log('InvoicePDFData', InvoicePDFData);
|
|
10
|
+
if (tr_utils_1.TrUtils.IsNull(InvoicePDFData.Name)) {
|
|
11
|
+
InvoicePDFData.Name = '';
|
|
12
|
+
}
|
|
13
|
+
let dd = {
|
|
14
|
+
info: {
|
|
15
|
+
title: 'CounterSale',
|
|
16
|
+
},
|
|
17
|
+
header: function (currentPage, pageCount, pageSize) {
|
|
18
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 25, fontSize: 8, marginTop: 2 };
|
|
19
|
+
},
|
|
20
|
+
pageMargins: this.GetMarginsBasedOnPaperSize(size),
|
|
21
|
+
pageSize: 'A4',
|
|
22
|
+
content: [
|
|
23
|
+
{ text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'center', fontSize: 15 },
|
|
24
|
+
{ text: this.GetAddress(InvoicePDFData.Entity), alignment: 'center', style: ['headerstyle'] },
|
|
25
|
+
{
|
|
26
|
+
columns: this.GetHeaderInfo(InvoicePDFData)
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
style: 'tableExample',
|
|
30
|
+
table: {
|
|
31
|
+
widths: [200, '*', 'auto'],
|
|
32
|
+
body: this.GetCustomerAndBankDetails(InvoicePDFData)
|
|
33
|
+
},
|
|
34
|
+
layout: this.HeaderLayOut()
|
|
35
|
+
},
|
|
36
|
+
this.GetItemsTable(InvoicePDFData.Items, InvoicePDFData.ShowTaxColumn, InvoicePDFData.Settings.PoS.SType, printOptions, size),
|
|
37
|
+
[this.TotalDetails(InvoicePDFData)],
|
|
38
|
+
this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.Type, InvoicePDFData.For),
|
|
39
|
+
],
|
|
40
|
+
styles: {
|
|
41
|
+
headerstyle: {
|
|
42
|
+
fontFamily: 'Calibri',
|
|
43
|
+
fontSize: 9
|
|
44
|
+
},
|
|
45
|
+
Sign: {
|
|
46
|
+
fontSize: 8,
|
|
47
|
+
margin: [0, 15, 0, 5]
|
|
48
|
+
},
|
|
49
|
+
forCompany: {
|
|
50
|
+
// margin: [0, 10, 30, 0],
|
|
51
|
+
marginRight: 5,
|
|
52
|
+
marginTop: 10,
|
|
53
|
+
fontSize: 9,
|
|
54
|
+
alignment: 'right'
|
|
55
|
+
},
|
|
56
|
+
forCompany1: {
|
|
57
|
+
margin: [0, 5, 15, 0],
|
|
58
|
+
fontSize: 8
|
|
59
|
+
},
|
|
60
|
+
tableheader: {
|
|
61
|
+
bold: true,
|
|
62
|
+
fontFamily: 'Calibri',
|
|
63
|
+
margin: [0, 1, 0, 5],
|
|
64
|
+
alignment: 'center'
|
|
65
|
+
},
|
|
66
|
+
tableheader1: {
|
|
67
|
+
bold: true,
|
|
68
|
+
fontFamily: 'Calibri',
|
|
69
|
+
margin: [0, 2, 0, 2],
|
|
70
|
+
alignment: 'center'
|
|
71
|
+
},
|
|
72
|
+
tableExample: {
|
|
73
|
+
fontSize: 9
|
|
74
|
+
},
|
|
75
|
+
tableExample1: {
|
|
76
|
+
fontSize: 8
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return dd;
|
|
81
|
+
}
|
|
82
|
+
static GetCustomerAndBankDetails(InvoicePDFData) {
|
|
83
|
+
let CustDetails = [];
|
|
84
|
+
CustDetails.push([{
|
|
85
|
+
marginLeft: 3,
|
|
86
|
+
stack: [
|
|
87
|
+
this.GetCustomerDetails(InvoicePDFData.Customer, InvoicePDFData.Type, null, null, 'Customer Name & Address')
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
marginLeft: 5,
|
|
92
|
+
marginRight: 5,
|
|
93
|
+
stack: [this.GetCustomerGSTIN(InvoicePDFData.Customer), this.GetCustomerDLNo(InvoicePDFData.Customer)]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
marginRight: 5,
|
|
97
|
+
stack: [{ text: 'Invoice No : ' + InvoicePDFData._id, style: ['headerstyle'] },
|
|
98
|
+
{ text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
|
|
99
|
+
}]);
|
|
100
|
+
if (InvoicePDFData.Entity.PrBank) {
|
|
101
|
+
CustDetails.push([{ text: 'Note: OUR BANK A/C: ' + InvoicePDFData.Entity.Bank.ACNo + ', IFSC CODE: ' + InvoicePDFData.Entity.Bank.IFSC + ', Account Holder Name: ' + InvoicePDFData.Entity.Bank.ACName + ', BANK NAME: ' + InvoicePDFData.Entity.Bank.Name, colSpan: 3, fontSize: 8 }]);
|
|
102
|
+
}
|
|
103
|
+
return CustDetails;
|
|
104
|
+
}
|
|
105
|
+
static GetAddress1(Customer) {
|
|
106
|
+
var Address = this.GetFormatAddress(Customer);
|
|
107
|
+
if (Address.length !== 5) {
|
|
108
|
+
return Address;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
let a = '';
|
|
112
|
+
return a;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
static GetFormatAddress(CustomerObj) {
|
|
116
|
+
var Addressnew = '';
|
|
117
|
+
if (!tr_utils_1.TrUtils.IsNull(CustomerObj.Adrs)) {
|
|
118
|
+
CustomerObj.Adrs.forEach((Adrs, index) => {
|
|
119
|
+
Addressnew = Addressnew + Adrs;
|
|
120
|
+
if (CustomerObj.Adrs.length > (index + 1)) {
|
|
121
|
+
Addressnew = Addressnew + ', ';
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return Addressnew;
|
|
126
|
+
}
|
|
127
|
+
static GetCustomerDetails(Customer, Type, Vehicle, Settings, CustHeader) {
|
|
128
|
+
if (tr_utils_1.TrUtils.IsNull(Customer)) {
|
|
129
|
+
return this.emptyObject();
|
|
130
|
+
}
|
|
131
|
+
let Data = [{ text: CustHeader + ':', style: 'hed', bold: true },
|
|
132
|
+
{ text: Customer.Name, marginTop: 2 },
|
|
133
|
+
{ text: this.GetAddress1(Customer), marginTop: 3, fontSize: 7 },
|
|
134
|
+
this.GetCustPhoneNumber(Customer, Type),
|
|
135
|
+
this.GetCustomerName(Customer.CustName)];
|
|
136
|
+
return {
|
|
137
|
+
style: 'colum1',
|
|
138
|
+
stack: Data
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
static GetFormatContact(CustomerObj) {
|
|
142
|
+
var contactnew = '';
|
|
143
|
+
if (!tr_utils_1.TrUtils.IsNull(CustomerObj.Cons)) {
|
|
144
|
+
CustomerObj.Cons.forEach((Contact) => {
|
|
145
|
+
contactnew = contactnew + '(' + Contact.Type + '):' + Contact.No + '\n';
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return contactnew;
|
|
149
|
+
}
|
|
150
|
+
static GetCustPhoneNumber(Customer, Type) {
|
|
151
|
+
if (Type !== 'Technician Copy') {
|
|
152
|
+
var contact = this.GetFormatContact(Customer);
|
|
153
|
+
if (contact.length !== 0) {
|
|
154
|
+
return { columns: [{ text: 'Phone', width: 27, style: 'hed' }, contact] };
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
return this.emptyObject();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return this.emptyObject();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
static emptyObject() {
|
|
165
|
+
let a = {};
|
|
166
|
+
return a;
|
|
167
|
+
}
|
|
168
|
+
static GetCustomerName(Customer) {
|
|
169
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Customer)) {
|
|
170
|
+
let GSTIN = { columns: [{ text: 'Customer Name :', width: 65, bold: true }, { text: Customer }] };
|
|
171
|
+
return GSTIN;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return this.emptyObject();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
static GetCustomerGSTIN(Customer) {
|
|
178
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Customer.GSTIN)) {
|
|
179
|
+
let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: Customer.GSTIN, marginTop: 1.5 }] };
|
|
180
|
+
return GSTIN;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return this.emptyObject();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
static GetCustomerDLNo(Customer) {
|
|
187
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Customer.DLNo)) {
|
|
188
|
+
let GSTIN = { columns: [{ text: 'DL No :', width: 33, style: 'hed' }, { text: Customer.DLNo, marginTop: 1.5 }] };
|
|
189
|
+
return GSTIN;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
return this.emptyObject();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
static HeaderLayOut() {
|
|
196
|
+
return {
|
|
197
|
+
hLineWidth: function (i, node) {
|
|
198
|
+
return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
|
|
199
|
+
},
|
|
200
|
+
vLineWidth: function (i, node) {
|
|
201
|
+
return (i === 0 || i === node.table.widths.length) ? 1 : 0;
|
|
202
|
+
},
|
|
203
|
+
hLineColor: function (i, node) {
|
|
204
|
+
return 'gray';
|
|
205
|
+
},
|
|
206
|
+
vLineColor: function (i, node) {
|
|
207
|
+
return 'gray';
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
static GetHeaderInfo(InvoicePDFData) {
|
|
212
|
+
let TaxInfo = [];
|
|
213
|
+
if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
|
|
214
|
+
TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' });
|
|
215
|
+
}
|
|
216
|
+
if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
|
|
217
|
+
TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' });
|
|
218
|
+
}
|
|
219
|
+
TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
|
|
220
|
+
return TaxInfo;
|
|
221
|
+
}
|
|
222
|
+
static GetMarginsBasedOnPaperSize(size) {
|
|
223
|
+
if (size === 'full') {
|
|
224
|
+
return [20, 15, 20, 15];
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
return [20, 15, 20, 435.945];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
static GrandTotalTable(data) {
|
|
231
|
+
var body = [];
|
|
232
|
+
data.forEach((row) => {
|
|
233
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
|
|
234
|
+
var dataRow = [];
|
|
235
|
+
dataRow.push({ text: (row.name).toString(), noWrap: true });
|
|
236
|
+
dataRow.push(':');
|
|
237
|
+
if (row.name === 'Final Total') {
|
|
238
|
+
dataRow.push({ text: (row.value).toString(), noWrap: true, bold: true, fontSize: 12, alignment: 'right' });
|
|
239
|
+
}
|
|
240
|
+
else if (!tr_utils_1.TrUtils.IsNull(row.value)) {
|
|
241
|
+
dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
dataRow.push({ text: '', noWrap: true, alignment: 'right' });
|
|
245
|
+
}
|
|
246
|
+
body.push(dataRow);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
return body;
|
|
250
|
+
}
|
|
251
|
+
static GetBillofSupplyName(Settings) {
|
|
252
|
+
return { text: Settings.Tax === 'BS' ? ' Bill of Supply' : null, alignment: 'center', marginLeft: 15, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
|
|
253
|
+
}
|
|
254
|
+
static GetDiscountOverall(InvoicePDFData) {
|
|
255
|
+
return tr_utils_1.TrUtils.FixPriceValue(Number(InvoicePDFData.FixedDisc));
|
|
256
|
+
}
|
|
257
|
+
static CustomerAndVehicleDetailsAfterLine(size) {
|
|
258
|
+
let length = 575;
|
|
259
|
+
if (size === 'A3') {
|
|
260
|
+
length = 820;
|
|
261
|
+
}
|
|
262
|
+
else if (size === 'Custom') {
|
|
263
|
+
length = 575;
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
canvas: [
|
|
267
|
+
{
|
|
268
|
+
type: 'line',
|
|
269
|
+
lineColor: 'gray',
|
|
270
|
+
x1: 0,
|
|
271
|
+
y1: 0,
|
|
272
|
+
x2: 540,
|
|
273
|
+
y2: 0,
|
|
274
|
+
lineWidth: 1
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
static GetSignatures(CName, For, Type) {
|
|
280
|
+
return {
|
|
281
|
+
columns: [{
|
|
282
|
+
stack: [
|
|
283
|
+
{ columns: ['', '', this.CompanyName(CName)] }
|
|
284
|
+
]
|
|
285
|
+
}],
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
static CompanyName(CName) {
|
|
289
|
+
return {
|
|
290
|
+
style: 'forCompany1',
|
|
291
|
+
text: ['For ', { text: CName, bold: 'true' }],
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
static Authorizedsignature() {
|
|
295
|
+
return {
|
|
296
|
+
style: 'Sign',
|
|
297
|
+
text: ['Authorized Signatory'],
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
static CustomerSignature() {
|
|
301
|
+
return {
|
|
302
|
+
style: 'Sign',
|
|
303
|
+
text: ['Customer Signature'], marginLeft: 90
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
static GetItemsTable(Items, ShowTaxColumn, SType, printOptions, size) {
|
|
307
|
+
return {
|
|
308
|
+
style: 'tableExample',
|
|
309
|
+
marginTop: 3,
|
|
310
|
+
marginBottom: 5,
|
|
311
|
+
table: {
|
|
312
|
+
widths: this.GetWidths(ShowTaxColumn, printOptions),
|
|
313
|
+
headerRows: 1,
|
|
314
|
+
body: this.BuildTableBodyForLaborAndParts(Items, ShowTaxColumn, SType, printOptions, size)
|
|
315
|
+
},
|
|
316
|
+
layout: {
|
|
317
|
+
hLineWidth: function (i, node) {
|
|
318
|
+
return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
|
|
319
|
+
},
|
|
320
|
+
vLineWidth: function (i, node) {
|
|
321
|
+
return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
|
|
322
|
+
},
|
|
323
|
+
hLineColor: function (i, node) {
|
|
324
|
+
return 'gray';
|
|
325
|
+
},
|
|
326
|
+
vLineColor: function (i, node) {
|
|
327
|
+
return 'gray';
|
|
328
|
+
},
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
static GetWidths(ShowTaxColumn, printOptions) {
|
|
333
|
+
if (ShowTaxColumn && printOptions.Tax !== 'NO') {
|
|
334
|
+
if (printOptions.Disc === 'NO') {
|
|
335
|
+
return [16, '*', 40, 45, 25, 20, 20, 45, 45, 30, 50];
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
return [16, '*', 40, 45, 25, 20, 20, 45, 45, 35, 30, 50];
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
if (printOptions.Disc === 'NO') {
|
|
343
|
+
return [22, '*', 40, 45, 25, 20, 20, 50, 50, 50];
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
return [22, '*', 40, 45, 25, 20, 20, 50, 50, 50, 50];
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
static GetAddress(Entity) {
|
|
351
|
+
return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
|
|
352
|
+
}
|
|
353
|
+
static BuildTableBodyForLaborAndParts(Items, ShowTaxColumn, SType, printOptions, size) {
|
|
354
|
+
let body = this.GetHeaderNames(ShowTaxColumn, SType, printOptions);
|
|
355
|
+
let j = 1;
|
|
356
|
+
Items.forEach((item, index) => {
|
|
357
|
+
var _a, _b;
|
|
358
|
+
let dataRow = [];
|
|
359
|
+
dataRow.push({ text: index + 1, });
|
|
360
|
+
dataRow.push({ text: item.Desc, });
|
|
361
|
+
if (ShowTaxColumn) {
|
|
362
|
+
dataRow.push({ text: item.HSN, alignment: 'center', style: ['headerstyle'], });
|
|
363
|
+
}
|
|
364
|
+
dataRow.push({ text: (_a = item.Batch) === null || _a === void 0 ? void 0 : _a.BN, alignment: 'center', style: ['headerstyle'], });
|
|
365
|
+
dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadableExDate(item['Batch'].ExDt), alignment: 'center', style: ['headerstyle'], });
|
|
366
|
+
dataRow.push({ text: item.QtyAndUoM, alignment: 'right', style: ['headerstyle'], });
|
|
367
|
+
dataRow.push({ text: item.OfQty, alignment: 'right', style: ['headerstyle'], });
|
|
368
|
+
dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(item.MRP), alignment: 'right', style: ['headerstyle'], });
|
|
369
|
+
dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(item.UnPr), alignment: 'right', style: ['headerstyle'], });
|
|
370
|
+
if (printOptions.Disc !== 'NO') {
|
|
371
|
+
if (printOptions.Disc === 'PERC') {
|
|
372
|
+
dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(item.DiscPerc), alignment: 'right', style: ['headerstyle'], });
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(item.Disc), alignment: 'right', style: ['headerstyle'], });
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (ShowTaxColumn && printOptions.Tax !== 'NO') {
|
|
379
|
+
let Tax = (_b = item.TaxName) === null || _b === void 0 ? void 0 : _b.split('%');
|
|
380
|
+
dataRow.push({ text: tr_utils_1.TrUtils.IsNull(Tax) ? '' : Tax[0], alignment: 'right', style: ['headerstyle'], });
|
|
381
|
+
}
|
|
382
|
+
dataRow.push({ text: item.Ret ? '-' + tr_utils_1.TrUtils.FixPriceValue(item.LineTotal) : tr_utils_1.TrUtils.FixPriceValue(item.LineTotal), alignment: 'right', style: ['headerstyle'], });
|
|
383
|
+
body.push(dataRow);
|
|
384
|
+
if (index + 1 === j * 9) {
|
|
385
|
+
j++;
|
|
386
|
+
if (size === 'diff') {
|
|
387
|
+
let dataRow1 = [{ text: '', pageBreak: 'after' }, '', '', '', '', ''];
|
|
388
|
+
if (ShowTaxColumn) {
|
|
389
|
+
dataRow1.push('');
|
|
390
|
+
dataRow1.push('');
|
|
391
|
+
}
|
|
392
|
+
body.push(dataRow1);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
return body;
|
|
397
|
+
}
|
|
398
|
+
static GetHeaderNames(ShowTaxColumn, SType, printOptions) {
|
|
399
|
+
let HeadingNames;
|
|
400
|
+
if (ShowTaxColumn) {
|
|
401
|
+
HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', fontSize: 7 },
|
|
402
|
+
{ text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
|
|
403
|
+
{ text: 'HSN', style: 'tableheader1', Field: 'HSN' },
|
|
404
|
+
{ text: 'Batch No.', style: 'tableheader1', Field: 'Batches' },
|
|
405
|
+
{ text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate' },
|
|
406
|
+
{ text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
|
|
407
|
+
{ text: 'Free', style: 'tableheader1', Field: 'OfQty', alignment: 'right' },
|
|
408
|
+
{ text: 'MRP', style: 'tableheader1', Field: 'MRP', alignment: 'right' },
|
|
409
|
+
{ text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
|
|
410
|
+
{ text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
|
|
411
|
+
if (printOptions.Disc !== 'NO') {
|
|
412
|
+
HeadingNames[0].splice(9, 0, { text: (printOptions.Disc === 'PERC') ? 'Disc(%)' : 'Disc(Rs)', style: 'tableheader1', Field: 'Disc' });
|
|
413
|
+
}
|
|
414
|
+
if (printOptions.Tax !== 'NO') {
|
|
415
|
+
HeadingNames[0].splice(10, 0, { text: (SType === 'Intra') ? 'GST(%)' : 'IGST(%)', style: 'tableheader1', Field: 'TaxAmount', alignment: 'right' });
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left' },
|
|
420
|
+
{ text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
|
|
421
|
+
{ text: 'Batch No.', style: 'tableheader1', Field: 'Batches', alignment: 'left' },
|
|
422
|
+
{ text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate', alignment: 'left' },
|
|
423
|
+
{ text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
|
|
424
|
+
{ text: 'Free', style: 'tableheader1', Field: 'OfQty', alignment: 'right' },
|
|
425
|
+
{ text: 'MRP', style: 'tableheader1', Field: 'MRP', alignment: 'right' },
|
|
426
|
+
{ text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
|
|
427
|
+
// { text: 'Disc(%)', style: 'tableheader1', Field: 'Disc' },
|
|
428
|
+
{ text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
|
|
429
|
+
if (printOptions.Disc !== 'NO') {
|
|
430
|
+
HeadingNames[0].splice(8, 0, { text: (printOptions.Disc === 'PERC') ? 'Disc(%)' : 'Disc(Rs)', style: 'tableheader1', Field: 'Disc' });
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return HeadingNames;
|
|
434
|
+
}
|
|
435
|
+
static TotalDetails(ROPrintData) {
|
|
436
|
+
let totalDisc;
|
|
437
|
+
let totalTax;
|
|
438
|
+
if (!ROPrintData.Consolidate) {
|
|
439
|
+
totalTax = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartITax));
|
|
440
|
+
if (tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax)) {
|
|
441
|
+
totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartsDiscTotal));
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
totalDisc = tr_utils_1.TrUtils.FixPriceValue(Number(0) + Number(ROPrintData.CustPartsDiscTotal) + Number(ROPrintData.FixedDisc));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return [
|
|
448
|
+
{
|
|
449
|
+
style: 'tableExample',
|
|
450
|
+
marginTop: -3,
|
|
451
|
+
table: {
|
|
452
|
+
widths: ['*', '*'],
|
|
453
|
+
body: [
|
|
454
|
+
[
|
|
455
|
+
this.PartsTaxAmounts(ROPrintData.CustTaxGroupData, true, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn),
|
|
456
|
+
{
|
|
457
|
+
columns: [{ text: '', width: 150 }, this.GrandTotal('0.00', ROPrintData.CustPartsTotalBeforeDisc, totalDisc, totalTax, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, null, ROPrintData.Consolidate, null)]
|
|
458
|
+
}
|
|
459
|
+
],
|
|
460
|
+
]
|
|
461
|
+
},
|
|
462
|
+
layout: 'noBorders'
|
|
463
|
+
},
|
|
464
|
+
];
|
|
465
|
+
}
|
|
466
|
+
static PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
|
|
467
|
+
if (ShowTaxColumn) {
|
|
468
|
+
return {
|
|
469
|
+
stack: [this.AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
return '';
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
static GrandTotal(LaborAfterGST, PartsAfterGST, OverAllRecordDiscount, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, subTotal) {
|
|
477
|
+
let AccountFields = [
|
|
478
|
+
{ name: 'Total Disc.', value: OverAllRecordDiscount },
|
|
479
|
+
];
|
|
480
|
+
if (!Consolidate && !tr_utils_1.TrUtils.IsNull(subTotal)) {
|
|
481
|
+
AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(subTotal))) });
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
if (!Consolidate) {
|
|
485
|
+
AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))) });
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (!tr_utils_1.TrUtils.IsEmpty(totalTax)) {
|
|
489
|
+
AccountFields.push({ name: 'Total Tax', value: totalTax });
|
|
490
|
+
}
|
|
491
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Adj)) {
|
|
492
|
+
if (Adj > 0) {
|
|
493
|
+
Adj = '+' + tr_utils_1.TrUtils.FixPriceValue(Adj);
|
|
494
|
+
}
|
|
495
|
+
AccountFields.push({ name: 'Adjust', value: Adj });
|
|
496
|
+
}
|
|
497
|
+
if (For === enums_1.PayTypeEnum.Insurance) {
|
|
498
|
+
let total = {
|
|
499
|
+
name: 'Total',
|
|
500
|
+
value: OverAllRecordTotal
|
|
501
|
+
};
|
|
502
|
+
let Rounding = { name: 'Rounding', value: Rounded };
|
|
503
|
+
if (Rounding.value > 0) {
|
|
504
|
+
Rounding.value = '+' + Rounding.value;
|
|
505
|
+
}
|
|
506
|
+
let FinalTotal = { name: 'Final Total', value: GrandTotal, bold: true, fontSize: 12 };
|
|
507
|
+
AccountFields.push(total);
|
|
508
|
+
AccountFields.push(Rounding);
|
|
509
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
|
|
510
|
+
AccountFields.push(FinalTotal);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
let total = {
|
|
515
|
+
name: 'Total',
|
|
516
|
+
value: OverAllRecordTotal
|
|
517
|
+
};
|
|
518
|
+
let Rounding = { name: 'Rounding', value: Rounded };
|
|
519
|
+
let FinalTotal = { name: 'Final Total', value: GrandTotal };
|
|
520
|
+
if (Rounding.value > 0) {
|
|
521
|
+
Rounding.value = '+' + Rounding.value;
|
|
522
|
+
}
|
|
523
|
+
// AccountFields.push(total);
|
|
524
|
+
AccountFields.push(Rounding);
|
|
525
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(Rounded)) {
|
|
526
|
+
AccountFields.push(FinalTotal);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return {
|
|
530
|
+
style: ['columnheader', 'TotalsStyles'],
|
|
531
|
+
lineHeight: 0.7,
|
|
532
|
+
marginBottom: 5,
|
|
533
|
+
width: 'auto',
|
|
534
|
+
table: {
|
|
535
|
+
widths: ['auto', 'auto', 60],
|
|
536
|
+
body: this.GrandTotalTable(AccountFields)
|
|
537
|
+
},
|
|
538
|
+
layout: 'noBorders'
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
static AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
|
|
542
|
+
if (ShowIGST) {
|
|
543
|
+
return {
|
|
544
|
+
style: 'tableExample1',
|
|
545
|
+
table: {
|
|
546
|
+
widths: [50, 30, 45, 45],
|
|
547
|
+
headerRows: 1,
|
|
548
|
+
body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
|
|
549
|
+
},
|
|
550
|
+
layout: this.HeaderLineStyle(),
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
return {
|
|
555
|
+
style: 'tableExample1',
|
|
556
|
+
table: {
|
|
557
|
+
widths: [50, 30, 30, 60, 60],
|
|
558
|
+
headerRows: 1,
|
|
559
|
+
body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
|
|
560
|
+
},
|
|
561
|
+
layout: this.HeaderLineStyle(),
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
static CreateHeadingAllHSNTaxList(ShowIGST) {
|
|
566
|
+
let HeaderNames = [{ text: 'HSN', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'HSN', alignment: 'right' },
|
|
567
|
+
{ text: 'Taxable Value', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount', alignment: 'right' },
|
|
568
|
+
{ text: 'Amount', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount', alignment: 'right' },
|
|
569
|
+
];
|
|
570
|
+
if (ShowIGST) {
|
|
571
|
+
HeaderNames.splice(1, 0, { text: 'IGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'IGST', alignment: 'right' });
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
HeaderNames.splice(1, 0, { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST', alignment: 'right' });
|
|
575
|
+
HeaderNames.splice(2, 0, { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST', alignment: 'right' });
|
|
576
|
+
}
|
|
577
|
+
return HeaderNames;
|
|
578
|
+
}
|
|
579
|
+
static CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
|
|
580
|
+
if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
|
|
581
|
+
var body = [];
|
|
582
|
+
let columns = this.CreateHeadingAllHSNTaxList(ShowIGST);
|
|
583
|
+
body.push(columns);
|
|
584
|
+
PartsTaxInfo.forEach((part) => {
|
|
585
|
+
var dataRow = [];
|
|
586
|
+
columns.forEach((column) => {
|
|
587
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) &&
|
|
588
|
+
!tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
|
|
589
|
+
|| column.Field === 'TotalTaxAmount') {
|
|
590
|
+
if (column.Field === 'HSN') {
|
|
591
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(part[column.Field]).toString(), alignment: 'right', nowrap: true });
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
part[column.Field] = '';
|
|
599
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right' });
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
body.push(dataRow);
|
|
603
|
+
});
|
|
604
|
+
return body;
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
return [{}];
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
static HeaderLineStyle() {
|
|
611
|
+
return {
|
|
612
|
+
hLineWidth: function (i, node) {
|
|
613
|
+
return (i === 1) ? 0.1 : 0;
|
|
614
|
+
},
|
|
615
|
+
vLineWidth: function (i, node) {
|
|
616
|
+
return (i === 0 || i === node.table.widths.length) ? 0 : 0;
|
|
617
|
+
},
|
|
618
|
+
hLineColor: function (i, node) {
|
|
619
|
+
let color;
|
|
620
|
+
if (i === 0 || i === node.table.body.length) {
|
|
621
|
+
color = 'black';
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
if (i === 1) {
|
|
625
|
+
color = 'lightgray';
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
color = 'lightgray';
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return color;
|
|
632
|
+
},
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
exports.InvoicePortraitPrintService = InvoicePortraitPrintService;
|