Prevent divide by zero with discounts
This commit is contained in:
parent
ac850dff35
commit
4204cbb06f
1 changed files with 3 additions and 1 deletions
|
|
@ -510,7 +510,9 @@ class InvoiceRepository extends BaseRepository
|
|||
|
||||
if ($invoice->discount > 0) {
|
||||
if ($invoice->is_amount_discount) {
|
||||
$lineTotal -= round(($lineTotal / $total) * $invoice->discount, 2);
|
||||
if ($total != 0) {
|
||||
$lineTotal -= round(($lineTotal / $total) * $invoice->discount, 2);
|
||||
}
|
||||
} else {
|
||||
$lineTotal -= round($lineTotal * ($invoice->discount / 100), 2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue