From e0ef5e7b648637aea813660aa507dd20ae981c9a Mon Sep 17 00:00:00 2001 From: tanshu Date: Sat, 26 Jun 2021 08:45:24 +0530 Subject: [PATCH] Fix: Rounding error prevented some bills from getting settled. This is related to the half even rounding in python. --- bookie/src/app/sales/bill.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bookie/src/app/sales/bill.service.ts b/bookie/src/app/sales/bill.service.ts index fa5a51b..30e156f 100644 --- a/bookie/src/app/sales/bill.service.ts +++ b/bookie/src/app/sales/bill.service.ts @@ -326,7 +326,11 @@ export class BillService { (t, k) => k.inventories.reduce( (a, c) => - a + (c.isHappyHour ? 0 : c.price) * c.quantity * (1 - c.discount) * (1 + c.taxRate), + a + + this.math.halfRoundEven( + (c.isHappyHour ? 0 : c.price) * c.quantity * (1 - c.discount) * (1 + c.taxRate), + 2, + ), 0, ) + t, 0,