-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLAIdat.py
96 lines (84 loc) · 2.94 KB
/
LAIdat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import codecs
class InvoiceHeaderLine(object):
fields = (('type', 1), # Fixed
('customer_no', 8),
('customer_name', 50),
('address', 50),
('post_code', 50),
('contact_person', 50),
('currency', 3),
('invoice_no', 8),
('delivery_date', 8),
('invoice_date', 8),
('placeholder1', 3),
('comment', 30), # Not in use
('invoice_type', 1), # Fixed
('reference_no', 24),
('customer_class', 20),
('email', 50),
('due_date', 8),
('iban', 34),
('bic', 20),
('operator', 20),
('invoice_address', 100), # Not in use
('ship_name', 50),
('ship_address_1', 50), # Not in use
('ship_address_2', 100), # Not in use
('ship_post_code', 50),
('ship_phone', 20),
('ship_fax', 20),
('ship_contact_person', 20),
('ship_mobile_phone', 20),
('ship_email', 255),
('chn', 20),
('net_address', 100),
('ovt_code', 50),
('contact_email', 255), # Not in use
('comments_1', 255),
('comments_2', 255),
('comments_3', 255),
('booking_date', 8),
('construction_key', 35),
)
def __init__(self):
for field_name, width in self.fields:
setattr(self, field_name, '')
self.type = '8'
self.invoice_type = '0'
def __str__(self):
return ''.join([getattr(self, field_name).ljust(width)[:width]
for field_name, width in self.fields])
class InvoiceLine(object):
fields = (('type', 1),
('code', 20),
('description', 50),
('quantity', 7),
('unit_price', 9),
('discount_percent', 5),
('total', 9),
('vat_number', 1),
('account', 6),
('cost_account_1', 6),
('cost_account_2', 6),
('vat_sum', 9),
('cost_account_3', 10),
('construction_key', 35),
)
def __init__(self):
for field_name, width in self.fields:
setattr(self, field_name, '')
self.type = '4'
def __str__(self):
return ''.join([getattr(self, field_name).ljust(width)[:width]
for field_name, width in self.fields])
class InfoLine(object):
fields = (('type', 1),
('text', 80),
)
def __init__(self):
for field_name, width in self.fields:
setattr(self, field_name, '')
self.type = '2'
def __str__(self):
return ''.join([getattr(self, field_name).ljust(width)[:width]
for field_name, width in self.fields])