Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Stupan
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hugo Hörnquist
Stupan
Commits
ecb57c8b
Commit
ecb57c8b
authored
Apr 13, 2018
by
Hugo Hörnquist
Browse files
Options
Downloads
Patches
Plain Diff
Add total to account list
parent
c6510599
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
admin/mainwindow.cpp
+22
-4
22 additions, 4 deletions
admin/mainwindow.cpp
admin/mainwindow.h
+1
-0
1 addition, 0 deletions
admin/mainwindow.h
with
23 additions
and
4 deletions
admin/mainwindow.cpp
+
22
−
4
View file @
ecb57c8b
...
@@ -59,6 +59,11 @@
...
@@ -59,6 +59,11 @@
// TODO stock diff should show null when actual field is null
// TODO stock diff should show null when actual field is null
// TODO possibly allow each money account in the database two have
// two nemes. One "true" name, which can alse be used as a key.
// And one "fancy" name, that should never be checked agains, and
// can be allowed to be translated.
/*
/*
* All internal prices should be in öre
* All internal prices should be in öre
* Never trust a front end number unless you KNOW it's good
* Never trust a front end number unless you KNOW it's good
...
@@ -372,16 +377,29 @@ void MainWindow::setMoneyAccountValues() {
...
@@ -372,16 +377,29 @@ void MainWindow::setMoneyAccountValues() {
QSqlRecord
rec
=
accModel
->
record
();
QSqlRecord
rec
=
accModel
->
record
();
QVariant
projected_price
=
get_projected_stock_value
();
rec
.
setValue
(
"name"
,
QVariant
(
"Lager (projicerat)"
));
rec
.
setValue
(
"name"
,
QVariant
(
"Lager (projicerat)"
));
rec
.
setValue
(
"amount"
,
QVariant
(
QString
(
"%1"
).
arg
(
get_projected_stock_value
().
toDouble
()
/
100.0
,
rec
.
setValue
(
"amount"
,
QVariant
(
formatMoney
(
projected_price
.
toDouble
()
/
100.0
)));
0
,
'f'
,
2
)));
accModel
->
insertRecord
(
-
1
,
rec
);
accModel
->
insertRecord
(
-
1
,
rec
);
QVariant
buy_price
=
get_acquistion_stock_value
();
rec
.
setValue
(
"name"
,
QVariant
(
"Lager (inköp)"
));
rec
.
setValue
(
"name"
,
QVariant
(
"Lager (inköp)"
));
rec
.
setValue
(
"amount"
,
QVariant
(
QString
(
"%1"
).
arg
(
get_acquistion_stock_value
().
toDouble
()
/
100.0
,
rec
.
setValue
(
"amount"
,
QVariant
(
formatMoney
(
buy_price
.
toDouble
()
/
100.0
)));
0
,
'f'
,
2
)));
accModel
->
insertRecord
(
-
1
,
rec
);
QSqlQuery
query
(
"SELECT sum(amount) FROM money"
);
if
(
query
.
next
())
{
qlonglong
sum
=
query
.
value
(
0
).
toLongLong
()
+
projected_price
.
toLongLong
();
rec
.
setValue
(
"name"
,
QVariant
(
"Totalt (projicerat)"
));
rec
.
setValue
(
"amount"
,
QVariant
(
formatMoney
((
double
)
sum
/
100.0
)));
accModel
->
insertRecord
(
-
1
,
rec
);
accModel
->
insertRecord
(
-
1
,
rec
);
}
}
}
QString
MainWindow
::
formatMoney
(
double
in
){
return
QString
(
"%1"
).
arg
(
in
,
0
,
'f'
,
2
);
}
/*
/*
* This updates the QSqlTableModel to contain the same data as the database.
* This updates the QSqlTableModel to contain the same data as the database.
...
...
This diff is collapsed.
Click to expand it.
admin/mainwindow.h
+
1
−
0
View file @
ecb57c8b
...
@@ -110,6 +110,7 @@ private:
...
@@ -110,6 +110,7 @@ private:
QVariant
get_acquistion_stock_value
();
QVariant
get_acquistion_stock_value
();
void
setStockValues
();
void
setStockValues
();
void
setAccTransferCombo
();
void
setAccTransferCombo
();
QString
formatMoney
(
double
in
);
void
open_till
();
void
open_till
();
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment