gemcap-be-common 1.5.51 → 1.5.53
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/models/BBCDate.model.d.ts +2 -2
- package/models/BBCDate.model.js +2 -3
- package/models/BBCDate.model.ts +4 -5
- package/models/BBCSheet.model.js +4 -0
- package/models/BBCSheet.model.ts +5 -0
- package/models/InventoryAvailability.model.d.ts +3 -3
- package/models/InventoryAvailabilityItem.model.d.ts +3 -3
- package/models/InventoryItem.model.d.ts +18 -18
- package/models/ReceivableAvailability.model.d.ts +6 -6
- package/models/SalesItem.model.d.ts +3 -3
- package/package.json +1 -1
- package/queries/inventory/invoice-difference.js +3 -0
- package/queries/inventory/invoice-difference.ts +3 -0
- package/services/collateral-adjustments.service.js +1 -1
- package/services/collateral-adjustments.service.ts +1 -1
- package/services/equipment.service.js +3 -3
- package/services/equipment.service.ts +3 -3
- package/services/loan-transactions.service.d.ts +1 -1
- package/services/reserve.service.js +1 -1
- package/services/reserve.service.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import Joi from 'joi';
|
|
26
|
-
import mongoose
|
|
26
|
+
import mongoose from 'mongoose';
|
|
27
27
|
import { ILoanStatementStatus } from './LoanStatementStatus.model';
|
|
28
28
|
export interface ICreateBBCDate {
|
|
29
29
|
date: Date;
|
|
@@ -36,7 +36,7 @@ export interface IBBCDate {
|
|
|
36
36
|
borrowerId: mongoose.Types.ObjectId;
|
|
37
37
|
bbcDate: Date;
|
|
38
38
|
}
|
|
39
|
-
export interface IBBCDateDoc extends IBBCDate, Document {
|
|
39
|
+
export interface IBBCDateDoc extends IBBCDate, mongoose.Document {
|
|
40
40
|
}
|
|
41
41
|
export interface IBBCDateDoc extends ILoanStatementStatus, mongoose.Document {
|
|
42
42
|
_id: mongoose.Types.ObjectId;
|
package/models/BBCDate.model.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.BBCDateModel = exports.BBCDateSchema = exports.ICreateBBCDateSchema = vo
|
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
8
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
9
9
|
const _models_1 = require("./_models");
|
|
10
|
-
const BBCSheet_model_1 = require("./BBCSheet.model");
|
|
11
10
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
12
11
|
exports.ICreateBBCDateSchema = joi_1.default.object({
|
|
13
12
|
date: joi_1.default.date().required(),
|
|
@@ -28,8 +27,8 @@ exports.BBCDateSchema = new mongoose_1.default.Schema({
|
|
|
28
27
|
__v: { type: Number, select: false },
|
|
29
28
|
}, { timestamps: true });
|
|
30
29
|
exports.BBCDateSchema.plugin(mongooseLeanId);
|
|
31
|
-
|
|
30
|
+
exports.BBCDateSchema.index({
|
|
32
31
|
borrowerId: 1,
|
|
33
|
-
bbcDate: 1,
|
|
32
|
+
bbcDate: -1,
|
|
34
33
|
});
|
|
35
34
|
exports.BBCDateModel = mongoose_1.default.model(_models_1.MODEL_NAMES.BBCDates, exports.BBCDateSchema);
|
package/models/BBCDate.model.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
|
-
import mongoose
|
|
2
|
+
import mongoose from 'mongoose';
|
|
3
3
|
|
|
4
4
|
import { MODEL_NAMES } from './_models';
|
|
5
5
|
import { ILoanStatementStatus } from './LoanStatementStatus.model';
|
|
6
|
-
import { BBCSheetSchema } from './BBCSheet.model';
|
|
7
6
|
|
|
8
7
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
9
8
|
|
|
@@ -26,7 +25,7 @@ export interface IBBCDate {
|
|
|
26
25
|
bbcDate: Date;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
export interface IBBCDateDoc extends IBBCDate, Document {
|
|
28
|
+
export interface IBBCDateDoc extends IBBCDate, mongoose.Document {
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
export interface IBBCDateDoc extends ILoanStatementStatus, mongoose.Document {
|
|
@@ -68,9 +67,9 @@ export const BBCDateSchema = new mongoose.Schema(
|
|
|
68
67
|
|
|
69
68
|
BBCDateSchema.plugin(mongooseLeanId);
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
BBCDateSchema.index({
|
|
72
71
|
borrowerId: 1,
|
|
73
|
-
bbcDate: 1,
|
|
72
|
+
bbcDate: -1,
|
|
74
73
|
});
|
|
75
74
|
|
|
76
75
|
export const BBCDateModel: mongoose.Model<IBBCDateDoc> = mongoose.model<IBBCDateDoc>(MODEL_NAMES.BBCDates, BBCDateSchema);
|
package/models/BBCSheet.model.js
CHANGED
|
@@ -49,4 +49,8 @@ exports.BBCSheetSchema.pre('findOneAndDelete', async function () {
|
|
|
49
49
|
await AccountPayableItem_model_1.AccountPayableItemModel.deleteMany({ bbcSheetId: bbcSheetId });
|
|
50
50
|
await SalesItem_model_1.SalesItem.deleteMany({ bbcSheetId: bbcSheetId });
|
|
51
51
|
});
|
|
52
|
+
exports.BBCSheetSchema.index({
|
|
53
|
+
dataType: 1,
|
|
54
|
+
bbcDateId: 1,
|
|
55
|
+
});
|
|
52
56
|
exports.BBCSheetModel = mongoose_1.default.model(_models_1.MODEL_NAMES.BBCSheets, exports.BBCSheetSchema);
|
package/models/BBCSheet.model.ts
CHANGED
|
@@ -83,4 +83,9 @@ BBCSheetSchema.pre('findOneAndDelete', async function () {
|
|
|
83
83
|
await SalesItem.deleteMany({ bbcSheetId: bbcSheetId });
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
+
BBCSheetSchema.index({
|
|
87
|
+
dataType: 1,
|
|
88
|
+
bbcDateId: 1,
|
|
89
|
+
});
|
|
90
|
+
|
|
86
91
|
export const BBCSheetModel: mongoose.Model<IBBCSheetDoc> = mongoose.model<IBBCSheetDoc>(MODEL_NAMES.BBCSheets, BBCSheetSchema);
|
|
@@ -88,8 +88,8 @@ export declare const InventoryAvailabilityScheme: mongoose.Schema<any, mongoose.
|
|
|
88
88
|
createdAt: NativeDate;
|
|
89
89
|
updatedAt: NativeDate;
|
|
90
90
|
} & {
|
|
91
|
-
bbcDateId: mongoose.Types.ObjectId;
|
|
92
91
|
borrowerId: mongoose.Types.ObjectId;
|
|
92
|
+
bbcDateId: mongoose.Types.ObjectId;
|
|
93
93
|
status: string;
|
|
94
94
|
summary: mongoose.Types.DocumentArray<{
|
|
95
95
|
order: number;
|
|
@@ -121,8 +121,8 @@ export declare const InventoryAvailabilityScheme: mongoose.Schema<any, mongoose.
|
|
|
121
121
|
createdAt: NativeDate;
|
|
122
122
|
updatedAt: NativeDate;
|
|
123
123
|
} & {
|
|
124
|
-
bbcDateId: mongoose.Types.ObjectId;
|
|
125
124
|
borrowerId: mongoose.Types.ObjectId;
|
|
125
|
+
bbcDateId: mongoose.Types.ObjectId;
|
|
126
126
|
status: string;
|
|
127
127
|
summary: mongoose.Types.DocumentArray<{
|
|
128
128
|
order: number;
|
|
@@ -154,8 +154,8 @@ export declare const InventoryAvailabilityScheme: mongoose.Schema<any, mongoose.
|
|
|
154
154
|
createdAt: NativeDate;
|
|
155
155
|
updatedAt: NativeDate;
|
|
156
156
|
} & {
|
|
157
|
-
bbcDateId: mongoose.Types.ObjectId;
|
|
158
157
|
borrowerId: mongoose.Types.ObjectId;
|
|
158
|
+
bbcDateId: mongoose.Types.ObjectId;
|
|
159
159
|
status: string;
|
|
160
160
|
summary: mongoose.Types.DocumentArray<{
|
|
161
161
|
order: number;
|
|
@@ -48,8 +48,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
|
|
|
48
48
|
createdAt: NativeDate;
|
|
49
49
|
updatedAt: NativeDate;
|
|
50
50
|
} & {
|
|
51
|
-
order: number;
|
|
52
51
|
unique: boolean;
|
|
52
|
+
order: number;
|
|
53
53
|
inventoryAvailabilityId: mongoose.Types.ObjectId;
|
|
54
54
|
inventoryId: mongoose.Types.ObjectId;
|
|
55
55
|
matched: boolean;
|
|
@@ -64,8 +64,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
|
|
|
64
64
|
createdAt: NativeDate;
|
|
65
65
|
updatedAt: NativeDate;
|
|
66
66
|
} & {
|
|
67
|
-
order: number;
|
|
68
67
|
unique: boolean;
|
|
68
|
+
order: number;
|
|
69
69
|
inventoryAvailabilityId: mongoose.Types.ObjectId;
|
|
70
70
|
inventoryId: mongoose.Types.ObjectId;
|
|
71
71
|
matched: boolean;
|
|
@@ -80,8 +80,8 @@ export declare const InventoryAvailabilityItemScheme: mongoose.Schema<any, mongo
|
|
|
80
80
|
createdAt: NativeDate;
|
|
81
81
|
updatedAt: NativeDate;
|
|
82
82
|
} & {
|
|
83
|
-
order: number;
|
|
84
83
|
unique: boolean;
|
|
84
|
+
order: number;
|
|
85
85
|
inventoryAvailabilityId: mongoose.Types.ObjectId;
|
|
86
86
|
inventoryId: mongoose.Types.ObjectId;
|
|
87
87
|
matched: boolean;
|
|
@@ -84,15 +84,17 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
84
84
|
createdAt: NativeDate;
|
|
85
85
|
updatedAt: NativeDate;
|
|
86
86
|
} & {
|
|
87
|
+
value: number;
|
|
88
|
+
bbcSheetId: mongoose.Types.ObjectId;
|
|
89
|
+
order: number;
|
|
87
90
|
skuDate: Date;
|
|
88
91
|
category: string;
|
|
89
92
|
sku: string;
|
|
90
93
|
qty: number;
|
|
91
|
-
|
|
92
|
-
bbcSheetId: mongoose.Types.ObjectId;
|
|
93
|
-
order: number;
|
|
94
|
-
expiryDate?: Date;
|
|
94
|
+
__v?: number;
|
|
95
95
|
location?: string;
|
|
96
|
+
lotNumber?: string;
|
|
97
|
+
expiryDate?: Date;
|
|
96
98
|
unitCost?: number;
|
|
97
99
|
skuDescription1?: string;
|
|
98
100
|
skuDescription2?: string;
|
|
@@ -100,21 +102,21 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
100
102
|
detail1?: string;
|
|
101
103
|
detail2?: string;
|
|
102
104
|
detail3?: string;
|
|
103
|
-
__v?: number;
|
|
104
|
-
lotNumber?: string;
|
|
105
105
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
106
106
|
createdAt: NativeDate;
|
|
107
107
|
updatedAt: NativeDate;
|
|
108
108
|
} & {
|
|
109
|
+
value: number;
|
|
110
|
+
bbcSheetId: mongoose.Types.ObjectId;
|
|
111
|
+
order: number;
|
|
109
112
|
skuDate: Date;
|
|
110
113
|
category: string;
|
|
111
114
|
sku: string;
|
|
112
115
|
qty: number;
|
|
113
|
-
|
|
114
|
-
bbcSheetId: mongoose.Types.ObjectId;
|
|
115
|
-
order: number;
|
|
116
|
-
expiryDate?: Date;
|
|
116
|
+
__v?: number;
|
|
117
117
|
location?: string;
|
|
118
|
+
lotNumber?: string;
|
|
119
|
+
expiryDate?: Date;
|
|
118
120
|
unitCost?: number;
|
|
119
121
|
skuDescription1?: string;
|
|
120
122
|
skuDescription2?: string;
|
|
@@ -122,21 +124,21 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
122
124
|
detail1?: string;
|
|
123
125
|
detail2?: string;
|
|
124
126
|
detail3?: string;
|
|
125
|
-
__v?: number;
|
|
126
|
-
lotNumber?: string;
|
|
127
127
|
}>> & mongoose.FlatRecord<{
|
|
128
128
|
createdAt: NativeDate;
|
|
129
129
|
updatedAt: NativeDate;
|
|
130
130
|
} & {
|
|
131
|
+
value: number;
|
|
132
|
+
bbcSheetId: mongoose.Types.ObjectId;
|
|
133
|
+
order: number;
|
|
131
134
|
skuDate: Date;
|
|
132
135
|
category: string;
|
|
133
136
|
sku: string;
|
|
134
137
|
qty: number;
|
|
135
|
-
|
|
136
|
-
bbcSheetId: mongoose.Types.ObjectId;
|
|
137
|
-
order: number;
|
|
138
|
-
expiryDate?: Date;
|
|
138
|
+
__v?: number;
|
|
139
139
|
location?: string;
|
|
140
|
+
lotNumber?: string;
|
|
141
|
+
expiryDate?: Date;
|
|
140
142
|
unitCost?: number;
|
|
141
143
|
skuDescription1?: string;
|
|
142
144
|
skuDescription2?: string;
|
|
@@ -144,8 +146,6 @@ export declare const InventoryItemSchema: mongoose.Schema<any, mongoose.Model<an
|
|
|
144
146
|
detail1?: string;
|
|
145
147
|
detail2?: string;
|
|
146
148
|
detail3?: string;
|
|
147
|
-
__v?: number;
|
|
148
|
-
lotNumber?: string;
|
|
149
149
|
}> & {
|
|
150
150
|
_id: mongoose.Types.ObjectId;
|
|
151
151
|
}>;
|
|
@@ -184,9 +184,10 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
184
184
|
createdAt: NativeDate;
|
|
185
185
|
updatedAt: NativeDate;
|
|
186
186
|
} & {
|
|
187
|
-
bbcDateId: mongoose.Types.ObjectId;
|
|
188
187
|
borrowerId: mongoose.Types.ObjectId;
|
|
188
|
+
bbcDateId: mongoose.Types.ObjectId;
|
|
189
189
|
useManualInputs: boolean;
|
|
190
|
+
actual?: boolean;
|
|
190
191
|
__v?: number;
|
|
191
192
|
summary?: {
|
|
192
193
|
invoiceAmount: number;
|
|
@@ -210,7 +211,6 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
210
211
|
ARReserves: number;
|
|
211
212
|
ARAvailability: number;
|
|
212
213
|
};
|
|
213
|
-
actual?: boolean;
|
|
214
214
|
userCalculatedId?: string;
|
|
215
215
|
calculatedAt?: Date;
|
|
216
216
|
settings?: {
|
|
@@ -244,9 +244,10 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
244
244
|
createdAt: NativeDate;
|
|
245
245
|
updatedAt: NativeDate;
|
|
246
246
|
} & {
|
|
247
|
-
bbcDateId: mongoose.Types.ObjectId;
|
|
248
247
|
borrowerId: mongoose.Types.ObjectId;
|
|
248
|
+
bbcDateId: mongoose.Types.ObjectId;
|
|
249
249
|
useManualInputs: boolean;
|
|
250
|
+
actual?: boolean;
|
|
250
251
|
__v?: number;
|
|
251
252
|
summary?: {
|
|
252
253
|
invoiceAmount: number;
|
|
@@ -270,7 +271,6 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
270
271
|
ARReserves: number;
|
|
271
272
|
ARAvailability: number;
|
|
272
273
|
};
|
|
273
|
-
actual?: boolean;
|
|
274
274
|
userCalculatedId?: string;
|
|
275
275
|
calculatedAt?: Date;
|
|
276
276
|
settings?: {
|
|
@@ -304,9 +304,10 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
304
304
|
createdAt: NativeDate;
|
|
305
305
|
updatedAt: NativeDate;
|
|
306
306
|
} & {
|
|
307
|
-
bbcDateId: mongoose.Types.ObjectId;
|
|
308
307
|
borrowerId: mongoose.Types.ObjectId;
|
|
308
|
+
bbcDateId: mongoose.Types.ObjectId;
|
|
309
309
|
useManualInputs: boolean;
|
|
310
|
+
actual?: boolean;
|
|
310
311
|
__v?: number;
|
|
311
312
|
summary?: {
|
|
312
313
|
invoiceAmount: number;
|
|
@@ -330,7 +331,6 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
330
331
|
ARReserves: number;
|
|
331
332
|
ARAvailability: number;
|
|
332
333
|
};
|
|
333
|
-
actual?: boolean;
|
|
334
334
|
userCalculatedId?: string;
|
|
335
335
|
calculatedAt?: Date;
|
|
336
336
|
settings?: {
|
|
@@ -51,9 +51,9 @@ export declare const SalesItemSchema: mongoose.Schema<any, mongoose.Model<any, a
|
|
|
51
51
|
createdAt: NativeDate;
|
|
52
52
|
updatedAt: NativeDate;
|
|
53
53
|
} & {
|
|
54
|
-
sku: string;
|
|
55
54
|
bbcSheetId: mongoose.Types.ObjectId;
|
|
56
55
|
order: number;
|
|
56
|
+
sku: string;
|
|
57
57
|
unitsSold: number;
|
|
58
58
|
__v?: number;
|
|
59
59
|
skuName?: string;
|
|
@@ -63,9 +63,9 @@ export declare const SalesItemSchema: mongoose.Schema<any, mongoose.Model<any, a
|
|
|
63
63
|
createdAt: NativeDate;
|
|
64
64
|
updatedAt: NativeDate;
|
|
65
65
|
} & {
|
|
66
|
-
sku: string;
|
|
67
66
|
bbcSheetId: mongoose.Types.ObjectId;
|
|
68
67
|
order: number;
|
|
68
|
+
sku: string;
|
|
69
69
|
unitsSold: number;
|
|
70
70
|
__v?: number;
|
|
71
71
|
skuName?: string;
|
|
@@ -75,9 +75,9 @@ export declare const SalesItemSchema: mongoose.Schema<any, mongoose.Model<any, a
|
|
|
75
75
|
createdAt: NativeDate;
|
|
76
76
|
updatedAt: NativeDate;
|
|
77
77
|
} & {
|
|
78
|
-
sku: string;
|
|
79
78
|
bbcSheetId: mongoose.Types.ObjectId;
|
|
80
79
|
order: number;
|
|
80
|
+
sku: string;
|
|
81
81
|
unitsSold: number;
|
|
82
82
|
__v?: number;
|
|
83
83
|
skuName?: string;
|
package/package.json
CHANGED
|
@@ -23,6 +23,9 @@ const getInventoryDifference = async (params) => {
|
|
|
23
23
|
const currentBbcDate = await BBCDate_model_1.BBCDateModel.findById(bbcDateId).lean();
|
|
24
24
|
if (currentBbcDate) {
|
|
25
25
|
const previousDocuments = await (0, collaterals_db_1.getPreviousCollateralDocument)(currentBbcDate.borrowerId.toString(), currentBbcDate.bbcDate, collaterals_enum_1.ECollaterals.INVENTORY, 1);
|
|
26
|
+
if (previousDocuments.length === 0) {
|
|
27
|
+
return { addedInventories: [], removedInventories: [] };
|
|
28
|
+
}
|
|
26
29
|
const items1 = await (0, collaterals_db_1.getCollateralListByBBCAndType)(currentBbcDate._id.toString(), collaterals_enum_1.ECollaterals.INVENTORY);
|
|
27
30
|
const items2 = await (0, collaterals_db_1.getCollateralListByBBCAndType)(previousDocuments[0]._id.toString(), collaterals_enum_1.ECollaterals.INVENTORY);
|
|
28
31
|
const compareInventories = (items1, items2) => {
|
|
@@ -22,6 +22,9 @@ export const getInventoryDifference = async (params: TQueryParams) => {
|
|
|
22
22
|
const currentBbcDate = await BBCDateModel.findById(bbcDateId).lean();
|
|
23
23
|
if (currentBbcDate) {
|
|
24
24
|
const previousDocuments = await getPreviousCollateralDocument(currentBbcDate.borrowerId.toString(), currentBbcDate.bbcDate, ECollaterals.INVENTORY, 1);
|
|
25
|
+
if (previousDocuments.length === 0) {
|
|
26
|
+
return { addedInventories: [], removedInventories: [] };
|
|
27
|
+
}
|
|
25
28
|
const items1 = await getCollateralListByBBCAndType(currentBbcDate._id.toString(), ECollaterals.INVENTORY);
|
|
26
29
|
const items2 = await getCollateralListByBBCAndType(previousDocuments[0]._id.toString(), ECollaterals.INVENTORY);
|
|
27
30
|
const compareInventories = (items1: any[], items2: any[]) => {
|
|
@@ -67,7 +67,7 @@ class CollateralAdjustmentsService {
|
|
|
67
67
|
const typeSummary = { rowDef: equipmentType, amount: 0 };
|
|
68
68
|
collateralAdjustmentItems.map((item) => {
|
|
69
69
|
if (item.type === equipmentType) {
|
|
70
|
-
typeSummary.amount = new decimal_js_1.default(typeSummary.amount).add(item.amount).toNumber();
|
|
70
|
+
typeSummary.amount = new decimal_js_1.default(typeSummary.amount).add(item.amount ?? 0).toNumber();
|
|
71
71
|
}
|
|
72
72
|
return typeSummary;
|
|
73
73
|
});
|
|
@@ -80,7 +80,7 @@ export class CollateralAdjustmentsService {
|
|
|
80
80
|
const typeSummary = { rowDef: equipmentType, amount: 0 };
|
|
81
81
|
collateralAdjustmentItems.map((item) => {
|
|
82
82
|
if (item.type === equipmentType) {
|
|
83
|
-
typeSummary.amount = new Decimal(typeSummary.amount).add(item.amount).toNumber();
|
|
83
|
+
typeSummary.amount = new Decimal(typeSummary.amount).add(item.amount ?? 0).toNumber();
|
|
84
84
|
}
|
|
85
85
|
return typeSummary;
|
|
86
86
|
});
|
|
@@ -85,9 +85,9 @@ class EquipmentService {
|
|
|
85
85
|
const typeSummary = { rowDef: equipmentType, amount: 0, advanceRate: 0, availability: 0 };
|
|
86
86
|
equipmentItems.forEach((item) => {
|
|
87
87
|
if (item.type === equipmentType) {
|
|
88
|
-
typeSummary.amount = new decimal_js_1.default(typeSummary.amount).add(item.amount).toNumber();
|
|
89
|
-
typeSummary.availability = new decimal_js_1.default(item.advanceRate).mul(item.amount).add(typeSummary.availability).toNumber();
|
|
90
|
-
typeSummary.advanceRate = typeSummary.amount === 0 ? 0 : new decimal_js_1.default(typeSummary.availability).div(typeSummary.amount).toDP(4).toNumber();
|
|
88
|
+
typeSummary.amount = new decimal_js_1.default(typeSummary.amount).add(item.amount ?? 0).toNumber();
|
|
89
|
+
typeSummary.availability = new decimal_js_1.default(item.advanceRate ?? 0).mul(item.amount ?? 0).add(typeSummary.availability ?? 0).toNumber();
|
|
90
|
+
typeSummary.advanceRate = typeSummary.amount === 0 ? 0 : new decimal_js_1.default(typeSummary.availability ?? 0).div(typeSummary.amount ?? 0).toDP(4).toNumber();
|
|
91
91
|
}
|
|
92
92
|
return typeSummary;
|
|
93
93
|
}, typeSummary);
|
|
@@ -109,9 +109,9 @@ export class EquipmentService {
|
|
|
109
109
|
const typeSummary = <ISummaryItem>{ rowDef: equipmentType, amount: 0, advanceRate: 0, availability: 0 };
|
|
110
110
|
equipmentItems.forEach((item) => {
|
|
111
111
|
if (item.type === equipmentType) {
|
|
112
|
-
typeSummary.amount = new Decimal(typeSummary.amount).add(item.amount).toNumber();
|
|
113
|
-
typeSummary.availability = new Decimal(item.advanceRate).mul(item.amount).add(typeSummary.availability).toNumber();
|
|
114
|
-
typeSummary.advanceRate = typeSummary.amount === 0 ? 0 : new Decimal(typeSummary.availability).div(typeSummary.amount).toDP(4).toNumber();
|
|
112
|
+
typeSummary.amount = new Decimal(typeSummary.amount).add(item.amount ?? 0).toNumber();
|
|
113
|
+
typeSummary.availability = new Decimal(item.advanceRate ?? 0).mul(item.amount ?? 0).add(typeSummary.availability ?? 0).toNumber();
|
|
114
|
+
typeSummary.advanceRate = typeSummary.amount === 0 ? 0 : new Decimal(typeSummary.availability ?? 0).div(typeSummary.amount ?? 0).toDP(4).toNumber();
|
|
115
115
|
}
|
|
116
116
|
return typeSummary;
|
|
117
117
|
}, typeSummary);
|
|
@@ -155,7 +155,7 @@ export declare class LoanTransactionsService {
|
|
|
155
155
|
getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
|
|
156
156
|
transactionIdsToMark: string[];
|
|
157
157
|
transactions: {
|
|
158
|
-
[x: string]: (string | number | string[]
|
|
158
|
+
[x: string]: (string | number | Date | string[])[];
|
|
159
159
|
}[];
|
|
160
160
|
}>;
|
|
161
161
|
getBorrowerIdsForFile(transactionFileId: string): Promise<{
|
|
@@ -61,7 +61,7 @@ class ReserveService {
|
|
|
61
61
|
const typeSummary = { rowDef: equipmentType, amount: 0 };
|
|
62
62
|
reserveItems.forEach((item) => {
|
|
63
63
|
if (item.type === equipmentType) {
|
|
64
|
-
typeSummary.amount = new decimal_js_1.default(typeSummary.amount).add(item.amount).toNumber();
|
|
64
|
+
typeSummary.amount = new decimal_js_1.default(typeSummary.amount).add(item.amount ?? 0).toNumber();
|
|
65
65
|
}
|
|
66
66
|
return typeSummary;
|
|
67
67
|
});
|
|
@@ -64,7 +64,7 @@ export class ReserveService {
|
|
|
64
64
|
const typeSummary = { rowDef: equipmentType, amount: 0 };
|
|
65
65
|
reserveItems.forEach((item) => {
|
|
66
66
|
if (item.type === equipmentType) {
|
|
67
|
-
typeSummary.amount = new Decimal(typeSummary.amount).add(item.amount).toNumber();
|
|
67
|
+
typeSummary.amount = new Decimal(typeSummary.amount).add(item.amount ?? 0).toNumber();
|
|
68
68
|
}
|
|
69
69
|
return typeSummary;
|
|
70
70
|
});
|