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--;
new_op.formula = _displayedOperations[row].formula;
}
value = item(row, CREDIT)->text();
if (value.length())
else
{
new_op.amount = value.replace(".", "").toInt();
if (new_op.amount < 0)
{
new_op.amount *= -1.0;
setItem(row, DEBIT, new QTableWidgetItem(value.sprintf("%.2lf", (double)new_op.amount/100)));
}
op_complete--;
new_op.formula = _displayedOperations[row].formula;
value = item(row, CREDIT)->text();
if (value.length())
{
new_op.amount = value.replace(".", "").toInt();
if (new_op.amount < 0)
{
new_op.amount *= -1.0;
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();