*** empty log message ***
This commit is contained in:
parent
7acc1306d9
commit
3c0caf1100
1 changed files with 7 additions and 7 deletions
14
journal.cc
14
journal.cc
|
|
@ -146,7 +146,8 @@ bool entry_base_t::finalize()
|
||||||
if (this_bal == other_bal)
|
if (this_bal == other_bal)
|
||||||
other_bal++;
|
other_bal++;
|
||||||
|
|
||||||
amount_t per_unit_cost = (*other_bal).second / (*this_bal).second;
|
amount_t per_unit_cost =
|
||||||
|
amount_t((*other_bal).second / (*this_bal).second).unround();
|
||||||
|
|
||||||
for (; x != transactions.end(); x++) {
|
for (; x != transactions.end(); x++) {
|
||||||
if ((*x)->cost || ((*x)->flags & TRANSACTION_VIRTUAL) ||
|
if ((*x)->cost || ((*x)->flags & TRANSACTION_VIRTUAL) ||
|
||||||
|
|
@ -157,12 +158,11 @@ bool entry_base_t::finalize()
|
||||||
balance -= (*x)->amount;
|
balance -= (*x)->amount;
|
||||||
|
|
||||||
entry_t * entry = dynamic_cast<entry_t *>(this);
|
entry_t * entry = dynamic_cast<entry_t *>(this);
|
||||||
if ((*x)->amount.commodity().annotated)
|
|
||||||
throw error("Cannot self-balance an annotated commodity");
|
if (! (*x)->amount.commodity().annotated)
|
||||||
|
(*x)->amount.annotate_commodity(abs(per_unit_cost),
|
||||||
(*x)->amount.annotate_commodity(abs(per_unit_cost),
|
entry ? entry->actual_date() : 0,
|
||||||
entry ? entry->actual_date() : 0,
|
entry ? entry->code : "");
|
||||||
entry ? entry->code : "");
|
|
||||||
|
|
||||||
(*x)->cost = new amount_t(- (per_unit_cost * (*x)->amount));
|
(*x)->cost = new amount_t(- (per_unit_cost * (*x)->amount));
|
||||||
balance += *(*x)->cost;
|
balance += *(*x)->cost;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue