Commit 31f8fff2 authored by Marc Hübner's avatar Marc Hübner Committed by Albert Astals Cid
Browse files

Display the sum of sub-categories when category is expanded

Adds a new column to the categories view. The (previously existing) "total" column does now always hold the summed value (no matter whether a subtotal position is expanded or collapsed). The new "posted amount" column only holds the value that was assigned to the category directly (that is, without subcategories).

BUGS: 373550
REVIEW: 129852
parent 6d941abe
......@@ -199,10 +199,17 @@ public:
model->setData(newIndex, QVariant(Qt::AlignRight | Qt::AlignVCenter), Qt::TextAlignmentRole);
// Total Value
newIndex = model->index(index.row(), index.column() + TotalValue, index.parent());
newIndex = model->index(index.row(), index.column() + TotalValue , index.parent());
model->setData(newIndex, MyMoneyUtils::formatMoney(accountTotalValue, m_file->baseCurrency()), Qt::DisplayRole);
model->setData(newIndex, MyMoneyUtils::formatMoney(accountTotalValue, m_file->baseCurrency()), AccountValueDisplayRole);
model->setData(newIndex, MyMoneyUtils::formatMoney(accountTotalValue, m_file->baseCurrency()), AccountTotalValueDisplayRole);
model->setData(newIndex, font, Qt::FontRole);
model->setData(newIndex, QVariant(Qt::AlignRight | Qt::AlignVCenter), Qt::TextAlignmentRole);
//Posted Value
newIndex = model->index(index.row(), index.column() + PostedValue , index.parent());
model->setData(newIndex, MyMoneyUtils::formatMoney(accountValue, m_file->baseCurrency()), Qt::DisplayRole);
model->setData(newIndex, MyMoneyUtils::formatMoney(accountValue, m_file->baseCurrency()), AccountValueDisplayRole);
model->setData(newIndex, MyMoneyUtils::formatMoney(accountTotalValue, m_file->baseCurrency()), AccountTotalValueDisplayRole);
model->setData(newIndex, font, Qt::FontRole);
model->setData(newIndex, QVariant(Qt::AlignRight | Qt::AlignVCenter), Qt::TextAlignmentRole);
}
......@@ -423,6 +430,9 @@ void AccountsModel::init()
case TotalBalance:
headerLabels << i18n("Total Balance");
break;
case PostedValue:
headerLabels << i18n("Posted Value");
break;
case TotalValue:
headerLabels << i18n("Total Value");
break;
......
......@@ -86,6 +86,7 @@ public:
VAT,
CostCenter,
TotalBalance,
PostedValue,
TotalValue,
LastColumnMarker
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment