diff --git a/bin/backend/controls/panels/Journal.css b/bin/backend/controls/panels/Journal.css index dd7a96ddfbe6ceb3062b898ec47e3d2ee735cbe1..4aaf89d05e360194634318a1644853b68f108c2e 100644 --- a/bin/backend/controls/panels/Journal.css +++ b/bin/backend/controls/panels/Journal.css @@ -214,3 +214,9 @@ .invoices-invoice-details .articles-sum td { font-size: 14px !important; } + +.invoices-invoice-details .articles-sum-exchange-rate { + float: left; + font-size: 10px; + margin: 10px 10px 0 10px; +} diff --git a/src/QUI/ERP/Accounting/Invoice/Invoice.php b/src/QUI/ERP/Accounting/Invoice/Invoice.php index b3363d960e856a298783335b190206bf517e0feb..97a1dd88114756043d37b5ffadeacbce34b94384 100644 --- a/src/QUI/ERP/Accounting/Invoice/Invoice.php +++ b/src/QUI/ERP/Accounting/Invoice/Invoice.php @@ -45,10 +45,10 @@ class Invoice extends QUI\QDOM // const PAYMENT_STATUS_STORNO = 3; // Alias for cancel // const PAYMENT_STATUS_CREATE_CREDIT = 5; - const DUNNING_LEVEL_OPEN = 0; // No Dunning -> Keine Mahnung - const DUNNING_LEVEL_REMIND = 1; // Payment reminding -> Zahlungserinnerung - const DUNNING_LEVEL_DUNNING = 2; // Dunning -> Erste Mahnung - const DUNNING_LEVEL_DUNNING2 = 3; // Second dunning -> Zweite Mahnung + const DUNNING_LEVEL_OPEN = 0; // No Dunning -> Keine Mahnung + const DUNNING_LEVEL_REMIND = 1; // Payment reminding -> Zahlungserinnerung + const DUNNING_LEVEL_DUNNING = 2; // Dunning -> Erste Mahnung + const DUNNING_LEVEL_DUNNING2 = 3; // Second dunning -> Zweite Mahnung const DUNNING_LEVEL_COLLECTION = 4; // Collection -> Inkasso /** @@ -249,6 +249,23 @@ public function getArticles(): ArticleListUnique $List = new ArticleListUnique($articles, $this->getCustomer()); $List->setLocale($this->getCustomer()->getLocale()); + + // accounting currency, if exists + $accountingCurrencyData = $this->getCustomDataEntry('accountingCurrencyData'); + + try { + if ($accountingCurrencyData) { + $List->setExchangeCurrency( + new QUI\ERP\Currency\Currency( + $accountingCurrencyData['accountingCurrency'] + ) + ); + + $List->setExchangeRate($accountingCurrencyData['rate']); + } + } catch (QUI\Exception $Exception) { + } + return $List; } diff --git a/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php b/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php index 1ac9a52c7bbc3f4e384a9a474dd01daf6429ef0d..c2e9f9eba5ec60f6d608bfe6d3970aeabb5daea3 100644 --- a/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php +++ b/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php @@ -238,6 +238,26 @@ public function __construct($id, Handler $Handler) if (\is_numeric($data['shipping_id'])) { $this->shippingId = (int)$data['shipping_id']; } + + // accounting currency, if exists + $accountingCurrencyData = $this->getCustomDataEntry('accountingCurrencyData'); + + try { + if ($accountingCurrencyData) { + $this->Articles->setExchangeCurrency( + new QUI\ERP\Currency\Currency( + $accountingCurrencyData['accountingCurrency'] + ) + ); + + $this->Articles->setExchangeRate($accountingCurrencyData['rate']); + } elseif (QUI\ERP\Currency\Conf::accountingCurrencyEnabled()) { + $this->Articles->setExchangeCurrency( + QUI\ERP\Currency\Conf::getAccountingCurrency() + ); + } + } catch (QUI\Exception $Exception) { + } } //region Getter