Balance sheet
 Ledger
 Cash Flow

along with urls
Balance sheet schema does not enforce multiple_of for amounts as multiple_of borks on random figures
This commit is contained in:
tanshu
2020-05-14 11:26:28 +05:30
parent 708a60baf7
commit a4b9fb7408
15 changed files with 120 additions and 138 deletions

View File

@ -21,21 +21,21 @@
<ng-container matColumnDef="group">
<mat-header-cell *matHeaderCellDef mat-sort-header>Group</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.group}}</mat-cell>
<mat-footer-cell *matFooterCellDef>{{info.footer.group}}</mat-footer-cell>
<mat-footer-cell *matFooterCellDef>{{info.footer?.group}}</mat-footer-cell>
</ng-container>
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.name}}</mat-cell>
<mat-footer-cell *matFooterCellDef>{{info.footer.name}}</mat-footer-cell>
<mat-footer-cell *matFooterCellDef>{{info.footer?.name}}</mat-footer-cell>
</ng-container>
<!-- SubAmount Column -->
<ng-container matColumnDef="subAmount">
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Amount</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{row.subAmount | currency:'INR' | clear}}</mat-cell>
<mat-footer-cell *matFooterCellDef class="right">{{info.footer.subAmount | currency:'INR' | clear}}
<mat-footer-cell *matFooterCellDef class="right">{{info.footer?.subAmount | currency:'INR' | clear}}
</mat-footer-cell>
</ng-container>
@ -43,7 +43,7 @@
<ng-container matColumnDef="total">
<mat-header-cell *matHeaderCellDef mat-sort-header class="right">Total</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{row.amount | currency:'INR' | clear}}</mat-cell>
<mat-footer-cell *matFooterCellDef class="right">{{info.footer.amount | currency:'INR' | clear}}
<mat-footer-cell *matFooterCellDef class="right">{{info.footer?.amount | currency:'INR' | clear}}
</mat-footer-cell>
</ng-container>

View File

@ -43,15 +43,12 @@ export class BalanceSheetComponent implements OnInit {
}
show() {
const info = this.getInfo();
this.router.navigate(['balance-sheet', info.date]);
const date = this.getDate();
this.router.navigate(['balance-sheet', date]);
}
getInfo(): BalanceSheet {
getDate(): string {
const formModel = this.form.value;
return {
date: moment(formModel.date).format('DD-MMM-YYYY')
};
return moment(formModel.date).format('DD-MMM-YYYY');
}
}

View File

@ -1,5 +1,12 @@
export class BalanceSheetItem {
name?: string;
group?: string;
amount?: number;
subAmount?: number;
order: number;
}
export class BalanceSheet {
date: string;
body?: any[];
footer?: any[];
body: BalanceSheetItem[];
footer?: BalanceSheetItem;
}

View File

@ -26,7 +26,7 @@
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell>
<mat-cell *matCellDef="let row"><a [href]="row.url">{{row.name}} </a></mat-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="row.url" [queryParams]="{startDate: info.startDate, finishDate: info.finishDate}">{{row.name}} </a></mat-cell>
</ng-container>
<!-- Amount Column -->

View File

@ -1,6 +1,6 @@
export class CashFlowItem {
name: string;
url: string;
url: [];
amount: number;
constructor(name: string) {

View File

@ -47,7 +47,7 @@
<!-- Particulars Column -->
<ng-container matColumnDef="particulars">
<mat-header-cell *matHeaderCellDef mat-sort-header>Particulars</mat-header-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/', row.url, row.id]">{{row.name}}</a></mat-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="row.url">{{row.name}}</a></mat-cell>
<mat-footer-cell *matFooterCellDef>Closing Balance</mat-footer-cell>
</ng-container>

View File

@ -56,12 +56,7 @@ export class LedgerComponent implements OnInit, AfterViewInit {
}
ngOnInit() {
this.route.data.pipe(map(
(data: { info: Ledger }) => {
data.info.body = data.info.body.map(x => ({...x, url: x['type'].replace(/ /g, '-').toLowerCase()}));
return data;
}
)).subscribe((data: { info: Ledger }) => {
this.route.data.subscribe((data: { info: Ledger }) => {
this.info = data.info;
this.calculateTotals();
this.form.setValue({

View File

@ -3,7 +3,6 @@ export class Unposted {
date: string;
voucherType: string;
narration: string;
isPosted: boolean;
debitName: string;
debitAmount: number;
creditName: string;