gemcap-be-common 1.2.140 → 1.3.0
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/classes/bank-transaction-item.d.ts +17 -0
- package/classes/bank-transaction-item.js +64 -0
- package/classes/bank-transaction-item.ts +66 -0
- package/classes/bank-uploaded-transaction.d.ts +17 -0
- package/classes/bank-uploaded-transaction.js +35 -0
- package/classes/bank-uploaded-transaction.ts +35 -0
- package/classes/inventory-item.d.ts +41 -0
- package/classes/inventory-item.js +44 -0
- package/classes/inventory-item.ts +63 -0
- package/classes/payable-account-item.d.ts +22 -0
- package/classes/payable-account-item.js +27 -0
- package/classes/payable-account-item.ts +35 -0
- package/classes/quickbook-item.d.ts +37 -0
- package/classes/quickbook-item.js +51 -0
- package/classes/quickbook-item.ts +59 -0
- package/classes/receivable-item.d.ts +26 -0
- package/classes/receivable-item.js +28 -0
- package/classes/receivable-item.ts +38 -0
- package/constants/date-formats.contsants.d.ts +1 -0
- package/constants/date-formats.contsants.js +4 -0
- package/constants/date-formats.contsants.ts +1 -0
- package/db/brokers.db.d.ts +185 -0
- package/db/brokers.db.js +35 -2
- package/db/brokers.db.ts +34 -1
- package/db/collateral-adjustments.db.d.ts +34 -0
- package/db/collateral-adjustments.db.js +52 -0
- package/db/collateral-adjustments.db.ts +54 -0
- package/db/collaterals.db.d.ts +1 -1
- package/db/equipment.db.d.ts +40 -0
- package/db/equipment.db.js +55 -0
- package/db/equipment.db.ts +56 -0
- package/db/financial-spreading.db.ts +2 -1
- package/db/groups.d.ts +5 -0
- package/db/groups.js +57 -0
- package/db/groups.ts +52 -0
- package/db/inventories.d.ts +91 -0
- package/db/inventories.js +449 -0
- package/db/inventories.ts +481 -0
- package/db/inventory-availability.d.ts +3 -0
- package/db/inventory-availability.js +103 -0
- package/db/inventory-availability.ts +113 -0
- package/db/new-summary.d.ts +31 -0
- package/db/new-summary.js +1295 -0
- package/db/new-summary.ts +1509 -0
- package/db/payable-accounts.d.ts +30 -0
- package/db/payable-accounts.js +55 -0
- package/db/payable-accounts.ts +50 -0
- package/db/reserve.db.d.ts +34 -0
- package/db/reserve.db.js +52 -0
- package/db/reserve.db.ts +48 -0
- package/db/uploads.db.d.ts +2 -0
- package/db/uploads.db.js +29 -0
- package/db/uploads.db.ts +24 -0
- package/helpers/main.helper.d.ts +31 -0
- package/helpers/main.helper.js +63 -0
- package/helpers/main.helper.ts +63 -0
- package/models/AccountPayableItem.model.d.ts +6 -6
- package/models/AllocatedBankTransaction.model.d.ts +54 -0
- package/models/AllocatedBankTransaction.model.js +70 -0
- package/models/AllocatedBankTransaction.model.ts +94 -0
- package/models/AllocatedData.model.d.ts +33 -0
- package/models/AllocatedData.model.js +19 -0
- package/models/AllocatedData.model.ts +24 -0
- package/models/BBCDate.model.d.ts +3 -3
- package/models/BBCSheet.model.d.ts +3 -3
- package/models/Banks.model.d.ts +3 -3
- package/models/Borrower.model.d.ts +3 -3
- package/models/BorrowerData.model.d.ts +3 -3
- package/models/BorrowerDataInsurance.model.d.ts +3 -3
- package/models/BorrowerDataTerm.model.d.ts +3 -3
- package/models/BorrowerSummary.model.js +1 -1
- package/models/BorrowerSummary.model.ts +1 -1
- package/models/CalandarDay.model.d.ts +40 -0
- package/models/CalandarDay.model.js +47 -0
- package/models/CalandarDay.model.ts +61 -0
- package/models/CashAllocationProduct.model.d.ts +119 -0
- package/models/CashAllocationProduct.model.js +102 -0
- package/models/CashAllocationProduct.model.ts +112 -0
- package/models/CashAllocationReference.model.d.ts +37 -0
- package/models/CashAllocationReference.model.js +27 -0
- package/models/CashAllocationReference.model.ts +40 -0
- package/models/CollateralAdjustment.model.d.ts +51 -0
- package/models/CollateralAdjustment.model.js +61 -0
- package/models/CollateralAdjustment.model.ts +98 -0
- package/models/Company.model.d.ts +35 -0
- package/models/Company.model.js +18 -0
- package/models/Company.model.ts +29 -0
- package/models/CustomerAPGroup.model.d.ts +32 -0
- package/models/CustomerAPGroup.model.js +24 -0
- package/models/CustomerAPGroup.model.ts +31 -0
- package/models/Equipment.model.d.ts +53 -0
- package/models/Equipment.model.js +140 -0
- package/models/Equipment.model.ts +172 -0
- package/models/FinancialCompliance.model.d.ts +39 -0
- package/models/FinancialCompliance.model.js +64 -0
- package/models/FinancialCompliance.model.ts +78 -0
- package/models/FinancialComplianceBorrower.model.d.ts +58 -0
- package/models/FinancialComplianceBorrower.model.js +82 -0
- package/models/FinancialComplianceBorrower.model.ts +118 -0
- package/models/FinancialIndexes.model.d.ts +36 -0
- package/models/FinancialIndexes.model.js +27 -0
- package/models/FinancialIndexes.model.ts +37 -0
- package/models/Inventory.model.d.ts +18 -18
- package/models/InventoryAvailability.model.d.ts +21 -21
- package/models/InventoryAvailabilityItem.model.d.ts +6 -6
- package/models/InventoryItem.model.d.ts +24 -24
- package/models/InventoryManualEntry.model.d.ts +9 -9
- package/models/InventorySeasonalRates.model.d.ts +3 -3
- package/models/LoanBroker.model.d.ts +3 -3
- package/models/LoanCharges.model.d.ts +12 -12
- package/models/LoanProducts.model.d.ts +9 -9
- package/models/LoanStatementStatus.model.d.ts +35 -0
- package/models/LoanStatementStatus.model.js +34 -0
- package/models/LoanStatementStatus.model.ts +45 -0
- package/models/LoanStatementTransaction.model.d.ts +9 -9
- package/models/LoanTransactionFile.model.d.ts +41 -0
- package/models/LoanTransactionFile.model.js +44 -0
- package/models/LoanTransactionFile.model.ts +61 -0
- package/models/MappedGroup.model.d.ts +37 -0
- package/models/MappedGroup.model.js +33 -0
- package/models/MappedGroup.model.ts +46 -0
- package/models/MonthEndData.Model.d.ts +41 -0
- package/models/MonthEndData.Model.js +42 -0
- package/models/MonthEndData.Model.ts +53 -0
- package/models/OrganizationEmails.model.d.ts +44 -0
- package/models/OrganizationEmails.model.js +40 -0
- package/models/OrganizationEmails.model.ts +54 -0
- package/models/ProductBroker.model.d.ts +9 -9
- package/models/QuickbooksAccount.model.d.ts +39 -0
- package/models/QuickbooksAccount.model.js +43 -0
- package/models/QuickbooksAccount.model.ts +57 -0
- package/models/Receivable.model.d.ts +12 -12
- package/models/ReceivableAvailability.model.d.ts +54 -54
- package/models/ReceivableAvailabilityItem.model.d.ts +57 -57
- package/models/ReceivableItem.model.d.ts +6 -6
- package/models/Reserve.model.d.ts +51 -0
- package/models/Reserve.model.js +96 -0
- package/models/Reserve.model.ts +125 -0
- package/models/TermLoan.model.d.ts +3 -3
- package/models/TermLoanCalculated.model.d.ts +6 -6
- package/models/TransactionAttachedFile.Model.d.ts +35 -0
- package/models/TransactionAttachedFile.Model.js +37 -0
- package/models/TransactionAttachedFile.Model.ts +48 -0
- package/models/UploadedBankTransaction.model.d.ts +56 -0
- package/models/UploadedBankTransaction.model.js +78 -0
- package/models/UploadedBankTransaction.model.ts +110 -0
- package/models/UploadedData.model.d.ts +36 -0
- package/models/UploadedData.model.js +23 -0
- package/models/UploadedData.model.ts +35 -0
- package/models/UploadedFile.model.d.ts +40 -0
- package/models/UploadedFile.model.js +41 -0
- package/models/UploadedFile.model.ts +57 -0
- package/models/UploadedSheet.model.d.ts +46 -0
- package/models/UploadedSheet.model.js +27 -0
- package/models/UploadedSheet.model.ts +51 -0
- package/package.json +10 -1
- package/repositories/globals.repository.d.ts +8 -0
- package/repositories/globals.repository.js +24 -0
- package/repositories/globals.repository.ts +21 -0
- package/services/attached-files.service.d.ts +57 -0
- package/services/attached-files.service.js +103 -0
- package/services/attached-files.service.ts +123 -0
- package/services/availability.service.d.ts +77 -0
- package/services/availability.service.js +897 -0
- package/services/availability.service.ts +1034 -0
- package/services/bank-uploaded-transactions.service.d.ts +33 -0
- package/services/bank-uploaded-transactions.service.js +430 -0
- package/services/bank-uploaded-transactions.service.ts +475 -0
- package/services/banks.service.d.ts +36 -0
- package/services/banks.service.js +91 -0
- package/services/banks.service.ts +95 -0
- package/services/borrower-summary.service.d.ts +35 -0
- package/services/borrower-summary.service.js +310 -0
- package/services/borrower-summary.service.ts +334 -0
- package/services/borrowers.service.d.ts +103 -0
- package/services/borrowers.service.js +268 -0
- package/services/borrowers.service.ts +302 -0
- package/services/brokers.service.d.ts +212 -0
- package/services/brokers.service.js +160 -0
- package/services/brokers.service.ts +200 -0
- package/services/calendar.service.d.ts +53 -0
- package/services/calendar.service.js +108 -0
- package/services/calendar.service.ts +128 -0
- package/services/cash-allocation.service.d.ts +40 -0
- package/services/cash-allocation.service.js +92 -0
- package/services/cash-allocation.service.ts +105 -0
- package/services/collateral-adjustments.service.d.ts +38 -0
- package/services/collateral-adjustments.service.js +82 -0
- package/services/collateral-adjustments.service.ts +95 -0
- package/services/collaterals.service.d.ts +69 -0
- package/services/collaterals.service.js +279 -0
- package/services/collaterals.service.ts +319 -0
- package/services/companies.service.d.ts +5 -0
- package/services/companies.service.js +21 -0
- package/services/companies.service.ts +23 -0
- package/services/compliance-borrowers.service.d.ts +152 -0
- package/services/compliance-borrowers.service.js +569 -0
- package/services/compliance-borrowers.service.ts +617 -0
- package/services/equipment.service.d.ts +42 -0
- package/services/equipment.service.js +120 -0
- package/services/equipment.service.ts +149 -0
- package/services/file-manager.service.d.ts +44 -0
- package/services/file-manager.service.js +120 -0
- package/services/file-manager.service.ts +146 -0
- package/services/financial-compliance.service.d.ts +58 -0
- package/services/financial-compliance.service.js +281 -0
- package/services/financial-compliance.service.ts +309 -0
- package/services/financial-indexes.service.d.ts +20 -0
- package/services/financial-indexes.service.js +241 -0
- package/services/financial-indexes.service.ts +257 -0
- package/services/financial-spreading.service.d.ts +74 -0
- package/services/financial-spreading.service.js +450 -0
- package/services/financial-spreading.service.ts +517 -0
- package/services/globals.service.d.ts +5 -0
- package/services/globals.service.js +11 -0
- package/services/globals.service.ts +8 -0
- package/services/groups.service.d.ts +39 -0
- package/services/groups.service.js +65 -0
- package/services/groups.service.ts +64 -0
- package/services/inventory-availability.service.d.ts +13 -0
- package/services/inventory-availability.service.js +170 -0
- package/services/inventory-availability.service.ts +187 -0
- package/services/inventory.service.d.ts +118 -0
- package/services/inventory.service.js +239 -0
- package/services/inventory.service.ts +276 -0
- package/services/loan-charges.service.d.ts +83 -0
- package/services/loan-charges.service.js +343 -0
- package/services/loan-charges.service.ts +396 -0
- package/services/loan-payments.service.d.ts +94 -0
- package/services/loan-payments.service.js +485 -0
- package/services/loan-payments.service.ts +541 -0
- package/services/loan-products.service.d.ts +12 -0
- package/services/loan-products.service.js +55 -0
- package/services/loan-products.service.ts +58 -0
- package/services/loan-statement-balance.service.d.ts +16 -0
- package/services/loan-statement-balance.service.js +106 -0
- package/services/loan-statement-balance.service.ts +113 -0
- package/services/loan-statement-effects.service.d.ts +8 -0
- package/services/loan-statement-effects.service.js +42 -0
- package/services/loan-statement-effects.service.ts +41 -0
- package/services/loan-statement-status.service.d.ts +208 -0
- package/services/loan-statement-status.service.js +159 -0
- package/services/loan-statement-status.service.ts +177 -0
- package/services/loan-statement.service.d.ts +186 -0
- package/services/loan-statement.service.js +935 -0
- package/services/loan-statement.service.ts +1040 -0
- package/services/loan-transactions.service.d.ts +169 -0
- package/services/loan-transactions.service.js +941 -0
- package/services/loan-transactions.service.ts +1042 -0
- package/services/lock.service.d.ts +6 -0
- package/services/lock.service.js +45 -0
- package/services/lock.service.ts +45 -0
- package/services/manual-entry.service.d.ts +20 -0
- package/services/manual-entry.service.js +186 -0
- package/services/manual-entry.service.ts +201 -0
- package/services/month-end-data.service.d.ts +34 -0
- package/services/month-end-data.service.js +30 -0
- package/services/month-end-data.service.ts +35 -0
- package/services/nodemailer.service.d.ts +96 -0
- package/services/nodemailer.service.js +689 -0
- package/services/nodemailer.service.ts +774 -0
- package/services/organization-emails.service.d.ts +31 -0
- package/services/organization-emails.service.js +10 -0
- package/services/organization-emails.service.ts +7 -0
- package/services/organizations.service.d.ts +34 -0
- package/services/organizations.service.js +74 -0
- package/services/organizations.service.ts +84 -0
- package/services/pdf.service.d.ts +61 -0
- package/services/pdf.service.js +547 -0
- package/services/pdf.service.ts +642 -0
- package/services/quickbooks.service.d.ts +99 -0
- package/services/quickbooks.service.js +640 -0
- package/services/quickbooks.service.ts +734 -0
- package/services/reports/investor-summary.service.d.ts +28 -0
- package/services/reports/investor-summary.service.js +136 -0
- package/services/reports/investor-summary.service.ts +159 -0
- package/services/reports.service.d.ts +126 -0
- package/services/reports.service.js +584 -0
- package/services/reports.service.ts +702 -0
- package/services/reserve.service.d.ts +37 -0
- package/services/reserve.service.js +76 -0
- package/services/reserve.service.ts +79 -0
- package/services/sentry.service.d.ts +11 -0
- package/services/sentry.service.js +49 -0
- package/services/sentry.service.ts +33 -0
- package/services/signs.service.d.ts +69 -0
- package/services/signs.service.js +230 -0
- package/services/signs.service.ts +260 -0
- package/services/term-loan.service.d.ts +30 -0
- package/services/term-loan.service.js +614 -0
- package/services/term-loan.service.ts +696 -0
- package/services/uploads.service.d.ts +134 -0
- package/services/uploads.service.js +587 -0
- package/services/uploads.service.ts +643 -0
- package/services/user-logs.service.d.ts +23 -0
- package/services/user-logs.service.js +160 -0
- package/services/user-logs.service.ts +177 -0
- package/services/users.service.d.ts +4 -4
- package/services/yield.service.d.ts +46 -0
- package/services/yield.service.js +42 -12
- package/services/yield.service.ts +38 -8
- package/tsconfig.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { IBorrowerGroupWithId } from '../interfaces/group.interface';
|
|
2
|
+
import { ICustomerGroupDocument } from '../models/CustomerGroup.model';
|
|
3
|
+
import { groupsMap } from '../db/groups.db';
|
|
4
|
+
|
|
5
|
+
import MappedGroup, { IMappedGroup } from '../models/MappedGroup.model';
|
|
6
|
+
|
|
7
|
+
export class GroupsService {
|
|
8
|
+
async createBorrowerGroups(borrowerId: string, groupType: string, groups: IBorrowerGroupWithId[]) {
|
|
9
|
+
const groupIds = groups.map((group) => group._id);
|
|
10
|
+
const allExistedGroups: ICustomerGroupDocument[] = await groupsMap[groupType].Model.find({ borrowerId }).lean();
|
|
11
|
+
await Promise.all(allExistedGroups.map(async (group) => {
|
|
12
|
+
if (!groupIds.includes(group.id)) {
|
|
13
|
+
await groupsMap[groupType].Model.findByIdAndDelete(group.id);
|
|
14
|
+
}
|
|
15
|
+
}))
|
|
16
|
+
await Promise.all(groups.map(async (group) => {
|
|
17
|
+
if (!group._id) {
|
|
18
|
+
const newGroup = new groupsMap[groupType].Model(group);
|
|
19
|
+
await newGroup.save();
|
|
20
|
+
} else {
|
|
21
|
+
await groupsMap[groupType].Model.findByIdAndUpdate(group._id, group);
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async getBorrowerGroups(borrowerId: string, relationshipGroups: string | string[]) {
|
|
27
|
+
if (typeof relationshipGroups == 'string') {
|
|
28
|
+
relationshipGroups = [relationshipGroups];
|
|
29
|
+
}
|
|
30
|
+
const allCustomerGroups = await Promise.all(relationshipGroups.map(async (groupName) => {
|
|
31
|
+
const groups = await groupsMap[groupName].Model.find({ borrowerId }).sort({ 'createdAt': 1 });
|
|
32
|
+
return { [groupName]: groups };
|
|
33
|
+
}))
|
|
34
|
+
return allCustomerGroups.reduce((acc, group) => {
|
|
35
|
+
return { ...acc, ...group };
|
|
36
|
+
}, {});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async createMappedGroups(borrowerId: string, groupType: string, groups: IMappedGroup[]) {
|
|
40
|
+
await MappedGroup.deleteMany({ borrowerId, groupType });
|
|
41
|
+
await Promise.all(groups.map(async (group) => {
|
|
42
|
+
const newMappedGroup = new MappedGroup({
|
|
43
|
+
borrowerId,
|
|
44
|
+
group1: group.group1,
|
|
45
|
+
group2: group.group2,
|
|
46
|
+
groupType: groupType,
|
|
47
|
+
});
|
|
48
|
+
await newMappedGroup.save();
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async getMappedGroups(borrowerId: string, groupTypes: string | string[]) {
|
|
53
|
+
if (typeof groupTypes == 'string') {
|
|
54
|
+
groupTypes = [groupTypes];
|
|
55
|
+
}
|
|
56
|
+
const allMappedGroups = await Promise.all(groupTypes.map(async (groupType) => {
|
|
57
|
+
const groups = await MappedGroup.find({ borrowerId, groupType });
|
|
58
|
+
return { [groupType]: groups };
|
|
59
|
+
}))
|
|
60
|
+
return allMappedGroups.reduce((acc, group) => {
|
|
61
|
+
return { ...acc, ...group };
|
|
62
|
+
}, {});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IInventoryAvailability, IInventoryAvailabilityDocument, InventoryAvailabilityPaginators } from '../models/InventoryAvailability.model';
|
|
2
|
+
import { ManualEntryService } from './manual-entry.service';
|
|
3
|
+
export declare class InventoryAvailabilityService {
|
|
4
|
+
private readonly manualEntryService;
|
|
5
|
+
constructor(manualEntryService: ManualEntryService);
|
|
6
|
+
getLatestBBCFilters(excludedBBCDateId: string): Promise<import("../models/InventoryAvailability.model").IInventoryFilter[]>;
|
|
7
|
+
getInventoryAvailability(bbcDateId: string, paginators: InventoryAvailabilityPaginators): Promise<Partial<IInventoryAvailabilityDocument>>;
|
|
8
|
+
getInventoryAvailabilityFilters(bbcDateId: string): Promise<IInventoryAvailabilityDocument>;
|
|
9
|
+
updateInventoryAvailabilityFilters(inventoryAvailability: IInventoryAvailability): Promise<IInventoryAvailabilityDocument>;
|
|
10
|
+
getAllInventorySettings(bbcDateId: string, borrowerId: string): Promise<any>;
|
|
11
|
+
checkCreateAvailability(bbcDateId: string): Promise<void>;
|
|
12
|
+
toggleManualInventoryAvailability(bbcDateId: string, useManualInputs: boolean): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InventoryAvailabilityService = void 0;
|
|
7
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
10
|
+
const inventory_availability_db_1 = require("../db/inventory-availability.db");
|
|
11
|
+
const bbcDates_db_1 = require("../db/bbcDates.db");
|
|
12
|
+
const BBCDate_model_1 = require("../models/BBCDate.model");
|
|
13
|
+
const inventory_availability_results_enum_1 = require("../enums/inventory-availability-results.enum");
|
|
14
|
+
const InventoryAvailability_model_1 = require("../models/InventoryAvailability.model");
|
|
15
|
+
const inventory_availability_1 = require("../db/inventory-availability");
|
|
16
|
+
const availability_service_1 = require("./availability.service");
|
|
17
|
+
class InventoryAvailabilityService {
|
|
18
|
+
manualEntryService;
|
|
19
|
+
constructor(manualEntryService) {
|
|
20
|
+
this.manualEntryService = manualEntryService;
|
|
21
|
+
}
|
|
22
|
+
async getLatestBBCFilters(excludedBBCDateId) {
|
|
23
|
+
const bbcDateDoc = await BBCDate_model_1.BBCDateModel.findById(excludedBBCDateId).lean();
|
|
24
|
+
if (!bbcDateDoc) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const latestBBCDate = await BBCDate_model_1.BBCDateModel.aggregate([
|
|
28
|
+
{
|
|
29
|
+
$match: {
|
|
30
|
+
'_id': { $ne: new mongoose_1.default.Types.ObjectId(excludedBBCDateId) },
|
|
31
|
+
'borrowerId': new mongoose_1.default.Types.ObjectId(bbcDateDoc.borrowerId),
|
|
32
|
+
},
|
|
33
|
+
}, {
|
|
34
|
+
$sort: {
|
|
35
|
+
'bbcDate': -1,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
39
|
+
if (latestBBCDate.length === 0) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
for (const bbcDate of latestBBCDate) {
|
|
43
|
+
const availability = await this.getInventoryAvailabilityFilters(bbcDate._id.toString());
|
|
44
|
+
if (!!availability) {
|
|
45
|
+
return availability.filters;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
async getInventoryAvailability(bbcDateId, paginators) {
|
|
51
|
+
const availability = await this.getInventoryAvailabilityFilters(bbcDateId);
|
|
52
|
+
const { borrowerId } = await (0, bbcDates_db_1.getBBCDateDoc)(bbcDateId);
|
|
53
|
+
if (!availability) {
|
|
54
|
+
const lastFilters = await this.getLatestBBCFilters(bbcDateId);
|
|
55
|
+
const newAvailability = {
|
|
56
|
+
bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId),
|
|
57
|
+
borrowerId: new mongoose_1.default.Types.ObjectId(borrowerId),
|
|
58
|
+
filters: lastFilters,
|
|
59
|
+
options: { maxAdvanceRatePriority: true },
|
|
60
|
+
useManualInputs: false,
|
|
61
|
+
results: {
|
|
62
|
+
[inventory_availability_results_enum_1.EInventoryAvailabilityResults.UNIQ_ITEMS]: {
|
|
63
|
+
items: [],
|
|
64
|
+
totalItems: 0,
|
|
65
|
+
paginatorOptions: paginators[inventory_availability_results_enum_1.EInventoryAvailabilityResults.UNIQ_ITEMS],
|
|
66
|
+
},
|
|
67
|
+
[inventory_availability_results_enum_1.EInventoryAvailabilityResults.NON_UNIQ_ITEMS]: {
|
|
68
|
+
items: [],
|
|
69
|
+
totalItems: 0,
|
|
70
|
+
paginatorOptions: paginators[inventory_availability_results_enum_1.EInventoryAvailabilityResults.NON_UNIQ_ITEMS],
|
|
71
|
+
},
|
|
72
|
+
[inventory_availability_results_enum_1.EInventoryAvailabilityResults.NOT_MATCHED_ITEMS]: {
|
|
73
|
+
items: [],
|
|
74
|
+
totalItems: 0,
|
|
75
|
+
paginatorOptions: paginators[inventory_availability_results_enum_1.EInventoryAvailabilityResults.NOT_MATCHED_ITEMS],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
summary: [],
|
|
79
|
+
};
|
|
80
|
+
return newAvailability;
|
|
81
|
+
}
|
|
82
|
+
const items = await (0, inventory_availability_1.getInventoryAvailabilityItems)(String(availability._id), paginators);
|
|
83
|
+
availability.results = { ...availability.results, ...items };
|
|
84
|
+
return availability;
|
|
85
|
+
}
|
|
86
|
+
async getInventoryAvailabilityFilters(bbcDateId) {
|
|
87
|
+
return await (0, inventory_availability_db_1.getInventoryAvailabilityByBBCDateId)(bbcDateId);
|
|
88
|
+
}
|
|
89
|
+
async updateInventoryAvailabilityFilters(inventoryAvailability) {
|
|
90
|
+
return await (0, inventory_availability_1.createInventoryAvailability)(inventoryAvailability);
|
|
91
|
+
}
|
|
92
|
+
async getAllInventorySettings(bbcDateId = null, borrowerId) {
|
|
93
|
+
const availabilities = await InventoryAvailability_model_1.InventoryAvailabilityModel.aggregate([
|
|
94
|
+
{
|
|
95
|
+
$match: {
|
|
96
|
+
$and: [
|
|
97
|
+
{ 'borrowerId': new mongoose_1.default.Types.ObjectId(borrowerId) },
|
|
98
|
+
{ 'bbcDateId': { '$ne': new mongoose_1.default.Types.ObjectId(bbcDateId) } },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
]);
|
|
103
|
+
return availabilities.reduce((acc, availability) => {
|
|
104
|
+
const settings = lodash_1.default.pick(availability, ['filters', 'options']);
|
|
105
|
+
return { ...acc, [availability.bbcDateId.toString()]: settings };
|
|
106
|
+
}, {});
|
|
107
|
+
}
|
|
108
|
+
async checkCreateAvailability(bbcDateId) {
|
|
109
|
+
const inventoryAvailability = await (0, inventory_availability_db_1.getInventoryAvailabilityByBBCDateId)(bbcDateId);
|
|
110
|
+
if (inventoryAvailability) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const newAvailability = await this.getInventoryAvailability(bbcDateId, availability_service_1.START_PAGINATORS);
|
|
114
|
+
if (newAvailability) {
|
|
115
|
+
await (0, inventory_availability_1.createInventoryAvailability)(newAvailability);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async toggleManualInventoryAvailability(bbcDateId, useManualInputs) {
|
|
119
|
+
await this.checkCreateAvailability(bbcDateId);
|
|
120
|
+
await (0, inventory_availability_db_1.setManualInputsToggle)(bbcDateId, useManualInputs);
|
|
121
|
+
const inventoryAvailability = await (0, inventory_availability_db_1.getInventoryAvailabilityByBBCDateId)(bbcDateId);
|
|
122
|
+
if (!inventoryAvailability) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (useManualInputs) {
|
|
126
|
+
const manualRates = await this.manualEntryService.getInventoryManualEntry(bbcDateId);
|
|
127
|
+
const summaryTotal = {
|
|
128
|
+
advanceRate: 0,
|
|
129
|
+
availability: 0,
|
|
130
|
+
inventoryName: 'TOTAL',
|
|
131
|
+
isGroup: false,
|
|
132
|
+
order: 1000,
|
|
133
|
+
totalQty: 0,
|
|
134
|
+
totalValue: 0,
|
|
135
|
+
};
|
|
136
|
+
const newSummary = manualRates.items.map((item, order) => {
|
|
137
|
+
return {
|
|
138
|
+
order,
|
|
139
|
+
isGroup: false,
|
|
140
|
+
inventoryName: item.inventoryName,
|
|
141
|
+
totalQty: item.totalQty,
|
|
142
|
+
totalValue: item.totalValue,
|
|
143
|
+
advanceRate: new decimal_js_1.default(item.advanceRate).div(100).toDP(2).toNumber(),
|
|
144
|
+
availability: item.availability,
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
const updateSummaryTotal = (summaryTotal, item) => {
|
|
148
|
+
summaryTotal.availability += item.availability;
|
|
149
|
+
summaryTotal.totalQty += item.totalQty;
|
|
150
|
+
summaryTotal.totalValue += item.totalValue;
|
|
151
|
+
if (summaryTotal.totalValue) {
|
|
152
|
+
summaryTotal.advanceRate = summaryTotal.availability / summaryTotal.totalValue;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
summaryTotal.advanceRate = 0;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
newSummary.forEach((item) => updateSummaryTotal(summaryTotal, item));
|
|
159
|
+
summaryTotal.availability = new decimal_js_1.default(summaryTotal.availability).toDP(2).toNumber();
|
|
160
|
+
summaryTotal.totalQty = new decimal_js_1.default(summaryTotal.totalQty).toDP(2).toNumber();
|
|
161
|
+
summaryTotal.totalValue = new decimal_js_1.default(summaryTotal.totalValue).toDP(2).toNumber();
|
|
162
|
+
summaryTotal.advanceRate = new decimal_js_1.default(summaryTotal.advanceRate).toDP(2).toNumber();
|
|
163
|
+
await (0, inventory_availability_db_1.saveInventoryAvailabilitySummary)(String(inventoryAvailability._id), [...newSummary, summaryTotal]);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
await (0, inventory_availability_db_1.saveInventoryAvailabilitySummary)(String(inventoryAvailability._id), []);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.InventoryAvailabilityService = InventoryAvailabilityService;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getInventoryAvailabilityByBBCDateId,
|
|
7
|
+
saveInventoryAvailabilitySummary,
|
|
8
|
+
setManualInputsToggle,
|
|
9
|
+
} from '../db/inventory-availability.db';
|
|
10
|
+
import { getBBCDateDoc } from '../db/bbcDates.db';
|
|
11
|
+
import { BBCDateModel, IBBCDateDoc } from '../models/BBCDate.model';
|
|
12
|
+
import { EInventoryAvailabilityResults } from '../enums/inventory-availability-results.enum';
|
|
13
|
+
import {
|
|
14
|
+
IInventoryAvailability,
|
|
15
|
+
IInventoryAvailabilityDocument, IInventoryAvailabilityResults,
|
|
16
|
+
IInventoryAvailabilitySummary, InventoryAvailabilityModel,
|
|
17
|
+
InventoryAvailabilityPaginators,
|
|
18
|
+
} from '../models/InventoryAvailability.model';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
createInventoryAvailability,
|
|
22
|
+
getInventoryAvailabilityItems,
|
|
23
|
+
} from '../db/inventory-availability';
|
|
24
|
+
import { ManualEntryService } from './manual-entry.service';
|
|
25
|
+
import { START_PAGINATORS } from './availability.service';
|
|
26
|
+
|
|
27
|
+
export class InventoryAvailabilityService {
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
private readonly manualEntryService: ManualEntryService,
|
|
31
|
+
) {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async getLatestBBCFilters(excludedBBCDateId: string) {
|
|
35
|
+
const bbcDateDoc = await BBCDateModel.findById(excludedBBCDateId).lean();
|
|
36
|
+
if (!bbcDateDoc) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
const latestBBCDate = await BBCDateModel.aggregate<IBBCDateDoc>([
|
|
40
|
+
{
|
|
41
|
+
$match: {
|
|
42
|
+
'_id': { $ne: new mongoose.Types.ObjectId(excludedBBCDateId) },
|
|
43
|
+
'borrowerId': new mongoose.Types.ObjectId(bbcDateDoc.borrowerId),
|
|
44
|
+
},
|
|
45
|
+
}, {
|
|
46
|
+
$sort: {
|
|
47
|
+
'bbcDate': -1,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
if (latestBBCDate.length === 0) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
for (const bbcDate of latestBBCDate) {
|
|
55
|
+
const availability = await this.getInventoryAvailabilityFilters(bbcDate._id.toString());
|
|
56
|
+
if (!!availability) {
|
|
57
|
+
return availability.filters;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async getInventoryAvailability(bbcDateId: string, paginators: InventoryAvailabilityPaginators) {
|
|
64
|
+
const availability = await this.getInventoryAvailabilityFilters(bbcDateId);
|
|
65
|
+
const { borrowerId } = await getBBCDateDoc(bbcDateId);
|
|
66
|
+
if (!availability) {
|
|
67
|
+
const lastFilters = await this.getLatestBBCFilters(bbcDateId);
|
|
68
|
+
const newAvailability: Partial<IInventoryAvailabilityDocument> = {
|
|
69
|
+
bbcDateId: new mongoose.Types.ObjectId(bbcDateId),
|
|
70
|
+
borrowerId: new mongoose.Types.ObjectId(borrowerId),
|
|
71
|
+
filters: lastFilters,
|
|
72
|
+
options: { maxAdvanceRatePriority: true },
|
|
73
|
+
useManualInputs: false,
|
|
74
|
+
results: {
|
|
75
|
+
[EInventoryAvailabilityResults.UNIQ_ITEMS]: {
|
|
76
|
+
items: [],
|
|
77
|
+
totalItems: 0,
|
|
78
|
+
paginatorOptions: paginators[EInventoryAvailabilityResults.UNIQ_ITEMS],
|
|
79
|
+
},
|
|
80
|
+
[EInventoryAvailabilityResults.NON_UNIQ_ITEMS]: {
|
|
81
|
+
items: [],
|
|
82
|
+
totalItems: 0,
|
|
83
|
+
paginatorOptions: paginators[EInventoryAvailabilityResults.NON_UNIQ_ITEMS],
|
|
84
|
+
},
|
|
85
|
+
[EInventoryAvailabilityResults.NOT_MATCHED_ITEMS]: {
|
|
86
|
+
items: [],
|
|
87
|
+
totalItems: 0,
|
|
88
|
+
paginatorOptions: paginators[EInventoryAvailabilityResults.NOT_MATCHED_ITEMS],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
summary: [],
|
|
92
|
+
};
|
|
93
|
+
return newAvailability;
|
|
94
|
+
}
|
|
95
|
+
const items = await getInventoryAvailabilityItems(String(availability._id), paginators);
|
|
96
|
+
availability.results = (<IInventoryAvailabilityResults>{ ...availability.results, ...items });
|
|
97
|
+
return availability;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async getInventoryAvailabilityFilters(bbcDateId: string) {
|
|
101
|
+
return await getInventoryAvailabilityByBBCDateId(bbcDateId);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async updateInventoryAvailabilityFilters(inventoryAvailability: IInventoryAvailability) {
|
|
105
|
+
return await createInventoryAvailability(inventoryAvailability);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async getAllInventorySettings(bbcDateId: string = null, borrowerId: string) {
|
|
109
|
+
const availabilities = await InventoryAvailabilityModel.aggregate([
|
|
110
|
+
{
|
|
111
|
+
$match: {
|
|
112
|
+
$and: [
|
|
113
|
+
{ 'borrowerId': new mongoose.Types.ObjectId(borrowerId) },
|
|
114
|
+
{ 'bbcDateId': { '$ne': new mongoose.Types.ObjectId(bbcDateId) } },
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
return availabilities.reduce((acc, availability) => {
|
|
120
|
+
const settings = _.pick(availability, ['filters', 'options']);
|
|
121
|
+
return { ...acc, [availability.bbcDateId.toString()]: settings };
|
|
122
|
+
}, {});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async checkCreateAvailability(bbcDateId: string) {
|
|
126
|
+
const inventoryAvailability = await getInventoryAvailabilityByBBCDateId(bbcDateId);
|
|
127
|
+
if (inventoryAvailability) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const newAvailability = await this.getInventoryAvailability(bbcDateId, START_PAGINATORS);
|
|
131
|
+
if (newAvailability) {
|
|
132
|
+
await createInventoryAvailability(newAvailability);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async toggleManualInventoryAvailability(bbcDateId: string, useManualInputs: boolean) {
|
|
137
|
+
await this.checkCreateAvailability(bbcDateId);
|
|
138
|
+
await setManualInputsToggle(bbcDateId, useManualInputs);
|
|
139
|
+
const inventoryAvailability = await getInventoryAvailabilityByBBCDateId(bbcDateId);
|
|
140
|
+
if (!inventoryAvailability) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (useManualInputs) {
|
|
144
|
+
const manualRates = await this.manualEntryService.getInventoryManualEntry(bbcDateId);
|
|
145
|
+
const summaryTotal: IInventoryAvailabilitySummary = {
|
|
146
|
+
advanceRate: 0,
|
|
147
|
+
availability: 0,
|
|
148
|
+
inventoryName: 'TOTAL',
|
|
149
|
+
isGroup: false,
|
|
150
|
+
order: 1000,
|
|
151
|
+
totalQty: 0,
|
|
152
|
+
totalValue: 0,
|
|
153
|
+
};
|
|
154
|
+
const newSummary = manualRates.items.map((item, order) => {
|
|
155
|
+
return <IInventoryAvailabilitySummary>{
|
|
156
|
+
order,
|
|
157
|
+
isGroup: false,
|
|
158
|
+
inventoryName: item.inventoryName,
|
|
159
|
+
totalQty: item.totalQty,
|
|
160
|
+
totalValue: item.totalValue,
|
|
161
|
+
advanceRate: new Decimal(item.advanceRate).div(100).toDP(2).toNumber(),
|
|
162
|
+
availability: item.availability,
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const updateSummaryTotal = (summaryTotal: IInventoryAvailabilitySummary, item: IInventoryAvailabilitySummary) => {
|
|
167
|
+
summaryTotal.availability += item.availability;
|
|
168
|
+
summaryTotal.totalQty += item.totalQty;
|
|
169
|
+
summaryTotal.totalValue += item.totalValue;
|
|
170
|
+
if (summaryTotal.totalValue) {
|
|
171
|
+
summaryTotal.advanceRate = summaryTotal.availability / summaryTotal.totalValue;
|
|
172
|
+
} else {
|
|
173
|
+
summaryTotal.advanceRate = 0;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
newSummary.forEach((item) => updateSummaryTotal(summaryTotal, item));
|
|
178
|
+
summaryTotal.availability = new Decimal(summaryTotal.availability).toDP(2).toNumber();
|
|
179
|
+
summaryTotal.totalQty = new Decimal(summaryTotal.totalQty).toDP(2).toNumber();
|
|
180
|
+
summaryTotal.totalValue = new Decimal(summaryTotal.totalValue).toDP(2).toNumber();
|
|
181
|
+
summaryTotal.advanceRate = new Decimal(summaryTotal.advanceRate).toDP(2).toNumber();
|
|
182
|
+
await saveInventoryAvailabilitySummary(String(inventoryAvailability._id), [...newSummary, summaryTotal]);
|
|
183
|
+
} else {
|
|
184
|
+
await saveInventoryAvailabilitySummary(String(inventoryAvailability._id), []);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import mongoose from 'mongoose';
|
|
26
|
+
import { IInventoryItem } from '../models/InventoryItem.model';
|
|
27
|
+
import { IUploadedItems } from '../interfaces/collaterals.interface';
|
|
28
|
+
import { CollateralsService } from './collaterals.service';
|
|
29
|
+
export declare class InventoryService {
|
|
30
|
+
private readonly collateralsService;
|
|
31
|
+
constructor(collateralsService: CollateralsService);
|
|
32
|
+
updateInventorySKU({ bbcDate, borrowerId, items }: IUploadedItems<IInventoryItem>): Promise<({
|
|
33
|
+
skuDate: Date;
|
|
34
|
+
category: string;
|
|
35
|
+
sku: string;
|
|
36
|
+
qty: number;
|
|
37
|
+
value: number;
|
|
38
|
+
expiryDate: Date;
|
|
39
|
+
location: string;
|
|
40
|
+
unitCost: number;
|
|
41
|
+
skuDescription1: string;
|
|
42
|
+
skuDescription2: string;
|
|
43
|
+
skuDescription3: string;
|
|
44
|
+
detail1: string;
|
|
45
|
+
detail2: string;
|
|
46
|
+
detail3: string;
|
|
47
|
+
bbcSheetId: mongoose.Types.ObjectId;
|
|
48
|
+
order: number;
|
|
49
|
+
} | {
|
|
50
|
+
skuDate: string;
|
|
51
|
+
category: string;
|
|
52
|
+
sku: string;
|
|
53
|
+
qty: number;
|
|
54
|
+
value: number;
|
|
55
|
+
expiryDate: Date;
|
|
56
|
+
location: string;
|
|
57
|
+
unitCost: number;
|
|
58
|
+
skuDescription1: string;
|
|
59
|
+
skuDescription2: string;
|
|
60
|
+
skuDescription3: string;
|
|
61
|
+
detail1: string;
|
|
62
|
+
detail2: string;
|
|
63
|
+
detail3: string;
|
|
64
|
+
bbcSheetId: mongoose.Types.ObjectId;
|
|
65
|
+
order: number;
|
|
66
|
+
})[]>;
|
|
67
|
+
getBenford(borrowerId: string): Promise<any[] | {
|
|
68
|
+
_id: any;
|
|
69
|
+
bbcDates: any;
|
|
70
|
+
confirmed: any[];
|
|
71
|
+
}>;
|
|
72
|
+
getInventoryAgingPlot(borrowerId: string, rangeStart: any, rangeEnd: any): Promise<{
|
|
73
|
+
name: string;
|
|
74
|
+
data: number[];
|
|
75
|
+
}[]>;
|
|
76
|
+
getAllSkuValues(borrowerId: string, startDate: string, endDate: string): Promise<any[]>;
|
|
77
|
+
getFirstSeenNew(sheetIds: mongoose.Types.ObjectId[], sku: string): Promise<{
|
|
78
|
+
bbcDate: Date;
|
|
79
|
+
}[]>;
|
|
80
|
+
getInconsistentData(bbcDateId: string): Promise<{
|
|
81
|
+
SKU: string;
|
|
82
|
+
UNIT_COST: number;
|
|
83
|
+
CALCULATED_UNIT_COST: number;
|
|
84
|
+
DIFFERENCE: number;
|
|
85
|
+
QTY: number;
|
|
86
|
+
VALUE_CHANGE: number;
|
|
87
|
+
}[]>;
|
|
88
|
+
getUnitCostDifference(borrowerId: string): Promise<{
|
|
89
|
+
SKU: string;
|
|
90
|
+
CURRENT_UNIT_COST: number;
|
|
91
|
+
LOWEST_UNIT_COST: number;
|
|
92
|
+
LOWEST_UNIT_COST_DATE: string;
|
|
93
|
+
DIFFERENCE: number;
|
|
94
|
+
CURRENT_QTY: number;
|
|
95
|
+
VALUE_CHANGE: number;
|
|
96
|
+
}[]>;
|
|
97
|
+
getExposures(borrowerId: string, useCustomerGroup: boolean): Promise<{
|
|
98
|
+
allCategoryNames: any[];
|
|
99
|
+
formattedSeriesData: {
|
|
100
|
+
name: Date;
|
|
101
|
+
data: any[];
|
|
102
|
+
}[];
|
|
103
|
+
}>;
|
|
104
|
+
getInventoryTurn(borrowerId: string, startDate: string, endDate: string): Promise<{
|
|
105
|
+
tableByUnit: any[];
|
|
106
|
+
tableByValue: any[];
|
|
107
|
+
}>;
|
|
108
|
+
getInvoiceMovement(borrowerId: string, bbcDateId: string): Promise<{
|
|
109
|
+
reportAdditions: any[];
|
|
110
|
+
reportRemoved: any[];
|
|
111
|
+
}>;
|
|
112
|
+
getContras(borrowerId: string, startDate: string, endDate: string): Promise<any[]>;
|
|
113
|
+
getExtension(borrowerId: string, startDate: string, endDate: string): Promise<any[]>;
|
|
114
|
+
compareInventories(bbcDateId: string): Promise<{
|
|
115
|
+
addedInventories: any[];
|
|
116
|
+
removedInventories: any[];
|
|
117
|
+
}>;
|
|
118
|
+
}
|