shareneus 1.6.27 → 1.6.29
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 +0 -1
- package/dist/index.js +2 -4
- package/dist/sales-receive/sales-receive-print.service.js +2 -2
- package/dist/services/est.print-service.d.ts +1 -0
- package/dist/services/est.print-service.js +40 -30
- package/dist/services/ro-print-service.d.ts +1 -0
- package/dist/services/ro-print-service.js +22 -12
- package/dist/services/ro-totals.service.d.ts +1 -0
- package/dist/services/ro-totals.service.js +28 -18
- package/dist/tax/tax-calculator.js +0 -9
- package/dist/transaction-calculations/index.d.ts +1 -0
- package/dist/transaction-calculations/index.js +3 -1
- package/dist/transaction-calculations/total-calculation.d.ts +6 -0
- package/dist/{sales-receive/sales-total-calculation.js → transaction-calculations/total-calculation.js} +5 -5
- package/package.json +1 -1
- package/dist/sales-receive/sales-total-calculation.d.ts +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -130,7 +130,6 @@ export { CalcItemFinalSalePrice } from "./inventory/items/item-price-for-priceli
|
|
|
130
130
|
export { ApplyServicePriceListToProcedure, ApplyServicePriceListToOpcode, GetServicePriceForPriceList } from "./services/service-price-for-pricelist";
|
|
131
131
|
export { IsNotNull, IsNull } from "./shared/util";
|
|
132
132
|
export { GetAgeString, GetNumber } from "./shared/util";
|
|
133
|
-
export { SalesTotalCalculationsWithDecimals } from "./sales-receive/sales-total-calculation";
|
|
134
133
|
export { ServiceHistoryPDFService } from "./services/service-history-pdf.service";
|
|
135
134
|
export { Add, Subtract, Multiply, Divide } from "./shared/math-operations";
|
|
136
135
|
export { ProductWithoutOwnerXlsxFileService } from "./common/reports/excel/product-without-owner-excel.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.CreateInvoicePDFService = exports.CreateReceiptPDFService = exports.GetInvoicePrintInfo = exports.GetBillPdfDataUrl = exports.GetBillPDF = exports.GetInvoicePDF = exports.ProductWithoutOwnerPDFService = exports.ProductWithoutOwnerXlsxFileService = exports.Divide = exports.Multiply = exports.Subtract = exports.Add = exports.ServiceHistoryPDFService = exports.
|
|
6
|
-
exports.ConvertFlatToTaxes = exports.ValidateHSNSACLength = exports.ValidateTaxId = exports.RoundAmount = exports.CalculateWithholding = exports.FindTaxCodeByRateAndSupplyType = exports.DetermineSupplyType = exports.ComputeTaxSummary = exports.SumTaxComponents = exports.ExtractNetFromInclusive = exports.CalculateLineTax = exports.TaxTreatmentEnum =
|
|
5
|
+
exports.CountryEnum = exports.CreateInvoicePDFService = exports.CreateReceiptPDFService = exports.GetInvoicePrintInfo = exports.GetBillPdfDataUrl = exports.GetBillPDF = exports.GetInvoicePDF = exports.ProductWithoutOwnerPDFService = exports.ProductWithoutOwnerXlsxFileService = exports.Divide = exports.Multiply = exports.Subtract = exports.Add = exports.ServiceHistoryPDFService = 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 = exports.CalculateLineTax = exports.TaxTreatmentEnum = 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");
|
|
@@ -272,8 +272,6 @@ Object.defineProperty(exports, "IsNull", { enumerable: true, get: function () {
|
|
|
272
272
|
var util_2 = require("./shared/util");
|
|
273
273
|
Object.defineProperty(exports, "GetAgeString", { enumerable: true, get: function () { return util_2.GetAgeString; } });
|
|
274
274
|
Object.defineProperty(exports, "GetNumber", { enumerable: true, get: function () { return util_2.GetNumber; } });
|
|
275
|
-
var sales_total_calculation_1 = require("./sales-receive/sales-total-calculation");
|
|
276
|
-
Object.defineProperty(exports, "SalesTotalCalculationsWithDecimals", { enumerable: true, get: function () { return sales_total_calculation_1.SalesTotalCalculationsWithDecimals; } });
|
|
277
275
|
var service_history_pdf_service_1 = require("./services/service-history-pdf.service");
|
|
278
276
|
Object.defineProperty(exports, "ServiceHistoryPDFService", { enumerable: true, get: function () { return service_history_pdf_service_1.ServiceHistoryPDFService; } });
|
|
279
277
|
var math_operations_1 = require("./shared/math-operations");
|
|
@@ -5,9 +5,9 @@ const code_enums_1 = require("../enums/code-enums");
|
|
|
5
5
|
const enums_1 = require("../enums/enums");
|
|
6
6
|
const math_operations_1 = require("../shared/math-operations");
|
|
7
7
|
const shared_print_service_1 = require("../shared/shared-print.service");
|
|
8
|
+
const transaction_calculations_1 = require("../transaction-calculations");
|
|
8
9
|
const my_date_1 = require("../utils/my-date");
|
|
9
10
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
10
|
-
const sales_total_calculation_1 = require("./sales-total-calculation");
|
|
11
11
|
class SalesReceivePrintService {
|
|
12
12
|
static GetSalesReceivePrintInfo(OriginalSalesReceiveData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma) {
|
|
13
13
|
var _a, _b;
|
|
@@ -30,7 +30,7 @@ class SalesReceivePrintService {
|
|
|
30
30
|
// let finalTotalsData: any = SalesReceiveTotalsService.GetTotalsValue([], argSalesReceiveData.Items, IsTaxable,
|
|
31
31
|
// true,
|
|
32
32
|
// argSalesReceiveData.Disc, argSalesReceiveData.Perc, TaxCodes, true, argSalesReceiveData.Settings, SalesReceivePrintData.Entity);
|
|
33
|
-
let finalTotalsData = (0,
|
|
33
|
+
let finalTotalsData = (0, transaction_calculations_1.TotalCalculationsWithDecimals)(argSalesReceiveData.Items, [], IsTaxable, TaxCodes, argSalesReceiveData.DecimalsNumber);
|
|
34
34
|
if (ConsolidateGST) {
|
|
35
35
|
// finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
|
|
36
36
|
// finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class EstPrintService {
|
|
2
|
+
static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
|
|
2
3
|
static GetEstimatePrintInfo(OriginalROData: any, OriginalCustomerData: any, OriginalVehicleData: any, OriginalEntityData: any, image: any, Payee: any, InsCompanyName: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, TaxCodes: any, OverallEst: boolean, SuppEstIndex: any, AsEstimated: boolean, isInitial: boolean, isReverse: boolean, Consolidate: boolean): any;
|
|
3
4
|
static GetROBasicDetailsForPrint(ROPrintData: any, argROData: any, Product: any, OverallEst: any, isInitial: boolean): any;
|
|
4
5
|
static GetPrintConditionsBasedOnInput(ROPrintData: any, IncludeGST: boolean, Payee: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, SType: any, Consolidate: boolean): any;
|
|
@@ -9,6 +9,16 @@ const my_date_1 = require("../utils/my-date");
|
|
|
9
9
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
10
10
|
const ro_totals_service_1 = require("./ro-totals.service");
|
|
11
11
|
class EstPrintService {
|
|
12
|
+
static GetTaxAmountFromGroup(item, taxGroupKey, taxCode, fallbackKey) {
|
|
13
|
+
const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
|
|
14
|
+
if (Array.isArray(groupedTaxes)) {
|
|
15
|
+
const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
16
|
+
if (matchedTaxes.length !== 0) {
|
|
17
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
|
|
21
|
+
}
|
|
12
22
|
static GetEstimatePrintInfo(OriginalROData, OriginalCustomerData, OriginalVehicleData, OriginalEntityData, image, Payee, InsCompanyName, AsCustomerOnly, AsInsuranceOnly, AsCustomerAndInsurance, AsInsuranceOrCustomer, TaxCodes, OverallEst, SuppEstIndex, AsEstimated, isInitial, isReverse, Consolidate) {
|
|
13
23
|
let ROPrintData = {};
|
|
14
24
|
let argROData = tr_utils_1.TrUtils.Stringify(OriginalROData);
|
|
@@ -414,14 +424,14 @@ class EstPrintService {
|
|
|
414
424
|
ROPrintData.Ops.forEach((Labor) => {
|
|
415
425
|
// console.log('Labor', Labor);
|
|
416
426
|
Labor.NetAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.NetAmt, DecimalsNumber);
|
|
417
|
-
Labor.CCGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
418
|
-
Labor.CSGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
419
|
-
Labor.CIGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
427
|
+
Labor.CCGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
428
|
+
Labor.CSGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
429
|
+
Labor.CIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
420
430
|
Labor.Disc = tr_utils_1.TrUtils.FixPriceValue(Labor.Disc, DecimalsNumber);
|
|
421
431
|
Labor.AssPr = tr_utils_1.TrUtils.FixPriceValue(Labor.AssPr, DecimalsNumber);
|
|
422
|
-
Labor.ACGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
423
|
-
Labor.ASGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
424
|
-
Labor.AIGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
432
|
+
Labor.ACGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
433
|
+
Labor.ASGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
434
|
+
Labor.AIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
425
435
|
if (Consolidate) {
|
|
426
436
|
if (Labor.PBy === enums_1.PayTypeEnum.Customer) {
|
|
427
437
|
Labor.EstPr = tr_utils_1.TrUtils.FixPriceValue(Labor.CustAfterTax, DecimalsNumber);
|
|
@@ -436,9 +446,9 @@ class EstPrintService {
|
|
|
436
446
|
Labor.EstPr = tr_utils_1.TrUtils.FixPriceValue(Labor.EstPr, DecimalsNumber);
|
|
437
447
|
Labor.Pr = tr_utils_1.TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
438
448
|
}
|
|
439
|
-
Labor.ECGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
440
|
-
Labor.ESGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
441
|
-
Labor.EIGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
449
|
+
Labor.ECGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
450
|
+
Labor.ESGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
451
|
+
Labor.EIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
442
452
|
if (tr_utils_1.TrUtils.IsNull(Labor.CollId)) {
|
|
443
453
|
let LaborColli = {
|
|
444
454
|
_id: Labor._id,
|
|
@@ -457,15 +467,15 @@ class EstPrintService {
|
|
|
457
467
|
// console.log('Part', Part);
|
|
458
468
|
Part.NetAmt = tr_utils_1.TrUtils.FixPriceValue(Part.NetAmt, DecimalsNumber);
|
|
459
469
|
Part.UnAmt = tr_utils_1.TrUtils.FixPriceValue(Part.UnAmt, DecimalsNumber);
|
|
460
|
-
Part.CCGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
461
|
-
Part.CSGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
462
|
-
Part.CIGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
470
|
+
Part.CCGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
471
|
+
Part.CSGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
472
|
+
Part.CIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
463
473
|
Part.Disc = tr_utils_1.TrUtils.FixPriceValue(Part.Disc, DecimalsNumber);
|
|
464
474
|
Part.AssPr = tr_utils_1.TrUtils.FixPriceValue(Part.AssPr, DecimalsNumber);
|
|
465
475
|
Part.AssAmt = tr_utils_1.TrUtils.FixPriceValue(Part.AssAmt, DecimalsNumber);
|
|
466
|
-
Part.ACGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
467
|
-
Part.ASGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
468
|
-
Part.AIGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
476
|
+
Part.ACGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
477
|
+
Part.ASGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
478
|
+
Part.AIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
469
479
|
Part.EstPr = tr_utils_1.TrUtils.FixPriceValue(Part.EstPr, DecimalsNumber);
|
|
470
480
|
if (Consolidate) {
|
|
471
481
|
if (Part.PBy === enums_1.PayTypeEnum.Customer) {
|
|
@@ -482,9 +492,9 @@ class EstPrintService {
|
|
|
482
492
|
Part.UnPr = tr_utils_1.TrUtils.FixPriceValue(Part.UnPr, DecimalsNumber);
|
|
483
493
|
}
|
|
484
494
|
Part.EstAmt = tr_utils_1.TrUtils.FixPriceValue(Part.EstAmt, DecimalsNumber);
|
|
485
|
-
Part.ECGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
486
|
-
Part.ESGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
487
|
-
Part.EIGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
495
|
+
Part.ECGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
496
|
+
Part.ESGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
497
|
+
Part.EIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
488
498
|
if (tr_utils_1.TrUtils.IsNull(Part.CollId)) {
|
|
489
499
|
let LaborIndex = ROPrintData.Ops.findIndex((Labor) => {
|
|
490
500
|
return Labor._id === Part.OpId;
|
|
@@ -828,9 +838,9 @@ class EstPrintService {
|
|
|
828
838
|
LaborList.forEach((Labor) => {
|
|
829
839
|
if (Labor.Sts === enums_1.LaborStatusEnum.New || Labor.Sts === enums_1.LaborStatusEnum.WtngForAppr) {
|
|
830
840
|
if (IncludeGST) {
|
|
831
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
832
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
833
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
841
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
842
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
843
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
834
844
|
}
|
|
835
845
|
else {
|
|
836
846
|
Labor.CGSTAmt = 0;
|
|
@@ -840,9 +850,9 @@ class EstPrintService {
|
|
|
840
850
|
}
|
|
841
851
|
else {
|
|
842
852
|
if (IncludeGST) {
|
|
843
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
844
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
845
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
853
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
854
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
855
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
846
856
|
}
|
|
847
857
|
else {
|
|
848
858
|
Labor.CGSTAmt = 0;
|
|
@@ -861,9 +871,9 @@ class EstPrintService {
|
|
|
861
871
|
let LaborStatus = tr_utils_1.TrUtils.IsNull(Item.CollId) ? this.GetPartParentStatus(Item.OpId, LaborList) : Item.Sts;
|
|
862
872
|
if (LaborStatus === enums_1.LaborStatusEnum.New || LaborStatus === enums_1.LaborStatusEnum.WtngForAppr) {
|
|
863
873
|
if (IncludeGST) {
|
|
864
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
865
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
866
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
874
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
875
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
876
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
867
877
|
}
|
|
868
878
|
else {
|
|
869
879
|
Item.CGSTAmt = 0;
|
|
@@ -873,9 +883,9 @@ class EstPrintService {
|
|
|
873
883
|
}
|
|
874
884
|
else {
|
|
875
885
|
if (IncludeGST) {
|
|
876
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
877
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
878
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
886
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
887
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
888
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
879
889
|
}
|
|
880
890
|
else {
|
|
881
891
|
Item.CGSTAmt = 0;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class ROPrintService {
|
|
2
|
+
static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
|
|
2
3
|
static GetRepairOrderPrintInfo(OriginalROData: any, OriginalCustomerData: any, OriginalVehicleData: any, OriginalEntityData: any, image: any, IncludeGST: boolean, ConsolidateGST: boolean, Payee: any, InsCompanyName: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, TaxCodes: any, OrderType: any, isReverse: boolean): any;
|
|
3
4
|
static GetEmployeeData(empData: any): any;
|
|
4
5
|
static GetROBasicDetailsForPrint(ROPrintData: any, argROData: any, Product: any, OrderType: any): any;
|
|
@@ -9,6 +9,16 @@ const my_date_1 = require("../utils/my-date");
|
|
|
9
9
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
10
10
|
const ro_totals_service_1 = require("./ro-totals.service");
|
|
11
11
|
class ROPrintService {
|
|
12
|
+
static GetTaxAmountFromGroup(item, taxGroupKey, taxCode, fallbackKey) {
|
|
13
|
+
const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
|
|
14
|
+
if (Array.isArray(groupedTaxes)) {
|
|
15
|
+
const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
16
|
+
if (matchedTaxes.length !== 0) {
|
|
17
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
|
|
21
|
+
}
|
|
12
22
|
static GetRepairOrderPrintInfo(OriginalROData, OriginalCustomerData, OriginalVehicleData, OriginalEntityData, image, IncludeGST, ConsolidateGST, Payee, InsCompanyName, AsCustomerOnly, AsInsuranceOnly, TaxCodes, OrderType, isReverse) {
|
|
13
23
|
let ROPrintData = {};
|
|
14
24
|
let argROData = tr_utils_1.TrUtils.Stringify(OriginalROData);
|
|
@@ -591,9 +601,9 @@ class ROPrintService {
|
|
|
591
601
|
else {
|
|
592
602
|
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.Pr, DecimalsNumber);
|
|
593
603
|
}
|
|
594
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
595
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
596
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
604
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
605
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
606
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
597
607
|
}
|
|
598
608
|
else {
|
|
599
609
|
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.Pr, DecimalsNumber);
|
|
@@ -610,9 +620,9 @@ class ROPrintService {
|
|
|
610
620
|
else {
|
|
611
621
|
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.AssPr, DecimalsNumber);
|
|
612
622
|
}
|
|
613
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
614
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
615
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
623
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
624
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
625
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
616
626
|
Labor.AssPr = tr_utils_1.TrUtils.FixedTo(Labor.AssPr, DecimalsNumber);
|
|
617
627
|
}
|
|
618
628
|
else {
|
|
@@ -639,9 +649,9 @@ class ROPrintService {
|
|
|
639
649
|
else {
|
|
640
650
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.UnPr, DecimalsNumber);
|
|
641
651
|
}
|
|
642
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
643
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
644
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
652
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
653
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
654
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
645
655
|
}
|
|
646
656
|
else {
|
|
647
657
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.UnPr, DecimalsNumber);
|
|
@@ -658,9 +668,9 @@ class ROPrintService {
|
|
|
658
668
|
else {
|
|
659
669
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.AssPr, DecimalsNumber);
|
|
660
670
|
}
|
|
661
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
662
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
663
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
671
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
672
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
673
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
664
674
|
Item.AssPr = tr_utils_1.TrUtils.FixedTo(Item.AssPr, DecimalsNumber);
|
|
665
675
|
}
|
|
666
676
|
else {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class ROTotalsService {
|
|
2
|
+
static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
|
|
2
3
|
static GetTotalsValue(OriRecordData: any, TaxCodes: any[], isWorkOrder: boolean, detailedInfo: boolean, withItems: boolean, isRoundable: boolean, EntitySettings: any): any;
|
|
3
4
|
static CalculateLaborValues(opCodesList: any, isWorkOrder: boolean, isTaxable: boolean): any;
|
|
4
5
|
static FilterValidLaborItems(opCodesList: any[]): any[];
|
|
@@ -5,6 +5,16 @@ const enums_1 = require("../enums/enums");
|
|
|
5
5
|
const math_operations_1 = require("../shared/math-operations");
|
|
6
6
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
7
|
class ROTotalsService {
|
|
8
|
+
static GetTaxAmountFromGroup(item, taxGroupKey, taxCode, fallbackKey) {
|
|
9
|
+
const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
|
|
10
|
+
if (Array.isArray(groupedTaxes)) {
|
|
11
|
+
const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
12
|
+
if (matchedTaxes.length !== 0) {
|
|
13
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
|
|
17
|
+
}
|
|
8
18
|
static GetTotalsValue(OriRecordData, TaxCodes, isWorkOrder, detailedInfo, withItems, isRoundable, EntitySettings) {
|
|
9
19
|
let dupRecordData = tr_utils_1.TrUtils.Stringify(OriRecordData);
|
|
10
20
|
let argRecordData = {};
|
|
@@ -38,19 +48,19 @@ class ROTotalsService {
|
|
|
38
48
|
Operation.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Disc);
|
|
39
49
|
Operation.Pr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Pr);
|
|
40
50
|
Operation.AssPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.AssPr);
|
|
41
|
-
Operation.ACGST =
|
|
42
|
-
Operation.ASGST =
|
|
43
|
-
Operation.AIGST =
|
|
44
|
-
Operation.CCGST =
|
|
45
|
-
Operation.CSGST =
|
|
46
|
-
Operation.CIGST =
|
|
51
|
+
Operation.ACGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'CGST', 'ACGST');
|
|
52
|
+
Operation.ASGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'SGST', 'ASGST');
|
|
53
|
+
Operation.AIGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'IGST', 'AIGST');
|
|
54
|
+
Operation.CCGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'CGST', 'CCGST');
|
|
55
|
+
Operation.CSGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'SGST', 'CSGST');
|
|
56
|
+
Operation.CIGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'IGST', 'CIGST');
|
|
47
57
|
Operation.NetAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.NetAmt);
|
|
48
58
|
Operation.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.RecDisc);
|
|
49
59
|
if (!isWorkOrder) {
|
|
50
60
|
Operation.EstPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.EstPr);
|
|
51
|
-
Operation.ECGST =
|
|
52
|
-
Operation.ESGST =
|
|
53
|
-
Operation.EIGST =
|
|
61
|
+
Operation.ECGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'CGST', 'ECGST');
|
|
62
|
+
Operation.ESGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'SGST', 'ESGST');
|
|
63
|
+
Operation.EIGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'IGST', 'EIGST');
|
|
54
64
|
}
|
|
55
65
|
return Operation;
|
|
56
66
|
}
|
|
@@ -179,21 +189,21 @@ class ROTotalsService {
|
|
|
179
189
|
Part.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.Disc);
|
|
180
190
|
Part.UnPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnPr);
|
|
181
191
|
Part.AssPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.AssPr);
|
|
182
|
-
Part.ACGST =
|
|
183
|
-
Part.ASGST =
|
|
184
|
-
Part.AIGST =
|
|
185
|
-
Part.CCGST =
|
|
186
|
-
Part.CSGST =
|
|
187
|
-
Part.CIGST =
|
|
192
|
+
Part.ACGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST');
|
|
193
|
+
Part.ASGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST');
|
|
194
|
+
Part.AIGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST');
|
|
195
|
+
Part.CCGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST');
|
|
196
|
+
Part.CSGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST');
|
|
197
|
+
Part.CIGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST');
|
|
188
198
|
Part.UnAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnAmt);
|
|
189
199
|
Part.AssAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.AssAmt);
|
|
190
200
|
Part.NetAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.NetAmt);
|
|
191
201
|
Part.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.RecDisc);
|
|
192
202
|
if (!isWorkOrder) {
|
|
193
203
|
Part.EstPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.EstPr);
|
|
194
|
-
Part.ECGST =
|
|
195
|
-
Part.ESGST =
|
|
196
|
-
Part.EIGST =
|
|
204
|
+
Part.ECGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST');
|
|
205
|
+
Part.ESGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST');
|
|
206
|
+
Part.EIGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST');
|
|
197
207
|
Part.EstAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.EstAmt);
|
|
198
208
|
}
|
|
199
209
|
return Part;
|
|
@@ -525,15 +525,6 @@ function ComputeDocumentTotals(input) {
|
|
|
525
525
|
roundedTotal = RoundAmount(grandTotal, { Method: Rounding.Method, Precision: Rounding.Precision });
|
|
526
526
|
roundAdj = (0, math_operations_1.Subtract)(roundedTotal, grandTotal);
|
|
527
527
|
}
|
|
528
|
-
console.log("Computed Document Totals:", {
|
|
529
|
-
SubTotal: subTotal,
|
|
530
|
-
Discount: discount,
|
|
531
|
-
TaxableAmount: taxableAmount,
|
|
532
|
-
TaxTotal: taxTotal,
|
|
533
|
-
GrandTotal: grandTotal,
|
|
534
|
-
Round: roundAdj,
|
|
535
|
-
Total: roundedTotal,
|
|
536
|
-
});
|
|
537
528
|
return {
|
|
538
529
|
SubTotal: subTotal,
|
|
539
530
|
Discount: discount,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateRecordDiscountForLine = exports.DiscountAndTaxCalculation = exports.TransactionCalculationEngine = void 0;
|
|
3
|
+
exports.TotalCalculationsWithDecimals = exports.calculateRecordDiscountForLine = exports.DiscountAndTaxCalculation = exports.TransactionCalculationEngine = void 0;
|
|
4
4
|
var transaction_calculation_engine_1 = require("./transaction-calculation-engine");
|
|
5
5
|
Object.defineProperty(exports, "TransactionCalculationEngine", { enumerable: true, get: function () { return transaction_calculation_engine_1.TransactionCalculationEngine; } });
|
|
6
6
|
var discounts_distribution_1 = require("./discounts-distribution");
|
|
7
7
|
Object.defineProperty(exports, "DiscountAndTaxCalculation", { enumerable: true, get: function () { return discounts_distribution_1.DiscountAndTaxCalculation; } });
|
|
8
8
|
Object.defineProperty(exports, "calculateRecordDiscountForLine", { enumerable: true, get: function () { return discounts_distribution_1.calculateRecordDiscountForLine; } });
|
|
9
|
+
var total_calculation_1 = require("./total-calculation");
|
|
10
|
+
Object.defineProperty(exports, "TotalCalculationsWithDecimals", { enumerable: true, get: function () { return total_calculation_1.TotalCalculationsWithDecimals; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function TotalCalculations(items?: any[], ops?: any[], isTaxable?: boolean, taxCodes?: any[], Adjust?: number): any;
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced version with decimal places control
|
|
4
|
+
*/
|
|
5
|
+
export declare function TotalCalculationsWithDecimals(items: any[] | undefined, ops: any[] | undefined, isTaxable: boolean | undefined, taxCodes: any[] | undefined, Adjust: number, decimalPlaces?: number): any;
|
|
6
|
+
export declare function CalculateTaxSummary(items: any[], taxCodes: any[]): unknown[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.TotalCalculations = TotalCalculations;
|
|
4
|
+
exports.TotalCalculationsWithDecimals = TotalCalculationsWithDecimals;
|
|
5
5
|
exports.CalculateTaxSummary = CalculateTaxSummary;
|
|
6
6
|
const math_operations_1 = require("../shared/math-operations");
|
|
7
7
|
const util_1 = require("../shared/util");
|
|
@@ -91,7 +91,7 @@ function getTaxAmountByCode(taxes, code) {
|
|
|
91
91
|
.filter((tax) => tax.Code === code)
|
|
92
92
|
.reduce((sum, tax) => (0, math_operations_1.Add)(sum, (0, util_1.GetNumber)(tax.Amt)), 0);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function TotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [], Adjust = 0) {
|
|
95
95
|
// Handle null/undefined arrays
|
|
96
96
|
const safeItems = safeArray(items);
|
|
97
97
|
const safeOps = safeArray(ops);
|
|
@@ -274,8 +274,8 @@ function SalesTotalCalculations(items = [], ops = [], isTaxable = false, taxCode
|
|
|
274
274
|
/**
|
|
275
275
|
* Enhanced version with decimal places control
|
|
276
276
|
*/
|
|
277
|
-
function
|
|
278
|
-
const result =
|
|
277
|
+
function TotalCalculationsWithDecimals(items = [], ops = [], isTaxable = false, taxCodes = [], Adjust, decimalPlaces = 2) {
|
|
278
|
+
const result = TotalCalculations(items, ops, isTaxable, taxCodes, Adjust);
|
|
279
279
|
// Round all values to specified decimal places
|
|
280
280
|
const roundToDecimals = (num) => Math.round(num * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces);
|
|
281
281
|
// Base rounded result
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function SalesTotalCalculations(items?: any[], ops?: any[], isTaxable?: boolean, taxCodes?: any[], Adjust?: number): any;
|
|
2
|
-
/**
|
|
3
|
-
* Enhanced version with decimal places control
|
|
4
|
-
*/
|
|
5
|
-
export declare function SalesTotalCalculationsWithDecimals(items: any[] | undefined, ops: any[] | undefined, isTaxable: boolean | undefined, taxCodes: any[] | undefined, Adjust: number, decimalPlaces?: number): any;
|
|
6
|
-
export declare function CalculateTaxSummary(items: any[], taxCodes: any[]): unknown[];
|