law-common 10.72.4-beta.0 → 10.72.4
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/dist/src/api/interface/billing.entity.response.d.ts +8 -1
- package/dist/src/constants/billing_constants.d.ts +1 -0
- package/dist/src/constants/billing_constants.js +2 -1
- package/dist/src/entities/model/billing.entity.model.d.ts +14 -4
- package/dist/src/entities/model/billing.entity.model.js +42 -36
- package/dist/src/utils/helper.fn.util.d.ts +1 -0
- package/dist/src/utils/helper.fn.util.js +5 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BillingActionsEnum, BillingStatusEnum, IBillingEntity, IBillingReimbursementExpenseEntity, IBillingTimesheetEntity, IProjectEntity, IUserEntity } from "../../entities";
|
|
1
|
+
import { BillingActionsEnum, BillingEntityModel, BillingStatusEnum, EntityModelRelationHelper, IBillingEntity, IBillingProfileEntity, IBillingReimbursementExpenseEntity, IBillingTimesheetEntity, IDesignationEntity, IProjectEntity, IUserEntity } from "../../entities";
|
|
2
2
|
import { IUpdateBillingDto } from "./billing.update.dto.interface";
|
|
3
3
|
export type IBillingEntityResponse = {
|
|
4
4
|
billing: IBillingEntity;
|
|
@@ -31,3 +31,10 @@ export type IBillingFlowContextData = {
|
|
|
31
31
|
currentBilling?: IBillingEntity;
|
|
32
32
|
dto?: IUpdateBillingDto;
|
|
33
33
|
};
|
|
34
|
+
export interface IBillingExportContext {
|
|
35
|
+
currentUser: IUserEntity;
|
|
36
|
+
billingEntity: BillingEntityModel;
|
|
37
|
+
billingEntityModelRelationHelper: EntityModelRelationHelper;
|
|
38
|
+
billingProfileEntity: IBillingProfileEntity[];
|
|
39
|
+
designationEntites: IDesignationEntity[];
|
|
40
|
+
}
|
|
@@ -2,3 +2,4 @@ export declare const billingPrefixCompanyName = "ALC";
|
|
|
2
2
|
export declare const billingSequenceSeperator = "-";
|
|
3
3
|
export declare const billingSequenceSeperatorForCurrentFy = "/";
|
|
4
4
|
export declare const currentFY = "2526";
|
|
5
|
+
export declare const PROHIBITED_CHARS = "\\ / : * ? \" < > | . , ; = # % & { } $ ! ' @ ` ~ ^ [ ] ( ) +";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.currentFY = exports.billingSequenceSeperatorForCurrentFy = exports.billingSequenceSeperator = exports.billingPrefixCompanyName = void 0;
|
|
3
|
+
exports.PROHIBITED_CHARS = exports.currentFY = exports.billingSequenceSeperatorForCurrentFy = exports.billingSequenceSeperator = exports.billingPrefixCompanyName = void 0;
|
|
4
4
|
exports.billingPrefixCompanyName = "ALC";
|
|
5
5
|
exports.billingSequenceSeperator = "-";
|
|
6
6
|
exports.billingSequenceSeperatorForCurrentFy = "/";
|
|
7
7
|
exports.currentFY = "2526";
|
|
8
|
+
exports.PROHIBITED_CHARS = `\\ / : * ? " < > | . , ; = # % & { } $ ! ' @ \` ~ ^ [ ] ( ) +`;
|
|
@@ -70,7 +70,6 @@ export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLI
|
|
|
70
70
|
static validateDocumentNoDocumentFile(data: DocumentFields<typeof BillingEntityModel.BILLING_ENTITY_DOCUMENT_TYPES>, deleteDetails?: DeleteDocumentDetails<typeof BillingEntityModel.BILLING_ENTITY_DOCUMENT_TYPES>): Result<void, IDtoValidationError[]>;
|
|
71
71
|
get intermediaryBanks(): import("./intermediary-bank.entity.model").IntermediaryBankEntityModel[] | undefined;
|
|
72
72
|
get reimbursements(): ReimbursementEntityModel[];
|
|
73
|
-
get summarryFolderName(): string;
|
|
74
73
|
static relationConfigs: RelationConfigs<[
|
|
75
74
|
EntityEnum.PROJECT,
|
|
76
75
|
EntityEnum.CLIENT,
|
|
@@ -133,7 +132,18 @@ export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLI
|
|
|
133
132
|
latestBilling?: IBillingEntity;
|
|
134
133
|
}): string;
|
|
135
134
|
getBillingTimesheetUserIds(): number[];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
getTimestamp(): string;
|
|
136
|
+
invoiceFileName(timestamp: string): string;
|
|
137
|
+
timesheetSummarryFileName(timestamp: string): string;
|
|
138
|
+
OPESummarryFileName(timestamp: string): string;
|
|
139
|
+
getFileNames(timestamp: string): {
|
|
140
|
+
invoiceFileName: string;
|
|
141
|
+
timesheetSummaryFileName: string;
|
|
142
|
+
opeSummaryFileName: string;
|
|
143
|
+
};
|
|
144
|
+
get billingPhase(): string;
|
|
145
|
+
get clientName(): string;
|
|
146
|
+
get projectName(): string;
|
|
147
|
+
getActiveBillingTransactions(): BillingTransactionEntityModel[] | undefined;
|
|
148
|
+
hasActiveTranansactions(): boolean | undefined;
|
|
139
149
|
}
|
|
@@ -61,28 +61,6 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
61
61
|
var _a, _b;
|
|
62
62
|
return (_b = (_a = this.reimbursementExpenses) === null || _a === void 0 ? void 0 : _a.map((expense) => expense.reimbursement).filter(utils_1.isDefined)) !== null && _b !== void 0 ? _b : [];
|
|
63
63
|
}
|
|
64
|
-
get summarryFolderName() {
|
|
65
|
-
// Folder Name
|
|
66
|
-
// <Invoice | Proforma Invoice | Draft Invoice> - <InvoiceNo | ProjectName> - YYMMDD HHMM
|
|
67
|
-
// File
|
|
68
|
-
// Proforma Invoice | Invoice | Draft Invoice.pdf
|
|
69
|
-
// Timesheet.pdf
|
|
70
|
-
// OPE.pdf
|
|
71
|
-
var _a, _b, _c;
|
|
72
|
-
const timestamp = utils_1.DateCodeModel.getCurrentTimestampCode();
|
|
73
|
-
let prefix;
|
|
74
|
-
if (this.type === billing_type_enum_1.BillingTypeEnum.ADVANCE) {
|
|
75
|
-
prefix = "Proforma Invoice";
|
|
76
|
-
}
|
|
77
|
-
else if (!this.invoiceNumber) {
|
|
78
|
-
prefix = "Draft Invoice";
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
prefix = "Invoice";
|
|
82
|
-
}
|
|
83
|
-
const identifier = (_c = (_a = this.invoiceNumber) !== null && _a !== void 0 ? _a : (_b = this.project) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : "";
|
|
84
|
-
return `${prefix} - ${identifier} - ${timestamp}`;
|
|
85
|
-
}
|
|
86
64
|
static fromEntity(entity) {
|
|
87
65
|
const result = new BillingEntityModel(entity_utils_interface_1.EntityEnum.BILLING);
|
|
88
66
|
Object.assign(result, entity);
|
|
@@ -388,26 +366,54 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
388
366
|
var _a, _b;
|
|
389
367
|
return (_b = (_a = this.billingTimesheets) === null || _a === void 0 ? void 0 : _a.map((timesheet) => timesheet.userId)) !== null && _b !== void 0 ? _b : [];
|
|
390
368
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
369
|
+
getTimestamp() {
|
|
370
|
+
const now = new Date();
|
|
371
|
+
const ist = new Date(now.getTime() + 5.5 * 60 * 60 * 1000);
|
|
372
|
+
return (`${String(ist.getDate()).padStart(2, "0")}${String(ist.getMonth() + 1).padStart(2, "0")}${ist.getFullYear()}` +
|
|
373
|
+
`_${String(ist.getHours()).padStart(2, "0")}${String(ist.getMinutes()).padStart(2, "0")}${String(ist.getSeconds()).padStart(2, "0")}`);
|
|
374
|
+
}
|
|
375
|
+
// summarryFolderName(timestamp: string): string {
|
|
376
|
+
// return `${this.billingPhase}_${this.clientName}_${this.projectName} _ ${timestamp}`;
|
|
377
|
+
// }
|
|
378
|
+
invoiceFileName(timestamp) {
|
|
379
|
+
return `${this.billingPhase}_Invoice_${this.clientName}_${this.projectName}_${timestamp}.pdf`;
|
|
380
|
+
}
|
|
381
|
+
timesheetSummarryFileName(timestamp) {
|
|
382
|
+
return `${this.billingPhase}_Timesheet_Summary_${this.clientName}_${this.projectName}_${timestamp}.pdf`;
|
|
383
|
+
}
|
|
384
|
+
OPESummarryFileName(timestamp) {
|
|
385
|
+
return `${this.billingPhase}_OPE_${this.clientName}_${this.projectName}_${timestamp}.pdf`;
|
|
386
|
+
}
|
|
387
|
+
getFileNames(timestamp) {
|
|
388
|
+
return {
|
|
389
|
+
invoiceFileName: this.invoiceFileName(timestamp),
|
|
390
|
+
timesheetSummaryFileName: this.timesheetSummarryFileName(timestamp),
|
|
391
|
+
opeSummaryFileName: this.OPESummarryFileName(timestamp),
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
get billingPhase() {
|
|
396
395
|
if (this.type === billing_type_enum_1.BillingTypeEnum.ADVANCE) {
|
|
397
|
-
return "Proforma
|
|
398
|
-
}
|
|
399
|
-
else if (!this.invoiceNumber) {
|
|
400
|
-
return "Draft Invoice.pdf";
|
|
396
|
+
return "Proforma";
|
|
401
397
|
}
|
|
402
398
|
else {
|
|
403
|
-
return
|
|
399
|
+
return this.invoiceNumber ? "Final" : "Draft";
|
|
404
400
|
}
|
|
405
401
|
}
|
|
406
|
-
get
|
|
407
|
-
|
|
402
|
+
get clientName() {
|
|
403
|
+
var _a, _b;
|
|
404
|
+
return (0, utils_1.sanitizeName)((_b = (_a = this.client) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "");
|
|
405
|
+
}
|
|
406
|
+
get projectName() {
|
|
407
|
+
var _a, _b;
|
|
408
|
+
return (0, utils_1.sanitizeName)((_b = (_a = this.project) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "");
|
|
409
|
+
}
|
|
410
|
+
getActiveBillingTransactions() {
|
|
411
|
+
var _a;
|
|
412
|
+
return (_a = this.billingTransactions) === null || _a === void 0 ? void 0 : _a.filter((transaction) => transaction.status !== billing_transaction_status_enum_1.BillingTransactionStatusEnum.REJECTED);
|
|
408
413
|
}
|
|
409
|
-
|
|
410
|
-
|
|
414
|
+
hasActiveTranansactions() {
|
|
415
|
+
const billTransactions = this.getActiveBillingTransactions();
|
|
416
|
+
return billTransactions && billTransactions.length > 0;
|
|
411
417
|
}
|
|
412
418
|
}
|
|
413
419
|
exports.BillingEntityModel = BillingEntityModel;
|
|
@@ -442,3 +442,4 @@ export declare function removeDuplicatesByKey<T, K extends keyof T>(items: T[],
|
|
|
442
442
|
* Preserves the exact type of the key (string[] or number[]).
|
|
443
443
|
*/
|
|
444
444
|
export declare function getUniqueValuesByKey<T, K extends keyof T>(items: T[], key: K): T[K][];
|
|
445
|
+
export declare function sanitizeName(name: string): string;
|
|
@@ -48,8 +48,10 @@ exports.sumNormalised = sumNormalised;
|
|
|
48
48
|
exports.isDefined = isDefined;
|
|
49
49
|
exports.removeDuplicatesByKey = removeDuplicatesByKey;
|
|
50
50
|
exports.getUniqueValuesByKey = getUniqueValuesByKey;
|
|
51
|
+
exports.sanitizeName = sanitizeName;
|
|
51
52
|
const date_fns_1 = require("date-fns");
|
|
52
53
|
const lodash_1 = require("lodash");
|
|
54
|
+
const constants_1 = require("../constants");
|
|
53
55
|
const util_constants_1 = require("../constants/util.constants");
|
|
54
56
|
const error_key_enum_1 = require("../enums/error.key.enum");
|
|
55
57
|
const exceptions_1 = require("../exceptions");
|
|
@@ -810,3 +812,6 @@ function removeDuplicatesByKey(items, key) {
|
|
|
810
812
|
function getUniqueValuesByKey(items, key) {
|
|
811
813
|
return [...new Set(items.map((item) => item[key]))];
|
|
812
814
|
}
|
|
815
|
+
function sanitizeName(name) {
|
|
816
|
+
return name.replace(constants_1.PROHIBITED_CHARS, " ").replace(/\s+/g, " ").trim();
|
|
817
|
+
}
|