refactoring: balance sheet report.

refactoring: trial balance sheet report.
refactoring: general ledger report.
refactoring: journal report.
refactoring: P&L report.
This commit is contained in:
Ahmed Bouhuolia
2020-12-10 13:04:49 +02:00
parent e8f329e29e
commit d49992a6d7
71 changed files with 3203 additions and 1571 deletions

View File

@@ -0,0 +1,45 @@
export interface IARAgingSummaryQuery {
asDate: Date | string,
agingDaysBefore: number,
agingPeriods: number,
numberFormat: {
noCents: number,
divideOn1000: number,
},
customersIds: number[],
noneZero: boolean,
}
export interface IAgingPeriod {
fromPeriod: Date,
toPeriod: Date,
beforeDays: number,
toDays: number,
};
export interface IAgingPeriodClosingBalance extends IAgingPeriod {
closingBalance: number,
};
export interface IAgingPeriodTotal extends IAgingPeriod {
total: number,
};
export interface ARAgingSummaryCustomerPeriod {
}
export interface ARAgingSummaryCustomerTotal {
amount: number,
formattedAmount: string,
currencyCode: string,
}
export interface ARAgingSummaryCustomer {
customerName: string,
aging: IAgingPeriodTotal[],
total: ARAgingSummaryCustomerTotal,
};

View File

