diff --git a/app/Models/Expense.php b/app/Models/Expense.php
index 9fbd5a485c7d..2749607c87e2 100644
--- a/app/Models/Expense.php
+++ b/app/Models/Expense.php
@@ -76,19 +76,9 @@ class Expense extends EntityModel
return ENTITY_EXPENSE;
}
- public function apply($amount)
+ public function isExchanged()
{
- if ($amount > $this->balance) {
- $applied = $this->balance;
- $this->balance = 0;
- } else {
- $applied = $amount;
- $this->balance = $this->balance - $amount;
- }
-
- $this->save();
-
- return $applied;
+ return $this->invoice_currency_id != $this->expense_currency_id;
}
}
diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php
index 114022662c69..63ac704fe8e1 100644
--- a/resources/lang/en/texts.php
+++ b/resources/lang/en/texts.php
@@ -1150,5 +1150,6 @@ return array(
'trial_success' => 'Successfully enabled two week free pro plan trial',
'overdue' => 'Overdue',
'white_label_text' => 'Purchase a ONE YEAR white label license for $'.WHITE_LABEL_PRICE.' to remove the Invoice Ninja branding from the client portal and help support our project.',
-
+
+ 'convert_currency' => 'Convert currency',
);
diff --git a/resources/views/expenses/edit.blade.php b/resources/views/expenses/edit.blade.php
index 8d413e16b69c..13a718919ab6 100644
--- a/resources/views/expenses/edit.blade.php
+++ b/resources/views/expenses/edit.blade.php
@@ -63,36 +63,46 @@
{!! Former::checkbox('should_be_invoiced')
->text(trans('texts.should_be_invoiced'))
->data_bind('checked: should_be_invoiced() || client_id(), enable: !client_id()')
- ->label(' ') !!}
+ ->label(' ') !!}
@endif
-
-
+ @if (!$expense || ($expense && ! $expense->isExchanged()))
+ {!! Former::checkbox('convert_currency')
+ ->text(trans('texts.convert_currency'))
+ ->data_bind('checked: convert_currency')
+ ->label(' ') !!}
+ @endif
+
- {!! Former::text('exchange_rate')
- ->data_bind("value: exchange_rate, enable: enableExchangeRate, valueUpdate: 'afterkeydown'") !!}
+