Void Bill Working

This commit is contained in:
Amritanshu
2019-08-10 18:49:05 +05:30
parent 2fcff26e34
commit 40a958a935
17 changed files with 212 additions and 46 deletions

View File

@ -12,6 +12,7 @@ import { VoucherService } from './bills/voucher.service';
import { ToasterService } from "../core/toaster.service";
import { tap } from "rxjs/operators";
import { Table } from "../core/table";
import {observableToBeFn} from "rxjs/internal/testing/TestScheduler";
@Injectable()
export class BillService {
@ -192,7 +193,7 @@ export class BillService {
return this.bill.voucherType;
}
receivePayment(amounts: { id: string; name: string; amount: number }[]) {
receivePayment(amounts: { id: string; name: string; amount: number }[]): Observable<boolean> {
return this.ser.receivePayment(this.bill.id, amounts, true).pipe(
tap(x => console.log(x))
);
@ -202,6 +203,10 @@ export class BillService {
return this.ser.moveTable(this.bill.id, table);
}
voidBill(reason: string): Observable<boolean> {
return this.ser.voidBill(this.bill.id, reason, true);
}
netAmount() {
return math.round(this.bill.kots.reduce(
(ka: number, k: Kot) => ka + k.inventories.reduce(