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