shareneus 1.5.71 → 1.5.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/dist/purchases/bills/bill-pdf/bill-pdf.service.d.ts +96 -0
- package/dist/purchases/bills/bill-pdf/bill-pdf.service.js +158 -0
- package/dist/purchases/bills/bill-pdf.service.d.ts +1 -0
- package/dist/purchases/bills/bill-pdf.service.js +17 -0
- package/dist/shared/party-details-section/pdf-party-details.section.d.ts +22 -0
- package/dist/shared/party-details-section/pdf-party-details.section.js +132 -45
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ export { Add, Subtract, Multiply, Divide } from "./shared/math-operations";
|
|
|
136
136
|
export { ProductWithoutOwnerXlsxFileService } from "./common/reports/excel/product-without-owner-excel.service";
|
|
137
137
|
export { ProductWithoutOwnerPDFService } from "./common/reports/pdf/product-without-owner-pdf.service";
|
|
138
138
|
export { GetInvoicePDF } from "./accounting/invoice/invoice-pdf.service";
|
|
139
|
+
export { GetBillPDF } from "./purchases/bills/bill-pdf.service";
|
|
139
140
|
export { GetInvoicePrintInfo } from "./accounting/invoice/inv-print.service";
|
|
140
141
|
export { CreateReceiptPDFService } from "./accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service";
|
|
141
142
|
export { CreateInvoicePDFService } from "./accounting/invoice/invoice-pdf/invoice-pdf.service";
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
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.TaskPDfService = exports.PrintSharedService = 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.InsuranceExpirePDF = exports.ExpiringDrugPDFService = exports.EstPrintService = exports.EquipmentDesignPdf = exports.DeliveryChallanTotalsService = exports.DeliveryChallanPrintService = exports.DeliveryChallanPdfService = exports.DebitNoteTotalsService = exports.DebitNotePrintService = void 0;
|
|
5
|
-
exports.
|
|
6
|
-
exports.convertFlatToTaxes = exports.validateHSNSACLength = exports.validateTaxId = exports.roundAmount = exports.calculateWithholding = exports.findTaxCodeByRateAndSupplyType = exports.determineSupplyType = exports.computeTaxSummary = exports.sumTaxComponents = void 0;
|
|
5
|
+
exports.calculateLineTax = exports.CreateInvoicePDFService = exports.CreateReceiptPDFService = exports.GetInvoicePrintInfo = exports.GetBillPDF = exports.GetInvoicePDF = exports.ProductWithoutOwnerPDFService = exports.ProductWithoutOwnerXlsxFileService = exports.Divide = exports.Multiply = exports.Subtract = exports.Add = exports.ServiceHistoryPDFService = exports.SalesTotalCalculationsWithDecimals = exports.GetNumber = exports.GetAgeString = exports.IsNull = exports.IsNotNull = exports.GetServicePriceForPriceList = exports.ApplyServicePriceListToOpcode = exports.ApplyServicePriceListToProcedure = exports.CalcItemFinalSalePrice = exports.GetItemPriceForPriceList = exports.SalesReceiveTotalsService = exports.SalesReceivePrintService = exports.SalesReceivePdfService = exports.AdjustmentDrugPDFService = exports.HSNSummaryPDFService = exports.HSNSummaryExcelService = exports.ItemBarCodeLabelPdf = exports.NextServiceDatePDFService = exports.NextServiceDateXlsxFileService = exports.ConsultationLetterHeadPDFService = exports.InvoiceLetterheadPdfService = exports.InvoicePortraitPrintService = exports.HCInvoiceprintService = exports.InvoiceprintService = 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 = void 0;
|
|
6
|
+
exports.convertFlatToTaxes = exports.validateHSNSACLength = exports.validateTaxId = exports.roundAmount = exports.calculateWithholding = exports.findTaxCodeByRateAndSupplyType = exports.determineSupplyType = exports.computeTaxSummary = exports.sumTaxComponents = exports.extractNetFromInclusive = void 0;
|
|
7
7
|
var analysis_excel_service_1 = require("./accounting/invoice/reports/excel/analysis-excel.service");
|
|
8
8
|
Object.defineProperty(exports, "AnalysisXlsxFileService", { enumerable: true, get: function () { return analysis_excel_service_1.AnalysisXlsxFileService; } });
|
|
9
9
|
var category_wise_item_excel_service_1 = require("./accounting/invoice/reports/excel/category-wise-item-excel.service");
|
|
@@ -287,6 +287,8 @@ var product_without_owner_pdf_service_1 = require("./common/reports/pdf/product-
|
|
|
287
287
|
Object.defineProperty(exports, "ProductWithoutOwnerPDFService", { enumerable: true, get: function () { return product_without_owner_pdf_service_1.ProductWithoutOwnerPDFService; } });
|
|
288
288
|
var invoice_pdf_service_1 = require("./accounting/invoice/invoice-pdf.service");
|
|
289
289
|
Object.defineProperty(exports, "GetInvoicePDF", { enumerable: true, get: function () { return invoice_pdf_service_1.GetInvoicePDF; } });
|
|
290
|
+
var bill_pdf_service_1 = require("./purchases/bills/bill-pdf.service");
|
|
291
|
+
Object.defineProperty(exports, "GetBillPDF", { enumerable: true, get: function () { return bill_pdf_service_1.GetBillPDF; } });
|
|
290
292
|
var inv_print_service_1 = require("./accounting/invoice/inv-print.service");
|
|
291
293
|
Object.defineProperty(exports, "GetInvoicePrintInfo", { enumerable: true, get: function () { return inv_print_service_1.GetInvoicePrintInfo; } });
|
|
292
294
|
// new Receipt PDF and Print services
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export declare function CreateBillPDFService(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
|
|
2
|
+
footer?: ((_currentPage: number, pageCount: number) => {
|
|
3
|
+
margin: number[];
|
|
4
|
+
columns: {
|
|
5
|
+
text: string;
|
|
6
|
+
alignment: string;
|
|
7
|
+
fontSize: number;
|
|
8
|
+
color: string;
|
|
9
|
+
}[];
|
|
10
|
+
}) | undefined;
|
|
11
|
+
watermark?: {
|
|
12
|
+
text: string;
|
|
13
|
+
color: string;
|
|
14
|
+
opacity: number;
|
|
15
|
+
bold: boolean;
|
|
16
|
+
} | undefined;
|
|
17
|
+
background?: (() => {
|
|
18
|
+
image: string;
|
|
19
|
+
width: number;
|
|
20
|
+
opacity: number;
|
|
21
|
+
alignment: string;
|
|
22
|
+
margin: number[];
|
|
23
|
+
}) | undefined;
|
|
24
|
+
pageSize: string;
|
|
25
|
+
pageOrientation: "portrait" | "landscape";
|
|
26
|
+
pageMargins: [number, number, number, number];
|
|
27
|
+
content: any[];
|
|
28
|
+
info: {
|
|
29
|
+
title: string;
|
|
30
|
+
subject: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare function DownloadBillPDFService(filename?: string, PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
|
|
34
|
+
footer?: ((_currentPage: number, pageCount: number) => {
|
|
35
|
+
margin: number[];
|
|
36
|
+
columns: {
|
|
37
|
+
text: string;
|
|
38
|
+
alignment: string;
|
|
39
|
+
fontSize: number;
|
|
40
|
+
color: string;
|
|
41
|
+
}[];
|
|
42
|
+
}) | undefined;
|
|
43
|
+
watermark?: {
|
|
44
|
+
text: string;
|
|
45
|
+
color: string;
|
|
46
|
+
opacity: number;
|
|
47
|
+
bold: boolean;
|
|
48
|
+
} | undefined;
|
|
49
|
+
background?: (() => {
|
|
50
|
+
image: string;
|
|
51
|
+
width: number;
|
|
52
|
+
opacity: number;
|
|
53
|
+
alignment: string;
|
|
54
|
+
margin: number[];
|
|
55
|
+
}) | undefined;
|
|
56
|
+
pageSize: string;
|
|
57
|
+
pageOrientation: "portrait" | "landscape";
|
|
58
|
+
pageMargins: [number, number, number, number];
|
|
59
|
+
content: any[];
|
|
60
|
+
info: {
|
|
61
|
+
title: string;
|
|
62
|
+
subject: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export declare function GetBillPdfDataUrl(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
|
|
66
|
+
footer?: ((_currentPage: number, pageCount: number) => {
|
|
67
|
+
margin: number[];
|
|
68
|
+
columns: {
|
|
69
|
+
text: string;
|
|
70
|
+
alignment: string;
|
|
71
|
+
fontSize: number;
|
|
72
|
+
color: string;
|
|
73
|
+
}[];
|
|
74
|
+
}) | undefined;
|
|
75
|
+
watermark?: {
|
|
76
|
+
text: string;
|
|
77
|
+
color: string;
|
|
78
|
+
opacity: number;
|
|
79
|
+
bold: boolean;
|
|
80
|
+
} | undefined;
|
|
81
|
+
background?: (() => {
|
|
82
|
+
image: string;
|
|
83
|
+
width: number;
|
|
84
|
+
opacity: number;
|
|
85
|
+
alignment: string;
|
|
86
|
+
margin: number[];
|
|
87
|
+
}) | undefined;
|
|
88
|
+
pageSize: string;
|
|
89
|
+
pageOrientation: "portrait" | "landscape";
|
|
90
|
+
pageMargins: [number, number, number, number];
|
|
91
|
+
content: any[];
|
|
92
|
+
info: {
|
|
93
|
+
title: string;
|
|
94
|
+
subject: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateBillPDFService = CreateBillPDFService;
|
|
4
|
+
exports.DownloadBillPDFService = DownloadBillPDFService;
|
|
5
|
+
exports.GetBillPdfDataUrl = GetBillPdfDataUrl;
|
|
6
|
+
const pdf_party_details_section_1 = require("../../../shared/party-details-section/pdf-party-details.section");
|
|
7
|
+
const pdf_table_section_1 = require("../../../shared/table-section/pdf-table.section");
|
|
8
|
+
const pdf_totals_section_1 = require("../../../shared/totals-section/pdf-totals.section");
|
|
9
|
+
const pdf_shared_utils_1 = require("../../../shared/header-footer-section/pdf-shared.utils");
|
|
10
|
+
const pdf_header_footer_section_1 = require("../../../shared/header-footer-section/pdf-header-footer.section");
|
|
11
|
+
const PAGE_SIZE = 'A4';
|
|
12
|
+
const PAGE_MARGINS = [20, 20, 20, 20];
|
|
13
|
+
const CELL_PADDING_LEFT = 4;
|
|
14
|
+
const CELL_PADDING_RIGHT = 4;
|
|
15
|
+
const BORDER_WIDTH = 0.5;
|
|
16
|
+
const TABLE_BORDER_COLOR = '#d3d3d3';
|
|
17
|
+
function CreateBillPDFService(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
18
|
+
const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
|
|
19
|
+
// pdfMake.createPdf(dd).open();
|
|
20
|
+
return dd;
|
|
21
|
+
}
|
|
22
|
+
function DownloadBillPDFService(filename = 'bill.pdf', PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
23
|
+
const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
|
|
24
|
+
// pdfMake.createPdf(dd).download(filename);
|
|
25
|
+
return dd;
|
|
26
|
+
}
|
|
27
|
+
function GetBillPdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
28
|
+
const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
|
|
29
|
+
return dd;
|
|
30
|
+
// return new Promise((resolve, reject) => {
|
|
31
|
+
// let settled = false;
|
|
32
|
+
// const done = (value: string) => {
|
|
33
|
+
// if (!settled) {
|
|
34
|
+
// settled = true;
|
|
35
|
+
// resolve(value);
|
|
36
|
+
// }
|
|
37
|
+
// };
|
|
38
|
+
// const fail = (error: any) => {
|
|
39
|
+
// if (!settled) {
|
|
40
|
+
// settled = true;
|
|
41
|
+
// reject(error);
|
|
42
|
+
// }
|
|
43
|
+
// };
|
|
44
|
+
// try {
|
|
45
|
+
// if (typeof pdfDoc.getDataUrl === 'function') {
|
|
46
|
+
// const result = pdfDoc.getDataUrl((dataUrl: string) => done(dataUrl));
|
|
47
|
+
// if (result && typeof result.then === 'function') {
|
|
48
|
+
// result.then((dataUrl: string) => done(dataUrl)).catch(fail);
|
|
49
|
+
// }
|
|
50
|
+
// return;
|
|
51
|
+
// }
|
|
52
|
+
// if (typeof pdfDoc.getBlob === 'function') {
|
|
53
|
+
// const result = pdfDoc.getBlob((blob: Blob) => done(URL.createObjectURL(blob)));
|
|
54
|
+
// if (result && typeof result.then === 'function') {
|
|
55
|
+
// result.then((blob: Blob) => done(URL.createObjectURL(blob))).catch(fail);
|
|
56
|
+
// }
|
|
57
|
+
// return;
|
|
58
|
+
// }
|
|
59
|
+
// fail(new Error('No supported preview API found on pdf document instance.'));
|
|
60
|
+
// } catch (error) {
|
|
61
|
+
// fail(error);
|
|
62
|
+
// }
|
|
63
|
+
// });
|
|
64
|
+
}
|
|
65
|
+
function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
66
|
+
const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
|
|
67
|
+
const pageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
|
|
68
|
+
const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
|
|
69
|
+
const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(PAGE_SIZE, pageOrientation, pageMargins);
|
|
70
|
+
const copyLabels = normalizeCopyLabels(printCopies);
|
|
71
|
+
const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
|
|
72
|
+
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
|
|
73
|
+
const footer = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
|
|
74
|
+
const content = [];
|
|
75
|
+
copyLabels.forEach((copyLabel, index) => {
|
|
76
|
+
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
|
|
77
|
+
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
78
|
+
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildPurchasePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer);
|
|
79
|
+
const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth);
|
|
80
|
+
const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
|
|
81
|
+
const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
82
|
+
if (index > 0) {
|
|
83
|
+
content.push({ text: '', pageBreak: 'before' });
|
|
84
|
+
}
|
|
85
|
+
if (copyLabel) {
|
|
86
|
+
content.push({
|
|
87
|
+
text: copyLabel,
|
|
88
|
+
alignment: 'right',
|
|
89
|
+
bold: true,
|
|
90
|
+
fontSize: 8,
|
|
91
|
+
margin: [0, 0, 0, 2]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
content.push(...invoiceHeaderContent, ...invoiceHeadingContent, ...invoicePartyDetailsContent, {
|
|
95
|
+
table: {
|
|
96
|
+
lineHeight: 2,
|
|
97
|
+
headerRows: tableData.headerRows.length,
|
|
98
|
+
widths: tableData.widths,
|
|
99
|
+
body: tableData.body
|
|
100
|
+
},
|
|
101
|
+
layout: {
|
|
102
|
+
paddingLeft: () => CELL_PADDING_LEFT,
|
|
103
|
+
paddingRight: () => CELL_PADDING_RIGHT,
|
|
104
|
+
vLineWidth: () => BORDER_WIDTH,
|
|
105
|
+
hLineWidth: () => BORDER_WIDTH,
|
|
106
|
+
vLineColor: () => TABLE_BORDER_COLOR,
|
|
107
|
+
hLineColor: () => TABLE_BORDER_COLOR
|
|
108
|
+
}
|
|
109
|
+
}, ...invoiceTotalsAndNotesContent, ...signatureContent);
|
|
110
|
+
});
|
|
111
|
+
const dd = Object.assign(Object.assign(Object.assign({ pageSize: PAGE_SIZE, pageOrientation: pageOrientation, pageMargins: pageMargins, content: content, info: {
|
|
112
|
+
title: 'invoice',
|
|
113
|
+
subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
|
|
114
|
+
} }, (background ? { background } : {})), (watermark ? { watermark } : {})), (footer ? { footer } : {}));
|
|
115
|
+
return dd;
|
|
116
|
+
}
|
|
117
|
+
function normalizeCopyLabels(printCopies = []) {
|
|
118
|
+
const labels = Array.isArray(printCopies)
|
|
119
|
+
? printCopies
|
|
120
|
+
.map((entry) => (0, pdf_shared_utils_1.toStr)(entry).trim())
|
|
121
|
+
.filter((entry) => !!entry)
|
|
122
|
+
: [];
|
|
123
|
+
return labels.length > 0 ? labels : [''];
|
|
124
|
+
}
|
|
125
|
+
function normalizePrintConfig(PDFInvoiceData, PrintConfigData) {
|
|
126
|
+
var _a, _b, _c;
|
|
127
|
+
const config = PrintConfigData || {};
|
|
128
|
+
const itemsHeader = Array.isArray(config === null || config === void 0 ? void 0 : config.TableConfig) ? config.TableConfig : [];
|
|
129
|
+
const headerData = (config === null || config === void 0 ? void 0 : config.headerData) ? config.headerData : (0, pdf_header_footer_section_1.deriveHeaderDataFromInvoice)(PDFInvoiceData);
|
|
130
|
+
const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)((_a = config === null || config === void 0 ? void 0 : config.Margin) !== null && _a !== void 0 ? _a : PAGE_MARGINS);
|
|
131
|
+
const watermarkText = (0, pdf_shared_utils_1.toStr)(config === null || config === void 0 ? void 0 : config.WatermarkText);
|
|
132
|
+
const watermark = !!(config === null || config === void 0 ? void 0 : config.Watermark);
|
|
133
|
+
const watermarkEnabled = !!(config === null || config === void 0 ? void 0 : config.WatermarkEnabled);
|
|
134
|
+
const footerText = (0, pdf_shared_utils_1.toStr)((_b = config === null || config === void 0 ? void 0 : config.Footer) === null || _b === void 0 ? void 0 : _b.Text);
|
|
135
|
+
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((_c = config === null || config === void 0 ? void 0 : config.headerStyles) !== null && _c !== void 0 ? _c : {
|
|
136
|
+
OrgNameFsize: config === null || config === void 0 ? void 0 : config.OrgNameFsize,
|
|
137
|
+
OrgNameClr: config === null || config === void 0 ? void 0 : config.OrgNameClr,
|
|
138
|
+
AdrsFsize: config === null || config === void 0 ? void 0 : config.AdrsFsize,
|
|
139
|
+
AdrsClr: config === null || config === void 0 ? void 0 : config.AdrsClr
|
|
140
|
+
});
|
|
141
|
+
const fixedTo = normalizeFixedTo(config === null || config === void 0 ? void 0 : config.fixedTo);
|
|
142
|
+
return Object.assign(Object.assign({}, config), { itemsHeader,
|
|
143
|
+
headerData,
|
|
144
|
+
pageMargins,
|
|
145
|
+
watermarkText,
|
|
146
|
+
watermark,
|
|
147
|
+
watermarkEnabled,
|
|
148
|
+
footerText,
|
|
149
|
+
headerStyles,
|
|
150
|
+
fixedTo });
|
|
151
|
+
}
|
|
152
|
+
function normalizeFixedTo(value) {
|
|
153
|
+
const parsed = Number(value);
|
|
154
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
155
|
+
return 2;
|
|
156
|
+
}
|
|
157
|
+
return Math.floor(parsed);
|
|
158
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GetBillPDF(billData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any): any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetBillPDF = GetBillPDF;
|
|
4
|
+
const tr_utils_1 = require("../../utils/tr-utils");
|
|
5
|
+
const purchase_order_print_service_1 = require("../purchase-order/purchase-order-print.service");
|
|
6
|
+
const bill_pdf_service_1 = require("./bill-pdf/bill-pdf.service");
|
|
7
|
+
function GetBillPDF(billData, entityData, headerConfig, printConfig, taxCodes, image = null) {
|
|
8
|
+
const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
|
|
9
|
+
const invoicePrintData = purchase_order_print_service_1.PurchaseOrderPrintService.GetDataForPurchaseOrderPrint(billData, entityData, image, billData.BFrom, taxCodes, false);
|
|
10
|
+
let invPrint;
|
|
11
|
+
// if (options.ConsolidateGST || !options.ShowGST) {
|
|
12
|
+
// invPrint = GetInvoicePrint(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
|
|
13
|
+
// } else {
|
|
14
|
+
invPrint = (0, bill_pdf_service_1.CreateBillPDFService)(invoicePrintData, printConfigData);
|
|
15
|
+
// }
|
|
16
|
+
return invPrint;
|
|
17
|
+
}
|
|
@@ -9,3 +9,25 @@ export declare function buildInvoicePartyDetailsSection(PDFInvoiceData: any, cus
|
|
|
9
9
|
columnGap: number;
|
|
10
10
|
margin: number[];
|
|
11
11
|
}[];
|
|
12
|
+
export declare function buildSalesPartyDetailsSection(PDFInvoiceData: any, customerLayout: any): {
|
|
13
|
+
text: string;
|
|
14
|
+
margin: number[];
|
|
15
|
+
}[] | {
|
|
16
|
+
columns: {
|
|
17
|
+
width: string;
|
|
18
|
+
stack: any[];
|
|
19
|
+
}[];
|
|
20
|
+
columnGap: number;
|
|
21
|
+
margin: number[];
|
|
22
|
+
}[];
|
|
23
|
+
export declare function buildPurchasePartyDetailsSection(PDFInvoiceData: any, customerLayout: any): {
|
|
24
|
+
text: string;
|
|
25
|
+
margin: number[];
|
|
26
|
+
}[] | {
|
|
27
|
+
columns: {
|
|
28
|
+
width: string;
|
|
29
|
+
stack: any[];
|
|
30
|
+
}[];
|
|
31
|
+
columnGap: number;
|
|
32
|
+
margin: number[];
|
|
33
|
+
}[];
|
|
@@ -4,26 +4,68 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.buildInvoicePartyDetailsSection = buildInvoicePartyDetailsSection;
|
|
7
|
+
exports.buildSalesPartyDetailsSection = buildSalesPartyDetailsSection;
|
|
8
|
+
exports.buildPurchasePartyDetailsSection = buildPurchasePartyDetailsSection;
|
|
7
9
|
const jsbarcode_1 = __importDefault(require("jsbarcode"));
|
|
8
10
|
const pdf_shared_utils_1 = require("../header-footer-section/pdf-shared.utils");
|
|
9
11
|
function buildInvoicePartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
12
|
+
return buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout);
|
|
13
|
+
}
|
|
14
|
+
function buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
15
|
+
const transactionData = PDFInvoiceData || {};
|
|
16
|
+
const billTo = resolveSalesBillToDetails(transactionData);
|
|
17
|
+
const shipTo = resolveSalesShipToDetails(transactionData);
|
|
18
|
+
const insurance = resolveInsuranceDetails(transactionData);
|
|
14
19
|
const useInsurance = !!insurance.name;
|
|
15
20
|
const secondaryParty = useInsurance ? insurance : shipTo;
|
|
16
|
-
const showBarCode = resolveShowBarCode(
|
|
17
|
-
const billToCode = resolveBillToCode(
|
|
18
|
-
const otherDetails = resolveOtherDetails(
|
|
21
|
+
const showBarCode = resolveShowBarCode(transactionData);
|
|
22
|
+
const billToCode = resolveBillToCode(transactionData);
|
|
23
|
+
const otherDetails = resolveOtherDetails(transactionData);
|
|
19
24
|
const shouldShowSecondaryBarcode = !secondaryParty.hasData && showBarCode && !!billToCode;
|
|
20
|
-
const billToStack = billTo.hasData ? buildPartyStack('Bill To', billTo, customerLayout) : [{ text: '' }];
|
|
21
25
|
const secondaryTitle = useInsurance ? 'Insurance' : 'Ship To';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
return buildPartyDetailsSectionLayout({
|
|
27
|
+
primaryTitle: 'Bill To',
|
|
28
|
+
primaryParty: billTo,
|
|
29
|
+
secondaryTitle,
|
|
30
|
+
secondaryParty,
|
|
31
|
+
customerLayout,
|
|
32
|
+
otherDetails,
|
|
33
|
+
shouldShowSecondaryBarcode,
|
|
34
|
+
secondaryBarcodeCode: billToCode
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function buildPurchasePartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
38
|
+
const transactionData = PDFInvoiceData || {};
|
|
39
|
+
const billTo = resolvePurchaseBillToDetails(transactionData);
|
|
40
|
+
const shipFrom = resolvePurchaseShipFromDetails(transactionData);
|
|
41
|
+
const showBarCode = resolveShowBarCode(transactionData);
|
|
42
|
+
const billToCode = resolvePurchaseBillToCode(transactionData);
|
|
43
|
+
const otherDetails = resolveOtherDetails(transactionData);
|
|
44
|
+
const shouldShowSecondaryBarcode = !shipFrom.hasData && showBarCode && !!billToCode;
|
|
45
|
+
return buildPartyDetailsSectionLayout({
|
|
46
|
+
primaryTitle: 'Bill To',
|
|
47
|
+
primaryParty: billTo,
|
|
48
|
+
secondaryTitle: 'S From',
|
|
49
|
+
secondaryParty: shipFrom,
|
|
50
|
+
customerLayout,
|
|
51
|
+
otherDetails,
|
|
52
|
+
shouldShowSecondaryBarcode,
|
|
53
|
+
secondaryBarcodeCode: billToCode
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function buildPartyDetailsSectionLayout(config) {
|
|
57
|
+
var _a, _b, _c, _d, _e, _f;
|
|
58
|
+
const primaryStack = ((_a = config === null || config === void 0 ? void 0 : config.primaryParty) === null || _a === void 0 ? void 0 : _a.hasData)
|
|
59
|
+
? buildPartyStack(config.primaryTitle, config.primaryParty, config.customerLayout)
|
|
60
|
+
: [{ text: '' }];
|
|
61
|
+
const secondaryStack = ((_b = config === null || config === void 0 ? void 0 : config.secondaryParty) === null || _b === void 0 ? void 0 : _b.hasData)
|
|
62
|
+
? buildPartyStack(config.secondaryTitle, config.secondaryParty, config.customerLayout)
|
|
63
|
+
: ((config === null || config === void 0 ? void 0 : config.shouldShowSecondaryBarcode) ? buildBarcodeStack(config === null || config === void 0 ? void 0 : config.secondaryBarcodeCode) : [{ text: '' }]);
|
|
64
|
+
const otherDetailsStack = ((_c = config === null || config === void 0 ? void 0 : config.otherDetails) === null || _c === void 0 ? void 0 : _c.hasData) ? buildOtherDetailsStack(config.otherDetails) : [{ text: '' }];
|
|
65
|
+
const hasAnyData = ((_d = config === null || config === void 0 ? void 0 : config.primaryParty) === null || _d === void 0 ? void 0 : _d.hasData)
|
|
66
|
+
|| ((_e = config === null || config === void 0 ? void 0 : config.secondaryParty) === null || _e === void 0 ? void 0 : _e.hasData)
|
|
67
|
+
|| (config === null || config === void 0 ? void 0 : config.shouldShowSecondaryBarcode)
|
|
68
|
+
|| ((_f = config === null || config === void 0 ? void 0 : config.otherDetails) === null || _f === void 0 ? void 0 : _f.hasData);
|
|
27
69
|
if (!hasAnyData) {
|
|
28
70
|
return [{
|
|
29
71
|
text: '',
|
|
@@ -32,7 +74,7 @@ function buildInvoicePartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
|
32
74
|
}
|
|
33
75
|
return [{
|
|
34
76
|
columns: [
|
|
35
|
-
{ width: '*', stack:
|
|
77
|
+
{ width: '*', stack: primaryStack },
|
|
36
78
|
{ width: '*', stack: secondaryStack },
|
|
37
79
|
{ width: '*', stack: otherDetailsStack }
|
|
38
80
|
],
|
|
@@ -40,23 +82,23 @@ function buildInvoicePartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
|
40
82
|
margin: [0, 0, 0, 10]
|
|
41
83
|
}];
|
|
42
84
|
}
|
|
43
|
-
function
|
|
85
|
+
function resolveSalesBillToDetails(transactionData) {
|
|
44
86
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
|
-
const billTo = (
|
|
87
|
+
const billTo = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Customer) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Cust) || {};
|
|
46
88
|
const address = normalizeAddress((billTo === null || billTo === void 0 ? void 0 : billTo.Adrs)
|
|
47
|
-
|| ((_a =
|
|
48
|
-
|| (
|
|
49
|
-
|| (
|
|
50
|
-
|| ((_b =
|
|
51
|
-
|| ((_c =
|
|
52
|
-
const name = (0, pdf_shared_utils_1.firstValue)(billTo === null || billTo === void 0 ? void 0 : billTo.Name, billTo === null || billTo === void 0 ? void 0 : billTo.CName, (_d =
|
|
89
|
+
|| ((_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _a === void 0 ? void 0 : _a.Adrs)
|
|
90
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillAddress)
|
|
91
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillToAddress)
|
|
92
|
+
|| ((_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Customer) === null || _b === void 0 ? void 0 : _b.Adrs)
|
|
93
|
+
|| ((_c = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Cust) === null || _c === void 0 ? void 0 : _c.Adrs));
|
|
94
|
+
const name = (0, pdf_shared_utils_1.firstValue)(billTo === null || billTo === void 0 ? void 0 : billTo.Name, billTo === null || billTo === void 0 ? void 0 : billTo.CName, (_d = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _d === void 0 ? void 0 : _d.Name, (_e = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Customer) === null || _e === void 0 ? void 0 : _e.Name, (_f = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Cust) === null || _f === void 0 ? void 0 : _f.Name, transactionData === null || transactionData === void 0 ? void 0 : transactionData.CustomerName);
|
|
53
95
|
const gstin = (0, pdf_shared_utils_1.firstValue)(billTo === null || billTo === void 0 ? void 0 : billTo.GSTIN, billTo === null || billTo === void 0 ? void 0 : billTo.GSTNo);
|
|
54
96
|
const contactInfo = resolvePhoneFromContacts(billTo === null || billTo === void 0 ? void 0 : billTo.Cons);
|
|
55
97
|
const directPhone = (0, pdf_shared_utils_1.firstValue)(billTo === null || billTo === void 0 ? void 0 : billTo.Ph, billTo === null || billTo === void 0 ? void 0 : billTo.Phone, billTo === null || billTo === void 0 ? void 0 : billTo.Mobile);
|
|
56
|
-
const ownerName = (0, pdf_shared_utils_1.firstValue)((_g =
|
|
98
|
+
const ownerName = (0, pdf_shared_utils_1.firstValue)((_g = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Cust) === null || _g === void 0 ? void 0 : _g.Name);
|
|
57
99
|
return {
|
|
58
100
|
name,
|
|
59
|
-
addressLines:
|
|
101
|
+
addressLines: buildAddressLines(address),
|
|
60
102
|
gstin,
|
|
61
103
|
phoneType: contactInfo.type,
|
|
62
104
|
phoneNumber: contactInfo.number || directPhone,
|
|
@@ -64,11 +106,11 @@ function resolveBillToDetails(invoiceData) {
|
|
|
64
106
|
hasData: !!(name || gstin || contactInfo.number || directPhone || hasAddress(address))
|
|
65
107
|
};
|
|
66
108
|
}
|
|
67
|
-
function
|
|
68
|
-
const shipTo = (
|
|
109
|
+
function resolveSalesShipToDetails(transactionData) {
|
|
110
|
+
const shipTo = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipTo) || {};
|
|
69
111
|
const address = normalizeAddress((shipTo === null || shipTo === void 0 ? void 0 : shipTo.Adrs)
|
|
70
|
-
|| (
|
|
71
|
-
|| (
|
|
112
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipAddress)
|
|
113
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipToAddress));
|
|
72
114
|
const name = (0, pdf_shared_utils_1.firstValue)(shipTo === null || shipTo === void 0 ? void 0 : shipTo.Name, shipTo === null || shipTo === void 0 ? void 0 : shipTo.CName);
|
|
73
115
|
const gstin = (0, pdf_shared_utils_1.firstValue)(shipTo === null || shipTo === void 0 ? void 0 : shipTo.GSTIN, shipTo === null || shipTo === void 0 ? void 0 : shipTo.GSTNo);
|
|
74
116
|
return {
|
|
@@ -78,8 +120,49 @@ function resolveShipToDetails(invoiceData) {
|
|
|
78
120
|
hasData: !!(name || gstin || hasAddress(address))
|
|
79
121
|
};
|
|
80
122
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
123
|
+
function resolvePurchaseBillToDetails(transactionData) {
|
|
124
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
125
|
+
const billTo = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BFrom) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vendor) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vnd) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Supplier) || {};
|
|
126
|
+
const address = normalizeAddress((billTo === null || billTo === void 0 ? void 0 : billTo.Adrs)
|
|
127
|
+
|| ((_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BFrom) === null || _a === void 0 ? void 0 : _a.Adrs)
|
|
128
|
+
|| ((_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _b === void 0 ? void 0 : _b.Adrs)
|
|
129
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BFromAddress)
|
|
130
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillAddress)
|
|
131
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillToAddress)
|
|
132
|
+
|| ((_c = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vendor) === null || _c === void 0 ? void 0 : _c.Adrs)
|
|
133
|
+
|| ((_d = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vnd) === null || _d === void 0 ? void 0 : _d.Adrs)
|
|
134
|
+
|| ((_e = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Supplier) === null || _e === void 0 ? void 0 : _e.Adrs));
|
|
135
|
+
const name = (0, pdf_shared_utils_1.firstValue)(billTo === null || billTo === void 0 ? void 0 : billTo.Name, billTo === null || billTo === void 0 ? void 0 : billTo.CName, (_f = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BFrom) === null || _f === void 0 ? void 0 : _f.Name, (_g = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _g === void 0 ? void 0 : _g.Name, (_h = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vendor) === null || _h === void 0 ? void 0 : _h.Name, (_j = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vnd) === null || _j === void 0 ? void 0 : _j.Name, (_k = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Supplier) === null || _k === void 0 ? void 0 : _k.Name, transactionData === null || transactionData === void 0 ? void 0 : transactionData.BFromName, transactionData === null || transactionData === void 0 ? void 0 : transactionData.VendorName);
|
|
136
|
+
const gstin = (0, pdf_shared_utils_1.firstValue)(billTo === null || billTo === void 0 ? void 0 : billTo.GSTIN, billTo === null || billTo === void 0 ? void 0 : billTo.GSTNo);
|
|
137
|
+
const contactInfo = resolvePhoneFromContacts(billTo === null || billTo === void 0 ? void 0 : billTo.Cons);
|
|
138
|
+
const directPhone = (0, pdf_shared_utils_1.firstValue)(billTo === null || billTo === void 0 ? void 0 : billTo.Ph, billTo === null || billTo === void 0 ? void 0 : billTo.Phone, billTo === null || billTo === void 0 ? void 0 : billTo.Mobile);
|
|
139
|
+
return {
|
|
140
|
+
name,
|
|
141
|
+
addressLines: buildAddressLines(address),
|
|
142
|
+
gstin,
|
|
143
|
+
phoneType: contactInfo.type,
|
|
144
|
+
phoneNumber: contactInfo.number || directPhone,
|
|
145
|
+
ownerName: '',
|
|
146
|
+
hasData: !!(name || gstin || contactInfo.number || directPhone || hasAddress(address))
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function resolvePurchaseShipFromDetails(transactionData) {
|
|
150
|
+
const shipFrom = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.SFrom) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipFrom) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.From) || {};
|
|
151
|
+
const address = normalizeAddress((shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.Adrs)
|
|
152
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.SFromAddress)
|
|
153
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipFromAddress)
|
|
154
|
+
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.FromAddress));
|
|
155
|
+
const name = (0, pdf_shared_utils_1.firstValue)(shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.Name, shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.CName, shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.WhName, transactionData === null || transactionData === void 0 ? void 0 : transactionData.SFromName, transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipFromName);
|
|
156
|
+
const gstin = (0, pdf_shared_utils_1.firstValue)(shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.GSTIN, shipFrom === null || shipFrom === void 0 ? void 0 : shipFrom.GSTNo);
|
|
157
|
+
return {
|
|
158
|
+
name,
|
|
159
|
+
addressLines: buildAddressLines(address),
|
|
160
|
+
gstin,
|
|
161
|
+
hasData: !!(name || gstin || hasAddress(address))
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function resolveInsuranceDetails(transactionData) {
|
|
165
|
+
const insurance = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Insurance) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Ins) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.Insurer) || {};
|
|
83
166
|
const address = normalizeAddress((insurance === null || insurance === void 0 ? void 0 : insurance.Adrs) || (insurance === null || insurance === void 0 ? void 0 : insurance.Address));
|
|
84
167
|
const name = (0, pdf_shared_utils_1.firstValue)(insurance === null || insurance === void 0 ? void 0 : insurance.Name, insurance === null || insurance === void 0 ? void 0 : insurance.Company, insurance === null || insurance === void 0 ? void 0 : insurance.Provider, insurance === null || insurance === void 0 ? void 0 : insurance.InsName);
|
|
85
168
|
const gstin = (0, pdf_shared_utils_1.firstValue)(insurance === null || insurance === void 0 ? void 0 : insurance.GSTIN, insurance === null || insurance === void 0 ? void 0 : insurance.GSTNo);
|
|
@@ -90,23 +173,23 @@ function resolveInsuranceDetails(invoiceData) {
|
|
|
90
173
|
hasData: !!(name || gstin || hasAddress(address))
|
|
91
174
|
};
|
|
92
175
|
}
|
|
93
|
-
function resolveOtherDetails(
|
|
176
|
+
function resolveOtherDetails(transactionData) {
|
|
94
177
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
95
|
-
const invoiceDate = (0, pdf_shared_utils_1.firstValue)(
|
|
96
|
-
const invoiceNumber = (0, pdf_shared_utils_1.firstValue)(
|
|
178
|
+
const invoiceDate = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.DDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvDt, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Date, transactionData === null || transactionData === void 0 ? void 0 : transactionData.CrDate);
|
|
179
|
+
const invoiceNumber = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData._id, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Code, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvNo, transactionData === null || transactionData === void 0 ? void 0 : transactionData.No);
|
|
97
180
|
const productName = [
|
|
98
|
-
(_a =
|
|
99
|
-
(_b =
|
|
100
|
-
(_c =
|
|
181
|
+
(_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _a === void 0 ? void 0 : _a.Make,
|
|
182
|
+
(_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _b === void 0 ? void 0 : _b.Model,
|
|
183
|
+
(_c = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _c === void 0 ? void 0 : _c.Var
|
|
101
184
|
]
|
|
102
185
|
.map((value) => String(value !== null && value !== void 0 ? value : '').trim())
|
|
103
186
|
.filter((value) => !!value)
|
|
104
187
|
.join(' ');
|
|
105
|
-
const vehicleDetails = (0, pdf_shared_utils_1.firstValue)(productName,
|
|
106
|
-
const Milage = (0, pdf_shared_utils_1.firstValue)(
|
|
107
|
-
const RegnNo = (_g =
|
|
108
|
-
const EngNo = (_h =
|
|
109
|
-
const ChassisNo = (_j =
|
|
188
|
+
const vehicleDetails = (0, pdf_shared_utils_1.firstValue)(productName, transactionData === null || transactionData === void 0 ? void 0 : transactionData.VehNo, transactionData === null || transactionData === void 0 ? void 0 : transactionData.VehicleNo, (_d = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vehicle) === null || _d === void 0 ? void 0 : _d.RegNo, (_e = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vehicle) === null || _e === void 0 ? void 0 : _e.No, (_f = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vehicle) === null || _f === void 0 ? void 0 : _f.Details, transactionData === null || transactionData === void 0 ? void 0 : transactionData.VehicleDetails);
|
|
189
|
+
const Milage = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.MIn, transactionData === null || transactionData === void 0 ? void 0 : transactionData.MOut, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Milage);
|
|
190
|
+
const RegnNo = (_g = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _g === void 0 ? void 0 : _g.RegNo;
|
|
191
|
+
const EngNo = (_h = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _h === void 0 ? void 0 : _h.EngNo;
|
|
192
|
+
const ChassisNo = (_j = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _j === void 0 ? void 0 : _j.VIN;
|
|
110
193
|
const lines = [
|
|
111
194
|
{ label: 'Invoice#', value: invoiceNumber },
|
|
112
195
|
{ label: 'Date', value: invoiceDate ? formatDisplayDate(invoiceDate) : '' },
|
|
@@ -277,13 +360,17 @@ function formatDisplayDate(value) {
|
|
|
277
360
|
}
|
|
278
361
|
return value;
|
|
279
362
|
}
|
|
280
|
-
function resolveShowBarCode(
|
|
363
|
+
function resolveShowBarCode(transactionData) {
|
|
281
364
|
var _a;
|
|
282
|
-
return isTruthy(
|
|
365
|
+
return isTruthy(transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShowBarCode) || isTruthy((_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Entity) === null || _a === void 0 ? void 0 : _a.PrCustBar) || isTruthy(transactionData === null || transactionData === void 0 ? void 0 : transactionData.PrCustBar);
|
|
283
366
|
}
|
|
284
|
-
function resolveBillToCode(
|
|
367
|
+
function resolveBillToCode(transactionData) {
|
|
285
368
|
var _a, _b, _c;
|
|
286
|
-
return (0, pdf_shared_utils_1.firstValue)((_a =
|
|
369
|
+
return (0, pdf_shared_utils_1.firstValue)((_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _a === void 0 ? void 0 : _a.Code, (_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Customer) === null || _b === void 0 ? void 0 : _b.Code, (_c = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Cust) === null || _c === void 0 ? void 0 : _c.Code);
|
|
370
|
+
}
|
|
371
|
+
function resolvePurchaseBillToCode(transactionData) {
|
|
372
|
+
var _a, _b, _c, _d, _e;
|
|
373
|
+
return (0, pdf_shared_utils_1.firstValue)((_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BFrom) === null || _a === void 0 ? void 0 : _a.Code, (_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _b === void 0 ? void 0 : _b.Code, (_c = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vendor) === null || _c === void 0 ? void 0 : _c.Code, (_d = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vnd) === null || _d === void 0 ? void 0 : _d.Code, (_e = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Supplier) === null || _e === void 0 ? void 0 : _e.Code);
|
|
287
374
|
}
|
|
288
375
|
function isTruthy(value) {
|
|
289
376
|
if (typeof value === 'boolean') {
|