law-common 11.3.21-beta.3 → 11.3.21-beta.5

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.
@@ -1,7 +1,7 @@
1
1
  import { IEntityCreateDto, Nullable } from "../../entities";
2
2
  import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
3
3
  import { IVendorAdvanceEntity } from "../../entities/interface/vendor_advance.entity.interface";
4
- export type IVendorAdvanceCreateExclude = "amountPaid" | "status" | "advanceDocument";
4
+ export type IVendorAdvanceCreateExclude = "amountPaid" | "status" | "appliedAmount" | "advanceDocument";
5
5
  export interface IVendorAdvanceCreateDto extends Omit<IEntityCreateDto<IVendorAdvanceEntity>, IVendorAdvanceCreateExclude> {
6
6
  advanceDocument?: Nullable<MulterFileWithUrl>;
7
7
  files: IFilePayload[];
@@ -14,4 +14,11 @@ export interface IVendorAdvanceEntity extends IEntityAuditColumn {
14
14
  advanceDocument?: Nullable<string>;
15
15
  amountPaid: number;
16
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;
17
24
  }
@@ -8,19 +8,19 @@ import { IVendorAdvanceEntity } from "../interface/vendor_advance.entity.interfa
8
8
  import { VendorAdvancePaymentMode } from "../enums/vendor_advance_payment_mode";
9
9
  import { VendorAdvanceStatusEnum } from "../enums/vendor_advance_status_enum";
10
10
  import { VendorEntityModel } from "./vendor.entity.model";
11
+ import { GstRateEntityModel } from "./gst_rate.entity.model";
12
+ import { TdsRateEntityModel } from "./tds_rate.entity.model";
11
13
  import { StateEntityModel } from "./state.entity.model";
12
14
  import { CountryEntityModel } from "./country.entity.model";
13
15
  import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
14
16
  import { OfficeLocationEntityModel } from "./office_location.entity.model";
15
17
  import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
16
18
  import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
17
- import { TdsRateEntityModel } from "./tds_rate.entity.model";
18
19
  import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
19
20
  import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
20
21
  import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
21
22
  import { BankEntityModel } from "./bank.entity.model";
22
23
  import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
23
- import { GstRateEntityModel } from "./gst_rate.entity.model";
24
24
  import { VendorInvoicePaymentEntityModel } from "./vendor_invoice_payment.entity.model";
25
25
  import { VendorAdvanceActionEnum } from "../../api";
26
26
  import { IVendorAdvanceFlowConfigContextData } from "../flow-configs/vendor_advance_flow.config";
@@ -34,14 +34,23 @@ export declare class VendorAdvanceEntityModel extends BaseEntityModel<EntityEnum
34
34
  tdsPercent: number;
35
35
  purpose?: string;
36
36
  advanceDocument?: string;
37
+ gstRateId: number;
38
+ gstAmount: number;
39
+ invoiceAmount: number;
40
+ tdsRateId: number;
41
+ tdsAmount: number;
42
+ netAmount: number;
37
43
  amountPaid: number;
38
44
  status: VendorAdvanceStatusEnum;
45
+ appliedAmount?: number;
39
46
  createdOn: number;
40
47
  updatedOn: number;
41
48
  createdBy: number;
42
49
  updatedBy: number;
43
50
  vendor?: VendorEntityModel;
44
- static relationConfigs: RelationConfigs<[EntityEnum.VENDOR], EntityEnum.VENDOR_ADVANCE>;
51
+ gstRate?: GstRateEntityModel;
52
+ tdsRate?: TdsRateEntityModel;
53
+ static relationConfigs: RelationConfigs<[EntityEnum.VENDOR, EntityEnum.GST_RATE, EntityEnum.TDS_RATE], EntityEnum.VENDOR_ADVANCE>;
45
54
  static fromEntity(entity: IVendorAdvanceEntity): VendorAdvanceEntityModel;
46
55
  getRelationConfigs(): any[];
47
56
  get state(): StateEntityModel | undefined;
@@ -50,13 +59,11 @@ export declare class VendorAdvanceEntityModel extends BaseEntityModel<EntityEnum
50
59
  get officeLocations(): OfficeLocationEntityModel[] | undefined;
51
60
  get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
52
61
  get voucherTypes(): VoucherTypeEntityModel[] | undefined;
53
- get tdsRates(): TdsRateEntityModel[] | undefined;
54
- get organizationType(): OrganizationTypeEntityModel | undefined;
62
+ get organizationTypes(): OrganizationTypeEntityModel[] | undefined;
55
63
  get vendorTdsLiabilitys(): VendorTdsLiabilityEntityModel[] | undefined;
56
64
  get vendorTdsChallans(): VendorTdsChallanEntityModel[] | undefined;
57
65
  get banks(): BankEntityModel[] | undefined;
58
66
  get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
59
- get gstRates(): GstRateEntityModel[] | undefined;
60
67
  get vendorInvoicePayments(): VendorInvoicePaymentEntityModel[] | undefined;
61
68
  getNextStatus(currentUser: IUserEntity, action: VendorAdvanceActionEnum, vendorAdvanceFlowConfigContextData: IVendorAdvanceFlowConfigContextData): VendorAdvanceStatusEnum;
62
69
  getAvailableActions(currentUser: UserEntityModel, config?: {
@@ -20,6 +20,12 @@ class VendorAdvanceEntityModel extends base_entity_model_1.BaseEntityModel {
20
20
  this.paymentMode = vendor_advance_payment_mode_1.VendorAdvancePaymentMode.NEFT;
21
21
  this.reference = "";
22
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;
23
29
  this.amountPaid = 0;
24
30
  this.status = vendor_advance_status_enum_1.VendorAdvanceStatusEnum.APPROVED;
25
31
  this.createdOn = 0;
@@ -73,81 +79,48 @@ class VendorAdvanceEntityModel extends base_entity_model_1.BaseEntityModel {
73
79
  }, []);
74
80
  }
75
81
  get vendorInvoiceItems() {
76
- // one_to_many -> many_to_many mismatch
77
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
78
- // ['vendor', 'vendor_invoice'] -> one_to_many
79
- // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
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
80
86
  var _a;
81
- return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
82
- if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
83
- accumulator.push(current);
84
- }
85
- return accumulator;
86
- }, []);
87
+ return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.vendorInvoiceItems;
87
88
  }
