gemcap-be-common 1.3.156 → 1.3.158
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/reports.db.js +7 -7
- package/db/reports.db.ts +8 -8
- package/helpers/date.helper.d.ts +3 -4
- package/helpers/date.helper.js +14 -18
- package/helpers/date.helper.ts +13 -17
- package/interfaces/task.interface.d.ts +0 -1
- package/interfaces/task.interface.js +0 -1
- package/interfaces/task.interface.ts +0 -1
- package/models/LoanStatementStatus.model.d.ts +9 -9
- package/models/_index.d.ts +6 -6
- 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/compliance-borrowers.service.d.ts +1 -1
- package/services/reports.service.js +3 -3
- package/services/reports.service.ts +4 -4
- package/tsconfig.tsbuildinfo +1 -1
package/db/reports.db.js
CHANGED
|
@@ -229,7 +229,7 @@ const getLedgerData = async (params, options = defaultReportLedgerOptions) => {
|
|
|
229
229
|
floatedBalance: statement.floatedBalance,
|
|
230
230
|
createdAt: statement['createdAt'],
|
|
231
231
|
info: statement.memo,
|
|
232
|
-
paymentDate: (0, date_helper_1.
|
|
232
|
+
paymentDate: (0, date_helper_1.convertDateToFormat)(payment.date),
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
}
|
|
@@ -270,7 +270,7 @@ const getLedgerData = async (params, options = defaultReportLedgerOptions) => {
|
|
|
270
270
|
const fullTransactions = sortedTransactions
|
|
271
271
|
.map((row) => ({
|
|
272
272
|
borrowerCode: borrowerCodesMap[productId],
|
|
273
|
-
date: (0, date_helper_1.
|
|
273
|
+
date: (0, date_helper_1.convertDateToFormat)(row.date, 'MM/DD/YYYY'),
|
|
274
274
|
type: row.isBrokerFee ? `${EChargeType[row.type]} BROKER` : EChargeType[row.type],
|
|
275
275
|
chargeCode: row.chargeCode,
|
|
276
276
|
PLCode: row.PLCode,
|
|
@@ -282,18 +282,18 @@ const getLedgerData = async (params, options = defaultReportLedgerOptions) => {
|
|
|
282
282
|
balance: row.balance,
|
|
283
283
|
floatedBalance: row.floatedBalance,
|
|
284
284
|
info: row.info,
|
|
285
|
-
paymentDate: row.paymentDate ? (0, date_helper_1.
|
|
285
|
+
paymentDate: row.paymentDate ? (0, date_helper_1.convertDateToFormat)(row.paymentDate) : '',
|
|
286
286
|
}));
|
|
287
287
|
const termLoan = await TermLoan_model_1.TermLoanModel.findOne({ productId, actual: true });
|
|
288
288
|
if (termLoan) {
|
|
289
289
|
const calculatedTermLoan = await TermLoanCalculated_model_1.TermLoanCalculatedModel.findOne({
|
|
290
290
|
termLoanId: termLoan._id.toString(),
|
|
291
|
-
relevantStatement: (0, date_helper_1.
|
|
291
|
+
relevantStatement: (0, date_helper_1.convertDateToFormat)(endDate),
|
|
292
292
|
});
|
|
293
293
|
if (calculatedTermLoan) {
|
|
294
294
|
const expectedPayment = {
|
|
295
295
|
borrowerCode: borrowerCodesMap[productId],
|
|
296
|
-
date: (0, date_helper_1.
|
|
296
|
+
date: (0, date_helper_1.convertDateToFormat)(endDate, 'MM/DD/YYYY'),
|
|
297
297
|
type: EChargeType.EXPECTED_PRINCIPAL,
|
|
298
298
|
chargeCode: null,
|
|
299
299
|
PLCode: null,
|
|
@@ -313,7 +313,7 @@ const getLedgerData = async (params, options = defaultReportLedgerOptions) => {
|
|
|
313
313
|
if (paymentDoc) {
|
|
314
314
|
const expectedPayment = {
|
|
315
315
|
borrowerCode: borrowerCodesMap[productId],
|
|
316
|
-
date: (0, date_helper_1.
|
|
316
|
+
date: (0, date_helper_1.convertDateToFormat)(endDate, 'MM/DD/YYYY'),
|
|
317
317
|
type: EChargeType.EXPECTED_PRINCIPAL_PAID,
|
|
318
318
|
chargeCode: null,
|
|
319
319
|
PLCode: null,
|
|
@@ -324,7 +324,7 @@ const getLedgerData = async (params, options = defaultReportLedgerOptions) => {
|
|
|
324
324
|
balance: null,
|
|
325
325
|
floatedBalance: null,
|
|
326
326
|
info: EChargeType.EXPECTED_PRINCIPAL_PAID,
|
|
327
|
-
paymentDate: (0, date_helper_1.
|
|
327
|
+
paymentDate: (0, date_helper_1.convertDateToFormat)(paymentDoc.date, 'MM/DD/YYYY'),
|
|
328
328
|
};
|
|
329
329
|
fullTransactions.unshift(expectedPayment);
|
|
330
330
|
}
|
package/db/reports.db.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
ILoanStatementTransactionDocWithCharge,
|
|
16
16
|
LoanStatementTransactionModel,
|
|
17
17
|
} from '../models/LoanStatementTransaction.model';
|
|
18
|
-
import {
|
|
18
|
+
import { convertDateToFormat } from '../helpers/date.helper';
|
|
19
19
|
import dayjs from 'dayjs';
|
|
20
20
|
import { getLoanChargeForProduct } from './loan-charges.db';
|
|
21
21
|
import { getLoanProductBalance } from './loan-products.db';
|
|
@@ -309,7 +309,7 @@ const getLedgerData = async (params: ReportLedgerParams, options = defaultReport
|
|
|
309
309
|
floatedBalance: statement.floatedBalance,
|
|
310
310
|
createdAt: statement['createdAt'],
|
|
311
311
|
info: statement.memo,
|
|
312
|
-
paymentDate:
|
|
312
|
+
paymentDate: convertDateToFormat(payment.date),
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
315
|
}
|
|
@@ -351,7 +351,7 @@ const getLedgerData = async (params: ReportLedgerParams, options = defaultReport
|
|
|
351
351
|
const fullTransactions = sortedTransactions
|
|
352
352
|
.map((row): ILedgerReportRow => ({
|
|
353
353
|
borrowerCode: borrowerCodesMap[productId],
|
|
354
|
-
date:
|
|
354
|
+
date: convertDateToFormat(row.date, 'MM/DD/YYYY'),
|
|
355
355
|
type: row.isBrokerFee ? `${EChargeType[row.type]} BROKER` : EChargeType[row.type],
|
|
356
356
|
chargeCode: row.chargeCode,
|
|
357
357
|
PLCode: row.PLCode,
|
|
@@ -363,19 +363,19 @@ const getLedgerData = async (params: ReportLedgerParams, options = defaultReport
|
|
|
363
363
|
balance: row.balance,
|
|
364
364
|
floatedBalance: row.floatedBalance,
|
|
365
365
|
info: row.info,
|
|
366
|
-
paymentDate: row.paymentDate ?
|
|
366
|
+
paymentDate: row.paymentDate ? convertDateToFormat(row.paymentDate) : '',
|
|
367
367
|
}));
|
|
368
368
|
|
|
369
369
|
const termLoan = await TermLoanModel.findOne({ productId, actual: true });
|
|
370
370
|
if (termLoan) {
|
|
371
371
|
const calculatedTermLoan = await TermLoanCalculatedModel.findOne({
|
|
372
372
|
termLoanId: termLoan._id.toString(),
|
|
373
|
-
relevantStatement:
|
|
373
|
+
relevantStatement: convertDateToFormat(endDate),
|
|
374
374
|
});
|
|
375
375
|
if (calculatedTermLoan) {
|
|
376
376
|
const expectedPayment = <ILedgerReportRow>{
|
|
377
377
|
borrowerCode: borrowerCodesMap[productId],
|
|
378
|
-
date:
|
|
378
|
+
date: convertDateToFormat(endDate, 'MM/DD/YYYY'),
|
|
379
379
|
type: EChargeType.EXPECTED_PRINCIPAL,
|
|
380
380
|
chargeCode: null,
|
|
381
381
|
PLCode: null,
|
|
@@ -395,7 +395,7 @@ const getLedgerData = async (params: ReportLedgerParams, options = defaultReport
|
|
|
395
395
|
if (paymentDoc) {
|
|
396
396
|
const expectedPayment = <ILedgerReportRow>{
|
|
397
397
|
borrowerCode: borrowerCodesMap[productId],
|
|
398
|
-
date:
|
|
398
|
+
date: convertDateToFormat(endDate, 'MM/DD/YYYY'),
|
|
399
399
|
type: EChargeType.EXPECTED_PRINCIPAL_PAID,
|
|
400
400
|
chargeCode: null,
|
|
401
401
|
PLCode: null,
|
|
@@ -406,7 +406,7 @@ const getLedgerData = async (params: ReportLedgerParams, options = defaultReport
|
|
|
406
406
|
balance: null,
|
|
407
407
|
floatedBalance: null,
|
|
408
408
|
info: EChargeType.EXPECTED_PRINCIPAL_PAID,
|
|
409
|
-
paymentDate:
|
|
409
|
+
paymentDate: convertDateToFormat(paymentDoc.date, 'MM/DD/YYYY'),
|
|
410
410
|
};
|
|
411
411
|
fullTransactions.unshift(expectedPayment);
|
|
412
412
|
}
|
package/helpers/date.helper.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import dayjs, { OpUnitType, QUnitType } from 'dayjs';
|
|
1
|
+
import dayjs, { Dayjs, OpUnitType, QUnitType } from 'dayjs';
|
|
2
2
|
export interface ISelectedMonth {
|
|
3
3
|
year: number;
|
|
4
4
|
month: number;
|
|
@@ -7,11 +7,10 @@ export declare const defaultDateFormat = "MM-DD-YYYY";
|
|
|
7
7
|
export declare const normalizeDate: (date: Date, type: 'start' | 'end') => Date;
|
|
8
8
|
export declare const convertAnyToDate: (date: any) => Date | null;
|
|
9
9
|
export declare const dateLessThan: (date: Date, compare: number, unit: QUnitType | OpUnitType) => boolean;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const convertDayjsToFormat: (date: Dayjs, format?: string) => string;
|
|
11
|
+
export declare const convertDateToFormat: (date: Date, format?: string) => string;
|
|
11
12
|
export declare const calculateTimeZone: (date: Date) => Date;
|
|
12
|
-
export declare const convertToDefaultFormat: (date: Date) => string;
|
|
13
13
|
export declare const excelDateToJSDate: (serial: number) => Date;
|
|
14
|
-
export declare const convertToFormat: (date: Date, format: string) => string;
|
|
15
14
|
export declare const convertSelectedMonthToDate: (selectedMonth: ISelectedMonth) => Date;
|
|
16
15
|
export declare const getStartOfMonthsBetweenDates: (startDate: Date, endDate: Date) => {
|
|
17
16
|
[dateView: string]: {
|
package/helpers/date.helper.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getShiftedMonth = exports.getDays = exports.getStartOfMonthsBetweenDates = exports.convertSelectedMonthToDate = exports.
|
|
6
|
+
exports.getShiftedMonth = exports.getDays = exports.getStartOfMonthsBetweenDates = exports.convertSelectedMonthToDate = exports.excelDateToJSDate = exports.calculateTimeZone = exports.convertDateToFormat = exports.convertDayjsToFormat = exports.dateLessThan = exports.convertAnyToDate = exports.normalizeDate = exports.defaultDateFormat = void 0;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
8
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
9
9
|
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
@@ -33,27 +33,27 @@ const convertAnyToDate = (date) => {
|
|
|
33
33
|
};
|
|
34
34
|
exports.convertAnyToDate = convertAnyToDate;
|
|
35
35
|
const dateLessThan = (date, compare, unit) => {
|
|
36
|
-
const currentDate = (0, dayjs_1.default)();
|
|
37
|
-
const nextDate = (0, dayjs_1.default)(
|
|
36
|
+
const currentDate = (0, dayjs_1.default)().utc();
|
|
37
|
+
const nextDate = (0, dayjs_1.default)(date).utc();
|
|
38
38
|
const difference = currentDate.diff(nextDate, unit);
|
|
39
39
|
return difference < compare;
|
|
40
40
|
};
|
|
41
41
|
exports.dateLessThan = dateLessThan;
|
|
42
|
-
const
|
|
43
|
-
return
|
|
42
|
+
const convertDayjsToFormat = (date, format = exports.defaultDateFormat) => {
|
|
43
|
+
return date.format(format);
|
|
44
44
|
};
|
|
45
|
-
exports.
|
|
45
|
+
exports.convertDayjsToFormat = convertDayjsToFormat;
|
|
46
|
+
const convertDateToFormat = (date, format = exports.defaultDateFormat) => {
|
|
47
|
+
return (0, exports.convertDayjsToFormat)((0, dayjs_1.default)(date).utc(), format);
|
|
48
|
+
};
|
|
49
|
+
exports.convertDateToFormat = convertDateToFormat;
|
|
46
50
|
const calculateTimeZone = (date) => {
|
|
47
51
|
if (date instanceof Date) {
|
|
48
|
-
return (0, dayjs_1.default)(date).subtract(date.getTimezoneOffset(), 'minute').toDate();
|
|
52
|
+
return (0, dayjs_1.default)(date).utc().subtract(date.getTimezoneOffset(), 'minute').toDate();
|
|
49
53
|
}
|
|
50
54
|
return date;
|
|
51
55
|
};
|
|
52
56
|
exports.calculateTimeZone = calculateTimeZone;
|
|
53
|
-
const convertToDefaultFormat = (date) => {
|
|
54
|
-
return (0, dayjs_1.default)(date).format(exports.defaultDateFormat);
|
|
55
|
-
};
|
|
56
|
-
exports.convertToDefaultFormat = convertToDefaultFormat;
|
|
57
57
|
const excelDateToJSDate = (serial) => {
|
|
58
58
|
const utcDays = Math.floor(serial - 25569);
|
|
59
59
|
const utcValue = utcDays * 86400;
|
|
@@ -67,17 +67,13 @@ const excelDateToJSDate = (serial) => {
|
|
|
67
67
|
return new Date(dateInfo.getFullYear(), dateInfo.getMonth(), dateInfo.getDate(), hours, minutes, seconds);
|
|
68
68
|
};
|
|
69
69
|
exports.excelDateToJSDate = excelDateToJSDate;
|
|
70
|
-
const convertToFormat = (date, format) => {
|
|
71
|
-
return (0, dayjs_1.default)(date).format(format);
|
|
72
|
-
};
|
|
73
|
-
exports.convertToFormat = convertToFormat;
|
|
74
70
|
const convertSelectedMonthToDate = (selectedMonth) => {
|
|
75
71
|
return dayjs_1.default.utc({ year: selectedMonth.year, month: selectedMonth.month - 1, day: 1 }).toDate();
|
|
76
72
|
};
|
|
77
73
|
exports.convertSelectedMonthToDate = convertSelectedMonthToDate;
|
|
78
74
|
const getStartOfMonthsBetweenDates = (startDate, endDate) => {
|
|
79
|
-
let start = (0, dayjs_1.default)(startDate).
|
|
80
|
-
const end = (0, dayjs_1.default)(endDate).
|
|
75
|
+
let start = (0, dayjs_1.default)(startDate).utc().startOf('month');
|
|
76
|
+
const end = (0, dayjs_1.default)(endDate).utc().startOf('month');
|
|
81
77
|
const dates = {};
|
|
82
78
|
while (start.isBefore(end) || start.isSame(end)) {
|
|
83
79
|
dates[start.format('YYYY-MM')] = { year: start.year(), month: start.month() + 1 };
|
|
@@ -95,7 +91,7 @@ const getDays = (period) => {
|
|
|
95
91
|
};
|
|
96
92
|
exports.getDays = getDays;
|
|
97
93
|
const getShiftedMonth = (month, shift) => {
|
|
98
|
-
const nextMonth = (0, dayjs_1.default)().
|
|
94
|
+
const nextMonth = (0, dayjs_1.default)().utc().year(month.year).month(month.month - 1).add(shift, 'month');
|
|
99
95
|
return { year: nextMonth.year(), month: nextMonth.month() + 1 };
|
|
100
96
|
};
|
|
101
97
|
exports.getShiftedMonth = getShiftedMonth;
|
package/helpers/date.helper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import dayjs, { OpUnitType, QUnitType } from 'dayjs';
|
|
1
|
+
import dayjs, { Dayjs, OpUnitType, QUnitType } from 'dayjs';
|
|
2
2
|
import utc from 'dayjs/plugin/utc';
|
|
3
3
|
import timezone from 'dayjs/plugin/timezone';
|
|
4
4
|
import objectSupport from 'dayjs/plugin/objectSupport';
|
|
@@ -35,27 +35,27 @@ export const convertAnyToDate = (date: any): Date | null => {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export const dateLessThan = (date: Date, compare: number, unit: QUnitType | OpUnitType) => {
|
|
38
|
-
const currentDate = dayjs();
|
|
39
|
-
const nextDate = dayjs(
|
|
38
|
+
const currentDate = dayjs().utc();
|
|
39
|
+
const nextDate = dayjs(date).utc();
|
|
40
40
|
const difference = currentDate.diff(nextDate, unit);
|
|
41
41
|
return difference < compare;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export const
|
|
45
|
-
return
|
|
44
|
+
export const convertDayjsToFormat = (date: Dayjs, format = defaultDateFormat): string => {
|
|
45
|
+
return date.format(format);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const convertDateToFormat = (date: Date, format = defaultDateFormat) => {
|
|
49
|
+
return convertDayjsToFormat(dayjs(date).utc(), format);
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
export const calculateTimeZone = (date: Date): Date => {
|
|
49
53
|
if (date instanceof Date) {
|
|
50
|
-
return dayjs(date).subtract(date.getTimezoneOffset(), 'minute').toDate();
|
|
54
|
+
return dayjs(date).utc().subtract(date.getTimezoneOffset(), 'minute').toDate();
|
|
51
55
|
}
|
|
52
56
|
return date;
|
|
53
57
|
};
|
|
54
58
|
|
|
55
|
-
export const convertToDefaultFormat = (date: Date) => {
|
|
56
|
-
return dayjs(date).format(defaultDateFormat);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
59
|
export const excelDateToJSDate = (serial: number) => {
|
|
60
60
|
const utcDays = Math.floor(serial - 25569);
|
|
61
61
|
const utcValue = utcDays * 86400;
|
|
@@ -69,10 +69,6 @@ export const excelDateToJSDate = (serial: number) => {
|
|
|
69
69
|
return new Date(dateInfo.getFullYear(), dateInfo.getMonth(), dateInfo.getDate(), hours, minutes, seconds);
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
export const convertToFormat = (date: Date, format: string) => {
|
|
73
|
-
return dayjs(date).format(format);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
72
|
export const convertSelectedMonthToDate = (selectedMonth: ISelectedMonth) => {
|
|
77
73
|
return dayjs.utc({ year: selectedMonth.year, month: selectedMonth.month - 1, day: 1 }).toDate();
|
|
78
74
|
};
|
|
@@ -80,8 +76,8 @@ export const convertSelectedMonthToDate = (selectedMonth: ISelectedMonth) => {
|
|
|
80
76
|
export const getStartOfMonthsBetweenDates = (startDate: Date, endDate: Date): {
|
|
81
77
|
[dateView: string]: { year: number; month: number }
|
|
82
78
|
} => {
|
|
83
|
-
let start = dayjs(startDate).
|
|
84
|
-
const end = dayjs(endDate).
|
|
79
|
+
let start = dayjs(startDate).utc().startOf('month');
|
|
80
|
+
const end = dayjs(endDate).utc().startOf('month');
|
|
85
81
|
const dates = {};
|
|
86
82
|
|
|
87
83
|
while (start.isBefore(end) || start.isSame(end)) {
|
|
@@ -101,6 +97,6 @@ export const getDays = (period: { start: dayjs.Dayjs, end: dayjs.Dayjs }) => {
|
|
|
101
97
|
};
|
|
102
98
|
|
|
103
99
|
export const getShiftedMonth = (month: ISelectedMonth, shift: number) => {
|
|
104
|
-
const nextMonth = dayjs().
|
|
100
|
+
const nextMonth = dayjs().utc().year(month.year).month(month.month - 1).add(shift, 'month');
|
|
105
101
|
return { year: nextMonth.year(), month: nextMonth.month() + 1 };
|
|
106
102
|
};
|
|
@@ -38,35 +38,35 @@ export declare const LoanStatementStatusSchema: mongoose.Schema<any, mongoose.Mo
|
|
|
38
38
|
createdAt: NativeDate;
|
|
39
39
|
updatedAt: NativeDate;
|
|
40
40
|
} & {
|
|
41
|
-
productId: mongoose.Types.ObjectId;
|
|
42
|
-
year: number;
|
|
43
41
|
month: number;
|
|
42
|
+
year: number;
|
|
43
|
+
productId: mongoose.Types.ObjectId;
|
|
44
44
|
__v?: number;
|
|
45
45
|
actual?: boolean;
|
|
46
|
-
locked?: boolean;
|
|
47
46
|
lastCalculated?: Date;
|
|
47
|
+
locked?: boolean;
|
|
48
48
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
49
49
|
createdAt: NativeDate;
|
|
50
50
|
updatedAt: NativeDate;
|
|
51
51
|
} & {
|
|
52
|
-
productId: mongoose.Types.ObjectId;
|
|
53
|
-
year: number;
|
|
54
52
|
month: number;
|
|
53
|
+
year: number;
|
|
54
|
+
productId: mongoose.Types.ObjectId;
|
|
55
55
|
__v?: number;
|
|
56
56
|
actual?: boolean;
|
|
57
|
-
locked?: boolean;
|
|
58
57
|
lastCalculated?: Date;
|
|
58
|
+
locked?: boolean;
|
|
59
59
|
}>> & mongoose.FlatRecord<{
|
|
60
60
|
createdAt: NativeDate;
|
|
61
61
|
updatedAt: NativeDate;
|
|
62
62
|
} & {
|
|
63
|
-
productId: mongoose.Types.ObjectId;
|
|
64
|
-
year: number;
|
|
65
63
|
month: number;
|
|
64
|
+
year: number;
|
|
65
|
+
productId: mongoose.Types.ObjectId;
|
|
66
66
|
__v?: number;
|
|
67
67
|
actual?: boolean;
|
|
68
|
-
locked?: boolean;
|
|
69
68
|
lastCalculated?: Date;
|
|
69
|
+
locked?: boolean;
|
|
70
70
|
}> & {
|
|
71
71
|
_id: mongoose.Types.ObjectId;
|
|
72
72
|
}>;
|
package/models/_index.d.ts
CHANGED
|
@@ -31,10 +31,10 @@ export declare const allSchemas: {
|
|
|
31
31
|
createdAt: NativeDate;
|
|
32
32
|
updatedAt: NativeDate;
|
|
33
33
|
} & {
|
|
34
|
-
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
35
34
|
order: number;
|
|
36
|
-
apDate: Date;
|
|
37
35
|
amount: number;
|
|
36
|
+
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
37
|
+
apDate: Date;
|
|
38
38
|
__v?: number;
|
|
39
39
|
poNumber?: string;
|
|
40
40
|
customerName?: string;
|
|
@@ -45,10 +45,10 @@ export declare const allSchemas: {
|
|
|
45
45
|
createdAt: NativeDate;
|
|
46
46
|
updatedAt: NativeDate;
|
|
47
47
|
} & {
|
|
48
|
-
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
49
48
|
order: number;
|
|
50
|
-
apDate: Date;
|
|
51
49
|
amount: number;
|
|
50
|
+
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
51
|
+
apDate: Date;
|
|
52
52
|
__v?: number;
|
|
53
53
|
poNumber?: string;
|
|
54
54
|
customerName?: string;
|
|
@@ -59,10 +59,10 @@ export declare const allSchemas: {
|
|
|
59
59
|
createdAt: NativeDate;
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
} & {
|
|
62
|
-
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
63
62
|
order: number;
|
|
64
|
-
apDate: Date;
|
|
65
63
|
amount: number;
|
|
64
|
+
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
65
|
+
apDate: Date;
|
|
66
66
|
__v?: number;
|
|
67
67
|
poNumber?: string;
|
|
68
68
|
customerName?: string;
|
package/package.json
CHANGED
|
@@ -230,7 +230,7 @@ class BorrowerSummaryService {
|
|
|
230
230
|
});
|
|
231
231
|
const revolverData = allProductsData.find((p) => p.productType === loan_types_enum_1.ELoanTypes.REVOLVER);
|
|
232
232
|
chartData.push({
|
|
233
|
-
bbc: (0, date_helper_1.
|
|
233
|
+
bbc: (0, date_helper_1.convertDateToFormat)(bbc.bbcDate),
|
|
234
234
|
revolverCollateralTotal: revolverData ? revolverData.totalCollateral : 0,
|
|
235
235
|
revolverLoanBalance: lastTransaction ? lastTransaction.balance : 0,
|
|
236
236
|
});
|
|
@@ -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,
|
|
6
|
+
import { defaultDateFormat, convertDateToFormat } 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';
|
|
@@ -253,7 +253,7 @@ export class BorrowerSummaryService {
|
|
|
253
253
|
});
|
|
254
254
|
const revolverData = allProductsData.find((p) => p.productType === ELoanTypes.REVOLVER);
|
|
255
255
|
chartData.push({
|
|
256
|
-
bbc:
|
|
256
|
+
bbc: convertDateToFormat(bbc.bbcDate),
|
|
257
257
|
revolverCollateralTotal: revolverData ? revolverData.totalCollateral : 0,
|
|
258
258
|
revolverLoanBalance: lastTransaction ? lastTransaction.balance : 0,
|
|
259
259
|
});
|
|
@@ -83,10 +83,10 @@ export declare class BorrowerService {
|
|
|
83
83
|
getBorrowerCodesMap(): Promise<Map<string, string>>;
|
|
84
84
|
getBorrowerStatementDetails(borrowers: IBorrowerDocument[]): Promise<{
|
|
85
85
|
[x: number]: {
|
|
86
|
+
SELECTED_PERIOD?: boolean;
|
|
87
|
+
ENTIRE_LOAN?: boolean;
|
|
86
88
|
LAST_MONTH?: boolean;
|
|
87
89
|
CURRENT_MONTH?: boolean;
|
|
88
|
-
ENTIRE_LOAN?: boolean;
|
|
89
|
-
SELECTED_PERIOD?: boolean;
|
|
90
90
|
TERM_LOAN?: boolean;
|
|
91
91
|
};
|
|
92
92
|
}>;
|
|
@@ -45,7 +45,7 @@ export declare class ComplianceBorrowersService {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
getFullComplianceBorrowerById(complianceBorrowerId: any): Promise<any>;
|
|
48
|
-
getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "
|
|
48
|
+
getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "borrower" | "fundingStatus" | "items"> | {
|
|
49
49
|
items: {
|
|
50
50
|
instances: any[];
|
|
51
51
|
item: import("../models/ComplianceItem.model").IComplianceItemDocument;
|
|
@@ -280,12 +280,12 @@ class ReportsService {
|
|
|
280
280
|
const emptyRow = [['']];
|
|
281
281
|
const reportHeader = [
|
|
282
282
|
['PORTFOLIO LOAN BALANCE AND COLLATERAL REPORT'],
|
|
283
|
-
[`RUN DATE ${(0, date_helper_1.
|
|
283
|
+
[`RUN DATE ${(0, date_helper_1.convertDateToFormat)(date)}`],
|
|
284
284
|
[''],
|
|
285
285
|
];
|
|
286
286
|
const reportToCovert = Object.values(report).reduce((acc, borrowerData) => {
|
|
287
287
|
const headers = [
|
|
288
|
-
[`LOAN BALANCE AND COLLATERAL REPORT ${borrowerData.borrowerName}, Last BBC date - ${(0, date_helper_1.
|
|
288
|
+
[`LOAN BALANCE AND COLLATERAL REPORT ${borrowerData.borrowerName}, Last BBC date - ${(0, date_helper_1.convertDateToFormat)(borrowerData.bbcDate)}`],
|
|
289
289
|
['', 'Gross Value', 'Advance Rate', 'Net Value'],
|
|
290
290
|
];
|
|
291
291
|
const convertToExcel = (dataGroup) => {
|
|
@@ -436,7 +436,7 @@ class ReportsService {
|
|
|
436
436
|
async getBalancesCollateralReportExcel(borrowerIds, date) {
|
|
437
437
|
const reportHeader = [
|
|
438
438
|
['PORTFOLIO LOAN BALANCE AND COLLATERAL REPORT'],
|
|
439
|
-
[`RUN DATE ${(0, date_helper_1.
|
|
439
|
+
[`RUN DATE ${(0, date_helper_1.convertDateToFormat)(date)}`],
|
|
440
440
|
[''],
|
|
441
441
|
];
|
|
442
442
|
const keyOrder = [
|
|
@@ -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,
|
|
5
|
+
import { defaultDateFormat, convertDateToFormat } 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';
|
|
@@ -375,12 +375,12 @@ export class ReportsService {
|
|
|
375
375
|
const emptyRow = [['']];
|
|
376
376
|
const reportHeader = [
|
|
377
377
|
['PORTFOLIO LOAN BALANCE AND COLLATERAL REPORT'],
|
|
378
|
-
[`RUN DATE ${
|
|
378
|
+
[`RUN DATE ${convertDateToFormat(date)}`],
|
|
379
379
|
[''],
|
|
380
380
|
];
|
|
381
381
|
const reportToCovert = Object.values(report).reduce((acc, borrowerData) => {
|
|
382
382
|
const headers = [
|
|
383
|
-
[`LOAN BALANCE AND COLLATERAL REPORT ${borrowerData.borrowerName}, Last BBC date - ${
|
|
383
|
+
[`LOAN BALANCE AND COLLATERAL REPORT ${borrowerData.borrowerName}, Last BBC date - ${convertDateToFormat(borrowerData.bbcDate)}`],
|
|
384
384
|
['', 'Gross Value', 'Advance Rate', 'Net Value'],
|
|
385
385
|
];
|
|
386
386
|
const convertToExcel = (dataGroup: ISummaryReportDataGroup) => {
|
|
@@ -546,7 +546,7 @@ export class ReportsService {
|
|
|
546
546
|
public async getBalancesCollateralReportExcel(borrowerIds: string[], date: Date) {
|
|
547
547
|
const reportHeader = [
|
|
548
548
|
['PORTFOLIO LOAN BALANCE AND COLLATERAL REPORT'],
|
|
549
|
-
[`RUN DATE ${
|
|
549
|
+
[`RUN DATE ${convertDateToFormat(date)}`],
|
|
550
550
|
[''],
|
|
551
551
|
];
|
|
552
552
|
|