Skip to content
Code-Schnipsel Gruppen Projekte
Commit 26dac29a erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

refactor: consider exchange rates

Übergeordneter a3f0b3f7
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -276,7 +276,13 @@ public function toUniqueList(): ArticleListUnique
{
$this->calc();
return new ArticleListUnique($this->toArray(), $this->getUser());
$List = new ArticleListUnique($this->toArray(), $this->getUser());
if ($this->ExchangeCurrency) {
$List->setExchangeCurrency($this->ExchangeCurrency);
}
return $List;
}
/**
......
......@@ -54,6 +54,16 @@ class ArticleListUnique implements \IteratorAggregate
*/
protected $showExchangeRate = true;
/**
* @var null
*/
protected $ExchangeCurrency = null;
/**
* @var float
*/
protected $exchangeRate = null;
/**
* ArticleList constructor.
*
......@@ -273,6 +283,22 @@ public function hideHeader()
$this->showHeader = false;
}
/**
* @param QUI\ERP\Currency\Currency $Currency
*/
public function setExchangeCurrency(QUI\ERP\Currency\Currency $Currency)
{
$this->ExchangeCurrency = $Currency;
}
/**
* @param float $rate
*/
public function setExchangeRate(float $rate)
{
$this->exchangeRate = $rate;
}
/**
* Return the Article List as HTML, without CSS
*
......@@ -320,14 +346,18 @@ public function toHTML($template = false): string
return $View;
}, $this->articles);
$ExchangeCurrency = QUI\ERP\Currency\Conf::getAccountingCurrency();
$ExchangeCurrency = $this->ExchangeCurrency;
$showExchangeRate = $this->showExchangeRate;
$exchangeRateText = '';
if ($ExchangeCurrency->getCode() === $Currency->getCode()) {
if (!$ExchangeCurrency || $ExchangeCurrency->getCode() === $Currency->getCode()) {
$showExchangeRate = false;
$exchangeRate = false;
} else {
if ($this->exchangeRate) {
$Currency->setExchangeRate($this->exchangeRate);
}
$exchangeRate = $Currency->getExchangeRate($ExchangeCurrency);
$exchangeRate = $ExchangeCurrency->format($exchangeRate);
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren