Feature: Sale Analysis is working

Fix: Cashier Checkout multiple entries
This commit is contained in:
Amritanshu
2019-08-20 23:02:17 +05:30
parent c6b907061e
commit 70d31fea5e
35 changed files with 650 additions and 138 deletions

View File

@ -11,7 +11,7 @@ import { Bill, Inventory, Kot, PrintType } from './bills/bill';
import { VoucherService } from './bills/voucher.service';
import { ToasterService } from '../core/toaster.service';
import { Table } from '../core/table';
import { SelectionModel } from "@angular/cdk/collections";
import { SelectionModel } from '@angular/cdk/collections';
@Injectable()
export class BillService {
@ -184,7 +184,7 @@ export class BillService {
printKot(guest_book_id: string): Observable<boolean> {
const item = JSON.parse(JSON.stringify(this.bill));
const newKot = this.getKot();
if (newKot.inventories.length == 0) {
if (newKot.inventories.length === 0) {
this.toaster.show('Error', 'Cannot print a blank KOT\nPlease add some products!');
}
item.kots.push(newKot);
@ -262,7 +262,7 @@ export class BillService {
}
splitBill(table: Table): Observable<boolean> {
const inventoriesToMove: string[] = this.selection.selected.map((x:any)=> x.id)
const inventoriesToMove: string[] = this.selection.selected.map((x: any) => x.id);
return this.ser.splitBill(this.bill.id, inventoriesToMove, table);
}
}

View File

@ -12,8 +12,8 @@ import { map, switchMap } from 'rxjs/operators';
import { TablesDialogComponent } from '../tables-dialog/tables-dialog.component';
import { TableService } from '../../tables/table.service';
import { ToasterService } from '../../core/toaster.service';
import { AuthService } from "../../auth/auth.service";
import { SelectionModel } from "@angular/cdk/collections";
import { AuthService } from '../../auth/auth.service';
import { SelectionModel } from '@angular/cdk/collections';
@Component({
selector: 'app-bills',
@ -56,8 +56,8 @@ export class BillsComponent implements OnInit {
}
isAnySelected(kot: Kot) {
let total: number = 0,
found: number = 0;
let total = 0,
found = 0;
this.bs.data.filter(
x => x.kotId === kot.id
).forEach((c: any) => {
@ -118,7 +118,7 @@ export class BillsComponent implements OnInit {
}
moveKot(kot: Kot) {
const canMergeTables = this.auth.hasPermission("Merge Tables");
const canMergeTables = this.auth.hasPermission('Merge Tables');
this.dialog.open(TablesDialogComponent, {
// width: '750px',
data: {

View File

@ -160,7 +160,7 @@ export class SalesHomeComponent implements OnInit {
}
moveTable() {
const canMergeTables = this.auth.hasPermission("Merge Tables");
const canMergeTables = this.auth.hasPermission('Merge Tables');
this.dialog.open(TablesDialogComponent, {
// width: '750px',
data: {
@ -296,7 +296,7 @@ export class SalesHomeComponent implements OnInit {
return false;
}
if (this.bs.bill.voucherType === PrintType.Kot) {
return false
return false;
}
if (this.bs.bill.isVoid) {
return false;

View File

@ -91,7 +91,7 @@ export class ReceivePaymentComponent {
(z, i) => array.controls[i].valueChanges.pipe(
distinctUntilChanged()
).subscribe(x => {
this.choices[this.type].find(s => s.name == x.name).amount = (x.amount === '' ? 0 : parseInt(x.amount, 10));
this.choices[this.type].find(s => s.name === x.name).amount = (x.amount === '' ? 0 : parseInt(x.amount, 10));
this.balance = this.amount - this.choices[this.type].reduce((a, c) => a + c.amount, 0);
})
);