shareneus 1.4.95 → 1.4.97
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.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -1
- package/dist/sales-receive/sales-receive-pdf.service.d.ts +272 -0
- package/dist/sales-receive/sales-receive-pdf.service.js +578 -0
- package/dist/sales-receive/sales-receive-print.service.d.ts +13 -0
- package/dist/sales-receive/sales-receive-print.service.js +187 -0
- package/dist/sales-receive/sales-receive-totals.service.d.ts +212 -0
- package/dist/sales-receive/sales-receive-totals.service.js +573 -0
- package/dist/sales-receive/sales-total-calculation.d.ts +5 -0
- package/dist/sales-receive/sales-total-calculation.js +152 -0
- package/package.json +1 -1
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SalesReceivePdfService = void 0;
|
|
4
|
+
const shared_pdf_service_1 = require("../shared/shared-pdf.service");
|
|
5
|
+
const shared_print_service_1 = require("../shared/shared-print.service");
|
|
6
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
|
+
class SalesReceivePdfService {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.FontSize = 8;
|
|
10
|
+
}
|
|
11
|
+
static GetSalesReceivePrint(SRPrintData, win, moreDiscDetails) {
|
|
12
|
+
var dd = {
|
|
13
|
+
info: {
|
|
14
|
+
title: this.GetFileName(SRPrintData),
|
|
15
|
+
},
|
|
16
|
+
background: function (currentPage, pageSize) {
|
|
17
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(SRPrintData.Image, pageSize, SRPrintData.Entity.Wmark);
|
|
18
|
+
},
|
|
19
|
+
header: function (currentPage, pageCount) {
|
|
20
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
21
|
+
},
|
|
22
|
+
pageMargins: [10, 15, 10, 15],
|
|
23
|
+
content: [
|
|
24
|
+
this.CommonHeaderDetails(SRPrintData),
|
|
25
|
+
this.PreparesparePartsTable(SRPrintData),
|
|
26
|
+
this.CommonTotalDetails(SRPrintData, moreDiscDetails)
|
|
27
|
+
],
|
|
28
|
+
styles: shared_pdf_service_1.SharedPDFService.GetStyles()
|
|
29
|
+
};
|
|
30
|
+
return dd;
|
|
31
|
+
}
|
|
32
|
+
static GetFileName(SRPrintData) {
|
|
33
|
+
let fileName = SRPrintData.HeaderName;
|
|
34
|
+
if (!tr_utils_1.TrUtils.IsNull(SRPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(SRPrintData.Product.RegNo)) {
|
|
35
|
+
fileName = fileName + '-' + SRPrintData.Product.RegNo;
|
|
36
|
+
}
|
|
37
|
+
return fileName;
|
|
38
|
+
}
|
|
39
|
+
static CommonHeaderDetails(SRPrintData) {
|
|
40
|
+
return [
|
|
41
|
+
this.GetMainHeaderDetails(SRPrintData.Entity, SRPrintData.HeaderName, SRPrintData.Image, SRPrintData.HColor, SRPrintData.AColor),
|
|
42
|
+
shared_pdf_service_1.SharedPDFService.GetCustomerAndVehicleDetails(SRPrintData._id, SRPrintData.CrDate, SRPrintData.PrDate, SRPrintData.MOut, SRPrintData.MIn, SRPrintData.Product, SRPrintData.PrintType, SRPrintData.For, SRPrintData.SurName, SRPrintData.SurPhone, SRPrintData.Type, SRPrintData.SurEmail, SRPrintData.InsComp, SRPrintData.PolNo, SRPrintData.PolType, SRPrintData.Customer, SRPrintData.IsProforma, SRPrintData.Settings, null, false, null, null, null, null, SRPrintData.DoS),
|
|
43
|
+
shared_pdf_service_1.SharedPDFService.GetOwnerDetails(SRPrintData.Cust, SRPrintData.Type, SRPrintData.For),
|
|
44
|
+
shared_pdf_service_1.SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
|
|
45
|
+
shared_pdf_service_1.SharedPDFService.GetDisplayTable(),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
static GetMainHeaderDetails(Entity, HeaderName, Image, HColor, AColor) {
|
|
49
|
+
return [
|
|
50
|
+
// SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, null),
|
|
51
|
+
shared_pdf_service_1.SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, null),
|
|
52
|
+
shared_pdf_service_1.SharedPDFService.GetPrintType(HeaderName),
|
|
53
|
+
shared_pdf_service_1.SharedPDFService.HeaderAfterLine()
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
static PreparesparePartsTable(SRPrintData) {
|
|
57
|
+
let List = [];
|
|
58
|
+
if (SRPrintData.Entity.Body === 1) {
|
|
59
|
+
for (let i = 0; i < SRPrintData.PrintInfo.length; i++) {
|
|
60
|
+
if (tr_utils_1.TrUtils.IsNull(SRPrintData.PrintInfo[i].Text)) {
|
|
61
|
+
SRPrintData.PrintInfo[i].Text = '';
|
|
62
|
+
}
|
|
63
|
+
List.push(SRPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(SRPrintData.PrintInfo[i].Items), [], SRPrintData.Entity.MPN));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (SRPrintData.Entity.Body === 2) {
|
|
68
|
+
for (let i = 0; i < SRPrintData.PrintInfo.length; i++) {
|
|
69
|
+
if (tr_utils_1.TrUtils.IsNull(SRPrintData.PrintInfo[i].Text)) {
|
|
70
|
+
SRPrintData.PrintInfo[i].Text = '';
|
|
71
|
+
}
|
|
72
|
+
List.push(SRPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(SRPrintData.PrintInfo[i].Items), [], SRPrintData.ShowTaxColumn, SRPrintData.Entity.MPN, SRPrintData.Entity.Body, SRPrintData.ShowIGST, SRPrintData.ConsolidateGST, SRPrintData.ShowDiscountColumn));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
if (SRPrintData.Summary) {
|
|
77
|
+
List.push('', this.GetLaborPartsTableForView(SRPrintData.Items, [], SRPrintData.Entity.MPN));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
for (let i = 0; i < SRPrintData.PrintInfo.length; i++) {
|
|
81
|
+
if (tr_utils_1.TrUtils.IsNull(SRPrintData.PrintInfo[i].Text)) {
|
|
82
|
+
SRPrintData.PrintInfo[i].Text = '';
|
|
83
|
+
}
|
|
84
|
+
List.push(SRPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(SRPrintData.PrintInfo[i].Items), [], SRPrintData.ShowTaxColumn, SRPrintData.Entity.MPN, SRPrintData.Entity.Body, SRPrintData.ShowIGST, SRPrintData.ConsolidateGST, SRPrintData.ShowDiscountColumn));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return List;
|
|
90
|
+
}
|
|
91
|
+
static GetLaborPartsTableForView(Parts, Ops, PrintPartNo) {
|
|
92
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
93
|
+
if (PrintPartNo) {
|
|
94
|
+
return {
|
|
95
|
+
style: 'tableExample',
|
|
96
|
+
// marginLeft: 20,
|
|
97
|
+
table: {
|
|
98
|
+
widths: [15, 30, 170, 85, 15, 20, 50, 30, 30, 60],
|
|
99
|
+
// headerRows: 2,
|
|
100
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
|
|
101
|
+
},
|
|
102
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return {
|
|
107
|
+
style: 'tableExample',
|
|
108
|
+
// marginLeft: 20,
|
|
109
|
+
table: {
|
|
110
|
+
widths: [15, 200, 55, 25, 55, 55, 40, 15, 60],
|
|
111
|
+
// headerRows: 2,
|
|
112
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
|
|
113
|
+
},
|
|
114
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
let a = '';
|
|
120
|
+
return a;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
static WithOutDiscountFieldTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
124
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
125
|
+
if (PrintPartNo) {
|
|
126
|
+
return {
|
|
127
|
+
style: 'tableExample',
|
|
128
|
+
marginLeft: 20,
|
|
129
|
+
table: {
|
|
130
|
+
widths: [15, 67, 160, 25, 50, 60, 30, 53],
|
|
131
|
+
headerRows: 1,
|
|
132
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
133
|
+
},
|
|
134
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return {
|
|
139
|
+
style: 'tableExample',
|
|
140
|
+
marginLeft: 20,
|
|
141
|
+
table: {
|
|
142
|
+
widths: [15, 215, 25, 50, 60, 45, 60],
|
|
143
|
+
headerRows: 1,
|
|
144
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
145
|
+
},
|
|
146
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
let a = '';
|
|
152
|
+
return a;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
static BuildTableBodyForLaborAndParts(Parts, Labor, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
156
|
+
var body = [];
|
|
157
|
+
let columns = shared_print_service_1.PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
|
|
158
|
+
// if (ShowTaxColumn) {
|
|
159
|
+
for (let i = 0; i < columns.length; i++) {
|
|
160
|
+
body.push(columns[i]);
|
|
161
|
+
}
|
|
162
|
+
columns = columns[1];
|
|
163
|
+
// } else {
|
|
164
|
+
// body.push(columns);
|
|
165
|
+
// }
|
|
166
|
+
let DummyOps = [];
|
|
167
|
+
if (Parts.length !== 0) {
|
|
168
|
+
let dummypartadding1 = {};
|
|
169
|
+
dummypartadding1.SNo = '';
|
|
170
|
+
dummypartadding1.Desc = 'Spare Parts';
|
|
171
|
+
dummypartadding1.Qty = '';
|
|
172
|
+
dummypartadding1.UnPr = '';
|
|
173
|
+
dummypartadding1.LineTotal = '';
|
|
174
|
+
Parts.unshift(dummypartadding1);
|
|
175
|
+
}
|
|
176
|
+
let SNo = 1;
|
|
177
|
+
Parts.forEach((part) => {
|
|
178
|
+
var dataRow = [];
|
|
179
|
+
columns.forEach((column) => {
|
|
180
|
+
if ((!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]))
|
|
181
|
+
|| (column.text === 'Line Total')) {
|
|
182
|
+
if (part[column.Field] === 'Spare Parts') {
|
|
183
|
+
dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
|
|
187
|
+
&& tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
|
|
188
|
+
part[column.Field] = '';
|
|
189
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'QtyAndUoM'
|
|
193
|
+
|| column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
|
|
194
|
+
|| column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
|
|
195
|
+
if (column.Field === 'Disc') {
|
|
196
|
+
if (column.type === 'percentage') {
|
|
197
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part[column.Field])) {
|
|
198
|
+
dataRow.push({ text: part[column.Field].toString(), noWrap: true });
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
dataRow.push({ text: '', noWrap: true });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
|
|
206
|
+
dataRow.push({ text: part[column.Field].toString(), noWrap: true });
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
dataRow.push({ text: '', noWrap: true });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
|
|
215
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
dataRow.push({ text: '', noWrap: true });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
dataRow.push(part[column.Field].toString());
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
if (column.Field === 'SNo') {
|
|
230
|
+
part[column.Field] = SNo;
|
|
231
|
+
SNo = SNo + 1;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
part[column.Field] = '';
|
|
235
|
+
}
|
|
236
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
body.push(dataRow);
|
|
240
|
+
});
|
|
241
|
+
if (Labor.length !== 0) {
|
|
242
|
+
let dummypartadding1 = {};
|
|
243
|
+
dummypartadding1.SNo = '';
|
|
244
|
+
dummypartadding1.Desc = 'Labor';
|
|
245
|
+
dummypartadding1.Qty = '';
|
|
246
|
+
dummypartadding1.UnPr = '';
|
|
247
|
+
dummypartadding1.LineTotal = '';
|
|
248
|
+
Labor.unshift(dummypartadding1);
|
|
249
|
+
// DummyOps.unshift(dummypartadding1);
|
|
250
|
+
}
|
|
251
|
+
if (Body === 2) {
|
|
252
|
+
for (let i = 0; i < Labor.length; i++) {
|
|
253
|
+
Labor[i].UnPr = '';
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Labor.forEach((Ops: any) => {
|
|
257
|
+
// var dataRow: any = [];
|
|
258
|
+
// columns.forEach((column: any) => {
|
|
259
|
+
// if ((!TrUtils.IsFixedZero(Ops[column.Field]) && !TrUtils.IsNull(Ops[column.Field]))
|
|
260
|
+
// || (column.text === 'Line Total')) {
|
|
261
|
+
// if (Ops[column.Field] === 'Labor') {
|
|
262
|
+
// dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
263
|
+
// } else {
|
|
264
|
+
// if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
|
|
265
|
+
// && TrUtils.CheckInvalidSelect(Ops.TCode))) {
|
|
266
|
+
// Ops[column.Field] = '';
|
|
267
|
+
// dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
|
|
268
|
+
// } else {
|
|
269
|
+
// if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
|
|
270
|
+
// || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
|
|
271
|
+
// || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
|
|
272
|
+
// if (column.Field === 'Disc') {
|
|
273
|
+
// if (column.type === 'percentage') {
|
|
274
|
+
// if (Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
|
|
275
|
+
// dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
|
|
276
|
+
// } else {
|
|
277
|
+
// dataRow.push({ text: '', noWrap: true });
|
|
278
|
+
// }
|
|
279
|
+
// } else {
|
|
280
|
+
// if (!Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
|
|
281
|
+
// dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
|
|
282
|
+
// } else {
|
|
283
|
+
// dataRow.push({ text: '', noWrap: true });
|
|
284
|
+
// }
|
|
285
|
+
// }
|
|
286
|
+
// } else {
|
|
287
|
+
// if (!TrUtils.IsZero(Ops[column.Field])) {
|
|
288
|
+
// dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
289
|
+
// } else {
|
|
290
|
+
// dataRow.push({ text: '', noWrap: true });
|
|
291
|
+
// }
|
|
292
|
+
// }
|
|
293
|
+
// } else {
|
|
294
|
+
// dataRow.push(Ops[column.Field].toString());
|
|
295
|
+
// }
|
|
296
|
+
// }
|
|
297
|
+
// }
|
|
298
|
+
// } else {
|
|
299
|
+
// if (column.Field === 'SNo') {
|
|
300
|
+
// Ops[column.Field] = SNo;
|
|
301
|
+
// SNo = SNo + 1;
|
|
302
|
+
// } else {
|
|
303
|
+
// Ops[column.Field] = '';
|
|
304
|
+
// }
|
|
305
|
+
// dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
|
|
306
|
+
// }
|
|
307
|
+
// });
|
|
308
|
+
// body.push(dataRow);
|
|
309
|
+
// });
|
|
310
|
+
return body;
|
|
311
|
+
}
|
|
312
|
+
static GetWithOutDiscAndTaxFieldHeader(Parts, Ops, ShowTaxColumn, PrintPartNo, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
313
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
314
|
+
if (ShowTaxColumn) {
|
|
315
|
+
return this.TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
if (ConsolidateGST) {
|
|
319
|
+
return this.ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
return this.NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
let a = '';
|
|
328
|
+
return a;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
static TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
332
|
+
if (PrintPartNo) {
|
|
333
|
+
if (ShowIGST) {
|
|
334
|
+
return {
|
|
335
|
+
style: 'tableExample',
|
|
336
|
+
table: {
|
|
337
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
338
|
+
// headerRows: 2,
|
|
339
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
340
|
+
},
|
|
341
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
return {
|
|
346
|
+
style: 'tableExample',
|
|
347
|
+
table: {
|
|
348
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
349
|
+
// headerRows: 2,
|
|
350
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
351
|
+
},
|
|
352
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
if (ShowIGST) {
|
|
358
|
+
return {
|
|
359
|
+
style: 'tableExample',
|
|
360
|
+
table: {
|
|
361
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
362
|
+
// headerRows: 2,
|
|
363
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
364
|
+
},
|
|
365
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
return {
|
|
370
|
+
style: 'tableExample',
|
|
371
|
+
table: {
|
|
372
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
373
|
+
// headerRows: 2,
|
|
374
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
375
|
+
},
|
|
376
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
static ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
382
|
+
if (PrintPartNo) {
|
|
383
|
+
return {
|
|
384
|
+
style: 'tableExample',
|
|
385
|
+
table: {
|
|
386
|
+
widths: [15, 70, 273, 25, 60, 80, 10, 40],
|
|
387
|
+
// headerRows: 1,
|
|
388
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
389
|
+
},
|
|
390
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
return {
|
|
395
|
+
style: 'tableExample',
|
|
396
|
+
table: {
|
|
397
|
+
widths: [20, 300, 50, 80, 80, 10, 40],
|
|
398
|
+
// headerRows: 1,
|
|
399
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
400
|
+
},
|
|
401
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
static NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
406
|
+
if (PrintPartNo) {
|
|
407
|
+
return {
|
|
408
|
+
style: 'tableExample',
|
|
409
|
+
table: {
|
|
410
|
+
widths: shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
|
|
411
|
+
// headerRows: 1,
|
|
412
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
413
|
+
},
|
|
414
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
return {
|
|
419
|
+
style: 'tableExample',
|
|
420
|
+
table: {
|
|
421
|
+
widths: shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
|
|
422
|
+
// headerRows: 1,
|
|
423
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
424
|
+
},
|
|
425
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
static buildTableForCustomerLabor(Parts, Ops, PrintPartNo, customerorInsurance) {
|
|
430
|
+
var body = [];
|
|
431
|
+
let columns;
|
|
432
|
+
columns = this.getSummaryHeaders(PrintPartNo);
|
|
433
|
+
body.push(columns);
|
|
434
|
+
if (Parts.length !== 0) {
|
|
435
|
+
let dummypartadding1 = {};
|
|
436
|
+
dummypartadding1.SNo = '';
|
|
437
|
+
dummypartadding1.Desc = 'Spare Parts';
|
|
438
|
+
dummypartadding1.Qty = '';
|
|
439
|
+
dummypartadding1.UnPr = '';
|
|
440
|
+
dummypartadding1.Price = '';
|
|
441
|
+
dummypartadding1.DiscountedPrice = '';
|
|
442
|
+
dummypartadding1.LineTotal = '';
|
|
443
|
+
dummypartadding1.QtyAndUoM = '';
|
|
444
|
+
dummypartadding1.HSN = '';
|
|
445
|
+
dummypartadding1.MPN = '';
|
|
446
|
+
Parts.unshift(dummypartadding1);
|
|
447
|
+
}
|
|
448
|
+
let SNo = 1;
|
|
449
|
+
Parts.forEach((part) => {
|
|
450
|
+
var dataRow = [];
|
|
451
|
+
columns.forEach((column) => {
|
|
452
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])
|
|
453
|
+
|| column.text === 'Line Total') {
|
|
454
|
+
if (part[column.Field] === 'Spare Parts') {
|
|
455
|
+
dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
// tslint:disable-next-line:max-line-length
|
|
459
|
+
if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
|
|
460
|
+
column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'UnPr') {
|
|
461
|
+
if (column.Field === 'Disc Amt') {
|
|
462
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
// dataRow.push({ text: part[column.Field].toString() });
|
|
470
|
+
if (column.Field === 'Desc') {
|
|
471
|
+
let DescData = [];
|
|
472
|
+
DescData.push(part[column.Field].toString());
|
|
473
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
474
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
475
|
+
}
|
|
476
|
+
dataRow.push({ stack: DescData });
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
if (column.Field === 'SNo') {
|
|
486
|
+
part[column.Field] = SNo;
|
|
487
|
+
SNo = SNo + 1;
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
part[column.Field] = '';
|
|
491
|
+
}
|
|
492
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
body.push(dataRow);
|
|
496
|
+
});
|
|
497
|
+
// if (Ops.length !== 0) {
|
|
498
|
+
// let dummypartadding1: any = {};
|
|
499
|
+
// dummypartadding1.SNo = '';
|
|
500
|
+
// dummypartadding1.Desc = 'Labor';
|
|
501
|
+
// dummypartadding1.Qty = '';
|
|
502
|
+
// dummypartadding1.UnPr = '';
|
|
503
|
+
// dummypartadding1.Price = '';
|
|
504
|
+
// dummypartadding1.DiscountedPrice = '';
|
|
505
|
+
// dummypartadding1.LineTotal = '';
|
|
506
|
+
// dummypartadding1.QtyAndUoM = '';
|
|
507
|
+
// dummypartadding1.HSN = '';
|
|
508
|
+
// Ops.unshift(dummypartadding1);
|
|
509
|
+
// }
|
|
510
|
+
// Ops.forEach((labor: any) => {
|
|
511
|
+
// var dataRow: any = [];
|
|
512
|
+
// columns.forEach((column: any) => {
|
|
513
|
+
// if (!TrUtils.IsFixedZero(labor[column.Field]) && !TrUtils.IsNull(labor[column.Field])
|
|
514
|
+
// || column.text === 'Line Total') {
|
|
515
|
+
// if (labor[column.Field] === 'Labor') {
|
|
516
|
+
// dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
517
|
+
// } else {
|
|
518
|
+
// if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount'
|
|
519
|
+
// || column.Field === 'UnPr' || column.Field === 'CustPrice' || column.Field === 'InsPrice') {
|
|
520
|
+
// if (column.Field === 'Disc Amt') {
|
|
521
|
+
// dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
522
|
+
// } else {
|
|
523
|
+
// dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
524
|
+
// }
|
|
525
|
+
// } else {
|
|
526
|
+
// dataRow.push({ text: labor[column.Field].toString() });
|
|
527
|
+
// }
|
|
528
|
+
// }
|
|
529
|
+
// } else {
|
|
530
|
+
// if (column.Field === 'SNo') {
|
|
531
|
+
// labor[column.Field] = SNo;
|
|
532
|
+
// SNo = SNo + 1;
|
|
533
|
+
// } else {
|
|
534
|
+
// labor[column.Field] = '';
|
|
535
|
+
// }
|
|
536
|
+
// dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
|
|
537
|
+
// }
|
|
538
|
+
// });
|
|
539
|
+
// body.push(dataRow);
|
|
540
|
+
// });
|
|
541
|
+
return body;
|
|
542
|
+
}
|
|
543
|
+
static getSummaryHeaders(permission) {
|
|
544
|
+
let headersNames = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
|
|
545
|
+
{ text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
|
|
546
|
+
{ text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
|
|
547
|
+
// { text: 'Rate / Unit', style: 'tableheader', Field: 'UnPr' },
|
|
548
|
+
{ text: 'Ins. Amt', style: 'tableheader', Field: 'AssPr' },
|
|
549
|
+
{ text: 'Cust. Amt', style: 'tableheader', Field: 'Pr' },
|
|
550
|
+
{ text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
|
|
551
|
+
{ text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
|
|
552
|
+
{ text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
|
|
553
|
+
if (permission) {
|
|
554
|
+
let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
|
|
555
|
+
let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
|
|
556
|
+
headersNames.unshift(sno, MPN);
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
|
|
560
|
+
headersNames.unshift(sno);
|
|
561
|
+
}
|
|
562
|
+
return headersNames;
|
|
563
|
+
}
|
|
564
|
+
static CommonTotalDetails(SRPrintData, moreDiscDetails) {
|
|
565
|
+
let CommonDetails = [
|
|
566
|
+
shared_pdf_service_1.SharedPDFService.GetDebitTotalDetails(SRPrintData, 0, 0, 0, 0, 0, SRPrintData.CustPartIGST, SRPrintData.ShowIGST, SRPrintData.ShowTaxColumn, SRPrintData.CustPartsTotalBeforeDisc, SRPrintData.CustPartsDiscTotal, SRPrintData.CustPartCGST, SRPrintData.CustPartSGST, SRPrintData.CustTaxGroupData, SRPrintData.ShowAccParts, SRPrintData.CustLaborAfterTax, SRPrintData.CustPartAfterTax, SRPrintData.FixedDisc, SRPrintData.For, SRPrintData.FixedTotal, SRPrintData.CustTotalRoundedBy, SRPrintData.CustRoundedTotal, SRPrintData.ShowTaxColumn, SRPrintData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable(SRPrintData.Settings.Tax), SRPrintData.CustLaborITax, SRPrintData.CustPartITax, SRPrintData.Consolidate, SRPrintData.From, moreDiscDetails),
|
|
567
|
+
shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(SRPrintData.Type, SRPrintData.Paid, SRPrintData.Due, SRPrintData.Sts, false, SRPrintData.Entity.DecimalsNumber),
|
|
568
|
+
shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(SRPrintData.Entity.Terms),
|
|
569
|
+
shared_pdf_service_1.SharedPDFService.GetUnderLine(),
|
|
570
|
+
shared_pdf_service_1.SharedPDFService.GetSignatures(SRPrintData.Entity.CName, SRPrintData.Type, SRPrintData.For),
|
|
571
|
+
];
|
|
572
|
+
if (SRPrintData.Type !== 'Invoice') {
|
|
573
|
+
CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine());
|
|
574
|
+
}
|
|
575
|
+
return CommonDetails;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
exports.SalesReceivePdfService = SalesReceivePdfService;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class SalesReceivePrintService {
|
|
2
|
+
static GetSalesReceivePrintInfo(OriginalSalesReceiveData: any, OriginalEntityData: any, image: any, IncludeGST: boolean, ConsolidateGST: boolean, TaxCodes: any, IsProforma: boolean): any;
|
|
3
|
+
static GetPrintConditionsBasedOnInput(SalesReceivePrintData: any, IncludeGST: boolean, ConsolidateGST: boolean, ForInsurance: boolean, SType: any, OriginalSalesReceiveData: any, IsProforma: boolean): any;
|
|
4
|
+
static GetSalesReceiveTypeHeading(SalesReceivePrintData: any, OriginalSalesReceiveData: any, IncludeGST: boolean, ConsolidateGST: boolean, IsProforma: boolean): any;
|
|
5
|
+
static GetSalesReceiveOtherDetailsForPrint(SalesReceivePrintData: any, OriginalSalesReceiveData: any): any;
|
|
6
|
+
static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number): any;
|
|
7
|
+
static ReverseItemsForSalesReceivePrint(argSalesReceiveData: any): any;
|
|
8
|
+
static PrepareFormatForSalesReceivePrint(SalesReceivePrintData: any, ROType: any, InvoiceStatus: any): any[];
|
|
9
|
+
static GetFormattedProductDataForPrint(OriginalSalesReceiveData: any, SalesReceivePrintData: any): any;
|
|
10
|
+
static GetBillNameForSalesReceivePrint(OriginalSalesReceiveData: any, SalesReceivePrintData: any): any;
|
|
11
|
+
static GetCustomerDetails(OriginalSalesReceiveData: any): any;
|
|
12
|
+
static GetBillToName(Title: any, Name: string): string;
|
|
13
|
+
}
|