This commit is contained in:
denisdulici
2018-12-22 14:59:58 +03:00
parent 44fe707b09
commit ca0b21b583
4 changed files with 48 additions and 10 deletions

View File

@@ -60,18 +60,24 @@ trait Currencies
return $money;
}
public function getConvertedAmount($format = false)
public function getConvertedAmount($format = false, $with_tax = true)
{
return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format);
$amount = $with_tax ? $this->amount : isset($this->amount_without_tax) ? $this->amount_without_tax : $this->amount;
return $this->convert($amount, $this->currency_code, $this->currency_rate, $format);
}
public function getReverseConvertedAmount($format = false)
public function getReverseConvertedAmount($format = false, $with_tax = true)
{
return $this->reverseConvert($this->amount, $this->currency_code, $this->currency_rate, $format);
$amount = $with_tax ? $this->amount : isset($this->amount_without_tax) ? $this->amount_without_tax : $this->amount;
return $this->reverseConvert($amount, $this->currency_code, $this->currency_rate, $format);
}
public function getDynamicConvertedAmount($format = false)
public function getDynamicConvertedAmount($format = false, $with_tax = true)
{
return $this->dynamicConvert($this->default_currency_code, $this->amount, $this->currency_code, $this->currency_rate, $format);
$amount = $with_tax ? $this->amount : isset($this->amount_without_tax) ? $this->amount_without_tax : $this->amount;
return $this->dynamicConvert($this->default_currency_code, $amount, $this->currency_code, $this->currency_rate, $format);
}
}