fixed currency conversion

This commit is contained in:
denisdulici
2020-03-09 18:07:16 +03:00
parent bc421a5887
commit 08f349c42c
10 changed files with 24 additions and 49 deletions

View File

@@ -92,7 +92,7 @@ class CreateDocumentTransaction extends Job
$default_amount_model->currency_code = $this->request['currency_code'];
$default_amount_model->currency_rate = $currencies[$this->request['currency_code']];
$default_amount = (double) $default_amount_model->getDivideConvertedAmount();
$default_amount = (double) $default_amount_model->getAmountConvertedToDefault();
$convert_amount_model = new Transaction();
$convert_amount_model->default_currency_code = $this->request['currency_code'];
@@ -100,7 +100,7 @@ class CreateDocumentTransaction extends Job
$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();
$amount = (double) $convert_amount_model->getAmountConvertedFromDefault();
}
$total_amount -= $this->model->paid;
@@ -126,7 +126,7 @@ class CreateDocumentTransaction extends Job
$error_amount_model->currency_code = $this->model->currency_code;
$error_amount_model->currency_rate = $currencies[$this->model->currency_code];
$error_amount = (double) $error_amount_model->getDivideConvertedAmount();
$error_amount = (double) $error_amount_model->getAmountConvertedToDefault();
$convert_amount_model = new Transaction();
$convert_amount_model->default_currency_code = $this->model->currency_code;
@@ -134,7 +134,7 @@ class CreateDocumentTransaction extends Job
$convert_amount_model->currency_code = $this->request['currency_code'];
$convert_amount_model->currency_rate = $currencies[$this->request['currency_code']];
$error_amount = (double) $convert_amount_model->getAmountConvertedFromCustomDefault();
$error_amount = (double) $convert_amount_model->getAmountConvertedFromDefault();
}
$message = trans('messages.error.over_payment', ['amount' => money($error_amount, $this->request['currency_code'], true)]);

View File

@@ -64,7 +64,7 @@ class CreateTransfer extends Job
$default_amount_model->currency_code = $expense_currency_code;
$default_amount_model->currency_rate = $currencies[$expense_currency_code];
$default_amount = $default_amount_model->getAmountDivided();
$default_amount = $default_amount_model->getAmountConvertedToDefault();
}
$transfer_amount = new Transfer();
@@ -74,7 +74,7 @@ class CreateTransfer extends Job
$transfer_amount->currency_code = $income_currency_code;
$transfer_amount->currency_rate = $currencies[$income_currency_code];
$amount = $transfer_amount->getAmountConvertedFromCustomDefault();
$amount = $transfer_amount->getAmountConvertedFromDefault();
} else {
$amount = $this->request->get('amount');
}

View File

@@ -71,7 +71,7 @@ class UpdateTransfer extends Job
$default_amount_model->currency_code = $expense_currency_code;
$default_amount_model->currency_rate = $currencies[$expense_currency_code];
$default_amount = $default_amount_model->getDivideConvertedAmount();
$default_amount = $default_amount_model->getAmountConvertedToDefault();
}
$transfer_amount = new Transfer();
@@ -81,7 +81,7 @@ class UpdateTransfer extends Job
$transfer_amount->currency_code = $income_currency_code;
$transfer_amount->currency_rate = $currencies[$income_currency_code];
$amount = $transfer_amount->getAmountConvertedFromCustomDefault();
$amount = $transfer_amount->getAmountConvertedFromDefault();
} else {
$amount = $this->request->get('amount');
}