Feature: Added Happy Hour Discount in the bill display and changed Net amount to Gross Amount.

Changed the color of running / printed tables to a brighter colors.
This commit is contained in:
Amritanshu Agrawal 2021-07-05 08:29:15 +05:30
parent c2483ae321
commit 5cd0acc7a9
5 changed files with 37 additions and 16 deletions

View File

@ -3,11 +3,11 @@
}
.running {
background-color: #f8cbad;
background-color: #f53d24;
color: #000000;
}
.printed {
background-color: #c6e0b4;
background-color: #00f518;
color: #000000;
}

View File

@ -26,8 +26,9 @@ import { ModifiersComponent } from './modifiers/modifiers.component';
export class BillService {
public dataObs: BehaviorSubject<BillViewItem[]>;
public bill: Bill = new Bill();
public netAmount: BehaviorSubject<number>;
public grossAmount: BehaviorSubject<number>;
public discountAmount: BehaviorSubject<number>;
public hhAmount: BehaviorSubject<number>;
public taxAmount: BehaviorSubject<number>;
public amount: Observable<number>;
public amountVal: number;
@ -44,8 +45,9 @@ export class BillService {
private modifierCategoryService: ModifierCategoryService,
) {
this.dataObs = new BehaviorSubject<BillViewItem[]>([]);
this.netAmount = new BehaviorSubject(0);
this.grossAmount = new BehaviorSubject(0);
this.discountAmount = new BehaviorSubject(0);
this.hhAmount = new BehaviorSubject(0);
this.taxAmount = new BehaviorSubject(0);
this.amountBs = new BehaviorSubject(0);
this.amountVal = 0;
@ -292,11 +294,19 @@ export class BillService {
}
updateAmounts() {
this.netAmount.next(
this.grossAmount.next(
this.math.halfRoundEven(
this.bill.kots.reduce(
(t, k) => k.inventories.reduce((a, c) => a + c.price * c.quantity, 0) + t,
0,
),
),
);
this.hhAmount.next(
this.math.halfRoundEven(
this.bill.kots.reduce(
(t, k) =>
k.inventories.reduce((a, c) => a + (c.isHappyHour ? 0 : c.price) * c.quantity, 0) + t,
k.inventories.reduce((a, c) => a + (c.isHappyHour ? c.price : 0) * c.quantity, 0) + t,
0,
),
),

View File

@ -45,7 +45,7 @@
<mat-header-cell *matHeaderCellDef class="deep-purple-50 bold right-align"
><button>Table: {{ bs.bill.table.name }}</button> /
<button (click)="choosePax()">{{ bs.bill.pax }} Pax</button> /
{{ bs.bill.customer?.name }}</mat-header-cell
<button>{{ bs.bill.customer?.name || 'Customer' }}</button></mat-header-cell
>
</ng-container>
@ -134,12 +134,22 @@
</button>
</mat-cell>
</ng-container>
<ng-container matColumnDef="net-title">
<mat-footer-cell *matFooterCellDef class="grey300 bold">Net</mat-footer-cell>
<ng-container matColumnDef="gross-title">
<mat-footer-cell *matFooterCellDef class="grey300 bold">Gross</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="net-amount">
<ng-container matColumnDef="gross-amount">
<mat-footer-cell *matFooterCellDef class="grey300 bold right-align">{{
bs.netAmount | async | currency: 'INR'
bs.grossAmount | async | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="hh-title">
<mat-footer-cell *matFooterCellDef class="grey300 bold"
>Happy Hour Discount</mat-footer-cell
>
</ng-container>
<ng-container matColumnDef="hh-amount">
<mat-footer-cell *matFooterCellDef class="grey300 bold right-align">{{
bs.hhAmount | async | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="discount-title">
@ -178,7 +188,8 @@
[class.yellow300]="row.isHappyHour && !row.isPrinted"
[class.yellow-for-hh-printed]="row.isPrinted && row.isHappyHour"
></mat-row>
<mat-footer-row *matFooterRowDef="['net-title', 'net-amount']"></mat-footer-row>
<mat-footer-row *matFooterRowDef="['gross-title', 'gross-amount']"></mat-footer-row>
<mat-footer-row *matFooterRowDef="['hh-title', 'hh-amount']"></mat-footer-row>
<mat-footer-row *matFooterRowDef="['discount-title', 'discount-amount']"></mat-footer-row>
<mat-footer-row *matFooterRowDef="['tax-title', 'tax-amount']"></mat-footer-row>
<mat-footer-row *matFooterRowDef="['amount-title', 'amount-amount']"></mat-footer-row>

View File

@ -1,10 +1,10 @@
.running {
background-color: #f8cbad;
background-color: #f53d24;
color: #000000;
}
.printed {
background-color: #c6e0b4;
background-color: #00f518;
color: #000000;
}

View File

@ -1,10 +1,10 @@
.running {
background-color: #f8cbad;
background-color: #f53d24;
color: #000000;
}
.printed {
background-color: #c6e0b4;
background-color: #00f518;
color: #000000;
}