diff options
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/src/output.cc b/src/output.cc index bd55fe99..2cc075eb 100644 --- a/src/output.cc +++ b/src/output.cc @@ -304,82 +304,4 @@ void format_accounts::operator()(account_t& account) posted_accounts.push_back(&account); } -format_equity::format_equity(report_t& _report, const string& _format) - : format_accounts(_report) -{ - const char * f = _format.c_str(); - - if (const char * p = std::strstr(f, "%/")) { - first_line_format.parse(string(f, 0, p - f)); - next_lines_format.parse(string(p + 2)); - } else { - first_line_format.parse(_format); - next_lines_format.parse(_format); - } - - entry_t header_entry; - header_entry.payee = "Opening Balances"; - header_entry._date = CURRENT_DATE(); - bind_scope_t bound_scope(report, header_entry); - first_line_format.format(report.output_stream, bound_scope); -} - -void format_equity::flush() -{ - account_t summary(NULL, "Equity:Opening Balances"); - - account_t::xdata_t& xdata(summary.xdata()); - std::ostream& out(report.output_stream); - - xdata.value = total.negate(); - - if (total.type() >= value_t::BALANCE) { - const balance_t * bal; - if (total.is_type(value_t::BALANCE)) - bal = &(total.as_balance()); - else - assert(false); - - foreach (balance_t::amounts_map::value_type pair, bal->amounts) { - xdata.value = pair.second; - xdata.value.negate(); - bind_scope_t bound_scope(report, summary); - next_lines_format.format(out, bound_scope); - } - } else { - bind_scope_t bound_scope(report, summary); - next_lines_format.format(out, bound_scope); - } - out.flush(); -} - -void format_equity::post_account(account_t& account) -{ - std::ostream& out(report.output_stream); - - if (! account.has_flags(ACCOUNT_EXT_MATCHING)) - return; - - value_t val = account.xdata().value; - - if (val.type() >= value_t::BALANCE) { - const balance_t * bal; - if (val.is_type(value_t::BALANCE)) - bal = &(val.as_balance()); - else - assert(false); - - foreach (balance_t::amounts_map::value_type pair, bal->amounts) { - account.xdata().value = pair.second; - bind_scope_t bound_scope(report, account); - next_lines_format.format(out, bound_scope); - } - account.xdata().value = val; - } else { - bind_scope_t bound_scope(report, account); - next_lines_format.format(out, bound_scope); - } - total += val; -} - } // namespace ledger |