From 97196445e6f89ed667a5ca8a6db385b625149806 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 13 Dec 2023 22:00:36 +0800 Subject: [PATCH] fix rounded ujrah --- app/Support/v2/Calculation.php | 2 +- tinker/getOnePercent.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Support/v2/Calculation.php b/app/Support/v2/Calculation.php index 4b3d3cc..69c310f 100644 --- a/app/Support/v2/Calculation.php +++ b/app/Support/v2/Calculation.php @@ -89,7 +89,7 @@ class Calculation } public function getRoundedMethod(float $number = 0.0) : Float{ - $number_string = number_format($number,2); + $number_string = number_format(floor(($number*100))/100,2); $rounded = substr($number_string, 0, -1); $lastDigit = substr($number_string, -1); diff --git a/tinker/getOnePercent.php b/tinker/getOnePercent.php index 965da66..a43344b 100644 --- a/tinker/getOnePercent.php +++ b/tinker/getOnePercent.php @@ -3,7 +3,7 @@ use App\Services\MasterServices; use App\Support\v2\Calculation; - $number = 1456.50; + $number = 1456.529; $test2 = new Calculation(); $test = new MasterServices('KB2'); // $response = $test->kiraUpahTawarruq('KB2231207-0004');