From 98aaf3028b1ce85f9a0b64a53f526fe38c5930bf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 23 Jun 2021 16:49:40 +1000 Subject: [PATCH] Change payment exchange_currency_id from the clients currency to the company currency --- app/Repositories/Migration/PaymentMigrationRepository.php | 4 +++- app/Repositories/PaymentRepository.php | 4 +++- app/Services/Invoice/MarkPaid.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php index 49980b60368f..7564d873c9cf 100644 --- a/app/Repositories/Migration/PaymentMigrationRepository.php +++ b/app/Repositories/Migration/PaymentMigrationRepository.php @@ -208,7 +208,9 @@ class PaymentMigrationRepository extends BaseRepository $exchange_rate = new CurrencyApi(); $payment->exchange_rate = $exchange_rate->exchangeRate($client_currency, $company_currency, Carbon::parse($payment->date)); - $payment->exchange_currency_id = $client_currency; + // $payment->exchange_currency_id = $client_currency; + $payment->exchange_currency_id = $company_currency; + } return $payment; diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index e0d881682316..e17cff099658 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -199,7 +199,9 @@ class PaymentRepository extends BaseRepository { $exchange_rate = new CurrencyApi(); $payment->exchange_rate = $exchange_rate->exchangeRate($client_currency, $company_currency, Carbon::parse($payment->date)); - $payment->exchange_currency_id = $client_currency; + // $payment->exchange_currency_id = $client_currency; + $payment->exchange_currency_id = $company_currency; + } return $payment; diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index ff1e0a4b5c93..68563ee5dfc7 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -113,7 +113,9 @@ class MarkPaid extends AbstractService $exchange_rate = new CurrencyApi(); $payment->exchange_rate = $exchange_rate->exchangeRate($client_currency, $company_currency, Carbon::parse($payment->date)); - $payment->exchange_currency_id = $client_currency; + //$payment->exchange_currency_id = $client_currency; // 23/06/2021 + $payment->exchange_currency_id = $company_currency; + $payment->save(); }