From 67e624c21aff9d0ca87e20a51cbae9bfcfa863df Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Fri, 15 Aug 2025 22:35:45 +0800 Subject: [PATCH] E-Invoice - Fix a problem reported by Brian, PO not tally with updated booking amount --- .../ControllersLogic/UpdateBookingAmountWithPOLogic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountWithPOLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountWithPOLogic.php index 5a5c5001..0ad1680c 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountWithPOLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountWithPOLogic.php @@ -86,7 +86,9 @@ class UpdateBookingAmountWithPOLogic extends AbstractControllerLogic return $product['quantity'] * floatval(str_replace(',', '', $product['unit_price'])); }); $bookingAmountUpdate = (float)$bookingAttribute->value; - $isTally = $total === $bookingAmountUpdate ? true : false; + // $isTally = ($total === $bookingAmountUpdate) ? true : false; + $isTally = bccomp($total, $bookingAmountUpdate, 3) === 0; + if(!$isTally){ throw new MalformedRequestException('Purchase Order total not tally with updated booking amount of ' . $bookingAmountUpdate); }