add simple usage
This commit is contained in:
parent
0f74186df2
commit
1aa2984c0f
1 changed files with 57 additions and 2 deletions
59
README.rst
59
README.rst
|
@ -5,11 +5,11 @@ PyInvoice
|
||||||
.. image:: https://api.travis-ci.org/CiCiApp/PyInvoice.svg?branch=master
|
.. image:: https://api.travis-ci.org/CiCiApp/PyInvoice.svg?branch=master
|
||||||
:target: https://github.com/CiCiApp/PyInvoice
|
:target: https://github.com/CiCiApp/PyInvoice
|
||||||
|
|
||||||
Invoice/receipt generator.
|
Invoice/Receipt Generator.
|
||||||
|
|
||||||
Dependency
|
Dependency
|
||||||
----------
|
----------
|
||||||
* reportlab
|
* Reportlab
|
||||||
* Python 2.6+/3.3+
|
* Python 2.6+/3.3+
|
||||||
|
|
||||||
+-------------------+-------------------+-------------------+-------------------+-------------------+
|
+-------------------+-------------------+-------------------+-------------------+-------------------+
|
||||||
|
@ -26,6 +26,61 @@ Dependency
|
||||||
| Reportlab 3.2 | | ✓ | ✓ | ✓ |
|
| Reportlab 3.2 | | ✓ | ✓ | ✓ |
|
||||||
+-------------------+-------------------+-------------------+-------------------+-------------------+
|
+-------------------+-------------------+-------------------+-------------------+-------------------+
|
||||||
|
|
||||||
|
Install
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pip install pyinvoice
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from datetime import datetime, date
|
||||||
|
from pyinvoice.models import InvoiceInfo, ServiceProviderInfo, ClientInfo, Item, Transaction
|
||||||
|
from pyinvoice.templates import SimpleInvoice
|
||||||
|
|
||||||
|
doc = SimpleInvoice('invoice.pdf')
|
||||||
|
|
||||||
|
# Paid stamp, optional
|
||||||
|
doc.is_paid = True
|
||||||
|
|
||||||
|
doc.invoice_info = InvoiceInfo(1023, datetime.now(), datetime.now()) # Invoice info, optional
|
||||||
|
|
||||||
|
# Service Provider Info, optional
|
||||||
|
doc.service_provider_info = ServiceProviderInfo(
|
||||||
|
name='PyInvoice',
|
||||||
|
street='My Street',
|
||||||
|
city='My City',
|
||||||
|
state='My State',
|
||||||
|
country='My Country',
|
||||||
|
post_code='222222',
|
||||||
|
vat_tax_number='Vat/Tax number'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Client info, optional
|
||||||
|
doc.client_info = ClientInfo(email='client@example.com')
|
||||||
|
|
||||||
|
# Add Item
|
||||||
|
doc.add_item(Item('Item', 'Item desc', 1, '1.1'))
|
||||||
|
doc.add_item(Item('Item', 'Item desc', 2, '2.2'))
|
||||||
|
doc.add_item(Item('Item', 'Item desc', 3, '3.3'))
|
||||||
|
|
||||||
|
# Tax rate
|
||||||
|
doc.set_item_tax_rate(20) # 20%
|
||||||
|
|
||||||
|
# Transactions detail, optional
|
||||||
|
doc.add_transaction(Transaction('Paypal', 111, datetime.now(), 1))
|
||||||
|
doc.add_transaction(Transaction('Strip', 222, date.today(), 2))
|
||||||
|
|
||||||
|
# Optional
|
||||||
|
doc.set_bottom_tip("Email: example@example.com<br />Don't hesitate to contact us for any questions.")
|
||||||
|
|
||||||
|
doc.finish()
|
||||||
|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
MIT
|
MIT
|
Loading…
Reference in a new issue