PyInvoice/simple.py

43 lines
1.1 KiB
Python
Raw Normal View History

from datetime import datetime
2015-05-30 16:30:00 +00:00
from decimal import Decimal
2015-06-06 09:51:52 +00:00
2015-06-06 09:17:57 +00:00
from pyinvoice.models import InvoiceInfo, ServiceProviderInfo, ClientInfo, Item, Transaction
2015-05-27 17:09:44 +00:00
from pyinvoice.templates import SimpleInvoice
2015-06-06 09:51:52 +00:00
2015-05-27 17:09:44 +00:00
doc = SimpleInvoice('test.pdf')
2015-05-30 16:30:00 +00:00
2015-06-06 09:00:31 +00:00
doc.is_paid = True
doc.invoice_info = InvoiceInfo('1024', datetime.now(), datetime.now())
2015-05-30 16:30:00 +00:00
doc.service_provider_info = ServiceProviderInfo(
name='PyInvoice',
street='My Street',
city='My City',
state='My State',
country='My Country',
2015-06-08 15:55:05 +00:00
post_code='222222',
vat_tax_number='Vat/Tax number'
)
doc.client_info = ClientInfo(
email='My Email',
client_id='My Client Id',
name='Client Name',
street='Client Street',
city='Client City',
state='Client State',
country='Client country',
2015-06-08 15:15:36 +00:00
post_code='222222'
)
2015-05-27 17:09:44 +00:00
2015-06-09 14:20:04 +00:00
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'))
doc.set_item_tax_rate(20) # 20%
2015-05-30 16:30:00 +00:00
2015-06-06 09:17:57 +00:00
doc.add_transaction(Transaction('Paypal', 111, datetime.now(), 1))
doc.add_transaction(Transaction('Strip', 222, datetime.now(), 2))
doc.finish()