shareneus 1.6.52 → 1.6.54
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.
|
@@ -12,9 +12,10 @@ const inv_print_service_1 = require("./inv-print.service");
|
|
|
12
12
|
const invoice_pdf_service_1 = require("./invoice-pdf/invoice-pdf.service");
|
|
13
13
|
const unified_invoice_pdf_service_1 = require("./unified-invoice-pdf.service");
|
|
14
14
|
function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], withPass = false, options = null) {
|
|
15
|
+
var _a;
|
|
15
16
|
if (!options) {
|
|
16
17
|
options = {
|
|
17
|
-
ShowGST: true,
|
|
18
|
+
ShowGST: (((_a = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Settings) === null || _a === void 0 ? void 0 : _a.Tax) === 'TI') ? true : false,
|
|
18
19
|
ConsolidateGST: false,
|
|
19
20
|
PartInvoice: true,
|
|
20
21
|
LaborInvoice: true,
|
|
@@ -42,9 +43,10 @@ function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCo
|
|
|
42
43
|
return invPrint;
|
|
43
44
|
}
|
|
44
45
|
function GetSalesReceiptPDF(salesReceiptData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], withPass = false, options = null) {
|
|
46
|
+
var _a;
|
|
45
47
|
if (!options) {
|
|
46
48
|
options = {
|
|
47
|
-
ShowGST: true,
|
|
49
|
+
ShowGST: (((_a = salesReceiptData === null || salesReceiptData === void 0 ? void 0 : salesReceiptData.Settings) === null || _a === void 0 ? void 0 : _a.Tax) === 'TI') ? true : false,
|
|
48
50
|
ConsolidateGST: false,
|
|
49
51
|
PartInvoice: true,
|
|
50
52
|
LaborInvoice: true,
|
|
@@ -182,7 +182,7 @@ class InvoiceTotalsService {
|
|
|
182
182
|
let CustPartsTotalAfterDisc1 = this.GetPartsAfterDiscount1(PartsList);
|
|
183
183
|
let AmtAfterIndvidualItemDisc = (0, math_operations_1.Add)(CustLaborTotalAfterDisc1, CustPartsTotalAfterDisc1);
|
|
184
184
|
finalTotalsData.SIndTotal = AmtAfterIndvidualItemDisc;
|
|
185
|
-
finalTotalsData.Disc = !
|
|
185
|
+
// finalTotalsData.Disc = !TrUtils.IsZero(finalTotalsData.Perc) ? TrUtils.ConvertPercToVal(finalTotalsData.Perc, AmtAfterIndvidualItemDisc, DecimalsNumber) : finalTotalsData.Disc;
|
|
186
186
|
let CustTotal = this.GetCustomerTotalBasedOnTaxType(finalTotalsData, CustLaborTaxTotal, CustPartTaxTotal, LaborList, PartsList, IsIndependentTax, Adjust);
|
|
187
187
|
let RetCustTotal = this.GetRetCustomerTotalBasedOnTaxType(finalTotalsData, CustLaborTaxTotal, RetCustParrtTaxTotal, LaborList, PartsList, IsIndependentTax, Adjust, DecimalsNumber);
|
|
188
188
|
let NonRetCustTotal = this.GetNonRetCustomerTotalBasedOnTaxType(finalTotalsData, CustLaborTaxTotal, NonRetCustParrtTaxTotal, LaborList, PartsList, IsIndependentTax, Adjust, DecimalsNumber);
|
|
@@ -4,6 +4,7 @@ exports.buildInvoiceTotalsAndNotesSection = buildInvoiceTotalsAndNotesSection;
|
|
|
4
4
|
exports.buildSignatureSection = buildSignatureSection;
|
|
5
5
|
const pdf_header_footer_section_1 = require("../header-footer-section/pdf-header-footer.section");
|
|
6
6
|
const pdf_shared_utils_1 = require("../header-footer-section/pdf-shared.utils");
|
|
7
|
+
const math_operations_1 = require("../math-operations");
|
|
7
8
|
const pdf_table_section_1 = require("../table-section/pdf-table.section");
|
|
8
9
|
function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintConfigData = {}) {
|
|
9
10
|
var _a;
|
|
@@ -472,6 +473,8 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
472
473
|
const itemsDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.PDisc));
|
|
473
474
|
const servicesDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.LDisc));
|
|
474
475
|
const overallDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Disc, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Discount, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.TotDisc));
|
|
476
|
+
const overalItemsDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)((invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CustPartsDiscTotal) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.PartsDiscTotal)));
|
|
477
|
+
const overalServicesDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)((invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CustLaborDiscTotal) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.ServiceDiscTotal)));
|
|
475
478
|
const hasDetailedDiscSource = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.PDisc) !== ''
|
|
476
479
|
|| (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.LDisc) !== ''
|
|
477
480
|
|| (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Disc, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Discount, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.TotDisc) !== '';
|
|
@@ -480,9 +483,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
480
483
|
: (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Disc', 'Discount', 'TotDisc']);
|
|
481
484
|
const roundOff = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Round', 'RoundOff']);
|
|
482
485
|
console.log('invoiceData', invoiceData);
|
|
483
|
-
console.log('TotalTax', invoiceData.TotalTax);
|
|
484
486
|
const taxFromInvoice = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['TotalTax', 'TaxTotal', 'TaxAmt', 'GSTTotal', 'CustItemITax']);
|
|
485
|
-
console.log('taxFromInvoice', taxFromInvoice);
|
|
486
487
|
const totalTaxValue = taxFromInvoice !== 0 ? taxFromInvoice : totalTax;
|
|
487
488
|
const returnTotal = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.RetTotal);
|
|
488
489
|
const finalTotalRaw = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.FinalTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Total, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.GrandTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.NetTotal);
|
|
@@ -507,7 +508,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
507
508
|
{ label: 'Overall Discount', amount: overallDiscount }
|
|
508
509
|
]
|
|
509
510
|
: [
|
|
510
|
-
{ label: 'Discount', amount:
|
|
511
|
+
{ label: 'Discount', amount: (0, math_operations_1.Add)(overalItemsDiscount, overalServicesDiscount) }
|
|
511
512
|
])
|
|
512
513
|
.filter((line) => Math.abs(parseNumber(line === null || line === void 0 ? void 0 : line.amount)) > 0);
|
|
513
514
|
const totalLines = [
|