removed unnecessary function
This commit is contained in:
parent
82f51a33a2
commit
e54ee59ca6
@ -103,7 +103,8 @@ class CreateDocumentTransaction extends Job
|
|||||||
$amount = (double) $convert_amount_model->getAmountConvertedFromCustomDefault();
|
$amount = (double) $convert_amount_model->getAmountConvertedFromCustomDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_amount -= $this->getPaidAmount();
|
$total_amount -= $this->model->paid;
|
||||||
|
unset($this->model->reconciled);
|
||||||
|
|
||||||
// For amount cover integer
|
// For amount cover integer
|
||||||
$multiplier = 1;
|
$multiplier = 1;
|
||||||
@ -146,45 +147,6 @@ class CreateDocumentTransaction extends Job
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPaidAmount()
|
|
||||||
{
|
|
||||||
$paid = 0;
|
|
||||||
|
|
||||||
if (!$this->model->transactions->count()) {
|
|
||||||
return $paid;
|
|
||||||
}
|
|
||||||
|
|
||||||
$currencies = Currency::enabled()->pluck('rate', 'code')->toArray();
|
|
||||||
|
|
||||||
foreach ($this->model->transactions as $item) {
|
|
||||||
$default_amount = $item->amount;
|
|
||||||
|
|
||||||
if ($this->model->currency_code == $item->currency_code) {
|
|
||||||
$amount = (double) $default_amount;
|
|
||||||
} else {
|
|
||||||
$default_amount_model = new Transaction();
|
|
||||||
$default_amount_model->default_currency_code = $this->model->currency_code;
|
|
||||||
$default_amount_model->amount = $default_amount;
|
|
||||||
$default_amount_model->currency_code = $item->currency_code;
|
|
||||||
$default_amount_model->currency_rate = $currencies[$item->currency_code];
|
|
||||||
|
|
||||||
$default_amount = (double) $default_amount_model->getDivideConvertedAmount();
|
|
||||||
|
|
||||||
$convert_amount_model = new Transaction();
|
|
||||||
$convert_amount_model->default_currency_code = $item->currency_code;
|
|
||||||
$convert_amount_model->amount = $default_amount;
|
|
||||||
$convert_amount_model->currency_code = $this->model->currency_code;
|
|
||||||
$convert_amount_model->currency_rate = $currencies[$this->model->currency_code];
|
|
||||||
|
|
||||||
$amount = (double) $convert_amount_model->getAmountConvertedFromCustomDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
$paid += $amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $paid;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function createHistory($transaction)
|
protected function createHistory($transaction)
|
||||||
{
|
{
|
||||||
$history_desc = money((double) $transaction->amount, (string) $transaction->currency_code, true)->format() . ' ' . trans_choice('general.payments', 1);
|
$history_desc = money((double) $transaction->amount, (string) $transaction->currency_code, true)->format() . ' ' . trans_choice('general.payments', 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user