@@ -10,9 +10,11 @@ export interface IAccountDTO {
};
export interface IAccount {
id: number,
name: string,
slug: string,
code: string,
index: number,
description: string,
accountTypeId: number,
parentAccountId: number,
@@ -20,6 +22,8 @@ export interface IAccount {
predefined: boolean,
amount: number,
currencyCode: string,
transactions?: any[],
type?: any[],
};
export interface IAccountsFilter extends IDynamicListFilterDTO {

View File

@@ -0,0 +1,74 @@
export interface IBalanceSheetQuery{
displayColumnsType: 'total' | 'date_periods',
displayColumnsBy: string,
fromDate: Date|string,
toDate: Date|string,
numberFormat: {
noCents: boolean,
divideOn1000: boolean,
},
noneZero: boolean,
noneTransactions: boolean,
basis: 'cash' | 'accural',
accountIds: number[],
}
export interface IBalanceSheetStatementService {
balanceSheet(tenantId: number, query: IBalanceSheetQuery): Promise<IBalanceSheetStatement>;
}
export interface IBalanceSheetStatementColumns {
}
export interface IBalanceSheetStatementData {
}
export interface IBalanceSheetStatement {
query: IBalanceSheetQuery,
columns: IBalanceSheetStatementColumns,
data: IBalanceSheetStatementData,
}
export interface IBalanceSheetStructureSection {
name: string,
sectionType?: string,
type: 'section' | 'accounts_section',
children?: IBalanceSheetStructureSection[],
_accountsTypesRelated?: string[],
_forceShow?: boolean,
}
export interface IBalanceSheetAccountTotal {
amount: number,
formattedAmount: string,
currencyCode: string,
date?: string|Date,
}
export interface IBalanceSheetAccount {
id: number,
index: number,
name: string,
code: string,
parentAccountId: number,
type: 'account',
hasTransactions: boolean,
children?: IBalanceSheetAccount[],
total: IBalanceSheetAccountTotal,
totalPeriods?: IBalanceSheetAccountTotal[],
}
export interface IBalanceSheetSection {
name: string,
sectionType?: string,
type: 'section' | 'accounts_section',
children: IBalanceSheetAccount[] | IBalanceSheetSection[],
total: IBalanceSheetAccountTotal,
totalPeriods?: IBalanceSheetAccountTotal[];
_accountsTypesRelated?: string[],
_forceShow?: boolean,
}

View File

@@ -43,6 +43,7 @@ export interface IContactAddressDTO {
shippingAddressState?: string,
};
export interface IContact extends IContactAddress{
id?: number,
contactService: 'customer' | 'vendor',
contactType: string,

View File

@@ -0,0 +1,2 @@

View File

@@ -0,0 +1,61 @@
export interface IGeneralLedgerSheetQuery {
fromDate: Date | string,
toDate: Date | string,
basis: string,
numberFormat: {
noCents: boolean,
divideOn1000: boolean,
},
noneTransactions: boolean,
accountsIds: number[],
};
export interface IGeneralLedgerSheetAccountTransaction {
id: number,
amount: number,
formattedAmount: string,
currencyCode: string,
note?: string,
transactionType?: string,
referenceId?: number,
referenceType?: string,
date: Date|string,
};
export interface IGeneralLedgerSheetAccountBalance {
date: Date|string,
amount: number,
formattedAmount: string,
currencyCode: string,
}
export interface IGeneralLedgerSheetAccount {
id: number,
name: string,
code: string,
index: number,
parentAccountId: number,
transactions: IGeneralLedgerSheetAccountTransaction[],
opening: IGeneralLedgerSheetAccountBalance,
closing: IGeneralLedgerSheetAccountBalance,
}
export interface IAccountTransaction {
id: number,
index: number,
draft: boolean,
note: string,
accountId: number,
transactionType: string,
referenceType: string,
referenceId: number,
contactId: number,
contactType: string,
credit: number,
debit: number,
date: string|Date,
createdAt: string|Date,
updatedAt: string|Date,
}

View File

@@ -1,6 +1,7 @@
export interface IJournalEntry {
id: number,
index?: number,
date: Date,
@@ -18,6 +19,8 @@ export interface IJournalEntry {
};
export interface IJournalPoster {
entries: IJournalEntry[],
credit(entry: IJournalEntry): void;
debit(entry: IJournalEntry): void;
@@ -26,6 +29,9 @@ export interface IJournalPoster {
saveEntries(): void;
saveBalance(): void;
deleteEntries(): void;
getAccountBalance(accountId: number, closingDate?: Date | string, dateType?: string): number;
getAccountEntries(accountId: number): IJournalEntry[];
}
export type TEntryType = 'credit' | 'debit';

View File

@@ -0,0 +1,28 @@
import { IJournalEntry } from './Journal';
export interface IJournalReportQuery {
fromDate: Date | string,
toDate: Date | string,
numberFormat: {
noCents: boolean,
divideOn1000: boolean,
},
transactionTypes: string | string[],
accountsIds: number | number[],
fromRange: number,
toRange: number,
}
export interface IJournalReportEntriesGroup {
id: string,
entries: IJournalEntry[],
currencyCode: string,
credit: number,
debit: number,
formattedCredit: string,
formattedDebit: string,
}
export interface IJournalReport {
entries: IJournalReportEntriesGroup[],
}

View File

@@ -0,0 +1,58 @@
export interface IProfitLossSheetQuery {
basis: string,
fromDate: Date | string,
toDate: Date | string,
numberFormat: {
noCents: boolean,
divideOn1000: boolean,
},
noneZero: boolean,
noneTransactions: boolean,
accountsIds: number[],
displayColumnsType: 'total' | 'date_periods',
displayColumnsBy: string,
};
export interface IProfitLossSheetTotal {
amount: number,
formattedAmount: string,
currencyCode: string,
date?: Date|string,
};
export interface IProfitLossSheetAccount {
id: number,
index: number,
name: string,
code: string,
parentAccountId: number,
hasTransactions: boolean,
total: IProfitLossSheetTotal,
totalPeriods: IProfitLossSheetTotal[],
};
export interface IProfitLossSheetAccountsSection {
sectionTitle: string,
entryNormal: 'credit',
accounts: IProfitLossSheetAccount[],
total: IProfitLossSheetTotal,
totalPeriods?: IProfitLossSheetTotal[],
};
export interface IProfitLossSheetTotalSection {
total: IProfitLossSheetTotal,
totalPeriods?: IProfitLossSheetTotal[],
};
export interface IProfitLossSheetStatement {
income: IProfitLossSheetAccountsSection,
costOfSales: IProfitLossSheetAccountsSection,
expenses: IProfitLossSheetAccountsSection,
otherExpenses: IProfitLossSheetAccountsSection,
netIncome: IProfitLossSheetTotalSection;
operatingProfit: IProfitLossSheetTotalSection;
grossProfit: IProfitLossSheetTotalSection;
};

View File

@@ -0,0 +1,37 @@
export interface ITrialBalanceSheetQuery {
fromDate: Date|string,
toDate: Date|string,
numberFormat: {
noCents: boolean,
divideOn1000: boolean,
},
basis: 'cash' | 'accural',
noneZero: boolean,
noneTransactions: boolean,
accountIds: number[],
}
export interface ITrialBalanceAccount {
id: number,
parentAccountId: number,
name: string,
code: string,
accountNormal: string,
hasTransactions: boolean,
credit: number,
debit: number,
balance: number,
formattedCredit: string,
formattedDebit: string,
formattedBalance: string,
}
export type ITrialBalanceSheetData = IBalanceSheetSection[];
export interface ITrialBalanceStatement {
data: ITrialBalanceSheetData,
query: ITrialBalanceSheetQuery,
}

View File

@@ -28,4 +28,12 @@ export * from './ManualJournal';
export * from './Currency';
export * from './ExchangeRate';
export * from './Media';
export * from './SaleEstimate';
export * from './SaleEstimate';
export * from './FinancialStatements';
export * from './BalanceSheet';
export * from './TrialBalanceSheet';
export * from './GeneralLedgerSheet'
export * from './ProfitLossSheet';
export * from './JournalReport';
export * from './ARAgingSummaryReport';