WIP gather all transactions over bank accounts
This commit is contained in:
parent
046835064d
commit
9e8de4b4c7
@ -19,18 +19,29 @@ credits_ = []
|
||||
# Precise bank account
|
||||
allTransactions = []
|
||||
|
||||
def appendTransactions()
|
||||
'''
|
||||
def appendTransactions(x):
|
||||
global allTransactions
|
||||
allTransactions += [x]
|
||||
'''
|
||||
|
||||
def appendTransactions(transactions, bankAccount):
|
||||
global allTransactions
|
||||
#print('Before')
|
||||
#pprint(allTransactions)
|
||||
for transaction in transactions:
|
||||
transaction['bank account'] = bankAccount
|
||||
allTransactions += [transaction]
|
||||
#print('After')
|
||||
#pprint(allTransactions)
|
||||
|
||||
for folder in os.listdir():
|
||||
if folder != MAIN_BANK_ACCOUNT:
|
||||
print(folder)
|
||||
for file in os.listdir(folder):
|
||||
print(file)
|
||||
filePath = f'{folder}/{file}'
|
||||
_initialAmount, _totalMonthlyDebit, _totalMonthlyCredit, transactions, fileDatetime = readPdfBankStatement(filePath)
|
||||
for transaction in transactions:
|
||||
transaction['bank account'] = folder
|
||||
allTransactions += [transaction]
|
||||
print(filePath)
|
||||
transactions = readPdfBankStatement(filePath)[3]
|
||||
appendTransactions(transactions, folder)
|
||||
|
||||
#exit(1)
|
||||
os.chdir(f'{MAIN_BANK_ACCOUNT}/')
|
||||
@ -39,16 +50,19 @@ for folder in sorted(os.listdir()):
|
||||
for file in sorted(os.listdir(folder)):
|
||||
filePath = f'{folder}/{file}'
|
||||
print(filePath)
|
||||
initialAmount, totalMonthlyDebit, totalMonthlyCredit, transactions, fileDatetime = readPdfBankStatement(filePath)
|
||||
for transaction in transactions:
|
||||
transaction['bank account'] = MAIN_BANK_ACCOUNT
|
||||
allTransactions += [transaction]
|
||||
transactions = readPdfBankStatement(filePath)[3]
|
||||
appendTransactions(transactions, MAIN_BANK_ACCOUNT)
|
||||
if PRINT_TRANSACTIONS:
|
||||
for transaction in transactions:
|
||||
printTransaction(transaction)
|
||||
#break
|
||||
#break
|
||||
lastDatetime = getDatetimeFromFileName(file)
|
||||
|
||||
from pprint import pprint
|
||||
#pprint(transactions)
|
||||
pprint(allTransactions)
|
||||
|
||||
exit(0)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
plt.title('Monthly debits and credits')
|
||||
|
Loading…
Reference in New Issue
Block a user