shareneus 1.5.23 → 1.5.25

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.
@@ -479,7 +479,7 @@ export declare class ReceiptPDFService {
479
479
  }[];
480
480
  })[];
481
481
  };
482
- static GetTowards(Ids: any, IsRepairOrder: boolean, Sts: any, RemAmt: any): {
482
+ static GetTowards(Ids: any, IsRepairOrder: boolean, Sts: any, RemAmt: any, RefundAmt: any): {
483
483
  columns: {
484
484
  stack: ({
485
485
  text: ({
@@ -25,7 +25,7 @@ class ReceiptPDFService {
25
25
  this.GetPayment(ReceiptData.PaymentId, isHC),
26
26
  this.GetName(ReceiptData.FullName),
27
27
  this.GetRupee(ReceiptData.TotalAmount),
28
- this.GetTowards(ReceiptData.Ids, ReceiptData.RepairOrder, ReceiptData.Sts, ReceiptData.RemAmt),
28
+ this.GetTowards(ReceiptData.Ids, ReceiptData.RepairOrder, ReceiptData.Sts, ReceiptData.RemAmt, ReceiptData.RefundAmount),
29
29
  this.GetAmount(ReceiptData.PaymentType, ReceiptData.TypeNumber, ReceiptData.PaidDate),
30
30
  // this.GetDrawDate(ReceiptData.PaymentType,ReceiptData.PaidDate),
31
31
  this.GetCompanyName(ReceiptData.Entity.CName),
@@ -180,12 +180,12 @@ class ReceiptPDFService {
180
180
  ]
181
181
  };
182
182
  }
183
- static GetTowards(Ids, IsRepairOrder, Sts, RemAmt) {
183
+ static GetTowards(Ids, IsRepairOrder, Sts, RemAmt, RefundAmt) {
184
184
  let data = '';
185
185
  let toward = '';
186
186
  for (let i = 0; i < Ids.length; i++) {
187
187
  if (i + 1 < Ids.length) {
188
- data = data + Ids[i] + ',';
188
+ data = data + Ids[i] + ', ';
189
189
  }
190
190
  else {
191
191
  data = data + Ids[i];
@@ -197,8 +197,11 @@ class ReceiptPDFService {
197
197
  }
198
198
  else {
199
199
  toward = 'INVOICE - ' + data;
200
+ if (RefundAmt > 0) {
201
+ toward += ', (refunded Rs.' + RefundAmt + ' )';
202
+ }
200
203
  if (RemAmt > 0) {
201
- toward += ' (remaining Rs.' + RemAmt + ' as advance)';
204
+ toward += ', (remaining Rs.' + RemAmt + ' as advance)';
202
205
  }
203
206
  }
204
207
  }
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReceiptPrintService = void 0;
4
+ const math_operations_1 = require("../../shared/math-operations");
4
5
  const shared_print_service_1 = require("../../shared/shared-print.service");
5
6
  const my_date_1 = require("../../utils/my-date");
6
7
  const tr_utils_1 = require("../../utils/tr-utils");
7
8
  class ReceiptPrintService {
8
9
  static GetReceiptPrint(argPaymentViewData, EntityData, image) {
10
+ var _a;
9
11
  let PaymentViewData = tr_utils_1.TrUtils.Stringify(argPaymentViewData);
10
12
  let ReceiptData = {};
11
13
  ReceiptData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(EntityData, "Receipt", argPaymentViewData);
@@ -25,6 +27,14 @@ class ReceiptPrintService {
25
27
  }
26
28
  ReceiptData.TotalAmount = PaymentViewData.Amt;
27
29
  ReceiptData.RemAmt = PaymentViewData.RemAmt;
30
+ let Refunds = (_a = PaymentViewData === null || PaymentViewData === void 0 ? void 0 : PaymentViewData.AllocRefs) === null || _a === void 0 ? void 0 : _a.filter((ref) => ref.Type === 'CR');
31
+ if (!tr_utils_1.TrUtils.IsNull(Refunds) && Refunds.length > 0) {
32
+ let Amount = 0;
33
+ for (let i = 0; i < Refunds.length; i++) {
34
+ Amount = (0, math_operations_1.Add)(Amount, Refunds[i].Amt);
35
+ }
36
+ ReceiptData.RefundAmount = Amount;
37
+ }
28
38
  ReceiptData.PaidDate = my_date_1.MyDate.ConvertUTCDateToReadable(PaymentViewData.Date);
29
39
  ReceiptData.Ids = this.GetRecordIds(PaymentViewData);
30
40
  ReceiptData.Type = 'Receipt';
@@ -34,13 +44,15 @@ class ReceiptPrintService {
34
44
  return ReceiptData;
35
45
  }
36
46
  static GetRecordIds(PaymentViewData) {
47
+ var _a;
37
48
  let IdList = [];
38
49
  var i = 0;
39
50
  if (!tr_utils_1.TrUtils.IsNull(PaymentViewData.AllocRefs) && PaymentViewData.AllocRefs.length !== 0) {
40
- for (i = 0; i < PaymentViewData.AllocRefs.length; i++) {
41
- let Id = PaymentViewData.AllocRefs[i].Code;
42
- if (!tr_utils_1.TrUtils.IsNull(PaymentViewData.AllocRefs[i].RegNo)) {
43
- Id = Id + '(' + PaymentViewData.AllocRefs[i].RegNo + ')';
51
+ let Invoices = (_a = PaymentViewData === null || PaymentViewData === void 0 ? void 0 : PaymentViewData.AllocRefs) === null || _a === void 0 ? void 0 : _a.filter((ref) => ref.Type === 'INV');
52
+ for (i = 0; i < Invoices.length; i++) {
53
+ let Id = Invoices[i].Code;
54
+ if (!tr_utils_1.TrUtils.IsNull(Invoices[i].RegNo)) {
55
+ Id = Id + '(' + Invoices[i].RegNo + ')';
44
56
  }
45
57
  IdList.push(Id);
46
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.23",
3
+ "version": "1.5.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",