diff options
-rw-r--r-- | main.cc | 2 | ||||
-rwxr-xr-x | main.py | 17 |
2 files changed, 11 insertions, 8 deletions
@@ -305,9 +305,9 @@ int parse_and_report(int argc, char * argv[], char * envp[]) if (account_has_xdata(*journal->master)) { account_xdata_t& xdata = account_xdata(*journal->master); - xdata.value = xdata.total; if (xdata.dflags & ACCOUNT_TO_DISPLAY) { *out << "--------------------\n"; + xdata.value = xdata.total; acct_formatter.format.format(*out, details_t(*journal->master)); } } @@ -215,7 +215,7 @@ class FormatEntries (FormatTransactions): self.last_entry = xact.entry; -class FormatAccount (AccountHandler): +class FormatAccounts (AccountHandler): output = None def __init__ (self, fmt, pred): @@ -233,6 +233,14 @@ class FormatAccount (AccountHandler): if config.output_file: self.output.close () + def final (self, account): + if account_has_xdata(account): + xdata = account_xdata(account) + if xdata.dflags & ACCOUNT_TO_DISPLAY: + print "--------------------" + xdata.value = xdata.total + self.output.write(self.formatter.format(account)) + def flush (self): self.output.flush () @@ -369,13 +377,8 @@ if command == "b": acct_formatter = FormatAccounts (format, config.display_predicate) sum_accounts (journal.master) walk_accounts (journal.master, acct_formatter, config.sort_string) + acct_formatter.final (journal.master) acct_formatter.flush () - #if account_has_xdata(journal.master): - # account_xdata(journal.master).value = account_xdata(journal.master).total; - # - # if account_xdata(journal.master).dflags & ACCOUNT_TO_DISPLAY: - # print "--------------------" - # config.format.format(out, details_t(*journal->master)); elif command == "E": acct_formatter = FormatEquity (format, config.display_predicate) |