Bumped the version to 7

Fixed double exception being thrown
Currency pipe broke the accounts pipe
This commit is contained in:
2020-06-01 09:01:31 +05:30
parent 1c2c98e7b5
commit 7b4756fe1a
26 changed files with 55 additions and 166 deletions

View File

@ -1,6 +1,6 @@
{
"name": "overlord",
"version": "0.0.0",
"version": "7.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",

View File

@ -66,8 +66,8 @@
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="getRowClass(row.id, row.posted)"
(click)="selectRow(row.id)"></mat-row>
<mat-row *matRowDef="let row; columns: displayedColumns;" [class.selected]="selectedRowId === row.id"
[class.unposted]="!row.posted && selectedRowId !== row.id" (click)="selectRow(row.id)"></mat-row>
</mat-table>
<mat-paginator #paginator

View File

@ -48,16 +48,6 @@ export class DaybookComponent implements OnInit {
this.selectedRowId = id;
}
getRowClass(id: string, posted: boolean): string {
if (this.selectedRowId === id) {
return 'selected';
} else if (!posted) {
return 'unposted';
} else {
return '';
}
}
show() {
const l = this.prepareSubmit();
this.router.navigate(['daybook'], {

View File

@ -133,7 +133,8 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy {
rowAmount(amount: string = '', debit: number): any {
try {
const val = math.eval(amount.trim().replace(',', ''));
amount = amount.replace(new RegExp('(₹[\s]*)|(,)|(\s)', 'g'), '');
const val = math.eval(amount);
if (val < 0) {
debit *= -1;
}

View File

@ -87,8 +87,8 @@
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="getRowClass(row.id, row.posted)"
(click)="selectRow(row.id)"></mat-row>
<mat-row *matRowDef="let row; columns: displayedColumns;" [class.selected]="selectedRowId === row.id"
[class.unposted]="!row.posted && selectedRowId !== row.id" (click)="selectRow(row.id)"></mat-row>
<mat-footer-row *matFooterRowDef="displayedColumns"></mat-footer-row>
</mat-table>

View File

@ -104,16 +104,6 @@ export class LedgerComponent implements OnInit, AfterViewInit {
this.selectedRowId = id;
}
getRowClass(id: string, posted: boolean): string {
if (this.selectedRowId === id) {
return 'selected';
} else if (!posted) {
return 'unposted';
} else {
return '';
}
}
show() {
const info = this.getInfo();
this.router.navigate(['ledger', info.account.id], {

View File

@ -141,7 +141,8 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
rowAmount(amount: string = ''): number {
try {
return math.eval(amount.trim().replace(',', ''));
amount = amount.replace(new RegExp('(₹[\s]*)|(,)|(\s)', 'g'), '');
return math.eval(amount);
} catch {
return 0;
}

View File

@ -140,7 +140,8 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
rowAmount(amount: string = ''): number {
try {
return math.eval(amount.trim().replace(',', ''));
amount = amount.replace(new RegExp('(₹[\s]*)|(,)|(\s)', 'g'), '');
return math.eval(amount);
} catch {
return 0;
}

View File

@ -13,7 +13,7 @@ export class AccountingPipe implements PipeTransform {
if (value === null) {
return '';
}
const amount = +(value.replace(new RegExp('(₹ )|(,)', 'g'), ''));
const amount = +(value.replace(new RegExp('(₹[\s]*)|(,)', 'g'), ''));
return value.replace('-', '') + ((amount < 0) ? '\u00A0Cr' : '\u00A0Dr');
}