gemcap-be-common 1.2.136 → 1.2.138

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.
Files changed (54) hide show
  1. package/db/collaterals.db.d.ts +1 -1
  2. package/db/collaterals.db.js +2 -2
  3. package/db/collaterals.db.ts +2 -2
  4. package/db/financial-spreading.db.d.ts +34 -0
  5. package/db/financial-spreading.db.js +103 -0
  6. package/db/financial-spreading.db.ts +112 -0
  7. package/db/inventories.db.js +2 -2
  8. package/db/inventories.db.ts +2 -2
  9. package/db/loan-products.db.js +3 -4
  10. package/db/loan-products.db.ts +3 -4
  11. package/db/loan-transactions.db.d.ts +3 -1
  12. package/db/loan-transactions.db.js +62 -2
  13. package/db/loan-transactions.db.ts +72 -1
  14. package/db/receivables.db.js +1 -1
  15. package/db/receivables.db.ts +1 -1
  16. package/helpers/date.helper.d.ts +4 -0
  17. package/helpers/date.helper.js +6 -1
  18. package/helpers/date.helper.ts +5 -0
  19. package/models/AvilabilitySignedData.model.d.ts +33 -0
  20. package/models/AvilabilitySignedData.model.js +22 -0
  21. package/models/AvilabilitySignedData.model.ts +30 -0
  22. package/models/BorrowerSummary.model.d.ts +70 -0
  23. package/models/BorrowerSummary.model.js +37 -0
  24. package/models/BorrowerSummary.model.ts +72 -0
  25. package/models/FinancialSpreading.model.d.ts +76 -0
  26. package/models/FinancialSpreading.model.js +65 -0
  27. package/models/FinancialSpreading.model.ts +110 -0
  28. package/models/FinancialSpreadingSheet.model.d.ts +152 -0
  29. package/models/FinancialSpreadingSheet.model.js +207 -0
  30. package/models/FinancialSpreadingSheet.model.ts +240 -0
  31. package/models/LoanTransaction.model.d.ts +8 -0
  32. package/models/LoanTransaction.model.ts +9 -0
  33. package/models/PostponedTransactions.model.d.ts +3 -3
  34. package/models/ProspectIndustry.model.d.ts +35 -0
  35. package/models/ProspectIndustry.model.js +26 -0
  36. package/models/ProspectIndustry.model.ts +38 -0
  37. package/models/Yield.model.d.ts +46 -0
  38. package/models/Yield.model.js +20 -1
  39. package/models/Yield.model.ts +20 -0
  40. package/package.json +1 -1
  41. package/queries/inventory/extension.js +3 -3
  42. package/queries/inventory/extension.ts +3 -3
  43. package/queries/inventory/turn.js +3 -3
  44. package/queries/inventory/turn.ts +3 -3
  45. package/reports/new-summary.d.ts +0 -0
  46. package/reports/new-summary.js +1327 -0
  47. package/reports/new-summary.ts +1327 -0
  48. package/services/users.service.d.ts +3 -3
  49. package/services/users.service.js +3 -3
  50. package/services/users.service.ts +4 -4
  51. package/services/yield.service.d.ts +53 -0
  52. package/services/yield.service.js +161 -0
  53. package/services/yield.service.ts +198 -0
  54. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,30 @@
