shareneus 1.2.0 → 1.2.2

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
@@ -1,8 +1,8 @@
1
1
  "use strict";
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
- 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.HCInvoiceprintService = 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 = exports.SharedPDFService = void 0;
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;
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");
@@ -119,8 +119,6 @@ var est_print_service_1 = require("./services/est.print-service");
119
119
  Object.defineProperty(exports, "EstPrintService", { enumerable: true, get: function () { return est_print_service_1.EstPrintService; } });
120
120
  var expiring_drugs_pdf_service_1 = require("./services/expiring-drugs-pdf.service");
121
121
  Object.defineProperty(exports, "ExpiringDrugPDFService", { enumerable: true, get: function () { return expiring_drugs_pdf_service_1.ExpiringDrugPDFService; } });
122
- var hc_inv_pdf_service_1 = require("./services/hc-inv-pdf.service");
123
- Object.defineProperty(exports, "HCInvoiceprintService", { enumerable: true, get: function () { return hc_inv_pdf_service_1.HCInvoiceprintService; } });
124
122
  var insurance_expire_pdf_service_1 = require("./services/insurance-expire-pdf.service");
125
123
  Object.defineProperty(exports, "InsuranceExpirePDF", { enumerable: true, get: function () { return insurance_expire_pdf_service_1.InsuranceExpirePDF; } });
126
124
  var inv_pdf_service_1 = require("./services/inv-pdf.service");
@@ -103,54 +103,54 @@ class ConsultationPDFService {
103
103
  return Sec;
104
104
  }
