gemcap-be-common 1.4.259 → 1.5.2
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/db/collaterals.db.d.ts +1 -1
- package/helpers/date.helper.d.ts +1 -0
- package/helpers/date.helper.js +12 -1
- package/helpers/date.helper.ts +14 -1
- package/models/AccountPayableItem.model.d.ts +6 -6
- package/models/InventoryAvailability.model.d.ts +9 -9
- package/models/InventoryAvailabilityItem.model.d.ts +3 -3
- package/models/InventoryItem.model.d.ts +15 -15
- package/models/LoanStatementStatus.model.d.ts +6 -6
- package/models/ReceivableAvailability.model.d.ts +18 -18
- package/models/ReceivableAvailabilityItem.model.d.ts +57 -57
- package/models/ReceivableItem.model.d.ts +6 -6
- package/models/_index.d.ts +3 -3
- package/package.json +1 -1
- package/services/borrower-summary.service.js +1 -1
- package/services/borrower-summary.service.ts +2 -2
- package/services/borrowers.service.d.ts +2 -2
- package/services/loan-charges.service.js +1 -0
- package/services/loan-charges.service.ts +1 -0
- package/services/loan-payments.service.js +3 -2
- package/services/loan-payments.service.ts +3 -2
- package/services/loan-transactions.service.js +3 -1
- package/services/loan-transactions.service.ts +4 -2
- package/services/pdf.service.js +11 -4
- package/services/pdf.service.ts +12 -4
- package/services/quickbooks.service.js +2 -1
- package/services/quickbooks.service.ts +2 -1
- package/services/reports.service.js +1 -1
- package/services/reports.service.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
package/models/_index.d.ts
CHANGED
|
@@ -32,9 +32,9 @@ export declare const allSchemas: {
|
|
|
32
32
|
updatedAt: NativeDate;
|
|
33
33
|
} & {
|
|
34
34
|
order: number;
|
|
35
|
+
amount: number;
|
|
35
36
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
36
37
|
apDate: Date;
|
|
37
|
-
amount: number;
|
|
38
38
|
__v?: number;
|
|
39
39
|
poNumber?: string;
|
|
40
40
|
customerName?: string;
|
|
@@ -46,9 +46,9 @@ export declare const allSchemas: {
|
|
|
46
46
|
updatedAt: NativeDate;
|
|
47
47
|
} & {
|
|
48
48
|
order: number;
|
|
49
|
+
amount: number;
|
|
49
50
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
50
51
|
apDate: Date;
|
|
51
|
-
amount: number;
|
|
52
52
|
__v?: number;
|
|
53
53
|
poNumber?: string;
|
|
54
54
|
customerName?: string;
|
|
@@ -60,9 +60,9 @@ export declare const allSchemas: {
|
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
} & {
|
|
62
62
|
order: number;
|
|
63
|
+
amount: number;
|
|
63
64
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
64
65
|
apDate: Date;
|
|
65
|
-
amount: number;
|
|
66
66
|
__v?: number;
|
|
67
67
|
poNumber?: string;
|
|
68
68
|
customerName?: string;
|
package/package.json
CHANGED
|
@@ -213,7 +213,7 @@ class BorrowerSummaryService {
|
|
|
213
213
|
}
|
|
214
214
|
async getChartData(borrowerId) {
|
|
215
215
|
const products = await this.loanChargesService.getLoanProducts(borrowerId);
|
|
216
|
-
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER);
|
|
216
|
+
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, new Date()));
|
|
217
217
|
const chartData = [];
|
|
218
218
|
if (revolverProduct) {
|
|
219
219
|
const lastSignedBBC = await (0, bbcDates_db_1.getLatestSignedBBCDateDoc)(borrowerId);
|
|
@@ -3,7 +3,7 @@ import dayjs from 'dayjs';
|
|
|
3
3
|
import Decimal from 'decimal.js';
|
|
4
4
|
|
|
5
5
|
import { ILoanTransactionDoc, LoanTransaction } from '../models/LoanTransaction.model';
|
|
6
|
-
import { defaultDateFormat, convertDateToFormat } from '../helpers/date.helper';
|
|
6
|
+
import { defaultDateFormat, convertDateToFormat, isProductActive } from '../helpers/date.helper';
|
|
7
7
|
import { formatNumbers } from '../helpers/numbers.helper';
|
|
8
8
|
import { BorrowerCompliance } from '../models/BorrowerCompliance.model';
|
|
9
9
|
import { EComplianceItemStatus } from '../models/ComplianceItem.model';
|
|
@@ -236,7 +236,7 @@ export class BorrowerSummaryService {
|
|
|
236
236
|
|
|
237
237
|
private async getChartData(borrowerId: string) {
|
|
238
238
|
const products = await this.loanChargesService.getLoanProducts(borrowerId);
|
|
239
|
-
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER);
|
|
239
|
+
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, new Date()));
|
|
240
240
|
const chartData = [];
|
|
241
241
|
if (revolverProduct) {
|
|
242
242
|
const lastSignedBBC = await getLatestSignedBBCDateDoc(borrowerId);
|
|
@@ -84,10 +84,10 @@ export declare class BorrowerService {
|
|
|
84
84
|
getBorrowerCodesMap(): Promise<Map<string, string>>;
|
|
85
85
|
getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
|
|
86
86
|
[x: string]: {
|
|
87
|
+
SELECTED_PERIOD?: boolean;
|
|
88
|
+
ENTIRE_LOAN?: boolean;
|
|
87
89
|
LAST_MONTH?: boolean;
|
|
88
90
|
CURRENT_MONTH?: boolean;
|
|
89
|
-
ENTIRE_LOAN?: boolean;
|
|
90
|
-
SELECTED_PERIOD?: boolean;
|
|
91
91
|
TERM_LOAN?: boolean;
|
|
92
92
|
};
|
|
93
93
|
}>;
|
|
@@ -195,6 +195,7 @@ class LoanChargesService {
|
|
|
195
195
|
}
|
|
196
196
|
validateLoanCharge(loanCharge) {
|
|
197
197
|
const validationResult = LoanCharges_model_1.chargeViewValidationSchema.validate(loanCharge);
|
|
198
|
+
console.debug({ validationResult });
|
|
198
199
|
return !!validationResult.error;
|
|
199
200
|
}
|
|
200
201
|
async saveLoanCharges(borrowerId, loanCharges, quickCreate = false) {
|
|
@@ -227,6 +227,7 @@ export class LoanChargesService {
|
|
|
227
227
|
|
|
228
228
|
validateLoanCharge(loanCharge: ILoanChargeView) {
|
|
229
229
|
const validationResult = chargeViewValidationSchema.validate(loanCharge);
|
|
230
|
+
console.debug({ validationResult })
|
|
230
231
|
return !!validationResult.error;
|
|
231
232
|
}
|
|
232
233
|
|
|
@@ -17,6 +17,7 @@ const LoanTransaction_model_1 = require("../models/LoanTransaction.model");
|
|
|
17
17
|
const LoanProducts_model_1 = require("../models/LoanProducts.model");
|
|
18
18
|
const Borrower_model_1 = require("../models/Borrower.model");
|
|
19
19
|
const LoanPayment_model_1 = require("../models/LoanPayment.model");
|
|
20
|
+
const date_helper_1 = require("../helpers/date.helper");
|
|
20
21
|
exports.paymentOrder = [
|
|
21
22
|
loan_charge_type_enum_1.ELoanChargeType.RECOVERABLE,
|
|
22
23
|
loan_charge_type_enum_1.ELoanChargeType.INTEREST_FEE,
|
|
@@ -329,7 +330,7 @@ class LoanPaymentsService {
|
|
|
329
330
|
const data = await loanStatementService.getBorrowerComplianceData(combinedPayment.borrowerId, new Date());
|
|
330
331
|
let totalSumToCover = combinedPayment.payment;
|
|
331
332
|
const products = await this.loanChargesService.getLoanProducts(combinedPayment.borrowerId);
|
|
332
|
-
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER);
|
|
333
|
+
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, dayjs_1.default)(product.deactivationDate).isBefore((0, dayjs_1.default)(combinedPayment.date)));
|
|
333
334
|
for (const p of combinedPayment.products) {
|
|
334
335
|
await this.loanProductsService.savePaymentOrder(p.productId, p.paymentOrder);
|
|
335
336
|
const desiredProductSum = data.productTotals[p.productId];
|
|
@@ -439,7 +440,7 @@ class LoanPaymentsService {
|
|
|
439
440
|
if (borrowerIds.includes(borrower._id.toString())) {
|
|
440
441
|
try {
|
|
441
442
|
const borrowerProducts = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
442
|
-
const revolverProduct = borrowerProducts.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER);
|
|
443
|
+
const revolverProduct = borrowerProducts.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, selectedDate));
|
|
443
444
|
const loanStatementService = this.getLoanStatementService();
|
|
444
445
|
const dueAmounts = await loanStatementService.getBorrowerProductTotals(borrower._id.toString());
|
|
445
446
|
if (dueAmounts.total === 0) {
|
|
@@ -40,6 +40,7 @@ import { LoanTransactionsService } from './loan-transactions.service';
|
|
|
40
40
|
import { TermLoanService } from './term-loan.service';
|
|
41
41
|
import { LockService } from './lock.service';
|
|
42
42
|
import { UsersService } from './users.service';
|
|
43
|
+
import { isProductActive } from '../helpers/date.helper';
|
|
43
44
|
|
|
44
45
|
export const paymentOrder = [
|
|
45
46
|
ELoanChargeType.RECOVERABLE,
|
|
@@ -371,7 +372,7 @@ export class LoanPaymentsService {
|
|
|
371
372
|
const data = await loanStatementService.getBorrowerComplianceData(combinedPayment.borrowerId, new Date());
|
|
372
373
|
let totalSumToCover = combinedPayment.payment;
|
|
373
374
|
const products = await this.loanChargesService.getLoanProducts(combinedPayment.borrowerId);
|
|
374
|
-
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER);
|
|
375
|
+
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && dayjs(product.deactivationDate).isBefore(dayjs(combinedPayment.date)));
|
|
375
376
|
|
|
376
377
|
for (const p of combinedPayment.products) {
|
|
377
378
|
await this.loanProductsService.savePaymentOrder(p.productId, p.paymentOrder);
|
|
@@ -490,7 +491,7 @@ export class LoanPaymentsService {
|
|
|
490
491
|
if (borrowerIds.includes(borrower._id.toString())) {
|
|
491
492
|
try {
|
|
492
493
|
const borrowerProducts = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
493
|
-
const revolverProduct = borrowerProducts.find((product) => product.type === ELoanTypes.REVOLVER);
|
|
494
|
+
const revolverProduct = borrowerProducts.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, selectedDate));
|
|
494
495
|
const loanStatementService = this.getLoanStatementService();
|
|
495
496
|
const dueAmounts = await loanStatementService.getBorrowerProductTotals(borrower._id.toString());
|
|
496
497
|
if (dueAmounts.total === 0) {
|
|
@@ -676,7 +676,9 @@ class LoanTransactionsService {
|
|
|
676
676
|
[loan_types_enum_1.ELoanTypes.TERM]: 0,
|
|
677
677
|
[loan_types_enum_1.ELoanTypes.REVOLVER]: 0,
|
|
678
678
|
};
|
|
679
|
-
await Promise.all(loanProducts
|
|
679
|
+
await Promise.all(loanProducts
|
|
680
|
+
.filter((product) => (0, date_helper_1.isProductActive)(product.deactivationDate, bbcDate.bbcDate))
|
|
681
|
+
.map(async (product) => {
|
|
680
682
|
const lastTransaction = await this.getLastTransactionForDate(product._id.toString(), (0, dayjs_1.default)(bbcDate.bbcDate).utcOffset(0).endOf('day').toDate());
|
|
681
683
|
if (lastTransaction) {
|
|
682
684
|
balances[loan_types_enum_1.ELoanTypes[product.type]] = new decimal_js_1.default(balances[loan_types_enum_1.ELoanTypes[product.type]]).add(lastTransaction.balance).toNumber();
|
|
@@ -4,7 +4,7 @@ import dayjs from 'dayjs';
|
|
|
4
4
|
import Decimal from 'decimal.js';
|
|
5
5
|
|
|
6
6
|
import { IEmail } from '../interfaces/email.interface';
|
|
7
|
-
import { calculateTimeZone } from '../helpers/date.helper';
|
|
7
|
+
import { calculateTimeZone, isProductActive } from '../helpers/date.helper';
|
|
8
8
|
import { createFilteredObject } from '../helpers/common.helper';
|
|
9
9
|
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
10
10
|
import { BBCDateModel } from '../models/BBCDate.model';
|
|
@@ -765,7 +765,9 @@ export class LoanTransactionsService {
|
|
|
765
765
|
[ELoanTypes.TERM]: 0,
|
|
766
766
|
[ELoanTypes.REVOLVER]: 0,
|
|
767
767
|
};
|
|
768
|
-
await Promise.all(loanProducts
|
|
768
|
+
await Promise.all(loanProducts
|
|
769
|
+
.filter((product) => isProductActive(product.deactivationDate, bbcDate.bbcDate))
|
|
770
|
+
.map(async (product) => {
|
|
769
771
|
const lastTransaction = await this.getLastTransactionForDate(product._id.toString(), dayjs(bbcDate.bbcDate).utcOffset(0).endOf('day').toDate());
|
|
770
772
|
if (lastTransaction) {
|
|
771
773
|
balances[ELoanTypes[product.type]] = new Decimal(balances[ELoanTypes[product.type]]).add(lastTransaction.balance).toNumber();
|
package/services/pdf.service.js
CHANGED
|
@@ -368,6 +368,13 @@ class PdfService {
|
|
|
368
368
|
async createStatementDoc(params, getOnlyTotal = false) {
|
|
369
369
|
const { borrowerId, start, end } = params;
|
|
370
370
|
const products = await this.loanChargesService.getLoanProducts(borrowerId);
|
|
371
|
+
const productForPeriod = products.filter(product => {
|
|
372
|
+
if (!product.deactivationDate) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
const deactivation = (0, dayjs_1.default)(product.deactivationDate);
|
|
376
|
+
return deactivation.isAfter((0, dayjs_1.default)(start)) && deactivation.isBefore((0, dayjs_1.default)(end));
|
|
377
|
+
});
|
|
371
378
|
const borrower = await Borrower_model_1.BorrowerModel.findById(borrowerId).lean();
|
|
372
379
|
const organization = await this.organizationsService.getOrganizationForBorrower(borrowerId);
|
|
373
380
|
pdfmake_1.default.vfs = vfs_fonts_1.default.pdfMake.vfs;
|
|
@@ -389,11 +396,11 @@ class PdfService {
|
|
|
389
396
|
[loan_charge_type_enum_1.ELoanChargeType.RECOVERABLE]: 0,
|
|
390
397
|
};
|
|
391
398
|
let totalOverDueStatementBalance = 0;
|
|
392
|
-
const productTotals =
|
|
399
|
+
const productTotals = productForPeriod.reduce((acc, p) => ({
|
|
393
400
|
...acc,
|
|
394
401
|
[p._id.toString()]: 0,
|
|
395
402
|
}), {});
|
|
396
|
-
const docContent = await Promise.all(
|
|
403
|
+
const docContent = await Promise.all(productForPeriod.map(async (product, index) => {
|
|
397
404
|
const { startStatementBalance, preparedStatementHeader, preparedStatement, preparedTransactionsHeader, preparedTransactions, groupedData, otherStatements, } = await this.getProductStatementData(product._id.toString(), start, end);
|
|
398
405
|
totalOverDueStatementBalance = new decimal_js_1.default(totalOverDueStatementBalance).add(startStatementBalance).toNumber();
|
|
399
406
|
let totalPerProduct = 0;
|
|
@@ -427,7 +434,7 @@ class PdfService {
|
|
|
427
434
|
emptyString,
|
|
428
435
|
...preparedTransactionsHeader,
|
|
429
436
|
preparedTransactions,
|
|
430
|
-
|
|
437
|
+
productForPeriod.length === index + 1 ? emptyString : pageBreaker,
|
|
431
438
|
];
|
|
432
439
|
}));
|
|
433
440
|
let totalStatementValue = 0;
|
|
@@ -448,7 +455,7 @@ class PdfService {
|
|
|
448
455
|
: [];
|
|
449
456
|
const principalData = [];
|
|
450
457
|
let paymentDueDate = null;
|
|
451
|
-
const termLoanProducts =
|
|
458
|
+
const termLoanProducts = productForPeriod.filter((product) => product.type === loan_types_enum_1.ELoanTypes.TERM);
|
|
452
459
|
await Promise.all(termLoanProducts.map(async (product) => {
|
|
453
460
|
const { termLoanTableData, monthlyPrincipal, dueDate, } = await this.getTermLoan(product._id.toString(), new Date(start));
|
|
454
461
|
if (monthlyPrincipal !== null) {
|
package/services/pdf.service.ts
CHANGED
|
@@ -426,6 +426,14 @@ export class PdfService {
|
|
|
426
426
|
|
|
427
427
|
const { borrowerId, start, end } = params;
|
|
428
428
|
const products = await this.loanChargesService.getLoanProducts(borrowerId);
|
|
429
|
+
const productForPeriod = products.filter(product => {
|
|
430
|
+
if (!product.deactivationDate) {
|
|
431
|
+
return true;
|
|
432
|
+
}
|
|
433
|
+
const deactivation = dayjs(product.deactivationDate);
|
|
434
|
+
return deactivation.isAfter(dayjs(start)) && deactivation.isBefore(dayjs(end));
|
|
435
|
+
});
|
|
436
|
+
|
|
429
437
|
const borrower = await BorrowerModel.findById(borrowerId).lean();
|
|
430
438
|
|
|
431
439
|
const organization = await this.organizationsService.getOrganizationForBorrower(borrowerId);
|
|
@@ -455,12 +463,12 @@ export class PdfService {
|
|
|
455
463
|
|
|
456
464
|
let totalOverDueStatementBalance = 0;
|
|
457
465
|
|
|
458
|
-
const productTotals: { [productId: string]: number } =
|
|
466
|
+
const productTotals: { [productId: string]: number } = productForPeriod.reduce((acc, p) => ({
|
|
459
467
|
...acc,
|
|
460
468
|
[p._id.toString()]: 0,
|
|
461
469
|
}), {});
|
|
462
470
|
|
|
463
|
-
const docContent = await Promise.all(
|
|
471
|
+
const docContent = await Promise.all(productForPeriod.map(async (product, index) => {
|
|
464
472
|
const {
|
|
465
473
|
startStatementBalance,
|
|
466
474
|
preparedStatementHeader,
|
|
@@ -506,7 +514,7 @@ export class PdfService {
|
|
|
506
514
|
emptyString,
|
|
507
515
|
...preparedTransactionsHeader,
|
|
508
516
|
preparedTransactions,
|
|
509
|
-
|
|
517
|
+
productForPeriod.length === index + 1 ? emptyString : pageBreaker,
|
|
510
518
|
];
|
|
511
519
|
}));
|
|
512
520
|
|
|
@@ -529,7 +537,7 @@ export class PdfService {
|
|
|
529
537
|
|
|
530
538
|
const principalData = [];
|
|
531
539
|
let paymentDueDate: Date = null;
|
|
532
|
-
const termLoanProducts =
|
|
540
|
+
const termLoanProducts = productForPeriod.filter((product) => product.type === ELoanTypes.TERM);
|
|
533
541
|
await Promise.all(termLoanProducts.map(async (product) => {
|
|
534
542
|
const {
|
|
535
543
|
termLoanTableData,
|
|
@@ -15,6 +15,7 @@ const Borrower_model_1 = require("../models/Borrower.model");
|
|
|
15
15
|
const TermLoan_model_1 = require("../models/TermLoan.model");
|
|
16
16
|
const reports_db_1 = require("../db/reports.db");
|
|
17
17
|
const QuickbooksAccount_model_1 = require("../models/QuickbooksAccount.model");
|
|
18
|
+
const date_helper_1 = require("../helpers/date.helper");
|
|
18
19
|
const headersIIF = [
|
|
19
20
|
{
|
|
20
21
|
service: '!TRNS',
|
|
@@ -433,7 +434,7 @@ class QuickbooksService {
|
|
|
433
434
|
};
|
|
434
435
|
if (settlementCode === 'null') {
|
|
435
436
|
const products = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
436
|
-
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER);
|
|
437
|
+
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, reportDate));
|
|
437
438
|
if (revolverProduct) {
|
|
438
439
|
settlementCode = revolverProduct.code;
|
|
439
440
|
}
|
|
@@ -22,6 +22,7 @@ import { CashAllocationService } from './cash-allocation.service';
|
|
|
22
22
|
import { CompaniesService } from './companies.service';
|
|
23
23
|
import { LoanChargesService } from './loan-charges.service';
|
|
24
24
|
import { LoanPaymentsService } from './loan-payments.service';
|
|
25
|
+
import { isProductActive } from '../helpers/date.helper';
|
|
25
26
|
|
|
26
27
|
export type QuickBookReportType = 'accrual' | 'payment' | 'cash';
|
|
27
28
|
|
|
@@ -505,7 +506,7 @@ export class QuickbooksService {
|
|
|
505
506
|
|
|
506
507
|
if (settlementCode === 'null') {
|
|
507
508
|
const products = await this.loanChargesService.getLoanProducts(borrower._id.toString());
|
|
508
|
-
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER);
|
|
509
|
+
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, reportDate));
|
|
509
510
|
if (revolverProduct) {
|
|
510
511
|
settlementCode = revolverProduct.code;
|
|
511
512
|
}
|
|
@@ -231,7 +231,7 @@ class ReportsService {
|
|
|
231
231
|
if (!borrower) {
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER);
|
|
234
|
+
const revolverProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.REVOLVER && (0, date_helper_1.isProductActive)(product.deactivationDate, date));
|
|
235
235
|
const termProduct = products.find((product) => product.type === loan_types_enum_1.ELoanTypes.TERM);
|
|
236
236
|
let revolverDataGroup = null;
|
|
237
237
|
if (revolverProduct) {
|
|
@@ -2,7 +2,7 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import Decimal from 'decimal.js';
|
|
3
3
|
|
|
4
4
|
import { BorrowerModel } from '../models/Borrower.model';
|
|
5
|
-
import { defaultDateFormat, convertDateToFormat } from '../helpers/date.helper';
|
|
5
|
+
import { defaultDateFormat, convertDateToFormat, isProductActive } from '../helpers/date.helper';
|
|
6
6
|
import { IInventoryAvailabilitySummary } from '../models/InventoryAvailability.model';
|
|
7
7
|
import { IReserveSummary, IReserveSummaryItem } from '../models/Reserve.model';
|
|
8
8
|
import { IAvailabilitySummary } from '../models/ReceivableAvailability.model';
|
|
@@ -314,7 +314,7 @@ export class ReportsService {
|
|
|
314
314
|
if (!borrower) {
|
|
315
315
|
return;
|
|
316
316
|
}
|
|
317
|
-
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER);
|
|
317
|
+
const revolverProduct = products.find((product) => product.type === ELoanTypes.REVOLVER && isProductActive(product.deactivationDate, date));
|
|
318
318
|
const termProduct = products.find((product) => product.type === ELoanTypes.TERM);
|
|
319
319
|
|
|
320
320
|
let revolverDataGroup: ISummaryReportDataGroup = null;
|