law-common 10.72.2-beta.2 → 10.72.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/api/interface/leave.api.d.ts +11 -2
- package/dist/src/api/interface/vendor.create.dto.interface.autocode.js +3 -12
- package/dist/src/api/interface/vendor.entity.response.d.ts +10 -4
- package/dist/src/entities/flow-configs/flow-config.type.d.ts +10 -10
- package/dist/src/entities/flow-configs/leave.flow.config.d.ts +1 -1
- package/dist/src/entities/flow-configs/vendor-flow.config.js +15 -15
- package/dist/src/entities/interface/entity.utils.interface.d.ts +2 -2
- package/dist/src/entities/interface/reimbursement.entity.interface.d.ts +3 -0
- package/dist/src/entities/model/leave.entity.model.js +1 -1
- package/dist/src/entities/model/organization_type.entity.model.d.ts +5 -21
- package/dist/src/entities/model/organization_type.entity.model.js +14 -113
- package/dist/src/entities/model/reimbursement.entity.model.d.ts +1 -0
- package/dist/src/entities/model/reimbursement.entity.model.js +1 -0
- package/dist/src/entities/model/tds_rate.entity.model.d.ts +3 -27
- package/dist/src/entities/model/tds_rate.entity.model.js +2 -114
- package/dist/src/entities/model/vendor.entity.model.d.ts +32 -44
- package/dist/src/entities/model/vendor.entity.model.js +53 -132
- package/dist/src/entities/model/vendor_invoice_item.entity.model.autocode.js +0 -40
- package/dist/src/entities/model/vendor_invoice_item.entity.model.d.ts +15 -24
- package/dist/src/entities/model/vendor_invoice_item.entity.model.js +5 -44
- package/dist/src/entities/model/voucher_type.entity.model.d.ts +5 -25
- package/dist/src/entities/model/voucher_type.entity.model.js +2 -102
- package/dist/src/utils/entity.flow.util.d.ts +40 -40
- package/package.json +41 -41
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdsRateEntityModel = void 0;
|
|
4
|
-
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
|
-
const base_entity_model_1 = require("./base.entity.model");
|
|
6
4
|
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
7
5
|
const tds_rate_status_enum_1 = require("../enums/tds_rate_status_enum");
|
|
6
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
7
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
8
8
|
class TdsRateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
@@ -28,109 +28,6 @@ class TdsRateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
28
28
|
getRelationConfigs() {
|
|
29
29
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
30
30
|
}
|
|
31
|
-
get organizationTypes() {
|
|
32
|
-
if (this.organizationTypeTdsRateMappings) {
|
|
33
|
-
return this.organizationTypeTdsRateMappings.filter((mapping) => mapping.organizationType).map((mapping) => mapping.organizationType);
|
|
34
|
-
}
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
get voucherTypes() {
|
|
38
|
-
if (this.tdsRateVoucherTypeMappings) {
|
|
39
|
-
return this.tdsRateVoucherTypeMappings.filter((mapping) => mapping.voucherType).map((mapping) => mapping.voucherType);
|
|
40
|
-
}
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
get vendors() {
|
|
44
|
-
// many_to_many -> many_to_many verified
|
|
45
|
-
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many'}
|
|
46
|
-
// ['tds_rate', 'organization_type'] -> many_to_many
|
|
47
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
48
|
-
var _a;
|
|
49
|
-
return (_a = this.organizationTypes) === null || _a === void 0 ? void 0 : _a.flatMap((organizationType) => organizationType.vendors).filter((vendor) => !!vendor).reduce((accumulator, current) => {
|
|
50
|
-
if (!accumulator.some((vendor) => vendor.id === current.id)) {
|
|
51
|
-
accumulator.push(current);
|
|
52
|
-
}
|
|
53
|
-
return accumulator;
|
|
54
|
-
}, []);
|
|
55
|
-
}
|
|
56
|
-
get states() {
|
|
57
|
-
// many_to_many -> many_to_many verified
|
|
58
|
-
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->state': 'many_to_one'}
|
|
59
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
60
|
-
// ['vendor', 'state'] -> many_to_one
|
|
61
|
-
var _a;
|
|
62
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.stateModel).filter((state) => !!state).reduce((accumulator, current) => {
|
|
63
|
-
if (!accumulator.some((state) => state.id === current.id)) {
|
|
64
|
-
accumulator.push(current);
|
|
65
|
-
}
|
|
66
|
-
return accumulator;
|
|
67
|
-
}, []);
|
|
68
|
-
}
|
|
69
|
-
get countrys() {
|
|
70
|
-
// many_to_many -> many_to_many verified
|
|
71
|
-
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->country': 'many_to_one'}
|
|
72
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
73
|
-
// ['vendor', 'country'] -> many_to_one
|
|
74
|
-
var _a;
|
|
75
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.countryModel).filter((country) => !!country).reduce((accumulator, current) => {
|
|
76
|
-
if (!accumulator.some((country) => country.id === current.id)) {
|
|
77
|
-
accumulator.push(current);
|
|
78
|
-
}
|
|
79
|
-
return accumulator;
|
|
80
|
-
}, []);
|
|
81
|
-
}
|
|
82
|
-
get vendorInvoices() {
|
|
83
|
-
// one_to_many -> many_to_many mismatch
|
|
84
|
-
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many'}
|
|
85
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
86
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
87
|
-
var _a;
|
|
88
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoices).filter((vendorInvoice) => !!vendorInvoice).reduce((accumulator, current) => {
|
|
89
|
-
if (!accumulator.some((vendorInvoice) => vendorInvoice.id === current.id)) {
|
|
90
|
-
accumulator.push(current);
|
|
91
|
-
}
|
|
92
|
-
return accumulator;
|
|
93
|
-
}, []);
|
|
94
|
-
}
|
|
95
|
-
get officeLocations() {
|
|
96
|
-
// many_to_many -> many_to_many verified
|
|
97
|
-
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
|
|
98
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
99
|
-
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
100
|
-
var _a;
|
|
101
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
|
|
102
|
-
if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
|
|
103
|
-
accumulator.push(current);
|
|
104
|
-
}
|
|
105
|
-
return accumulator;
|
|
106
|
-
}, []);
|
|
107
|
-
}
|
|
108
|
-
get expenseHeads() {
|
|
109
|
-
// many_to_many -> many_to_many verified
|
|
110
|
-
// {'tds_rate->voucher_type': 'many_to_many', 'voucher_type->expense_head': 'one_to_many'}
|
|
111
|
-
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
112
|
-
// ['voucher_type', 'expense_head'] -> one_to_many
|
|
113
|
-
var _a;
|
|
114
|
-
return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.expenseHeads).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
115
|
-
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
116
|
-
accumulator.push(current);
|
|
117
|
-
}
|
|
118
|
-
return accumulator;
|
|
119
|
-
}, []);
|
|
120
|
-
}
|
|
121
|
-
get gstRates() {
|
|
122
|
-
// many_to_many -> many_to_many verified
|
|
123
|
-
// {'tds_rate->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
|
|
124
|
-
// ['tds_rate', 'vendor_invoice_item'] -> one_to_many
|
|
125
|
-
// ['vendor_invoice_item', 'gst_rate'] -> many_to_one
|
|
126
|
-
var _a;
|
|
127
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
|
|
128
|
-
if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
|
|
129
|
-
accumulator.push(current);
|
|
130
|
-
}
|
|
131
|
-
return accumulator;
|
|
132
|
-
}, []);
|
|
133
|
-
}
|
|
134
31
|
get organizationTypeIds() {
|
|
135
32
|
var _a;
|
|
136
33
|
return ((_a = this.organizationTypeTdsRateMappings) === null || _a === void 0 ? void 0 : _a.map((mapping) => mapping.organizationTypeId)) || [];
|
|
@@ -162,13 +59,4 @@ TdsRateEntityModel.relationConfigs = [
|
|
|
162
59
|
key: "id",
|
|
163
60
|
},
|
|
164
61
|
},
|
|
165
|
-
{
|
|
166
|
-
name: entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_ITEM,
|
|
167
|
-
relation: relation_type_enum_1.RelationType.MANY,
|
|
168
|
-
key: "vendorInvoiceItems",
|
|
169
|
-
mapKeyConfig: {
|
|
170
|
-
relationKey: "tdsRateId",
|
|
171
|
-
key: "id",
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
62
|
];
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
|
|
2
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
1
|
+
import { EntityEnum, IEntityUpdateDto, Nullable } from "../interface/entity.utils.interface";
|
|
3
2
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
import { IVendorActionDataDto } from "../../api";
|
|
5
|
+
import { VendorActionEnum } from "../enums/vendor-action.enum";
|
|
6
|
+
import { VendorStatusEnum } from "../enums/vendor-status.enum";
|
|
7
|
+
import { VendorContractApplicabilityEnum } from "../enums/vendor_contract_applicability_enum";
|
|
6
8
|
import { VendorGstTypeEnum } from "../enums/vendor_gst_type_enum";
|
|
9
|
+
import { VendorLocationTypeEnum } from "../enums/vendor_location_type_enum";
|
|
7
10
|
import { VendorPanTypeEnum } from "../enums/vendor_pan_type_enum";
|
|
8
|
-
import { VendorContractApplicabilityEnum } from "../enums/vendor_contract_applicability_enum";
|
|
9
|
-
import { VendorStatusEnum } from "../enums/vendor-status.enum";
|
|
10
|
-
import { StateEntityModel } from "./state.entity.model";
|
|
11
|
-
import { CountryEntityModel } from "./country.entity.model";
|
|
12
|
-
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
13
|
-
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
14
|
-
import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
15
|
-
import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
|
|
16
|
-
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
17
|
-
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
18
|
-
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
19
|
-
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
20
11
|
import { IUserEntity } from "../interface/user.entity.interface";
|
|
21
|
-
import {
|
|
12
|
+
import { IVendorEntity } from "../interface/vendor.entity.interface";
|
|
22
13
|
import { IRowActions } from "./interface/row-actions.interface";
|
|
14
|
+
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
15
|
+
import { StateEntityModel } from "./state.entity.model";
|
|
23
16
|
import { UserEntityModel } from "./user.entity.model";
|
|
24
|
-
import { IVendorFlowConfigContextData } from "../../api";
|
|
25
17
|
export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR> implements IVendorEntity {
|
|
26
18
|
id: number;
|
|
27
19
|
name: string;
|
|
@@ -44,37 +36,14 @@ export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR
|
|
|
44
36
|
attachmentDocuments?: string;
|
|
45
37
|
contactDetail?: string;
|
|
46
38
|
bankDetail?: string;
|
|
47
|
-
organizationTypeId?: number;
|
|
48
|
-
status: VendorStatusEnum;
|
|
49
|
-
remark: Nullable<string>;
|
|
50
39
|
createdOn: number;
|
|
51
40
|
updatedOn: number;
|
|
52
41
|
createdBy: number;
|
|
53
42
|
updatedBy: number;
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
status: VendorStatusEnum;
|
|
44
|
+
remark: Nullable<string>;
|
|
45
|
+
organizationTypeId?: Nullable<number>;
|
|
56
46
|
organizationType?: OrganizationTypeEntityModel;
|
|
57
|
-
vendorInvoices?: VendorInvoiceEntityModel[];
|
|
58
|
-
static relationConfigs: RelationConfigs<[EntityEnum.STATE, EntityEnum.COUNTRY, EntityEnum.ORGANIZATION_TYPE, EntityEnum.VENDOR_INVOICE], EntityEnum.VENDOR>;
|
|
59
|
-
static fromEntity(entity: IVendorEntity): VendorEntityModel;
|
|
60
|
-
getRelationConfigs(): any[];
|
|
61
|
-
get officeLocations(): OfficeLocationEntityModel[] | undefined;
|
|
62
|
-
get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
|
|
63
|
-
get voucherTypes(): VoucherTypeEntityModel[] | undefined;
|
|
64
|
-
get tdsRates(): TdsRateEntityModel[] | undefined;
|
|
65
|
-
get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
|
|
66
|
-
get gstRates(): GstRateEntityModel[] | undefined;
|
|
67
|
-
getNextStatus(currentUser: IUserEntity, action: VendorActionEnum, vendorFlowConfigContextData: IVendorFlowConfigContextData): VendorStatusEnum;
|
|
68
|
-
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
69
|
-
combinedActions?: Record<string, {
|
|
70
|
-
combineActions: VendorActionEnum[];
|
|
71
|
-
label: string;
|
|
72
|
-
}>;
|
|
73
|
-
customLabels?: Partial<Record<VendorActionEnum, string>>;
|
|
74
|
-
}): IRowActions<EntityEnum.VENDOR>[];
|
|
75
|
-
getUpdateActionVisibility(currentUser: UserEntityModel): {
|
|
76
|
-
[key: string]: () => boolean;
|
|
77
|
-
};
|
|
78
47
|
static readonly VENDOR_ENTITY_DOCUMENT_TYPES: readonly ["pan", "gst"];
|
|
79
48
|
/**
|
|
80
49
|
* Default number of days added to the Invoice Date to calculate the Due Date,
|
|
@@ -90,4 +59,23 @@ export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR
|
|
|
90
59
|
* @see VendorEntityModel.paymentDueDays
|
|
91
60
|
*/
|
|
92
61
|
static readonly DEFAULT_DUE_DAYS = 7;
|
|
62
|
+
stateModel?: StateEntityModel;
|
|
63
|
+
populateOrganizationTypeModel(organizationTypeEntityModels: OrganizationTypeEntityModel[]): null;
|
|
64
|
+
getPanNoFourthCharacter(): string;
|
|
65
|
+
static relationConfigs: RelationConfigs<[EntityEnum.STATE], EntityEnum.VENDOR>;
|
|
66
|
+
static fromEntity(entity: IVendorEntity): VendorEntityModel;
|
|
67
|
+
getRelationConfigs(): any[];
|
|
68
|
+
getNextStatus(currentUser: IUserEntity, dto: IEntityUpdateDto<IVendorEntity> & {
|
|
69
|
+
actionData: IVendorActionDataDto;
|
|
70
|
+
}): VendorStatusEnum;
|
|
71
|
+
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
72
|
+
combinedActions?: Record<string, {
|
|
73
|
+
combineActions: VendorActionEnum[];
|
|
74
|
+
label: string;
|
|
75
|
+
}>;
|
|
76
|
+
customLabels?: Partial<Record<VendorActionEnum, string>>;
|
|
77
|
+
}): IRowActions<EntityEnum.VENDOR>[];
|
|
78
|
+
getUpdateActionVisibility(currentUser: UserEntityModel): {
|
|
79
|
+
[key: string]: () => boolean;
|
|
80
|
+
};
|
|
93
81
|
}
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VendorEntityModel = void 0;
|
|
4
4
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
5
|
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
7
|
+
const exceptions_1 = require("../../exceptions");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const vendor_status_enum_1 = require("../enums/vendor-status.enum");
|
|
6
10
|
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
7
|
-
const
|
|
11
|
+
const vendor_contract_applicability_enum_1 = require("../enums/vendor_contract_applicability_enum");
|
|
8
12
|
const vendor_gst_type_enum_1 = require("../enums/vendor_gst_type_enum");
|
|
13
|
+
const vendor_location_type_enum_1 = require("../enums/vendor_location_type_enum");
|
|
9
14
|
const vendor_pan_type_enum_1 = require("../enums/vendor_pan_type_enum");
|
|
10
|
-
const vendor_contract_applicability_enum_1 = require("../enums/vendor_contract_applicability_enum");
|
|
11
|
-
const vendor_status_enum_1 = require("../enums/vendor-status.enum");
|
|
12
|
-
const exceptions_1 = require("../../exceptions");
|
|
13
|
-
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
14
15
|
const vendor_flow_config_1 = require("../flow-configs/vendor-flow.config");
|
|
15
|
-
const utils_1 = require("../../utils");
|
|
16
16
|
class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
@@ -24,12 +24,30 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
24
24
|
this.gstType = vendor_gst_type_enum_1.VendorGstTypeEnum.REGISTERED;
|
|
25
25
|
this.panType = vendor_pan_type_enum_1.VendorPanTypeEnum.AVAILABLE;
|
|
26
26
|
this.contractApplicability = vendor_contract_applicability_enum_1.VendorContractApplicabilityEnum.YES;
|
|
27
|
-
this.status = vendor_status_enum_1.VendorStatusEnum.CREATE_APPROVAL;
|
|
28
|
-
this.remark = null;
|
|
29
27
|
this.createdOn = 0;
|
|
30
28
|
this.updatedOn = 0;
|
|
31
29
|
this.createdBy = 0;
|
|
32
30
|
this.updatedBy = 0;
|
|
31
|
+
this.status = vendor_status_enum_1.VendorStatusEnum.CREATE_APPROVAL;
|
|
32
|
+
this.remark = null;
|
|
33
|
+
}
|
|
34
|
+
populateOrganizationTypeModel(organizationTypeEntityModels) {
|
|
35
|
+
const panType = this.getPanNoFourthCharacter();
|
|
36
|
+
if (!panType) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
if (panType) {
|
|
40
|
+
this.organizationType = organizationTypeEntityModels.find((model) => model.code === panType);
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
getPanNoFourthCharacter() {
|
|
45
|
+
var _a;
|
|
46
|
+
if (this.panType === vendor_pan_type_enum_1.VendorPanTypeEnum.AVAILABLE && this.panNo) {
|
|
47
|
+
const panNo = ((_a = this.panNo.split("/").pop()) === null || _a === void 0 ? void 0 : _a.split(".").shift()) || "";
|
|
48
|
+
return panNo.charAt(3) || "";
|
|
49
|
+
}
|
|
50
|
+
return "";
|
|
33
51
|
}
|
|
34
52
|
static fromEntity(entity) {
|
|
35
53
|
const result = new VendorEntityModel(entity_utils_interface_1.EntityEnum.VENDOR);
|
|
@@ -39,85 +57,7 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
39
57
|
getRelationConfigs() {
|
|
40
58
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
41
59
|
}
|
|
42
|
-
|
|
43
|
-
// many_to_many -> many_to_many verified
|
|
44
|
-
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
|
|
45
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
46
|
-
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
47
|
-
var _a;
|
|
48
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
|
|
49
|
-
if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
|
|
50
|
-
accumulator.push(current);
|
|
51
|
-
}
|
|
52
|
-
return accumulator;
|
|
53
|
-
}, []);
|
|
54
|
-
}
|
|
55
|
-
get vendorInvoiceItems() {
|
|
56
|
-
// one_to_many -> one_to_many verified
|
|
57
|
-
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
|
|
58
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
59
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
60
|
-
var _a;
|
|
61
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
|
|
62
|
-
if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
|
|
63
|
-
accumulator.push(current);
|
|
64
|
-
}
|
|
65
|
-
return accumulator;
|
|
66
|
-
}, []);
|
|
67
|
-
}
|
|
68
|
-
get voucherTypes() {
|
|
69
|
-
// many_to_many -> many_to_many verified
|
|
70
|
-
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one'}
|
|
71
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
72
|
-
// ['vendor_invoice_item', 'voucher_type'] -> many_to_one
|
|
73
|
-
var _a;
|
|
74
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.voucherType).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
|
|
75
|
-
if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
|
|
76
|
-
accumulator.push(current);
|
|
77
|
-
}
|
|
78
|
-
return accumulator;
|
|
79
|
-
}, []);
|
|
80
|
-
}
|
|
81
|
-
get tdsRates() {
|
|
82
|
-
// many_to_many -> many_to_many verified
|
|
83
|
-
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->tds_rate': 'many_to_one'}
|
|
84
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
85
|
-
// ['vendor_invoice_item', 'tds_rate'] -> many_to_one
|
|
86
|
-
var _a;
|
|
87
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.tdsRate).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
|
|
88
|
-
if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
|
|
89
|
-
accumulator.push(current);
|
|
90
|
-
}
|
|
91
|
-
return accumulator;
|
|
92
|
-
}, []);
|
|
93
|
-
}
|
|
94
|
-
get expenseHeads() {
|
|
95
|
-
// many_to_many -> many_to_many verified
|
|
96
|
-
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
|
|
97
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
98
|
-
// ['vendor_invoice_item', 'expense_head'] -> many_to_one
|
|
99
|
-
var _a;
|
|
100
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.expenseHead).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
101
|
-
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
102
|
-
accumulator.push(current);
|
|
103
|
-
}
|
|
104
|
-
return accumulator;
|
|
105
|
-
}, []);
|
|
106
|
-
}
|
|
107
|
-
get gstRates() {
|
|
108
|
-
// many_to_many -> many_to_many verified
|
|
109
|
-
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
|
|
110
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
111
|
-
// ['vendor_invoice_item', 'gst_rate'] -> many_to_one
|
|
112
|
-
var _a;
|
|
113
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
|
|
114
|
-
if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
|
|
115
|
-
accumulator.push(current);
|
|
116
|
-
}
|
|
117
|
-
return accumulator;
|
|
118
|
-
}, []);
|
|
119
|
-
}
|
|
120
|
-
getNextStatus(currentUser, action, vendorFlowConfigContextData) {
|
|
60
|
+
getNextStatus(currentUser, dto) {
|
|
121
61
|
if (!this.status) {
|
|
122
62
|
throw new exceptions_1.AppBadRequestException({
|
|
123
63
|
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
@@ -131,17 +71,17 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
131
71
|
message: [`No flow configuration found for status: ${this.status}`],
|
|
132
72
|
});
|
|
133
73
|
}
|
|
134
|
-
if (!
|
|
74
|
+
if (!(dto === null || dto === void 0 ? void 0 : dto.actionData)) {
|
|
135
75
|
throw new exceptions_1.AppBadRequestException({
|
|
136
76
|
key: error_key_enum_1.ErrorKeyEnum.ACTION_DATA,
|
|
137
|
-
message: ["actionData is required"],
|
|
77
|
+
message: ["dto.actionData is required"],
|
|
138
78
|
});
|
|
139
79
|
}
|
|
140
|
-
const matchingPermissionConfig = flowForStatus.actions[action];
|
|
80
|
+
const matchingPermissionConfig = flowForStatus.actions[dto.actionData.action];
|
|
141
81
|
if (!matchingPermissionConfig) {
|
|
142
82
|
throw new exceptions_1.AppBadRequestException({
|
|
143
83
|
key: error_key_enum_1.ErrorKeyEnum.ACTION,
|
|
144
|
-
message: [`Action '${action}' is not valid for the current status.`],
|
|
84
|
+
message: [`Action '${dto.actionData.action}' is not valid for the current status.`],
|
|
145
85
|
});
|
|
146
86
|
}
|
|
147
87
|
if (!currentUser.permissions || currentUser.permissions.length === 0) {
|
|
@@ -154,10 +94,10 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
154
94
|
if (!hasPermission) {
|
|
155
95
|
throw new exceptions_1.AppBadRequestException({
|
|
156
96
|
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
157
|
-
message: [`Current user does not have permission to ${action} vendor`],
|
|
97
|
+
message: [`Current user does not have permission to ${dto.actionData.action} vendor`],
|
|
158
98
|
});
|
|
159
99
|
}
|
|
160
|
-
const nextStatus = matchingPermissionConfig.next(
|
|
100
|
+
const nextStatus = matchingPermissionConfig.next();
|
|
161
101
|
return nextStatus;
|
|
162
102
|
}
|
|
163
103
|
getAvailableActions(currentUser, config) {
|
|
@@ -177,45 +117,6 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
177
117
|
}
|
|
178
118
|
}
|
|
179
119
|
exports.VendorEntityModel = VendorEntityModel;
|
|
180
|
-
VendorEntityModel.relationConfigs = [
|
|
181
|
-
{
|
|
182
|
-
name: entity_utils_interface_1.EntityEnum.STATE,
|
|
183
|
-
relation: relation_type_enum_1.RelationType.ONE,
|
|
184
|
-
key: "stateModel",
|
|
185
|
-
mapKeyConfig: {
|
|
186
|
-
relationKey: "name",
|
|
187
|
-
key: "state",
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: entity_utils_interface_1.EntityEnum.COUNTRY,
|
|
192
|
-
relation: relation_type_enum_1.RelationType.ONE,
|
|
193
|
-
key: "countryModel",
|
|
194
|
-
mapKeyConfig: {
|
|
195
|
-
relationKey: "name",
|
|
196
|
-
key: "country",
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE,
|
|
201
|
-
relation: relation_type_enum_1.RelationType.ONE,
|
|
202
|
-
key: "organizationType",
|
|
203
|
-
mapKeyConfig: {
|
|
204
|
-
relationKey: "id",
|
|
205
|
-
key: "organizationTypeId",
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: entity_utils_interface_1.EntityEnum.VENDOR_INVOICE,
|
|
210
|
-
relation: relation_type_enum_1.RelationType.MANY,
|
|
211
|
-
key: "vendorInvoices",
|
|
212
|
-
mapKeyConfig: {
|
|
213
|
-
relationKey: "vendorId",
|
|
214
|
-
key: "id",
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
];
|
|
218
|
-
//
|
|
219
120
|
VendorEntityModel.VENDOR_ENTITY_DOCUMENT_TYPES = ["pan", "gst"];
|
|
220
121
|
/**
|
|
221
122
|
* Default number of days added to the Invoice Date to calculate the Due Date,
|
|
@@ -231,3 +132,23 @@ VendorEntityModel.VENDOR_ENTITY_DOCUMENT_TYPES = ["pan", "gst"];
|
|
|
231
132
|
* @see VendorEntityModel.paymentDueDays
|
|
232
133
|
*/
|
|
233
134
|
VendorEntityModel.DEFAULT_DUE_DAYS = 7;
|
|
135
|
+
VendorEntityModel.relationConfigs = [
|
|
136
|
+
{
|
|
137
|
+
name: entity_utils_interface_1.EntityEnum.STATE,
|
|
138
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
139
|
+
key: "stateModel",
|
|
140
|
+
mapKeyConfig: {
|
|
141
|
+
relationKey: "name",
|
|
142
|
+
key: "state",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
// {
|
|
146
|
+
// name: EntityEnum.OFFICE_LOCATION,
|
|
147
|
+
// relation: RelationType.MANY,
|
|
148
|
+
// key: "officeLocations",
|
|
149
|
+
// mapKeyConfig: {
|
|
150
|
+
// relationKey: "id",
|
|
151
|
+
// key: "officeLocationId",
|
|
152
|
+
// },
|
|
153
|
+
// },
|
|
154
|
+
];
|
|
@@ -9,11 +9,6 @@
|
|
|
9
9
|
// import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
10
10
|
// import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
11
11
|
// import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
12
|
-
// import { VendorEntityModel } from "./vendor.entity.model";
|
|
13
|
-
// import { StateEntityModel } from "./state.entity.model";
|
|
14
|
-
// import { CountryEntityModel } from "./country.entity.model";
|
|
15
|
-
// import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
16
|
-
// import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
17
12
|
// export class VendorInvoiceItemEntityModel extends BaseEntityModel<EntityEnum.VENDOR_INVOICE_ITEM> implements IVendorInvoiceItemEntity {
|
|
18
13
|
// id: number = 0;
|
|
19
14
|
// vendorInvoiceId: number = 0;
|
|
@@ -94,39 +89,4 @@
|
|
|
94
89
|
// getRelationConfigs(): any[] {
|
|
95
90
|
// return this.constructor.prototype.constructor.relationConfigs || [];
|
|
96
91
|
// }
|
|
97
|
-
// get vendor(): VendorEntityModel | undefined {
|
|
98
|
-
// // many_to_one -> many_to_one verified
|
|
99
|
-
// // {'vendor_invoice_item->vendor_invoice': 'many_to_one', 'vendor_invoice->vendor': 'many_to_one'}
|
|
100
|
-
// // ['vendor_invoice_item', 'vendor_invoice'] -> many_to_one
|
|
101
|
-
// // ['vendor_invoice', 'vendor'] -> many_to_one
|
|
102
|
-
// return this.vendorInvoice?.vendor;
|
|
103
|
-
// }
|
|
104
|
-
// get state(): StateEntityModel | undefined {
|
|
105
|
-
// // many_to_one -> many_to_one verified
|
|
106
|
-
// // {'vendor_invoice_item->vendor_invoice': 'many_to_one', 'vendor_invoice->vendor': 'many_to_one', 'vendor->state': 'many_to_one'}
|
|
107
|
-
// // ['vendor_invoice', 'vendor'] -> many_to_one
|
|
108
|
-
// // ['vendor', 'state'] -> many_to_one
|
|
109
|
-
// return this.vendor?.state;
|
|
110
|
-
// }
|
|
111
|
-
// get country(): CountryEntityModel | undefined {
|
|
112
|
-
// // many_to_one -> many_to_one verified
|
|
113
|
-
// // {'vendor_invoice_item->vendor_invoice': 'many_to_one', 'vendor_invoice->vendor': 'many_to_one', 'vendor->country': 'many_to_one'}
|
|
114
|
-
// // ['vendor_invoice', 'vendor'] -> many_to_one
|
|
115
|
-
// // ['vendor', 'country'] -> many_to_one
|
|
116
|
-
// return this.vendor?.country;
|
|
117
|
-
// }
|
|
118
|
-
// get organizationType(): OrganizationTypeEntityModel | undefined {
|
|
119
|
-
// // many_to_one -> many_to_one verified
|
|
120
|
-
// // {'vendor_invoice_item->vendor_invoice': 'many_to_one', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one'}
|
|
121
|
-
// // ['vendor_invoice', 'vendor'] -> many_to_one
|
|
122
|
-
// // ['vendor', 'organization_type'] -> many_to_one
|
|
123
|
-
// return this.vendor?.organizationType;
|
|
124
|
-
// }
|
|
125
|
-
// get officeLocation(): OfficeLocationEntityModel | undefined {
|
|
126
|
-
// // many_to_one -> many_to_one verified
|
|
127
|
-
// // {'vendor_invoice_item->vendor_invoice': 'many_to_one', 'vendor_invoice->office_location': 'many_to_one'}
|
|
128
|
-
// // ['vendor_invoice_item', 'vendor_invoice'] -> many_to_one
|
|
129
|
-
// // ['vendor_invoice', 'office_location'] -> many_to_one
|
|
130
|
-
// return this.vendorInvoice?.officeLocation;
|
|
131
|
-
// }
|
|
132
92
|
// }
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
|
|
2
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
3
2
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
4
|
import { IVendorInvoiceItemEntity } from "../interface/vendor_invoice_item.entity.interface";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { IGstRateEntity } from "../interface/gst_rate.entity.interface";
|
|
6
|
+
import { ITdsRateEntity } from "../interface/tds_rate.entity.interface";
|
|
7
|
+
import { IVendorEntity } from "../interface/vendor.entity.interface";
|
|
7
8
|
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
8
9
|
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
9
10
|
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
10
11
|
import { VendorEntityModel } from "./vendor.entity.model";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
13
|
+
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
14
|
+
export interface IVendorInvoiceItemEntityAmounts {
|
|
15
|
+
gstAmount: number;
|
|
16
|
+
tdsAmount: number;
|
|
17
|
+
invoiceAmount: number;
|
|
18
|
+
netAmount: number;
|
|
19
|
+
}
|
|
18
20
|
export declare class VendorInvoiceItemEntityModel extends BaseEntityModel<EntityEnum.VENDOR_INVOICE_ITEM> implements IVendorInvoiceItemEntity {
|
|
19
21
|
id: number;
|
|
20
22
|
vendorInvoiceId: number;
|
|
@@ -28,13 +30,13 @@ export declare class VendorInvoiceItemEntityModel extends BaseEntityModel<Entity
|
|
|
28
30
|
netAmount: number;
|
|
29
31
|
quantity: number;
|
|
30
32
|
rate: number;
|
|
33
|
+
remark: Nullable<string>;
|
|
34
|
+
gstAmount: number;
|
|
35
|
+
tdsAmount: number;
|
|
31
36
|
createdOn: number;
|
|
32
37
|
updatedOn: number;
|
|
33
38
|
createdBy: number;
|
|
34
39
|
updatedBy: number;
|
|
35
|
-
remark: Nullable<string>;
|
|
36
|
-
gstAmount: number;
|
|
37
|
-
tdsAmount: number;
|
|
38
40
|
vendorInvoice?: VendorInvoiceEntityModel;
|
|
39
41
|
voucherType?: VoucherTypeEntityModel;
|
|
40
42
|
expenseHead?: ExpenseHeadEntityModel;
|
|
@@ -49,11 +51,6 @@ export declare class VendorInvoiceItemEntityModel extends BaseEntityModel<Entity
|
|
|
49
51
|
], EntityEnum.VENDOR_INVOICE_ITEM>;
|
|
50
52
|
static fromEntity(entity: IVendorInvoiceItemEntity): VendorInvoiceItemEntityModel;
|
|
51
53
|
getRelationConfigs(): any[];
|
|
52
|
-
get vendor(): VendorEntityModel | undefined;
|
|
53
|
-
get state(): StateEntityModel | undefined;
|
|
54
|
-
get country(): CountryEntityModel | undefined;
|
|
55
|
-
get organizationType(): OrganizationTypeEntityModel | undefined;
|
|
56
|
-
get officeLocation(): OfficeLocationEntityModel | undefined;
|
|
57
54
|
static calculateAmounts(params: {
|
|
58
55
|
basicAmount: number;
|
|
59
56
|
gstRateEntity: IGstRateEntity;
|
|
@@ -63,9 +60,3 @@ export declare class VendorInvoiceItemEntityModel extends BaseEntityModel<Entity
|
|
|
63
60
|
static tdsRate(vendorEntity: IVendorEntity, tdsRateEntity: ITdsRateEntity): number;
|
|
64
61
|
static AMOUNT_KEYS: (keyof IVendorInvoiceItemEntityAmounts)[];
|
|
65
62
|
}
|
|
66
|
-
export interface IVendorInvoiceItemEntityAmounts {
|
|
67
|
-
gstAmount: number;
|
|
68
|
-
tdsAmount: number;
|
|
69
|
-
invoiceAmount: number;
|
|
70
|
-
netAmount: number;
|
|
71
|
-
}
|