diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index fe14b372..72ae5813 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -595,9 +595,24 @@ class BookingController extends Controller $svcharge = 20.00; } - $subtotal = round($amount + $svcharge / $rate,2); - $taxAmount = round($subtotal * $taxrate,2); - $billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate, 2); + $subtotal = round(($amount + $svcharge) / $rate,2); + + // TODO : refactor + if ($taxrate !=0){ + $taxAmount = round($subtotal * $taxrate - $subtotal,2); + } + else{ + $taxAmount = 0; + } + + if ($billingChargeRate !=0){ + $billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate - ($amount + $svcharge), 2); + } + else{ + $billingChargeAmount = 0; + } + + $billingChargeAmount = round((($amount / $rate) * $billingChargeRate) - ($amount / $rate), 2); $bankin_amount = round($subtotal + $taxAmount + $billingChargeAmount , 2); return response()->json([