from functools import reduce register_account_ = "assets:current:cash:register" revenue_accounts_ = ["revenue:sales:edibles", "revenue:sales:materials"] inventory_accounts_ = ["assets:current:inventory-edibles", "assets:current:inventory-materials" ] schwund_account_ = "expenses:shrinkage" donation_account_ = "expenses:shrinkage" #donation_account_ = "revenue:donations:shrinkage" default_currency_ = "EUR" hledger_ledgerpath_=os.path.split(__file__)[0]+'/../Ledgers/r3.ledger' ledger_fileobj = open(hledger_ledgerpath_) journal = ledger.sortTransactionsByDate( list(ledger.createTempAccountsForAndConvertFromMultiDatePostings( ledger.parseJournal(ledger_fileobj) )) ) ledger_fileobj.close() acct_currency_amt_dict, asstresult = ledger.sumUpJournalVerifyAssertions(journal, abort_on_assrtfail=True) #print(ledger.showSums(acct_currency_amt_dict, [register_account_, revenue_account_]+ inventory_accounts_)) if asstresult == True: sys.exit(0) ##nothing to do asstresult, problematic_transaction, posting_with_failed_assertion = asstresult assert(asstresult == False) if problematic_transaction.name != "INVENTUR":
import datetime register_account_ = "assets:current:cash:register" revenue_accounts_ = ["revenue:sales:edibles", "revenue:sales:materials"] inventory_accounts_ = ["assets:current:inventory-edibles", "assets:current:inventory-materials" ] schwund_account_ = "expenses:shrinkage" donation_account_ = "expenses:shrinkage" #donation_account_ = "revenue:donations:shrinkage" default_currency_ = "EUR" hledger_ledgerpath_=os.path.split(__file__)[0]+'/../Ledgers/r3.ledger' ledger_fileobj = open(hledger_ledgerpath_) journal = ledger.sortTransactionsByDate( list(ledger.createTempAccountsForAndConvertFromMultiDatePostings( ledger.parseJournal(ledger_fileobj) )) ) ledger_fileobj.close() dates = [] interval = [] # days between taking inventory d1 = [] d2 = [] d3 = [] d4 = [] # 3 datapoints of umsatz: # - minimum break even point: summmer der einkaufspreise der getränke/snaks die aus assets:current:inventory-edibles verkauft wurden # - tatsächlicher umsatz: erwarteter umsatz mit getränken - schwund in euro # - maximum we should get: erw. umsatz mit getränken
filter( lambda t: len(t.postings) > 0, ledger.parseJournal( ledger.getHLedger(hledger_ledgerpath_, ["--cost"] + sys.argv[1:], depth=None)))) print("done") print("depth limiting transactions ...", end="", flush=True) for t in transactions: t.reduceDepth(depth) print("done") transactions_with_tempaccounts_without_multidates = list( ledger.sortTransactionsByDate( list( ledger.createTempAccountsForAndConvertFromMultiDatePostings( transactions)))) ## make running sum of journal for the graphs print("calculating running sum ...", end="", flush=True) running_sum_ = list( ledger.runningSumOfJournal( transactions_with_tempaccounts_without_multidates)) print("done") print("calculating cashflow ...", end="") acct_currency_accts_cashflow_dict_ = ledger.cashflowPerAccount( transactions, addinsubaccounts=True) print("done") graph = VisJsGraph()
transactions = list( filter( lambda t: len(t.postings) > 0, ledger.parseJournal( ledger.getHLedger(hledger_ledgerpath_, ["--cost"] + sys.argv[1:],depth=None) ) ) ) print("done") print("depth limiting transactions ...", end="", flush=True) for t in transactions: t.reduceDepth(depth) print("done") transactions_with_tempaccounts_without_multidates = list(ledger.sortTransactionsByDate( list(ledger.createTempAccountsForAndConvertFromMultiDatePostings(transactions)) )) ## make running sum of journal for the graphs print("calculating running sum ...", end="", flush=True) running_sum_ = list(ledger.runningSumOfJournal(transactions_with_tempaccounts_without_multidates)) print("done") print("calculating cashflow ...", end="") acct_currency_accts_cashflow_dict_ = ledger.cashflowPerAccount(transactions, addinsubaccounts=True) print("done") graph = VisJsGraph() def logScaleValue(x): e=1.3