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.
- package/dist/aggregation/aggregation.js +60 -0
- package/dist/enums/cache-enums.js +37 -0
- package/dist/enums/code-enums.js +288 -0
- package/dist/enums/enums.js +362 -0
- package/dist/enums/industry-enums.js +24 -0
- package/dist/excel-files/GSTR-RO-excel.service.js +935 -0
- package/dist/excel-files/GSTR1-excel.service.js +295 -0
- package/dist/excel-files/GSTR2-excel.service.js +295 -0
- package/dist/excel-files/analysis-excel.service.js +297 -0
- package/dist/excel-files/category-wise-item-excel.service.js +274 -0
- package/dist/excel-files/cust-balance-excel.service.js +287 -0
- package/dist/excel-files/cust-wise-sales-details.js +320 -0
- package/dist/excel-files/cust-wise-sales-summary-excel.service.js +302 -0
- package/dist/excel-files/expiring-drugs-excel.service.js +292 -0
- package/dist/excel-files/insurance-expire-excel.service.js +301 -0
- package/dist/excel-files/invoice-wise-excel.service.js +857 -0
- package/dist/excel-files/item-wise-doctor-sale-excel.service.js +258 -0
- package/dist/excel-files/item-wise-mout-details.js +292 -0
- package/dist/excel-files/item-wise-mout-summary.js +286 -0
- package/dist/excel-files/items-wise-sales-excel.service.js +314 -0
- package/dist/excel-files/manf-wise-sales-excel.service.js +276 -0
- package/dist/excel-files/operator-wise-details.js +265 -0
- package/dist/excel-files/operator-wise-summary.js +266 -0
- package/dist/excel-files/payment-receive-excel.service.js +225 -0
- package/dist/excel-files/payments-made-excel.service.js +302 -0
- package/dist/excel-files/repair-orders-excel.service.js +255 -0
- package/dist/excel-files/sa-wise-labor-sales-excel.service.js +232 -0
- package/dist/excel-files/sa-wise-part-sales-excel.service.js +232 -0
- package/dist/excel-files/sale-summary-excel.service.js +326 -0
- package/dist/excel-files/sales-by-service-details-excel.service.js +1 -0
- package/dist/excel-files/sales-by-service-summary-excel.service.js +422 -0
- package/dist/excel-files/scheduled-drug-summary-excel.service.js +367 -0
- package/dist/excel-files/scheduled-drugs-excel.service.js +366 -0
- package/dist/excel-files/spares-issue-excel.service.js +492 -0
- package/dist/excel-files/stock-excel.service.js +283 -0
- package/dist/excel-files/tally-sales-import.service.js +765 -0
- package/dist/excel-files/ven-balance-excel.service.js +293 -0
- package/dist/index.js +237 -0
- package/dist/services/analysis-pdf.service.js +105 -0
- package/dist/services/appointment-total.service.js +253 -0
- package/dist/services/auto-sales-receipt-pdf.service.js +539 -0
- package/dist/services/category-wise-item-pdf.service.js +98 -0
- package/dist/services/checklist-pdf.js +140 -0
- package/dist/services/checklists-pdf.js +124 -0
- package/dist/services/cn-print.service.js +211 -0
- package/dist/services/consultation-fee-receipt.service.js +378 -0
- package/dist/services/consultation-full-pdf.service.js +220 -0
- package/dist/services/consultation-pdf.service.js +360 -0
- package/dist/services/credit-note-pdf.service.js +578 -0
- package/dist/services/credit-note-totals.service.js +328 -0
- package/dist/services/cust-wise-sales-details-pdf.service.js +118 -0
- package/dist/services/cust-wise-sales-summary-pdf.service.js +111 -0
- package/dist/services/customer-balances-pdf.service.js +169 -0
- package/dist/services/dc-landscape-pdf.service.js +903 -0
- package/dist/services/dc-landscape-without-price-pdf.service.js +853 -0
- package/dist/services/dc-without-price-pdf.service.js +489 -0
- package/dist/services/debit-note-pdf.service.js +673 -0
- package/dist/services/debit-note-print.service.js +234 -0
- package/dist/services/debit-note-totals.service.js +293 -0
- package/dist/services/delivery-challan-pdf.service.js +434 -0
- package/dist/services/delivery-challan-print.service.js +177 -0
- package/dist/services/delivery-challan-totals.js +339 -0
- package/dist/services/equipment-design-pdf.service.js +144 -0
- package/dist/services/est.print-service.js +1053 -0
- package/dist/services/expiring-drugs-pdf.service.js +156 -0
- package/dist/services/hc-inv-pdf.service.js +837 -0
- package/dist/services/insurance-expire-pdf.service.js +99 -0
- package/dist/services/inv-pdf.service.js +785 -0
- package/dist/services/inv-print.service.js +415 -0
- package/dist/services/invoice-landscape-pdf.service.js +909 -0
- package/dist/services/invoice-total.service.js +659 -0
- package/dist/services/issue-parts-pdf.service.js +763 -0
- package/dist/services/item-detais-pdf.js +136 -0
- package/dist/services/item-wise-doctor-sale-pdf.service.js +164 -0
- package/dist/services/item-wise-mout-details-pdf.js +107 -0
- package/dist/services/item-wise-mout-summary-pdf.js +99 -0
- package/dist/services/item-wise-sales-pdf.service.js +178 -0
- package/dist/services/manf-wise-sales-pdf.service.js +173 -0
- package/dist/services/meeting-pdf.js +369 -0
- package/dist/services/mout-pdf.service.js +503 -0
- package/dist/services/operator-wise-details-pdf.service.js +103 -0
- package/dist/services/operator-wise-summary-pdf.js +101 -0
- package/dist/services/pack-ship-pdf.service.js +105 -0
- package/dist/services/pack-ship-print.service.js +167 -0
- package/dist/services/payment-pdf.service.js +373 -0
- package/dist/services/payment-report-pdf.service.js +106 -0
- package/dist/services/po-totals.service.js +279 -0
- package/dist/services/pos-receipt-pdf.js +438 -0
- package/dist/services/purchase-order-pdf.service.js +924 -0
- package/dist/services/purchase-order-print.service.js +150 -0
- package/dist/services/purchase-order-totals.service.js +280 -0
- package/dist/services/receipt-print.service.js +50 -0
- package/dist/services/reorder-point-pdf.service.js +151 -0
- package/dist/services/repair-orders-pdf.service.js +172 -0
- package/dist/services/ro-pdf.service.js +1764 -0
- package/dist/services/ro-print-service.js +737 -0
- package/dist/services/ro-totals.service.js +1241 -0
- package/dist/services/sales-by-service-pdf.service.js +116 -0
- package/dist/services/sales-pdf.service.js +630 -0
- package/dist/services/sales-print.service.js +305 -0
- package/dist/services/sales-receipt-pdf.service.js +611 -0
- package/dist/services/sales-receipt-print.service.js +425 -0
- package/dist/services/sales-totals.service.js +339 -0
- package/dist/services/scheduled-drug-pdf.service.js +176 -0
- package/dist/services/scheduled-drug-summary-pdf.service.js +188 -0
- package/dist/services/separate-wo-print.service.js +351 -0
- package/dist/services/shared-inv-pdf.service.js +763 -0
- package/dist/services/shared-pdf.service.js +2569 -0
- package/dist/services/shared-print.service.js +885 -0
- package/dist/services/task-pdf.service.js +220 -0
- package/dist/services/task-reports-pdf.service.js +296 -0
- package/dist/services/technician-pdf.service.js +238 -0
- package/dist/services/technician-print.service.js +87 -0
- package/dist/services/transfer-order-pdf.service.js +139 -0
- package/dist/services/vendor-balances-pdf.service.js +101 -0
- package/dist/services/vendor-credit-note-pdf.service.js +1007 -0
- package/dist/services/vendor-credit-note-print.service.js +104 -0
- package/dist/services/vendor-credit-note-totals.service.js +327 -0
- package/dist/services/vendor-debit-note-pdf.service.js +561 -0
- package/dist/services/vendor-debit-note-print.service.js +245 -0
- package/dist/services/vendor-debit-note-totals.service.js +305 -0
- package/dist/utils/my-date.js +652 -0
- package/dist/utils/tr-utils.js +354 -0
- package/package.json +24 -0
- package/tsconfig.json +109 -0
|
@@ -0,0 +1,1764 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoprintService = void 0;
|
|
4
|
+
const code_enums_1 = require("../enums/code-enums");
|
|
5
|
+
const enums_1 = require("../enums/enums");
|
|
6
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
|
+
const shared_pdf_service_1 = require("./shared-pdf.service");
|
|
8
|
+
const shared_print_service_1 = require("./shared-print.service");
|
|
9
|
+
class RoprintService {
|
|
10
|
+
static CommonHeaderDetails(ROPrintData, text, isOtherIndustry) {
|
|
11
|
+
// console.log('ROPrintData', ROPrintData);
|
|
12
|
+
return [
|
|
13
|
+
this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
|
|
14
|
+
// this.GetHeaderDetails(ROPrintData.HeaderName, ROPrintData.Entity, ROPrintData.Image),
|
|
15
|
+
// SharedPDFService.HeaderAfterLine()
|
|
16
|
+
shared_pdf_service_1.SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate, ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Vehicle, ROPrintData.Type, ROPrintData.Payee, ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp, ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, false, ROPrintData.Settings, ROPrintData.Location, isOtherIndustry, null, null, null, null),
|
|
17
|
+
shared_pdf_service_1.SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
|
|
18
|
+
shared_pdf_service_1.SharedPDFService.GetDisplayTable()
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
static GetMainHeaderDetails(Entity, HeaderName, Image, HColor, AColor, text) {
|
|
22
|
+
return [
|
|
23
|
+
// SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, text),
|
|
24
|
+
shared_pdf_service_1.SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
|
|
25
|
+
shared_pdf_service_1.SharedPDFService.GetPrintType(HeaderName),
|
|
26
|
+
shared_pdf_service_1.SharedPDFService.HeaderAfterLine()
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
static CommonTotalDetails(ROPrintData, index, numberofCopies) {
|
|
30
|
+
let CommonDetails = [
|
|
31
|
+
shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData.CustLaborTotalBeforeDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST, ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.Payee, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowDetailedLaborTaxInfo, ROPrintData.ShowDetailedPartTaxInfo, tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax, ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, null, null),
|
|
32
|
+
shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, false),
|
|
33
|
+
shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
|
|
34
|
+
shared_pdf_service_1.SharedPDFService.GetUnderLine(),
|
|
35
|
+
shared_pdf_service_1.SharedPDFService.GetSignatures(ROPrintData.Entity.CName, ROPrintData.Type, ROPrintData.Payee),
|
|
36
|
+
];
|
|
37
|
+
if (ROPrintData.Type !== 'Invoice') {
|
|
38
|
+
CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine());
|
|
39
|
+
}
|
|
40
|
+
if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
|
|
41
|
+
CommonDetails.push({ text: '', pageBreak: 'after' });
|
|
42
|
+
}
|
|
43
|
+
return CommonDetails;
|
|
44
|
+
}
|
|
45
|
+
static CommonInsTotalDetails(ROPrintData, index, numberofCopies) {
|
|
46
|
+
let CommonDetails = [
|
|
47
|
+
shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData.InsLaborTotalBeforeDisc, ROPrintData.InsLaborDiscTotal, ROPrintData.InsLaborCGST, ROPrintData.InsLaborSGST, ROPrintData.InsLaborIGST, ROPrintData.InsPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.InsPartsTotalBeforeDisc, ROPrintData.InsPartsDiscTotal, ROPrintData.InsPartCGST, ROPrintData.InsPartSGST, ROPrintData.InsTaxGroupData, ROPrintData.ShowAccParts, ROPrintData.InsLaborTotalAfterTax, ROPrintData.InsPartsTotalAfterTax, ROPrintData.FixedDisc, ROPrintData.Payee, ROPrintData.FixedInsTotal, ROPrintData.InsTotalRoundedBy, ROPrintData.InsRoundedTotal, ROPrintData.ShowDetailedLaborTaxInfo, ROPrintData.ShowDetailedPartTaxInfo, tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.InsLaborITax, ROPrintData.InsPartITax, ROPrintData.Consolidate, ROPrintData.From, null, null),
|
|
48
|
+
shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, false),
|
|
49
|
+
shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
|
|
50
|
+
shared_pdf_service_1.SharedPDFService.GetUnderLine(),
|
|
51
|
+
shared_pdf_service_1.SharedPDFService.GetSignatures(ROPrintData.Entity.CName, ROPrintData.Type, ROPrintData.Payee),
|
|
52
|
+
];
|
|
53
|
+
if (ROPrintData.Type !== 'Invoice') {
|
|
54
|
+
CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine());
|
|
55
|
+
}
|
|
56
|
+
if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
|
|
57
|
+
CommonDetails.push({ text: '', pageBreak: 'after' });
|
|
58
|
+
}
|
|
59
|
+
return CommonDetails;
|
|
60
|
+
}
|
|
61
|
+
// Customer Only Print Method
|
|
62
|
+
static GetCustomerPrint(ROPrintData, numberofCopies, isOtherIndustry) {
|
|
63
|
+
var contents = [];
|
|
64
|
+
if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
|
|
65
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, null, isOtherIndustry), this.CustomersparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, null, numberofCopies));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
numberofCopies.forEach((text, index) => {
|
|
69
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, text, isOtherIndustry), this.CustomersparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, index, numberofCopies));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
var dd = {
|
|
73
|
+
info: {
|
|
74
|
+
title: this.GetFileName(ROPrintData),
|
|
75
|
+
},
|
|
76
|
+
header: function (currentPage, pageCount, pageSize) {
|
|
77
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
78
|
+
},
|
|
79
|
+
background: function (currentPage, pageSize) {
|
|
80
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
|
|
81
|
+
},
|
|
82
|
+
pageMargins: [10, 25, 10, 15],
|
|
83
|
+
content: contents,
|
|
84
|
+
styles: shared_pdf_service_1.SharedPDFService.GetStyles()
|
|
85
|
+
};
|
|
86
|
+
return dd;
|
|
87
|
+
}
|
|
88
|
+
static GetHeaderDetails(HeaderName, Entity, Image) {
|
|
89
|
+
return {
|
|
90
|
+
columns: [{
|
|
91
|
+
stack: [{
|
|
92
|
+
image: Image,
|
|
93
|
+
width: 150, marginBottom: 15
|
|
94
|
+
}, { text: HeaderName, fontSize: 20 }]
|
|
95
|
+
}, {
|
|
96
|
+
stack: this.CompanyDetails(Entity),
|
|
97
|
+
}], marginLeft: 20, marginRight: 20, marginTop: 15, marginBottom: 5
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
static CompanyDetails(Entity) {
|
|
101
|
+
let Details = [
|
|
102
|
+
{ text: Entity.CName, alignment: 'right', lineHeight: 1.5, fontSize: 8 },
|
|
103
|
+
{ text: Entity.Adrs1 + ',', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
|
|
104
|
+
{ text: '' + Entity.City + shared_pdf_service_1.SharedPDFService.getPinCode(Entity.PIN) + ', ' + 'Ph: ' + Entity.Phone, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
|
|
105
|
+
{ text: '' + shared_pdf_service_1.SharedPDFService.GetEmail(Entity.Email) + '', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
|
|
106
|
+
{ text: 'GSTIN : ' + Entity.GSTIN, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
|
|
107
|
+
{ text: 'PAN No : ' + Entity.PAN, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 }
|
|
108
|
+
];
|
|
109
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Entity.Adrs2)) {
|
|
110
|
+
Details.splice(2, 0, { text: Entity.Adrs2 + '', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 });
|
|
111
|
+
}
|
|
112
|
+
return Details;
|
|
113
|
+
}
|
|
114
|
+
static GetFileName(ROPrintData) {
|
|
115
|
+
let fileName = ROPrintData.HeaderName;
|
|
116
|
+
if (!tr_utils_1.TrUtils.IsEmpty(ROPrintData.Vehicle.RegNo)) {
|
|
117
|
+
fileName = fileName + '-' + ROPrintData.Vehicle.RegNo;
|
|
118
|
+
}
|
|
119
|
+
return fileName;
|
|
120
|
+
}
|
|
121
|
+
static CustomersparePartsTable(ROPrintData) {
|
|
122
|
+
let List = [];
|
|
123
|
+
if (ROPrintData.Entity.Body === 1) {
|
|
124
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
125
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
126
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
127
|
+
}
|
|
128
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.Entity.MPN), this.GetCustomerIndPartsTable(ROPrintData.PrintInfo[i].Colli, ROPrintData.PrintInfo[i].Type, ROPrintData.PrintInfo[i].Sts, ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
if (ROPrintData.Entity.Body === 2) {
|
|
133
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
134
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
135
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
136
|
+
}
|
|
137
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetCustomerIndPartsTable(ROPrintData.PrintInfo[i].Colli, ROPrintData.PrintInfo[i].Type, ROPrintData.PrintInfo[i].Sts, ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
if (ROPrintData.Summary) {
|
|
142
|
+
List.push('', this.GetLaborPartsTableForView(ROPrintData.Parts, ROPrintData.Ops, ROPrintData.Entity.MPN)
|
|
143
|
+
// this.GetCustomerIndPartsTable(null, ROPrintData.Type, ROPrintData.Sts,
|
|
144
|
+
// ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn)
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
149
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
150
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
151
|
+
}
|
|
152
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetCustomerIndPartsTable(ROPrintData.PrintInfo[i].Colli, ROPrintData.PrintInfo[i].Type, ROPrintData.PrintInfo[i].Sts, ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return List;
|
|
158
|
+
}
|
|
159
|
+
static GetCustomerIndPartsTable(Colli, Type, Status, PrintPartNo, ShowTaxColumn) {
|
|
160
|
+
let Table = {};
|
|
161
|
+
if (!tr_utils_1.TrUtils.IsNull(Colli) && Colli.length !== 0) {
|
|
162
|
+
let Approved = (Status === enums_1.ROStatusEnum.New || Status === enums_1.ROStatusEnum.WtngForAppr) ? false : true;
|
|
163
|
+
let isRepairOrder = (Type === code_enums_1.ROTypeEnum.RepairOrder) ? true : false;
|
|
164
|
+
Table = this.CustomerAccidentalPartsTableAfterApproval(Colli, ShowTaxColumn, PrintPartNo, Approved, isRepairOrder);
|
|
165
|
+
return Table;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return Table;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
static GetInsurancePrint(ROPrintData, numberofCopies, isOtherIndustry) {
|
|
172
|
+
var contents = [];
|
|
173
|
+
if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
|
|
174
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, null, isOtherIndustry), this.InsurancesparePartsTable(ROPrintData), this.CommonInsTotalDetails(ROPrintData, null, numberofCopies));
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
numberofCopies.forEach((text, index) => {
|
|
178
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, text, isOtherIndustry), this.InsurancesparePartsTable(ROPrintData), this.CommonInsTotalDetails(ROPrintData, index, numberofCopies));
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
var dd = {
|
|
182
|
+
info: {
|
|
183
|
+
title: this.GetFileName(ROPrintData),
|
|
184
|
+
},
|
|
185
|
+
background: function (currentPage, pageSize) {
|
|
186
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
|
|
187
|
+
},
|
|
188
|
+
header: function (currentPage, pageCount) {
|
|
189
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
190
|
+
},
|
|
191
|
+
pageMargins: [10, 25, 10, 15],
|
|
192
|
+
content: contents,
|
|
193
|
+
styles: shared_pdf_service_1.SharedPDFService.GetStyles()
|
|
194
|
+
};
|
|
195
|
+
// if (!TrUtils.IsNull(win)) {
|
|
196
|
+
// pdfMake.createPdf(dd).open({}, win);
|
|
197
|
+
// } else {
|
|
198
|
+
// pdfMake.createPdf(dd).open();
|
|
199
|
+
// }
|
|
200
|
+
return dd;
|
|
201
|
+
// this.PrintFile = TrUtils.Stringify(dd);
|
|
202
|
+
// pdfMake.createPdf(dd).getDataUrl(function (outDoc: any) {
|
|
203
|
+
// document.getElementById('pdf').setAttribute('src', outDoc);
|
|
204
|
+
// });
|
|
205
|
+
}
|
|
206
|
+
// Insurance Only Print Method
|
|
207
|
+
static InsurancesparePartsTable(ROPrintData) {
|
|
208
|
+
let List = [];
|
|
209
|
+
if (ROPrintData.Entity.Body === 1) {
|
|
210
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
211
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
212
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
213
|
+
}
|
|
214
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.Entity.MPN), this.GetInsuranceIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
if (ROPrintData.Entity.Body === 2) {
|
|
219
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
220
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
221
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
222
|
+
}
|
|
223
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetInsuranceIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
if (ROPrintData.Summary) {
|
|
228
|
+
List.push('', this.GetLaborPartsTableForView(ROPrintData.Parts, ROPrintData.Ops, ROPrintData.Entity.MPN)
|
|
229
|
+
// this.GetCustomerIndPartsTable(null, ROPrintData.Type, ROPrintData.Sts,
|
|
230
|
+
// ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn)
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
235
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
236
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
237
|
+
}
|
|
238
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetInsuranceIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return List;
|
|
244
|
+
}
|
|
245
|
+
static GetInsuranceIndPartsTable(PrintInfo, PrintPartNo, ShowTaxColumn) {
|
|
246
|
+
let Table = {};
|
|
247
|
+
if (!tr_utils_1.TrUtils.IsNull(PrintInfo.Colli) && PrintInfo.Colli.length !== 0) {
|
|
248
|
+
if (PrintInfo.Sts === enums_1.ROStatusEnum.New || PrintInfo.Sts === enums_1.ROStatusEnum.WtngForAppr) {
|
|
249
|
+
Table = this.GetTableForApproval(PrintInfo.Colli, PrintPartNo, ShowTaxColumn);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
Table = this.InsuranceAccidentalPartsTableAfterApproval(PrintInfo.Colli, ShowTaxColumn, PrintPartNo);
|
|
253
|
+
}
|
|
254
|
+
return Table;
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return Table;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// Insurance & Customer Print Method
|
|
261
|
+
static GetInsuranceAndCustomerPrint(ROPrintData, numberofCopies, isOtherIndustry) {
|
|
262
|
+
var contents = [];
|
|
263
|
+
if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
|
|
264
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, null, isOtherIndustry), this.InsuranceAndCustomersparePartsTable(ROPrintData), this.CommonInsTotalDetails(ROPrintData, null, numberofCopies));
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
numberofCopies.forEach((text, index) => {
|
|
268
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, text, isOtherIndustry), this.InsuranceAndCustomersparePartsTable(ROPrintData), this.CommonInsTotalDetails(ROPrintData, index, numberofCopies));
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
var dd = {
|
|
272
|
+
info: {
|
|
273
|
+
title: this.GetFileName(ROPrintData),
|
|
274
|
+
},
|
|
275
|
+
background: function (currentPage, pageSize) {
|
|
276
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
|
|
277
|
+
},
|
|
278
|
+
header: function (currentPage, pageCount) {
|
|
279
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
280
|
+
},
|
|
281
|
+
pageMargins: [10, 25, 10, 15],
|
|
282
|
+
content: contents,
|
|
283
|
+
styles: shared_pdf_service_1.SharedPDFService.GetStyles()
|
|
284
|
+
};
|
|
285
|
+
// if (!TrUtils.IsNull(win)) {
|
|
286
|
+
// pdfMake.createPdf(dd).open({}, win);
|
|
287
|
+
// } else {
|
|
288
|
+
// pdfMake.createPdf(dd).open();
|
|
289
|
+
// }
|
|
290
|
+
return dd;
|
|
291
|
+
// this.PrintFile = TrUtils.Stringify(dd);
|
|
292
|
+
// pdfMake.createPdf(dd).getDataUrl(function (outDoc: any) {
|
|
293
|
+
// document.getElementById('pdf').setAttribute('src', outDoc);
|
|
294
|
+
// });
|
|
295
|
+
}
|
|
296
|
+
static InsuranceAndCustomersparePartsTable(ROPrintData) {
|
|
297
|
+
let List = [];
|
|
298
|
+
if (ROPrintData.Entity.Body === 1) {
|
|
299
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
300
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
301
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
302
|
+
}
|
|
303
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.Entity.MPN), this.GetInsuranceAndCustomerIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
if (ROPrintData.Entity.Body === 2) {
|
|
308
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
309
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
310
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
311
|
+
}
|
|
312
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetInsuranceAndCustomerIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
if (ROPrintData.Summary) {
|
|
317
|
+
List.push('', this.GetInsuranceOrCustomerLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.Ops), ROPrintData.Entity.MPN));
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
321
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
322
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
323
|
+
}
|
|
324
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Parts), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetInsuranceAndCustomerIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return List;
|
|
330
|
+
}
|
|
331
|
+
static GetInsuranceAndCustomerIndPartsTable(PrintInfo, PrintPartNo, ShowTaxColumn) {
|
|
332
|
+
let Table = {};
|
|
333
|
+
if (!tr_utils_1.TrUtils.IsNull(PrintInfo.Colli) && PrintInfo.Colli.length !== 0) {
|
|
334
|
+
Table = this.GetTableAsCombinedColForCustAndIns(PrintInfo.Colli, PrintPartNo, ShowTaxColumn);
|
|
335
|
+
return Table;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
return Table;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// Insurance | Customer Print Method
|
|
342
|
+
static GetInsuranceOrCustomerPrint(ROPrintData, numberofCopies, isOtherIndustry) {
|
|
343
|
+
var contents = [];
|
|
344
|
+
if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
|
|
345
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, null, isOtherIndustry), this.InsuranceOrCustomersparePartsTable(ROPrintData), this.CommonInsTotalDetails(ROPrintData, null, numberofCopies));
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
numberofCopies.forEach((text, index) => {
|
|
349
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, text, isOtherIndustry), this.InsuranceOrCustomersparePartsTable(ROPrintData), this.CommonInsTotalDetails(ROPrintData, index, numberofCopies));
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
var dd = {
|
|
353
|
+
info: {
|
|
354
|
+
title: this.GetFileName(ROPrintData),
|
|
355
|
+
},
|
|
356
|
+
background: function (currentPage, pageSize) {
|
|
357
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
|
|
358
|
+
},
|
|
359
|
+
header: function (currentPage, pageCount) {
|
|
360
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
361
|
+
},
|
|
362
|
+
pageMargins: [10, 25, 10, 15],
|
|
363
|
+
content: contents,
|
|
364
|
+
styles: shared_pdf_service_1.SharedPDFService.GetStyles()
|
|
365
|
+
};
|
|
366
|
+
// if (!TrUtils.IsNull(win)) {
|
|
367
|
+
// pdfMake.createPdf(dd).open({}, win);
|
|
368
|
+
// } else {
|
|
369
|
+
// pdfMake.createPdf(dd).open();
|
|
370
|
+
// }
|
|
371
|
+
return dd;
|
|
372
|
+
// this.PrintFile = TrUtils.Stringify(dd);
|
|
373
|
+
// pdfMake.createPdf(dd).getDataUrl(function (outDoc: any) {
|
|
374
|
+
// document.getElementById('pdf').setAttribute('src', outDoc);
|
|
375
|
+
// });
|
|
376
|
+
}
|
|
377
|
+
static InsuranceOrCustomersparePartsTable(ROPrintData) {
|
|
378
|
+
let List = [];
|
|
379
|
+
if (ROPrintData.Entity.Body === 1) {
|
|
380
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
381
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
382
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
383
|
+
}
|
|
384
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(ROPrintData.PrintInfo[i].Parts, ROPrintData.PrintInfo[i].Ops, ROPrintData.Entity.MPN), this.GetInsuranceOrCustomerIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
if (ROPrintData.Entity.Body === 2) {
|
|
389
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
390
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
391
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
392
|
+
}
|
|
393
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(ROPrintData.PrintInfo[i].Parts, ROPrintData.PrintInfo[i].Ops, ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetInsuranceOrCustomerIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
if (ROPrintData.Summary) {
|
|
398
|
+
List.push('', this.GetInsuranceOrCustomerLaborPartsTableForView(ROPrintData.Parts, ROPrintData.Ops, ROPrintData.Entity.MPN));
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
402
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
403
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
404
|
+
}
|
|
405
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(ROPrintData.PrintInfo[i].Parts, ROPrintData.PrintInfo[i].Ops, ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGS, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn), this.GetInsuranceOrCustomerIndPartsTable(ROPrintData.PrintInfo[i], ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn));
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return List;
|
|
411
|
+
}
|
|
412
|
+
static GetInsuranceOrCustomerIndPartsTable(PrintInfo, PrintPartNo, ShowTaxColumn) {
|
|
413
|
+
let Table = {};
|
|
414
|
+
if (!tr_utils_1.TrUtils.IsNull(PrintInfo.Colli) && PrintInfo.Colli.length !== 0) {
|
|
415
|
+
Table = this.GetTableAsSeparateColForCustAndIns(PrintInfo.Colli, PrintPartNo, ShowTaxColumn);
|
|
416
|
+
return Table;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
return Table;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
static GetLaborPartsTableForView(Parts, Ops, PrintPartNo) {
|
|
423
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
424
|
+
if (PrintPartNo) {
|
|
425
|
+
return {
|
|
426
|
+
style: 'tableExample',
|
|
427
|
+
// marginLeft: 20,
|
|
428
|
+
table: {
|
|
429
|
+
widths: [25, 85, 170, 20, 50, 30, 30, 50],
|
|
430
|
+
// headerRows: 2,
|
|
431
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
|
|
432
|
+
},
|
|
433
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
return {
|
|
438
|
+
style: 'tableExample',
|
|
439
|
+
// marginLeft: 20,
|
|
440
|
+
table: {
|
|
441
|
+
widths: [25, 200, 55, 25, 55, 55, 40, 50],
|
|
442
|
+
// headerRows: 2,
|
|
443
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
|
|
444
|
+
},
|
|
445
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
let a = '';
|
|
451
|
+
return a;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
static GetInsuranceOrCustomerLaborPartsTableForView(Parts, Ops, PrintPartNo) {
|
|
455
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
456
|
+
if (PrintPartNo) {
|
|
457
|
+
return {
|
|
458
|
+
style: 'tableExample',
|
|
459
|
+
// marginLeft: 20,
|
|
460
|
+
table: {
|
|
461
|
+
widths: [25, 85, 170, 20, 50, 30, 30, 50],
|
|
462
|
+
// headerRows: 2,
|
|
463
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, true)
|
|
464
|
+
},
|
|
465
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
return {
|
|
470
|
+
style: 'tableExample',
|
|
471
|
+
// marginLeft: 20,
|
|
472
|
+
table: {
|
|
473
|
+
widths: [25, 185, 45, 20, 50, 50, 40, 30, 50],
|
|
474
|
+
// headerRows: 2,
|
|
475
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, true)
|
|
476
|
+
},
|
|
477
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
let a = '';
|
|
483
|
+
return a;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
static buildTableBody(Parts, Ops, PrintPartNo) {
|
|
487
|
+
var body = [];
|
|
488
|
+
let columns = shared_pdf_service_1.SharedPDFService.GetHeaders(PrintPartNo);
|
|
489
|
+
// body.push(columns);
|
|
490
|
+
for (let i = 0; i < columns.length; i++) {
|
|
491
|
+
body.push(columns[i]);
|
|
492
|
+
}
|
|
493
|
+
let DummyOps = [];
|
|
494
|
+
if (Parts.length !== 0) {
|
|
495
|
+
let dummypartadding1 = {};
|
|
496
|
+
dummypartadding1.SNo = '';
|
|
497
|
+
dummypartadding1.Desc = 'Spare Parts';
|
|
498
|
+
dummypartadding1.Qty = '';
|
|
499
|
+
dummypartadding1.UnPr = '';
|
|
500
|
+
dummypartadding1.LineTotal = '';
|
|
501
|
+
Parts.unshift(dummypartadding1);
|
|
502
|
+
}
|
|
503
|
+
let SNo = 1;
|
|
504
|
+
Parts.forEach((part) => {
|
|
505
|
+
var dataRow = [];
|
|
506
|
+
columns[1].forEach((column) => {
|
|
507
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])
|
|
508
|
+
|| column.text === 'Line Total') {
|
|
509
|
+
if (part[column.Field] === 'Spare Parts') {
|
|
510
|
+
dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
// tslint:disable-next-line:max-line-length
|
|
514
|
+
if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'UnPr') {
|
|
515
|
+
if (column.Field === 'Disc') {
|
|
516
|
+
if (column.type === 'percentage') {
|
|
517
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part.Perc)) {
|
|
518
|
+
dataRow.push({ text: part.Perc.toString(), alignment: 'right', noWrap: true });
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
dataRow.push({ text: '', noWrap: true });
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
|
|
526
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
dataRow.push({ text: '', noWrap: true });
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
if (column.Field === 'Desc') {
|
|
539
|
+
let DescData = [];
|
|
540
|
+
DescData.push(part[column.Field].toString());
|
|
541
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
542
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
543
|
+
}
|
|
544
|
+
dataRow.push({ stack: DescData });
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
if (column.Field === 'SNo') {
|
|
554
|
+
part[column.Field] = SNo;
|
|
555
|
+
SNo = SNo + 1;
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
part[column.Field] = '';
|
|
559
|
+
}
|
|
560
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
body.push(dataRow);
|
|
564
|
+
});
|
|
565
|
+
if (Ops.length !== 0) {
|
|
566
|
+
let dummypartadding1 = {};
|
|
567
|
+
dummypartadding1.SNo = '';
|
|
568
|
+
dummypartadding1.Desc = 'Labor';
|
|
569
|
+
dummypartadding1.Qty = '';
|
|
570
|
+
dummypartadding1.UnPr = '';
|
|
571
|
+
dummypartadding1.LineTotal = '';
|
|
572
|
+
Ops.unshift(dummypartadding1);
|
|
573
|
+
}
|
|
574
|
+
Ops.forEach((labor) => {
|
|
575
|
+
var dataRow = [];
|
|
576
|
+
columns[1].forEach((column) => {
|
|
577
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(labor[column.Field]) && !tr_utils_1.TrUtils.IsNull(labor[column.Field])
|
|
578
|
+
|| column.text === 'Line Total') {
|
|
579
|
+
if (labor[column.Field] === 'Labor') {
|
|
580
|
+
dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'Disc'
|
|
584
|
+
|| column.Field === 'UnPr') {
|
|
585
|
+
if (column.Field === 'Disc') {
|
|
586
|
+
if (column.type === 'percentage') {
|
|
587
|
+
if (!tr_utils_1.TrUtils.IsEmpty(labor.Perc)) {
|
|
588
|
+
dataRow.push({ text: labor.Perc.toString(), alignment: 'right', noWrap: true });
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
dataRow.push({ text: '', noWrap: true });
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
if (!tr_utils_1.TrUtils.IsZero(labor[column.Field])) {
|
|
596
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
dataRow.push({ text: '', noWrap: true });
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
dataRow.push(labor[column.Field].toString());
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
if (column.Field === 'SNo') {
|
|
614
|
+
labor[column.Field] = SNo;
|
|
615
|
+
SNo = SNo + 1;
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
labor[column.Field] = '';
|
|
619
|
+
}
|
|
620
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
body.push(dataRow);
|
|
624
|
+
});
|
|
625
|
+
return body;
|
|
626
|
+
}
|
|
627
|
+
static GetTableForApproval(Colli, PrintPartNo, ShowTaxColumn) {
|
|
628
|
+
if (ShowTaxColumn) {
|
|
629
|
+
return {
|
|
630
|
+
style: 'tableExample',
|
|
631
|
+
marginTop: 7,
|
|
632
|
+
lineHeight: 1,
|
|
633
|
+
dontBreakRows: true,
|
|
634
|
+
table: {
|
|
635
|
+
widths: [10, 94, 28, 20, 34, 35, 34, 35, 34, 35, 34, 35, 35],
|
|
636
|
+
// headerRows: 3,
|
|
637
|
+
body: this.GetApprovalTableHeaderBody(Colli, PrintPartNo, ShowTaxColumn)
|
|
638
|
+
},
|
|
639
|
+
layout: this.threeLayOutStyle()
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
return {
|
|
644
|
+
style: 'tableExample',
|
|
645
|
+
marginTop: 7,
|
|
646
|
+
lineHeight: 1,
|
|
647
|
+
dontBreakRows: true,
|
|
648
|
+
table: {
|
|
649
|
+
widths: [10, 130, 20, 34, 35, 34, 35, 34, 35, 34, 35, 35],
|
|
650
|
+
// headerRows: 3,
|
|
651
|
+
body: this.GetApprovalTableHeaderBody(Colli, PrintPartNo, ShowTaxColumn)
|
|
652
|
+
},
|
|
653
|
+
layout: this.threeLayOutStyle()
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
static GetApprovalTableHeaderBody(Colli, PrintPartNo, ShowTaxColumn) {
|
|
658
|
+
var body = [];
|
|
659
|
+
let SNo = 1;
|
|
660
|
+
let columns = this.GetTableHeadersForApproval(PrintPartNo, ShowTaxColumn);
|
|
661
|
+
for (let i = 0; i < columns.length; i++) {
|
|
662
|
+
body.push(columns[i]);
|
|
663
|
+
}
|
|
664
|
+
Colli.forEach((part) => {
|
|
665
|
+
var dataRow = [];
|
|
666
|
+
columns[2].forEach((column) => {
|
|
667
|
+
if (!tr_utils_1.TrUtils.IsNull(column.Parent)) {
|
|
668
|
+
if (column.Field === 'AssPr') {
|
|
669
|
+
dataRow.push({ text: '', alignment: 'center' });
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
if (!tr_utils_1.TrUtils.IsNull(part[column.Parent]) && !tr_utils_1.TrUtils.IsFixedZero(part[column.Parent][column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Parent][column.Field])) {
|
|
673
|
+
dataRow.push({ text: part[column.Parent][column.Field].toString(), alignment: 'right', fontSize: 7, nowrap: true });
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
dataRow.push({ text: '', alignment: 'center' });
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
else {
|
|
681
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
682
|
+
if (column.Field === 'SNo' || column.Field === 'Desc'
|
|
683
|
+
|| column.text === 'Description/PartNo') {
|
|
684
|
+
// dataRow.push(part[column.Field].toString());
|
|
685
|
+
if (column.Field === 'Desc') {
|
|
686
|
+
let DescData = [];
|
|
687
|
+
DescData.push(part[column.Field].toString());
|
|
688
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
689
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
690
|
+
}
|
|
691
|
+
dataRow.push({ stack: DescData });
|
|
692
|
+
}
|
|
693
|
+
else {
|
|
694
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', fontSize: 7, nowrap: true });
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
if (column.Field === 'SNo') {
|
|
703
|
+
part[column.Field] = SNo;
|
|
704
|
+
SNo = SNo + 1;
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
part[column.Field] = '';
|
|
708
|
+
}
|
|
709
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
body.push(dataRow);
|
|
714
|
+
});
|
|
715
|
+
return body;
|
|
716
|
+
}
|
|
717
|
+
static GetTableHeadersForApproval(PrintPartNo, ShowTaxColumn) {
|
|
718
|
+
let headersNames = [
|
|
719
|
+
[{ text: 'S. No.', rowSpan: 3, style: ['tableheader', 'withOutApp'], lineHeight: 1 },
|
|
720
|
+
{ text: 'Qty', style: ['tableheader', 'withOutApp'], rowSpan: 3 },
|
|
721
|
+
{ text: 'Unit Price', style: ['tableheader', 'withOutApp'], rowSpan: 2, colSpan: 2 },
|
|
722
|
+
{},
|
|
723
|
+
{ text: 'Labor charges', style: ['tableheader', 'withOutApp'], colSpan: 6 }, {}, {}, {}, {}, {},
|
|
724
|
+
{ text: 'Line Total', rowSpan: 3, style: 'tableheader', alignment: 'center', lineHeight: 1 }],
|
|
725
|
+
[{}, {}, {}, {}, {},
|
|
726
|
+
{ text: 'R&R/Labor', colSpan: 2, style: ['tableheader', 'withOutApp'] }, {},
|
|
727
|
+
{ text: 'Denting', colSpan: 2, style: ['tableheader', 'withOutApp'] }, {},
|
|
728
|
+
{ text: 'Painting', colSpan: 2, style: ['tableheader', 'withOutApp'] }, {}, {}],
|
|
729
|
+
[{ text: '', Field: 'SNo', lineHeight: 0.5 },
|
|
730
|
+
{ text: '', Field: 'Desc', lineHeight: 0.5 },
|
|
731
|
+
{ text: '', Field: 'QtyAndUoM', Parent: 'PartData', lineHeight: 0.5 },
|
|
732
|
+
{ text: 'Estimate', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'PartData', Field: 'EstPr', },
|
|
733
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'PartData', Field: 'AssPr', },
|
|
734
|
+
{ text: 'Estimate', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'RRFData', Field: 'EstPr', },
|
|
735
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'RRFData', Field: 'AssPr', },
|
|
736
|
+
{ text: 'Estimate', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'DtngData', Field: 'EstPr', },
|
|
737
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'DtngData', Field: 'AssPr', },
|
|
738
|
+
{ text: 'Estimate', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'PtngData', Field: 'EstPr', },
|
|
739
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'PtngData', Field: 'AssPr', },
|
|
740
|
+
{ text: '', Field: 'LineTotal', lineHeight: 1, alignment: 'center' }]
|
|
741
|
+
];
|
|
742
|
+
if (PrintPartNo) {
|
|
743
|
+
headersNames[0].splice(1, 0, { text: 'Description/PartNo', rowSpan: 3, style: ['tableheader', 'withOutApp'] });
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
headersNames[0].splice(1, 0, { text: 'Description', rowSpan: 3, style: ['tableheader', 'withOutApp'] });
|
|
747
|
+
}
|
|
748
|
+
if (ShowTaxColumn) {
|
|
749
|
+
headersNames[0].splice(2, 0, { text: 'HSN', style: ['tableheader', 'withOutApp'], rowSpan: 3 });
|
|
750
|
+
headersNames[1].splice(2, 0, {});
|
|
751
|
+
headersNames[2].splice(2, 0, { text: '', Parent: 'PartData', Field: 'HSN', lineHeight: 0.5 });
|
|
752
|
+
}
|
|
753
|
+
return headersNames;
|
|
754
|
+
}
|
|
755
|
+
static GetTableAsSeparateColForCustAndIns(Colli, PrintPartNo, ShowTaxColumn) {
|
|
756
|
+
if (ShowTaxColumn) {
|
|
757
|
+
return {
|
|
758
|
+
style: 'tableExample',
|
|
759
|
+
marginTop: 7,
|
|
760
|
+
lineHeight: 1,
|
|
761
|
+
table: {
|
|
762
|
+
widths: [10, 96, 28, 20, 34, 33, 34, 33, 34, 33, 34, 33, 40],
|
|
763
|
+
// headerRows: 3,
|
|
764
|
+
body: this.GetApprovedCustInsTableHeaderBody(Colli, PrintPartNo, ShowTaxColumn)
|
|
765
|
+
},
|
|
766
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
return {
|
|
771
|
+
style: 'tableExample',
|
|
772
|
+
marginTop: 7,
|
|
773
|
+
lineHeight: 1,
|
|
774
|
+
table: {
|
|
775
|
+
widths: [10, 130, 20, 34, 33, 34, 33, 34, 33, 34, 33, 40],
|
|
776
|
+
// headerRows: 3,
|
|
777
|
+
body: this.GetApprovedCustInsTableHeaderBody(Colli, PrintPartNo, ShowTaxColumn)
|
|
778
|
+
},
|
|
779
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
static GetApprovedCustInsTableHeaderBody(Parts, PrintPartNo, ShowTaxColumn) {
|
|
784
|
+
var body = [];
|
|
785
|
+
let SNo = 1;
|
|
786
|
+
let columns = this.GetTableHeadersForCustAndIns(PrintPartNo, ShowTaxColumn);
|
|
787
|
+
for (let i = 0; i < columns.length; i++) {
|
|
788
|
+
body.push(columns[i]);
|
|
789
|
+
}
|
|
790
|
+
Parts.forEach((part) => {
|
|
791
|
+
var dataRow = [];
|
|
792
|
+
columns[2].forEach((column) => {
|
|
793
|
+
if (!tr_utils_1.TrUtils.IsNull(column.Parent)) {
|
|
794
|
+
if (!tr_utils_1.TrUtils.IsNull(part[column.Parent]) && !tr_utils_1.TrUtils.IsFixedZero(part[column.Parent][column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Parent][column.Field])) {
|
|
795
|
+
dataRow.push({ text: part[column.Parent][column.Field].toString(), alignment: 'right', fontSize: 7, nowrap: true });
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
dataRow.push({ text: '', alignment: 'center' });
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
else {
|
|
802
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
803
|
+
if (column.Field === 'SNo' || column.Field === 'Desc'
|
|
804
|
+
|| column.text === 'Description/PartNo') {
|
|
805
|
+
// dataRow.push(part[column.Field].toString());
|
|
806
|
+
if (column.Field === 'Desc') {
|
|
807
|
+
let DescData = [];
|
|
808
|
+
DescData.push(part[column.Field].toString());
|
|
809
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
810
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
811
|
+
}
|
|
812
|
+
dataRow.push({ stack: DescData });
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', fontSize: 7, nowrap: true });
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
if (column.Field === 'SNo') {
|
|
824
|
+
part[column.Field] = SNo;
|
|
825
|
+
SNo = SNo + 1;
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
part[column.Field] = '';
|
|
829
|
+
}
|
|
830
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
body.push(dataRow);
|
|
835
|
+
});
|
|
836
|
+
return body;
|
|
837
|
+
}
|
|
838
|
+
static GetTableHeadersForCustAndIns(PrintPartNo, ShowTaxColumn) {
|
|
839
|
+
let headersNames = [
|
|
840
|
+
[{ text: 'S. No.', rowSpan: 3, style: ['tableheader', 'withOutApp'], lineHeight: 1 },
|
|
841
|
+
{ text: 'Qty', style: ['tableheader', 'withOutApp'], rowSpan: 3 },
|
|
842
|
+
{ text: 'Unit Price', style: ['tableheader', 'withOutApp'], rowSpan: 2, colSpan: 2, },
|
|
843
|
+
{},
|
|
844
|
+
{ text: 'Labor charges', style: ['tableheader', 'withOutApp'], colSpan: 6 }, {}, {}, {}, {}, {},
|
|
845
|
+
{ text: 'Line Total', rowSpan: 3, style: 'tableheader', alignment: 'center', lineHeight: 1 }],
|
|
846
|
+
[{}, {}, {}, {}, {},
|
|
847
|
+
{ text: 'R&R/Labor', colSpan: 2, style: ['tableheader', 'withOutApp'] }, {},
|
|
848
|
+
{ text: 'Denting', colSpan: 2, style: ['tableheader', 'withOutApp'] }, {},
|
|
849
|
+
{ text: 'Painting', colSpan: 2, style: ['tableheader', 'withOutApp'] }, {}, {}],
|
|
850
|
+
[{ text: '', Field: 'SNo' },
|
|
851
|
+
{ text: '', Field: 'Desc' },
|
|
852
|
+
{ text: '', Field: 'QtyAndUoM', Parent: 'PartData' },
|
|
853
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Field: 'AssPr', Parent: 'PartData' },
|
|
854
|
+
{ text: 'Customer', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Field: 'UnPr', Parent: 'PartData', lineHeight: 1 },
|
|
855
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Field: 'AssPr', Parent: 'RRFData' },
|
|
856
|
+
{ text: 'Customer', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Field: 'NetAmt', Parent: 'RRFData', lineHeight: 1 },
|
|
857
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Field: 'AssPr', Parent: 'DtngData' },
|
|
858
|
+
{
|
|
859
|
+
text: 'Customer', fontSize: this.FontSize,
|
|
860
|
+
style: ['tableheader', 'withOutApp'], Field: 'NetAmt', Parent: 'DtngData', lineHeight: 1
|
|
861
|
+
},
|
|
862
|
+
{ text: 'Assessed', fontSize: this.FontSize, style: ['tableheader', 'withOutApp'], Parent: 'PtngData', Field: 'AssPr' },
|
|
863
|
+
{
|
|
864
|
+
text: 'Customer', fontSize: this.FontSize,
|
|
865
|
+
style: ['tableheader', 'withOutApp'], Field: 'NetAmt', Parent: 'PtngData', lineHeight: 1
|
|
866
|
+
},
|
|
867
|
+
{ text: '', Field: 'LineTotal' }]
|
|
868
|
+
];
|
|
869
|
+
if (PrintPartNo) {
|
|
870
|
+
headersNames[0].splice(1, 0, { text: 'Description/PartNo', rowSpan: 3, style: ['tableheader', 'withOutApp'] });
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
headersNames[0].splice(1, 0, { text: 'Description', rowSpan: 3, style: ['tableheader', 'withOutApp'] });
|
|
874
|
+
}
|
|
875
|
+
if (ShowTaxColumn) {
|
|
876
|
+
headersNames[0].splice(2, 0, { text: 'HSN', style: ['tableheader', 'withOutApp'], rowSpan: 3 });
|
|
877
|
+
headersNames[1].splice(2, 0, {});
|
|
878
|
+
headersNames[2].splice(2, 0, { text: '', Parent: 'PartData', Field: 'HSN' });
|
|
879
|
+
}
|
|
880
|
+
return headersNames;
|
|
881
|
+
}
|
|
882
|
+
static GetTableAsCombinedColForCustAndIns(Colli, PrintPartNo, ShowTaxColumn) {
|
|
883
|
+
if (ShowTaxColumn) {
|
|
884
|
+
return {
|
|
885
|
+
style: 'tableExample',
|
|
886
|
+
lineHeight: 1,
|
|
887
|
+
marginTop: 7,
|
|
888
|
+
// marginLeft: 20,
|
|
889
|
+
table: {
|
|
890
|
+
// widths: [15, 179, 35, 25, 45, 49, 49, 49, 49],
|
|
891
|
+
widths: [24, 180, 35, 25, 45, 45, 45, 45, 45],
|
|
892
|
+
// headerRows: 2,
|
|
893
|
+
body: this.GetCombinedCustAndInsTableBodyAndHeaders(Colli, PrintPartNo, ShowTaxColumn)
|
|
894
|
+
},
|
|
895
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
{
|
|
900
|
+
return {
|
|
901
|
+
style: 'tableExample',
|
|
902
|
+
lineHeight: 1,
|
|
903
|
+
marginTop: 7,
|
|
904
|
+
// marginLeft: 20,
|
|
905
|
+
table: {
|
|
906
|
+
// widths: [15, 179, 35, 25, 45, 49, 49, 49, 49],
|
|
907
|
+
widths: [25, 220, 25, 45, 45, 45, 45, 45],
|
|
908
|
+
// headerRows: 2,
|
|
909
|
+
body: this.GetCombinedCustAndInsTableBodyAndHeaders(Colli, PrintPartNo, ShowTaxColumn)
|
|
910
|
+
},
|
|
911
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
static GetCombinedCustAndInsTableBodyAndHeaders(Colli, PrintPartNo, ShowTaxColumn) {
|
|
917
|
+
let SNo = 1;
|
|
918
|
+
let body = [];
|
|
919
|
+
let columns = this.GetCombinedCustAndInsColumns(PrintPartNo, ShowTaxColumn);
|
|
920
|
+
for (let i = 0; i < columns.length; i++) {
|
|
921
|
+
body.push(columns[i]);
|
|
922
|
+
}
|
|
923
|
+
Colli.forEach((part) => {
|
|
924
|
+
var dataRow = [];
|
|
925
|
+
columns[1].forEach((column) => {
|
|
926
|
+
if (!tr_utils_1.TrUtils.IsNull(column.Parent)) {
|
|
927
|
+
if (!tr_utils_1.TrUtils.IsNull(part[column.Parent]) && !tr_utils_1.TrUtils.IsFixedZero(part[column.Parent][column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Parent][column.Field])) {
|
|
928
|
+
dataRow.push({ text: part[column.Parent][column.Field].toString(), alignment: 'right', nowrap: true });
|
|
929
|
+
}
|
|
930
|
+
else {
|
|
931
|
+
dataRow.push({ text: '', alignment: 'center' });
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
else {
|
|
935
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
936
|
+
if (column.Field === 'SNo' || column.Field === 'Desc'
|
|
937
|
+
|| column.text === 'Description/PartNo') {
|
|
938
|
+
// dataRow.push(part[column.Field].toString());
|
|
939
|
+
if (column.Field === 'Desc') {
|
|
940
|
+
let DescData = [];
|
|
941
|
+
DescData.push(part[column.Field].toString());
|
|
942
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
943
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
944
|
+
}
|
|
945
|
+
dataRow.push({ stack: DescData });
|
|
946
|
+
}
|
|
947
|
+
else {
|
|
948
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
if (column.Field === 'SNo') {
|
|
957
|
+
part[column.Field] = SNo;
|
|
958
|
+
SNo = SNo + 1;
|
|
959
|
+
}
|
|
960
|
+
else {
|
|
961
|
+
part[column.Field] = '';
|
|
962
|
+
}
|
|
963
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
body.push(dataRow);
|
|
968
|
+
});
|
|
969
|
+
return body;
|
|
970
|
+
}
|
|
971
|
+
static GetCombinedCustAndInsColumns(PrintPartNo, ShowTaxColumn) {
|
|
972
|
+
let headersNames = [
|
|
973
|
+
[{ text: 'S.No.', rowSpan: 2, style: ['tableheader', 'withApp'] },
|
|
974
|
+
{ text: 'Qty', style: ['tableheader', 'withApp'], rowSpan: 2, },
|
|
975
|
+
{ text: 'Unit Price', style: ['tableheader', 'withApp'], rowSpan: 2, lineHeight: 1 },
|
|
976
|
+
{ text: 'Labor charges', style: ['tableheader', 'withApp'], colSpan: 3, }, {}, {},
|
|
977
|
+
{ text: 'Line Total', rowSpan: 2, style: ['tableheader', 'withApp'] }
|
|
978
|
+
],
|
|
979
|
+
[{ text: '', Field: 'SNo' }, { text: '', Field: 'Desc' },
|
|
980
|
+
{ text: '', Field: 'QtyAndUoM', Parent: 'PartData' }, { text: '', Field: 'AssPr', Parent: 'PartData' },
|
|
981
|
+
{ text: 'R&R/Labor', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Field: 'AssPr', Parent: 'RRFData' },
|
|
982
|
+
{ text: 'Denting', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Field: 'AssPr', Parent: 'DtngData' },
|
|
983
|
+
{ text: 'Painting', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Field: 'AssPr', Parent: 'PtngData' },
|
|
984
|
+
{ text: '', Field: 'LineTotal', style: ['tableheader', 'withApp'] }
|
|
985
|
+
]
|
|
986
|
+
];
|
|
987
|
+
if (PrintPartNo) {
|
|
988
|
+
headersNames[0].splice(1, 0, { text: 'Description/PartNo', rowSpan: 2, style: ['tableheader', 'withOutApp'] });
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
headersNames[0].splice(1, 0, { text: 'Description', rowSpan: 2, style: ['tableheader', 'withOutApp'] });
|
|
992
|
+
}
|
|
993
|
+
if (ShowTaxColumn) {
|
|
994
|
+
headersNames[0].splice(2, 0, { text: 'HSN', style: ['tableheader', 'withApp'], rowSpan: 2, });
|
|
995
|
+
headersNames[1].splice(2, 0, { text: '', Parent: 'PartData', Field: 'HSN' });
|
|
996
|
+
}
|
|
997
|
+
return headersNames;
|
|
998
|
+
}
|
|
999
|
+
static CustomerAccidentalPartsTableAfterApproval(Colli, ShowTaxColumn, PrintPartNo, Approved, isRepairOrder) {
|
|
1000
|
+
if (ShowTaxColumn) {
|
|
1001
|
+
return {
|
|
1002
|
+
style: 'tableExample',
|
|
1003
|
+
marginTop: 7,
|
|
1004
|
+
lineHeight: 1,
|
|
1005
|
+
// marginLeft: 20,
|
|
1006
|
+
table: {
|
|
1007
|
+
// widths: [15, 174, 35, 25, 49, 49, 49, 49, 49],
|
|
1008
|
+
widths: [24, 185, 35, 25, 45, 45, 45, 45, 45],
|
|
1009
|
+
// headerRows: 2,
|
|
1010
|
+
body: this.GetCustomerAccidentalPartsTableBodyData(Colli, ShowTaxColumn, PrintPartNo, Approved, isRepairOrder)
|
|
1011
|
+
},
|
|
1012
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
else {
|
|
1016
|
+
return {
|
|
1017
|
+
style: 'tableExample',
|
|
1018
|
+
marginTop: 7,
|
|
1019
|
+
lineHeight: 1,
|
|
1020
|
+
// marginLeft: 20,
|
|
1021
|
+
table: {
|
|
1022
|
+
// widths: [15, 174, 35, 25, 49, 49, 49, 49, 49],
|
|
1023
|
+
widths: [25, 220, 25, 45, 45, 45, 45, 45],
|
|
1024
|
+
// headerRows: 2,
|
|
1025
|
+
body: this.GetCustomerAccidentalPartsTableBodyData(Colli, ShowTaxColumn, PrintPartNo, Approved, isRepairOrder)
|
|
1026
|
+
},
|
|
1027
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
static InsuranceAccidentalPartsTableAfterApproval(Colli, ShowTaxColumn, PrintPartNo) {
|
|
1032
|
+
if (ShowTaxColumn) {
|
|
1033
|
+
return {
|
|
1034
|
+
style: 'tableExample',
|
|
1035
|
+
marginTop: 7,
|
|
1036
|
+
// lineHeight: 1,
|
|
1037
|
+
// marginLeft: 20,
|
|
1038
|
+
table: {
|
|
1039
|
+
widths: [24, 185, 35, 25, 45, 45, 45, 45, 45],
|
|
1040
|
+
// headerRows: 2,
|
|
1041
|
+
body: this.GetInsuranceAccidentalPartsTableBodyData(Colli, ShowTaxColumn, PrintPartNo)
|
|
1042
|
+
},
|
|
1043
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
else {
|
|
1047
|
+
return {
|
|
1048
|
+
style: 'tableExample',
|
|
1049
|
+
marginTop: 7,
|
|
1050
|
+
// lineHeight: 1,
|
|
1051
|
+
// marginLeft: 20,
|
|
1052
|
+
table: {
|
|
1053
|
+
widths: [25, 220, 25, 45, 45, 45, 45, 45],
|
|
1054
|
+
// headerRows: 2,
|
|
1055
|
+
body: this.GetInsuranceAccidentalPartsTableBodyData(Colli, ShowTaxColumn, PrintPartNo)
|
|
1056
|
+
},
|
|
1057
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
static GetCustomerAccidentalPartsTableBodyData(Parts, ShowTaxColumn, PrintPartNo, Approved, isRepairOrder) {
|
|
1062
|
+
let columns = this.GetCustomerAccidentalPartsHeaders(ShowTaxColumn, PrintPartNo, Approved, isRepairOrder);
|
|
1063
|
+
var body = [];
|
|
1064
|
+
for (let i = 0; i < columns.length; i++) {
|
|
1065
|
+
body.push(columns[i]);
|
|
1066
|
+
}
|
|
1067
|
+
let SNo = 1;
|
|
1068
|
+
Parts.forEach((part) => {
|
|
1069
|
+
var dataRow = [];
|
|
1070
|
+
columns[1].forEach((column) => {
|
|
1071
|
+
if (!tr_utils_1.TrUtils.IsNull(column.Parent)) {
|
|
1072
|
+
if (!tr_utils_1.TrUtils.IsNull(part[column.Parent]) && !tr_utils_1.TrUtils.IsFixedZero(part[column.Parent][column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Parent][column.Field])) {
|
|
1073
|
+
dataRow.push({ text: part[column.Parent][column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1074
|
+
}
|
|
1075
|
+
else {
|
|
1076
|
+
dataRow.push({ text: '', alignment: 'center' });
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
else {
|
|
1080
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
1081
|
+
if (column.Field === 'SNo' || column.Field === 'Desc'
|
|
1082
|
+
|| column.text === 'Description/PartNo') {
|
|
1083
|
+
// dataRow.push(part[column.Field].toString());
|
|
1084
|
+
if (column.Field === 'Desc') {
|
|
1085
|
+
let DescData = [];
|
|
1086
|
+
DescData.push(part[column.Field].toString());
|
|
1087
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
1088
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
1089
|
+
}
|
|
1090
|
+
dataRow.push({ stack: DescData });
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
else {
|
|
1101
|
+
if (column.Field === 'SNo') {
|
|
1102
|
+
part[column.Field] = SNo;
|
|
1103
|
+
SNo = SNo + 1;
|
|
1104
|
+
}
|
|
1105
|
+
else {
|
|
1106
|
+
part[column.Field] = '';
|
|
1107
|
+
}
|
|
1108
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
body.push(dataRow);
|
|
1113
|
+
});
|
|
1114
|
+
return body;
|
|
1115
|
+
}
|
|
1116
|
+
static GetInsuranceAccidentalPartsTableBodyData(Parts, ShowTaxColumn, PrintPartNo) {
|
|
1117
|
+
let columns = this.GetInsuranceAccidentalPartsHeaders(ShowTaxColumn, PrintPartNo);
|
|
1118
|
+
var body = [];
|
|
1119
|
+
for (let i = 0; i < columns.length; i++) {
|
|
1120
|
+
body.push(columns[i]);
|
|
1121
|
+
}
|
|
1122
|
+
let SNo = 1;
|
|
1123
|
+
Parts.forEach((part) => {
|
|
1124
|
+
var dataRow = [];
|
|
1125
|
+
columns[1].forEach((column) => {
|
|
1126
|
+
if (!tr_utils_1.TrUtils.IsNull(column.Parent)) {
|
|
1127
|
+
if (!tr_utils_1.TrUtils.IsNull(part[column.Parent]) && !tr_utils_1.TrUtils.IsFixedZero(part[column.Parent][column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Parent][column.Field])) {
|
|
1128
|
+
dataRow.push({ text: part[column.Parent][column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1131
|
+
dataRow.push({ text: '', alignment: 'center' });
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
else {
|
|
1135
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
1136
|
+
if (column.Field === 'SNo' || column.Field === 'Desc'
|
|
1137
|
+
|| column.text === 'Description/PartNo') {
|
|
1138
|
+
// dataRow.push(part[column.Field].toString());
|
|
1139
|
+
if (column.Field === 'Desc') {
|
|
1140
|
+
let DescData = [];
|
|
1141
|
+
DescData.push(part[column.Field].toString());
|
|
1142
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
1143
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
1144
|
+
}
|
|
1145
|
+
dataRow.push({ stack: DescData });
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
else {
|
|
1156
|
+
if (column.Field === 'SNo') {
|
|
1157
|
+
part[column.Field] = SNo;
|
|
1158
|
+
SNo = SNo + 1;
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
part[column.Field] = '';
|
|
1162
|
+
}
|
|
1163
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
});
|
|
1167
|
+
body.push(dataRow);
|
|
1168
|
+
});
|
|
1169
|
+
return body;
|
|
1170
|
+
}
|
|
1171
|
+
static GetInsuranceAccidentalPartsHeaders(ShowTaxColumn, PrintPartNo) {
|
|
1172
|
+
let headersNames = [
|
|
1173
|
+
[{ text: 'S.No.', rowSpan: 2, style: ['tableheader', 'withApp'] },
|
|
1174
|
+
{ text: 'Qty', style: ['tableheader', 'withApp'], rowSpan: 2, },
|
|
1175
|
+
{ text: 'Unit Price', style: ['tableheader', 'withApp'], rowSpan: 2, },
|
|
1176
|
+
{ text: 'Labor charges ', style: ['tableheader', 'withApp'], colSpan: 3, }, {}, {},
|
|
1177
|
+
{ text: 'Line Total', rowSpan: 2, style: ['tableheader', 'withApp'] }
|
|
1178
|
+
],
|
|
1179
|
+
[{ text: '', Field: 'SNo' }, { text: '', Field: 'Desc' },
|
|
1180
|
+
{ text: '', Field: 'QtyAndUoM', Parent: 'PartData' }, { text: '', Parent: 'PartData', Field: 'AssPr' },
|
|
1181
|
+
{ text: 'R&R/Labor', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Parent: 'RRFData', Field: 'AssPr' },
|
|
1182
|
+
{ text: 'Denting', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Parent: 'DtngData', Field: 'AssPr' },
|
|
1183
|
+
{ text: 'Painting', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Parent: 'PtngData', Field: 'AssPr' },
|
|
1184
|
+
{ text: '', Field: 'LineTotal', style: ['tableheader', 'withApp'] }
|
|
1185
|
+
]
|
|
1186
|
+
];
|
|
1187
|
+
if (PrintPartNo) {
|
|
1188
|
+
headersNames[0].splice(1, 0, { text: 'Description/PartNo', rowSpan: 2, style: ['tableheader', 'withApp'] });
|
|
1189
|
+
}
|
|
1190
|
+
else {
|
|
1191
|
+
headersNames[0].splice(1, 0, { text: 'Description', rowSpan: 2, style: ['tableheader', 'withApp'] });
|
|
1192
|
+
}
|
|
1193
|
+
if (ShowTaxColumn) {
|
|
1194
|
+
headersNames[0].splice(2, 0, { text: 'HSN', rowSpan: 2, style: ['tableheader', 'withApp'] });
|
|
1195
|
+
headersNames[1].splice(2, 0, { text: '', Parent: 'PartData', Field: 'HSN' });
|
|
1196
|
+
}
|
|
1197
|
+
return headersNames;
|
|
1198
|
+
}
|
|
1199
|
+
static GetCustomerAccidentalPartsHeaders(ShowTaxColumn, PrintPartNo, Approved, isRepairOrder) {
|
|
1200
|
+
let headersNames = [];
|
|
1201
|
+
if (Approved || isRepairOrder) {
|
|
1202
|
+
headersNames = [
|
|
1203
|
+
[{ text: 'S.No.', rowSpan: 2, style: ['tableheader', 'withApp'], alignment: 'center' },
|
|
1204
|
+
{ text: 'Qty', style: ['tableheader', 'withApp'], rowSpan: 2, alignment: 'center' },
|
|
1205
|
+
{ text: 'Unit Price', style: ['tableheader', 'withApp'], rowSpan: 2, alignment: 'center' },
|
|
1206
|
+
{ text: 'Labor charges ', style: ['tableheader', 'withApp'], colSpan: 3, alignment: 'center' }, {}, {},
|
|
1207
|
+
{ text: 'Line Total', rowSpan: 2, alignment: 'center', style: ['tableheader', 'withApp'] }
|
|
1208
|
+
],
|
|
1209
|
+
[{ text: '', Field: 'SNo' }, { text: '', Field: 'Desc' },
|
|
1210
|
+
{ text: '', Parent: 'PartData', Field: 'QtyAndUoM' }, { text: '', Parent: 'PartData', Field: 'UnPr' },
|
|
1211
|
+
{ text: 'R&R/Labor', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Parent: 'RRFData', Field: 'UnPr' },
|
|
1212
|
+
{
|
|
1213
|
+
text: 'Denting', fontSize: this.FontSize, Parent: 'DtngData',
|
|
1214
|
+
style: ['tableheader', 'withApp'], Field: 'UnPr'
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
text: 'Painting', fontSize: this.FontSize, Parent: 'PtngData',
|
|
1218
|
+
style: ['tableheader', 'withApp'], Field: 'UnPr', alignment: 'center'
|
|
1219
|
+
},
|
|
1220
|
+
{ text: '', Field: 'LineTotal' }
|
|
1221
|
+
]
|
|
1222
|
+
];
|
|
1223
|
+
}
|
|
1224
|
+
else {
|
|
1225
|
+
headersNames = [
|
|
1226
|
+
[{ text: 'S.No.', rowSpan: 2, style: ['tableheader', 'withApp'], alignment: 'center' },
|
|
1227
|
+
{ text: 'Qty', style: ['tableheader', 'withApp'], rowSpan: 2, alignment: 'center' },
|
|
1228
|
+
{ text: 'Unit Price', style: ['tableheader', 'withApp'], rowSpan: 2, alignment: 'center' },
|
|
1229
|
+
{ text: 'Labor charges ', style: ['tableheader', 'withApp'], colSpan: 3, alignment: 'center' }, {}, {},
|
|
1230
|
+
{ text: 'Line Total', rowSpan: 2, alignment: 'center', style: ['tableheader', 'withApp'] }
|
|
1231
|
+
],
|
|
1232
|
+
[{ text: '', Field: 'SNo' }, { text: '', Field: 'Desc' },
|
|
1233
|
+
{ text: '', Parent: 'PartData', Field: 'QtyAndUoM' }, { text: '', Parent: 'PartData', Field: 'EstPr' },
|
|
1234
|
+
{ text: 'R&R/Labor', fontSize: this.FontSize, style: ['tableheader', 'withApp'], Parent: 'RRFData', Field: 'EstPr' },
|
|
1235
|
+
{
|
|
1236
|
+
text: 'Denting', fontSize: this.FontSize,
|
|
1237
|
+
style: ['tableheader', 'withApp'], Parent: 'DtngData', Field: 'EstPr'
|
|
1238
|
+
},
|
|
1239
|
+
{
|
|
1240
|
+
text: 'Painting', fontSize: this.FontSize,
|
|
1241
|
+
style: ['tableheader', 'withApp'], Parent: 'PtngData', Field: 'EstPr', alignment: 'center'
|
|
1242
|
+
},
|
|
1243
|
+
{ text: '', Field: 'LineTotal' }
|
|
1244
|
+
]
|
|
1245
|
+
];
|
|
1246
|
+
}
|
|
1247
|
+
if (PrintPartNo) {
|
|
1248
|
+
headersNames[0].splice(1, 0, { text: 'Description/PartNo', rowSpan: 2, style: ['tableheader', 'withApp'] });
|
|
1249
|
+
}
|
|
1250
|
+
else {
|
|
1251
|
+
headersNames[0].splice(1, 0, { text: 'Description', rowSpan: 2, style: ['tableheader', 'withApp'] });
|
|
1252
|
+
}
|
|
1253
|
+
if (ShowTaxColumn) {
|
|
1254
|
+
headersNames[0].splice(2, 0, { text: 'HSN', rowSpan: 2, style: ['tableheader', 'withApp'], alignment: 'center' });
|
|
1255
|
+
headersNames[1].splice(2, 0, { text: '', Parent: 'PartData', Field: 'HSN' });
|
|
1256
|
+
}
|
|
1257
|
+
return headersNames;
|
|
1258
|
+
}
|
|
1259
|
+
static threeLayOutStyle() {
|
|
1260
|
+
return {
|
|
1261
|
+
hLineWidth: function (i, node) {
|
|
1262
|
+
return (i === 0 || i === node.table.body.length) ? 0.7 : 0.7;
|
|
1263
|
+
},
|
|
1264
|
+
vLineWidth: function (i, node) {
|
|
1265
|
+
return (i === 0 || i === node.table.widths.length) ? 0.7 : 0.7;
|
|
1266
|
+
},
|
|
1267
|
+
hLineColor: function (i, node) {
|
|
1268
|
+
let color;
|
|
1269
|
+
if (i === 0 || i === node.table.body.length) {
|
|
1270
|
+
color = 'black';
|
|
1271
|
+
}
|
|
1272
|
+
else {
|
|
1273
|
+
if (i === 1 || i === 2 || i === 3) {
|
|
1274
|
+
color = 'gray';
|
|
1275
|
+
}
|
|
1276
|
+
else {
|
|
1277
|
+
color = 'lightgray';
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
return color;
|
|
1281
|
+
},
|
|
1282
|
+
vLineColor: function (i, node) {
|
|
1283
|
+
let color;
|
|
1284
|
+
if (i === 0 || i === node.table.widths.length) {
|
|
1285
|
+
color = 'black';
|
|
1286
|
+
}
|
|
1287
|
+
else {
|
|
1288
|
+
color = 'gray';
|
|
1289
|
+
}
|
|
1290
|
+
return color;
|
|
1291
|
+
},
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
static WithOutDiscountFieldTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
1295
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
1296
|
+
if (PrintPartNo) {
|
|
1297
|
+
return {
|
|
1298
|
+
style: 'tableExample',
|
|
1299
|
+
marginLeft: 20,
|
|
1300
|
+
table: {
|
|
1301
|
+
widths: [25, 60, 160, 25, 50, 60, 30, 50],
|
|
1302
|
+
headerRows: 1,
|
|
1303
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1304
|
+
},
|
|
1305
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
else {
|
|
1309
|
+
return {
|
|
1310
|
+
style: 'tableExample',
|
|
1311
|
+
marginLeft: 20,
|
|
1312
|
+
table: {
|
|
1313
|
+
widths: [25, 215, 25, 50, 60, 45, 50],
|
|
1314
|
+
headerRows: 1,
|
|
1315
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1316
|
+
},
|
|
1317
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
else {
|
|
1322
|
+
let a = '';
|
|
1323
|
+
return a;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
static BuildTableBodyForLaborAndParts(Parts, Labor, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
1327
|
+
var body = [];
|
|
1328
|
+
let columns = shared_print_service_1.PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
|
|
1329
|
+
// if (ShowTaxColumn) {
|
|
1330
|
+
for (let i = 0; i < columns.length; i++) {
|
|
1331
|
+
body.push(columns[i]);
|
|
1332
|
+
}
|
|
1333
|
+
columns = columns[1];
|
|
1334
|
+
// } else {
|
|
1335
|
+
// body.push(columns);
|
|
1336
|
+
// }
|
|
1337
|
+
let DummyOps = [];
|
|
1338
|
+
if (Parts.length !== 0) {
|
|
1339
|
+
let dummypartadding1 = {};
|
|
1340
|
+
dummypartadding1.SNo = '';
|
|
1341
|
+
dummypartadding1.Desc = 'Spare Parts';
|
|
1342
|
+
dummypartadding1.Qty = '';
|
|
1343
|
+
dummypartadding1.UnPr = '';
|
|
1344
|
+
dummypartadding1.LineTotal = '';
|
|
1345
|
+
Parts.unshift(dummypartadding1);
|
|
1346
|
+
}
|
|
1347
|
+
let SNo = 1;
|
|
1348
|
+
Parts.forEach((part) => {
|
|
1349
|
+
var dataRow = [];
|
|
1350
|
+
columns.forEach((column) => {
|
|
1351
|
+
if ((!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]))
|
|
1352
|
+
|| (column.text === 'Line Total')) {
|
|
1353
|
+
if (part[column.Field] === 'Spare Parts') {
|
|
1354
|
+
dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
1355
|
+
}
|
|
1356
|
+
else {
|
|
1357
|
+
if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
|
|
1358
|
+
&& tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
|
|
1359
|
+
part[column.Field] = '';
|
|
1360
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1363
|
+
if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'QtyAndUoM'
|
|
1364
|
+
|| column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
|
|
1365
|
+
|| column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
|
|
1366
|
+
if (column.Field === 'Disc') {
|
|
1367
|
+
if (column.type === 'percentage') {
|
|
1368
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part.Perc)) {
|
|
1369
|
+
dataRow.push({ text: part.Perc.toString(), alignment: 'right', noWrap: true });
|
|
1370
|
+
}
|
|
1371
|
+
else {
|
|
1372
|
+
dataRow.push({ text: '', noWrap: true });
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
else {
|
|
1376
|
+
if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
|
|
1377
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
1378
|
+
}
|
|
1379
|
+
else {
|
|
1380
|
+
dataRow.push({ text: '', noWrap: true });
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
else {
|
|
1385
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
else {
|
|
1389
|
+
// dataRow.push(part[column.Field].toString());
|
|
1390
|
+
if (column.Field === 'Desc') {
|
|
1391
|
+
let DescData = [];
|
|
1392
|
+
DescData.push(part[column.Field].toString());
|
|
1393
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
1394
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
1395
|
+
}
|
|
1396
|
+
dataRow.push({ stack: DescData });
|
|
1397
|
+
}
|
|
1398
|
+
else {
|
|
1399
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
else {
|
|
1406
|
+
if (column.Field === 'SNo') {
|
|
1407
|
+
part[column.Field] = SNo;
|
|
1408
|
+
SNo = SNo + 1;
|
|
1409
|
+
}
|
|
1410
|
+
else {
|
|
1411
|
+
if (tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
1412
|
+
part[column.Field] = '';
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
body.push(dataRow);
|
|
1419
|
+
});
|
|
1420
|
+
SNo = 1;
|
|
1421
|
+
if (Labor.length !== 0) {
|
|
1422
|
+
let dummypartadding1 = {};
|
|
1423
|
+
dummypartadding1.SNo = '';
|
|
1424
|
+
dummypartadding1.Desc = 'Labor';
|
|
1425
|
+
dummypartadding1.Qty = '';
|
|
1426
|
+
dummypartadding1.UnPr = '';
|
|
1427
|
+
dummypartadding1.LineTotal = '';
|
|
1428
|
+
Labor.unshift(dummypartadding1);
|
|
1429
|
+
// DummyOps.unshift(dummypartadding1);
|
|
1430
|
+
}
|
|
1431
|
+
if (Body === 2) {
|
|
1432
|
+
for (let i = 0; i < Labor.length; i++) {
|
|
1433
|
+
Labor[i].UnPr = '';
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
Labor.forEach((Ops) => {
|
|
1437
|
+
var dataRow = [];
|
|
1438
|
+
columns.forEach((column) => {
|
|
1439
|
+
if ((!tr_utils_1.TrUtils.IsFixedZero(Ops[column.Field]) && !tr_utils_1.TrUtils.IsNull(Ops[column.Field]))
|
|
1440
|
+
|| (column.text === 'Line Total')) {
|
|
1441
|
+
if (Ops[column.Field] === 'Labor') {
|
|
1442
|
+
dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
1443
|
+
}
|
|
1444
|
+
else {
|
|
1445
|
+
if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
|
|
1446
|
+
&& tr_utils_1.TrUtils.CheckInvalidSelect(Ops.TCode))) {
|
|
1447
|
+
Ops[column.Field] = '';
|
|
1448
|
+
dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
|
|
1449
|
+
}
|
|
1450
|
+
else {
|
|
1451
|
+
if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
|
|
1452
|
+
|| column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
|
|
1453
|
+
|| column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
|
|
1454
|
+
if (column.Field === 'Disc') {
|
|
1455
|
+
if (column.type === 'percentage') {
|
|
1456
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Ops.Perc)) {
|
|
1457
|
+
dataRow.push({ text: Ops.Perc.toString(), alignment: 'right', noWrap: true });
|
|
1458
|
+
}
|
|
1459
|
+
else {
|
|
1460
|
+
dataRow.push({ text: '', noWrap: true });
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
else {
|
|
1464
|
+
if (!tr_utils_1.TrUtils.IsZero(Ops[column.Field])) {
|
|
1465
|
+
dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
1466
|
+
}
|
|
1467
|
+
else {
|
|
1468
|
+
dataRow.push({ text: '', noWrap: true });
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
else {
|
|
1473
|
+
dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
else {
|
|
1477
|
+
dataRow.push(Ops[column.Field].toString());
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
else {
|
|
1483
|
+
if (column.Field === 'SNo') {
|
|
1484
|
+
Ops[column.Field] = SNo;
|
|
1485
|
+
SNo = SNo + 1;
|
|
1486
|
+
}
|
|
1487
|
+
else {
|
|
1488
|
+
if (tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
|
|
1489
|
+
Ops[column.Field] = '';
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
body.push(dataRow);
|
|
1496
|
+
});
|
|
1497
|
+
return body;
|
|
1498
|
+
}
|
|
1499
|
+
static GetWithOutDiscAndTaxFieldHeader(Parts, Ops, ShowTaxColumn, PrintPartNo, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
1500
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
1501
|
+
if (ShowTaxColumn) {
|
|
1502
|
+
return this.TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
|
|
1503
|
+
}
|
|
1504
|
+
else {
|
|
1505
|
+
if (ConsolidateGST) {
|
|
1506
|
+
return this.ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
|
|
1507
|
+
}
|
|
1508
|
+
else {
|
|
1509
|
+
return this.NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
else {
|
|
1514
|
+
let a = '';
|
|
1515
|
+
return a;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
static TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
1519
|
+
if (PrintPartNo) {
|
|
1520
|
+
if (ShowIGST) {
|
|
1521
|
+
return {
|
|
1522
|
+
style: 'tableExample',
|
|
1523
|
+
table: {
|
|
1524
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
1525
|
+
// headerRows: 2,
|
|
1526
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1527
|
+
},
|
|
1528
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
else {
|
|
1532
|
+
return {
|
|
1533
|
+
style: 'tableExample',
|
|
1534
|
+
table: {
|
|
1535
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
1536
|
+
// headerRows: 2,
|
|
1537
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1538
|
+
},
|
|
1539
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
else {
|
|
1544
|
+
if (ShowIGST) {
|
|
1545
|
+
return {
|
|
1546
|
+
style: 'tableExample',
|
|
1547
|
+
table: {
|
|
1548
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
1549
|
+
// headerRows: 2,
|
|
1550
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1551
|
+
},
|
|
1552
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
else {
|
|
1556
|
+
return {
|
|
1557
|
+
style: 'tableExample',
|
|
1558
|
+
table: {
|
|
1559
|
+
widths: shared_print_service_1.PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
1560
|
+
// headerRows: 2,
|
|
1561
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1562
|
+
},
|
|
1563
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
static ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
1569
|
+
if (PrintPartNo) {
|
|
1570
|
+
return {
|
|
1571
|
+
style: 'tableExample',
|
|
1572
|
+
table: {
|
|
1573
|
+
widths: [25, 65, 273, 25, 60, 75, 10, 40],
|
|
1574
|
+
// headerRows: 1,
|
|
1575
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1576
|
+
},
|
|
1577
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1578
|
+
};
|
|
1579
|
+
}
|
|
1580
|
+
else {
|
|
1581
|
+
return {
|
|
1582
|
+
style: 'tableExample',
|
|
1583
|
+
table: {
|
|
1584
|
+
widths: [25, 290, 50, 80, 80, 10, 40],
|
|
1585
|
+
// headerRows: 1,
|
|
1586
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1587
|
+
},
|
|
1588
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
static NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn) {
|
|
1593
|
+
if (PrintPartNo) {
|
|
1594
|
+
return {
|
|
1595
|
+
style: 'tableExample',
|
|
1596
|
+
table: {
|
|
1597
|
+
widths: shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
|
|
1598
|
+
// headerRows: 1,
|
|
1599
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1600
|
+
},
|
|
1601
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
else {
|
|
1605
|
+
return {
|
|
1606
|
+
style: 'tableExample',
|
|
1607
|
+
table: {
|
|
1608
|
+
widths: shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
|
|
1609
|
+
// headerRows: 1,
|
|
1610
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
|
|
1611
|
+
},
|
|
1612
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle()
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
static buildTableForCustomerLabor(Parts, Ops, PrintPartNo, customerorInsurance) {
|
|
1617
|
+
var body = [];
|
|
1618
|
+
let columns;
|
|
1619
|
+
columns = this.getSummaryHeaders(PrintPartNo);
|
|
1620
|
+
// console.log(columns);
|
|
1621
|
+
body.push(columns);
|
|
1622
|
+
if (Parts.length !== 0) {
|
|
1623
|
+
let dummypartadding1 = {};
|
|
1624
|
+
dummypartadding1.SNo = '';
|
|
1625
|
+
dummypartadding1.Desc = 'Spare Parts';
|
|
1626
|
+
dummypartadding1.Qty = '';
|
|
1627
|
+
dummypartadding1.UnPr = '';
|
|
1628
|
+
dummypartadding1.Price = '';
|
|
1629
|
+
dummypartadding1.DiscountedPrice = '';
|
|
1630
|
+
dummypartadding1.LineTotal = '';
|
|
1631
|
+
dummypartadding1.QtyAndUoM = '';
|
|
1632
|
+
dummypartadding1.HSN = '';
|
|
1633
|
+
dummypartadding1.MPN = '';
|
|
1634
|
+
Parts.unshift(dummypartadding1);
|
|
1635
|
+
}
|
|
1636
|
+
let SNo = 1;
|
|
1637
|
+
Parts.forEach((part) => {
|
|
1638
|
+
var dataRow = [];
|
|
1639
|
+
columns.forEach((column) => {
|
|
1640
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])
|
|
1641
|
+
|| column.text === 'Line Total') {
|
|
1642
|
+
if (part[column.Field] === 'Spare Parts') {
|
|
1643
|
+
dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
1644
|
+
}
|
|
1645
|
+
else {
|
|
1646
|
+
// tslint:disable-next-line:max-line-length
|
|
1647
|
+
if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
|
|
1648
|
+
column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'UnPr') {
|
|
1649
|
+
if (column.Field === 'Disc Amt') {
|
|
1650
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
1651
|
+
}
|
|
1652
|
+
else {
|
|
1653
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
else {
|
|
1657
|
+
// dataRow.push({ text: part[column.Field].toString() });
|
|
1658
|
+
if (column.Field === 'Desc') {
|
|
1659
|
+
let DescData = [];
|
|
1660
|
+
DescData.push(part[column.Field].toString());
|
|
1661
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
1662
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
1663
|
+
}
|
|
1664
|
+
dataRow.push({ stack: DescData });
|
|
1665
|
+
}
|
|
1666
|
+
else {
|
|
1667
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
else {
|
|
1673
|
+
if (column.Field === 'SNo') {
|
|
1674
|
+
part[column.Field] = SNo;
|
|
1675
|
+
SNo = SNo + 1;
|
|
1676
|
+
}
|
|
1677
|
+
else {
|
|
1678
|
+
if (tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
1679
|
+
part[column.Field] = '';
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
1683
|
+
}
|
|
1684
|
+
});
|
|
1685
|
+
body.push(dataRow);
|
|
1686
|
+
});
|
|
1687
|
+
SNo = 1;
|
|
1688
|
+
if (Ops.length !== 0) {
|
|
1689
|
+
let dummypartadding1 = {};
|
|
1690
|
+
dummypartadding1.SNo = '';
|
|
1691
|
+
dummypartadding1.Desc = 'Labor';
|
|
1692
|
+
dummypartadding1.Qty = '';
|
|
1693
|
+
dummypartadding1.UnPr = '';
|
|
1694
|
+
dummypartadding1.Price = '';
|
|
1695
|
+
dummypartadding1.DiscountedPrice = '';
|
|
1696
|
+
dummypartadding1.LineTotal = '';
|
|
1697
|
+
dummypartadding1.QtyAndUoM = '';
|
|
1698
|
+
dummypartadding1.HSN = '';
|
|
1699
|
+
Ops.unshift(dummypartadding1);
|
|
1700
|
+
}
|
|
1701
|
+
Ops.forEach((labor) => {
|
|
1702
|
+
var dataRow = [];
|
|
1703
|
+
columns.forEach((column) => {
|
|
1704
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(labor[column.Field]) && !tr_utils_1.TrUtils.IsNull(labor[column.Field])
|
|
1705
|
+
|| column.text === 'Line Total') {
|
|
1706
|
+
if (labor[column.Field] === 'Labor') {
|
|
1707
|
+
dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
1708
|
+
}
|
|
1709
|
+
else {
|
|
1710
|
+
if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount'
|
|
1711
|
+
|| column.Field === 'UnPr' || column.Field === 'CustPrice' || column.Field === 'InsPrice') {
|
|
1712
|
+
if (column.Field === 'Disc Amt') {
|
|
1713
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
1714
|
+
}
|
|
1715
|
+
else {
|
|
1716
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
else {
|
|
1720
|
+
dataRow.push({ text: labor[column.Field].toString() });
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
else {
|
|
1725
|
+
if (column.Field === 'SNo') {
|
|
1726
|
+
labor[column.Field] = SNo;
|
|
1727
|
+
SNo = SNo + 1;
|
|
1728
|
+
}
|
|
1729
|
+
else {
|
|
1730
|
+
if (tr_utils_1.TrUtils.IsNull(labor[column.Field])) {
|
|
1731
|
+
labor[column.Field] = '';
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
body.push(dataRow);
|
|
1738
|
+
});
|
|
1739
|
+
return body;
|
|
1740
|
+
}
|
|
1741
|
+
static getSummaryHeaders(permission) {
|
|
1742
|
+
let headersNames = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
|
|
1743
|
+
{ text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
|
|
1744
|
+
{ text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
|
|
1745
|
+
// { text: 'Rate / Unit', style: 'tableheader', Field: 'UnPr' },
|
|
1746
|
+
{ text: 'Ins. Amt', style: 'tableheader', Field: 'InsPrice' },
|
|
1747
|
+
{ text: 'Cust. Amt', style: 'tableheader', Field: 'CustPrice' },
|
|
1748
|
+
{ text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
|
|
1749
|
+
{ text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
|
|
1750
|
+
{ text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
|
|
1751
|
+
if (permission) {
|
|
1752
|
+
let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
|
|
1753
|
+
let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
|
|
1754
|
+
headersNames.unshift(sno, MPN);
|
|
1755
|
+
}
|
|
1756
|
+
else {
|
|
1757
|
+
let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
|
|
1758
|
+
headersNames.unshift(sno);
|
|
1759
|
+
}
|
|
1760
|
+
return headersNames;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
exports.RoprintService = RoprintService;
|
|
1764
|
+
RoprintService.FontSize = 8;
|