@mody-park-cha-raja/finance_common 4.26.1-beta.0 → 4.26.1-beta.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/dist/index.d.mts +88 -1
- package/dist/index.d.ts +88 -1
- package/dist/index.js +255 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as XLSX from 'xlsx';
|
|
2
|
+
|
|
1
3
|
declare const SPECIAL_FLATS: readonly string[];
|
|
2
4
|
declare const FLAT_NUMBERS: readonly string[];
|
|
3
5
|
declare const FLATS_BY_WING: ReadonlyMap<string, readonly string[]>;
|
|
@@ -654,6 +656,91 @@ declare enum OrderByDirection {
|
|
|
654
656
|
DESC = "DESC"
|
|
655
657
|
}
|
|
656
658
|
|
|
659
|
+
interface UserExpenseRow {
|
|
660
|
+
userId: number;
|
|
661
|
+
userName: string;
|
|
662
|
+
count: number;
|
|
663
|
+
cash: number;
|
|
664
|
+
upi: number;
|
|
665
|
+
bankTransfer: number;
|
|
666
|
+
total: number;
|
|
667
|
+
}
|
|
668
|
+
interface UserExpenseReportTotals {
|
|
669
|
+
count: number;
|
|
670
|
+
cash: number;
|
|
671
|
+
upi: number;
|
|
672
|
+
bankTransfer: number;
|
|
673
|
+
total: number;
|
|
674
|
+
}
|
|
675
|
+
interface UserExpenseReport {
|
|
676
|
+
year: number;
|
|
677
|
+
rows: UserExpenseRow[];
|
|
678
|
+
totals: UserExpenseReportTotals;
|
|
679
|
+
}
|
|
680
|
+
declare function buildUserExpenseReport(expenses: ExpenseModel[], year: number): UserExpenseReport;
|
|
681
|
+
declare function buildUserExpenseWorkbook(report: UserExpenseReport): XLSX.WorkBook;
|
|
682
|
+
|
|
683
|
+
interface WingCollectionDonationLike {
|
|
684
|
+
flatNo: string;
|
|
685
|
+
amount: number;
|
|
686
|
+
receiptNumber?: string;
|
|
687
|
+
paymentType?: string;
|
|
688
|
+
createdOn?: number;
|
|
689
|
+
}
|
|
690
|
+
interface WingCollectionRow {
|
|
691
|
+
flatNo: string;
|
|
692
|
+
status: FlatCollectionStatus;
|
|
693
|
+
amount: number;
|
|
694
|
+
count: number;
|
|
695
|
+
receiptNumber: string;
|
|
696
|
+
paymentType: string;
|
|
697
|
+
donationDate: string;
|
|
698
|
+
}
|
|
699
|
+
interface WingCollectionTotals {
|
|
700
|
+
flats: number;
|
|
701
|
+
paid: number;
|
|
702
|
+
pending: number;
|
|
703
|
+
amount: number;
|
|
704
|
+
cash: number;
|
|
705
|
+
upi: number;
|
|
706
|
+
bankTransfer: number;
|
|
707
|
+
}
|
|
708
|
+
interface WingCollectionReport {
|
|
709
|
+
year: number;
|
|
710
|
+
selection: string;
|
|
711
|
+
label: string;
|
|
712
|
+
rows: WingCollectionRow[];
|
|
713
|
+
totals: WingCollectionTotals;
|
|
714
|
+
}
|
|
715
|
+
declare const ALL_WINGS_SELECTION = "ALL";
|
|
716
|
+
declare function getWingSelectionLabel(selection: string): string;
|
|
717
|
+
declare function getWingSelectionSlug(selection: string): string;
|
|
718
|
+
declare function buildWingWiseCollectionReport(donations: WingCollectionDonationLike[], year: number, selection: string): WingCollectionReport;
|
|
719
|
+
declare function buildWingWiseCollectionWorkbook(report: WingCollectionReport): XLSX.WorkBook;
|
|
720
|
+
|
|
721
|
+
type XlsxSerializationType = 'base64' | 'array' | 'binary';
|
|
722
|
+
interface XlsxCellAddress {
|
|
723
|
+
r: number;
|
|
724
|
+
c: number;
|
|
725
|
+
}
|
|
726
|
+
interface XlsxMergeRange {
|
|
727
|
+
s: XlsxCellAddress;
|
|
728
|
+
e: XlsxCellAddress;
|
|
729
|
+
}
|
|
730
|
+
interface XlsxSheetOptions {
|
|
731
|
+
cols?: {
|
|
732
|
+
wch?: number;
|
|
733
|
+
}[];
|
|
734
|
+
merges?: XlsxMergeRange[];
|
|
735
|
+
}
|
|
736
|
+
interface XlsxSheetInput {
|
|
737
|
+
name: string;
|
|
738
|
+
aoa: (string | number)[][];
|
|
739
|
+
options?: XlsxSheetOptions;
|
|
740
|
+
}
|
|
741
|
+
declare function buildXlsxWorkbook(sheets: XlsxSheetInput[]): XLSX.WorkBook;
|
|
742
|
+
declare function serializeXlsx(workbook: XLSX.WorkBook, type: XlsxSerializationType): string | ArrayBuffer;
|
|
743
|
+
|
|
657
744
|
interface IUserEntity extends IAuditColumnEntity {
|
|
658
745
|
id: number;
|
|
659
746
|
name: string;
|
|
@@ -808,4 +895,4 @@ interface IConfigurationUpdateDto extends IEntityUpdateDto<EntityType<EntityList
|
|
|
808
895
|
interface IConfigurationSearchDto extends IEntityFilterData<EntityType<EntityList.CONFIGURATION>> {
|
|
809
896
|
}
|
|
810
897
|
|
|
811
|
-
export { BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PAYMENT_OPTIONS, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
|
|
898
|
+
export { ALL_WINGS_SELECTION, BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PAYMENT_OPTIONS, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, type UserExpenseReport, type UserExpenseReportTotals, type UserExpenseRow, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, type WingCollectionDonationLike, type WingCollectionReport, type WingCollectionRow, type WingCollectionTotals, type XlsxCellAddress, type XlsxMergeRange, type XlsxSerializationType, type XlsxSheetInput, type XlsxSheetOptions, buildUserExpenseReport, buildUserExpenseWorkbook, buildWingWiseCollectionReport, buildWingWiseCollectionWorkbook, buildXlsxWorkbook, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, getWingSelectionLabel, getWingSelectionSlug, groupBy, serializeXlsx };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as XLSX from 'xlsx';
|
|
2
|
+
|
|
1
3
|
declare const SPECIAL_FLATS: readonly string[];
|
|
2
4
|
declare const FLAT_NUMBERS: readonly string[];
|
|
3
5
|
declare const FLATS_BY_WING: ReadonlyMap<string, readonly string[]>;
|
|
@@ -654,6 +656,91 @@ declare enum OrderByDirection {
|
|
|
654
656
|
DESC = "DESC"
|
|
655
657
|
}
|
|
656
658
|
|
|
659
|
+
interface UserExpenseRow {
|
|
660
|
+
userId: number;
|
|
661
|
+
userName: string;
|
|
662
|
+
count: number;
|
|
663
|
+
cash: number;
|
|
664
|
+
upi: number;
|
|
665
|
+
bankTransfer: number;
|
|
666
|
+
total: number;
|
|
667
|
+
}
|
|
668
|
+
interface UserExpenseReportTotals {
|
|
669
|
+
count: number;
|
|
670
|
+
cash: number;
|
|
671
|
+
upi: number;
|
|
672
|
+
bankTransfer: number;
|
|
673
|
+
total: number;
|
|
674
|
+
}
|
|
675
|
+
interface UserExpenseReport {
|
|
676
|
+
year: number;
|
|
677
|
+
rows: UserExpenseRow[];
|
|
678
|
+
totals: UserExpenseReportTotals;
|
|
679
|
+
}
|
|
680
|
+
declare function buildUserExpenseReport(expenses: ExpenseModel[], year: number): UserExpenseReport;
|
|
681
|
+
declare function buildUserExpenseWorkbook(report: UserExpenseReport): XLSX.WorkBook;
|
|
682
|
+
|
|
683
|
+
interface WingCollectionDonationLike {
|
|
684
|
+
flatNo: string;
|
|
685
|
+
amount: number;
|
|
686
|
+
receiptNumber?: string;
|
|
687
|
+
paymentType?: string;
|
|
688
|
+
createdOn?: number;
|
|
689
|
+
}
|
|
690
|
+
interface WingCollectionRow {
|
|
691
|
+
flatNo: string;
|
|
692
|
+
status: FlatCollectionStatus;
|
|
693
|
+
amount: number;
|
|
694
|
+
count: number;
|
|
695
|
+
receiptNumber: string;
|
|
696
|
+
paymentType: string;
|
|
697
|
+
donationDate: string;
|
|
698
|
+
}
|
|
699
|
+
interface WingCollectionTotals {
|
|
700
|
+
flats: number;
|
|
701
|
+
paid: number;
|
|
702
|
+
pending: number;
|
|
703
|
+
amount: number;
|
|
704
|
+
cash: number;
|
|
705
|
+
upi: number;
|
|
706
|
+
bankTransfer: number;
|
|
707
|
+
}
|
|
708
|
+
interface WingCollectionReport {
|
|
709
|
+
year: number;
|
|
710
|
+
selection: string;
|
|
711
|
+
label: string;
|
|
712
|
+
rows: WingCollectionRow[];
|
|
713
|
+
totals: WingCollectionTotals;
|
|
714
|
+
}
|
|
715
|
+
declare const ALL_WINGS_SELECTION = "ALL";
|
|
716
|
+
declare function getWingSelectionLabel(selection: string): string;
|
|
717
|
+
declare function getWingSelectionSlug(selection: string): string;
|
|
718
|
+
declare function buildWingWiseCollectionReport(donations: WingCollectionDonationLike[], year: number, selection: string): WingCollectionReport;
|
|
719
|
+
declare function buildWingWiseCollectionWorkbook(report: WingCollectionReport): XLSX.WorkBook;
|
|
720
|
+
|
|
721
|
+
type XlsxSerializationType = 'base64' | 'array' | 'binary';
|
|
722
|
+
interface XlsxCellAddress {
|
|
723
|
+
r: number;
|
|
724
|
+
c: number;
|
|
725
|
+
}
|
|
726
|
+
interface XlsxMergeRange {
|
|
727
|
+
s: XlsxCellAddress;
|
|
728
|
+
e: XlsxCellAddress;
|
|
729
|
+
}
|
|
730
|
+
interface XlsxSheetOptions {
|
|
731
|
+
cols?: {
|
|
732
|
+
wch?: number;
|
|
733
|
+
}[];
|
|
734
|
+
merges?: XlsxMergeRange[];
|
|
735
|
+
}
|
|
736
|
+
interface XlsxSheetInput {
|
|
737
|
+
name: string;
|
|
738
|
+
aoa: (string | number)[][];
|
|
739
|
+
options?: XlsxSheetOptions;
|
|
740
|
+
}
|
|
741
|
+
declare function buildXlsxWorkbook(sheets: XlsxSheetInput[]): XLSX.WorkBook;
|
|
742
|
+
declare function serializeXlsx(workbook: XLSX.WorkBook, type: XlsxSerializationType): string | ArrayBuffer;
|
|
743
|
+
|
|
657
744
|
interface IUserEntity extends IAuditColumnEntity {
|
|
658
745
|
id: number;
|
|
659
746
|
name: string;
|
|
@@ -808,4 +895,4 @@ interface IConfigurationUpdateDto extends IEntityUpdateDto<EntityType<EntityList
|
|
|
808
895
|
interface IConfigurationSearchDto extends IEntityFilterData<EntityType<EntityList.CONFIGURATION>> {
|
|
809
896
|
}
|
|
810
897
|
|
|
811
|
-
export { BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PAYMENT_OPTIONS, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, groupBy };
|
|
898
|
+
export { ALL_WINGS_SELECTION, BadRequestException, BaseEntityModel, ConfigurationKey, ConfigurationModel, ConfigurationType, DateCodeUtils, DateUtil, DonationHistoryModel, DonationModel, EntityFilterDataHelper, EntityHistoryOperation, EntityList, type EntityListEntityModelMap, type EntityModelType, EntityStatus, type EntityType, ExpenseHistoryModel, ExpenseModel, ExpenseType, FLATS_BY_WING, FLAT_NUMBERS, type FlatCollectionEntry, type FlatCollectionStatus, type FlatDonationLike, FlatModel, type FlatOption, type FlatParseResult, ForbiddenException, HttpException, type IAuditColumnEntity, type IBaseHistoryEntity, type ICashBookEntry, type IConfigurationCreateDto, type IConfigurationEntity, type IConfigurationSearchDto, type IConfigurationUpdateDto, type IDonationCreateDto, type IDonationEntity, type IDonationHistoryEntity, type IDonationSearchDto, type IDonationUpdateDto, type IDtoValidationError, type IEntityCreateDto, type IEntityFilterData, type IEntityFilterSearchData, type IEntityFilterSearchDataV2, type IEntityUpdateDto, type IExpenseCreateDto, type IExpenseEntity, type IExpenseHistoryEntity, type IExpenseSearchDto, type IExpenseUpdateDto, type IMappingPropertyEntry, type IModelRelationConfig, type ISearchV2Response, type ISponsorCreateDto, type ISponsorEntity, type ISponsorHistoryEntity, type ISponsorSearchDto, type ISponsorUpdateDto, type ITransactionCreateDto, type ITransactionEntity, type ITransactionHistoryEntity, type ITransactionSearchDto, type ITransactionUpdateDto, type IUserCreateDto, type IUserEntity, type IUserHistoryEntity, type IUserSearchDto, type IUserUpdateDto, type IVendorCreateDto, type IVendorEntity, type IVendorHistoryEntity, type IVendorSearchDto, type IVendorUpdateDto, NotFoundException, type Nullable, OrderByDirection, PAYMENT_OPTIONS, PaymentType, ReferenceIdPrefix, RelationType, SPECIAL_FLATS, SponsorHistoryModel, SponsorModel, SponsorTier, TransactionEntityType, TransactionHistoryModel, TransactionModel, TransactionType, USER_RELATION_CONFIG, UnauthorizedException, type UserExpenseReport, type UserExpenseReportTotals, type UserExpenseRow, UserHistoryModel, UserModel, VendorHistoryModel, VendorModel, VendorType, WINGS, type WingCollectionDonationLike, type WingCollectionReport, type WingCollectionRow, type WingCollectionTotals, type XlsxCellAddress, type XlsxMergeRange, type XlsxSerializationType, type XlsxSheetInput, type XlsxSheetOptions, buildUserExpenseReport, buildUserExpenseWorkbook, buildWingWiseCollectionReport, buildWingWiseCollectionWorkbook, buildXlsxWorkbook, convertNumberToWords, definedValues, diffArrays, entityListEntityModelMap, epochToReadableDate, getObjectDiffingKeys, getWingSelectionLabel, getWingSelectionSlug, groupBy, serializeXlsx };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,11 +17,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var index_exports = {};
|
|
22
32
|
__export(index_exports, {
|
|
33
|
+
ALL_WINGS_SELECTION: () => ALL_WINGS_SELECTION,
|
|
23
34
|
BadRequestException: () => BadRequestException,
|
|
24
35
|
BaseEntityModel: () => BaseEntityModel,
|
|
25
36
|
ConfigurationKey: () => ConfigurationKey,
|
|
@@ -63,13 +74,21 @@ __export(index_exports, {
|
|
|
63
74
|
VendorModel: () => VendorModel,
|
|
64
75
|
VendorType: () => VendorType,
|
|
65
76
|
WINGS: () => WINGS,
|
|
77
|
+
buildUserExpenseReport: () => buildUserExpenseReport,
|
|
78
|
+
buildUserExpenseWorkbook: () => buildUserExpenseWorkbook,
|
|
79
|
+
buildWingWiseCollectionReport: () => buildWingWiseCollectionReport,
|
|
80
|
+
buildWingWiseCollectionWorkbook: () => buildWingWiseCollectionWorkbook,
|
|
81
|
+
buildXlsxWorkbook: () => buildXlsxWorkbook,
|
|
66
82
|
convertNumberToWords: () => convertNumberToWords,
|
|
67
83
|
definedValues: () => definedValues,
|
|
68
84
|
diffArrays: () => diffArrays,
|
|
69
85
|
entityListEntityModelMap: () => entityListEntityModelMap,
|
|
70
86
|
epochToReadableDate: () => epochToReadableDate,
|
|
71
87
|
getObjectDiffingKeys: () => getObjectDiffingKeys,
|
|
72
|
-
|
|
88
|
+
getWingSelectionLabel: () => getWingSelectionLabel,
|
|
89
|
+
getWingSelectionSlug: () => getWingSelectionSlug,
|
|
90
|
+
groupBy: () => groupBy,
|
|
91
|
+
serializeXlsx: () => serializeXlsx
|
|
73
92
|
});
|
|
74
93
|
module.exports = __toCommonJS(index_exports);
|
|
75
94
|
|
|
@@ -1515,6 +1534,231 @@ var OrderByDirection = /* @__PURE__ */ ((OrderByDirection2) => {
|
|
|
1515
1534
|
return OrderByDirection2;
|
|
1516
1535
|
})(OrderByDirection || {});
|
|
1517
1536
|
|
|
1537
|
+
// src/utils/xlsx.utils.ts
|
|
1538
|
+
var XLSX = __toESM(require("xlsx"));
|
|
1539
|
+
function addressToCell(addr) {
|
|
1540
|
+
return { c: addr.c, r: addr.r };
|
|
1541
|
+
}
|
|
1542
|
+
function buildXlsxWorkbook(sheets) {
|
|
1543
|
+
const workbook = XLSX.utils.book_new();
|
|
1544
|
+
for (const { name, aoa, options } of sheets) {
|
|
1545
|
+
const worksheet = XLSX.utils.aoa_to_sheet(aoa);
|
|
1546
|
+
if (options) {
|
|
1547
|
+
if (options.cols) worksheet["!cols"] = options.cols;
|
|
1548
|
+
if (options.merges) {
|
|
1549
|
+
worksheet["!merges"] = options.merges.map((merge) => ({
|
|
1550
|
+
s: addressToCell(merge.s),
|
|
1551
|
+
e: addressToCell(merge.e)
|
|
1552
|
+
}));
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, name);
|
|
1556
|
+
}
|
|
1557
|
+
return workbook;
|
|
1558
|
+
}
|
|
1559
|
+
function serializeXlsx(workbook, type) {
|
|
1560
|
+
return XLSX.write(workbook, { type, bookType: "xlsx" });
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
// src/utils/user-expense.report.ts
|
|
1564
|
+
function buildUserExpenseReport(expenses, year) {
|
|
1565
|
+
const map = /* @__PURE__ */ new Map();
|
|
1566
|
+
for (const e of expenses) {
|
|
1567
|
+
const userId = e.incurredBy ?? 0;
|
|
1568
|
+
const userName = e.incurredByUserName || (userId === 0 ? UserModel.mandalAccountUser().name : `User #${userId}`);
|
|
1569
|
+
let row = map.get(userId);
|
|
1570
|
+
if (!row) {
|
|
1571
|
+
row = { userId, userName, count: 0, cash: 0, upi: 0, bankTransfer: 0, total: 0 };
|
|
1572
|
+
map.set(userId, row);
|
|
1573
|
+
}
|
|
1574
|
+
row.count += 1;
|
|
1575
|
+
row.total += e.amount;
|
|
1576
|
+
if (e.paymentType === "UPI" /* UPI */) {
|
|
1577
|
+
row.upi += e.amount;
|
|
1578
|
+
} else if (e.paymentType === "Bank Transfer" /* BANK_TRANSFER */) {
|
|
1579
|
+
row.bankTransfer += e.amount;
|
|
1580
|
+
} else {
|
|
1581
|
+
row.cash += e.amount;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
const rows = [...map.values()].sort((a, b) => b.total - a.total);
|
|
1585
|
+
const totals = rows.reduce(
|
|
1586
|
+
(acc, r) => ({
|
|
1587
|
+
count: acc.count + r.count,
|
|
1588
|
+
cash: acc.cash + r.cash,
|
|
1589
|
+
upi: acc.upi + r.upi,
|
|
1590
|
+
bankTransfer: acc.bankTransfer + r.bankTransfer,
|
|
1591
|
+
total: acc.total + r.total
|
|
1592
|
+
}),
|
|
1593
|
+
{ count: 0, cash: 0, upi: 0, bankTransfer: 0, total: 0 }
|
|
1594
|
+
);
|
|
1595
|
+
return { year, rows, totals };
|
|
1596
|
+
}
|
|
1597
|
+
function buildUserExpenseWorkbook(report) {
|
|
1598
|
+
const aoa = [
|
|
1599
|
+
["User", "Expense Count", "Cash (INR)", "UPI (INR)", "Bank Transfer (INR)", "Total (INR)"]
|
|
1600
|
+
];
|
|
1601
|
+
for (const row of report.rows) {
|
|
1602
|
+
aoa.push([row.userName, row.count, row.cash, row.upi, row.bankTransfer, row.total]);
|
|
1603
|
+
}
|
|
1604
|
+
aoa.push([
|
|
1605
|
+
"GRAND TOTAL",
|
|
1606
|
+
report.totals.count,
|
|
1607
|
+
report.totals.cash,
|
|
1608
|
+
report.totals.upi,
|
|
1609
|
+
report.totals.bankTransfer,
|
|
1610
|
+
report.totals.total
|
|
1611
|
+
]);
|
|
1612
|
+
return buildXlsxWorkbook([
|
|
1613
|
+
{
|
|
1614
|
+
name: "User-wise Expense Report",
|
|
1615
|
+
aoa,
|
|
1616
|
+
options: {
|
|
1617
|
+
cols: [{ wch: 26 }, { wch: 14 }, { wch: 12 }, { wch: 12 }, { wch: 18 }, { wch: 12 }]
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
]);
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
// src/utils/wing-wise-collection.report.ts
|
|
1624
|
+
var ALL_WINGS_SELECTION = "ALL";
|
|
1625
|
+
function getWingSelectionLabel(selection) {
|
|
1626
|
+
if (selection === ALL_WINGS_SELECTION) return "All Wings";
|
|
1627
|
+
if (FlatModel.SPECIAL_FLATS.includes(selection)) return selection;
|
|
1628
|
+
return `Wing ${selection}`;
|
|
1629
|
+
}
|
|
1630
|
+
function getWingSelectionSlug(selection) {
|
|
1631
|
+
if (selection === ALL_WINGS_SELECTION) return "all";
|
|
1632
|
+
if (FlatModel.SPECIAL_FLATS.includes(selection)) {
|
|
1633
|
+
return selection.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
1634
|
+
}
|
|
1635
|
+
return selection.toLowerCase();
|
|
1636
|
+
}
|
|
1637
|
+
function getFlatNumbersInScope(selection) {
|
|
1638
|
+
if (selection === ALL_WINGS_SELECTION) {
|
|
1639
|
+
return FlatModel.FLAT_NUMBERS.map((n) => n);
|
|
1640
|
+
}
|
|
1641
|
+
if (FlatModel.SPECIAL_FLATS.includes(selection)) {
|
|
1642
|
+
return [selection];
|
|
1643
|
+
}
|
|
1644
|
+
const wingFlats = FlatModel.FLATS_BY_WING.get(selection) ?? [];
|
|
1645
|
+
return wingFlats.map((num) => FlatModel.buildFlatNumber(selection, num));
|
|
1646
|
+
}
|
|
1647
|
+
function buildWingWiseCollectionReport(donations, year, selection) {
|
|
1648
|
+
const label = getWingSelectionLabel(selection);
|
|
1649
|
+
const donationsByFlat = /* @__PURE__ */ new Map();
|
|
1650
|
+
for (const d of donations) {
|
|
1651
|
+
const list = donationsByFlat.get(d.flatNo) ?? [];
|
|
1652
|
+
list.push(d);
|
|
1653
|
+
donationsByFlat.set(d.flatNo, list);
|
|
1654
|
+
}
|
|
1655
|
+
const rows = getFlatNumbersInScope(selection).map(
|
|
1656
|
+
(flatNo) => {
|
|
1657
|
+
const flatDonations = donationsByFlat.get(flatNo) ?? [];
|
|
1658
|
+
const amount = flatDonations.reduce((sum, d) => sum + d.amount, 0);
|
|
1659
|
+
const latest = flatDonations.reduce(
|
|
1660
|
+
(acc, d) => !acc || (d.createdOn ?? 0) > (acc.createdOn ?? 0) ? d : acc,
|
|
1661
|
+
null
|
|
1662
|
+
);
|
|
1663
|
+
return {
|
|
1664
|
+
flatNo,
|
|
1665
|
+
status: amount > 0 ? "Paid" : "Pending",
|
|
1666
|
+
amount,
|
|
1667
|
+
count: flatDonations.length,
|
|
1668
|
+
receiptNumber: latest?.receiptNumber ?? "",
|
|
1669
|
+
paymentType: latest?.paymentType ?? "",
|
|
1670
|
+
donationDate: latest?.createdOn ? epochToReadableDate(latest.createdOn, "short") : ""
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
);
|
|
1674
|
+
rows.sort((a, b) => FlatModel.compareFlatNumbers(a.flatNo, b.flatNo));
|
|
1675
|
+
const totals = rows.reduce(
|
|
1676
|
+
(acc, r) => ({
|
|
1677
|
+
flats: acc.flats + 1,
|
|
1678
|
+
paid: acc.paid + (r.status === "Paid" ? 1 : 0),
|
|
1679
|
+
pending: acc.pending + (r.status === "Pending" ? 1 : 0),
|
|
1680
|
+
amount: acc.amount + r.amount,
|
|
1681
|
+
cash: acc.cash,
|
|
1682
|
+
upi: acc.upi,
|
|
1683
|
+
bankTransfer: acc.bankTransfer
|
|
1684
|
+
}),
|
|
1685
|
+
{ flats: 0, paid: 0, pending: 0, amount: 0, cash: 0, upi: 0, bankTransfer: 0 }
|
|
1686
|
+
);
|
|
1687
|
+
for (const [flatNo, flatDonations] of donationsByFlat) {
|
|
1688
|
+
if (!getFlatNumbersInScope(selection).includes(flatNo)) continue;
|
|
1689
|
+
for (const d of flatDonations) {
|
|
1690
|
+
if (d.paymentType === "Cash" /* CASH */) {
|
|
1691
|
+
totals.cash += d.amount;
|
|
1692
|
+
} else if (d.paymentType === "UPI" /* UPI */) {
|
|
1693
|
+
totals.upi += d.amount;
|
|
1694
|
+
} else {
|
|
1695
|
+
totals.bankTransfer += d.amount;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
return { year, selection, label, rows, totals };
|
|
1700
|
+
}
|
|
1701
|
+
function buildWingWiseCollectionWorkbook(report) {
|
|
1702
|
+
const aoa = [
|
|
1703
|
+
[
|
|
1704
|
+
`Mody Park Ganeshotsav Mandal - Wing-wise Collection Report (${report.label}) - ${report.year}`
|
|
1705
|
+
],
|
|
1706
|
+
[
|
|
1707
|
+
`Assessment Cycle ${report.year} - Flats ${report.totals.flats}, Paid ${report.totals.paid}, Pending ${report.totals.pending}`
|
|
1708
|
+
],
|
|
1709
|
+
[
|
|
1710
|
+
"S.No.",
|
|
1711
|
+
"Flat No",
|
|
1712
|
+
"Status",
|
|
1713
|
+
"Amount (INR)",
|
|
1714
|
+
"Receipt No",
|
|
1715
|
+
"Payment Type",
|
|
1716
|
+
"Donation Date"
|
|
1717
|
+
]
|
|
1718
|
+
];
|
|
1719
|
+
report.rows.forEach((row, index) => {
|
|
1720
|
+
aoa.push([
|
|
1721
|
+
index + 1,
|
|
1722
|
+
row.flatNo,
|
|
1723
|
+
row.status,
|
|
1724
|
+
row.amount,
|
|
1725
|
+
row.receiptNumber,
|
|
1726
|
+
row.paymentType,
|
|
1727
|
+
row.donationDate
|
|
1728
|
+
]);
|
|
1729
|
+
});
|
|
1730
|
+
aoa.push([
|
|
1731
|
+
"",
|
|
1732
|
+
"GRAND TOTAL",
|
|
1733
|
+
`${report.totals.paid} Paid / ${report.totals.pending} Pending`,
|
|
1734
|
+
report.totals.amount,
|
|
1735
|
+
"",
|
|
1736
|
+
"",
|
|
1737
|
+
""
|
|
1738
|
+
]);
|
|
1739
|
+
return buildXlsxWorkbook([
|
|
1740
|
+
{
|
|
1741
|
+
name: "Wing-Wise Collection",
|
|
1742
|
+
aoa,
|
|
1743
|
+
options: {
|
|
1744
|
+
cols: [
|
|
1745
|
+
{ wch: 8 },
|
|
1746
|
+
{ wch: 10 },
|
|
1747
|
+
{ wch: 12 },
|
|
1748
|
+
{ wch: 14 },
|
|
1749
|
+
{ wch: 18 },
|
|
1750
|
+
{ wch: 14 },
|
|
1751
|
+
{ wch: 14 }
|
|
1752
|
+
],
|
|
1753
|
+
merges: [
|
|
1754
|
+
{ s: { r: 0, c: 0 }, e: { r: 0, c: 6 } },
|
|
1755
|
+
{ s: { r: 1, c: 0 }, e: { r: 1, c: 6 } }
|
|
1756
|
+
]
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
]);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1518
1762
|
// src/helpers/entity-filter-data.helper.ts
|
|
1519
1763
|
var EntityFilterDataHelper = class {
|
|
1520
1764
|
constructor(searchResponse) {
|
|
@@ -1613,6 +1857,7 @@ var USER_RELATION_CONFIG = {
|
|
|
1613
1857
|
};
|
|
1614
1858
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1615
1859
|
0 && (module.exports = {
|
|
1860
|
+
ALL_WINGS_SELECTION,
|
|
1616
1861
|
BadRequestException,
|
|
1617
1862
|
BaseEntityModel,
|
|
1618
1863
|
ConfigurationKey,
|
|
@@ -1656,12 +1901,20 @@ var USER_RELATION_CONFIG = {
|
|
|
1656
1901
|
VendorModel,
|
|
1657
1902
|
VendorType,
|
|
1658
1903
|
WINGS,
|
|
1904
|
+
buildUserExpenseReport,
|
|
1905
|
+
buildUserExpenseWorkbook,
|
|
1906
|
+
buildWingWiseCollectionReport,
|
|
1907
|
+
buildWingWiseCollectionWorkbook,
|
|
1908
|
+
buildXlsxWorkbook,
|
|
1659
1909
|
convertNumberToWords,
|
|
1660
1910
|
definedValues,
|
|
1661
1911
|
diffArrays,
|
|
1662
1912
|
entityListEntityModelMap,
|
|
1663
1913
|
epochToReadableDate,
|
|
1664
1914
|
getObjectDiffingKeys,
|
|
1665
|
-
|
|
1915
|
+
getWingSelectionLabel,
|
|
1916
|
+
getWingSelectionSlug,
|
|
1917
|
+
groupBy,
|
|
1918
|
+
serializeXlsx
|
|
1666
1919
|
});
|
|
1667
1920
|
//# sourceMappingURL=index.js.map
|