KissCount

KissCount Commit Details

Date:2019-01-29 19:31:35 (8 months 19 days ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:ea6a3204168fa9b7c9ff61719ed8ef16ae3e7194
Parents: 1fbb920cb34ce74aebfddd858b228e1212023678
Message:Now fixed operations is not necessary bound to fix category

Changes:
Msrc/model/Database.cpp (1 diff)
Msrc/view/AccountPanel.cpp (1 diff)
Msrc/view/CostRepartitionBanner.cpp (2 diffs)
Msrc/view/SearchPanel.cpp (3 diffs)
Msrc/view/grid/GridAccount.cpp (6 diffs)

File differences

src/model/Database.cpp
16171617
16181618
16191619
1620
1620
1621
1622
1623
16211624
16221625
16231626
{
for (categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++)
{
req = "SELECT SUM(amount) as amount FROM operation AS o1 WHERE category='" + QString::number(categoryIt->id) + "'";
if (categoryIt->id == 1)
req = "SELECT SUM(amount) as amount FROM operation AS o1 WHERE (category='" + QString::number(categoryIt->id) + "' OR fix_cost='1')";
else
req = "SELECT SUM(amount) as amount FROM operation AS o1 WHERE category='" + QString::number(categoryIt->id) + "'";
accountIt = user->_accounts.begin();
req += " AND (account IN('" + QString::number(accountIt->id);
accountIt++;
src/view/AccountPanel.cpp
632632
633633
634634
635
636
637
635638
639
636640
637641
638642
else
{
if ((!op.transfert || force_debit) && user->GetCategoryName(op.category) != _("Unknown"))
{
if (op.fix_cost && op.category != 1)
_categoriesValues[0] += -op.amount ;
_categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ;
}
if (!op.transfert || force_debit)
{
src/view/CostRepartitionBanner.cpp
5252
5353
5454
55
56
55
56
57
5758
5859
5960
......
149150
150151
151152
153
152154
153
154
155155
156
156
157
158
157159
158160
159161
legend->setShowToolTips(true);
_pie->setMargins(QMargins(5, 5, 5, 5));
for(i=0; i<nbCategories; i++)
/* Ignore fix category */
for(i=1; i<nbCategories; i++)
{
slice = series->append(_categories[i], 0);
if (i < wxUI::MAX_CATEGORY)
if (!i)
_statsGrid->item(i, 1)->setText(v.sprintf("%.2lf (%02d %%)", (double)categoriesValues[i]/100, (int)percents));
else
{
_statsGrid->item(i+1, 1)->setText(v.sprintf("%.2lf (%02d %%)", (double)categoriesValues[i]/100, (int)percents));
slices[i]->setValue(categoriesValues[i] / 100);
slices[i]->setLabelVisible(categoriesValues[i] != 0.0);
slices[i-1]->setValue(categoriesValues[i] / 100);
slices[i-1]->setLabelVisible(categoriesValues[i] != 0.0);
}
}
value = totalDebit - categoriesValues[0];
src/view/SearchPanel.cpp
216216
217217
218218
219
220219
221220
222
223221
224222
225223
......
231229
232230
233231
234
235
232
236233
237234
238235
......
248245
249246
250247
251
252248
253249
254250
255251
256
257252
258253
259254
static void ChangeCategory(Operation* op, void** params)
{
int* category = (int*) params[0];
bool* fix = (bool*) params[1];
op->category = *category;
op->fix_cost = * fix;
}
void SearchPanel::OnButtonChangeCategory()
std::vector<Operation>::iterator it;
QString res;
int category;
bool fix;
void * params[] = {&category, &fix};
void * params[] = {&category};
if (!_operations) return;
{
a = categories.indexOf(res);
category = user->_categories[a-1].id ;
fix = user->_categories[a-1].fix_cost;
}
else
{
category = 0;
fix = false;
}
_grid->MassUpdate(rows, true, ChangeCategory, params);
src/view/grid/GridAccount.cpp
431431
432432
433433
434
435
436
437434
438435
439436
......
459456
460457
461458
462
463
459
460
464461
465462
466463
......
481478
482479
483480
481
482
483
484484
485485
486486
487
487
488
489
488490
489491
490492
......
705707
706708
707709
710
708711
709712
710713
......
718721
719722
720723
721
724
725
726
727
728
729
722730
723731
724732
......
11471155
11481156
11491157
1150
1158
1159
1160
1161
1162
1163
1164
1165
11511166
11521167
11531168
if (fix)
{
item = new QTableWidgetItem(_("Fix"));
setItem(line, CATEGORY, item);
SET_READ_ONLY(item);
_fixCosts++;
}
if (!op.meta)
setItem(line, ACCOUNT, new QTableWidgetItem(user->GetAccountName(op.account)));
if (!fix && !op.meta)
setItem(line, CATEGORY, new QTableWidgetItem(_(cat.name.toStdString().c_str())));
if (!op.meta)
setItem(line, CATEGORY, new QTableWidgetItem(_(cat.name.toStdString().c_str())));
if (tag.id)
setItem(line, TAG, new QTableWidgetItem(_(tag.name.toStdString().c_str())));
setItem(line, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)amount/100)));
}
if (line <= _fixCosts)
cat = user->GetCategory(1);
if (op.category)
color = cat.backcolor;
else
color = view::OWN_GREEN;
{
color = (op.fix_cost) ? view::OWN_YELLOW : view::OWN_GREEN;
}
if (op.checked)
{
QColor color;
int r,g,b;
User* user = _kiss->GetUser();
Category cat;
if (!force)
{
checkBox->setCheckState(check ? Qt::Checked : Qt::Unchecked);
}
color = user->GetCategory(op.category).backcolor;
if (line <= _fixCosts)
cat = user->GetCategory(1);
else
cat = user->GetCategory(op.category);
color = cat.backcolor;
if (check)
{
(_displayedOperations)[row] = new_op;
cat = user->GetCategory(new_op.category);
CheckOperation(new_op, row, new_op.checked, true);
SET_ROW_FONT(row, user->GetCategoryFont(cat.id));
if (row <= _fixCosts)
{
SET_ROW_FONT(row, user->GetCategoryFont(0));
}
else
{
SET_ROW_FONT(row, user->GetCategoryFont(cat.id));
}
}
}
// Add an operation

Archive Download the corresponding diff file