diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 499ebf8..cf81de2 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -503,12 +503,12 @@ void AccountPanel::UpdateStats() value = _accountsInitValues[accountIt->id]; value2 = (*notChecked)[accountIt->id]; - _accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2)); + _accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2)); value = curAccountAmount[accountIt->id]; - _accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2)); + _accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2)); _accountsGrid->SetCellTextColour(i, ACCOUNT_CUR, (value >= 0.0) ? wxColor(0x00, 0x00, 0x00) : wxColor(0xFF, 0x00, 0x00)); value = finalAccountAmount[accountIt->id]; - _accountsGrid->SetCellValue(i, ACCOUNT_FINAL, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2)); + _accountsGrid->SetCellValue(i, ACCOUNT_FINAL, wxString::Format(wxT("%.2lf (%.2lf)"), value, value-value2)); } } diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index e2fb30f..ae7da1f 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -273,6 +273,8 @@ void PreferencesPanel::InitCategories(User* user) wxFont font = user->GetCategoryFont(it->id); SET_ROW_FONT(curLine, font); } + + _categoriesGrid->SetCellAlignment(curLine, CATEGORY_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); } _categoriesGrid->SetReadOnly(0, CATEGORY_NAME, true); diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index e7b8ed6..782261d 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -440,7 +440,7 @@ void GridAccount::DeleteOperation(const Operation& op) void GridAccount::InsertIntoGrid(Operation& op) { - int i; + int i, a; User* user = _kiss->GetUser(); for(i=0; i<(int)_displayedOperations.size(); i++) @@ -468,9 +468,24 @@ void GridAccount::InsertIntoGrid(Operation& op) else if (!(_displayedOperations)[i].fix_cost && op.fix_cost) i --; - _operations->push_back(op); + for (a=0; a<(int)_operations->size(); a++) + { + if ((*_operations)[a].fix_cost && !op.fix_cost) continue; + if (!(*_operations)[a].fix_cost && op.fix_cost) + { + a--; + break; + } + if ((*_operations)[a].day > op.day) + { + a--; + break; + } + } + + _operations->insert(_operations->begin()+a, op); - InsertOperationWithWeek(user, (*_operations)[_operations->size()-1], i, op.fix_cost, _curMonth, _curYear); + InsertOperationWithWeek(user, (*_operations)[a], i, op.fix_cost, _curMonth, _curYear); } void GridAccount::RemoveMeta(Operation& op, int line, bool removeRoot, bool deleteOp) @@ -1234,6 +1249,8 @@ void GridAccount::Group() UpdateMeta(op); InsertIntoGrid(op); + + UpdateOperation(op); }