diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-14 14:08:52 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-14 14:08:52 -0600 |
commit | 8654cea10f6902719006d5975db7dc07b2fcc713 (patch) | |
tree | 6cf0608a089c234056746a467f739722687b645a /kmymoney2/reports | |
parent | 2a54aa58cfe166f48d6f1395cbc6c9bfd5e31bfc (diff) | |
download | kmymoney-8654cea10f6902719006d5975db7dc07b2fcc713.tar.gz kmymoney-8654cea10f6902719006d5975db7dc07b2fcc713.zip |
Update to upstream stable version 1.0.5
Diffstat (limited to 'kmymoney2/reports')
-rw-r--r-- | kmymoney2/reports/pivottable.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/kmymoney2/reports/pivottable.cpp b/kmymoney2/reports/pivottable.cpp index db73062..b75ffb9 100644 --- a/kmymoney2/reports/pivottable.cpp +++ b/kmymoney2/reports/pivottable.cpp @@ -825,9 +825,27 @@ void PivotTable::calculateBudgetMapping( void ) // // It will choose the first budget in the list for the start year of the report if no budget is select MyMoneyBudget budget = MyMoneyBudget(); + + TQValueList<MyMoneyBudget> budgets = file->budgetList(); + bool validBudget = false; + + //check that the selected budget is valid + if (m_config_f.budget() != "Any") { + TQValueList<MyMoneyBudget>::const_iterator budgets_it = budgets.begin(); + while( budgets_it != budgets.end() ) { + //pick the budget by id + if ((*budgets_it).id() == m_config_f.budget()) { + budget = file->budget((*budgets_it).id()); + validBudget = true; + break; + } + ++budgets_it; + } + } + //if no budget has been selected - if (m_config_f.budget() == "Any" ) { - TQValueList<MyMoneyBudget> budgets = file->budgetList(); + if (!validBudget ) { + TQValueList<MyMoneyBudget>::const_iterator budgets_it = budgets.begin(); while( budgets_it != budgets.end() ) { //pick the first budget that matches the report start year @@ -843,9 +861,6 @@ void PivotTable::calculateBudgetMapping( void ) //assign the budget to the report m_config_f.setBudget(budget.id(), m_config_f.isIncludingBudgetActuals()); - } else { - //pick the budget selected by the user - budget = file->budget( m_config_f.budget()); } // Dump the budget |