1
+ import mongoose, { Model } from 'mongoose';
2
+
3
+ import { MODEL_NAMES } from '../models/_models';
4
+
5
+ export interface IAvailabilitySignedData {
6
+ _id?: mongoose.Types.ObjectId;
7
+ bbcDateId?: mongoose.Types.ObjectId;
8
+ data: any;
9
+ }
10
+
11
+ type IAvailabilitySignedDataModel = Model<IAvailabilitySignedData, {}, {}>;
12
+
13
+ const AvailabilitySignedDataSchema = new mongoose.Schema<IAvailabilitySignedData, IAvailabilitySignedDataModel>(
14
+ {
15
+ bbcDateId: {
16
+ type: mongoose.Schema.Types.ObjectId,
17
+ ref: MODEL_NAMES.BBCDates,
18
+ required: false,
19
+ },
20
+ data: {
21
+ type: mongoose.Schema.Types.Mixed,
22
+ },
23
+ },
24
+ {
25
+ timestamps: { createdAt: false, updatedAt: false },
26
+ versionKey: false,
27
+ },
28
+ );
29
+
30
+ export const AvailabilitySignedData = mongoose.model<IAvailabilitySignedData, IAvailabilitySignedDataModel>(MODEL_NAMES.availabilitySignedData, AvailabilitySignedDataSchema);
@@ -0,0 +1,70 @@
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, { Document, Model } from 'mongoose';
26
+ export declare enum ETableNames {
27
+ HIGH_LEVEL = "HIGH_LEVEL",
28
+ HIGH_LEVEL_APPROVED = "HIGH_LEVEL_APPROVED",
29
+ COMPLIANCE_ITEMS = "COMPLIANCE_ITEMS",
30
+ TOP_5_SKUS = "TOP_5_SKUS",
31
+ LAST_5_DAYS_TRANSACTIONS = "LAST_5_DAYS_TRANSACTIONS",
32
+ INVENTORY_TURN = "INVENTORY_TURN",
33
+ TOP_5_CUSTOMERS_CONCENTRATION = "TOP_5_CUSTOMERS_CONCENTRATION",
34
+ AGED_OUT_CUSTOMERS = "AGED_OUT_CUSTOMERS"
35
+ }
36
+ export type IBorrowerSummaryTableData = {
37
+ [key in ETableNames]: {
38
+ title: string;
39
+ data: string[][];
40
+ };
41
+ };
42
+ export declare enum EChartNames {
43
+ LAST_6_MONTH = "LAST_6_MONTH"
44
+ }
45
+ export type IBorrowerSummaryChartData = {
46
+ [key in EChartNames]: {
47
+ series: {
48
+ type: string;
49
+ xKey: string;
50
+ yKey: string;
51
+ yName: string;
52
+ }[];
53
+ data: {
54
+ bbc: string;
55
+ revolverCollateralTotal: number;
56
+ revolverLoanBalance: number;
57
+ }[];
58
+ };
59
+ };
60
+ export interface IBorrowerSummary {
61
+ borrowerId: mongoose.Types.ObjectId;
62
+ lastCalculatedAt: Date;
63
+ tableData: IBorrowerSummaryTableData;
64
+ chartData: IBorrowerSummaryChartData;
65
+ }
66
+ export interface IBorrowerSummaryDoc extends IBorrowerSummary, Document {
67
+ }
68
+ type BorrowerSummaryModel = Model<IBorrowerSummary, {}, {}>;
69
+ export declare const BorrowerSummary: BorrowerSummaryModel;
70
+ export {};
@@ -0,0 +1,37 @@
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.BorrowerSummary = exports.EChartNames = exports.ETableNames = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const _models_1 = require("../models/_models");
9
+ var ETableNames;
10
+ (function (ETableNames) {
11
+ ETableNames["HIGH_LEVEL"] = "HIGH_LEVEL";
12
+ ETableNames["HIGH_LEVEL_APPROVED"] = "HIGH_LEVEL_APPROVED";
13
+ ETableNames["COMPLIANCE_ITEMS"] = "COMPLIANCE_ITEMS";
14
+ ETableNames["TOP_5_SKUS"] = "TOP_5_SKUS";
15
+ ETableNames["LAST_5_DAYS_TRANSACTIONS"] = "LAST_5_DAYS_TRANSACTIONS";
16
+ ETableNames["INVENTORY_TURN"] = "INVENTORY_TURN";
17
+ ETableNames["TOP_5_CUSTOMERS_CONCENTRATION"] = "TOP_5_CUSTOMERS_CONCENTRATION";
18
+ ETableNames["AGED_OUT_CUSTOMERS"] = "AGED_OUT_CUSTOMERS";
19
+ })(ETableNames || (exports.ETableNames = ETableNames = {}));
20
+ var EChartNames;
21
+ (function (EChartNames) {
22
+ EChartNames["LAST_6_MONTH"] = "LAST_6_MONTH";
23
+ })(EChartNames || (exports.EChartNames = EChartNames = {}));
24
+ const BorrowerSummarySchema = new mongoose_1.default.Schema({
25
+ borrowerId: {
26
+ type: mongoose_1.default.Schema.Types.ObjectId,
27
+ ref: _models_1.MODEL_NAMES.borrowers,
28
+ required: true,
29
+ },
30
+ lastCalculatedAt: {
31
+ type: Date,
32
+ required: true,
33
+ },
34
+ tableData: mongoose_1.default.Schema.Types.Mixed,
35
+ chartData: mongoose_1.default.Schema.Types.Mixed,
36
+ }, { timestamps: true });
37
+ exports.BorrowerSummary = mongoose_1.default.model(_models_1.MODEL_NAMES.borrowerSummaries, BorrowerSummarySchema);
@@ -0,0 +1,72 @@
1
+ import mongoose, { Document, Model } from 'mongoose';
2
+
3
+ import { MODEL_NAMES } from '../models/_models';
4
+
5
+ export enum ETableNames {
6
+ HIGH_LEVEL = 'HIGH_LEVEL',
7
+ HIGH_LEVEL_APPROVED = 'HIGH_LEVEL_APPROVED',
8
+ COMPLIANCE_ITEMS = 'COMPLIANCE_ITEMS',
9
+ TOP_5_SKUS = 'TOP_5_SKUS',
10
+ LAST_5_DAYS_TRANSACTIONS = 'LAST_5_DAYS_TRANSACTIONS',
11
+ INVENTORY_TURN = 'INVENTORY_TURN',
12
+ TOP_5_CUSTOMERS_CONCENTRATION = 'TOP_5_CUSTOMERS_CONCENTRATION',
13
+ AGED_OUT_CUSTOMERS = 'AGED_OUT_CUSTOMERS',
14
+ }
15
+
16
+ export type IBorrowerSummaryTableData = {
17
+ [key in ETableNames]: {
18
+ title: string;
19
+ data: string[][];
20
+ };
21
+ }
22
+
23
+ export enum EChartNames {
24
+ LAST_6_MONTH = 'LAST_6_MONTH',
25
+ }
26
+
27
+ export type IBorrowerSummaryChartData = {
28
+ [key in EChartNames]: {
29
+ series: {
30
+ type: string,
31
+ xKey: string,
32
+ yKey: string,
33
+ yName: string,
34
+ }[],
35
+ data: {
36
+ bbc: string,
37
+ revolverCollateralTotal: number,
38
+ revolverLoanBalance: number,
39
+ }[],
40
+ };
41
+ }
42
+
43
+ export interface IBorrowerSummary {
44
+ borrowerId: mongoose.Types.ObjectId;
45
+ lastCalculatedAt: Date;
46
+ tableData: IBorrowerSummaryTableData;
47
+ chartData: IBorrowerSummaryChartData;
48
+ }
49
+
50
+ export interface IBorrowerSummaryDoc extends IBorrowerSummary, Document {
51
+ }
52
+
53
+ type BorrowerSummaryModel = Model<IBorrowerSummary, {}, {}>;
54
+
55
+ const BorrowerSummarySchema = new mongoose.Schema<IBorrowerSummary, BorrowerSummaryModel>(
56
+ {
57
+ borrowerId: {
58
+ type: mongoose.Schema.Types.ObjectId,
59
+ ref: MODEL_NAMES.borrowers,
60
+ required: true,
61
+ },
62
+ lastCalculatedAt: {
63
+ type: Date,
64
+ required: true,
65
+ },
66
+ tableData: mongoose.Schema.Types.Mixed,
67
+ chartData: mongoose.Schema.Types.Mixed,
68
+ },
69
+ { timestamps: true },
70
+ );
71
+
72
+ export const BorrowerSummary = mongoose.model<IBorrowerSummary, BorrowerSummaryModel>(MODEL_NAMES.borrowerSummaries, BorrowerSummarySchema);
@@ -0,0 +1,76 @@
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 Joi from 'joi';
26
+ import mongoose, { Model } from 'mongoose';
27
+ import { ISelectedMonth } from '../helpers/date.helper';
28
+ import { BasicDTO } from '../helpers/db-data.helper';
29
+ import { EFinancialSpreadingType } from './FinancialSpreadingSheet.model';
30
+ export declare class FinancialSpreadingDTO extends BasicDTO {
31
+ borrowerId: string;
32
+ year: number;
33
+ month: number;
34
+ sheetId: string;
35
+ amount: number;
36
+ }
37
+ export interface IFinancialSpreadingView {
38
+ _id: string;
39
+ borrowerId: string;
40
+ year: number;
41
+ month: number;
42
+ sheetId: string;
43
+ amount: number;
44
+ minus_1?: number;
45
+ minus_2?: number;
46
+ minus_3?: number;
47
+ }
48
+ export interface IFinancialSpreadingUpload {
49
+ _id: string;
50
+ sheetId: string;
51
+ sheetType: string;
52
+ amount: number;
53
+ title: string;
54
+ isNew: boolean;
55
+ }
56
+ export interface IFinancialSpreadingViewWithDeepData extends IFinancialSpreadingView {
57
+ [minus: string]: string | number | boolean;
58
+ }
59
+ export interface IFinancialSpreadingParams {
60
+ borrowerId: string;
61
+ selectedMonth: ISelectedMonth;
62
+ financialSpreadingType: EFinancialSpreadingType;
63
+ }
64
+ export interface IFinancialSpreading {
65
+ _id?: mongoose.Types.ObjectId;
66
+ borrowerId: mongoose.Types.ObjectId;
67
+ year: number;
68
+ month: number;
69
+ sheetId: mongoose.Types.ObjectId;
70
+ amount: number;
71
+ }
72
+ export declare const financialSpreadingViewValidationSchema: Joi.ObjectSchema<IFinancialSpreadingView>;
73
+ export declare const financialSpreadingParamsValidationSchema: Joi.ObjectSchema<IFinancialSpreadingParams>;
74
+ type IFinancialSpreadingModel = Model<IFinancialSpreading, object, object>;
75
+ export declare const FinancialSpreading: IFinancialSpreadingModel;
76
+ export {};
@@ -0,0 +1,65 @@
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.FinancialSpreading = exports.financialSpreadingParamsValidationSchema = exports.financialSpreadingViewValidationSchema = exports.FinancialSpreadingDTO = void 0;
7
+ const joi_1 = __importDefault(require("joi"));
8
+ const mongoose_1 = __importDefault(require("mongoose"));
9
+ const _models_1 = require("../models/_models");
10
+ const db_data_helper_1 = require("../helpers/db-data.helper");
11
+ const FinancialSpreadingSheet_model_1 = require("./FinancialSpreadingSheet.model");
12
+ class FinancialSpreadingDTO extends db_data_helper_1.BasicDTO {
13
+ borrowerId;
14
+ year;
15
+ month;
16
+ sheetId;
17
+ amount;
18
+ }
19
+ exports.FinancialSpreadingDTO = FinancialSpreadingDTO;
20
+ exports.financialSpreadingViewValidationSchema = joi_1.default.object({
21
+ _id: joi_1.default.string().required(),
22
+ borrowerId: joi_1.default.string().required(),
23
+ month: joi_1.default.number().integer().min(1).max(12),
24
+ year: joi_1.default.number().integer().min(1900).max(9999),
25
+ sheetId: joi_1.default.string().required(),
26
+ amount: joi_1.default.number().required().allow(0),
27
+ minus_1: joi_1.default.number(),
28
+ minus_2: joi_1.default.number(),
29
+ minus_3: joi_1.default.number(),
30
+ });
31
+ exports.financialSpreadingParamsValidationSchema = joi_1.default.object({
32
+ borrowerId: joi_1.default.string().required(),
33
+ selectedMonth: joi_1.default.object({
34
+ month: joi_1.default.number().integer().min(1).max(12),
35
+ year: joi_1.default.number().integer().min(1900).max(9999),
36
+ }).required(),
37
+ financialSpreadingType: joi_1.default.string().valid(...Object.values(FinancialSpreadingSheet_model_1.EFinancialSpreadingType)),
38
+ });
39
+ const FinancialSpreadingSchema = new mongoose_1.default.Schema({
40
+ borrowerId: {
41
+ type: mongoose_1.default.Schema.Types.ObjectId,
42
+ ref: _models_1.MODEL_NAMES.borrowers,
43
+ required: true,
44
+ },
45
+ year: {
46
+ type: Number,
47
+ required: true,
48
+ },
49
+ month: {
50
+ type: Number,
51
+ required: true,
52
+ },
53
+ sheetId: {
54
+ type: mongoose_1.default.Schema.Types.ObjectId,
55
+ ref: _models_1.MODEL_NAMES.financialSpreadingSheets,
56
+ required: true,
57
+ },
58
+ amount: {
59
+ type: Number,
60
+ required: true,
61
+ },
62
+ }, {
63
+ timestamps: { createdAt: true, updatedAt: true },
64
+ });
65
+ exports.FinancialSpreading = mongoose_1.default.model(_models_1.MODEL_NAMES.financialSpreading, FinancialSpreadingSchema);
@@ -0,0 +1,110 @@
1
+ import Joi from 'joi';
2
+ import mongoose, { Model } from 'mongoose';
3
+
4
+ import { ISelectedMonth } from '../helpers/date.helper';
5
+ import { MODEL_NAMES } from '../models/_models';
6
+ import { BasicDTO } from '../helpers/db-data.helper';
7
+ import { EFinancialSpreadingType } from './FinancialSpreadingSheet.model';
8
+
9
+ export class FinancialSpreadingDTO extends BasicDTO {
10
+ borrowerId: string;
11
+ year: number;
12
+ month: number;
13
+ sheetId: string;
14
+ amount: number;
15
+ }
16
+
17
+ export interface IFinancialSpreadingView {
18
+ _id: string;
19
+ borrowerId: string;
20
+ year: number;
21
+ month: number;
22
+ sheetId: string;
23
+ amount: number;
24
+ minus_1?: number;
25
+ minus_2?: number;
26
+ minus_3?: number;
27
+ }
28
+
29
+ export interface IFinancialSpreadingUpload {
30
+ _id: string;
31
+ sheetId: string;
32
+ sheetType: string;
33
+ amount: number;
34
+ title: string;
35
+ isNew: boolean;
36
+ }
37
+
38
+ export interface IFinancialSpreadingViewWithDeepData extends IFinancialSpreadingView {
39
+ [minus: string]: string | number | boolean;
40
+ }
41
+
42
+ export interface IFinancialSpreadingParams {
43
+ borrowerId: string;
44
+ selectedMonth: ISelectedMonth;
45
+ financialSpreadingType: EFinancialSpreadingType;
46
+ }
47
+
48
+ export interface IFinancialSpreading {
49
+ _id?: mongoose.Types.ObjectId;
50
+ borrowerId: mongoose.Types.ObjectId;
51
+ year: number;
52
+ month: number;
53
+ sheetId: mongoose.Types.ObjectId;
54
+ amount: number;
55
+ }
56
+
57
+ export const financialSpreadingViewValidationSchema = Joi.object<IFinancialSpreadingView>({
58
+ _id: Joi.string().required(),
59
+ borrowerId: Joi.string().required(),
60
+ month: Joi.number().integer().min(1).max(12),
61
+ year: Joi.number().integer().min(1900).max(9999),
62
+ sheetId: Joi.string().required(),
63
+ amount: Joi.number().required().allow(0),
64
+ minus_1: Joi.number(),
65
+ minus_2: Joi.number(),
66
+ minus_3: Joi.number(),
67
+ });
68
+
69
+ export const financialSpreadingParamsValidationSchema = Joi.object<IFinancialSpreadingParams>({
70
+ borrowerId: Joi.string().required(),
71
+ selectedMonth: Joi.object({
72
+ month: Joi.number().integer().min(1).max(12),
73
+ year: Joi.number().integer().min(1900).max(9999),
74
+ }).required(),
75
+ financialSpreadingType: Joi.string().valid(...Object.values(EFinancialSpreadingType)),
76
+ });
77
+
78
+ type IFinancialSpreadingModel = Model<IFinancialSpreading, object, object>;
79
+
80
+ const FinancialSpreadingSchema = new mongoose.Schema<IFinancialSpreading, IFinancialSpreadingModel>(
81
+ {
82
+ borrowerId: {
83
+ type: mongoose.Schema.Types.ObjectId,
84
+ ref: MODEL_NAMES.borrowers,
85
+ required: true,
86
+ },
87
+ year: {
88
+ type: Number,
89
+ required: true,
90
+ },
91
+ month: {
92
+ type: Number,
93
+ required: true,
94
+ },
95
+ sheetId: {
96
+ type: mongoose.Schema.Types.ObjectId,
97
+ ref: MODEL_NAMES.financialSpreadingSheets,
98
+ required: true,
99
+ },
100
+ amount: {
101
+ type: Number,
102
+ required: true,
103
+ },
104
+ },
105
+ {
106
+ timestamps: { createdAt: true, updatedAt: true },
107
+ },
108
+ );
109
+
110
+ export const FinancialSpreading = mongoose.model<IFinancialSpreading, IFinancialSpreadingModel>(MODEL_NAMES.financialSpreading, FinancialSpreadingSchema);
@@ -0,0 +1,152 @@
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, { Model } from 'mongoose';
26
+ import Joi from 'joi';
27
+ import { BasicDTO } from '../helpers/db-data.helper';
28
+ export declare enum EFinancialSpreadingType {
29
+ PROFIT_LOSS = "PROFIT_LOSS",
30
+ BALANCE_SHEET = "BALANCE_SHEET"
31
+ }
32
+ export declare enum EFinanceSpreadingPLTotal {
33
+ SALES = "SALES",
34
+ COST_OF_SALES = "COST_OF_SALES",
35
+ GROSS_PROFIT = "GROSS_PROFIT",
36
+ GROSS_MARGIN = "GROSS_MARGIN",
37
+ OPERATING_EXPENSES = "OPERATING_EXPENSES",
38
+ INCOME_FROM_OPERATIONS = "INCOME_FROM_OPERATIONS",
39
+ OPERATING_MARGIN = "OPERATING_MARGIN",
40
+ NON_OPERATING_EXPENSES = "NON_OPERATING_EXPENSES",
41
+ NON_OPERATING_INCOME = "NON_OPERATING_INCOME",
42
+ FINANCING_COSTS = "FINANCING_COSTS",
43
+ DEPRECIATION_AMORTIZATION = "DEPRECIATION_AMORTIZATION",
44
+ PRE_TAX_INCOME = "PRE_TAX_INCOME",
45
+ TAX = "TAX",
46
+ NET_INCOME = "NET_INCOME"
47
+ }
48
+ export declare const financeSpreadingPLList: {
49
+ [type in EFinanceSpreadingPLTotal]?: boolean;
50
+ };
51
+ export declare enum EFinanceSpreadingBSTotal {
52
+ CASH_EQUIVALENTS = "CASH_EQUIVALENTS",
53
+ TRADE_RECEIVABLES = "TRADE_RECEIVABLES",
54
+ INVENTORY = "INVENTORY",
55
+ OTHER_CURRENT_ASSETS = "OTHER_CURRENT_ASSETS",
56
+ TOTAL_CURRENT_ASSET = "TOTAL_CURRENT_ASSET",
57
+ FIXED_ASSETS = "FIXED_ASSETS",
58
+ OTHER_NON_CURRENT_ASSETS = "OTHER_NON_CURRENT_ASSETS",
59
+ TOTAL_NON_CURRENT_ASSETS = "TOTAL_NON_CURRENT_ASSETS",
60
+ TOTAL_ASSETS = "TOTAL_ASSETS",
61
+ ACCOUNTS_PAYABLE = "ACCOUNTS_PAYABLE",
62
+ OTHER_CURRENT_LIABILITIES = "OTHER_CURRENT_LIABILITIES",
63
+ TOTAL_CURRENT_LIABILITIES = "TOTAL_CURRENT_LIABILITIES",
64
+ COMPANY_DEBT = "COMPANY_DEBT",
65
+ OTHER_DEBT = "OTHER_DEBT",
66
+ OTHER_LONG_TERM_LIABILITIES = "OTHER_LONG_TERM_LIABILITIES",
67
+ LONG_TERM_LIABILITIES = "LONG_TERM_LIABILITIES",
68
+ TOTAL_LIABILITIES = "TOTAL_LIABILITIES",
69
+ RETAINED_EARNINGS = "RETAINED_EARNINGS",
70
+ EQUITY_RESERVES = "EQUITY_RESERVES",
71
+ CHECK = "CHECK"
72
+ }
73
+ export declare const financeSpreadingBSList: {
74
+ [type in EFinanceSpreadingBSTotal]?: boolean;
75
+ };
76
+ export declare const financialSpreadingTotalDictionary: Record<EFinanceSpreadingPLTotal | EFinanceSpreadingBSTotal, string>;
77
+ export declare const financeSpreadingLists: {
78
+ PROFIT_LOSS: {
79
+ SALES?: boolean;
80
+ COST_OF_SALES?: boolean;
81
+ GROSS_PROFIT?: boolean;
82
+ GROSS_MARGIN?: boolean;
83
+ OPERATING_EXPENSES?: boolean;
84
+ INCOME_FROM_OPERATIONS?: boolean;
85
+ OPERATING_MARGIN?: boolean;
86
+ NON_OPERATING_EXPENSES?: boolean;
87
+ NON_OPERATING_INCOME?: boolean;
88
+ FINANCING_COSTS?: boolean;
89
+ DEPRECIATION_AMORTIZATION?: boolean;
90
+ PRE_TAX_INCOME?: boolean;
91
+ TAX?: boolean;
92
+ NET_INCOME?: boolean;
93
+ };
94
+ BALANCE_SHEET: {
95
+ CASH_EQUIVALENTS?: boolean;
96
+ TRADE_RECEIVABLES?: boolean;
97
+ INVENTORY?: boolean;
98
+ OTHER_CURRENT_ASSETS?: boolean;
99
+ TOTAL_CURRENT_ASSET?: boolean;
100
+ FIXED_ASSETS?: boolean;
101
+ OTHER_NON_CURRENT_ASSETS?: boolean;
102
+ TOTAL_NON_CURRENT_ASSETS?: boolean;
103
+ TOTAL_ASSETS?: boolean;
104
+ ACCOUNTS_PAYABLE?: boolean;
105
+ OTHER_CURRENT_LIABILITIES?: boolean;
106
+ TOTAL_CURRENT_LIABILITIES?: boolean;
107
+ COMPANY_DEBT?: boolean;
108
+ OTHER_DEBT?: boolean;
109
+ OTHER_LONG_TERM_LIABILITIES?: boolean;
110
+ LONG_TERM_LIABILITIES?: boolean;
111
+ TOTAL_LIABILITIES?: boolean;
112
+ RETAINED_EARNINGS?: boolean;
113
+ EQUITY_RESERVES?: boolean;
114
+ CHECK?: boolean;
115
+ };
116
+ };
117
+ export interface IFinancialSpreadingSheetView {
118
+ _id: string;
119
+ name: string;
120
+ borrowerId: string;
121
+ financialSpreadingType: string;
122
+ rowType: string;
123
+ order: number;
124
+ suborder: number;
125
+ isTotal: boolean;
126
+ isCalculated: boolean;
127
+ }
128
+ export declare class FinancialSpreadingSheetDTO extends BasicDTO {
129
+ borrowerId: string;
130
+ financialSpreadingType: EFinancialSpreadingType;
131
+ rowType: EFinanceSpreadingPLTotal | EFinanceSpreadingBSTotal;
132
+ name: string;
133
+ order: number;
134
+ suborder: number;
135
+ isTotal: boolean;
136
+ isCalculated: boolean;
137
+ }
138
+ export declare const financialSpreadingSheetViewValidationSchema: Joi.ObjectSchema<IFinancialSpreadingSheetView>;
139
+ export interface IFinancialSpreadingSheet {
140
+ _id?: mongoose.Types.ObjectId;
141
+ borrowerId: mongoose.Types.ObjectId;
142
+ financialSpreadingType: EFinancialSpreadingType;
143
+ rowType: EFinanceSpreadingPLTotal | EFinanceSpreadingBSTotal;
144
+ name: string;
145
+ order: number;
146
+ suborder: number;
147
+ isTotal: boolean;
148
+ isCalculated: boolean;
149
+ }
150
+ type IFinancialSpreadingSheetModel = Model<IFinancialSpreadingSheet, {}, {}>;
151
+ export declare const FinancialSpreadingSheet: IFinancialSpreadingSheetModel;
152
+ export {};