shareneus 1.6.52 → 1.6.53
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 = !tr_utils_1.TrUtils.
|
|
185
|
+
finalTotalsData.Disc = !tr_utils_1.TrUtils.IsZero(finalTotalsData.Perc) ? tr_utils_1.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);
|
|
@@ -472,6 +472,8 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
472
472
|
const itemsDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.PDisc));
|
|
473
473
|
const servicesDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.LDisc));
|
|
474
474
|
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));
|
|
475
|
+
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)));
|
|
476
|
+
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
477
|
const hasDetailedDiscSource = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.PDisc) !== ''
|
|
476
478
|
|| (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.LDisc) !== ''
|
|
477
479
|
|| (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 +482,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
480
482
|
: (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Disc', 'Discount', 'TotDisc']);
|
|
481
483
|
const roundOff = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Round', 'RoundOff']);
|
|
482
484
|
console.log('invoiceData', invoiceData);
|
|
483
|
-
console.log('TotalTax', invoiceData.TotalTax);
|
|
484
485
|
const taxFromInvoice = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['TotalTax', 'TaxTotal', 'TaxAmt', 'GSTTotal', 'CustItemITax']);
|
|
485
|
-
console.log('taxFromInvoice', taxFromInvoice);
|
|
486
486
|
const totalTaxValue = taxFromInvoice !== 0 ? taxFromInvoice : totalTax;
|
|
487
487
|
const returnTotal = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.RetTotal);
|
|
488
488
|
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 +507,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
507
507
|
{ label: 'Overall Discount', amount: overallDiscount }
|
|
508
508
|
]
|
|
509
509
|
: [
|
|
510
|
-
{ label: 'Discount', amount:
|
|
510
|
+
{ label: 'Discount', amount: overalItemsDiscount + overalServicesDiscount }
|
|
511
511
|
])
|
|
512
512
|
.filter((line) => Math.abs(parseNumber(line === null || line === void 0 ? void 0 : line.amount)) > 0);
|
|
513
513
|
const totalLines = [
|