I believe it would be a great improvement to be able to export data (invoices especially) to UBL.
UBL is an international ISO Standard and has been approved by the European Commision (article1). Being able to export to a UBL-xml would enable accountants al over europe to import the data into their software.
Indeed, the UBL Invoice is the only XML Invoice document standard that is sanctioned, stable, integrated within a suite of supply chain documents and is the nearest thing the world has to a purpose-built ebXML document format.
(article2)
I totally agree with your feature request.
As stated in your request above we currently see that each EU country uses its own internal specifications. Is it possible to build a common UBL 2.1 plugin with the ability to select a UBL-specific version/schema?
This way a user can determine what kind of UBL his customer needs or wants to use; Zugferd, UBL 2.1, UBL-PEPPOL, UBL-efff, UBL-SI, âŚ
These UBL-specific version (schema) could then later be added to the system as needed.
If someone can help me a bit I would love to contribute further to this feature.
I took a look at how the ZuGFerD xml getâs generated and itâs seems straight forward enough for me to be able to deduce how to correctly generate the UBL XML from that.
I suggest adding:
a button to the invoice âoptionsâ with âDownload UBL XMLâ or changing the âDownload pdfâ to âDownloadâ and using a modal for the file-type choice.
a file-type multi-select (multi so you can send pdf and xml if unsure what the receiver can handle) to the âsend emailâ page with options ânormal pdfâ,âZuGFerD pdfâ, âUBL 2.1 xmlâ,âŚ
So I think I can do the xml generation part, but how do I go about this? (First time contributing to open-source)
First I do a pull-request on github, then write the xml generation code, and then do a merge-request. Is that about right?
Can grand wizard @Kovah perhaps point me in the right direction?
I personally would add a new button which downloads the XML. I donât know if itâs common to change the format of the XML (XSLT?) often but maybe you could just simply add a new setting for the XML style that is set once. Iâm not familiar with this XML stuff so I canât help you very much with the requirements, settings and so on.
I would recommend.mend to fork the project on GitHub and treat it like a normal project: check it out to your machine, switch to the 1.4.11 branch, develop the feature and then push the changes back to GitHub. Please make sure that you add the issue ID to all commits, I will add it tomorrow.
If everything is done just notify me and I will create a pull request.
You may join our slack chat so you can ask me if you have any questions.
@maxdevos:I would like to contribute to the construction of this feature.
Remember that it depends on how âthe customerâ treats his invoices, his internal workflow and the country in which he is established.
I suggest to first replace the zugferd setting to make a checkbox or radio button âUse UBLâ (yes/no) and then display a drop-downmenu where, among other UBL versions; zugferd, UBL 2.1, ⌠can be selected.
For email you could default sent the pdf and xml file as attachments to your customer.
Give the customer also the possibility (drop-downmenu) to download the required UBL version on his own invoice/payment page.
Itâs a raw xml file.
Thatâs why I would add some styling to the file which I thought was gonna work through XSTL but I seem to be mistaken.
Lets start with a simple raw XML and worry about styling later.
I did some more reading and I would actually suggest NOT adding other additional formats besides the already implemented zugFerD and the standard UBL 2.1 because the whole point of UBL (U stands for Universal) is to make the Business transaction data universal. Other formats are mostly aimed at Invoicing only (like zugFerd, Finvoice, etc âŚ) and thus might not be very future proof. Where-as it seems UBL is here to stay.
@VeRony
What is the dependency you are referring to? UBL is accepted in the EU and Universal so I would argue it does not depend on the country (if inside Europe at least) or workflow.
What do you think about the following, just keeping it simple:
I am aware of the fact that UBL is indeed ISO certified, globally and in the EU accepted, but today almost every EU country has its own UBL format. Numerous UBL dialects are in use e.g. ZUGFeRD in Germany, UBL SI and UBL OHNL in the Netherlands, UBL eFFF in Belgium, UBL Peppol is used by the governement in different countries and by various industries, etc⌠More information about this problem can be found here: http://scobdo.eu/background/.
Till this problem is solved and for the time being I propose to add a UBL setting for each client (comparable to the language setting and the template system) as I already implemented on my own system.
For now, some items can be selected in the list box; Zugferd (DE), UBL EFFF (BE), and more can be easily added as the UBL library files (cfg templates) are created.
In this dropdown list the user can choose for the clientâs UBL version which he wants to use. Each UBL-format/version has his own library which generates his specified xml file. Included for Zugferd (DE) and external for others like UBL efff (BE).
I do have eliminated the global âZugferd xmlâ setting.
I hope that these adjustments may be useful for someone.
I myself am struggling howto attach the external UBL (XML) files to emails.
Q: How do I get the external XML file as an attachment in the email? Can someone point me in the right direction? Some examples might help me outâŚ
@maxdevos Thanks for pointing me into the right direction.
This helped me alot (as a starting point) to find where the pdf-invoice is attached and also where the ubl should be added in the email.
Iâve got this working well.
My procedure:
Choose (individually) the right UBL setting for your client.
Create the invoice and send it to the client.
-> No need to add the created ubl as attachment to the email.
-> If the ubl-file is created then my function will automatically attach it to the email.
-> If your client setting is âZugferd UBLâ then the UBL-file is included into the pdf.
@Kovah: (simply out of curosity) is there a reason why the date is added to the âpdf-invoice-filenameâ in the archive folder?
Can I view your branch on github? Iâd like to see how you did it / wrote the functions.
The procedure looks good and it makes sense choosing the format per client instead of per invoice.
I think the date in the filename is an accounting thing.
No problem to show you my coding butâŚ
I am by no means a real developer but I like to find things out and improve where necessary. Thatâs why I have my adjustments built on a local wamp server instance and not (yet) on github.
Can you show me how to setup and configure github on Windows for InvoicePlane webdevelopment?
In short what did I do:
I have eliminated the global âpdf zugferdâ setting.
In the client setting I added a UBL dropdown-menu. See 1ste screenshot in item # 9.
At the same time I added a âcontacts fieldâ (for departments or personal names) to the client and user setting because that was lacking in my opinion.
As you can see also (other screenshots - red arrow) in the same item #9 I added some client settings in the invoice view page, e.g. contact, UBL version, VAT Id.
The two screenshots shows a UBL efff version (external file) and a Zugferd version (included in the PDF).
I also (instead of the menu-item âDownload PDFâ) created a âView PDFâ menu-item that displays the invoice PDF file in a modal window on the same webpage.
Finally, as described in item # 11 I have made adjustments to âphpmailer_helper.phpâ so that the pdf invoice and the external UBL-file (if available) are automatically added to the email.
// Add the attachment if supplied
if ($attachment_path && $CI->mdl_settings->setting(âemail_pdf_attachmentâ)) {
$attachfile = pathinfo($attachment_path);
// check the date prefix: â2017-02-01â_ == today, then strip, copy and attach the new file)
if ( substr($attachfile[âfilenameâ], 0, 10) == date(âY-m-dâ) ){
$filename = $attachfile[âdirnameâ].â/â.substr_replace($attachfile[âfilenameâ], ââ, 0, 11);
copy($attachment_path, $filename.â.pdfâ);
$mail->addAttachment($filename.â.pdfâ);
}
if (file_exists($filename.â.xmlâ)) {
$mail->addAttachment($filename.â.xmlâ);
}
}