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

@ -5,6 +5,7 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { ErrorLoggerService } from '../../core/error-logger.service';
import { Bill, PrintType } from './bill';
import { Table } from "../../core/table";
import {ObjectUnsubscribedError} from "rxjs";
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
@ -77,9 +78,9 @@ export class VoucherService {
}
}
receivePayment(id: string, amounts: { id: string; name: string; amount: number }[], updateTable: boolean): Observable<Bill> {
receivePayment(id: string, amounts: { id: string; name: string; amount: number }[], updateTable: boolean): Observable<boolean> {
const options = {params: new HttpParams().set('r', "").set('u', updateTable.toString())};
return <Observable<Bill>>this.http.post<Bill>(`${url}/${id}`, amounts, options)
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, amounts, options)
.pipe(
catchError(this.log.handleError(serviceName, 'receivePayment'))
);
@ -92,4 +93,12 @@ export class VoucherService {
catchError(this.log.handleError(serviceName, 'moveTable'))
);
}
voidBill(id: string, reason: string, updateTable: boolean): Observable<boolean> {
const options = {params: new HttpParams().set('v', reason).set('u', updateTable.toString())};
return <Observable<boolean>>this.http.post<boolean>(`${url}/${id}`, {}, options)
.pipe(
catchError(this.log.handleError(serviceName, 'voidBill'))
);
}
}