105
105
  static GetWeight(CnstData) {
106
- var _a, _b;
107
- if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Weight)) {
108
- return { text: 'Weight :' + ((_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Weight) + ' kg', Width: 80 };
106
+ var _a, _b, _c, _d, _e;
107
+ if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Weight) && !tr_utils_1.TrUtils.IsNull((_c = (_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Weight) === null || _c === void 0 ? void 0 : _c.V)) {
108
+ return { text: 'Weight :' + ((_e = (_d = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _d === void 0 ? void 0 : _d.Weight) === null || _e === void 0 ? void 0 : _e.V) + ' kg', Width: 80 };
109
109
  }
110
110
  else {
111
111
  return { text: 'Weight :', Width: 80 };
112
112
  }
113
113
  }
114
114
  static GetTemperature(CnstData) {
115
- var _a, _b;
116
- if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Temp)) {
117
- return { text: 'Temperature :' + ((_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Temp) + ' F', Width: 80 };
115
+ var _a, _b, _c, _d, _e;
116
+ if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Temp) && !tr_utils_1.TrUtils.IsNull((_c = (_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Temp) === null || _c === void 0 ? void 0 : _c.V)) {
117
+ return { text: 'Temperature :' + ((_e = (_d = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _d === void 0 ? void 0 : _d.Temp) === null || _e === void 0 ? void 0 : _e.V) + ' F', Width: 80 };
118
118
  }
119
119
  else {
120
120
  return { text: 'Temperature :', Width: 80 };
121
121
  }
122
122
  }
123
123
  static GetSPO2(CnstData) {
124
- var _a, _b;
125
- if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.SPO2)) {
126
- return { text: 'SPO2 :' + ((_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.SPO2) + ' mmHg', Width: 80 };
124
+ var _a, _b, _c, _d, _e;
125
+ if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.SPO2) && !tr_utils_1.TrUtils.IsNull((_c = (_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.SPO2) === null || _c === void 0 ? void 0 : _c.V)) {
126
+ return { text: 'SPO2 :' + ((_e = (_d = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _d === void 0 ? void 0 : _d.SPO2) === null || _e === void 0 ? void 0 : _e.V) + ' mmHg', Width: 80 };
127
127
  }
128
128
  else {
129
129
  return { text: 'SPO2 :', Width: 80 };
130
130
  }
131
131
  }
132
132
  static GetPulse(CnstData) {
133
- var _a, _b;
134
- if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Pulse)) {
135
- return { text: 'Pulse :' + ((_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Pulse) + ' bpm', Width: 80 };
133
+ var _a, _b, _c, _d, _e;
134
+ if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Pulse) && !tr_utils_1.TrUtils.IsNull((_c = (_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Pulse) === null || _c === void 0 ? void 0 : _c.V)) {
135
+ return { text: 'Pulse :' + ((_e = (_d = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _d === void 0 ? void 0 : _d.Pulse) === null || _e === void 0 ? void 0 : _e.V) + ' bpm', Width: 80 };
136
136
  }
137
137
  else {
138
138
  return { text: 'Pulse :', Width: 80 };
139
139
  }
140
140
  }
141
141
  static GetHeight(CnstData) {
142
- var _a, _b;
143
- if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Height)) {
144
- return { text: 'Height :' + ((_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Height) + ' cm', Width: 80 };
142
+ var _a, _b, _c, _d, _e, _f, _g;
143
+ if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.Height) && !tr_utils_1.TrUtils.IsNull((_c = (_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Height) === null || _c === void 0 ? void 0 : _c.V)) {
144
+ return { text: 'Height :' + ((_e = (_d = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _d === void 0 ? void 0 : _d.Height) === null || _e === void 0 ? void 0 : _e.V) + ' ' + ((_g = (_f = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _f === void 0 ? void 0 : _f.Height) === null || _g === void 0 ? void 0 : _g.U), Width: 80 };
145
145
  }
146
146
  else {
147
147
  return { text: 'Height :', Width: 80 };
148
148
  }
149
149
  }
150
150
  static GetBP(CnstData) {
151
- var _a, _b;
152
- if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.BP)) {
153
- return { text: 'BP :' + ((_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.BP) + ' mmHg', Width: 80 };
151
+ var _a, _b, _c, _d, _e;
152
+ if (!tr_utils_1.TrUtils.IsNull((_a = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _a === void 0 ? void 0 : _a.BP) && !tr_utils_1.TrUtils.IsNull((_c = (_b = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _b === void 0 ? void 0 : _b.Height) === null || _c === void 0 ? void 0 : _c.U)) {
153
+ return { text: 'BP :' + ((_e = (_d = CnstData === null || CnstData === void 0 ? void 0 : CnstData.Vitals) === null || _d === void 0 ? void 0 : _d.BP) === null || _e === void 0 ? void 0 : _e.V) + ' mmHg', Width: 80 };
154
154
  }
155
155
  else {
156
156
  return { text: 'BP :', Width: 80 };
@@ -13,7 +13,7 @@ class InvoicePortraitPrintService {
13
13
  }
14
14
  let dd = {
15
15
  info: {
16
- title: 'CounterSale',
16
+ title: 'TAX INVOICE',
17
17
  },
18
18
  header: function (currentPage, pageCount, pageSize) {
19
19
  return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 25, fontSize: 8, marginTop: 2 };
@@ -36,7 +36,15 @@ class InvoicePortraitPrintService {
36
36
  },
37
37
  this.GetItemsTable(InvoicePDFData.Items, InvoicePDFData.ShowTaxColumn, InvoicePDFData.Settings.PoS.SType, printOptions, size),
38
38
  [this.TotalDetails(InvoicePDFData)],
39
- this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.CustRoundedTotal),
39
+ {
40
+ style: 'tableExample',
41
+ table: {
42
+ widths: ['*', 'auto'],
43
+ body: this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.CustRoundedTotal)
44
+ },
45
+ layout: 'noBorders'
46
+ },
47
+ // this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.CustRoundedTotal),
40
48
  ],
41
49
  styles: {
42
50
  headerstyle: {
@@ -277,14 +285,17 @@ class InvoicePortraitPrintService {
277
285
  ]
278
286
  };
279
287
  }
288
+ // static GetSignatures(CName: any, Total:any) {
289
+ // return {
290
+ // columns: [{
291
+ // stack: [
292
+ // { columns: [this.GetNumberInWords(Total), this.CompanyName(CName)] }
293
+ // ]
294
+ // }],
295
+ // };
296
+ // }
280
297
  static GetSignatures(CName, Total) {
281
- return {
282
- columns: [{
283
- stack: [
284
- { columns: [this.GetNumberInWords(Total), '', this.CompanyName(CName)] }
285
- ]
286
- }],
287
- };
298
+ return [[this.GetNumberInWords(Total), this.CompanyName(CName)]];
288
299
  }
289
300
  static CompanyName(CName) {
290
301
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,837 +0,0 @@
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;