88
89
  get voucherTypes() {
89
90
  // many_to_many -> many_to_many verified
90
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one'}
91
- // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
92
- // ['vendor_invoice_item', 'voucher_type'] -> many_to_one
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
93
94
  var _a;
94
- return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.voucherType).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
95
- if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
96
- accumulator.push(current);
97
- }
98
- return accumulator;
99
- }, []);
95
+ return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.voucherTypes;
100
96
  }
101
- get tdsRates() {
97
+ get organizationTypes() {
102
98
  // many_to_many -> many_to_many verified
103
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many'}
104
- // ['vendor_invoice_item', 'voucher_type'] -> many_to_one
105
- // ['voucher_type', 'tds_rate'] -> many_to_many
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
106
102
  var _a;
107
- return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.tdsRates).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
108
- if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
109
- accumulator.push(current);
110
- }
111
- return accumulator;
112
- }, []);
113
- }
114
- get organizationType() {
115
- // many_to_one -> many_to_one verified
116
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one'}
117
- // ['vendor_advance', 'vendor'] -> many_to_one
118
- // ['vendor', 'organization_type'] -> many_to_one
119
- var _a;
120
- return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.organizationType;
103
+ return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.organizationTypes;
121
104
  }
122
105
  get vendorTdsLiabilitys() {
123
106
  // many_to_many -> many_to_many verified
124
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_liability': 'one_to_many'}
125
- // ['voucher_type', 'tds_rate'] -> many_to_many
107
+ // {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->vendor_tds_liability': 'one_to_many'}
108
+ // ['vendor_advance', 'tds_rate'] -> many_to_one
126
109
  // ['tds_rate', 'vendor_tds_liability'] -> one_to_many
127
110
  var _a;
128
- return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsLiabilitys).filter((vendorTdsLiability) => !!vendorTdsLiability).reduce((accumulator, current) => {
129
- if (!accumulator.some((vendorTdsLiability) => vendorTdsLiability.id === current.id)) {
130
- accumulator.push(current);
131
- }
132
- return accumulator;
133
- }, []);
111
+ return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.vendorTdsLiabilitys;
134
112
  }
