================
InvoiceGenerator
================
.. image:: https://travis-ci.org/by-cx/InvoiceGenerator.svg?branch=master
:target: https://travis-ci.org/by-cx/InvoiceGenerator
.. image:: https://img.shields.io/pypi/v/InvoiceGenerator.svg
:target: https://pypi.python.org/pypi/InvoiceGenerator/
:alt: Latest Version
This is library to generate a simple invoices.
Currently supported formats are PDF and XML for Pohoda accounting system.
PDF invoice is based on ReportLab.
.. image:: https://raw.githubusercontent.com/mezka/InvoiceGenerator/master/example_with_vat.png
:alt: Example image of invoice
:width: 25%
Installation
============
Run this command as root::
pip install InvoiceGenerator
If you want upgrade to new version, add ``--upgrade`` flag::
pip install InvoiceGenerator --upgrade
You can use setup.py from GitHub repository too::
python setup.py install
Documentation
-------------
Complete documentation is available on
`Read The Docs <http://readthedocs.org/docs/InvoiceGenerator/>`_.
Example
=======
Basic API
---------
Define invoice data first::
import os
from tempfile import NamedTemporaryFile
from InvoiceGenerator.api import Invoice, Item, Client, Provider, Creator
# choose english as language
os.environ["INVOICE_LANG"] = "en"
client = Client('Client company')
provider = Provider('My company', bank_account='2600420569', bank_code='2010')
creator = Creator('John Doe')
invoice = Invoice(client, provider, creator)
invoice.currency_locale = 'en_US.UTF-8'
invoice.add_item(Item(32, 600, description="Item 1"))
invoice.add_item(Item(60, 50, description="Item 2", tax=21))
invoice.add_item(Item(50, 60, description="Item 3", tax=0))
invoice.add_item(Item(5, 600, description="Item 4", tax=15))
Note: Due to Python's representational error, write numbers as integer ``tax=10``,
Decimal ``tax=Decimal('10.1')`` or string ``tax='1.2'`` to avoid getting results with
lot of decimal places.
PDF
---
Generate PDF invoice file::
from InvoiceGenerator.pdf import SimpleInvoice
pdf = SimpleInvoice(invoice)
pdf.gen("invoice.pdf", generate_qr_code=True)
Pohoda XML
----------
Generate XML invoice file::
from InvoiceGenerator.pohoda import SimpleInvoice
pdf = SimpleInvoice(invoice)
pdf.gen("invoice.xml")
Note: Pohoda uses three tax rates: none: 0%, low: 15%, high: 21%.
If any item doesn't meet those percentage, the rateVat parameter will
not be set for those items resulting in 0% tax rate.
Only SimpleInvoice is currently supported for Pohoda XML format.
Hacking
=======
Fork the `repository on github <https://github.com/creckx/InvoiceGenerator>`_ and
write code. Make sure to add tests covering your code under `/tests/`. You can
run tests using::
python setup.py test
Then propose your patch via a pull request.
Documentation is generated from `doc/source/` using `Sphinx
<http://sphinx-doc.org/>`_::
python setup.py build_sphinx
Then head to `doc/build/html/index.html`.
History
=======
1.2.0 - 2024-07-14
------------------
- Large project update, support for Python 3.8 - 3.12
1.1.0 - 2020-04-24
------------------
- Fix QR code on invoice
- Drop Python 2 support
- Add pt_BR translation
- Add support for transparent PNGs
1.0.0 - 2018-05-17
------------------
- Add support for Pohoda XML format
- Added much more complex documentation
- Parameter ``Address.zip`` was renamed to ``Address.zip_code``
- Add parameters ``division`` and ``country`` to the ``Address``
- Added parameter ``Address.bank_code``
If present, the bank code will be written after dash to
the account number, otherwise whole
``Address.bank_account`` will be used
- Address are rendered to fit the area on the PDF invoice
- Code style fixes
- Fixes for rounding: usage of ``decimal.Decimal`` and
added parameter ``Invoice.rounding_strategy``
- Fix for QR code
- Allow to set line width in ``SimpleInvoice``
0.5.4 - 2017-03-22
------------------
- Fix locale in build package
0.5.3 - 2017-01-09
------------------
- Use Babel for currency formating; fix and improve tests
0.5.2 - 2014-12-04
------------------
- Stop mentionning python2.6 support
- Make invoice.variable_symbol optional
0.5.1 - 2014-10-28
------------------
- Fix conf relative import
- Use python native function splitlines for notes
0.5.0 - 2014-09-21
------------------
- Add property number to object Invoice
- Replaced variable symbol for invoice number in invoice header
- Update Czech translations
0.4.9 - 2014-07-3
-----------------
- Bug fix previous commit
0.4.8 - 2014-07-3
-----------------
- Create proforma invoice
0.4.7 - 2014-07-1
-----------------
- Change date format for qr code generator
- Disable converting datetime to string on Invoice
- Disable rendering empty values
0.4.6 - 2014-05-14
------------------
- The displayed number of pages only when there is more than one
- Rename Date to Date of exposure
- Use pillow instead of PIL
0.4.5 - 2014-04-21
------------------
- Support for multipage items printout
- Support for multiline item description
- Use locale to print currency strings and values
- Adding logo to provider header
No notes on earlier releases.
Contributors
============
- Adam Strauch (@creckx)
- Martin Voldrich (@rbas)
- Petr Dlouhy (@PetrDlouhy)
- Antoine Musso (@hashar)
Raw data
{
"_id": null,
"home_page": "https://github.com/creckx/InvoiceGenerator",
"name": "InvoiceGenerator",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "invoice invoices generator",
"author": "Adam Strauch",
"author_email": "cx@initd.cz",
"download_url": "https://files.pythonhosted.org/packages/25/31/f256a6fe577752672b76062cc4fe10b46439bfdad6b97b7b479174e5ebf2/invoicegenerator-1.2.0.tar.gz",
"platform": null,
"description": "================\nInvoiceGenerator\n================\n.. image:: https://travis-ci.org/by-cx/InvoiceGenerator.svg?branch=master\n :target: https://travis-ci.org/by-cx/InvoiceGenerator\n \n.. image:: https://img.shields.io/pypi/v/InvoiceGenerator.svg\n :target: https://pypi.python.org/pypi/InvoiceGenerator/\n :alt: Latest Version\n\nThis is library to generate a simple invoices.\nCurrently supported formats are PDF and XML for Pohoda accounting system.\nPDF invoice is based on ReportLab.\n\n.. image:: https://raw.githubusercontent.com/mezka/InvoiceGenerator/master/example_with_vat.png\n :alt: Example image of invoice\n :width: 25%\n\nInstallation\n============\n\nRun this command as root::\n\n\tpip install InvoiceGenerator\n\nIf you want upgrade to new version, add ``--upgrade`` flag::\n\n\tpip install InvoiceGenerator --upgrade\n\nYou can use setup.py from GitHub repository too::\n\n\tpython setup.py install\n\n\nDocumentation\n-------------\n\nComplete documentation is available on\n`Read The Docs <http://readthedocs.org/docs/InvoiceGenerator/>`_.\n\n\nExample\n=======\n\nBasic API\n---------\n\nDefine invoice data first::\n\n\timport os\n\n\tfrom tempfile import NamedTemporaryFile\n\n\tfrom InvoiceGenerator.api import Invoice, Item, Client, Provider, Creator\n\n\t# choose english as language\n\tos.environ[\"INVOICE_LANG\"] = \"en\"\n\n\tclient = Client('Client company')\n\tprovider = Provider('My company', bank_account='2600420569', bank_code='2010')\n\tcreator = Creator('John Doe')\n\n\tinvoice = Invoice(client, provider, creator)\n\tinvoice.currency_locale = 'en_US.UTF-8'\n\tinvoice.add_item(Item(32, 600, description=\"Item 1\"))\n\tinvoice.add_item(Item(60, 50, description=\"Item 2\", tax=21))\n\tinvoice.add_item(Item(50, 60, description=\"Item 3\", tax=0))\n\tinvoice.add_item(Item(5, 600, description=\"Item 4\", tax=15))\n\nNote: Due to Python's representational error, write numbers as integer ``tax=10``,\nDecimal ``tax=Decimal('10.1')`` or string ``tax='1.2'`` to avoid getting results with\nlot of decimal places.\n\nPDF\n---\n\nGenerate PDF invoice file::\n\n\tfrom InvoiceGenerator.pdf import SimpleInvoice\n\n\tpdf = SimpleInvoice(invoice)\n\tpdf.gen(\"invoice.pdf\", generate_qr_code=True)\n\n\nPohoda XML\n----------\n\nGenerate XML invoice file::\n\n\tfrom InvoiceGenerator.pohoda import SimpleInvoice\n\n\tpdf = SimpleInvoice(invoice)\n\tpdf.gen(\"invoice.xml\")\n\nNote: Pohoda uses three tax rates: none: 0%, low: 15%, high: 21%.\nIf any item doesn't meet those percentage, the rateVat parameter will\nnot be set for those items resulting in 0% tax rate.\n\nOnly SimpleInvoice is currently supported for Pohoda XML format.\n\n\nHacking\n=======\n\nFork the `repository on github <https://github.com/creckx/InvoiceGenerator>`_ and\nwrite code. Make sure to add tests covering your code under `/tests/`. You can\nrun tests using::\n\n python setup.py test\n\nThen propose your patch via a pull request.\n\nDocumentation is generated from `doc/source/` using `Sphinx\n<http://sphinx-doc.org/>`_::\n\n python setup.py build_sphinx\n\nThen head to `doc/build/html/index.html`.\n\n\nHistory\n=======\n\n1.2.0 - 2024-07-14\n------------------\n- Large project update, support for Python 3.8 - 3.12\n\n1.1.0 - 2020-04-24\n------------------\n- Fix QR code on invoice\n- Drop Python 2 support\n- Add pt_BR translation\n- Add support for transparent PNGs\n\n1.0.0 - 2018-05-17\n------------------\n- Add support for Pohoda XML format\n- Added much more complex documentation\n- Parameter ``Address.zip`` was renamed to ``Address.zip_code``\n- Add parameters ``division`` and ``country`` to the ``Address``\n- Added parameter ``Address.bank_code``\n If present, the bank code will be written after dash to\n the account number, otherwise whole\n ``Address.bank_account`` will be used\n- Address are rendered to fit the area on the PDF invoice\n- Code style fixes\n- Fixes for rounding: usage of ``decimal.Decimal`` and\n added parameter ``Invoice.rounding_strategy``\n- Fix for QR code\n- Allow to set line width in ``SimpleInvoice``\n\n\n0.5.4 - 2017-03-22\n------------------\n- Fix locale in build package\n\n\n0.5.3 - 2017-01-09\n------------------\n- Use Babel for currency formating; fix and improve tests\n\n0.5.2 - 2014-12-04\n------------------\n- Stop mentionning python2.6 support\n- Make invoice.variable_symbol optional\n\n0.5.1 - 2014-10-28\n------------------\n- Fix conf relative import\n- Use python native function splitlines for notes\n\n0.5.0 - 2014-09-21\n------------------\n- Add property number to object Invoice\n- Replaced variable symbol for invoice number in invoice header\n- Update Czech translations\n\n0.4.9 - 2014-07-3\n-----------------\n- Bug fix previous commit\n\n0.4.8 - 2014-07-3\n-----------------\n- Create proforma invoice\n\n0.4.7 - 2014-07-1\n-----------------\n- Change date format for qr code generator\n- Disable converting datetime to string on Invoice\n- Disable rendering empty values\n\n0.4.6 - 2014-05-14\n------------------\n- The displayed number of pages only when there is more than one\n- Rename Date to Date of exposure\n- Use pillow instead of PIL\n\n0.4.5 - 2014-04-21\n------------------\n\n- Support for multipage items printout\n- Support for multiline item description\n- Use locale to print currency strings and values\n- Adding logo to provider header\n\n\nNo notes on earlier releases.\n\n\nContributors\n============\n\n- Adam Strauch (@creckx)\n- Martin Voldrich (@rbas)\n- Petr Dlouhy (@PetrDlouhy)\n- Antoine Musso (@hashar)\n\n\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Library to generate PDF invoice.",
"version": "1.2.0",
"project_urls": {
"Homepage": "https://github.com/creckx/InvoiceGenerator"
},
"split_keywords": [
"invoice",
"invoices",
"generator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7cc3d52b0808108eacd11f40ba8a9f25a75f4499abd914d5a8b53a92b4774ff8",
"md5": "8c18bdab13d768a3de3385d1333b0a22",
"sha256": "2eab5a02f6c975c03c554d0f214e5ed2c9b70956c0d1558a05cc24ed3a6173dc"
},
"downloads": -1,
"filename": "InvoiceGenerator-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8c18bdab13d768a3de3385d1333b0a22",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1136389,
"upload_time": "2024-07-14T07:44:23",
"upload_time_iso_8601": "2024-07-14T07:44:23.090768Z",
"url": "https://files.pythonhosted.org/packages/7c/c3/d52b0808108eacd11f40ba8a9f25a75f4499abd914d5a8b53a92b4774ff8/InvoiceGenerator-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2531f256a6fe577752672b76062cc4fe10b46439bfdad6b97b7b479174e5ebf2",
"md5": "5412d72f76d07cd8e6315c0cb77302e2",
"sha256": "d9977fa63eaa4769a8175dee0487d9a6be2a4667e703c5e1e83a141b32cd0976"
},
"downloads": -1,
"filename": "invoicegenerator-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "5412d72f76d07cd8e6315c0cb77302e2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1235816,
"upload_time": "2024-07-14T07:44:26",
"upload_time_iso_8601": "2024-07-14T07:44:26.531230Z",
"url": "https://files.pythonhosted.org/packages/25/31/f256a6fe577752672b76062cc4fe10b46439bfdad6b97b7b479174e5ebf2/invoicegenerator-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-14 07:44:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "creckx",
"github_project": "InvoiceGenerator",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "invoicegenerator"
}