law-common 11.4.0 → 12.0.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/README.md +1 -1
- package/dist/src/api/index.d.ts +4 -0
- package/dist/src/api/index.js +4 -0
- package/dist/src/api/interface/vendor_advance.create.dto.interface.d.ts +10 -0
- package/dist/src/api/interface/vendor_advance.create.dto.interface.js +12 -0
- package/dist/src/api/interface/vendor_advance.update.dto.interface.d.ts +24 -0
- package/dist/src/api/interface/vendor_advance.update.dto.interface.js +18 -0
- package/dist/src/api/interface/vendor_invoice.update.dto.interface.d.ts +3 -0
- package/dist/src/api/interface/vendor_invoice.update.dto.interface.js +1 -0
- package/dist/src/api/interface/vendor_invoice_advance.create.dto.interface.d.ts +5 -0
- package/dist/src/api/interface/vendor_invoice_advance.update.dto.interface.d.ts +17 -0
- package/dist/src/api/interface/vendor_invoice_advance.update.dto.interface.js +17 -0
- package/dist/src/constants/website_lead.constants.d.ts +2 -1
- package/dist/src/constants/website_lead.constants.js +3 -2
- package/dist/src/entities/enums/vendor_advance_payment_mode.d.ts +7 -0
- package/dist/src/entities/enums/vendor_advance_payment_mode.js +11 -0
- package/dist/src/entities/enums/vendor_advance_status_enum.d.ts +5 -0
- package/dist/src/entities/enums/vendor_advance_status_enum.js +9 -0
- package/dist/src/entities/enums/vendor_invoice_action.enum.d.ts +2 -1
- package/dist/src/entities/enums/vendor_invoice_action.enum.js +1 -0
- package/dist/src/entities/enums/vendor_invoice_advance_status_enum.d.ts +5 -0
- package/dist/src/entities/enums/vendor_invoice_advance_status_enum.js +9 -0
- package/dist/src/entities/flow-configs/vendor-invoice-flow.config.d.ts +4 -0
- package/dist/src/entities/flow-configs/vendor-invoice-flow.config.js +25 -0
- package/dist/src/entities/flow-configs/vendor_advance_flow.config.d.ts +6 -0
- package/dist/src/entities/flow-configs/vendor_advance_flow.config.js +75 -0
- package/dist/src/entities/flow-configs/vendor_invoice_advance_flow.config.d.ts +6 -0
- package/dist/src/entities/flow-configs/vendor_invoice_advance_flow.config.js +70 -0
- package/dist/src/entities/flow-configs/vendor_tds_liability_flow.config.js +1 -1
- package/dist/src/entities/index.d.ts +9 -0
- package/dist/src/entities/index.js +9 -0
- package/dist/src/entities/interface/entity.utils.interface.d.ts +9 -3
- package/dist/src/entities/interface/entity.utils.interface.js +2 -0
- package/dist/src/entities/interface/vendor_advance.entity.interface.d.ts +24 -0
- package/dist/src/entities/interface/vendor_advance.entity.interface.js +2 -0
- package/dist/src/entities/interface/vendor_invoice_advance.entity.interface.d.ts +11 -0
- package/dist/src/entities/interface/vendor_invoice_advance.entity.interface.js +2 -0
- package/dist/src/entities/model/entity.model.interface.js +4 -0
- package/dist/src/entities/model/vendor.entity.model.d.ts +24 -5
- package/dist/src/entities/model/vendor.entity.model.js +74 -4
- package/dist/src/entities/model/vendor_advance.entity.model.d.ts +80 -0
- package/dist/src/entities/model/vendor_advance.entity.model.js +262 -0
- package/dist/src/entities/model/vendor_invoice_advance.entity.model.d.ts +73 -0
- package/dist/src/entities/model/vendor_invoice_advance.entity.model.js +243 -0
- package/package.json +56 -50
- package/dist/src/api/interface/document_upload.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/document_upload.create.dto.interface.autocode.js +0 -27
- package/dist/src/api/interface/document_upload.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/document_upload.update.dto.interface.autocode.js +0 -8
- package/dist/src/api/interface/expense_head.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/expense_head.create.dto.interface.autocode.js +0 -4
- package/dist/src/api/interface/expense_head.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/expense_head.update.dto.interface.autocode.js +0 -3
- package/dist/src/api/interface/gst_rate.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/gst_rate.create.dto.interface.autocode.js +0 -4
- package/dist/src/api/interface/gst_rate.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/gst_rate.update.dto.interface.autocode.js +0 -3
- package/dist/src/api/interface/organization_type.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/organization_type.create.dto.interface.autocode.js +0 -4
- package/dist/src/api/interface/organization_type.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/organization_type.update.dto.interface.autocode.js +0 -3
- package/dist/src/api/interface/state.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/state.create.dto.interface.autocode.js +0 -6
- package/dist/src/api/interface/state.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/state.update.dto.interface.autocode.js +0 -10
- package/dist/src/api/interface/tds_rate.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/tds_rate.create.dto.interface.autocode.js +0 -6
- package/dist/src/api/interface/tds_rate.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/tds_rate.update.dto.interface.autocode.js +0 -3
- package/dist/src/api/interface/tds_rate_voucher_type_mapping.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/tds_rate_voucher_type_mapping.create.dto.interface.autocode.js +0 -7
- package/dist/src/api/interface/tds_rate_voucher_type_mapping.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/tds_rate_voucher_type_mapping.update.dto.interface.autocode.js +0 -3
- package/dist/src/api/interface/vendor.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/vendor.create.dto.interface.autocode.js +0 -74
- package/dist/src/api/interface/vendor.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/vendor.update.dto.interface.autocode.js +0 -8
- package/dist/src/api/interface/vendor_invoice.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/vendor_invoice.create.dto.interface.autocode.js +0 -21
- package/dist/src/api/interface/vendor_invoice.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/vendor_invoice.update.dto.interface.autocode.js +0 -8
- package/dist/src/api/interface/vendor_invoice_item.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/vendor_invoice_item.create.dto.interface.autocode.js +0 -6
- package/dist/src/api/interface/vendor_invoice_item.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/vendor_invoice_item.update.dto.interface.autocode.js +0 -6
- package/dist/src/api/interface/voucher_type.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/voucher_type.create.dto.interface.autocode.js +0 -4
- package/dist/src/api/interface/voucher_type.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/voucher_type.update.dto.interface.autocode.js +0 -3
- package/dist/src/api/interface/website_lead.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/website_lead.create.dto.interface.autocode.js +0 -6
- package/dist/src/entities/enums/address_book_status_enum.autocode.d.ts +0 -5
- package/dist/src/entities/enums/address_book_status_enum.autocode.js +0 -9
- package/dist/src/entities/enums/expense_head_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/expense_head_status_enum.autocode.js +0 -6
- package/dist/src/entities/enums/gst_rate_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/gst_rate_status_enum.autocode.js +0 -6
- package/dist/src/entities/enums/organization_type_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/organization_type_status_enum.autocode.js +0 -6
- package/dist/src/entities/enums/state_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/state_status_enum.autocode.js +0 -6
- package/dist/src/entities/enums/tds_rate_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/tds_rate_status_enum.autocode.js +0 -6
- package/dist/src/entities/enums/vendor_contract_applicability_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/vendor_contract_applicability_enum.autocode.js +0 -5
- package/dist/src/entities/enums/vendor_gst_type_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/vendor_gst_type_enum.autocode.js +0 -5
- package/dist/src/entities/enums/vendor_invoice_action_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/vendor_invoice_action_status_enum.autocode.js +0 -5
- package/dist/src/entities/enums/vendor_invoice_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/vendor_invoice_status_enum.autocode.js +0 -5
- package/dist/src/entities/enums/vendor_location_type_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/vendor_location_type_enum.autocode.js +0 -5
- package/dist/src/entities/enums/vendor_pan_type_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/vendor_pan_type_enum.autocode.js +0 -5
- package/dist/src/entities/enums/voucher_type_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/voucher_type_status_enum.autocode.js +0 -6
- package/dist/src/entities/interface/address-book.entity.interface.autocode.d.ts +0 -13
- package/dist/src/entities/interface/document_upload.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/document_upload.entity.interface.autocode.js +0 -10
- package/dist/src/entities/interface/expense_head.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/expense_head.entity.interface.autocode.js +0 -8
- package/dist/src/entities/interface/gst_rate.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/gst_rate.entity.interface.autocode.js +0 -8
- package/dist/src/entities/interface/organization_type.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/organization_type.entity.interface.autocode.js +0 -8
- package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.autocode.js +0 -7
- package/dist/src/entities/interface/state.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/state.entity.interface.autocode.js +0 -10
- package/dist/src/entities/interface/tds_rate.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/tds_rate.entity.interface.autocode.js +0 -12
- package/dist/src/entities/interface/tds_rate_voucher_type_mapping.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/tds_rate_voucher_type_mapping.entity.interface.autocode.js +0 -7
- package/dist/src/entities/interface/vendor.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/vendor.entity.interface.autocode.js +0 -24
- package/dist/src/entities/interface/vendor_invoice.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/vendor_invoice.entity.interface.autocode.js +0 -18
- package/dist/src/entities/interface/vendor_invoice_item.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/vendor_invoice_item.entity.interface.autocode.js +0 -17
- package/dist/src/entities/interface/voucher_type.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/voucher_type.entity.interface.autocode.js +0 -7
- package/dist/src/entities/model/document_upload.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/document_upload.entity.model.autocode.js +0 -25
- package/dist/src/entities/model/expense_head.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/expense_head.entity.model.autocode.js +0 -33
- package/dist/src/entities/model/gst_rate.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/gst_rate.entity.model.autocode.js +0 -22
- package/dist/src/entities/model/office_location.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/office_location.entity.model.autocode.js +0 -23
- package/dist/src/entities/model/organization_type.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/organization_type.entity.model.autocode.js +0 -22
- package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.autocode.js +0 -24
- package/dist/src/entities/model/tds_rate.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/tds_rate.entity.model.autocode.js +0 -261
- package/dist/src/entities/model/tds_rate_voucher_type_mapping.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/tds_rate_voucher_type_mapping.entity.model.autocode.js +0 -22
- package/dist/src/entities/model/vendor.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/vendor.entity.model.autocode.js +0 -60
- package/dist/src/entities/model/vendor_invoice.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/vendor_invoice.entity.model.autocode.js +0 -67
- package/dist/src/entities/model/vendor_invoice_item.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/vendor_invoice_item.entity.model.autocode.js +0 -132
- package/dist/src/entities/model/voucher_type.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/voucher_type.entity.model.autocode.js +0 -32
- /package/dist/src/{entities/interface/address-book.entity.interface.autocode.js → api/interface/vendor_invoice_advance.create.dto.interface.js} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
2
|
+
import { Nullable } from "./entity.utils.interface";
|
|
3
|
+
import { VendorAdvancePaymentMode } from "../enums/vendor_advance_payment_mode";
|
|
4
|
+
import { VendorAdvanceStatusEnum } from "../enums/vendor_advance_status_enum";
|
|
5
|
+
export interface IVendorAdvanceEntity extends IEntityAuditColumn {
|
|
6
|
+
id: number;
|
|
7
|
+
vendorId: number;
|
|
8
|
+
date: number;
|
|
9
|
+
amount: number;
|
|
10
|
+
paymentMode: VendorAdvancePaymentMode;
|
|
11
|
+
reference: string;
|
|
12
|
+
tdsPercent: number;
|
|
13
|
+
purpose?: Nullable<string>;
|
|
14
|
+
advanceDocument?: Nullable<string>;
|
|
15
|
+
amountPaid: number;
|
|
16
|
+
status: VendorAdvanceStatusEnum;
|
|
17
|
+
appliedAmount?: Nullable<number>;
|
|
18
|
+
gstRateId: number;
|
|
19
|
+
gstAmount: number;
|
|
20
|
+
invoiceAmount: number;
|
|
21
|
+
tdsRateId: number;
|
|
22
|
+
tdsAmount: number;
|
|
23
|
+
netAmount: number;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
2
|
+
import { VendorInvoiceAdvanceStatusEnum } from "../enums/vendor_invoice_advance_status_enum";
|
|
3
|
+
export interface IVendorInvoiceAdvanceEntity extends IEntityAuditColumn {
|
|
4
|
+
id: number;
|
|
5
|
+
date: number;
|
|
6
|
+
amount: number;
|
|
7
|
+
vendorInvoiceId: number;
|
|
8
|
+
vendorAdvanceId: number;
|
|
9
|
+
vendorId: number;
|
|
10
|
+
status: VendorInvoiceAdvanceStatusEnum;
|
|
11
|
+
}
|
|
@@ -70,8 +70,10 @@ const timesheet_history_entity_model_1 = require("./timesheet_history.entity.mod
|
|
|
70
70
|
const to_do_list_entity_model_1 = require("./to_do_list.entity.model");
|
|
71
71
|
const user_entity_model_1 = require("./user.entity.model");
|
|
72
72
|
const vendor_entity_model_1 = require("./vendor.entity.model");
|
|
73
|
+
const vendor_advance_entity_model_1 = require("./vendor_advance.entity.model");
|
|
73
74
|
const vendor_history_entity_model_1 = require("./vendor_history.entity.model");
|
|
74
75
|
const vendor_invoice_entity_model_1 = require("./vendor_invoice.entity.model");
|
|
76
|
+
const vendor_invoice_advance_entity_model_1 = require("./vendor_invoice_advance.entity.model");
|
|
75
77
|
const vendor_invoice_history_entity_model_1 = require("./vendor_invoice_history.entity.model");
|
|
76
78
|
const vendor_invoice_item_entity_model_1 = require("./vendor_invoice_item.entity.model");
|
|
77
79
|
const vendor_invoice_item_history_entity_model_1 = require("./vendor_invoice_item_history.entity.model");
|
|
@@ -184,6 +186,8 @@ exports.entityEnumToEntityModel = {
|
|
|
184
186
|
[entity_utils_interface_1.EntityEnum.LEAVE_APPROVAL]: leave_approval_entity_model_1.LeaveApprovalEntityModel.fromEntity,
|
|
185
187
|
[entity_utils_interface_1.EntityEnum.VENDOR_TDS_LIABILITY]: vendor_tds_liability_entity_model_1.VendorTdsLiabilityEntityModel.fromEntity,
|
|
186
188
|
[entity_utils_interface_1.EntityEnum.VENDOR_TDS_CHALLAN]: vendor_tds_challan_entity_model_1.VendorTdsChallanEntityModel.fromEntity,
|
|
189
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_ADVANCE]: vendor_advance_entity_model_1.VendorAdvanceEntityModel.fromEntity,
|
|
190
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_ADVANCE]: vendor_invoice_advance_entity_model_1.VendorInvoiceAdvanceEntityModel.fromEntity,
|
|
187
191
|
};
|
|
188
192
|
function entityMapToModels(entityMap) {
|
|
189
193
|
for (const entityName in entityMap) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
|
|
2
2
|
import { BaseEntityModel } from "./base.entity.model";
|
|
3
3
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
+
import { IUserEntity } from "../interface/user.entity.interface";
|
|
5
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
6
|
+
import { IRowActions } from "./interface/row-actions.interface";
|
|
4
7
|
import { IVendorEntity } from "../interface/vendor.entity.interface";
|
|
5
8
|
import { VendorLocationTypeEnum } from "../enums/vendor_location_type_enum";
|
|
6
9
|
import { VendorGstTypeEnum } from "../enums/vendor_gst_type_enum";
|
|
@@ -11,16 +14,19 @@ import { StateEntityModel } from "./state.entity.model";
|
|
|
11
14
|
import { CountryEntityModel } from "./country.entity.model";
|
|
12
15
|
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
13
16
|
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
17
|
+
import { VendorAdvanceEntityModel } from "./vendor_advance.entity.model";
|
|
18
|
+
import { VendorInvoiceAdvanceEntityModel } from "./vendor_invoice_advance.entity.model";
|
|
14
19
|
import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
15
20
|
import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
|
|
16
21
|
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
17
22
|
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
18
|
-
import {
|
|
23
|
+
import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
|
|
24
|
+
import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
|
|
25
|
+
import { BankEntityModel } from "./bank.entity.model";
|
|
19
26
|
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
20
|
-
import {
|
|
27
|
+
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
28
|
+
import { VendorInvoicePaymentEntityModel } from "./vendor_invoice_payment.entity.model";
|
|
21
29
|
import { VendorActionEnum } from "../enums/vendor-action.enum";
|
|
22
|
-
import { IRowActions } from "./interface/row-actions.interface";
|
|
23
|
-
import { UserEntityModel } from "./user.entity.model";
|
|
24
30
|
import { IVendorFlowConfigContextData } from "../../api";
|
|
25
31
|
export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR> implements IVendorEntity {
|
|
26
32
|
id: number;
|
|
@@ -55,15 +61,28 @@ export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR
|
|
|
55
61
|
countryModel?: CountryEntityModel;
|
|
56
62
|
organizationType?: OrganizationTypeEntityModel;
|
|
57
63
|
vendorInvoices?: VendorInvoiceEntityModel[];
|
|
58
|
-
|
|
64
|
+
vendorAdvances?: VendorAdvanceEntityModel[];
|
|
65
|
+
vendorInvoiceAdvances?: VendorInvoiceAdvanceEntityModel[];
|
|
66
|
+
static relationConfigs: RelationConfigs<[
|
|
67
|
+
EntityEnum.STATE,
|
|
68
|
+
EntityEnum.COUNTRY,
|
|
69
|
+
EntityEnum.ORGANIZATION_TYPE,
|
|
70
|
+
EntityEnum.VENDOR_INVOICE,
|
|
71
|
+
EntityEnum.VENDOR_ADVANCE,
|
|
72
|
+
EntityEnum.VENDOR_INVOICE_ADVANCE
|
|
73
|
+
], EntityEnum.VENDOR>;
|
|
59
74
|
static fromEntity(entity: IVendorEntity): VendorEntityModel;
|
|
60
75
|
getRelationConfigs(): any[];
|
|
61
76
|
get officeLocations(): OfficeLocationEntityModel[] | undefined;
|
|
62
77
|
get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
|
|
63
78
|
get voucherTypes(): VoucherTypeEntityModel[] | undefined;
|
|
64
79
|
get tdsRates(): TdsRateEntityModel[] | undefined;
|
|
80
|
+
get vendorTdsLiabilitys(): VendorTdsLiabilityEntityModel[] | undefined;
|
|
81
|
+
get vendorTdsChallans(): VendorTdsChallanEntityModel[] | undefined;
|
|
65
82
|
get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
|
|
83
|
+
get banks(): BankEntityModel[] | undefined;
|
|
66
84
|
get gstRates(): GstRateEntityModel[] | undefined;
|
|
85
|
+
get vendorInvoicePayments(): VendorInvoicePaymentEntityModel[] | undefined;
|
|
67
86
|
getNextStatus(currentUser: IUserEntity, action: VendorActionEnum, vendorFlowConfigContextData: IVendorFlowConfigContextData): VendorStatusEnum;
|
|
68
87
|
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
69
88
|
combinedActions?: Record<string, {
|
|
@@ -4,15 +4,15 @@ 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
6
|
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
7
|
+
const exceptions_1 = require("../../exceptions");
|
|
8
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
7
10
|
const vendor_location_type_enum_1 = require("../enums/vendor_location_type_enum");
|
|
8
11
|
const vendor_gst_type_enum_1 = require("../enums/vendor_gst_type_enum");
|
|
9
12
|
const vendor_pan_type_enum_1 = require("../enums/vendor_pan_type_enum");
|
|
10
13
|
const vendor_contract_applicability_enum_1 = require("../enums/vendor_contract_applicability_enum");
|
|
11
14
|
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);
|
|
@@ -91,6 +91,32 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
91
91
|
return accumulator;
|
|
92
92
|
}, []);
|
|
93
93
|
}
|
|
94
|
+
get vendorTdsLiabilitys() {
|
|
95
|
+
// many_to_many -> many_to_many verified
|
|
96
|
+
// {'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_liability': 'one_to_many'}
|
|
97
|
+
// ['organization_type', 'tds_rate'] -> many_to_many
|
|
98
|
+
// ['tds_rate', 'vendor_tds_liability'] -> one_to_many
|
|
99
|
+
var _a;
|
|
100
|
+
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsLiabilitys).filter((vendorTdsLiability) => !!vendorTdsLiability).reduce((accumulator, current) => {
|
|
101
|
+
if (!accumulator.some((vendorTdsLiability) => vendorTdsLiability.id === current.id)) {
|
|
102
|
+
accumulator.push(current);
|
|
103
|
+
}
|
|
104
|
+
return accumulator;
|
|
105
|
+
}, []);
|
|
106
|
+
}
|
|
107
|
+
get vendorTdsChallans() {
|
|
108
|
+
// many_to_many -> many_to_many verified
|
|
109
|
+
// {'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many'}
|
|
110
|
+
// ['organization_type', 'tds_rate'] -> many_to_many
|
|
111
|
+
// ['tds_rate', 'vendor_tds_challan'] -> one_to_many
|
|
112
|
+
var _a;
|
|
113
|
+
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsChallans).filter((vendorTdsChallan) => !!vendorTdsChallan).reduce((accumulator, current) => {
|
|
114
|
+
if (!accumulator.some((vendorTdsChallan) => vendorTdsChallan.id === current.id)) {
|
|
115
|
+
accumulator.push(current);
|
|
116
|
+
}
|
|
117
|
+
return accumulator;
|
|
118
|
+
}, []);
|
|
119
|
+
}
|
|
94
120
|
get expenseHeads() {
|
|
95
121
|
// many_to_many -> many_to_many verified
|
|
96
122
|
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
|
|
@@ -104,6 +130,19 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
104
130
|
return accumulator;
|
|
105
131
|
}, []);
|
|
106
132
|
}
|
|
133
|
+
get banks() {
|
|
134
|
+
// many_to_many -> many_to_many verified
|
|
135
|
+
// {'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
|
|
136
|
+
// ['tds_rate', 'vendor_tds_challan'] -> one_to_many
|
|
137
|
+
// ['vendor_tds_challan', 'bank'] -> many_to_one
|
|
138
|
+
var _a;
|
|
139
|
+
return (_a = this.vendorTdsChallans) === null || _a === void 0 ? void 0 : _a.flatMap((vendorTdsChallan) => vendorTdsChallan.bank).filter((bank) => !!bank).reduce((accumulator, current) => {
|
|
140
|
+
if (!accumulator.some((bank) => bank.id === current.id)) {
|
|
141
|
+
accumulator.push(current);
|
|
142
|
+
}
|
|
143
|
+
return accumulator;
|
|
144
|
+
}, []);
|
|
145
|
+
}
|
|
107
146
|
get gstRates() {
|
|
108
147
|
// many_to_many -> many_to_many verified
|
|
109
148
|
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
|
|
@@ -117,6 +156,19 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
117
156
|
return accumulator;
|
|
118
157
|
}, []);
|
|
119
158
|
}
|
|
159
|
+
get vendorInvoicePayments() {
|
|
160
|
+
// one_to_many -> one_to_many verified
|
|
161
|
+
// {'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
|
|
162
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
163
|
+
// ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
|
|
164
|
+
var _a;
|
|
165
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments).filter((vendorInvoicePayment) => !!vendorInvoicePayment).reduce((accumulator, current) => {
|
|
166
|
+
if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
|
|
167
|
+
accumulator.push(current);
|
|
168
|
+
}
|
|
169
|
+
return accumulator;
|
|
170
|
+
}, []);
|
|
171
|
+
}
|
|
120
172
|
getNextStatus(currentUser, action, vendorFlowConfigContextData) {
|
|
121
173
|
if (!this.status) {
|
|
122
174
|
throw new exceptions_1.AppBadRequestException({
|
|
@@ -141,7 +193,7 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
141
193
|
if (!matchingPermissionConfig) {
|
|
142
194
|
throw new exceptions_1.AppBadRequestException({
|
|
143
195
|
key: error_key_enum_1.ErrorKeyEnum.ACTION,
|
|
144
|
-
message: [`Action '${action}' is not valid for the current status
|
|
196
|
+
message: [`Action '${action}' is not valid for the current status.`],
|
|
145
197
|
});
|
|
146
198
|
}
|
|
147
199
|
if (!currentUser.permissions || currentUser.permissions.length === 0) {
|
|
@@ -214,6 +266,24 @@ VendorEntityModel.relationConfigs = [
|
|
|
214
266
|
key: "id",
|
|
215
267
|
},
|
|
216
268
|
},
|
|
269
|
+
{
|
|
270
|
+
name: entity_utils_interface_1.EntityEnum.VENDOR_ADVANCE,
|
|
271
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
272
|
+
key: "vendorAdvances",
|
|
273
|
+
mapKeyConfig: {
|
|
274
|
+
relationKey: "vendorId",
|
|
275
|
+
key: "id",
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_ADVANCE,
|
|
280
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
281
|
+
key: "vendorInvoiceAdvances",
|
|
282
|
+
mapKeyConfig: {
|
|
283
|
+
relationKey: "vendorId",
|
|
284
|
+
key: "id",
|
|
285
|
+
},
|
|
286
|
+
},
|
|
217
287
|
];
|
|
218
288
|
//
|
|
219
289
|
VendorEntityModel.VENDOR_ENTITY_DOCUMENT_TYPES = ["pan", "gst"];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
2
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
3
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
+
import { IUserEntity } from "../interface/user.entity.interface";
|
|
5
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
6
|
+
import { IRowActions } from "./interface/row-actions.interface";
|
|
7
|
+
import { IVendorAdvanceEntity } from "../interface/vendor_advance.entity.interface";
|
|
8
|
+
import { VendorAdvancePaymentMode } from "../enums/vendor_advance_payment_mode";
|
|
9
|
+
import { VendorAdvanceStatusEnum } from "../enums/vendor_advance_status_enum";
|
|
10
|
+
import { VendorEntityModel } from "./vendor.entity.model";
|
|
11
|
+
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
12
|
+
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
13
|
+
import { StateEntityModel } from "./state.entity.model";
|
|
14
|
+
import { CountryEntityModel } from "./country.entity.model";
|
|
15
|
+
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
16
|
+
import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
17
|
+
import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
|
|
18
|
+
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
19
|
+
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
20
|
+
import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
|
|
21
|
+
import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
|
|
22
|
+
import { BankEntityModel } from "./bank.entity.model";
|
|
23
|
+
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
24
|
+
import { VendorInvoicePaymentEntityModel } from "./vendor_invoice_payment.entity.model";
|
|
25
|
+
import { VendorAdvanceActionEnum } from "../../api";
|
|
26
|
+
import { IVendorAdvanceFlowConfigContextData } from "../flow-configs/vendor_advance_flow.config";
|
|
27
|
+
export declare class VendorAdvanceEntityModel extends BaseEntityModel<EntityEnum.VENDOR_ADVANCE> implements IVendorAdvanceEntity {
|
|
28
|
+
id: number;
|
|
29
|
+
vendorId: number;
|
|
30
|
+
date: number;
|
|
31
|
+
amount: number;
|
|
32
|
+
paymentMode: VendorAdvancePaymentMode;
|
|
33
|
+
reference: string;
|
|
34
|
+
tdsPercent: number;
|
|
35
|
+
purpose?: string;
|
|
36
|
+
advanceDocument?: string;
|
|
37
|
+
gstRateId: number;
|
|
38
|
+
gstAmount: number;
|
|
39
|
+
invoiceAmount: number;
|
|
40
|
+
tdsRateId: number;
|
|
41
|
+
tdsAmount: number;
|
|
42
|
+
netAmount: number;
|
|
43
|
+
amountPaid: number;
|
|
44
|
+
status: VendorAdvanceStatusEnum;
|
|
45
|
+
appliedAmount?: number;
|
|
46
|
+
createdOn: number;
|
|
47
|
+
updatedOn: number;
|
|
48
|
+
createdBy: number;
|
|
49
|
+
updatedBy: number;
|
|
50
|
+
vendor?: VendorEntityModel;
|
|
51
|
+
gstRate?: GstRateEntityModel;
|
|
52
|
+
tdsRate?: TdsRateEntityModel;
|
|
53
|
+
static relationConfigs: RelationConfigs<[EntityEnum.VENDOR, EntityEnum.GST_RATE, EntityEnum.TDS_RATE], EntityEnum.VENDOR_ADVANCE>;
|
|
54
|
+
static fromEntity(entity: IVendorAdvanceEntity): VendorAdvanceEntityModel;
|
|
55
|
+
getRelationConfigs(): any[];
|
|
56
|
+
get state(): StateEntityModel | undefined;
|
|
57
|
+
get country(): CountryEntityModel | undefined;
|
|
58
|
+
get vendorInvoices(): VendorInvoiceEntityModel[] | undefined;
|
|
59
|
+
get officeLocations(): OfficeLocationEntityModel[] | undefined;
|
|
60
|
+
get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
|
|
61
|
+
get voucherTypes(): VoucherTypeEntityModel[] | undefined;
|
|
62
|
+
get organizationTypes(): OrganizationTypeEntityModel[] | undefined;
|
|
63
|
+
get vendorTdsLiabilitys(): VendorTdsLiabilityEntityModel[] | undefined;
|
|
64
|
+
get vendorTdsChallans(): VendorTdsChallanEntityModel[] | undefined;
|
|
65
|
+
get banks(): BankEntityModel[] | undefined;
|
|
66
|
+
get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
|
|
67
|
+
get vendorInvoicePayments(): VendorInvoicePaymentEntityModel[] | undefined;
|
|
68
|
+
getNextStatus(currentUser: IUserEntity, action: VendorAdvanceActionEnum, vendorAdvanceFlowConfigContextData: IVendorAdvanceFlowConfigContextData): VendorAdvanceStatusEnum;
|
|
69
|
+
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
70
|
+
combinedActions?: Record<string, {
|
|
71
|
+
combineActions: VendorAdvanceActionEnum[];
|
|
72
|
+
label: string;
|
|
73
|
+
}>;
|
|
74
|
+
customLabels?: Partial<Record<VendorAdvanceActionEnum, string>>;
|
|
75
|
+
}): IRowActions<EntityEnum.VENDOR_ADVANCE>[];
|
|
76
|
+
getUpdateActionVisibility(currentUser: UserEntityModel): {
|
|
77
|
+
[key: string]: () => boolean;
|
|
78
|
+
};
|
|
79
|
+
getBalanceAmount(): number;
|
|
80
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VendorAdvanceEntityModel = void 0;
|
|
4
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
7
|
+
const exceptions_1 = require("../../exceptions");
|
|
8
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const vendor_advance_payment_mode_1 = require("../enums/vendor_advance_payment_mode");
|
|
11
|
+
const vendor_advance_status_enum_1 = require("../enums/vendor_advance_status_enum");
|
|
12
|
+
const vendor_advance_flow_config_1 = require("../flow-configs/vendor_advance_flow.config");
|
|
13
|
+
class VendorAdvanceEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.id = 0;
|
|
17
|
+
this.vendorId = 0;
|
|
18
|
+
this.date = 0;
|
|
19
|
+
this.amount = 0;
|
|
20
|
+
this.paymentMode = vendor_advance_payment_mode_1.VendorAdvancePaymentMode.NEFT;
|
|
21
|
+
this.reference = "";
|
|
22
|
+
this.tdsPercent = 0;
|
|
23
|
+
this.gstRateId = 0;
|
|
24
|
+
this.gstAmount = 0;
|
|
25
|
+
this.invoiceAmount = 0;
|
|
26
|
+
this.tdsRateId = 0;
|
|
27
|
+
this.tdsAmount = 0;
|
|
28
|
+
this.netAmount = 0;
|
|
29
|
+
this.amountPaid = 0;
|
|
30
|
+
this.status = vendor_advance_status_enum_1.VendorAdvanceStatusEnum.APPROVED;
|
|
31
|
+
this.createdOn = 0;
|
|
32
|
+
this.updatedOn = 0;
|
|
33
|
+
this.createdBy = 0;
|
|
34
|
+
this.updatedBy = 0;
|
|
35
|
+
}
|
|
36
|
+
static fromEntity(entity) {
|
|
37
|
+
const result = new VendorAdvanceEntityModel(entity_utils_interface_1.EntityEnum.VENDOR_ADVANCE);
|
|
38
|
+
Object.assign(result, entity);
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
getRelationConfigs() {
|
|
42
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
43
|
+
}
|
|
44
|
+
get state() {
|
|
45
|
+
// many_to_one -> many_to_one verified
|
|
46
|
+
// {'vendor_advance->vendor': 'many_to_one', 'vendor->state': 'many_to_one'}
|
|
47
|
+
// ['vendor_advance', 'vendor'] -> many_to_one
|
|
48
|
+
// ['vendor', 'state'] -> many_to_one
|
|
49
|
+
var _a;
|
|
50
|
+
return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.stateModel;
|
|
51
|
+
}
|
|
52
|
+
get country() {
|
|
53
|
+
// many_to_one -> many_to_one verified
|
|
54
|
+
// {'vendor_advance->vendor': 'many_to_one', 'vendor->country': 'many_to_one'}
|
|
55
|
+
// ['vendor_advance', 'vendor'] -> many_to_one
|
|
56
|
+
// ['vendor', 'country'] -> many_to_one
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.countryModel;
|
|
59
|
+
}
|
|
60
|
+
get vendorInvoices() {
|
|
61
|
+
// many_to_many -> many_to_many verified
|
|
62
|
+
// {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many'}
|
|
63
|
+
// ['vendor_advance', 'vendor'] -> many_to_one
|
|
64
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.vendorInvoices;
|
|
67
|
+
}
|
|
68
|
+
get officeLocations() {
|
|
69
|
+
// many_to_many -> many_to_many verified
|
|
70
|
+
// {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
|
|
71
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
72
|
+
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
|
|
75
|
+
if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
|
|
76
|
+
accumulator.push(current);
|
|
77
|
+
}
|
|
78
|
+
return accumulator;
|
|
79
|
+
}, []);
|
|
80
|
+
}
|
|
81
|
+
get vendorInvoiceItems() {
|
|
82
|
+
// many_to_many -> many_to_many verified
|
|
83
|
+
// {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->vendor_invoice_item': 'one_to_many'}
|
|
84
|
+
// ['vendor_advance', 'tds_rate'] -> many_to_one
|
|
85
|
+
// ['tds_rate', 'vendor_invoice_item'] -> one_to_many
|
|
86
|
+
var _a;
|
|
87
|
+
return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.vendorInvoiceItems;
|
|
88
|
+
}
|
|
89
|
+
get voucherTypes() {
|
|
90
|
+
// many_to_many -> many_to_many verified
|
|
91
|
+
// {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->voucher_type': 'many_to_many'}
|
|
92
|
+
// ['vendor_advance', 'tds_rate'] -> many_to_one
|
|
93
|
+
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
94
|
+
var _a;
|
|
95
|
+
return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.voucherTypes;
|
|
96
|
+
}
|
|
97
|
+
get organizationTypes() {
|
|
98
|
+
// many_to_many -> many_to_many verified
|
|
99
|
+
// {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many'}
|
|
100
|
+
// ['vendor_advance', 'tds_rate'] -> many_to_one
|
|
101
|
+
// ['tds_rate', 'organization_type'] -> many_to_many
|
|
102
|
+
var _a;
|
|
103
|
+
return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.organizationTypes;
|
|
104
|
+
}
|
|
105
|
+
get vendorTdsLiabilitys() {
|
|
106
|
+
// many_to_many -> many_to_many verified
|
|
107
|
+
// {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->vendor_tds_liability': 'one_to_many'}
|
|
108
|
+
// ['vendor_advance', 'tds_rate'] -> many_to_one
|
|
109
|
+
// ['tds_rate', 'vendor_tds_liability'] -> one_to_many
|
|
110
|
+
var _a;
|
|
111
|
+
return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.vendorTdsLiabilitys;
|
|
112
|
+
}
|
|
113
|
+
get vendorTdsChallans() {
|
|
114
|
+
// many_to_many -> many_to_many verified
|
|
115
|
+
// {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->vendor_tds_challan': 'one_to_many'}
|
|
116
|
+
// ['vendor_advance', 'tds_rate'] -> many_to_one
|
|
117
|
+
// ['tds_rate', 'vendor_tds_challan'] -> one_to_many
|
|
118
|
+
var _a;
|
|
119
|
+
return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.vendorTdsChallans;
|
|
120
|
+
}
|
|
121
|
+
get banks() {
|
|
122
|
+
// many_to_many -> many_to_many verified
|
|
123
|
+
// {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
|
|
124
|
+
// ['tds_rate', 'vendor_tds_challan'] -> one_to_many
|
|
125
|
+
// ['vendor_tds_challan', 'bank'] -> many_to_one
|
|
126
|
+
var _a;
|
|
127
|
+
return (_a = this.vendorTdsChallans) === null || _a === void 0 ? void 0 : _a.flatMap((vendorTdsChallan) => vendorTdsChallan.bank).filter((bank) => !!bank).reduce((accumulator, current) => {
|
|
128
|
+
if (!accumulator.some((bank) => bank.id === current.id)) {
|
|
129
|
+
accumulator.push(current);
|
|
130
|
+
}
|
|
131
|
+
return accumulator;
|
|
132
|
+
}, []);
|
|
133
|
+
}
|
|
134
|
+
get expenseHeads() {
|
|
135
|
+
// many_to_many -> many_to_many verified
|
|
136
|
+
// {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->voucher_type': 'many_to_many', 'voucher_type->expense_head': 'one_to_many'}
|
|
137
|
+
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
138
|
+
// ['voucher_type', 'expense_head'] -> one_to_many
|
|
139
|
+
var _a;
|
|
140
|
+
return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.expenseHeads).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
141
|
+
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
142
|
+
accumulator.push(current);
|
|
143
|
+
}
|
|
144
|
+
return accumulator;
|
|
145
|
+
}, []);
|
|
146
|
+
}
|
|
147
|
+
get vendorInvoicePayments() {
|
|
148
|
+
// one_to_many -> many_to_many mismatch
|
|
149
|
+
// {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
|
|
150
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
151
|
+
// ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
|
|
152
|
+
var _a;
|
|
153
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments).filter((vendorInvoicePayment) => !!vendorInvoicePayment).reduce((accumulator, current) => {
|
|
154
|
+
if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
|
|
155
|
+
accumulator.push(current);
|
|
156
|
+
}
|
|
157
|
+
return accumulator;
|
|
158
|
+
}, []);
|
|
159
|
+
}
|
|
160
|
+
getNextStatus(currentUser, action, vendorAdvanceFlowConfigContextData) {
|
|
161
|
+
if (!this.status) {
|
|
162
|
+
throw new exceptions_1.AppBadRequestException({
|
|
163
|
+
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
164
|
+
message: [`Status not found: ${this.status}`],
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const flowForStatus = vendor_advance_flow_config_1.vendorAdvanceFlowConfig[this.status];
|
|
168
|
+
if (!flowForStatus) {
|
|
169
|
+
throw new exceptions_1.AppBadRequestException({
|
|
170
|
+
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
171
|
+
message: [`No flow configuration found for status: ${this.status}`],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (!action) {
|
|
175
|
+
throw new exceptions_1.AppBadRequestException({
|
|
176
|
+
key: error_key_enum_1.ErrorKeyEnum.ACTION_DATA,
|
|
177
|
+
message: ["actionData is required"],
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
const matchingPermissionConfig = flowForStatus.actions[action];
|
|
181
|
+
if (!matchingPermissionConfig) {
|
|
182
|
+
throw new exceptions_1.AppBadRequestException({
|
|
183
|
+
key: error_key_enum_1.ErrorKeyEnum.ACTION,
|
|
184
|
+
message: [`Action '${action}' is not valid for the current status.`],
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (!currentUser.permissions || currentUser.permissions.length === 0) {
|
|
188
|
+
throw new exceptions_1.AppBadRequestException({
|
|
189
|
+
key: error_key_enum_1.ErrorKeyEnum.PERMISSIONS,
|
|
190
|
+
message: ["Permission not available for currentUser"],
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const hasPermission = matchingPermissionConfig.permissions.some((permission) => currentUser.permissions.includes(permission));
|
|
194
|
+
if (!hasPermission) {
|
|
195
|
+
throw new exceptions_1.AppBadRequestException({
|
|
196
|
+
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
197
|
+
message: [`Current user does not have permission to ${action} vendorAdvance`],
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
const nextStatus = matchingPermissionConfig.next(vendorAdvanceFlowConfigContextData);
|
|
201
|
+
return nextStatus;
|
|
202
|
+
}
|
|
203
|
+
getAvailableActions(currentUser, config) {
|
|
204
|
+
var _a;
|
|
205
|
+
const params = {
|
|
206
|
+
flowConfig: vendor_advance_flow_config_1.vendorAdvanceFlowConfig,
|
|
207
|
+
currentStatus: this.status,
|
|
208
|
+
userPermissions: (_a = currentUser.permissions) !== null && _a !== void 0 ? _a : [],
|
|
209
|
+
visibilityData: this.getUpdateActionVisibility.bind(this, currentUser),
|
|
210
|
+
combinedActions: config === null || config === void 0 ? void 0 : config.combinedActions,
|
|
211
|
+
customLabels: config === null || config === void 0 ? void 0 : config.customLabels,
|
|
212
|
+
};
|
|
213
|
+
return utils_1.EntityActionFlowResolverV2.getAvailableActionsData(params);
|
|
214
|
+
}
|
|
215
|
+
getUpdateActionVisibility(currentUser) {
|
|
216
|
+
return {};
|
|
217
|
+
}
|
|
218
|
+
getBalanceAmount() {
|
|
219
|
+
var _a;
|
|
220
|
+
return this.netAmount - ((_a = this.appliedAmount) !== null && _a !== void 0 ? _a : 0);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.VendorAdvanceEntityModel = VendorAdvanceEntityModel;
|
|
224
|
+
// vendorInvoiceAdvances?: VendorInvoiceAdvanceEntityModel[];
|
|
225
|
+
VendorAdvanceEntityModel.relationConfigs = [
|
|
226
|
+
{
|
|
227
|
+
name: entity_utils_interface_1.EntityEnum.VENDOR,
|
|
228
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
229
|
+
key: "vendor",
|
|
230
|
+
mapKeyConfig: {
|
|
231
|
+
relationKey: "id",
|
|
232
|
+
key: "vendorId",
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: entity_utils_interface_1.EntityEnum.GST_RATE,
|
|
237
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
238
|
+
key: "gstRate",
|
|
239
|
+
mapKeyConfig: {
|
|
240
|
+
relationKey: "id",
|
|
241
|
+
key: "gstRateId",
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: entity_utils_interface_1.EntityEnum.TDS_RATE,
|
|
246
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
247
|
+
key: "tdsRate",
|
|
248
|
+
mapKeyConfig: {
|
|
249
|
+
relationKey: "id",
|
|
250
|
+
key: "tdsRateId",
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
// {
|
|
254
|
+
// name: EntityEnum.VENDOR_INVOICE_ADVANCE,
|
|
255
|
+
// relation: RelationType.MANY,
|
|
256
|
+
// key: "vendorInvoiceAdvances",
|
|
257
|
+
// mapKeyConfig: {
|
|
258
|
+
// relationKey: "vendorAdvanceId",
|
|
259
|
+
// key: "id",
|
|
260
|
+
// },
|
|
261
|
+
// },
|
|
262
|
+
];
|