Fix a bug : Don't add operation if amount not set

This commit is contained in:
Grégory Soutadé 2015-06-04 20:18:35 +02:00
parent f0e0aba4f3
commit 20be059f27
1 changed files with 16 additions and 11 deletions

View File

@ -1008,18 +1008,23 @@ void GridAccount::OnOperationModified(int row, int col)
op_complete--; op_complete--;
new_op.formula = _displayedOperations[row].formula; new_op.formula = _displayedOperations[row].formula;
} }
else
value = item(row, CREDIT)->text();
if (value.length())
{ {
new_op.amount = value.replace(".", "").toInt(); value = item(row, CREDIT)->text();
if (new_op.amount < 0) if (value.length())
{ {
new_op.amount *= -1.0; new_op.amount = value.replace(".", "").toInt();
setItem(row, DEBIT, new QTableWidgetItem(value.sprintf("%.2lf", (double)new_op.amount/100))); if (new_op.amount < 0)
} {
op_complete--; new_op.amount *= -1.0;
new_op.formula = _displayedOperations[row].formula; setItem(row, DEBIT, new QTableWidgetItem(value.sprintf("%.2lf", (double)new_op.amount/100)));
}
op_complete--;
new_op.formula = _displayedOperations[row].formula;
}
else
// Don't add operation if amount not set
op_complete += 100;
} }
value = item(row, CATEGORY)->text(); value = item(row, CATEGORY)->text();