mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Force exchange rates
This commit is contained in:
parent
ad8a7f6766
commit
60daf3d3fc
@ -251,7 +251,7 @@ class Rule extends BaseRule implements RuleInterface
|
||||
// }
|
||||
|
||||
$this->tax_rate = $this->client->company->tax_data->regions->AU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate;
|
||||
$this->reduced_tax_rate = $this->client->company->tax_data->regions->AU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate;
|
||||
$this->reduced_tax_rate = $this->client->company->tax_data->regions->AU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate;
|
||||
|
||||
return $this;
|
||||
|
||||
|
@ -11,21 +11,22 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\Models\Traits\Excludable;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\Models\Presenters\ClientPresenter;
|
||||
use App\Models\Traits\Excludable;
|
||||
use App\Services\Client\ClientService;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Utils\Traits\ClientGroupSettingsSaver;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Services\Client\ClientService;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use App\Models\Presenters\ClientPresenter;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Utils\Traits\ClientGroupSettingsSaver;
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
|
||||
/**
|
||||
* App\Models\Client
|
||||
@ -820,6 +821,9 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
$defaults['public_notes'] = $this->public_notes;
|
||||
}
|
||||
|
||||
$exchange_rate = new CurrencyApi();
|
||||
$defaults['exchange_rate'] = 1/$exchange_rate->exchangeRate($this->getSetting('currency_id'), $this->company->settings->currency_id);
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
|
@ -165,6 +165,7 @@ class BaseRepository
|
||||
|
||||
if (! $model->id) {
|
||||
$company_defaults = $client->setCompanyDefaults($data, lcfirst($resource));
|
||||
$data['exchange_rate'] = $company_defaults['exchange_rate'];
|
||||
$model->uses_inclusive_taxes = $client->getSetting('inclusive_taxes');
|
||||
$data = array_merge($company_defaults, $data);
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ class InvoiceService
|
||||
* Sets the exchange rate on the invoice if the client currency
|
||||
* is different to the company currency.
|
||||
*/
|
||||
public function setExchangeRate()
|
||||
public function setExchangeRate($force = false)
|
||||
{
|
||||
if ($this->invoice->exchange_rate != 1) {
|
||||
if ($this->invoice->exchange_rate != 1 || $force) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,6 @@ class ProfitAndLossReportTest extends TestCase
|
||||
|
||||
$this->account->delete();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testSimpleInvoiceIncome()
|
||||
|
Loading…
Reference in New Issue
Block a user