Billy is an open source Java library which aims to provide applications with the ability to create and manage invoices. One of the main goals, is the ability to export the invoices in different formats, such as SAF-T and pdf. It's buid in a modular way in order to support additional country legislation, new billing artifacts as well as new export mechanisms.
Billy supports invoices, simplified invoices, credit notes and SAF-T (PT).
Simplified invoices are a type of invoice that only contain the Tax Registration Number of the customer. In this type of invoice the customers' address isn't mandatory and therefore suppliers only need to include its company name and Tax Registration Number.
At the moment it does not support accounting properties. However, it's prepared to be further developed in that area.
At the moment billy uses JPA (Java Persistence API) implemented in billy-core-jpa. However, it's prepared to be extended with new APIs.
Billy doesn't keep backup copies.
Billy doesn't allow invoices from other applications to be integrated in Billy's database.
Billy doesn't allow an application to change the existing data directly. Billy lets you create amending documents that change the state of other documents.
Invoices can be issued by:
An invoice must be issued in a business to business (BtoB) supply situations and in certain business to customer (BtoC) supply situations.
The Standard Audit File for Tax (SAF-T) is an international normalized file in XML format, for exchanging reliable accounting data from organizations to the national tax authority or external auditors. The Standard is defined by the Organization for Economic Cooperation and Development (OECD) and it enables auditors to access accounting data in an easy readable format. The SAF-T file incorporates exported accounting data from an accounting system for a given time period and by due to its uniform layout and format it's easily readable and extensible. It has been widely adopted in Europe, being extended as needed by each country in order to comply with its policies and legislation.
To add a new SAF-T you must extend the OECD SAF-T to comply with the country's legislation and policies. This achieved by creating a new module that extends the billy-core module which implements the OECD standard. An example of this is the Portuguese module billy-platypus.
Check out the contribution section and our Issue Tracker for more information. Contributions are always welcome!
You can check if all fields of the SAF-T (PT) are in accordance with the latest schema using offline validator made available by the Portuguese Ministry of Finance. There are other online validators provided by third parties.
Billy must sign all the documents that it exports to avoid the direct change of those documents, so the following documents are signed by Billy:
To process handwritten invoices or other amending documents, you must individually insert the document to billy, which will associate the document to a special series, with anual periodicity or more.
Only some fields of the invoice can be changed, address, banck account number, customer name, and product description, if you want to change any of the other fields you need to create a credit note to cancel the invoice and create a new changed invoice.
Billy application do it's calculations according to the MathContext.Decimal128, and Half_Even rounding mode, which round to nearest neighbor, where an equidistant value is rounded to the nearest even neighbor. For the math calculations billy uses 34 digits to assure a big precision in calculations, in the validations only 7 decimal figures are important, and for presentation only uses 2 decimal figures to represent the cents.
The structure of the invoice PDF template must be defined in XSL,and the location of that template file must be passed to the billy pdf generation, when you want to export an invoice. Note: The names in the XSL entries in the template must be the same that billy generator expects, otherwise the PDF wont't be generated. If you want to add new entries you must extends the generator to fill the new fields.