Better auto completion for transfert operation (not two times the same operation completed)
This commit is contained in:
@@ -410,10 +410,9 @@ std::vector<Operation>* KissCount::Search(QString* description, QDate* dateFrom,
|
||||
return _db->Search(_user, description, dateFrom, dateTo, amountFrom, amountTo, categories, types, accounts, true);
|
||||
}
|
||||
|
||||
bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType)
|
||||
bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType, int index)
|
||||
{
|
||||
std::vector<Operation>* operations;
|
||||
QDate* date ;
|
||||
//wxDateSpan threeMonths(0, 3); Not working :(
|
||||
std::vector<int> v;
|
||||
int i;
|
||||
@@ -425,15 +424,12 @@ bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month
|
||||
month += 12;
|
||||
}
|
||||
|
||||
date = new QDate(year, month, 0);
|
||||
QDate date = QDate(year, month, 0);
|
||||
|
||||
if (limitToType)
|
||||
operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, op.fix_cost ? +Database::FIX_OP : +Database::NON_FIX_OP, v, false);
|
||||
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, op.fix_cost ? +Database::FIX_OP : +Database::NON_FIX_OP, v, false);
|
||||
else
|
||||
operations = _db->Search(_user, &op.description, date, 0, 0, 0, v, Database::ALL_OP, v, false);
|
||||
|
||||
|
||||
delete date;
|
||||
operations = _db->Search(_user, &op.description, &date, 0, 0, 0, v, Database::ALL_OP, v, false);
|
||||
|
||||
if (!operations->size())
|
||||
{
|
||||
@@ -442,7 +438,7 @@ bool KissCount::SearchPreviousOperation(Operation* res, Operation& op, int month
|
||||
}
|
||||
|
||||
for(i=operations->size()-1; i>=0; i--)
|
||||
if (!(*operations)[i].meta)
|
||||
if (!(*operations)[i].meta && index--)
|
||||
{
|
||||
*res = (*operations)[i];
|
||||
delete operations;
|
||||
|
@@ -104,7 +104,7 @@ public:
|
||||
double* amountFrom, double* amountTo,
|
||||
std::vector<int> categories, int types, std::vector<int> accounts);
|
||||
|
||||
bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType);
|
||||
bool SearchPreviousOperation(Operation* res, Operation& op, int month, int year, bool limitToType, int index);
|
||||
|
||||
void GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo,
|
||||
std::map<int, std::map<int, std::map<int, double> > >* accountAmounts,
|
||||
|
Reference in New Issue
Block a user