gemcap-be-common 1.5.24 → 1.5.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.24",
3
+ "version": "1.5.26",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -403,6 +403,9 @@ class PdfService {
403
403
  ...acc,
404
404
  [p._id.toString()]: 0,
405
405
  }), {});
406
+ let totalStatementValue = 0;
407
+ const principalData = [];
408
+ let paymentDueDate = null;
406
409
  const docContent = await Promise.all(productForPeriod.map(async (product, index) => {
407
410
  const { startStatementBalance, preparedStatementHeader, preparedStatement, preparedTransactionsHeader, preparedTransactions, groupedData, otherStatements, } = await this.getProductStatementData(product._id.toString(), start, end);
408
411
  totalOverDueStatementBalance = new decimal_js_1.default(totalOverDueStatementBalance).add(startStatementBalance).toNumber();
@@ -466,7 +469,6 @@ class PdfService {
466
469
  }
467
470
  return baseContent;
468
471
  }));
469
- let totalStatementValue = 0;
470
472
  const preparedTotal = Object.entries(totalGroupedData).map(([chargeType, amount]) => {
471
473
  totalStatementValue = new decimal_js_1.default(totalStatementValue).add(amount).toNumber();
472
474
  return [
@@ -482,8 +484,6 @@ class PdfService {
482
484
  { text: '' }
483
485
  ]
484
486
  : [];
485
- const principalData = [];
486
- let paymentDueDate = null;
487
487
  const totalOwed = new decimal_js_1.default(totalStatementValue).add(totalOverDueStatementBalance).toNumber();
488
488
  if (getOnlyTotal) {
489
489
  return { total: totalOwed, dueDate: paymentDueDate, productTotals };
@@ -472,6 +472,10 @@ export class PdfService {
472
472
  [p._id.toString()]: 0,
473
473
  }), {});
474
474
 
475
+ let totalStatementValue = 0;
476
+ const principalData = [];
477
+ let paymentDueDate: Date = null;
478
+
475
479
  const docContent = await Promise.all(productForPeriod.map(async (product, index) => {
476
480
  const {
477
481
  startStatementBalance,
@@ -556,7 +560,6 @@ export class PdfService {
556
560
  return baseContent;
557
561
  }));
558
562
 
559
- let totalStatementValue = 0;
560
563
  const preparedTotal = Object.entries(totalGroupedData).map(([chargeType, amount]) => {
561
564
  totalStatementValue = new Decimal(totalStatementValue).add(amount).toNumber();
562
565
  return [
@@ -573,9 +576,6 @@ export class PdfService {
573
576
  { text: '' }]
574
577
  : [];
575
578
 
576
- const principalData = [];
577
- let paymentDueDate: Date = null;
578
-
579
579
  const totalOwed = new Decimal(totalStatementValue).add(totalOverDueStatementBalance).toNumber();
580
580
 
581
581
  if (getOnlyTotal) {