-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathxeroAccounts.py
40 lines (34 loc) · 1.02 KB
/
xeroAccounts.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
#Just holds Xero Account code defs
import re
COLLAT = 601
MINER_FEE = 311
BURN_FEE = 312
SLASH = 319
TRANSFERS = 990
BLOCK_REWARDS = 200
MINER_BALANCE = 601
def getTb(accountingApi, tennant, date, printIt=False):
tb = {}
report = accountingApi.get_report_trial_balance(tennant, date=date)
rows = report.reports[0].rows
for r in rows:
try:
for rr in r.rows:
try:
debits = float(rr.cells[3].value)
except:
debits = 0
try:
credits = float(rr.cells[4].value)
except:
credits = 0
amount = debits - credits
description = rr.cells[0].value
account = re.findall((r'\((\d+)\)'), description)[0]
tb[account] = amount;
# print(str(account))
if (printIt):
print(str(rr.cells[0].value) +' | '+ str(amount))
except:
pass
return tb