2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 09:24:04 +00:00
books/reports/types.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
2.6 KiB
TypeScript
Raw Normal View History

2022-05-16 10:10:35 +00:00
import { DateTime } from 'luxon';
import { AccountRootType } from 'models/baseModels/Account/types';
import { BaseField, FieldType, RawValue } from 'schemas/types';
2022-05-18 08:48:30 +00:00
export type ExportExtention = 'csv' | 'json';
2022-05-12 10:04:37 +00:00
export interface ReportCell {
bold?: boolean;
italics?: boolean;
align?: 'left' | 'right' | 'center';
width?: number;
2022-05-12 10:04:37 +00:00
value: string;
rawValue: RawValue | undefined | Date;
indent?: number;
color?: 'red' | 'green';
}
export interface ReportRow {
cells: ReportCell[];
level?: number;
isGroup?: boolean;
2022-05-16 10:10:35 +00:00
isEmpty?: boolean;
folded?: boolean;
foldedBelow?: boolean;
}
2022-05-12 10:04:37 +00:00
export type ReportData = ReportRow[];
export interface ColumnField extends Omit<BaseField, 'fieldtype'> {
fieldtype: FieldType;
align?: 'left' | 'right' | 'center';
2022-05-12 10:04:37 +00:00
width?: number;
}
export type BalanceType = 'Credit' | 'Debit';
export type Periodicity = 'Monthly' | 'Quarterly' | 'Half Yearly' | 'Yearly';
export interface FinancialStatementOptions {
rootType: AccountRootType;
fromDate: string;
toDate: string;
balanceMustBe?: BalanceType;
periodicity?: Periodicity;
accumulateValues?: boolean;
}
export interface RawLedgerEntry {
name: string;
account: string;
date: string;
debit: string;
credit: string;
referenceType: string;
referenceName: string;
party: string;
reverted: number;
reverts: string;
[key: string]: RawValue;
}
export interface LedgerEntry {
index?: string;
name: number;
account: string;
date: Date | null;
debit: number | null;
credit: number | null;
balance: number | null;
referenceType: string;
referenceName: string;
party: string;
reverted: boolean;
reverts: string;
}
export type GroupedMap = Map<string, LedgerEntry[]>;
2022-05-16 10:10:35 +00:00
export type DateRange = { fromDate: DateTime; toDate: DateTime };
2022-05-16 13:01:58 +00:00
export type ValueMap = Map<DateRange, Record<string, number>>;
2022-05-16 10:10:35 +00:00
export interface Account {
name: string;
rootType: AccountRootType;
isGroup: boolean;
parentAccount: string | null;
}
export type AccountTree = Record<string, AccountTreeNode>;
export interface AccountTreeNode extends Account {
children?: AccountTreeNode[];
valueMap?: ValueMap;
prune?: boolean;
}
export type AccountList = AccountListNode[];
export interface AccountListNode extends Account {
valueMap?: ValueMap;
level?: number;
}
export type AccountNameValueMapMap = Map<string, ValueMap>;
export type BasedOn = 'Fiscal Year' | 'Until Date';
export interface TreeNode {
name: string;
children?: TreeNode[];
}
export type Tree = Record<string, TreeNode>;
2022-05-16 13:01:58 +00:00
export type RootTypeRow = {
rootType: AccountRootType;
rootNode: AccountTreeNode;
rows: ReportData;
};