Dont save payments with a zero alloc amount, delete payments with a zero alloc amount, fix javascript calculating payment balance
This commit is contained in:
parent
6aa30f537b
commit
0b4e3a9341
@ -126,8 +126,7 @@ class AdminController extends Controller
|
||||
|
||||
if ($items->count() == 1) {
|
||||
$oo = $items->pop();
|
||||
|
||||
if (! $amount['id']) {
|
||||
if ($amount['id'] == 0) {
|
||||
$oo->delete();
|
||||
continue;
|
||||
}
|
||||
@ -138,7 +137,13 @@ class AdminController extends Controller
|
||||
}
|
||||
|
||||
$oo->amount = ($oo->invoice->due >= 0) && ($oo->invoice->due-$amount['id'] >= 0) ? $amount['id'] : 0;
|
||||
|
||||
// If the amount is empty, ignore it.
|
||||
if (! $oo->amount)
|
||||
continue;
|
||||
|
||||
$oo->site_id = config('site')->site_id;
|
||||
$oo->active = TRUE;
|
||||
$o->items()->save($oo);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,8 @@ A new invoice has been generated on your account. A summary of that invoice is b
|
||||
||| Sub Total | ${{ number_format($invoice->sub_total,2) }} |
|
||||
||| Tax | ${{ number_format($invoice->tax_total,2) }} |
|
||||
||| Total | ${{ number_format($invoice->total,2) }} |
|
||||
||| Payments | ${{ number_format($invoice->paid,2) }} |
|
||||
||| Still Due | ${{ number_format($invoice->due,2) }} |
|
||||
@endcomponent
|
||||
|
||||
If you would like a PDF copy of that invoice, please click on the link below:
|
||||
|
@ -219,7 +219,7 @@
|
||||
var alloc = 0;
|
||||
|
||||
$('.invoice').each(function() {
|
||||
alloc += $(this).val();
|
||||
alloc += parseFloat($(this).val());
|
||||
})
|
||||
|
||||
$('#balance').val(($('#total_amt').val()-alloc).toFixed(2))
|
||||
|
Loading…
Reference in New Issue
Block a user