feat: format amount rows of financial statemnets.

This commit is contained in:
a.bouhuolia
2021-01-12 11:45:36 +02:00
parent 463c748717
commit 7680150a31
27 changed files with 392 additions and 208 deletions

View File

@@ -2,15 +2,15 @@ import {
IAgingPeriod,
IAgingPeriodTotal
} from './AgingReport';
import {
INumberFormatQuery
} from './FinancialStatements';
export interface IAPAgingSummaryQuery {
asDate: Date | string;
agingDaysBefore: number;
agingPeriods: number;
numberFormat: {
noCents: boolean;
divideOn1000: boolean;
};
numberFormat: INumberFormatQuery;
vendorsIds: number[];
noneZero: boolean;
}

View File

@@ -2,15 +2,15 @@ import {
IAgingPeriod,
IAgingPeriodTotal
} from './AgingReport';
import {
INumberFormatQuery
} from './FinancialStatements';
export interface IARAgingSummaryQuery {
asDate: Date | string;
agingDaysBefore: number;
agingPeriods: number;
numberFormat: {
noCents: boolean;
divideOn1000: boolean;
};
numberFormat: INumberFormatQuery;
customersIds: number[];
noneZero: boolean;
}

View File

@@ -1,74 +1,79 @@
import {
INumberFormatQuery,
IFormatNumberSettings,
} from './FinancialStatements';
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 IBalanceSheetQuery {
displayColumnsType: 'total' | 'date_periods';
displayColumnsBy: string;
fromDate: Date | string;
toDate: Date | string;
numberFormat: INumberFormatQuery;
noneZero: boolean;
noneTransactions: boolean;
basis: 'cash' | 'accural';
accountIds: number[];
}
export interface IBalanceSheetFormatNumberSettings
extends IFormatNumberSettings {
type: string;
}
export interface IBalanceSheetStatementService {
balanceSheet(tenantId: number, query: IBalanceSheetQuery): Promise<IBalanceSheetStatement>;
balanceSheet(
tenantId: number,
query: IBalanceSheetQuery
): Promise<IBalanceSheetStatement>;
}
export interface IBalanceSheetStatementColumns {
export interface IBalanceSheetStatementColumns {}
}
export interface IBalanceSheetStatementData {
}
export interface IBalanceSheetStatementData {}
export interface IBalanceSheetStatement {
query: IBalanceSheetQuery,
columns: IBalanceSheetStatementColumns,
data: IBalanceSheetStatementData,
query: IBalanceSheetQuery;
columns: IBalanceSheetStatementColumns;
data: IBalanceSheetStatementData;
}
export interface IBalanceSheetStructureSection {
name: string,
sectionType?: string,
type: 'section' | 'accounts_section',
children?: IBalanceSheetStructureSection[],
accountsTypesRelated?: string[],
alwaysShow?: boolean,
name: string;
sectionType?: string;
type: 'section' | 'accounts_section';
children?: IBalanceSheetStructureSection[];
accountsTypesRelated?: string[];
alwaysShow?: boolean;
}
export interface IBalanceSheetAccountTotal {
amount: number,
formattedAmount: string,
currencyCode: string,
date?: string|Date,
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[],
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,
name: string;
sectionType?: string;
type: 'section' | 'accounts_section';
children: IBalanceSheetAccount[] | IBalanceSheetSection[];
total: IBalanceSheetAccountTotal;
totalPeriods?: IBalanceSheetAccountTotal[];
accountsTypesRelated?: string[],
_forceShow?: boolean,
}
accountsTypesRelated?: string[];
_forceShow?: boolean;
}

View File

@@ -1,2 +1,19 @@
export interface INumberFormatQuery {
precision: number;
divideOn1000: boolean;
showZero: boolean;
formatMoney: 'total' | 'always' | 'none';
negativeFormat: 'parentheses' | 'mines';
}
export interface IFormatNumberSettings {
precision?: number;
divideOn1000?: boolean;
excerptZero?: boolean;
negativeFormat?: 'parentheses' | 'mines';
thousand?: string;
decimal?: string;
zeroSign?: string;
symbol?: string;
money?: boolean,
}

View File

@@ -11,6 +11,8 @@ export interface IJournalEntry {
referenceType: string,
referenceId: number,
referenceTypeFormatted: string,
transactionType?: string,
note?: string,
userId?: number,

View File

@@ -1,13 +1,12 @@
import {
INumberFormatQuery,
} from './FinancialStatements';
export interface IProfitLossSheetQuery {
basis: string,
fromDate: Date | string,
toDate: Date | string,
numberFormat: {
noCents: boolean,
divideOn1000: boolean,
},
numberFormat: INumberFormatQuery,
noneZero: boolean,
noneTransactions: boolean,
accountsIds: number[],
@@ -34,8 +33,8 @@ export interface IProfitLossSheetAccount {
};
export interface IProfitLossSheetAccountsSection {
sectionTitle: string,
entryNormal: 'credit',
name: string,
entryNormal: 'credit' | 'debit',
accounts: IProfitLossSheetAccount[],
total: IProfitLossSheetTotal,
totalPeriods?: IProfitLossSheetTotal[],

View File

@@ -1,38 +1,41 @@
import { INumberFormatQuery } from './FinancialStatements';
export interface ITrialBalanceSheetQuery {
fromDate: Date|string,
toDate: Date|string,
numberFormat: {
noCents: boolean,
divideOn1000: boolean,
},
basis: 'cash' | 'accural',
noneZero: boolean,
noneTransactions: boolean,
accountIds: number[],
fromDate: Date | string;
toDate: Date | string;
numberFormat: INumberFormatQuery;
basis: 'cash' | 'accural';
noneZero: boolean;
noneTransactions: boolean;
accountIds: number[];
}
export interface ITrialBalanceAccount {
id: number,
parentAccountId: number,
name: string,
code: string,
accountNormal: string,
hasTransactions: boolean,
export interface ITrialBalanceTotal {
credit: number;
debit: number;
balance: number;
currencyCode: string;
credit: number,
debit: number,
balance: number,
currencyCode: string,
formattedCredit: string,
formattedDebit: string,
formattedBalance: string,
formattedCredit: string;
formattedDebit: string;
formattedBalance: string;
}
export type ITrialBalanceSheetData = IBalanceSheetSection[];
export interface ITrialBalanceAccount extends ITrialBalanceTotal {
id: number;
parentAccountId: number;
name: string;
code: string;
accountNormal: string;
hasTransactions: boolean;
}
export type ITrialBalanceSheetData = {
accounts: ITrialBalanceAccount[];
total: ITrialBalanceTotal;
};
export interface ITrialBalanceStatement {
data: ITrialBalanceSheetData,
query: ITrialBalanceSheetQuery,
}
data: ITrialBalanceSheetData;
query: ITrialBalanceSheetQuery;
}