brewman/overlord/src/app/cash-flow/cash-flow.ts

37 lines
992 B
TypeScript

export class CashFlowItem {
name: string;
url: [];
amount: number;
constructor(name: string) {
this.name = name;
}
}
export class CashFlow {
startDate: string;
finishDate: string;
body?: { operating: CashFlowItem[], investing: CashFlowItem[], financing: CashFlowItem[], details: CashFlowItem[] };
footer?: CashFlowItem[];
static Data(value): CashFlowItem[] {
const d: CashFlowItem[] = [];
if (value.body.operating?.length) {
d.push(new CashFlowItem('Cash flows from Operating activities'));
d.push(...value.body.operating);
}
if (value.body.investing?.length) {
d.push(new CashFlowItem('Cash flows from Investing activities'));
d.push(...value.body.investing);
}
if (value.body.financing?.length) {
d.push(new CashFlowItem('Cash flows from Financing activities'));
d.push(...value.body.financing);
}
if (value.body.details?.length) {
d.push(...value.body.details);
}
return d;
}
}