135
113
  get vendorTdsChallans() {
136
114
  // many_to_many -> many_to_many verified
137
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many'}
138
- // ['voucher_type', 'tds_rate'] -> many_to_many
115
+ // {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->vendor_tds_challan': 'one_to_many'}
116
+ // ['vendor_advance', 'tds_rate'] -> many_to_one
139
117
  // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
140
118
  var _a;
141
- return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsChallans).filter((vendorTdsChallan) => !!vendorTdsChallan).reduce((accumulator, current) => {
142
- if (!accumulator.some((vendorTdsChallan) => vendorTdsChallan.id === current.id)) {
143
- accumulator.push(current);
144
- }
145
- return accumulator;
146
- }, []);
119
+ return (_a = this.tdsRate) === null || _a === void 0 ? void 0 : _a.vendorTdsChallans;
147
120
  }
148
121
  get banks() {
149
122
  // many_to_many -> many_to_many verified
150
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
123
+ // {'vendor_advance->tds_rate': 'many_to_one', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
151
124
  // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
152
125
  // ['vendor_tds_challan', 'bank'] -> many_to_one
153
126
  var _a;
@@ -160,30 +133,17 @@ class VendorAdvanceEntityModel extends base_entity_model_1.BaseEntityModel {
160
133
  }
161
134
  get expenseHeads() {
162
135
  // many_to_many -> many_to_many verified
163
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
164
- // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
165
- // ['vendor_invoice_item', 'expense_head'] -> many_to_one
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
166
139
  var _a;
167
- return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.expenseHead).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
140
+ return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.expenseHeads).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
168
141
  if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
169
142
  accumulator.push(current);
170
143
  }
171
144
  return accumulator;
172
145
  }, []);
173
146
  }
174
- get gstRates() {
175
- // many_to_many -> many_to_many verified
176
- // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
177
- // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
178
- // ['vendor_invoice_item', 'gst_rate'] -> many_to_one
179
- var _a;
180
- return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
181
- if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
182
- accumulator.push(current);
183
- }
184
- return accumulator;
185
- }, []);
186
- }
187
147
  get vendorInvoicePayments() {
188
148
  // one_to_many -> many_to_many mismatch
189
149
  // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
@@ -257,6 +217,7 @@ class VendorAdvanceEntityModel extends base_entity_model_1.BaseEntityModel {
257
217
  }
258
218
  }
259
219
  exports.VendorAdvanceEntityModel = VendorAdvanceEntityModel;
220
+ // vendorInvoiceAdvances?: VendorInvoiceAdvanceEntityModel[];
260
221
  VendorAdvanceEntityModel.relationConfigs = [
261
222
  {
262
223
  name: entity_utils_interface_1.EntityEnum.VENDOR,
@@ -267,4 +228,31 @@ VendorAdvanceEntityModel.relationConfigs = [
267
228
  key: "vendorId",
268
229
  },
269
230
  },
231
+ {
232
+ name: entity_utils_interface_1.EntityEnum.GST_RATE,
233
+ relation: relation_type_enum_1.RelationType.ONE,
234
+ key: "gstRate",
235
+ mapKeyConfig: {
236
+ relationKey: "id",
237
+ key: "gstRateId",
238
+ },
239
+ },
240
+ {
241
+ name: entity_utils_interface_1.EntityEnum.TDS_RATE,
242
+ relation: relation_type_enum_1.RelationType.ONE,
243
+ key: "tdsRate",
244
+ mapKeyConfig: {
245
+ relationKey: "id",
246
+ key: "tdsRateId",
247
+ },
248
+ },
249
+ // {
250
+ // name: EntityEnum.VENDOR_INVOICE_ADVANCE,
251
+ // relation: RelationType.MANY,
252
+ // key: "vendorInvoiceAdvances",
253
+ // mapKeyConfig: {
254
+ // relationKey: "vendorAdvanceId",
255
+ // key: "id",
256
+ // },
257
+ // },
270
258
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "11.3.21-beta.3",
3
+ "version": "11.3.21-beta.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [