All Values are now in fix point
This commit is contained in:
@@ -335,7 +335,7 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
|
||||
std::vector<Operation>::iterator it;
|
||||
std::vector<QString>::iterator it2;
|
||||
int r, g, b;
|
||||
double amount;
|
||||
int amount;
|
||||
QColor color;
|
||||
QDate curDate = QDate::currentDate();
|
||||
QString description, v;
|
||||
@@ -377,10 +377,10 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
|
||||
setItem(line, OP_DATE, new QTableWidgetItem(_kiss->FormatDate(op.day+1, month+1, year)));
|
||||
if (op.amount < 0)
|
||||
{
|
||||
setItem(line, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", -op.amount)));
|
||||
setItem(line, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)-op.amount/100)));
|
||||
}
|
||||
else
|
||||
setItem(line, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", op.amount)));
|
||||
setItem(line, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)op.amount/100)));
|
||||
|
||||
if (!op.meta)
|
||||
setItem(line, ACCOUNT, new QTableWidgetItem(user->GetAccountName(op.account)));
|
||||
@@ -403,8 +403,8 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
|
||||
{
|
||||
amount = _kiss->MetaPositiveAmount(op.id);
|
||||
|
||||
setItem(line, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", amount)));
|
||||
setItem(line, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", amount)));
|
||||
setItem(line, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)amount/100)));
|
||||
setItem(line, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)amount/100)));
|
||||
}
|
||||
|
||||
if (op.category)
|
||||
@@ -871,7 +871,7 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
unsigned char r, g, b;
|
||||
std::vector<int>::iterator it;
|
||||
Operation op, op2;
|
||||
double amount;
|
||||
int amount;
|
||||
QFont font;
|
||||
Category cat ;
|
||||
bool fix_cost;
|
||||
@@ -945,11 +945,11 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
value = item(row, DEBIT)->text();
|
||||
if (value.length())
|
||||
{
|
||||
new_op.amount = value.toDouble();
|
||||
new_op.amount = value.toDouble()*100;
|
||||
if (new_op.amount < 0)
|
||||
{
|
||||
new_op.amount *= -1.0;
|
||||
setItem(row, DEBIT, new QTableWidgetItem(value.sprintf("%.2lf", new_op.amount)));
|
||||
setItem(row, DEBIT, new QTableWidgetItem(value.sprintf("%.2lf", (double)new_op.amount/100)));
|
||||
}
|
||||
if (new_op.amount != 0.0) new_op.amount *= -1.0;
|
||||
op_complete--;
|
||||
@@ -959,11 +959,11 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
value = item(row, CREDIT)->text();
|
||||
if (value.length())
|
||||
{
|
||||
new_op.amount = value.toDouble();
|
||||
new_op.amount = value.toDouble()*100;
|
||||
if (new_op.amount < 0)
|
||||
{
|
||||
new_op.amount *= -1.0;
|
||||
setItem(row, DEBIT, new QTableWidgetItem(value.sprintf("%.2lf", new_op.amount)));
|
||||
setItem(row, DEBIT, new QTableWidgetItem(value.sprintf("%.2lf", (double)new_op.amount/100)));
|
||||
}
|
||||
op_complete--;
|
||||
new_op.formula = _displayedOperations[row].formula;
|
||||
@@ -1131,20 +1131,20 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||
{
|
||||
amount = _kiss->MetaPositiveAmount(new_op.id);
|
||||
|
||||
setItem(row, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", amount)));
|
||||
setItem(row, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", amount)));
|
||||
setItem(row, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)amount/100)));
|
||||
setItem(row, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)amount/100)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_displayedOperations[row].amount < 0)
|
||||
{
|
||||
setItem(row, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", -new_op.amount)));
|
||||
setItem(row, DEBIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)-new_op.amount/100)));
|
||||
setItem(row, CREDIT, new QTableWidgetItem(""));
|
||||
}
|
||||
else
|
||||
{
|
||||
setItem(row, DEBIT, new QTableWidgetItem(""));
|
||||
setItem(row, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", new_op.amount)));
|
||||
setItem(row, CREDIT, new QTableWidgetItem(v.sprintf("%.2lf", (double)new_op.amount/100)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user