diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index fb5885c..19ad49a 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -705,6 +705,11 @@ void GridAccount::OnOperationModified(wxGridEvent& event) if (value.Length()) { value.ToDouble(&new_op.amount); + if (new_op.amount < 0) + { + new_op.amount *= -1.0; + SetCellValue(row, DEBIT, wxString::Format(wxT("%.2lf"), new_op.amount)); + } if (new_op.amount != 0.0) new_op.amount *= -1.0; op_complete--; wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, DEBIT); @@ -712,17 +717,21 @@ void GridAccount::OnOperationModified(wxGridEvent& event) pEditor->DecRef(); } - value = GetCellValue(row, CREDIT); + value = GetCellValue(row, CREDIT); if (value.Length()) { value.ToDouble(&new_op.amount); + if (new_op.amount < 0) + { + new_op.amount *= -1.0; + SetCellValue(row, CREDIT, wxString::Format(wxT("%.2lf"), new_op.amount)); + } op_complete--; wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, CREDIT); new_op.formula = pEditor->GetFormula(); pEditor->DecRef(); } - if (new_op.amount < 0) new_op.amount *= -1; value = GetCellValue(row, CATEGORY); if (value.Length())