Skip to content
Code-Schnipsel Gruppen Projekte

fix: improve invoice handling for the electronic invoice

Zusammengeführt Henning Leutz schlägt vor, next-2.x in main zu mergen.
1 Datei
+ 17
3
Änderungen vergleichen
  • Nebeneinander
  • In der Reihe
@@ -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']);
}