law-common 11.3.11 → 11.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/src/api/index.d.ts +0 -4
  2. package/dist/src/api/index.js +0 -4
  3. package/dist/src/entities/enums/billing-transaction-status.enum.js +1 -0
  4. package/dist/src/entities/enums/billing.action.enum.js +2 -0
  5. package/dist/src/entities/enums/billing.transaction.enum.js +1 -0
  6. package/dist/src/entities/enums/configuration-key.enum.d.ts +5 -1
  7. package/dist/src/entities/enums/configuration-key.enum.js +6 -0
  8. package/dist/src/entities/enums/cron-jobs-name.enum.d.ts +3 -1
  9. package/dist/src/entities/enums/cron-jobs-name.enum.js +2 -0
  10. package/dist/src/entities/enums/timesheet.action.enum.d.ts +3 -1
  11. package/dist/src/entities/enums/timesheet.action.enum.js +4 -0
  12. package/dist/src/entities/enums/timesheet.classification.status.enum.d.ts +10 -0
  13. package/dist/src/entities/enums/timesheet.classification.status.enum.js +28 -0
  14. package/dist/src/entities/enums/vendor_invoice_status_enum.d.ts +2 -1
  15. package/dist/src/entities/enums/vendor_invoice_status_enum.js +1 -0
  16. package/dist/src/entities/flow-configs/billing-transaction.flow.config.js +17 -0
  17. package/dist/src/entities/index.d.ts +1 -9
  18. package/dist/src/entities/index.js +1 -9
  19. package/dist/src/entities/interface/billing_transaction.entity.interface.d.ts +2 -2
  20. package/dist/src/entities/interface/entity.utils.interface.d.ts +3 -9
  21. package/dist/src/entities/interface/entity.utils.interface.js +0 -2
  22. package/dist/src/entities/interface/timesheet.entity.interface.d.ts +7 -1
  23. package/dist/src/entities/model/billing-transaction.model.d.ts +7 -2
  24. package/dist/src/entities/model/billing-transaction.model.js +38 -0
  25. package/dist/src/entities/model/billing.entity.model.d.ts +5 -0
  26. package/dist/src/entities/model/billing.entity.model.js +29 -4
  27. package/dist/src/entities/model/client.entity.model.d.ts +8 -0
  28. package/dist/src/entities/model/client.entity.model.js +60 -0
  29. package/dist/src/entities/model/entity.model.interface.js +0 -4
  30. package/dist/src/entities/model/project.entity.model.d.ts +20 -2
  31. package/dist/src/entities/model/project.entity.model.js +61 -0
  32. package/dist/src/entities/model/tds_rate.entity.model.autocode.js +1 -225
  33. package/dist/src/entities/model/tds_rate.entity.model.d.ts +1 -7
  34. package/dist/src/entities/model/tds_rate.entity.model.js +0 -18
  35. package/dist/src/entities/model/timesheet.entity.model.d.ts +30 -2
  36. package/dist/src/entities/model/timesheet.entity.model.js +108 -7
  37. package/dist/src/entities/model/user.entity.model.d.ts +2 -1
  38. package/dist/src/entities/model/user.entity.model.js +3 -0
  39. package/dist/src/entities/model/vendor_invoice.entity.model.d.ts +1 -8
  40. package/dist/src/entities/model/vendor_invoice.entity.model.js +0 -9
  41. package/dist/src/enums/error.key.enum.d.ts +1 -2
  42. package/dist/src/enums/error.key.enum.js +0 -1
  43. package/dist/src/model/entities/timesheet.model.d.ts +5 -1
  44. package/dist/src/model/entities/timesheet.model.js +1 -0
  45. package/dist/src/utils/models/date-code.model.util.d.ts +8 -0
  46. package/dist/src/utils/models/date-code.model.util.js +22 -0
  47. package/package.json +1 -1
  48. package/dist/src/api/interface/vendor_tds_challan.create.dto.interface.d.ts +0 -5
  49. package/dist/src/api/interface/vendor_tds_challan.create.dto.interface.js +0 -2
  50. package/dist/src/api/interface/vendor_tds_challan.update.dto.interface.d.ts +0 -17
  51. package/dist/src/api/interface/vendor_tds_challan.update.dto.interface.js +0 -17
  52. package/dist/src/api/interface/vendor_tds_liability.create.dto.interface.d.ts +0 -5
  53. package/dist/src/api/interface/vendor_tds_liability.create.dto.interface.js +0 -2
  54. package/dist/src/api/interface/vendor_tds_liability.update.dto.interface.d.ts +0 -19
  55. package/dist/src/api/interface/vendor_tds_liability.update.dto.interface.js +0 -13
  56. package/dist/src/entities/enums/vendor_tds_challan_status_enum.d.ts +0 -5
  57. package/dist/src/entities/enums/vendor_tds_challan_status_enum.js +0 -9
  58. package/dist/src/entities/enums/vendor_tds_liability_paid_status_enum.d.ts +0 -4
  59. package/dist/src/entities/enums/vendor_tds_liability_paid_status_enum.js +0 -8
  60. package/dist/src/entities/enums/vendor_tds_liability_status_enum.d.ts +0 -5
  61. package/dist/src/entities/enums/vendor_tds_liability_status_enum.js +0 -9
  62. package/dist/src/entities/flow-configs/vendor_tds_challan_flow.config.d.ts +0 -6
  63. package/dist/src/entities/flow-configs/vendor_tds_challan_flow.config.js +0 -70
  64. package/dist/src/entities/flow-configs/vendor_tds_liability_flow.config.d.ts +0 -7
  65. package/dist/src/entities/flow-configs/vendor_tds_liability_flow.config.js +0 -107
  66. package/dist/src/entities/interface/vendor_tds_challan.entity.interface.d.ts +0 -15
  67. package/dist/src/entities/interface/vendor_tds_challan.entity.interface.js +0 -2
  68. package/dist/src/entities/interface/vendor_tds_liability.entity.interface.d.ts +0 -15
  69. package/dist/src/entities/interface/vendor_tds_liability.entity.interface.js +0 -2
  70. package/dist/src/entities/model/vendor_tds_challan.entity.model.d.ts +0 -68
  71. package/dist/src/entities/model/vendor_tds_challan.entity.model.js +0 -251
  72. package/dist/src/entities/model/vendor_tds_liability.entity.model.d.ts +0 -66
  73. package/dist/src/entities/model/vendor_tds_liability.entity.model.js +0 -222
