fix base_due_amount calculation

This commit is contained in:
Mohit Panjwani
2021-12-02 14:16:12 +05:30
parent 6c1fc8e514
commit f99b8b4a1c
2 changed files with 37 additions and 0 deletions

View File

@ -389,6 +389,7 @@ class Invoice extends Model implements HasMedia
}
$data['due_amount'] = ($this->due_amount + $oldTotal);
$data['base_due_amount'] = $data['due_amount'] * $data['exchange_rate'];
$data['customer_sequence_number'] = $serial->nextCustomerSequenceNumber;
$this->changeInvoiceStatus($data['due_amount']);
@ -660,6 +661,7 @@ class Invoice extends Model implements HasMedia
public function addInvoicePayment($amount)
{
$this->due_amount += $amount;
$this->base_due_amount = $this->due_amount * $this->exchange_rate;
$this->changeInvoiceStatus($this->due_amount);
}
@ -667,6 +669,7 @@ class Invoice extends Model implements HasMedia
public function subtractInvoicePayment($amount)
{
$this->due_amount -= $amount;
$this->base_due_amount = $this->due_amount * $this->exchange_rate;
$this->changeInvoiceStatus($this->due_amount);
}