2015-05-30 15:41:06 +00:00
|
|
|
from datetime import datetime
|
2015-05-30 16:30:00 +00:00
|
|
|
from decimal import Decimal
|
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
|
|
|
|
|
|
|
|
doc = SimpleInvoice('test.pdf')
|
2015-05-30 16:30:00 +00:00
|
|
|
|
2015-06-06 09:00:31 +00:00
|
|
|
doc.is_paid = True
|
|
|
|
|
2015-05-30 15:41:06 +00:00
|
|
|
doc.invoice_info = InvoiceInfo('1024', datetime.now(), datetime.now())
|
2015-05-30 16:30:00 +00:00
|
|
|
|
2015-05-30 15:41:06 +00:00
|
|
|
doc.service_provider_info = ServiceProviderInfo(
|
|
|
|
name='PyInvoice',
|
|
|
|
street='My Street',
|
|
|
|
city='My City',
|
|
|
|
state='My State',
|
|
|
|
country='My Country',
|
|
|
|
post_code='My Post code'
|
|
|
|
)
|
|
|
|
|
|
|
|
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',
|
|
|
|
post_code='Client Post code'
|
|
|
|
)
|
2015-05-27 17:09:44 +00:00
|
|
|
|
2015-05-30 16:30:00 +00:00
|
|
|
doc.add_item(Item('0000', 'Item 0000', 'Item Description 1 Long--------------------------------Item Description 1 Long', 1, Decimal('1.1')))
|
|
|
|
doc.add_item(Item('1111', 'Item 1111', 'Item Description 2', 2, Decimal('2.2')))
|
|
|
|
doc.add_item(Item('2222', 'Item 2222', 'Item Description 3', 3, Decimal('3.3')))
|
|
|
|
|
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))
|
|
|
|
|
2015-05-30 15:41:06 +00:00
|
|
|
doc.finish()
|