josemmo / einvoicing

Library for reading and creating European-compliant electronic invoices (EN 16931)
https://josemmo.github.io/einvoicing/
MIT License
117 stars 30 forks source link

How to add tag SupplierAssignedAccountID #35

Closed jw7712 closed 1 year ago

jw7712 commented 1 year ago

I'm trying to export UBL invoices for importing in an accounting application (Venice) and need to add cac:AccountingCustomerParty/cbc:SupplierAssignedAccountID to the XML file.

How can this be done using this package?

Screenshot from 2022-12-05 15-18-22

Thanks in advance

josemmo commented 1 year ago

Hello @jw7712,

"cbc:SupplierAssignedAccountID" doesn't appear to be part of the EN 16931 standard nor PEPPOL BIS 3.0.

jw7712 commented 1 year ago

@josemmo Thanks for your reply. I see that indeed it's not part of the standard, but some accounting packages make use of it to match a contact by id.

When searching for it i see that exact online is also using this: https://support.exactonline.com/community/s/knowledge-base#All-All-HNO-Concept-general-importexport-gen-impexp-ublineolc

josemmo commented 1 year ago

Adding this feature is not feasible because is non-standard and, in some cases, not allowed.

But if you need to add the field to a document, you can do it manually after generating the XML:

use Einvoicing\Invoice;
use Einvoicing\Presets;
use Einvoicing\Writers\UblWriter;
use UXML\UXML;

// Generate invoice
$inv = new Invoice(Presets\Peppol::class);
// [...]

// Export invoice
$writer = new UblWriter();
$xml = UXML::fromString($writer->export($inv));
$xml->get('cac:AccountingCustomerParty')->add('cbc:SupplierAssignedAccountID', '0011223344'); // <---
echo $xml->asXML();
jw7712 commented 1 year ago

Great, thanks for the great support! I will try it!

The issue can be closed.