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

fix: e-invoice validation

Übergeordneter b502e0ba
No related branches found
No related tags found
2 Merge Requests!87Next 2.x,!80Update 'next-3.x' with latest changes from 'main'
Pipeline #13622 fehlgeschlagen mit Phase
in 2 Minuten und 27 Sekunden
......@@ -17,6 +17,14 @@
use IntlDateFormatter;
use horstoeko\zugferd\ZugferdDocumentBuilder;
use horstoeko\zugferd\ZugferdProfiles;
use horstoeko\zugferd\codelists\ZugferdCountryCodes;
use horstoeko\zugferd\codelists\ZugferdCurrencyCodes;
use horstoeko\zugferd\codelists\ZugferdElectronicAddressScheme;
use horstoeko\zugferd\codelists\ZugferdInvoiceType;
use horstoeko\zugferd\codelists\ZugferdReferenceCodeQualifiers;
use horstoeko\zugferd\codelists\ZugferdUnitCodes;
use horstoeko\zugferd\codelists\ZugferdVatCategoryCodes;
use horstoeko\zugferd\codelists\ZugferdVatTypeCodes;
use function array_map;
use function array_merge;
......@@ -747,12 +755,32 @@ public static function getElectronicInvoice(
$bankAccount = QUI\ERP\BankAccounts\Handler::getCompanyBankAccount();
if (!empty($bankAccount)) {
/* lastschrift
$document->addDocumentPaymentMeanToDirectDebit(
$bankAccount['iban'],
$Invoice->getPrefixedNumber()
// @todo mandats nummer
);
*/
$document->addDocumentPaymentMean(
'42', // TypeCode für Überweisung
$bankAccount['iban'] ?? '',
$bankAccount['bic'] ?? ''
);
} else {
$document->addDocumentPaymentMean(
'42', // TypeCode für Überweisung
'',
''
);
}
$document->addDocumentPaymentMean(
'42', // TypeCode für Überweisung
$bankAccount['iban'] ?? '',
$bankAccount['bic'] ?? ''
);
// customer
$Customer = $Invoice->getCustomer();
......@@ -774,9 +802,15 @@ public static function getElectronicInvoice(
if ($Customer->getAddress()->getAttribute('email')) {
$document->setDocumentBuyerCommunication('EM', $Customer->getAddress()->getAttribute('email'));
} else {
//$document->setDocumentBuyerCommunication('UUID', $Customer->getAddress()->getUUID());
// fallback für
try {
$User = QUI::getUsers()->get($Customer->getUUID());
$document->setDocumentBuyerCommunication('EM', $User->getAttribute('email'));
} catch (QUI\Exception) {
// requirement -> workaround -> placeholder
$document->setDocumentBuyerCommunication('EM', 'unknown@example.com');
}
}
//->setDocumentBuyerOrderReferencedDocument($Invoice->getUUID());
// total
......@@ -798,13 +832,13 @@ public static function getElectronicInvoice(
$document->setDocumentSummation(
$priceCalculation->getSum()->value(),
$priceCalculation->getSum()->value(),
$priceCalculation->getSum()->value(),
0.0,
0.0,
$priceCalculation->getNettoSum()->value(),
$vatTotal,
null,
0.0
0.0, // zuschläge
0.0, // rabatte
$priceCalculation->getNettoSum()->value(), // Steuerbarer Betrag (BT-109)
$vatTotal, // Steuerbetrag
null, // Rundungsbetrag
0.0 // Vorauszahlungen
);
// products
......@@ -828,6 +862,7 @@ public static function getElectronicInvoice(
->setDocumentPositionLineSummation($article['sum']);
}
// payment stuff
$timeForPayment = null;
try {
......@@ -842,7 +877,6 @@ public static function getElectronicInvoice(
$timeForPayment
);
return $document;
}
}
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