shareneus 1.6.54 → 1.6.56

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.
@@ -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, PurchaseOrderPDFData.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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.54",
3
+ "version": "1.6.56",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",