@@ -24,6 +24,28 @@ class ClientEntityModel extends base_entity_model_1.BaseEntityModel {
24
24
  this.secondaryContact = null;
25
25
  this.projects = [];
26
26
  this.clientAffiliates = [];
27
+ // getAdjustedCreditNoteTransactions(billingProfileCode?: string) {
28
+ // return this.getBillingsFromProfileCode(billingProfileCode).flatMap((billing) => billing.adjustedCreditNoteTransactions ?? []);
29
+ // }
30
+ // get totalCreditNoteAmount(): number {
31
+ // const creditNoteTransactions = this.projects.flatMap((project) => project.settledBillings ?? []).flatMap((billing) => billing.creditNoteTransactions ?? []);
32
+ // return sumNormalised(creditNoteTransactions, "amount");
33
+ // }
34
+ // get totalCreditNoteAmountAdjusted(): number {
35
+ // const adjustedTransactions = this.projects
36
+ // .flatMap((project) => project.settledBillings ?? [])
37
+ // .flatMap((billing) => billing.adjustedCreditNoteTransactions ?? []);
38
+ // return sumNormalised(adjustedTransactions, "amount");
39
+ // }
40
+ // get totalCreditNoteAmountPendingForAdjustment(): number {
41
+ // return this.totalCreditNoteAmount - this.totalCreditNoteAmountAdjusted;
42
+ // }
43
+ // getUnsettledCreditNoteSummary(billingProfileCode?: string) {
44
+ // return BillingTransactionEntityModel.getUnsettledCreditNoteSummary(
45
+ // this.getCreditNoteTransactions(billingProfileCode),
46
+ // this.getAdjustedCreditNoteTransactions(billingProfileCode),
47
+ // );
48
+ // }
27
49
  }
