mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 22:22:32 +01:00
add helper for Invoice payable amount
This commit is contained in:
parent
4b3e09faf8
commit
f7ff5d34df
@ -498,6 +498,20 @@ class Invoice extends BaseModel
|
||||
return $this->calc()->getTotal();
|
||||
}
|
||||
|
||||
public function getPayableAmount()
|
||||
{
|
||||
if($this->partial > 0)
|
||||
return $this->partial;
|
||||
|
||||
if($this->balance > 0)
|
||||
return $this->balance;
|
||||
|
||||
if($this->status_id = 1)
|
||||
return $this->amount;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function entityEmailEvent($invitation, $reminder_template, $template)
|
||||
{
|
||||
switch ($reminder_template) {
|
||||
|
@ -59,7 +59,7 @@
|
||||
@if($settings->client_portal_allow_under_payment || $settings->client_portal_allow_over_payment)
|
||||
<button class="button button-primary bg-primary">{{ ctrans('texts.pay_now') }}</button>
|
||||
@else
|
||||
@livewire('pay-now-dropdown', ['total' => $invoice->partial > 0 ? $invoice->partial : $invoice->balance, 'company' => $company])
|
||||
@livewire('pay-now-dropdown', ['total' => $invoice->getPayableAmount(), 'company' => $company])
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user