shareneus 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DebitNotePdfService = exports.DCWithoutPricePdfService = exports.DCLandscapeWithoutPricePdfService = exports.DCLandscapePdfService = exports.CustomerBalancesService = exports.SalesByCustomerPDFService = exports.CustWiseSalesDetailsService = exports.CreditNoteTotalsService = exports.CreditNotePdfService = exports.ConsultationPDFService = exports.ConsultationFullPrintService = exports.ConsultationFeeReceiptPrintService = exports.CNPrintService = exports.ChecklistsPDFService = exports.CheckListPrintService = exports.CategoryWiseItemPDFService = exports.SalesReceiptprintService = exports.AppointmentTotalsService = exports.AnalysisPDFService = exports.VenBalanceXlsxFileService = exports.TallySalesImportXlsxFileService = exports.StockXlsxFileService = exports.IssueSparesXlsxFileService = exports.ScheduledDrugXlsxFileService = exports.ScheduledDrugSummaryXlsxFileService = exports.SalesByServiceSummaryXlsxFileService = exports.SummaryXlsxFileService = exports.ServiceAdvisorWisePartXlsxFileService = exports.ServiceAdvisorWiseLaborXlsxFileService = exports.RepairOrdersXlsxFileService = exports.PaymentsMadeXlsxFileService = exports.PaymentReceiveXlsxFileService = exports.OperatorWiseSummaryXlsxFileService = exports.OperatorWiseDetailsXlsxFileService = exports.ManfWiseSalesXlsxFileService = exports.ItemsWiseSalesXlsxFileService = exports.ItemWiseMOSummaryXlsxFileService = exports.ItemWiseMODetailsXlsxFileService = exports.ItemWiseDoctorSaleXlsxFileService = exports.InvoicesWiseXlsxFileService = exports.InsuranceExpireXlsxFileService = exports.GSTR2ExcelService = exports.GSTR1ExcelService = exports.GSTROXlsxFileService = exports.ExpiringDrugsXlsxFileService = exports.SalesByCustomerXlsxFileService = exports.CustWiseSalesXlsxFileService = exports.CustBalanceXlsxFileService = exports.CategoryWiseItemXlsxFileService = exports.AnalysisXlsxFileService = void 0;
|
|
4
4
|
exports.SharedPDFService = exports.SharedInvoiceprintService = exports.WOPrintService = exports.ScheduledDrugSummaryPDFService = exports.ScheduledDrugPDFService = exports.SalesTotalsService = exports.SaleReceiptPrintService = exports.SalesReceiptpdfService = exports.SalesPrintService = exports.SalesPdfService = exports.SalesByServiceSummaryPDF = exports.ROTotalsService = exports.ROPrintService = exports.RoprintService = exports.RepairOrdersReportsPDFService = exports.ReorderPointPDFService = exports.ReceiptPrintService = exports.PurchaseOrderPDFService = exports.PurchaseOrderTotalsService = exports.PurchaseOrderPrintService = exports.PosReceiptPrintService = exports.POTotalsService = exports.PaymentsReportPDFService = exports.ReceiptPDFService = exports.PackShipPrintService = exports.PackShipPDFService = exports.OperatorWiseSalesSummaryPDF = exports.OperatorWiseSalesDetailsPDF = exports.MaterialOutprintService = exports.MeetingPdfService = exports.ManfWiseSalesService = exports.ItemWiseSalesPDFService = exports.ItemWiseMOSummaryPDF = exports.ItemWiseMODetailsPDF = exports.ItemWiseDoctorSalePDFService = exports.ItemDetaisPdf = exports.IssuePartsprintService = exports.InvoiceTotalsService = exports.InvoiceLandscapePdfService = exports.InvPrintService = exports.InvoiceprintService = exports.InsuranceExpirePDF = exports.ExpiringDrugPDFService = exports.EstPrintService = exports.EquipmentDesignPdf = exports.DeliveryChallanTotalsService = exports.DeliveryChallanPrintService = exports.DeliveryChallanPdfService = exports.DebitNoteTotalsService = exports.DebitNotePrintService = void 0;
|
|
5
|
-
exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
|
|
5
|
+
exports.HCInvoiceprintService = exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
|
|
6
6
|
var analysis_excel_service_1 = require("./excel-files/analysis-excel.service");
|
|
7
7
|
Object.defineProperty(exports, "AnalysisXlsxFileService", { enumerable: true, get: function () { return analysis_excel_service_1.AnalysisXlsxFileService; } });
|
|
8
8
|
var category_wise_item_excel_service_1 = require("./excel-files/category-wise-item-excel.service");
|
|
@@ -235,3 +235,5 @@ var my_date_1 = require("./utils/my-date");
|
|
|
235
235
|
Object.defineProperty(exports, "MyDate", { enumerable: true, get: function () { return my_date_1.MyDate; } });
|
|
236
236
|
var invoice_portrait_pdf_1 = require("./services/invoice-portrait-pdf");
|
|
237
237
|
Object.defineProperty(exports, "InvoicePortraitPrintService", { enumerable: true, get: function () { return invoice_portrait_pdf_1.InvoicePortraitPrintService; } });
|
|
238
|
+
var hc_inv_pdf_service_1 = require("./services/hc-inv-pdf.service");
|
|
239
|
+
Object.defineProperty(exports, "HCInvoiceprintService", { enumerable: true, get: function () { return hc_inv_pdf_service_1.HCInvoiceprintService; } });
|
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HCInvoiceprintService = void 0;
|
|
4
|
+
const tr_utils_1 = require("../utils/tr-utils");
|
|
5
|
+
const shared_pdf_service_1 = require("./shared-pdf.service");
|
|
6
|
+
const shared_print_service_1 = require("./shared-print.service");
|
|
7
|
+
class HCInvoiceprintService {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.FontSize = 8;
|
|
10
|
+
}
|
|
11
|
+
static GetInvoicePrint(ROPrintData, numberofCopies, isotherIndustry, withPass, isAuto, size) {
|
|
12
|
+
ROPrintData.Entity.IsProforma = ROPrintData.IsProforma;
|
|
13
|
+
var contents = [];
|
|
14
|
+
if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
|
|
15
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, null, isotherIndustry), this.PreparesparePartsTable(ROPrintData, isAuto), this.CommonTotalDetails(ROPrintData, null, numberofCopies, withPass, isAuto));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
numberofCopies.forEach((text, index) => {
|
|
19
|
+
contents.push(this.CommonHeaderDetails(ROPrintData, text, isotherIndustry), this.PreparesparePartsTable(ROPrintData, isAuto), this.CommonTotalDetails(ROPrintData, index, numberofCopies, withPass, isAuto));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var dd = {
|
|
23
|
+
watermark: this.GetWatermark(ROPrintData),
|
|
24
|
+
info: {
|
|
25
|
+
title: this.GetFileName(ROPrintData),
|
|
26
|
+
},
|
|
27
|
+
background: function (currentPage, pageSize) {
|
|
28
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
|
|
29
|
+
},
|
|
30
|
+
header: function (currentPage, pageCount) {
|
|
31
|
+
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
|
|
32
|
+
},
|
|
33
|
+
pageBreakBefore: function (currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
|
|
34
|
+
return currentNode.startPosition.top >= 700 && !tr_utils_1.TrUtils.IsNull(currentNode === null || currentNode === void 0 ? void 0 : currentNode.id) && (currentNode === null || currentNode === void 0 ? void 0 : currentNode.id) === '567';
|
|
35
|
+
},
|
|
36
|
+
// pageMargins: [10, 15, 10, 15],
|
|
37
|
+
pageMargins: this.GetMarginsBasedOnPaperSize(size),
|
|
38
|
+
pageSize: 'A4',
|
|
39
|
+
content: contents,
|
|
40
|
+
styles: shared_pdf_service_1.SharedPDFService.GetStyles()
|
|
41
|
+
};
|
|
42
|
+
return dd;
|
|
43
|
+
}
|
|
44
|
+
static GetMarginsBasedOnPaperSize(size) {
|
|
45
|
+
if (size === 'full') {
|
|
46
|
+
return [25, 15, 15, 15];
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return [25, 15, 15, 435.945];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static GetWatermark(ROPrintData) {
|
|
53
|
+
if (ROPrintData.IsProforma && ROPrintData.Entity.Wmark) {
|
|
54
|
+
return { text: 'Not a final invoice', opacity: 0.2 };
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
static GetFileName(ROPrintData) {
|
|
61
|
+
let fileName = ROPrintData.HeaderName;
|
|
62
|
+
if (!tr_utils_1.TrUtils.IsNull(ROPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
|
|
63
|
+
fileName = fileName + '-' + ROPrintData.Product.RegNo;
|
|
64
|
+
}
|
|
65
|
+
return fileName;
|
|
66
|
+
}
|
|
67
|
+
static CommonHeaderDetails(ROPrintData, text, isotherIndustry) {
|
|
68
|
+
return [
|
|
69
|
+
this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
|
|
70
|
+
shared_pdf_service_1.SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate, ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For, ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp, ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, null, ROPrintData.Location, isotherIndustry, ROPrintData.BL, ROPrintData.ROCode, ROPrintData.TypeName, ROPrintData.AdmNo),
|
|
71
|
+
shared_pdf_service_1.SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
|
|
72
|
+
this.CustomerAndVehicleDetailsAfterLine(),
|
|
73
|
+
shared_pdf_service_1.SharedPDFService.GetDisplayTable(),
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
static CustomerAndVehicleDetailsAfterLine() {
|
|
77
|
+
return {
|
|
78
|
+
canvas: [
|
|
79
|
+
{
|
|
80
|
+
type: 'line',
|
|
81
|
+
lineColor: 'grey',
|
|
82
|
+
x1: 0,
|
|
83
|
+
y1: 0,
|
|
84
|
+
x2: 555,
|
|
85
|
+
y2: 0,
|
|
86
|
+
lineWidth: 1.5
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static GetMainHeaderDetails(Entity, HeaderName, Image, HColor, AColor, text) {
|
|
92
|
+
return [
|
|
93
|
+
// SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, text),
|
|
94
|
+
shared_pdf_service_1.SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
|
|
95
|
+
this.GetPrintType(HeaderName, Entity.RegNo),
|
|
96
|
+
this.HeaderAfterLine()
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
static HeaderAfterLine() {
|
|
100
|
+
return {
|
|
101
|
+
canvas: [
|
|
102
|
+
{
|
|
103
|
+
type: 'line',
|
|
104
|
+
lineColor: 'grey',
|
|
105
|
+
x1: 0,
|
|
106
|
+
y1: 0,
|
|
107
|
+
x2: 555,
|
|
108
|
+
y2: 0,
|
|
109
|
+
lineWidth: 1.5
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static GetPrintType(type, RegNo) {
|
|
115
|
+
return {
|
|
116
|
+
// marginLeft: 10,
|
|
117
|
+
columns: [{ text: '', width: 120 },
|
|
118
|
+
{ text: type, alignment: 'center', style: 'Receiptheader1' }, { text: 'Regn.No : ' + RegNo, alignment: 'right', width: 140, fontSize: 7 }
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
static PreparesparePartsTable(ROPrintData, isAuto) {
|
|
123
|
+
let List = [];
|
|
124
|
+
if (ROPrintData.Entity.Body === 1) {
|
|
125
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
126
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
127
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
128
|
+
}
|
|
129
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), false));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
if (ROPrintData.Entity.Body === 2) {
|
|
134
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
135
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
136
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
137
|
+
}
|
|
138
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, false, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
if (ROPrintData.Summary) {
|
|
143
|
+
List.push('', this.GetLaborPartsTableForView(ROPrintData.Items, ROPrintData.Ops, false));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
|
|
147
|
+
if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
|
|
148
|
+
ROPrintData.PrintInfo[i].Text = '';
|
|
149
|
+
}
|
|
150
|
+
List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, false, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return List;
|
|
156
|
+
}
|
|
157
|
+
static GetLaborPartsTableForView(Parts, Ops, PrintPartNo) {
|
|
158
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
159
|
+
if (PrintPartNo) {
|
|
160
|
+
return {
|
|
161
|
+
style: 'tableExample',
|
|
162
|
+
// marginLeft: 20,
|
|
163
|
+
table: {
|
|
164
|
+
widths: [25, 30, 170, 85, 15, 20, 50, 30, 30, 50],
|
|
165
|
+
// headerRows: 2,
|
|
166
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
|
|
167
|
+
},
|
|
168
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
return {
|
|
173
|
+
style: 'tableExample',
|
|
174
|
+
// marginLeft: 20,
|
|
175
|
+
table: {
|
|
176
|
+
widths: [25, 200, 55, 25, 55, 55, 40, 15, 50],
|
|
177
|
+
// headerRows: 2,
|
|
178
|
+
body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
|
|
179
|
+
},
|
|
180
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
let a = '';
|
|
186
|
+
return a;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
static WithOutDiscountFieldTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto) {
|
|
190
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
191
|
+
if (PrintPartNo) {
|
|
192
|
+
return {
|
|
193
|
+
style: 'tableExample',
|
|
194
|
+
marginLeft: 20,
|
|
195
|
+
table: {
|
|
196
|
+
widths: [25, 60, 155, 30, 50, 60, 30, 50],
|
|
197
|
+
headerRows: 1,
|
|
198
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
199
|
+
},
|
|
200
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return {
|
|
205
|
+
style: 'tableExample',
|
|
206
|
+
marginLeft: 20,
|
|
207
|
+
table: {
|
|
208
|
+
widths: [25, 215, 25, 50, 60, 45, 50],
|
|
209
|
+
headerRows: 1,
|
|
210
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
211
|
+
},
|
|
212
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyleanother()
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
let a = '';
|
|
218
|
+
return a;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
static BuildTableBodyForLaborAndParts(Parts, Labor, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto) {
|
|
222
|
+
var body = [];
|
|
223
|
+
let columns = shared_print_service_1.PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
|
|
224
|
+
// if (ShowTaxColumn) {
|
|
225
|
+
for (let i = 0; i < columns.length; i++) {
|
|
226
|
+
body.push(columns[i]);
|
|
227
|
+
}
|
|
228
|
+
columns = columns[1];
|
|
229
|
+
// } else {
|
|
230
|
+
// body.push(columns);
|
|
231
|
+
// }
|
|
232
|
+
let DummyOps = [];
|
|
233
|
+
if (Parts.length !== 0) {
|
|
234
|
+
// console.log('Parts', Parts);
|
|
235
|
+
if (isAuto) {
|
|
236
|
+
let Qty = 0;
|
|
237
|
+
let CGSTAMT = 0;
|
|
238
|
+
let SGSTAMT = 0;
|
|
239
|
+
let IGSTAMT = 0;
|
|
240
|
+
let Taxable = 0;
|
|
241
|
+
let FinalTotal = 0;
|
|
242
|
+
Parts.forEach((part) => {
|
|
243
|
+
// console.log('part', part);
|
|
244
|
+
Qty = Qty + part.Qty;
|
|
245
|
+
CGSTAMT = CGSTAMT + part.CGSTAmt;
|
|
246
|
+
SGSTAMT = SGSTAMT + part.SGSTAmt;
|
|
247
|
+
IGSTAMT = IGSTAMT + part.IGSTAmt;
|
|
248
|
+
Taxable = Taxable + part.AfterPartDisc;
|
|
249
|
+
FinalTotal = FinalTotal + part.AfterPartTax;
|
|
250
|
+
});
|
|
251
|
+
let dpartadding1 = {};
|
|
252
|
+
dpartadding1.SNo = '';
|
|
253
|
+
dpartadding1.Desc = 'Medications Total';
|
|
254
|
+
dpartadding1.QtyAndUoM = tr_utils_1.TrUtils.FixedTo(Qty);
|
|
255
|
+
dpartadding1.bold = true;
|
|
256
|
+
dpartadding1.UnPr = tr_utils_1.TrUtils.FixedTo(Taxable);
|
|
257
|
+
dpartadding1.SGSTAmt = tr_utils_1.TrUtils.FixedTo(SGSTAMT);
|
|
258
|
+
dpartadding1.IGSTAmt = tr_utils_1.TrUtils.FixedTo(IGSTAMT);
|
|
259
|
+
dpartadding1.CGSTAmt = tr_utils_1.TrUtils.FixedTo(CGSTAMT);
|
|
260
|
+
dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
|
|
261
|
+
dpartadding1.LineTotal = tr_utils_1.TrUtils.FixPriceValue(FinalTotal);
|
|
262
|
+
Parts.push({ SNo: '' });
|
|
263
|
+
Parts.push(dpartadding1);
|
|
264
|
+
}
|
|
265
|
+
let dummypartadding1 = {};
|
|
266
|
+
dummypartadding1.SNo = '';
|
|
267
|
+
dummypartadding1.Desc = ' ';
|
|
268
|
+
dummypartadding1.Qty = '';
|
|
269
|
+
dummypartadding1.UnPr = '';
|
|
270
|
+
dummypartadding1.LineTotal = '';
|
|
271
|
+
// Parts.unshift(dummypartadding1);
|
|
272
|
+
}
|
|
273
|
+
let SNo = 1;
|
|
274
|
+
Parts.forEach((part) => {
|
|
275
|
+
var dataRow = [];
|
|
276
|
+
columns.forEach((column) => {
|
|
277
|
+
if ((!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]))
|
|
278
|
+
|| (column.text === 'Line Total')) {
|
|
279
|
+
// if (part[column.Field] === 'Medications') {
|
|
280
|
+
// dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
281
|
+
// } else {
|
|
282
|
+
if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
|
|
283
|
+
&& tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
|
|
284
|
+
part[column.Field] = '';
|
|
285
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'QtyAndUoM'
|
|
289
|
+
|| column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
|
|
290
|
+
|| column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
|
|
291
|
+
if (column.Field === 'Disc') {
|
|
292
|
+
if (column.type === 'percentage') {
|
|
293
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part[column.Field])) {
|
|
294
|
+
dataRow.push({ text: part[column.Field].toString(), noWrap: true });
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
dataRow.push({ text: '', noWrap: true });
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
if (!tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
302
|
+
dataRow.push({ text: part[column.Field].toString(), noWrap: true });
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
dataRow.push({ text: '', noWrap: true });
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
if (!tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
311
|
+
dataRow.push({ text: part[column.Field].toString(), bold: part.bold, alignment: 'right', nowrap: true });
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
dataRow.push({ text: '', noWrap: true });
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
// dataRow.push(part[column.Field].toString());
|
|
320
|
+
if (column.Field === 'Desc') {
|
|
321
|
+
let DescData = [];
|
|
322
|
+
DescData.push({ text: part[column.Field].toString(), bold: part.bold });
|
|
323
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
324
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
325
|
+
}
|
|
326
|
+
dataRow.push({ stack: DescData });
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// }
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
if (column.Field === 'SNo') {
|
|
337
|
+
part[column.Field] = SNo;
|
|
338
|
+
SNo = SNo + 1;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
if (tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
342
|
+
part[column.Field] = '';
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
body.push(dataRow);
|
|
349
|
+
});
|
|
350
|
+
SNo = 1;
|
|
351
|
+
if (Labor.length !== 0 && Parts.length !== 0) {
|
|
352
|
+
// let Qty: number = 0;
|
|
353
|
+
if (isAuto) {
|
|
354
|
+
let CGSTAMT = 0;
|
|
355
|
+
let SGSTAMT = 0;
|
|
356
|
+
let IGSTAMT = 0;
|
|
357
|
+
let Taxable = 0;
|
|
358
|
+
let FinalTotal = 0;
|
|
359
|
+
Labor.forEach((operation) => {
|
|
360
|
+
// console.log('operation', operation);
|
|
361
|
+
// Qty = Qty + operation.Qty;
|
|
362
|
+
CGSTAMT = CGSTAMT + operation.CGSTAmt;
|
|
363
|
+
SGSTAMT = SGSTAMT + operation.SGSTAmt;
|
|
364
|
+
IGSTAMT = IGSTAMT + operation.IGSTAmt;
|
|
365
|
+
Taxable = Taxable + operation.AfterLaborDisc;
|
|
366
|
+
FinalTotal = FinalTotal + operation.AfterLaborTax;
|
|
367
|
+
});
|
|
368
|
+
let dpartadding1 = {};
|
|
369
|
+
dpartadding1.SNo = '';
|
|
370
|
+
dpartadding1.Desc = 'Procedures Total';
|
|
371
|
+
// dpartadding1.QtyAndUoM = Qty;
|
|
372
|
+
dpartadding1.UnPr = tr_utils_1.TrUtils.FixedTo(Taxable);
|
|
373
|
+
dpartadding1.SGSTAmt = tr_utils_1.TrUtils.FixedTo(SGSTAMT);
|
|
374
|
+
dpartadding1.IGSTAmt = tr_utils_1.TrUtils.FixedTo(IGSTAMT);
|
|
375
|
+
dpartadding1.CGSTAmt = tr_utils_1.TrUtils.FixedTo(CGSTAMT);
|
|
376
|
+
dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
|
|
377
|
+
dpartadding1.bold = true;
|
|
378
|
+
dpartadding1.LineTotal = tr_utils_1.TrUtils.FixPriceValue(FinalTotal);
|
|
379
|
+
Labor.push({ SNo: '' });
|
|
380
|
+
Labor.push(dpartadding1);
|
|
381
|
+
}
|
|
382
|
+
let dummypartadding1 = {};
|
|
383
|
+
dummypartadding1.SNo = '';
|
|
384
|
+
dummypartadding1.Desc = ' ';
|
|
385
|
+
dummypartadding1.Qty = '';
|
|
386
|
+
dummypartadding1.UnPr = '';
|
|
387
|
+
dummypartadding1.LineTotal = '';
|
|
388
|
+
Labor.unshift(dummypartadding1);
|
|
389
|
+
// DummyOps.unshift(dummypartadding1);
|
|
390
|
+
}
|
|
391
|
+
if (Body === 2) {
|
|
392
|
+
for (let i = 0; i < Labor.length; i++) {
|
|
393
|
+
Labor[i].UnPr = '';
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
Labor.forEach((Ops) => {
|
|
397
|
+
var dataRow = [];
|
|
398
|
+
columns.forEach((column) => {
|
|
399
|
+
if ((!tr_utils_1.TrUtils.IsFixedZero(Ops[column.Field]) && !tr_utils_1.TrUtils.IsNull(Ops[column.Field]))
|
|
400
|
+
|| (column.text === 'Line Total')) {
|
|
401
|
+
if (Ops[column.Field] === 'Procedures') {
|
|
402
|
+
dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
|
|
406
|
+
&& tr_utils_1.TrUtils.CheckInvalidSelect(Ops.TCode))) {
|
|
407
|
+
Ops[column.Field] = '';
|
|
408
|
+
dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
|
|
412
|
+
|| column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
|
|
413
|
+
|| column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
|
|
414
|
+
if (column.Field === 'Disc') {
|
|
415
|
+
if (column.type === 'percentage') {
|
|
416
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Ops[column.Field])) {
|
|
417
|
+
dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
dataRow.push({ text: '', noWrap: true });
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
if (!tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
|
|
425
|
+
dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
dataRow.push({ text: '', noWrap: true });
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
if (!tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
|
|
434
|
+
dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true, bold: Ops.bold });
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
dataRow.push({ text: '', noWrap: true });
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
dataRow.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
if (column.Field === 'SNo') {
|
|
449
|
+
Ops[column.Field] = SNo;
|
|
450
|
+
SNo = SNo + 1;
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
if (tr_utils_1.TrUtils.IsNull(Ops[column.Field])) {
|
|
454
|
+
Ops[column.Field] = '';
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
body.push(dataRow);
|
|
461
|
+
});
|
|
462
|
+
return body;
|
|
463
|
+
}
|
|
464
|
+
static GetWithOutDiscAndTaxFieldHeader(Parts, Ops, ShowTaxColumn, PrintPartNo, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto) {
|
|
465
|
+
if (Parts.length !== 0 || Ops.length !== 0) {
|
|
466
|
+
if (ShowTaxColumn) {
|
|
467
|
+
return this.TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto);
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
if (ConsolidateGST) {
|
|
471
|
+
return this.ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
return this.NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
let a = '';
|
|
480
|
+
return a;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
static TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn) {
|
|
484
|
+
if (PrintPartNo) {
|
|
485
|
+
if (ShowIGST) {
|
|
486
|
+
if (ShowDiscountColumn) {
|
|
487
|
+
return [22, 50, 143, 35, 25, 40, 17, 35, 17, 35, 45];
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
return [22, 50, 207, 37, 25, 40, 17, 35, 51];
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
if (ShowDiscountColumn) {
|
|
495
|
+
return [22, 40, 90, 35, 22, 40, 17, 34, 17, 32, 17, 32, 48];
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
return [22, 50, 135, 40, 22, 40, 17, 32, 17, 32, 54];
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
if (ShowIGST) {
|
|
504
|
+
if (ShowDiscountColumn) {
|
|
505
|
+
return [22, 200, 40, 25, 40, 17, 35, 17, 35, 41];
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
return [22, 255, 40, 25, 40, 20, 40, 50];
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
if (ShowDiscountColumn) {
|
|
513
|
+
return [22, 135, 34, 22, 40, 17, 34, 17, 35, 17, 35, 45];
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
return [22, 195, 35, 22, 40, 17, 35, 17, 35, 50];
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
static TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto) {
|
|
522
|
+
if (PrintPartNo) {
|
|
523
|
+
if (ShowIGST) {
|
|
524
|
+
return {
|
|
525
|
+
style: 'tableExample',
|
|
526
|
+
table: {
|
|
527
|
+
widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
528
|
+
// headerRows: 2,
|
|
529
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
530
|
+
},
|
|
531
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
return {
|
|
536
|
+
style: 'tableExample',
|
|
537
|
+
table: {
|
|
538
|
+
widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
539
|
+
// headerRows: 2,
|
|
540
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
541
|
+
},
|
|
542
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
if (ShowIGST) {
|
|
548
|
+
return {
|
|
549
|
+
style: 'tableExample',
|
|
550
|
+
table: {
|
|
551
|
+
widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
552
|
+
// headerRows: 2,
|
|
553
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
554
|
+
},
|
|
555
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
return {
|
|
560
|
+
style: 'tableExample',
|
|
561
|
+
table: {
|
|
562
|
+
widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
|
|
563
|
+
// headerRows: 2,
|
|
564
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
565
|
+
},
|
|
566
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
static ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto) {
|
|
572
|
+
if (PrintPartNo) {
|
|
573
|
+
return {
|
|
574
|
+
style: 'tableExample',
|
|
575
|
+
table: {
|
|
576
|
+
widths: [25, 70, 263, 25, 60, 80, 10, 40],
|
|
577
|
+
// headerRows: 1,
|
|
578
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
579
|
+
},
|
|
580
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
return {
|
|
585
|
+
style: 'tableExample',
|
|
586
|
+
table: {
|
|
587
|
+
widths: [25, 295, 50, 80, 80, 10, 40],
|
|
588
|
+
// headerRows: 1,
|
|
589
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
590
|
+
},
|
|
591
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
static NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto) {
|
|
596
|
+
if (PrintPartNo) {
|
|
597
|
+
return {
|
|
598
|
+
style: 'tableExample',
|
|
599
|
+
table: {
|
|
600
|
+
widths: shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
|
|
601
|
+
// headerRows: 1,
|
|
602
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
603
|
+
},
|
|
604
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
return {
|
|
609
|
+
style: 'tableExample',
|
|
610
|
+
table: {
|
|
611
|
+
widths: shared_print_service_1.PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
|
|
612
|
+
// headerRows: 1,
|
|
613
|
+
body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto)
|
|
614
|
+
},
|
|
615
|
+
layout: shared_print_service_1.PrintSharedService.LayOutStyle1()
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
static buildTableForCustomerLabor(Parts, Ops, PrintPartNo, customerorInsurance) {
|
|
620
|
+
var body = [];
|
|
621
|
+
let columns;
|
|
622
|
+
columns = this.getSummaryHeaders(PrintPartNo);
|
|
623
|
+
body.push(columns);
|
|
624
|
+
if (Parts.length !== 0) {
|
|
625
|
+
let dummypartadding1 = {};
|
|
626
|
+
dummypartadding1.SNo = '';
|
|
627
|
+
dummypartadding1.Desc = ' ';
|
|
628
|
+
dummypartadding1.Qty = '';
|
|
629
|
+
dummypartadding1.UnPr = '';
|
|
630
|
+
dummypartadding1.Price = '';
|
|
631
|
+
dummypartadding1.DiscountedPrice = '';
|
|
632
|
+
dummypartadding1.LineTotal = '';
|
|
633
|
+
dummypartadding1.QtyAndUoM = '';
|
|
634
|
+
dummypartadding1.HSN = '';
|
|
635
|
+
dummypartadding1.MPN = '';
|
|
636
|
+
// Parts.unshift(dummypartadding1);
|
|
637
|
+
}
|
|
638
|
+
let SNo = 1;
|
|
639
|
+
Parts.forEach((part) => {
|
|
640
|
+
var dataRow = [];
|
|
641
|
+
columns.forEach((column) => {
|
|
642
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])
|
|
643
|
+
|| column.text === 'Line Total') {
|
|
644
|
+
// if (part[column.Field] === 'Medications') {
|
|
645
|
+
// dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
646
|
+
// } else {
|
|
647
|
+
// tslint:disable-next-line:max-line-length
|
|
648
|
+
if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
|
|
649
|
+
column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'UnPr') {
|
|
650
|
+
if (column.Field === 'Disc Amt') {
|
|
651
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
if (column.Field === 'Desc') {
|
|
659
|
+
let DescData = [];
|
|
660
|
+
DescData.push(part[column.Field].toString());
|
|
661
|
+
if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
|
|
662
|
+
DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
|
|
663
|
+
}
|
|
664
|
+
dataRow.push({ stack: DescData });
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
dataRow.push({ text: part[column.Field].toString() });
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
// }
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
if (column.Field === 'SNo') {
|
|
674
|
+
part[column.Field] = SNo;
|
|
675
|
+
SNo = SNo + 1;
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
if (tr_utils_1.TrUtils.IsNull(part[column.Field])) {
|
|
679
|
+
part[column.Field] = '';
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
body.push(dataRow);
|
|
686
|
+
});
|
|
687
|
+
SNo = 1;
|
|
688
|
+
if (Ops.length !== 0 && Parts.length !== 0) {
|
|
689
|
+
let dummypartadding1 = {};
|
|
690
|
+
dummypartadding1.SNo = '';
|
|
691
|
+
dummypartadding1.Desc = ' ';
|
|
692
|
+
dummypartadding1.Qty = '';
|
|
693
|
+
dummypartadding1.UnPr = '';
|
|
694
|
+
dummypartadding1.Price = '';
|
|
695
|
+
dummypartadding1.DiscountedPrice = '';
|
|
696
|
+
dummypartadding1.LineTotal = '';
|
|
697
|
+
dummypartadding1.QtyAndUoM = '';
|
|
698
|
+
dummypartadding1.HSN = '';
|
|
699
|
+
Ops.unshift(dummypartadding1);
|
|
700
|
+
}
|
|
701
|
+
Ops.forEach((labor) => {
|
|
702
|
+
var dataRow = [];
|
|
703
|
+
columns.forEach((column) => {
|
|
704
|
+
if (!tr_utils_1.TrUtils.IsFixedZero(labor[column.Field]) && !tr_utils_1.TrUtils.IsNull(labor[column.Field])
|
|
705
|
+
|| column.text === 'Line Total') {
|
|
706
|
+
if (labor[column.Field] === 'Procedures') {
|
|
707
|
+
dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
|
|
708
|
+
}
|
|
709
|
+
else {
|
|
710
|
+
if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount'
|
|
711
|
+
|| column.Field === 'UnPr' || column.Field === 'CustPrice' || column.Field === 'InsPrice') {
|
|
712
|
+
if (column.Field === 'Disc Amt') {
|
|
713
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
dataRow.push({ text: labor[column.Field].toString() });
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
if (column.Field === 'SNo') {
|
|
726
|
+
labor[column.Field] = SNo;
|
|
727
|
+
SNo = SNo + 1;
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
if (tr_utils_1.TrUtils.IsNull(labor[column.Field])) {
|
|
731
|
+
labor[column.Field] = '';
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
body.push(dataRow);
|
|
738
|
+
});
|
|
739
|
+
return body;
|
|
740
|
+
}
|
|
741
|
+
static getSummaryHeaders(permission) {
|
|
742
|
+
let headersNames = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
|
|
743
|
+
{ text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
|
|
744
|
+
{ text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
|
|
745
|
+
// { text: 'Rate / Unit', style: 'tableheader', Field: 'UnPr' },
|
|
746
|
+
{ text: 'Ins. Amt', style: 'tableheader', Field: 'AssPr' },
|
|
747
|
+
{ text: 'Cust. Amt', style: 'tableheader', Field: 'Pr' },
|
|
748
|
+
{ text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
|
|
749
|
+
{ text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
|
|
750
|
+
{ text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
|
|
751
|
+
if (permission) {
|
|
752
|
+
let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
|
|
753
|
+
let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
|
|
754
|
+
headersNames.unshift(sno, MPN);
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
|
|
758
|
+
headersNames.unshift(sno);
|
|
759
|
+
}
|
|
760
|
+
return headersNames;
|
|
761
|
+
}
|
|
762
|
+
static CommonTotalDetails(ROPrintData, index, numberofCopies, withPass, isAuto) {
|
|
763
|
+
// console.log('ROPrintData', ROPrintData);
|
|
764
|
+
let CommonDetails = [
|
|
765
|
+
shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails1(ROPrintData.CustLaborTotalAfterDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST, ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalAfterDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupDataByPerc, ROPrintData.ShowAccParts, ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax, ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, ROPrintData.Adj, ROPrintData.CustLaborTaxGroupDataByPerc, ROPrintData.STotal, isAuto),
|
|
766
|
+
this.GetNumberInWords(ROPrintData.CustRoundedTotal),
|
|
767
|
+
this.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale),
|
|
768
|
+
shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
|
|
769
|
+
shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
|
|
770
|
+
// SharedPDFService.GetUnderLine(),
|
|
771
|
+
shared_pdf_service_1.SharedPDFService.GetHCInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
|
|
772
|
+
// this.PageBrake(ROPrintData, withPass),
|
|
773
|
+
// SharedPDFService.GetUnderLine1(withPass),
|
|
774
|
+
// this.GetGatePass(withPass, ROPrintData)
|
|
775
|
+
];
|
|
776
|
+
if (ROPrintData.Type !== 'Invoice') {
|
|
777
|
+
CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine());
|
|
778
|
+
}
|
|
779
|
+
if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
|
|
780
|
+
CommonDetails.push({ text: '', pageBreak: 'after' });
|
|
781
|
+
}
|
|
782
|
+
return CommonDetails;
|
|
783
|
+
}
|
|
784
|
+
static InvoiceDueStatus(Type, Paid, Due, Status, isCounter) {
|
|
785
|
+
if (Type === 'Invoice' && !isCounter) {
|
|
786
|
+
return {
|
|
787
|
+
// lineHeight: 0.7,
|
|
788
|
+
fontSize: 9,
|
|
789
|
+
marginTop: 10,
|
|
790
|
+
marginBottom: 5,
|
|
791
|
+
table: {
|
|
792
|
+
widths: [187, 170, 170],
|
|
793
|
+
body: [[{ text: 'Paid : ' + Paid },
|
|
794
|
+
{ text: 'Due : ' + Due },
|
|
795
|
+
{ text: 'Status : ' + Status }]]
|
|
796
|
+
},
|
|
797
|
+
layout: shared_pdf_service_1.SharedPDFService.LayOutStyle(),
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
else {
|
|
801
|
+
return shared_pdf_service_1.SharedPDFService.emptyObject();
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
static GetNumberInWords(TotalAmount) {
|
|
805
|
+
var rupee = shared_pdf_service_1.SharedPDFService.convertNumberToWords(TotalAmount);
|
|
806
|
+
// console.log('rupee', rupee);
|
|
807
|
+
return { columns: [{ text: 'In Words :', fontSize: 7, width: 35 }, { text: rupee, bold: true, fontSize: 7, width: '*' }] };
|
|
808
|
+
}
|
|
809
|
+
static GetCustomerDetails(ROPrintData, isOtherIndustry) {
|
|
810
|
+
let CustomerData = [
|
|
811
|
+
{ name: 'Customer Name', value: ROPrintData.Customer.Name },
|
|
812
|
+
{ name: 'Service Advisor', value: ROPrintData.Name },
|
|
813
|
+
];
|
|
814
|
+
return shared_pdf_service_1.SharedPDFService.GetVehicleDataTable(CustomerData);
|
|
815
|
+
}
|
|
816
|
+
static GetVehicleDetails(Vehicle, isOtherIndustry) {
|
|
817
|
+
let vehicleData;
|
|
818
|
+
vehicleData = [];
|
|
819
|
+
if (isOtherIndustry) {
|
|
820
|
+
vehicleData.push({ name: 'Serial No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.SNo) });
|
|
821
|
+
}
|
|
822
|
+
let a = [
|
|
823
|
+
{ name: 'Vehicle Model', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.Model) },
|
|
824
|
+
];
|
|
825
|
+
if (!isOtherIndustry) {
|
|
826
|
+
a.unshift({ name: 'Regn. No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.RegNo) });
|
|
827
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Vehicle.VIN)) {
|
|
828
|
+
a.unshift({ name: 'Chassis No', value: shared_pdf_service_1.SharedPDFService.CheckAndSetString(Vehicle.VIN) });
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
for (let i = 0; i < a.length; i++) {
|
|
832
|
+
vehicleData.push(a[i]);
|
|
833
|
+
}
|
|
834
|
+
return shared_pdf_service_1.SharedPDFService.GetVehicleDataTable(vehicleData);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
exports.HCInvoiceprintService = HCInvoiceprintService;
|
|
@@ -206,6 +206,14 @@ class InvPrintService {
|
|
|
206
206
|
else {
|
|
207
207
|
Labor.UnPr = tr_utils_1.TrUtils.FixPriceValue(Labor.Pr);
|
|
208
208
|
}
|
|
209
|
+
Labor.TaxName = this.getTaxName(Labor.TCode, TaxCodes);
|
|
210
|
+
if (!tr_utils_1.TrUtils.IsEmpty(Labor.Perc)) {
|
|
211
|
+
Labor.DiscPerc = Labor.Perc;
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
Labor.DiscPerc = Labor.Perc;
|
|
215
|
+
Labor.DiscPerc = (0, aggregation_1.division)((0, aggregation_1.multiply)(100, Labor.Disc), Labor.UnPr);
|
|
216
|
+
}
|
|
209
217
|
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.CGST);
|
|
210
218
|
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.SGST);
|
|
211
219
|
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.IGST);
|
|
@@ -15,17 +15,16 @@ class InvoicePortraitPrintService {
|
|
|
15
15
|
info: {
|
|
16
16
|
title: 'TAX INVOICE',
|
|
17
17
|
},
|
|
18
|
+
background: function (currentPage, pageSize) {
|
|
19
|
+
return shared_pdf_service_1.SharedPDFService.GetWatermarkImage(InvoicePDFData.Image, pageSize, InvoicePDFData.Entity.Wmark);
|
|
20
|
+
},
|
|
18
21
|
header: function (currentPage, pageCount, pageSize) {
|
|
19
22
|
return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 25, fontSize: 8, marginTop: 2 };
|
|
20
23
|
},
|
|
21
24
|
pageMargins: this.GetMarginsBasedOnPaperSize(size),
|
|
22
25
|
pageSize: 'A4',
|
|
23
26
|
content: [
|
|
24
|
-
|
|
25
|
-
{ text: this.GetAddress(InvoicePDFData.Entity), alignment: 'center', style: ['headerstyle'] },
|
|
26
|
-
{
|
|
27
|
-
columns: this.GetHeaderInfo(InvoicePDFData)
|
|
28
|
-
},
|
|
27
|
+
this.GetMainHeaderInfo(InvoicePDFData),
|
|
29
28
|
{
|
|
30
29
|
style: 'tableExample',
|
|
31
30
|
table: {
|
|
@@ -88,6 +87,34 @@ class InvoicePortraitPrintService {
|
|
|
88
87
|
};
|
|
89
88
|
return dd;
|
|
90
89
|
}
|
|
90
|
+
static GetMainHeaderInfo(InvoicePDFData) {
|
|
91
|
+
if (!tr_utils_1.TrUtils.IsNull(InvoicePDFData.Image)) {
|
|
92
|
+
return {
|
|
93
|
+
columns: [{ image: InvoicePDFData.Image, width: 60, height: 60, marginBottom: 5 },
|
|
94
|
+
{
|
|
95
|
+
stack: [
|
|
96
|
+
{ text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'left', fontSize: 15 },
|
|
97
|
+
{ text: this.GetAddress(InvoicePDFData.Entity), alignment: 'left', style: ['headerstyle'] },
|
|
98
|
+
{
|
|
99
|
+
columns: this.GetHeaderInfo(InvoicePDFData, 0)
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
], columnGap: 10
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return {
|
|
108
|
+
stack: [
|
|
109
|
+
{ text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'center', fontSize: 15 },
|
|
110
|
+
{ text: this.GetAddress(InvoicePDFData.Entity), alignment: 'center', style: ['headerstyle'] },
|
|
111
|
+
{
|
|
112
|
+
columns: this.GetHeaderInfo(InvoicePDFData, 5)
|
|
113
|
+
},
|
|
114
|
+
]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
91
118
|
static GetCustomerAndBankDetails(InvoicePDFData) {
|
|
92
119
|
let CustDetails = [];
|
|
93
120
|
CustDetails.push([{
|
|
@@ -217,10 +244,10 @@ class InvoicePortraitPrintService {
|
|
|
217
244
|
},
|
|
218
245
|
};
|
|
219
246
|
}
|
|
220
|
-
static GetHeaderInfo(InvoicePDFData) {
|
|
247
|
+
static GetHeaderInfo(InvoicePDFData, marginleft) {
|
|
221
248
|
let TaxInfo = [];
|
|
222
249
|
if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
|
|
223
|
-
TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft:
|
|
250
|
+
TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: marginleft, alignment: 'left', fontSize: 9, width: 'auto' });
|
|
224
251
|
}
|
|
225
252
|
if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
|
|
226
253
|
TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' });
|
|
@@ -436,7 +463,7 @@ class InvoicePortraitPrintService {
|
|
|
436
463
|
body.push(dataRow);
|
|
437
464
|
}
|
|
438
465
|
Items.forEach((item, index) => {
|
|
439
|
-
var _a, _b;
|
|
466
|
+
var _a, _b, _c;
|
|
440
467
|
let dataRow = [];
|
|
441
468
|
dataRow.push({ text: index + 1, });
|
|
442
469
|
dataRow.push({ text: item.Desc, });
|
|
@@ -444,7 +471,7 @@ class InvoicePortraitPrintService {
|
|
|
444
471
|
dataRow.push({ text: item.HSN, alignment: 'center', style: ['headerstyle'], });
|
|
445
472
|
}
|
|
446
473
|
dataRow.push({ text: (_a = item.Batch) === null || _a === void 0 ? void 0 : _a.BN, alignment: 'center', style: ['headerstyle'], });
|
|
447
|
-
dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadableExDate(item['Batch'].ExDt), alignment: 'center', style: ['headerstyle'], });
|
|
474
|
+
dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadableExDate((_b = item['Batch']) === null || _b === void 0 ? void 0 : _b.ExDt), alignment: 'center', style: ['headerstyle'], });
|
|
448
475
|
dataRow.push({ text: item.QtyAndUoM, alignment: 'right', style: ['headerstyle'], });
|
|
449
476
|
dataRow.push({ text: item.OfQty, alignment: 'right', style: ['headerstyle'], });
|
|
450
477
|
dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(item.MRP), alignment: 'right', style: ['headerstyle'], });
|
|
@@ -458,7 +485,7 @@ class InvoicePortraitPrintService {
|
|
|
458
485
|
}
|
|
459
486
|
}
|
|
460
487
|
if (ShowTaxColumn && printOptions.ShowTax !== 'NO') {
|
|
461
|
-
let Tax = (
|
|
488
|
+
let Tax = (_c = item.TaxName) === null || _c === void 0 ? void 0 : _c.split('%');
|
|
462
489
|
dataRow.push({ text: tr_utils_1.TrUtils.IsNull(Tax) ? '' : Tax[0], alignment: 'right', style: ['headerstyle'], });
|
|
463
490
|
}
|
|
464
491
|
dataRow.push({ text: item.Ret ? '-' + tr_utils_1.TrUtils.FixPriceValue(item.LineTotal) : tr_utils_1.TrUtils.FixPriceValue(item.LineTotal), alignment: 'right', style: ['headerstyle'], });
|