Skip to content

Commit

Permalink
Update TaxCalculatorController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
itsemon245 authored Apr 29, 2024
1 parent e9074b6 commit 9131e45
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/Http/Controllers/Frontend/TaxCalculatorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,8 @@ public function calcTax(int $value, $request, string $type): int
* If it's first calculation then free tax will be deducted
* Else the slot difference will be the amount to calculate tax;
*/
if ($slot->difference < $value) {
$amountForTax = $key == 0 ? ($slot->difference - $taxFree) : $slot->difference;
} else {
$amountForTax = $key == 0 ? ($value - $taxFree) : $value;
}

$amountForTax = $slot->difference < $value ? $slot->difference : $value;
$tax = $amountForTax * ($slot->tax_percentage / 100);
$tax = $minTax > $tax ? $minTax : $tax;
$value -= $amountForTax;
Expand Down

0 comments on commit 9131e45

Please sign in to comment.