Fix: Unable to receive payment as the amountVal as always zero.

This commit is contained in:
2026-02-11 08:37:12 +00:00
parent b27a5a9211
commit e3d40d50f0
2 changed files with 24 additions and 23 deletions

View File

@ -37,8 +37,7 @@ export class BillService {
public discountAmount: Observable<number>; public discountAmount: Observable<number>;
public hhAmount: Observable<number>; public hhAmount: Observable<number>;
public taxAmount: Observable<number>; public taxAmount: Observable<number>;
public amount: Observable<number>; public amount: BehaviorSubject<number>;
public amountVal: number;
public selection = new SelectionModel<string>(true, []); public selection = new SelectionModel<string>(true, []);
private updateTable: boolean; private updateTable: boolean;
private allowDeactivate: boolean; private allowDeactivate: boolean;
@ -47,7 +46,6 @@ export class BillService {
constructor() { constructor() {
this.dataObs = new BehaviorSubject<Kot[]>([]); this.dataObs = new BehaviorSubject<Kot[]>([]);
this.amountVal = 0;
this.updateTable = true; this.updateTable = true;
this.allowDeactivate = false; this.allowDeactivate = false;
@ -97,7 +95,9 @@ export class BillService {
}), }),
); );
this.amount = this.dataObs.pipe( this.amount = new BehaviorSubject<number>(0);
this.dataObs
.pipe(
map((kots: Kot[]) => { map((kots: Kot[]) => {
return this.math.halfRoundEven( return this.math.halfRoundEven(
kots.reduce( kots.reduce(
@ -115,7 +115,8 @@ export class BillService {
), ),
); );
}), }),
); )
.subscribe((value) => this.amount.next(value));
} }
displayBill(): void { displayBill(): void {

View File

@ -195,7 +195,7 @@ export class SalesHomeComponent {
if (!this.receivePaymentAllowed()) { if (!this.receivePaymentAllowed()) {
return; return;
} }
const amount = this.bs.amountVal; const amount = this.bs.amount.value;
const type = this.bs.bill.voucherType; const type = this.bs.bill.voucherType;
this.dialog this.dialog
.open(ReceivePaymentComponent, { .open(ReceivePaymentComponent, {