Skip to content

Commit e316ca8

Browse files
Merge pull request #89 from khalidmaquilang/hotfix/si-99-total-amount-without-vat
SI-99 | Hotfix | fix total amount when there is no vat
2 parents 38680da + c1699d5 commit e316ca8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/Filament/Resources/SaleResource.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,18 @@ public static function updateTotalAmount(Forms\Get $get, Forms\Set $set): void
358358
$discount = (float) str_replace(',', '', $get('discount'));
359359
$discountType = $get('discount_type');
360360

361-
if (empty($subTotal) || empty($vatField)) {
361+
if (empty($subTotal)) {
362362
$subTotal = 0;
363363
}
364364

365365
if (! empty($discount)) {
366366
$subTotal = self::calculateAfterDiscount($subTotal, $discount, $discountType);
367367
}
368368

369-
$vat = $subTotal * ($vatField / 100);
369+
$vat = 0;
370+
if (! empty($vatField)) {
371+
$vat = $subTotal * ($vatField / 100);
372+
}
370373

371374
$set('formatted_total_amount', number_format($subTotal + $vat, 2));
372375
$set('total_amount', $subTotal + $vat);

0 commit comments

Comments
 (0)