Commit 72cf5d04 authored by Hugo Hörnquist's avatar Hugo Hörnquist

diff = actual - expected, as it should be

parent 7fa55fec
......@@ -346,7 +346,7 @@ void MainWindow::on_inventoryModel_dataChanged(const QModelIndex &topLeft, const
int actual = model->data(model->index(row, 5)).toInt(&number);
model->setData(model->index(row, 6),
number ? expected - actual
number ? actual - expected
: QVariant());
}
}
......
......@@ -209,7 +209,7 @@ SELECT d.id AS id,
p.name AS name,
s.active AS expected,
d.amount AS actual,
s.active - d.amount as diff
d.amount - s.active AS diff
FROM products p
INNER JOIN stock s ON p.id = s.product_id
INNER JOIN diff_help d ON p.id = d.product_id;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment