law-common 11.3.1-beta.1 → 11.3.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 CHANGED
@@ -1 +1 @@
1
- # law-common
1
+ # law-common
@@ -11,4 +11,5 @@ export interface IVendorInvoiceActionDataDto {
11
11
  action: VendorInvoiceActionEnum;
12
12
  remark?: string;
13
13
  vendorInvoicePayment?: VendorInvoicePaymentEntityModel;
14
+ amountDifference?: number;
14
15
  }
@@ -9,4 +9,5 @@ export declare enum BillingTemplateTitle {
9
9
  INVOICE = "INVOICE",
10
10
  DRAFT_INVOICE = "DRAFT INVOICE"
11
11
  }
12
+ export declare const RESTRICT_PENDING_PAYMENT_EDIT = true;
12
13
  export declare const proFormaInvoiceStatuses: BillingStatusEnum[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.proFormaInvoiceStatuses = exports.BillingTemplateTitle = exports.PROHIBITED_CHARS = exports.currentFY = exports.billingSequenceSeperatorForCurrentFy = exports.billingSequenceSeperator = exports.billingPrefixCompanyName = void 0;
3
+ exports.proFormaInvoiceStatuses = exports.RESTRICT_PENDING_PAYMENT_EDIT = exports.BillingTemplateTitle = exports.PROHIBITED_CHARS = exports.currentFY = exports.billingSequenceSeperatorForCurrentFy = exports.billingSequenceSeperator = exports.billingPrefixCompanyName = void 0;
4
4
  const entities_1 = require("../entities");
5
5
  exports.billingPrefixCompanyName = "ALC";
6
6
  exports.billingSequenceSeperator = "-";
@@ -13,6 +13,7 @@ var BillingTemplateTitle;
13
13
  BillingTemplateTitle["INVOICE"] = "INVOICE";
14
14
  BillingTemplateTitle["DRAFT_INVOICE"] = "DRAFT INVOICE";
15
15
  })(BillingTemplateTitle || (exports.BillingTemplateTitle = BillingTemplateTitle = {}));
