diff --git a/src/QUI/ERP/Accounting/Invoice/Utils/Invoice.php b/src/QUI/ERP/Accounting/Invoice/Utils/Invoice.php index b925673afcd25a9432b9df1dea46da0cbd8c138d..d75835a5ed4aee828d24b9615202ed614c3400a0 100644 --- a/src/QUI/ERP/Accounting/Invoice/Utils/Invoice.php +++ b/src/QUI/ERP/Accounting/Invoice/Utils/Invoice.php @@ -663,6 +663,11 @@ public static function addressRequirementThreshold(): float return floatval($threshold); } + /** + * @throws QUI\ERP\Exception + * @throws QUI\Exception + * @throws QUI\Users\Exception + */ public static function getElectronicInvoice( InvoiceTemporary | QUI\ERP\Accounting\Invoice\Invoice $Invoice, $type = ZugferdProfiles::PROFILE_EN16931 @@ -828,9 +833,17 @@ public static function getElectronicInvoice( // products foreach ($Invoice->getArticles() as $Article) { - /* @var $Article QUI\ERP\Accounting\Article */ $article = $Article->toArray(); + $nettoPreis = $article['calculated']['nettoPrice']; // Netto-Einzelpreis + $vatSum = $article['calculated']['vatArray']['sum']; + $bruttoPreis = $nettoPreis; + + if ($vatSum) { + $bruttoPreis = $nettoPreis + ($vatSum / $article['quantity']); + } + + $document ->addNewPosition($article['position']) ->setDocumentPositionProductDetails( @@ -841,9 +854,10 @@ public static function getElectronicInvoice( null, null ) - ->setDocumentPositionNetPrice($article['calculated']['nettoPrice']) + ->setDocumentPositionNetPrice($article['calculated']['nettoPrice'], 1, "C62") // C62 = Stück + ->setDocumentPositionGrossPrice($bruttoPreis, 1, "C62") // C62 = Stück ->setDocumentPositionQuantity($article['quantity'], "H87") - ->addDocumentPositionTax('S', 'VAT', $article['vat']) + ->addDocumentPositionTax('S', 'VAT', $article['vat'], $article['calculated']['vatArray']['sum']) ->setDocumentPositionLineSummation($article['sum']); }