Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit 381be8fa erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: create Credit Note -> consider all prices

Übergeordneter cc83413a
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -18,9 +18,9 @@ function ($invoiceId, $invoiceData) {
$invoiceData = '';
}
$invoiceData = \json_decode($invoiceData, true);
$invoiceData = json_decode($invoiceData, true);
if (!\is_array($invoiceData)) {
if (!is_array($invoiceData)) {
$invoiceData = [];
}
......
......@@ -8,13 +8,13 @@
use IntlDateFormatter;
use QUI;
use QUI\ERP\Customer\CustomerFiles;
use QUI\Permissions\Permission;
use QUI\ERP\Money\Price;
use QUI\ERP\Accounting\ArticleListUnique;
use QUI\ERP\Accounting\Payments\Transactions\Transaction;
use QUI\ERP\Accounting\Invoice\Utils\Invoice as InvoiceUtils;
use QUI\ERP\Accounting\Payments\Transactions\Transaction;
use QUI\ERP\Customer\CustomerFiles;
use QUI\ERP\Money\Price;
use QUI\ERP\Output\Output as ERPOutput;
use QUI\Permissions\Permission;
use function array_key_exists;
use function class_exists;
......@@ -24,6 +24,7 @@
use function json_decode;
use function json_encode;
use function str_replace;
use function strip_tags;
use function strtotime;
use function time;
......@@ -873,9 +874,38 @@ public function createCreditNote($PermissionUser = null, $globalProcessId = fals
$ArticleList->clear();
$ArticleList->setCurrency($this->getCurrency());
$priceKeyList = [
'price',
'basisPrice',
'nettoPriceNotRounded',
'sum',
'nettoSum',
'nettoSubSum',
'nettoPrice',
'nettoBasisPrice',
'unitPrice',
];
foreach ($articles as $Article) {
$article = $Article->toArray();
$article['unitPrice'] = $article['unitPrice'] * -1;
$article = $Article->toArray();
foreach ($priceKeyList as $priceKey) {
if (isset($article[$priceKey])) {
$article[$priceKey] = $article[$priceKey] * -1;
}
}
if (isset($article['calculated'])) {
foreach ($priceKeyList as $priceKey) {
if (isset($article['calculated'][$priceKey])) {
$article['calculated'][$priceKey] = $article['calculated'][$priceKey] * -1;
}
}
}
if (isset($article['calculated']['vatArray'])) {
$article['calculated']['vatArray']['sum'] = $article['calculated']['vatArray']['sum'] * -1;
}
$Clone = new QUI\ERP\Accounting\Article($article);
$ArticleList->addArticle($Clone);
......@@ -1308,7 +1338,7 @@ public function addComment(string $comment, $PermissionUser = null)
$PermissionUser
);
$comment = \strip_tags(
$comment = strip_tags(
$comment,
'<div><span><pre><p><br><hr>
<ul><ol><li><dl><dt><dd><strong><em><b><i><u>
......
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