Fix a bug in search (absolute amounts) and remove automatic dating for new fix operation
This commit is contained in:
parent
cc70c0f804
commit
7e41063b42
|
@ -953,13 +953,13 @@ std::vector<Operation>* Database::Search(User* user, wxString* description, wxDa
|
|||
if (amountFrom)
|
||||
{
|
||||
if (firstCond) req += wxT(" AND ") ; else firstCond = true;
|
||||
req += wxT("amount >= '") + *amountFrom + wxT("'");
|
||||
req += wxT("ABS(amount) >= ") + *amountFrom;
|
||||
}
|
||||
|
||||
if (amountTo)
|
||||
{
|
||||
if (firstCond) req += wxT(" AND ") ; else firstCond = true;
|
||||
req += wxT("amount <= '") + *amountTo + wxT("'");
|
||||
req += wxT("ABS(amount) <= ") + *amountTo;
|
||||
}
|
||||
|
||||
if (categories.size())
|
||||
|
@ -1025,13 +1025,13 @@ std::vector<Operation>* Database::Search(User* user, wxString* description, wxDa
|
|||
|
||||
if (dateFrom &&
|
||||
(int)op.year == dateFrom->GetYear() &&
|
||||
(int)op.month < dateFrom->GetMonth() &&
|
||||
(int)op.month <= dateFrom->GetMonth() &&
|
||||
(int)op.day < dateFrom->GetDay()-1)
|
||||
continue;
|
||||
|
||||
if (dateTo &&
|
||||
(int)op.year == dateTo->GetYear() &&
|
||||
(int)op.month > dateTo->GetMonth() &&
|
||||
(int)op.month >= dateTo->GetMonth() &&
|
||||
(int)op.day > dateTo->GetDay()-1)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -160,7 +160,8 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
|
|||
else
|
||||
{
|
||||
SetCellEditor(line, DATE, new CalendarEditor(0, curMonth, curYear));
|
||||
if (curDate.GetMonth() == curMonth &&
|
||||
if (!fix &&
|
||||
curDate.GetMonth() == curMonth &&
|
||||
curDate.GetYear() == curYear)
|
||||
{
|
||||
SetCellValue(line, DATE, wxString::Format(wxT("%02d/%02d/%d"), curDate.GetDay(), curMonth+1, curYear));
|
||||
|
@ -171,8 +172,9 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
|
|||
|
||||
if (fix)
|
||||
SET_ROW_COLOR(line, OWN_YELLOW)
|
||||
else
|
||||
SET_ROW_COLOR(line, OWN_GREEN);
|
||||
else
|
||||
SET_ROW_COLOR(line, OWN_GREEN);
|
||||
|
||||
SetReadOnly(line, CHECKED, true);
|
||||
SetReadOnly(line, DELETE, true);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,8 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
|
|||
delete amountFrom;
|
||||
return;
|
||||
}
|
||||
|
||||
if (af < 0) af *= -1;
|
||||
}
|
||||
|
||||
if (_amountTo->GetLineText(0) != wxT(""))
|
||||
|
@ -152,6 +154,8 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event)
|
|||
delete amountTo;
|
||||
return;
|
||||
}
|
||||
|
||||
if (at < 0) at *= -1;
|
||||
}
|
||||
|
||||
if (amountFrom && amountTo && af > at)
|
||||
|
|
Loading…
Reference in New Issue
Block a user