forked from rtucker/gnucash-importers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoices-invoiceable.py
executable file
·57 lines (50 loc) · 1.8 KB
/
invoices-invoiceable.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
#!/usr/bin/python
import csv
import sys
POST_ACCOUNT = "Assets:Accounts Receivable"
incsv = csv.DictReader(sys.stdin)
outcsv = csv.writer(sys.stdout)
for row in incsv:
if int(row['recurring']) == 1:
continue
if row['total'] == "100.00":
desc = "Monthly Invoice - Desk"
acct = "Income:Member Dues:Desk"
elif row['total'] == "50.00":
desc = "Monthly Invoice - Full"
acct = "Income:Member Dues:Full"
elif row['total'] == "35.00":
desc = "Monthly Invoice - Student"
acct = "Income:Member Dues:Student"
elif row['total'] == "25.00":
desc = "Monthly Invoice - Associate"
acct = "Income:Member Dues:Associate"
else:
desc = "Monthly Invoice - UNKNOWN"
acct = "Income:Member Dues"
date = row['date'].split(' ')[0]
duedate = row['date_due'].split(' ')[0]
outcsv.writerow([
"INV" + row['ref'], # id
date, # date_opened
row['client_id'], # owner_id
"", # billingid
"invoiceable import", # notes
date, # date
desc, # desc
"Material", # action
acct, # account
"1", # quantity
row['total'], # price
"%", # disc_type
"", # disc_how
"0", # discount
"", # taxable
"", # taxincluded
"", # tax_table
date, # date_posted
duedate, # due_date
POST_ACCOUNT, # account_posted
"", # memo_posted
"yes", # accu_splits
])