Added back several cost reporting options.

This commit is contained in:
John Wiegley 2009-01-19 22:28:34 -04:00
parent 5e25a6d838
commit 7ffe0e1539
2 changed files with 53 additions and 18 deletions

View file

@ -517,12 +517,18 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
case 'a':
if (std::strcmp(p, "amount_") == 0)
return MAKE_FUNCTOR(report_t::option_amount_);
else if (std::strcmp(p, "ansi") == 0)
return MAKE_FUNCTOR(report_t::option_ansi);
else if (std::strcmp(p, "ansi-invert") == 0)
return MAKE_FUNCTOR(report_t::option_ansi_invert);
break;
case 'b':
if (std::strcmp(p, "b_") == 0 ||
std::strcmp(p, "begin_") == 0)
return MAKE_FUNCTOR(report_t::option_begin_);
else if (std::strcmp(p, "base") == 0)
return MAKE_FUNCTOR(report_t::option_base);
else if (std::strcmp(p, "by-payee") == 0)
return MAKE_FUNCTOR(report_t::option_by_payee);
break;
@ -534,6 +540,8 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::option_collapse);
else if (std::strcmp(p, "cleared") == 0)
return MAKE_FUNCTOR(report_t::option_cleared);
else if (std::strcmp(p, "cost") == 0)
return MAKE_FUNCTOR(report_t::option_cost);
else if (std::strcmp(p, "comm-as-payee") == 0)
return MAKE_FUNCTOR(report_t::option_comm_as_payee);
else if (std::strcmp(p, "code-as-payee") == 0)
@ -601,11 +609,17 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::option_period_);
else if (std::strcmp(p, "period_sort_") == 0)
return MAKE_FUNCTOR(report_t::option_period_sort_);
else if (std::strcmp(p, "price") == 0)
return MAKE_FUNCTOR(report_t::option_price);
else if (std::strcmp(p, "price_db_") == 0)
return MAKE_FUNCTOR(report_t::option_price_db_);
break;
case 'q':
if (std::strcmp(p, "quarterly") == 0)
return MAKE_FUNCTOR(report_t::option_quarterly);
else if (std::strcmp(p, "quantity") == 0)
return MAKE_FUNCTOR(report_t::option_quantity);
break;
case 'r':
@ -659,6 +673,11 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::option_date_format_);
break;
case 'B':
if (! *(p + 1))
return MAKE_FUNCTOR(report_t::option_cost);
break;
case 'C':
if (! *(p + 1))
return MAKE_FUNCTOR(report_t::option_cleared);
@ -674,6 +693,11 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::option_format_);
break;
case 'I':
if (! *(p + 1))
return MAKE_FUNCTOR(report_t::option_price);
break;
case 'J':
if (! *(p + 1))
return MAKE_FUNCTOR(report_t::option_total_data);
@ -684,6 +708,11 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::option_monthly);
break;
case 'O':
if (! *(p + 1))
return MAKE_FUNCTOR(report_t::option_quantity);
break;
case 'P':
if (! *(p + 1))
return MAKE_FUNCTOR(report_t::option_by_payee);

View file

@ -691,15 +691,16 @@ public:
return true;
}
#if 0
value_t option_ansi(call_scope_t& args) {
format_t::ansi_codes = true;
format_t::ansi_invert = false;
return true;
}
value_t option_ansi_invert(call_scope_t& args) {
format_t::ansi_codes =
format_t::ansi_invert = true;
return true;
}
//////////////////////////////////////////////////////////////////////
@ -708,40 +709,46 @@ public:
value_t option_base(call_scope_t& args) { // :
amount_t::keep_base = true;
return true;
}
value_t option_price_db(call_scope_t& args) { // :
config->price_db = optarg;
value_t option_price_db_(call_scope_t& args) { // :
session.price_db = args[0].as_string();
return true;
}
value_t option_price_exp(call_scope_t& args) { // Z:
config->pricing_leeway = std::atol(optarg) * 60;
value_t option_price_exp_(call_scope_t& args) { // Z:
session.pricing_leeway = lexical_cast<long>(args[0].as_string()) * 60;
return true;
}
value_t option_download(call_scope_t& args) { // Q
config->download_quotes = true;
session.download_quotes = true;
return true;
}
value_t option_quantity(call_scope_t& args) { // O
ledger::amount_expr = "amount";
ledger::total_expr = "total";
amount_expr = "amount";
total_expr = "total";
return true;
}
value_t option_basis(call_scope_t& args) { // B
ledger::amount_expr = "b";
ledger::total_expr = "B";
value_t option_cost(call_scope_t& args) { // B
amount_expr = "cost";
total_expr = "total_cost";
return true;
}
value_t option_price(call_scope_t& args) { // I
ledger::amount_expr = "i";
ledger::total_expr = "I";
amount_expr = "price";
total_expr = "price_total";
return true;
}
value_t option_market(call_scope_t& args) { // V
report->show_revalued = true;
ledger::amount_expr = "v";
ledger::total_expr = "V";
show_revalued = true;
display_total = "market_value(total_expr)";
return true;
}
#if 0
@ -768,7 +775,6 @@ public:
}
}
}
#endif
#endif
//