Fix two bugs (No entry in Search Panel and Date in Search (Database))
Add auto detection for account and category using description Auto add date with curMonth & curYear for new operation
This commit is contained in:
@@ -522,7 +522,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||
User* user = _kiss->GetUser();
|
||||
int row = event.GetRow()-1;
|
||||
int col = event.GetCol();
|
||||
Operation new_op, cur_op;
|
||||
Operation new_op, cur_op, op_tmp;
|
||||
int op_complete = 6, i;
|
||||
wxString value ;
|
||||
wxDateTime date;
|
||||
@@ -535,7 +535,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||
if (inModification) return;
|
||||
|
||||
inModification = true ;
|
||||
|
||||
|
||||
if (event.GetCol() == DEBIT)
|
||||
_grid->SetCellValue(event.GetRow(), CREDIT, wxT(""));
|
||||
else if (event.GetCol() == CREDIT)
|
||||
@@ -594,6 +594,20 @@ void AccountPanel::OnOperationModified(wxGridEvent& event)
|
||||
new_op.checked = false;
|
||||
op_complete--;
|
||||
|
||||
if (event.GetCol() == DESCRIPTION &&
|
||||
_grid->GetCellValue(event.GetRow(), CATEGORY) == wxT("") &&
|
||||
_grid->GetCellValue(event.GetRow(), ACCOUNT) == wxT(""))
|
||||
{
|
||||
if (_kiss->SearchPreviousOperation(&op_tmp, new_op.description, _curMonth-3, _curYear))
|
||||
{
|
||||
new_op.category = op_tmp.category;
|
||||
new_op.account = op_tmp.account;
|
||||
_grid->SetCellValue(event.GetRow(), CATEGORY, user->GetCategoryName(new_op.category));
|
||||
_grid->SetCellValue(event.GetRow(), ACCOUNT, user->GetAccountName(new_op.account));
|
||||
op_complete -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (col == CHECKED || col == CATEGORY)
|
||||
{
|
||||
color = user->GetCategory(new_op.category).color;
|
||||
|
||||
Reference in New Issue
Block a user