28
50
  getRelationConfigs() {
29
51
  return this.constructor.prototype.constructor.relationConfigs;
@@ -74,6 +96,44 @@ class ClientEntityModel extends base_entity_model_1.BaseEntityModel {
74
96
  static validateDocumentNoDocumentFile(data, deleteDetails) {
75
97
  return (0, document_validate_util_1.validateDocumentPairs)(ClientEntityModel.CLIENT_ENTITY_DOCUMENT_TYPES, data, deleteDetails);
76
98
  }
99
+ get gstNo() {
100
+ var _a;
101
+ return (_a = this.gstNumber) !== null && _a !== void 0 ? _a : "";
102
+ }
103
+ get parsedAddress() {
104
+ if (!this.address)
105
+ return null;
106
+ try {
107
+ return JSON.parse(this.address);
108
+ }
109
+ catch (_a) {
110
+ return null;
111
+ }
112
+ }
113
+ get addressLineOne() {
114
+ var _a, _b;
115
+ return (_b = (_a = this.parsedAddress) === null || _a === void 0 ? void 0 : _a.addressLine1) !== null && _b !== void 0 ? _b : "";
116
+ }
117
+ get addressLineTwo() {
118
+ var _a, _b;
119
+ return (_b = (_a = this.parsedAddress) === null || _a === void 0 ? void 0 : _a.addressLine2) !== null && _b !== void 0 ? _b : "";
120
+ }
121
+ get city() {
122
+ var _a, _b;
123
+ return (_b = (_a = this.parsedAddress) === null || _a === void 0 ? void 0 : _a.city) !== null && _b !== void 0 ? _b : "";
124
+ }
125
+ get state() {
126
+ var _a, _b;
127
+ return (_b = (_a = this.parsedAddress) === null || _a === void 0 ? void 0 : _a.state) !== null && _b !== void 0 ? _b : "";
128
+ }
129
+ getBillingsFromProfileCode(billingProfileCode) {
130
+ return this.projects
131
+ .flatMap((project) => { var _a; return (_a = project.billings) !== null && _a !== void 0 ? _a : []; })
132
+ .filter((billing) => !billingProfileCode || billing.billingProfileCode === billingProfileCode);
133
+ }
134
+ getCreditNoteTransactions(billingProfileCode) {
135
+ return this.getBillingsFromProfileCode(billingProfileCode).flatMap((billing) => { var _a; return (_a = billing.creditNoteTransactions) !== null && _a !== void 0 ? _a : []; });
136
+ }
77
137
  }
78
138
  exports.ClientEntityModel = ClientEntityModel;
79
139
  ClientEntityModel.CLIENT_ENTITY_DOCUMENT_TYPES = ["pan", "tan", "gst"];
@@ -76,8 +76,6 @@ const vendor_invoice_history_entity_model_1 = require("./vendor_invoice_history.
76
76
  const vendor_invoice_item_entity_model_1 = require("./vendor_invoice_item.entity.model");
77
77
  const vendor_invoice_item_history_entity_model_1 = require("./vendor_invoice_item_history.entity.model");
78
78
  const vendor_invoice_payment_entity_model_1 = require("./vendor_invoice_payment.entity.model");
79
- const vendor_tds_challan_entity_model_1 = require("./vendor_tds_challan.entity.model");
80
- const vendor_tds_liability_entity_model_1 = require("./vendor_tds_liability.entity.model");
81
79
  const voucher_type_entity_model_1 = require("./voucher_type.entity.model");
82
80
  const website_lead_entity_model_1 = require("./website_lead.entity.model");
83
81
  const website_newsletter_subscription_entity_model_1 = require("./website_newsletter_subscription.entity.model");
@@ -182,8 +180,6 @@ exports.entityEnumToEntityModel = {
182
180
  [entity_utils_interface_1.EntityEnum.ENTITY_HISTORY]: entity_history_entity_model_1.EntityHistoryEntityModel.fromEntity,
183
181
  [entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_PAYMENT]: vendor_invoice_payment_entity_model_1.VendorInvoicePaymentEntityModel.fromEntity,
184
182
  [entity_utils_interface_1.EntityEnum.LEAVE_APPROVAL]: leave_approval_entity_model_1.LeaveApprovalEntityModel.fromEntity,
185
- [entity_utils_interface_1.EntityEnum.VENDOR_TDS_LIABILITY]: vendor_tds_liability_entity_model_1.VendorTdsLiabilityEntityModel.fromEntity,
186
- [entity_utils_interface_1.EntityEnum.VENDOR_TDS_CHALLAN]: vendor_tds_challan_entity_model_1.VendorTdsChallanEntityModel.fromEntity,
187
183
  };
188
184
  function entityMapToModels(entityMap) {
189
185
  for (const entityName in entityMap) {
@@ -5,8 +5,10 @@ import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
5
5
  import { IProjectEntity, IProjectUserDto, UsageNotificationThresholdEnum } from "../interface/project.entity.interface";
6
6
  import { RelationConfigs } from "../interface/relation-config.interface";
7
7
  import { BaseEntityModel } from "./base.entity.model";
8
+ import { BillingEntityModel } from "./billing.entity.model";
8
9
  import { ClientEntityModel } from "./client.entity.model";
9
10
  import { ProjectUserMappingEntityModel } from "./project-user-mapping.entity.model";
11
+ import { TimesheetEntityModel } from "./timesheet.entity.model";
10
12
  import { UserEntityModel } from "./user.entity.model";
11
13
  export declare class ProjectEntityModel extends BaseEntityModel<EntityEnum.PROJECT> implements IProjectEntity {
12
14
  id: number;
@@ -34,10 +36,12 @@ export declare class ProjectEntityModel extends BaseEntityModel<EntityEnum.PROJE
34
36
  userMappings?: (UserEntityModel & ProjectUserMappingEntityModel)[];
35
37
  projectUserMappings?: ProjectUserMappingEntityModel[];
36
38
  client: ClientEntityModel;
39
+ billings?: BillingEntityModel[];
40
+ timesheets: TimesheetEntityModel[];
37
41
  static fromEntity(entity: IProjectEntity): ProjectEntityModel;
38
- static relationConfigs: RelationConfigs<[EntityEnum.PROJECT_USER_MAPPING, EntityEnum.CLIENT], EntityEnum.PROJECT>;
42
+ static relationConfigs: RelationConfigs<[EntityEnum.PROJECT_USER_MAPPING, EntityEnum.BILLING, EntityEnum.CLIENT, EntityEnum.TIMESHEET], EntityEnum.PROJECT>;
39
43
  populateUsers(users: UserEntityModel[], projectUserMapping: ProjectUserMappingEntityModel[]): void;
40
- getRelationConfigs(): [import("../interface/relation-config.interface").IRelationConfig<EntityEnum.PROJECT_USER_MAPPING, EntityEnum.PROJECT>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.CLIENT, EntityEnum.PROJECT>];
44
+ getRelationConfigs(): [import("../interface/relation-config.interface").IRelationConfig<EntityEnum.PROJECT_USER_MAPPING, EntityEnum.PROJECT>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.BILLING, EntityEnum.PROJECT>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.CLIENT, EntityEnum.PROJECT>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.TIMESHEET, EntityEnum.PROJECT>];
41
45
  isForeignCurrencyProject(): boolean;
42
46
  get parsedBillingRate(): any;
43
47
  isHourlyProject(): boolean;
@@ -45,4 +49,18 @@ export declare class ProjectEntityModel extends BaseEntityModel<EntityEnum.PROJE
45
49
  isAdhocProject(): boolean;
46
50
  get partnersOwnerUsersOfProject(): UserEntityModel[];
47
51
  get clientName(): string;
52
+ get clientGSTNumber(): string;
53
+ get clientVendorCode(): string;
54
+ get timesheetsOfProject(): TimesheetEntityModel[];
55
+ getTimesheetsGroupedByUserId(): Map<number, TimesheetEntityModel[]>;
56
+ getAllPartnersClassificationData(): Map<number, {
57
+ resourceCounts: {
58
+ resourceName: string;
59
+ timesheetCount: number;
60
+ }[];
61
+ resources: {
62
+ resourceName: string;
63
+ timesheets: TimesheetEntityModel[];
64
+ }[];
65
+ }>;
48
66
  }
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProjectEntityModel = void 0;
4
4
  const enums_1 = require("../../enums");
5
+ // import { BillingStatusEnum } from "../enums/billing.status.enum";
6
+ const helper_fn_util_1 = require("../../utils/helper.fn.util");
5
7
  const project_revenue_split_enum_1 = require("../enums/project-revenue-split.enum");
6
8
  const project_entity_enum_1 = require("../enums/project.entity.enum");
7
9
  const relation_type_enum_1 = require("../enums/relation-type.enum");
@@ -29,6 +31,8 @@ class ProjectEntityModel extends base_entity_model_1.BaseEntityModel {
29
31
  this.clientQuoteId = null;
30
32
  this.users = [];
31
33
  this.client = {};
34
+ this.billings = [];
35
+ this.timesheets = [];
32
36
  }
33
37
  static fromEntity(entity) {
34
38
  const result = new ProjectEntityModel(entity_utils_interface_1.EntityEnum.PROJECT);
@@ -112,6 +116,45 @@ class ProjectEntityModel extends base_entity_model_1.BaseEntityModel {
112
116
  get clientName() {
113
117
  return this.client.name;
114
118
  }
119
+ get clientGSTNumber() {
120
+ return this.client.gstNo;
121
+ }
122
+ get clientVendorCode() {
123
+ var _a;
124
+ return (_a = this.client.vendorCode) !== null && _a !== void 0 ? _a : "";
125
+ }
126
+ // get settledBillings() {
127
+ // return this.billings?.filter((billing) => billing.status === BillingStatusEnum.SETTLED);
128
+ // }
129
+ get timesheetsOfProject() {
130
+ return this.timesheets;
131
+ }
132
+ getTimesheetsGroupedByUserId() {
133
+ return (0, helper_fn_util_1.groupByFunction)(this.timesheets, (t) => t.userId);
134
+ }
135
+ getAllPartnersClassificationData() {
136
+ var _a, _b, _c;
137
+ const result = new Map();
138
+ const timesheetsGroupedByUserId = this.getTimesheetsGroupedByUserId();
139
+ const partnerMappings = (_b = (_a = this.projectUserMappings) === null || _a === void 0 ? void 0 : _a.filter((m) => m.isMappingOfPartnerOwner())) !== null && _b !== void 0 ? _b : [];
140
+ for (const pm of partnerMappings) {
141
+ result.set(pm.userId, { resourceCounts: [], resources: [] });
142
+ }
143
+ for (const mapping of (_c = this.projectUserMappings) !== null && _c !== void 0 ? _c : []) {
144
+ if (!mapping.user)
145
+ continue;
146
+ const userTimesheets = timesheetsGroupedByUserId.get(mapping.userId);
147
+ if (!(userTimesheets === null || userTimesheets === void 0 ? void 0 : userTimesheets.length))
148
+ continue;
149
+ for (const pm of partnerMappings) {
150
+ const entry = result.get(pm.userId);
151
+ const resourceName = mapping.userId === pm.userId ? "You" : mapping.user.name;
152
+ entry.resourceCounts.push({ resourceName, timesheetCount: userTimesheets.length });
153
+ entry.resources.push({ resourceName, timesheets: userTimesheets });
154
+ }
155
+ }
156
+ return result;
157
+ }
115
158
  }
116
159
  exports.ProjectEntityModel = ProjectEntityModel;
117
160
  ProjectEntityModel.relationConfigs = [
@@ -124,6 +167,15 @@ ProjectEntityModel.relationConfigs = [
124
167
  key: "id",
125
168
  },
126
169
  },
170
+ {
171
+ name: entity_utils_interface_1.EntityEnum.BILLING,
172
+ relation: relation_type_enum_1.RelationType.MANY,
173
+ key: "billings",
174
+ mapKeyConfig: {
175
+ relationKey: "projectId",
176
+ key: "id",
177
+ },
178
+ },
127
179
  {
128
180
  name: entity_utils_interface_1.EntityEnum.CLIENT,
129
181
  relation: relation_type_enum_1.RelationType.ONE,
@@ -133,4 +185,13 @@ ProjectEntityModel.relationConfigs = [
133
185
  key: "clientId",
134
186
  },
135
187
  },
188
+ {
189
+ name: entity_utils_interface_1.EntityEnum.TIMESHEET,
190
+ relation: relation_type_enum_1.RelationType.MANY,
191
+ key: "timesheets",
192
+ mapKeyConfig: {
193
+ relationKey: "projectId",
194
+ key: "id",
195
+ },
196
+ },
136
197
  ];
@@ -1,34 +1,6 @@
1
1
  "use strict";
2
2
  // import { EntityEnum } from "../interface/entity.utils.interface";
3
3
  // import { BaseEntityModel } from "./base.entity.model";
4
- // import { RelationConfigs } from "../interface/relation-config.interface";
5
- // import { RelationType } from "../enums/relation-type.enum";
6
- // import { IUserEntity } from "../interface/user.entity.interface";
7
- // import { AppBadRequestException } from "../../exceptions";
8
- // import { ErrorKeyEnum } from "../../enums/error.key.enum";
9
- // import { UserEntityModel } from "./user.entity.model";
10
- // import { IRowActions } from "./interface/row-actions.interface";
11
- // import { EntityActionFlowResolverV2 } from "../../utils";
12
- // import { ITdsRateEntity } from "../interface/tds_rate.entity.interface";
13
- // import { TdsRateStatusEnum } from "../enums/tds_rate_status_enum";
14
- // import { OrganizationTypeTdsRateMappingEntityModel } from "./organization_type_tds_rate_mapping.entity.model";
15
- // import { TdsRateVoucherTypeMappingEntityModel } from "./tds_rate_voucher_type_mapping.entity.model";
16
- // import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
17
- // import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
18
- // import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
19
- // import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
20
- // import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
21
- // import { VendorEntityModel } from "./vendor.entity.model";
22
- // import { StateEntityModel } from "./state.entity.model";
23
- // import { CountryEntityModel } from "./country.entity.model";
24
- // import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
25
- // import { OfficeLocationEntityModel } from "./office_location.entity.model";
26
- // import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
27
- // import { GstRateEntityModel } from "./gst_rate.entity.model";
28
- // import { VendorInvoicePaymentEntityModel } from "./vendor_invoice_payment.entity.model";
29
- // import { BankEntityModel } from "./bank.entity.model";
30
- // import { TdsRateActionEnum } from "../../api";
31
- // import { ITdsRateFlowConfigContextData, tdsRateFlowConfig } from "../flow-configs/tds_rate_flow.config";
32
4
  // export class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_RATE> implements ITdsRateEntity {
33
5
  // id: number = 0;
34
6
  // section: string = "";
@@ -43,20 +15,7 @@
43
15
  // createdBy: number = 0;
44
16
  // updatedBy: number = 0;
45
17
  // organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
46
- // tdsRateVoucherTypeMappings?: TdsRateVoucherTypeMappingEntityModel[];
47
- // vendorInvoiceItems?: VendorInvoiceItemEntityModel[];
48
- // vendorTdsLiabilitys?: VendorTdsLiabilityEntityModel[];
49
- // vendorTdsChallans?: VendorTdsChallanEntityModel[];
50
- // static relationConfigs: RelationConfigs<
51
- // [
52
- // EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING,
53
- // EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING,
54
- // EntityEnum.VENDOR_INVOICE_ITEM,
55
- // EntityEnum.VENDOR_TDS_LIABILITY,
56
- // EntityEnum.VENDOR_TDS_CHALLAN,
57
- // ],
58
- // EntityEnum.TDS_RATE
59
- // > = [
18
+ // static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING], EnumEntityType<EntityEnum.TDS_RATE>> = [
60
19
  // {
61
20
  // name: EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING,
62
21
  // relation: RelationType.MANY,
@@ -66,42 +25,6 @@
66
25
  // key: "id",
67
26
  // },
68
27
  // },
69
- // {
70
- // name: EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING,
71
- // relation: RelationType.MANY,
72
- // key: "tdsRateVoucherTypeMappings",
73
- // mapKeyConfig: {
74
- // relationKey: "tdsRateId",
75
- // key: "id",
76
- // },
77
- // },
78
- // {
79
- // name: EntityEnum.VENDOR_INVOICE_ITEM,
80
- // relation: RelationType.MANY,
81
- // key: "vendorInvoiceItems",
82
- // mapKeyConfig: {
83
- // relationKey: "tdsRateId",
84
- // key: "id",
85
- // },
86
- // },
87
- // {
88
- // name: EntityEnum.VENDOR_TDS_LIABILITY,
89
- // relation: RelationType.MANY,
90
- // key: "vendorTdsLiabilitys",
91
- // mapKeyConfig: {
92
- // relationKey: "tdsRateId",
93
- // key: "id",
94
- // },
95
- // },
96
- // {
97
- // name: EntityEnum.VENDOR_TDS_CHALLAN,
98
- // relation: RelationType.MANY,
99
- // key: "vendorTdsChallans",
100
- // mapKeyConfig: {
101
- // relationKey: "tdsRateId",
102
- // key: "id",
103
- // },
104
- // },
105
28
  // ];
106
29
  // static fromEntity(entity: ITdsRateEntity): TdsRateEntityModel {
107
30
  // const result = new TdsRateEntityModel(EntityEnum.TDS_RATE);
@@ -111,151 +34,4 @@
111
34
  // getRelationConfigs(): any[] {
112
35
  // return this.constructor.prototype.constructor.relationConfigs || [];
113
36
  // }
114
- // get organizationTypes(): OrganizationTypeEntityModel[] {
115
- // if (this.organizationTypeTdsRateMappings) {
116
- // return this.organizationTypeTdsRateMappings.filter((mapping) => mapping.organizationType).map((mapping) => mapping.organizationType!);
117
- // }
118
- // return [];
119
- // }
120
- // get voucherTypes(): VoucherTypeEntityModel[] {
121
- // if (this.tdsRateVoucherTypeMappings) {
122
- // return this.tdsRateVoucherTypeMappings.filter((mapping) => mapping.voucherType).map((mapping) => mapping.voucherType!);
123
- // }
124
- // return [];
125
- // }
126
- // get vendors(): VendorEntityModel[] | undefined {
127
- // // many_to_many -> many_to_many verified
128
- // // {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many'}
129
- // // ['tds_rate', 'organization_type'] -> many_to_many
130
- // // ['organization_type', 'vendor'] -> one_to_many
131
- // return this.organizationTypes
132
- // ?.flatMap((organizationType) => organizationType.vendors)
133
- // .filter((vendor): vendor is VendorEntityModel => !!vendor)
134
- // .reduce((accumulator: VendorEntityModel[], current) => {
135
- // if (!accumulator.some((vendor) => vendor.id === current.id)) {
136
- // accumulator.push(current);
137
- // }
138
- // return accumulator;
139
- // }, []);
140
- // }
141
- // get states(): StateEntityModel[] | undefined {
142
- // // many_to_many -> many_to_many verified
143
- // // {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->state': 'many_to_one'}
144
- // // ['organization_type', 'vendor'] -> one_to_many
145
- // // ['vendor', 'state'] -> many_to_one
146
- // return this.vendors
147
- // ?.flatMap((vendor) => vendor.state)
148
- // .filter((state): state is StateEntityModel => !!state)
149
- // .reduce((accumulator: StateEntityModel[], current) => {
150
- // if (!accumulator.some((state) => state.id === current.id)) {
151
- // accumulator.push(current);
152
- // }
153
- // return accumulator;
154
- // }, []);
155
- // }
156
- // get countrys(): CountryEntityModel[] | undefined {
157
- // // many_to_many -> many_to_many verified
158
- // // {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->country': 'many_to_one'}
159
- // // ['organization_type', 'vendor'] -> one_to_many
160
- // // ['vendor', 'country'] -> many_to_one
161
- // return this.vendors
162
- // ?.flatMap((vendor) => vendor.country)
163
- // .filter((country): country is CountryEntityModel => !!country)
164
- // .reduce((accumulator: CountryEntityModel[], current) => {
165
- // if (!accumulator.some((country) => country.id === current.id)) {
166
- // accumulator.push(current);
167
- // }
168
- // return accumulator;
169
- // }, []);
170
- // }
171
- // get vendorInvoices(): VendorInvoiceEntityModel[] | undefined {
172
- // // one_to_many -> many_to_many mismatch
173
- // // {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many'}
174
- // // ['organization_type', 'vendor'] -> one_to_many
175
- // // ['vendor', 'vendor_invoice'] -> one_to_many
176
- // return this.vendors
177
- // ?.flatMap((vendor) => vendor.vendorInvoices)
178
- // .filter((vendorInvoice): vendorInvoice is VendorInvoiceEntityModel => !!vendorInvoice)
179
- // .reduce((accumulator: VendorInvoiceEntityModel[], current) => {
180
- // if (!accumulator.some((vendorInvoice) => vendorInvoice.id === current.id)) {
181
- // accumulator.push(current);
182
- // }
183
- // return accumulator;
184
- // }, []);
185
- // }
186
- // get officeLocations(): OfficeLocationEntityModel[] | undefined {
187
- // // many_to_many -> many_to_many verified
188
- // // {'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'}
189
- // // ['vendor', 'vendor_invoice'] -> one_to_many
190
- // // ['vendor_invoice', 'office_location'] -> many_to_one
191
- // return this.vendorInvoices
192
- // ?.flatMap((vendorInvoice) => vendorInvoice.officeLocation)
193
- // .filter((officeLocation): officeLocation is OfficeLocationEntityModel => !!officeLocation)
194
- // .reduce((accumulator: OfficeLocationEntityModel[], current) => {
195
- // if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
196
- // accumulator.push(current);
197
- // }
198
- // return accumulator;
199
- // }, []);
200
- // }
201
- // get expenseHeads(): ExpenseHeadEntityModel[] | undefined {
202
- // // many_to_many -> many_to_many verified
203
- // // {'tds_rate->voucher_type': 'many_to_many', 'voucher_type->expense_head': 'one_to_many'}
204
- // // ['tds_rate', 'voucher_type'] -> many_to_many
205
- // // ['voucher_type', 'expense_head'] -> one_to_many
206
- // return this.voucherTypes
207
- // ?.flatMap((voucherType) => voucherType.expenseHeads)
208
- // .filter((expenseHead): expenseHead is ExpenseHeadEntityModel => !!expenseHead)
209
- // .reduce((accumulator: ExpenseHeadEntityModel[], current) => {
210
- // if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
211
- // accumulator.push(current);
212
- // }
213
- // return accumulator;
214
- // }, []);
215
- // }
216
- // get gstRates(): GstRateEntityModel[] | undefined {
217
- // // many_to_many -> many_to_many verified
218
- // // {'tds_rate->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
219
- // // ['tds_rate', 'vendor_invoice_item'] -> one_to_many
220
- // // ['vendor_invoice_item', 'gst_rate'] -> many_to_one
221
- // return this.vendorInvoiceItems
222
- // ?.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate)
223
- // .filter((gstRate): gstRate is GstRateEntityModel => !!gstRate)
224
- // .reduce((accumulator: GstRateEntityModel[], current) => {
225
- // if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
226
- // accumulator.push(current);
227
- // }
228
- // return accumulator;
229
- // }, []);
230
- // }
231
- // get vendorInvoicePayments(): VendorInvoicePaymentEntityModel[] | undefined {
232
- // // one_to_many -> many_to_many mismatch
233
- // // {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
234
- // // ['vendor', 'vendor_invoice'] -> one_to_many
235
- // // ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
236
- // return this.vendorInvoices
237
- // ?.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments)
238
- // .filter((vendorInvoicePayment): vendorInvoicePayment is VendorInvoicePaymentEntityModel => !!vendorInvoicePayment)
239
- // .reduce((accumulator: VendorInvoicePaymentEntityModel[], current) => {
240
- // if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
241
- // accumulator.push(current);
242
- // }
243
- // return accumulator;
244
- // }, []);
245
- // }
246
- // get banks(): BankEntityModel[] | undefined {
247
- // // many_to_many -> many_to_many verified
248
- // // {'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
249
- // // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
250
- // // ['vendor_tds_challan', 'bank'] -> many_to_one
251
- // return this.vendorTdsChallans
252
- // ?.flatMap((vendorTdsChallan) => vendorTdsChallan.bank)
253
- // .filter((bank): bank is BankEntityModel => !!bank)
254
- // .reduce((accumulator: BankEntityModel[], current) => {
255
- // if (!accumulator.some((bank) => bank.id === current.id)) {
256
- // accumulator.push(current);
257
- // }
258
- // return accumulator;
259
- // }, []);
260
- // }
261
37
  // }
@@ -15,8 +15,6 @@ import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
15
15
  import { OfficeLocationEntityModel } from "./office_location.entity.model";
16
16
  import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
17
17
  import { GstRateEntityModel } from "./gst_rate.entity.model";
18
- import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
19
- import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
20
18
  export declare class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_RATE> implements ITdsRateEntity {
21
19
  id: number;
22
20
  section: string;
@@ -33,14 +31,10 @@ export declare class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_R
33
31
  organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
34
32
  tdsRateVoucherTypeMappings?: TdsRateVoucherTypeMappingEntityModel[];
35
33
  vendorInvoiceItems?: VendorInvoiceItemEntityModel[];
36
- vendorTdsLiabilitys?: VendorTdsLiabilityEntityModel[];
37
- vendorTdsChallans?: VendorTdsChallanEntityModel[];
38
34
  static relationConfigs: RelationConfigs<[
39
35
  EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING,
40
36
  EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING,
41
- EntityEnum.VENDOR_INVOICE_ITEM,
42
- EntityEnum.VENDOR_TDS_LIABILITY,
43
- EntityEnum.VENDOR_TDS_CHALLAN
37
+ EntityEnum.VENDOR_INVOICE_ITEM
44
38
  ], EntityEnum.TDS_RATE>;
45
39
  static fromEntity(entity: ITdsRateEntity): TdsRateEntityModel;
46
40
  getRelationConfigs(): any[];
@@ -171,22 +171,4 @@ TdsRateEntityModel.relationConfigs = [
171
171
  key: "id",
172
172
  },
173
173
  },
174
- {
175
- name: entity_utils_interface_1.EntityEnum.VENDOR_TDS_LIABILITY,
176
- relation: relation_type_enum_1.RelationType.MANY,
177
- key: "vendorTdsLiabilitys",
178
- mapKeyConfig: {
179
- relationKey: "tdsRateId",
180
- key: "id",
181
- },
182
- },
183
- {
184
- name: entity_utils_interface_1.EntityEnum.VENDOR_TDS_CHALLAN,
185
- relation: relation_type_enum_1.RelationType.MANY,
186
- key: "vendorTdsChallans",
187
- mapKeyConfig: {
188
- relationKey: "tdsRateId",
189
- key: "id",
190
- },
191
- },
192
174
  ];
@@ -1,11 +1,20 @@
1
1
  import { CurrencyEnum } from "../../enums";
2
+ import { TimesheetClassificationStatusEnum } from "../enums/timesheet.classification.status.enum";
2
3
  import { TimesheetStatusEnum } from "../enums/timesheet.status.enum";
3
- import { EntityEnum } from "../interface/entity.utils.interface";
4
+ import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
4
5
  import { RelationConfigs } from "../interface/relation-config.interface";
5
6
  import { ITimesheetEntity } from "../interface/timesheet.entity.interface";
6
7
  import { BaseEntityModel } from "./base.entity.model";
8
+ import { ProjectEntityModel } from "./project.entity.model";
7
9
  import { TimesheetHistoryEntityModel } from "./timesheet_history.entity.model";
8
10
  import { UserEntityModel } from "./user.entity.model";
11
+ export interface IClassificationWindowConfig {
12
+ bufferDays: number;
13
+ windows: Array<{
14
+ startDay: number;
15
+ endDay: Nullable<number>;
16
+ }>;
17
+ }
9
18
  export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIMESHEET> implements ITimesheetEntity {
10
19
  id: number;
11
20
  userId: number;
@@ -17,17 +26,36 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
17
26
  status: TimesheetStatusEnum;
18
27
  remark?: string;
19
28
  billingId?: number;
29
+ billedDuration?: number;
30
+ notBilledDuration?: number;
31
+ classificationStatus: TimesheetClassificationStatusEnum;
32
+ classifiedBy?: number;
20
33
  createdBy: number;
21
34
  updatedBy: number;
22
35
  createdOn: number;
23
36
  updatedOn: number;
24
37
  user?: UserEntityModel;
25
38
  history?: TimesheetHistoryEntityModel[];
39
+ project?: ProjectEntityModel;
26
40
  static fromEntity(entity: ITimesheetEntity): TimesheetEntityModel;
27
41
  getRelationConfigs(): any[];
28
- static relationConfigs: RelationConfigs<[EntityEnum.USER, EntityEnum.TIMESHEET_HISTORY], EntityEnum.TIMESHEET>;
42
+ static relationConfigs: RelationConfigs<[EntityEnum.USER, EntityEnum.TIMESHEET_HISTORY, EntityEnum.PROJECT], EntityEnum.TIMESHEET>;
29
43
  getTimesheetAmount(projectCurrency: CurrencyEnum): number;
30
44
  get formattedDate(): string;
31
45
  get userName(): string | undefined;
32
46
  get latestStatusFromHistory(): TimesheetStatusEnum | undefined;
47
+ getDateCodeDay(): number;
48
+ getClassificationDeadline(config: IClassificationWindowConfig): Date;
49
+ static getTimesheetAutoClassificationDateCodeRange(config: IClassificationWindowConfig): {
50
+ windowStart: string;
51
+ windowEnd: string;
52
+ } | null;
53
+ static getActiveClassificationWindowRange(config: IClassificationWindowConfig): {
54
+ windowStart: string;
55
+ windowEnd: string;
56
+ } | null;
57
+ static parseClassificationWindowsString(str: string): Array<{
58
+ startDay: number;
59
+ endDay: Nullable<number>;
60
+ }>;
33
61
  }