Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Stupan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Hugo Hörnquist
Stupan
Commits
666fbbc0
Commit
666fbbc0
authored
Dec 21, 2018
by
Hugo Hörnquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start adding past drainage view.
parent
34744f27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
14 deletions
+69
-14
admin/mainwindow.cpp
admin/mainwindow.cpp
+25
-4
admin/mainwindow.ui
admin/mainwindow.ui
+44
-10
No files found.
admin/mainwindow.cpp
View file @
666fbbc0
...
...
@@ -316,7 +316,28 @@ MainWindow::MainWindow(QWidget *parent) :
updateCurrentDrainageStatus
();
// TODO past drainages
// TODO default values in drainage table are wrong!
/* PAST DRAINAGES */
// TODO show how much was sold during a drainage, and how much we lost during it
QSqlQueryModel
*
pastDrainageModel
=
new
QSqlQueryModel
();
pastDrainageModel
->
setQuery
(
"SELECT id, "
// " datetime(start_time, 'localtime') AS Starttid, "
// " datetime(end_time, 'localtime') AS Sluttid, "
" decrease as [Kr/Tid], "
" how_often_minutes AS [Hur ofta], "
" min_price as [Minimipris] "
"FROM drainage "
"WHERE strftime('%s', end_time) < strftime('%s', 'now') "
"ORDER BY start_time"
);
ui
->
drainagePastView
->
setModel
(
pastDrainageModel
);
ui
->
drainagePastView
->
hideColumn
(
0
);
ui
->
drainagePastView
->
setItemDelegateForColumn
(
3
,
monDel
);
ui
->
drainagePastView
->
setItemDelegateForColumn
(
1
,
monDel
);
ui
->
drainagePastView
->
header
()
->
setSectionResizeMode
(
QHeaderView
::
ResizeToContents
);
// ============= Money ==============================
...
...
@@ -723,10 +744,10 @@ void MainWindow::updateCurrentDrainageStatus()
"LIMIT 1"
);
if
(
currentDrainageQuery
.
next
())
{
QString
startStr
=
currentDrainageQuery
.
value
(
0
).
toString
();
QString
endStr
=
currentDrainageQuery
.
value
(
1
).
toString
();
QString
startStr
=
currentDrainageQuery
.
value
(
0
).
toString
();
QString
endStr
=
currentDrainageQuery
.
value
(
1
).
toString
();
double
decreaseStr
=
currentDrainageQuery
.
value
(
2
).
toDouble
();
QString
minutesStr
=
currentDrainageQuery
.
value
(
3
).
toString
();
QString
minutesStr
=
currentDrainageQuery
.
value
(
3
).
toString
();
double
minStr
=
currentDrainageQuery
.
value
(
4
).
toDouble
();
ui
->
drainageLabel
->
setText
(
QString
(
"%1 kr/%2 min, ner till %3 kr
\n
Mellan %4 och %5 lokal tid"
)
.
arg
(
decreaseStr
,
0
,
'f'
,
2
)
...
...
admin/mainwindow.ui
View file @
666fbbc0
...
...
@@ -697,20 +697,54 @@
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
Kommande Tömningar (lokal tid):
</string>
<widget
class=
"QSplitter"
name=
"splitter"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Expanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget
class=
"QTreeView"
name=
"drainageView"
>
<property
name=
"alternatingRowColors"
>
<bool>
true
</bool>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"
rootIsDecorated
"
>
<property
name=
"
childrenCollapsible
"
>
<bool>
false
</bool>
</property>
<widget
class=
"QWidget"
name=
"layoutWidget"
native=
"true"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_15"
>
<item>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
Kommande Tömningar (lokal tid):
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QTreeView"
name=
"drainageView"
>
<property
name=
"alternatingRowColors"
>
<bool>
true
</bool>
</property>
<property
name=
"rootIsDecorated"
>
<bool>
false
</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"layoutWidget"
native=
"true"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_17"
>
<item>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"text"
>
<string>
Gånga tömmningar
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QTreeView"
name=
"drainagePastView"
/>
</item>
</layout>
</widget>
</widget>
</item>
<item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment