Skip to content

Commit

Permalink
refs #412
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Jul 11, 2018
1 parent 9a2adf7 commit 8090107
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/Http/Controllers/Expenses/Bills.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,16 @@ public function payment(PaymentRequest $request)
$total_amount -= $bill->payments()->paid();
}

// For amount cover integer
$multiplier = 1;

for ($i = 0; $i < $currency->precision; $i++) {
$multiplier *= 10;
}

$amount *= $multiplier;
$total_amount *= $multiplier;

if ($amount > $total_amount) {
$message = trans('messages.error.over_payment');

Expand Down
10 changes: 10 additions & 0 deletions app/Http/Controllers/Incomes/Invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,16 @@ public function payment(PaymentRequest $request)
$total_amount -= $invoice->payments()->paid();
}

// For amount cover integer
$multiplier = 1;

for ($i = 0; $i < $currency->precision; $i++) {
$multiplier *= 10;
}

$amount *= $multiplier;
$total_amount *= $multiplier;

if ($amount > $total_amount) {
$message = trans('messages.error.over_payment');

Expand Down

0 comments on commit 8090107

Please sign in to comment.