shareneus 1.6.53 → 1.6.55

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.
@@ -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.IsZero(finalTotalsData.Perc) ? tr_utils_1.TrUtils.ConvertPercToVal(finalTotalsData.Perc, AmtAfterIndvidualItemDisc, DecimalsNumber) : 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);
@@ -1,6 +1,7 @@
1
1
  export declare class PurchaseOrderPrintService {
2
2
  static GetDataForPurchaseOrderPrint(argPurchaseOrderData: any, EntityData: any, image: any, VendorData: any, TaxCodes: any, IsFormPO: boolean): any;
3
3
  static GetLaborPrintInfo(LaborList: any, TaxCodes: any, LineTotal: string, DecimalsNumber: number): any;
4
+ static GetPaymentsTotal(Credits: any, BillPayments: any, Total: number, BillStatus: string, DecimalsNumber: number): any;
4
5
  static GetVendorDataForPrint(argVendorData: any): any;
5
6
  static GetQtyWithUoM(Items: any): any;
6
7
  static ConcatTotalsInfo(PurchaseOrderPDFData: any, DetailedTotalsInfo: any): any;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PurchaseOrderPrintService = void 0;
4
4
  const aggregation_1 = require("../../aggregation/aggregation");
5
5
  const code_enums_1 = require("../../enums/code-enums");
6
+ const enums_1 = require("../../enums/enums");
7
+ const math_operations_1 = require("../../shared/math-operations");
6
8
  const shared_print_service_1 = require("../../shared/shared-print.service");
7
9
  const my_date_1 = require("../../utils/my-date");
8
10
  const tr_utils_1 = require("../../utils/tr-utils");
@@ -65,7 +67,9 @@ class PurchaseOrderPrintService {
65
67
  PurchaseOrderPDFData.HeaderName = 'Expense';
66
68
  }
67
69
  else {
70
+ let PaymentData = this.GetPaymentsTotal(PurchaseOrderData.Credits, PurchaseOrderData.Payments, PurchaseOrderData.Total, PurchaseOrderData.Sts, PurchaseOrderData.Entity.DecimalsNumber);
68
71
  PurchaseOrderPDFData.HeaderName = 'Bill';
72
+ PurchaseOrderPDFData.Due = PaymentData.Due;
69
73
  }
70
74
  }
71
75
  PurchaseOrderPDFData.Vendor = this.GetVendorDataForPrint(tr_utils_1.TrUtils.Stringify(VendorData));
@@ -104,6 +108,26 @@ class PurchaseOrderPrintService {
104
108
  });
105
109
  return LaborList;
106
110
  }
111
+ static GetPaymentsTotal(Credits, BillPayments, Total, BillStatus, DecimalsNumber) {
112
+ const payments = Array.isArray(BillPayments) ? BillPayments : [];
113
+ const credits = Array.isArray(Credits) ? Credits : [];
114
+ const paymentsTotal = payments.reduce((total, payment) => total + tr_utils_1.TrUtils.SetValueToZeroIfNull(payment === null || payment === void 0 ? void 0 : payment.Paid), 0);
115
+ const creditsTotal = credits.reduce((total, credit) => total + tr_utils_1.TrUtils.SetValueToZeroIfNull(credit === null || credit === void 0 ? void 0 : credit.Amt), 0);
116
+ const paidTotal = paymentsTotal + creditsTotal;
117
+ const isPaid = BillStatus === enums_1.BillStatusEnum.Paid;
118
+ let due = isPaid ? 0 : tr_utils_1.TrUtils.FixedTo((0, math_operations_1.Subtract)(Total, paidTotal), DecimalsNumber);
119
+ if (due < 0) {
120
+ due = 0;
121
+ }
122
+ const data = {
123
+ Due: due,
124
+ Paid: tr_utils_1.TrUtils.FixedTo(paidTotal, DecimalsNumber)
125
+ };
126
+ if (due === 0) {
127
+ data.Sts = enums_1.BillStatusEnum.Closed;
128
+ }
129
+ return data;
130
+ }
107
131
  static GetVendorDataForPrint(argVendorData) {
108
132
  if (tr_utils_1.TrUtils.IsNull(argVendorData)) {
109
133
  return null;
@@ -801,7 +801,7 @@ class PrintSharedService {
801
801
  }
802
802
  else {
803
803
  if (ShowDiscountColumn) {
804
- return [25, 210, 40, 70, 40, 40, 70];
804
+ return [25, 210, 40, 75, 40, 40, 80];
805
805
  }
806
806
  else {
807
807
  return [25, 308, 52, 65, 80];
@@ -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;
@@ -507,7 +508,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
507
508
  { label: 'Overall Discount', amount: overallDiscount }
508
509
  ]
509
510
  : [
510
- { label: 'Discount', amount: overalItemsDiscount + overalServicesDiscount }
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 = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.53",
3
+ "version": "1.6.55",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",