16
+ exports.RESTRICT_PENDING_PAYMENT_EDIT = true;
16
17
  exports.proFormaInvoiceStatuses = [
17
18
  entities_1.BillingStatusEnum.PENDING_APPROVAL,
18
19
  entities_1.BillingStatusEnum.REQUEST_CHANGES,
@@ -6,6 +6,6 @@ import { VendorInvoiceEntityModel } from "../model/vendor_invoice.entity.model";
6
6
  export interface IVendorInvoiceFlowConfigContextData {
7
7
  vendorInvoicePayment?: VendorInvoicePaymentEntityModel;
8
8
  existingVendorInvoice?: VendorInvoiceEntityModel;
9
- vendorInvoicePayments?: VendorInvoicePaymentEntityModel[];
9
+ amountDifference?: number;
10
10
  }
11
11
  export declare const vendorInvoiceFlowConfig: FlowConfig<VendorInvoiceStatusEnum, VendorInvoiceActionEnum, IVendorInvoiceFlowConfigContextData>;
@@ -4,7 +4,6 @@ exports.vendorInvoiceFlowConfig = void 0;
4
4
  const vendor_invoice_action_enum_1 = require("../enums/vendor_invoice_action.enum");
5
5
  const vendor_invoice_action_status_enum_1 = require("../enums/vendor_invoice_action_status_enum");
6
6
  const base_flow_config_factory_1 = require("./base-flow-config.factory");
7
- const vendor_invoice_payment_entity_model_1 = require("../model/vendor_invoice_payment.entity.model");
8
7
  const exceptions_1 = require("../../exceptions");
9
8
  const enums_1 = require("../../enums");
10
9
  const VENDOR_INVOICE_APPROVE_PERMISSION = ["VENDOR_INVOICE_APPROVE"];
@@ -41,10 +40,9 @@ const ACTION_MAP = {
41
40
  };
42
41
  const { createActionConfig, createTransition } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
43
42
  const createTransitionAnyStatusUpdatePaymentAction = createTransition((context) => {
44
- const { existingVendorInvoice, vendorInvoicePayments } = context;
45
- if (existingVendorInvoice && vendorInvoicePayments) {
46
- const amountPaidThroughPayments = vendor_invoice_payment_entity_model_1.VendorInvoicePaymentEntityModel.getTotalAmount(vendorInvoicePayments);
47
- if (existingVendorInvoice.totalNetAmount === existingVendorInvoice.adjustedAmount + amountPaidThroughPayments) {
43
+ const { existingVendorInvoice, amountDifference } = context;
44
+ if (existingVendorInvoice && amountDifference !== undefined) {
45
+ if (existingVendorInvoice.totalNetAmount === existingVendorInvoice.adjustedAmount + amountDifference + existingVendorInvoice.paidAmount) {
48
46
  return vendor_invoice_action_status_enum_1.VendorInvoiceStatusEnum.PAYMENT_DISBURSE;
49
47
  }
50
48
  else {
@@ -54,7 +52,7 @@ const createTransitionAnyStatusUpdatePaymentAction = createTransition((context)
54
52
  else {
55
53
  throw new exceptions_1.AppBadRequestException({
56
54
  key: enums_1.ErrorKeyEnum.VENDOR_INVOICE_FLOW_CONTEXT_DATA,
57
- message: ["Both existingVendorInvoice and vendorInvoicePayments must be provided in the context data for processing update payment action."],
55
+ message: ["Both existingVendorInvoice and amountDifference must be provided in the context data for processing update payment action."],
58
56
  });
59
57
  }
60
58
  // return existingVendorInvoice ? existingVendorInvoice.actionStatus : VendorInvoiceStatusEnum.APPROVED;
@@ -157,8 +155,8 @@ exports.vendorInvoiceFlowConfig = {
157
155
  },
158
156
  [vendor_invoice_action_status_enum_1.VendorInvoiceStatusEnum.PAYMENT_DISBURSE]: {
159
157
  actions: {
160
- // [VendorInvoiceActionEnum.UPDATE_PAYMENT]: transitionPaymentDisburseStatusUpdatePaymentAction,
161
- // [VendorInvoiceActionEnum.DELETE_PAYMENT]: transitionPaymentDisburseStatusDeleteAction,
158
+ [vendor_invoice_action_enum_1.VendorInvoiceActionEnum.UPDATE_PAYMENT]: transitionPaymentDisburseStatusUpdatePaymentAction,
159
+ [vendor_invoice_action_enum_1.VendorInvoiceActionEnum.DELETE_PAYMENT]: transitionPaymentDisburseStatusDeleteAction,
162
160
  },
163
161
  },
164
162
  };
@@ -1,18 +1,12 @@
1
+ import { ClientQuoteStatusEnum } from "../enums/client_quote_status_enum";
1
2
  import { IEntityAuditColumn } from "./entity-audit-columns.interface";
2
3
  import { Nullable } from "./entity.utils.interface";
3
- import { ClientQuoteCurrencyEnum } from "../enums/client_quote_currency_enum";
4
- import { ClientQuoteStatusEnum } from "../enums/client_quote_status_enum";
5
4
  export interface IClientQuoteEntity extends IEntityAuditColumn {
6
5
  id: number;
7
6
  clientName: string;
8
7
  projectName?: Nullable<string>;
9
- currency: ClientQuoteCurrencyEnum;
10
- marginPercentage: number;
11
8
  status: ClientQuoteStatusEnum;
12
- costMinTotal: number;
13
- costMaxTotal: number;
9
+ costTotal: number;
14
10
  billingMinTotal: number;
15
- billingMaxTotal: number;
16
- idealMinTotal: number;
17
- idealMaxTotal: number;
11
+ recommendedTotal: number;
18
12
  }
@@ -5,11 +5,6 @@ export interface IClientQuoteRateEntity extends IEntityAuditColumn {
5
5
  resourceType: string;
6
6
  headCount: number;
7
7
  billingHourlyRate: number;
8
- minHour: number;
9
- maxHour: number;
10
- billingMinTotal: number;
11
- billingMaxTotal: number;
8
+ estimatedHour: number;
12
9
  costHourlyRate: number;
13
- costMinTotal: number;
14
- costMaxTotal: number;
15
10
  }
@@ -25,4 +25,5 @@ export declare class BankEntityModel extends BaseEntityModel<EntityEnum.BANK> im
25
25
  getRelationConfigs(): any[];
26
26
  static relationConfigs: RelationConfigs<[EntityEnum.INTERMEDIARY_BANK], EntityEnum.BANK>;
27
27
  get intermediaryBankModel(): IntermediaryBankEntityModel[];
28
+ getPaymentContactEmails(): string[];
28
29
  }
@@ -35,6 +35,13 @@ class BankEntityModel extends base_entity_model_1.BaseEntityModel {
35
35
  var _a;
36
36
  return (_a = this.intermediaryBanks) !== null && _a !== void 0 ? _a : [];
37
37
  }
38
+ getPaymentContactEmails() {
39
+ const emails = this.emailForPaymentInfoCsv
40
+ .split(",")
41
+ .map((email) => email.trim())
42
+ .filter(Boolean);
43
+ return emails;
44
+ }
38
45
  }
39
46
  exports.BankEntityModel = BankEntityModel;
40
47
  BankEntityModel.relationConfigs = [
@@ -447,16 +447,16 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
447
447
  return (_b = (_a = this.client) === null || _a === void 0 ? void 0 : _a.clientAffiliates) === null || _b === void 0 ? void 0 : _b.find((affiliate) => affiliate.id === this.invoiceEntityId);
448
448
  }
449
449
  get isForeignBilling() {
450
- var _a;
451
- if (this.isClientInvoice()) {
452
- return ((_a = this.client) === null || _a === void 0 ? void 0 : _a.country) !== undefined && this.client.country !== "India";
453
- }
454
- const affiliate = this.clientAffiliate;
455
- return (affiliate === null || affiliate === void 0 ? void 0 : affiliate.country) !== undefined && affiliate.country !== "India";
450
+ // if (this.isClientInvoice()) {
451
+ // return this.client?.country !== undefined && this.client.country !== "India";
452
+ // }
453
+ // const affiliate = this.clientAffiliate;
454
+ // return affiliate?.country !== undefined && affiliate.country !== "India";
455
+ return this.currency !== enums_1.CurrencyEnum.INR;
456
456
  }
457
457
  get isForeignCurrencyProject() {
458
458
  var _a, _b;
459
- return (_b = (_a = this.project) === null || _a === void 0 ? void 0 : _a.isForeignCurrencyProjoect()) !== null && _b !== void 0 ? _b : false;
459
+ return (_b = (_a = this.project) === null || _a === void 0 ? void 0 : _a.isForeignCurrencyProject()) !== null && _b !== void 0 ? _b : false;
460
460
  }
461
461
  get isProformaInvoice() {
462
462
  return this.type === billing_type_enum_1.BillingTypeEnum.ADVANCE;
@@ -1,7 +1,6 @@
1
1
  import { EntityEnum } from "../interface/entity.utils.interface";
2
2
  import { RelationConfigs } from "../interface/relation-config.interface";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
- import { ClientQuoteCurrencyEnum } from "../enums/client_quote_currency_enum";
5
4
  import { ClientQuoteStatusEnum } from "../enums/client_quote_status_enum";
6
5
  import { IClientQuoteEntity } from "../interface/client_quote.entity.interface";
7
6
  import { ClientQuoteRateEntityModel } from "./client_quote_rate.entity.model";
@@ -9,14 +8,9 @@ export declare class ClientQuoteEntityModel extends BaseEntityModel<EntityEnum.C
9
8
  id: number;
10
9
  clientName: string;
11
10
  projectName?: string;
12
- currency: ClientQuoteCurrencyEnum;
13
- marginPercentage: number;
14
- costMinTotal: number;
15
- costMaxTotal: number;
11
+ costTotal: number;
16
12
  billingMinTotal: number;
17
- billingMaxTotal: number;
18
- idealMinTotal: number;
19
- idealMaxTotal: number;
13
+ recommendedTotal: number;
20
14
  status: ClientQuoteStatusEnum;
21
15
  createdOn: number;
22
16
  updatedOn: number;
@@ -5,21 +5,15 @@ const relation_type_enum_1 = require("../enums/relation-type.enum");
5
5
  const entity_utils_interface_1 = require("../interface/entity.utils.interface");
6
6
  const base_entity_model_1 = require("./base.entity.model");
7
7
  const utils_1 = require("../../utils");
8
- const client_quote_currency_enum_1 = require("../enums/client_quote_currency_enum");
9
8
  const client_quote_status_enum_1 = require("../enums/client_quote_status_enum");
10
9
  class ClientQuoteEntityModel extends base_entity_model_1.BaseEntityModel {
11
10
  constructor() {
12
11
  super(...arguments);
13
12
  this.id = 0;
14
13
  this.clientName = "";
15
- this.currency = client_quote_currency_enum_1.ClientQuoteCurrencyEnum.INR;
16
- this.marginPercentage = 0;
17
- this.costMinTotal = 0;
18
- this.costMaxTotal = 0;
14
+ this.costTotal = 0;
19
15
  this.billingMinTotal = 0;
20
- this.billingMaxTotal = 0;
21
- this.idealMinTotal = 0;
22
- this.idealMaxTotal = 0;
16
+ this.recommendedTotal = 0;
23
17
  this.status = client_quote_status_enum_1.ClientQuoteStatusEnum.ACTIVE;
24
18
  this.createdOn = 0;
25
19
  this.updatedOn = 0;
@@ -34,10 +28,14 @@ class ClientQuoteEntityModel extends base_entity_model_1.BaseEntityModel {
34
28
  getRelationConfigs() {
35
29
  return this.constructor.prototype.constructor.relationConfigs || [];
36
30
  }
31
+ // get maxEstimatedHours(): number {
32
+ // if (!this.clientQuoteRates) return 0;
33
+ // return sumNormalised(this.clientQuoteRates, "maxHour");
34
+ // }
37
35
  get maxEstimatedHours() {
38
36
  if (!this.clientQuoteRates)
39
37
  return 0;
40
- return (0, utils_1.sumNormalised)(this.clientQuoteRates, "maxHour");
38
+ return (0, utils_1.sumNormalised)(this.clientQuoteRates, "estimatedHour");
41
39
  }
42
40
  }
43
41
  exports.ClientQuoteEntityModel = ClientQuoteEntityModel;
@@ -9,13 +9,8 @@ export declare class ClientQuoteRateEntityModel extends BaseEntityModel<EntityEn
9
9
  resourceType: string;
10
10
  headCount: number;
11
11
  billingHourlyRate: number;
12
- minHour: number;
13
- maxHour: number;
14
- billingMinTotal: number;
15
- billingMaxTotal: number;
12
+ estimatedHour: number;
16
13
  costHourlyRate: number;
17
- costMinTotal: number;
18
- costMaxTotal: number;
19
14
  createdOn: number;
20
15
  updatedOn: number;
21
16
  createdBy: number;
@@ -12,13 +12,8 @@ class ClientQuoteRateEntityModel extends base_entity_model_1.BaseEntityModel {
12
12
  this.resourceType = "";
13
13
  this.headCount = 0;
14
14
  this.billingHourlyRate = 0;
15
- this.minHour = 0;
16
- this.maxHour = 0;
17
- this.billingMinTotal = 0;
18
- this.billingMaxTotal = 0;
15
+ this.estimatedHour = 0;
19
16
  this.costHourlyRate = 0;
20
- this.costMinTotal = 0;
21
- this.costMaxTotal = 0;
22
17
  this.createdOn = 0;
23
18
  this.updatedOn = 0;
24
19
  this.createdBy = 0;
@@ -195,7 +195,7 @@ function parseEntities(json, baseEntity, entityMap) {
195
195
  if (!(baseEntity in exports.entityEnumToEntityModel)) {
196
196
  throw new Error(`Unknown entity: ${baseEntity}`);
197
197
  }
198
- entityMap[baseEntity] = ((entityMap[baseEntity] && entityMap[baseEntity].length > 0 ? [...entityMap[baseEntity], ...json["baseEntities"]] : json["baseEntities"]) || []).map(
198
+ entityMap[baseEntity] = ((entityMap[baseEntity] && entityMap[baseEntity].length > 0 ? [...entityMap[baseEntity], ...(json["baseEntities"] || [])] : json["baseEntities"] || []) || []).map(
199
199
  // @ts-ignore
200
200
  (e) => exports.entityEnumToEntityModel[baseEntity](e));
201
201
  if (json["relatedEntities"]) {
@@ -38,7 +38,7 @@ export declare class ProjectEntityModel extends BaseEntityModel<EntityEnum.PROJE
38
38
  static relationConfigs: RelationConfigs<[EntityEnum.PROJECT_USER_MAPPING, EntityEnum.CLIENT], EntityEnum.PROJECT>;
39
39
  populateUsers(users: UserEntityModel[], projectUserMapping: ProjectUserMappingEntityModel[]): void;
40
40
  getRelationConfigs(): [import("../interface/relation-config.interface").IRelationConfig<EntityEnum.PROJECT_USER_MAPPING, EntityEnum.PROJECT>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.CLIENT, EntityEnum.PROJECT>];
41
- isForeignCurrencyProjoect(): boolean;
41
+ isForeignCurrencyProject(): boolean;
42
42
  get parsedBillingRate(): any;
43
43
  isHourlyProject(): boolean;
44
44
  isFixedProject(): boolean;
@@ -90,7 +90,7 @@ class ProjectEntityModel extends base_entity_model_1.BaseEntityModel {
90
90
  getRelationConfigs() {
91
91
  return ProjectEntityModel.relationConfigs;
92
92
  }
93
- isForeignCurrencyProjoect() {
93
+ isForeignCurrencyProject() {
94
94
  return this.currency !== enums_1.CurrencyEnum.INR;
95
95
  }
96
96
  get parsedBillingRate() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "11.3.1-beta.1",
3
+ "version": "11.3.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [