Sun, 24 Apr 2022 22:22:22 +0200
Added the largest part of print recipe.
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Printer.cpp is part of bmsapp. |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * bmsapp is free software: you can redistribute it and/or modify |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * the Free Software Foundation, either version 3 of the License, or |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * bmsapp is distributed in the hope that it will be useful, |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | */ |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #include "PrinterDialog.h" |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
18 | #include "Utils.h" |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
19 | #include "EditRecipe.h" |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | #include "config.h" |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
90
diff
changeset
|
21 | #include "global.h" |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | #include <QPrintPreviewDialog> |
90
2396457a8167
Moved functions from bmsapp.cpp to MainWindow.cpp
Michiel Broek <mbroek@mbse.eu>
parents:
88
diff
changeset
|
24 | #include <QDebug> |
2396457a8167
Moved functions from bmsapp.cpp to MainWindow.cpp
Michiel Broek <mbroek@mbse.eu>
parents:
88
diff
changeset
|
25 | #include <QtSql> |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | PrinterDialog::PrinterDialog(int job, int rec, QWidget* parent) : QDialog(parent) |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | { |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | qDebug() << "PrinterDialog start job" << job << "rec" << rec; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | p_job = job; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | p_rec = rec; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | QPrinter printer(QPrinter::ScreenResolution); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | QPrintPreviewDialog preview(&printer, this); |
88
64cf5468fd22
Improve the CMakeLists.txt. Cleanup unused variables. Removed som debug messages.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
37 | connect(&preview, &QPrintPreviewDialog::paintRequested, this, &PrinterDialog::printDocument); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | preview.exec(); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | |
88
64cf5468fd22
Improve the CMakeLists.txt. Cleanup unused variables. Removed som debug messages.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
42 | PrinterDialog::~PrinterDialog() {} |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | void PrinterDialog::printDocument(QPrinter *printer) |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | { |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | qDebug() << "PrinterDialog printDocument()"; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | QRect rectangle; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | QRect boundingRect; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | QPainter painter; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | QString w; |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
53 | QSqlQuery query; |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
55 | const QColor c_header(255, 150, 100, 255); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
56 | const QColor c_line1( 210, 245, 255, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
57 | const QColor c_line2( 255, 255, 210, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
58 | const QColor f_line( 250, 195, 65, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
59 | const QColor h_line( 100, 250, 65, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
60 | const QColor y_line( 175, 175, 255, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
61 | const QColor mw_line( 240, 140, 130, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
62 | const QColor mf_line( 95, 180, 25, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
63 | const QColor ms_line( 240, 250, 65, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
64 | const QColor mo_line( 210, 245, 255, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
65 | const QColor m_line( 175, 175, 255, 255); // also y_line |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
66 | const QColor w_line( 120, 255, 250, 255); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
67 | |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
68 | const QStringList y_unit({tr("pkg"), tr("gr"), tr("ml"), tr("ml"), tr("ml"), tr("ml"), tr("gr")}); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
69 | const QStringList ibu_method({ "Tinseth", "Rager", "Daniels", "Garetz", "Mosher", "Noonan" }); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
70 | const QStringList color_method({ "Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" }); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | painter.begin(printer); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | qreal y = 0; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | if (p_job == PR_SUPPLIES) { |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
76 | /* |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
77 | * Print supplies in stock |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
78 | */ |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | double tot_fermentables = 0, tot_hops = 0, tot_yeasts = 0, tot_miscs = 0; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
81 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
82 | y = 120; |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | /* Fermentables supplies header */ |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | painter.setPen(Qt::black); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
86 | painter.fillRect( 0, y, 735, 20, c_header); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | painter.drawText( 0, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | painter.drawText( 90, y+4, 100, 20, Qt::AlignLeft, tr("Supplier")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | painter.drawText(190, y+4, 270, 20, Qt::AlignLeft, tr("Fermentable")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, tr("Stock")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | y += 20; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
95 | query.exec("SELECT type,name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY type,supplier,name"); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | query.first(); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | for (int i = 0 ; i < query.size() ; i++ ) { |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
98 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
99 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
100 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
101 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
102 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
103 | painter.fillRect( 0, y, 735, 20, (i % 2) ? c_line1:c_line2); |
155
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
104 | painter.drawText( 0, y+4, 90, 20, Qt::AlignLeft, fermentable_types[query.value(0).toInt()]); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | painter.drawText( 90, y+4, 100, 20, Qt::AlignLeft, query.value(2).toString()); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | painter.drawText(190, y+4, 270, 20, Qt::AlignLeft, query.value(1).toString()); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | w = QString("%1 kg").arg(query.value(3).toDouble(), 10, 'f', 3); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | w = QString("%1 €").arg(query.value(4).toDouble(), 8, 'f', 2); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | w = QString("%1 €").arg(query.value(3).toDouble() * query.value(4).toDouble(), 8, 'f', 2); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | tot_fermentables += (query.value(3).toDouble() * query.value(4).toDouble()); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | query.next(); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | y += 20; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | } |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
117 | painter.fillRect( 0, y, 735, 20, c_header); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | painter.drawText( 0, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | w = QString("%1 €").arg(tot_fermentables, 8, 'f', 2); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | y += 20; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
123 | /* Hops supplies */ |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | query.exec("SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name"); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
126 | if ((y + 80 + (query.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
127 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
128 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
129 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
130 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
131 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
132 | } |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | painter.setPen(Qt::black); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
135 | painter.fillRect( 0, y, 735, 20, c_header); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Country")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | painter.drawText(120, y+4, 260, 20, Qt::AlignLeft, tr("Hop name")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | painter.drawText(380, y+4, 80, 20, Qt::AlignLeft, tr("Form")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, tr("Stock")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | y += 20; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | for (int i = 0; i < query.size(); i++) { |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
145 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
146 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
147 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
148 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
149 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
150 | painter.fillRect( 0, y, 735, 20, (i % 2) ? c_line1:c_line2); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, query.value(2).toString()); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | painter.drawText(120, y+4, 260, 20, Qt::AlignLeft, query.value(0).toString()); |
155
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
153 | painter.drawText(380, y+4, 80, 20, Qt::AlignLeft, hop_forms[query.value(1).toInt()]); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | if (query.value(3).toDouble() < 0.6) |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | w = QString("%1 gr").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | else |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | w = QString("%1 kg").arg(query.value(3).toDouble(), 10, 'f', 3); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | w = QString("%1 €").arg(query.value(4).toDouble(), 8, 'f', 2); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | w = QString("%1 €").arg(query.value(3).toDouble() * query.value(4).toDouble(), 8, 'f', 2); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | tot_hops += (query.value(3).toDouble() * query.value(4).toDouble()); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
164 | query.next(); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | y += 20; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | } |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
167 | painter.fillRect( 0, y, 735, 20, c_header); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | painter.drawText( 0, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | w = QString("%1 €").arg(tot_hops, 8, 'f', 2); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | y += 20; |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
173 | /* Yeasts supplies */ |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | query.exec("SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
175 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
176 | if ((y + 80 + (query.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
177 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
178 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
179 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
180 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
181 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
182 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
183 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
184 | painter.setPen(Qt::black); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
185 | painter.fillRect( 0, y, 735, 20, c_header); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
186 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Laboratory")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
187 | painter.drawText(120, y+4, 120, 20, Qt::AlignLeft, tr("Product")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
188 | painter.drawText(240, y+4, 220, 20, Qt::AlignLeft, tr("Yeast")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
189 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, tr("Stock")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
190 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
191 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
192 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
193 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
194 | for (int i = 0; i < query.size(); i++) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
195 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
196 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
197 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
198 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
199 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
200 | painter.fillRect( 0, y, 735, 20, (i % 2) ? c_line1:c_line2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
201 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, query.value(1).toString()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
202 | painter.drawText(120, y+4, 120, 20, Qt::AlignLeft, query.value(2).toString()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
203 | painter.drawText(240, y+4, 220, 20, Qt::AlignLeft, query.value(0).toString()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
204 | if (query.value(3).toInt() == 0) |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
205 | w = QString("%1 %2").arg(query.value(4).toDouble(), 10, 'f', 1).arg(y_unit[query.value(3).toInt()]); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
206 | else |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
207 | w = QString("%1 %2").arg(query.value(4).toDouble() * 1000.0, 10, 'f', 1).arg(y_unit[query.value(3).toInt()]); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
208 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
209 | w = QString("%1 €").arg(query.value(5).toDouble(), 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
210 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
211 | w = QString("%1 €").arg(query.value(4).toDouble() * query.value(5).toDouble(), 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
212 | tot_yeasts += (query.value(4).toDouble() * query.value(5).toDouble()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
213 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
214 | query.next(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
215 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
216 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
217 | painter.fillRect( 0, y, 735, 20, c_header); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
218 | painter.drawText( 0, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
219 | w = QString("%1 €").arg(tot_yeasts, 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
220 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
221 | y += 20; |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
222 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
223 | /* Miscs supplies */ |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
224 | query.exec("SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name"); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
226 | if ((y + 80 + (query.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
227 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
228 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
229 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
230 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
231 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
232 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
233 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
234 | painter.setPen(Qt::black); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
235 | painter.fillRect( 0, y, 735, 20, c_header); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
236 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Type")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
237 | painter.drawText(120, y+4, 340, 20, Qt::AlignLeft, tr("Ingredient")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
238 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, tr("Stock")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
239 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, tr("Price/Kg")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
240 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, tr("Value")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
241 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
242 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
243 | for (int i = 0; i < query.size(); i++) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
244 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
245 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
246 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
247 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
248 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
249 | painter.fillRect( 0, y, 735, 20, (i % 2) ? c_line1:c_line2); |
155
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
250 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, misc_types[query.value(1).toInt()]); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
251 | painter.drawText(120, y+4, 340, 20, Qt::AlignLeft, query.value(0).toString()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
252 | if (query.value(2).toInt()) |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
253 | w = QString("%1 gr").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
254 | else |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
255 | w = QString("%1 ml").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
256 | painter.drawText(460, y+4, 115, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
257 | w = QString("%1 €").arg(query.value(4).toDouble(), 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
258 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
259 | w = QString("%1 €").arg(query.value(3).toDouble() * query.value(4).toDouble(), 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
260 | tot_miscs += (query.value(3).toDouble() * query.value(4).toDouble()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
261 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
262 | query.next(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
263 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
264 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
265 | painter.fillRect( 0, y, 735, 20, c_header); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
266 | painter.drawText( 0, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
267 | w = QString("%1 €").arg(tot_miscs, 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
268 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
269 | y += 20; |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
270 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
271 | } else if (p_job == PR_YEASTBANK) { |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
272 | /* |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
273 | * Print yeast in the private yeast bank. |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
274 | */ |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
275 | printHeader(&painter); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
276 | y = 120; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
277 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
278 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
279 | painter.setPen(Qt::black); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
280 | painter.fillRect( 0, y, 735, 20, c_header); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
281 | painter.drawText( 0, y+4, 200, 20, Qt::AlignLeft, tr("Yeast")); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
282 | painter.drawText(200, y+4, 230, 20, Qt::AlignLeft, tr("Description")); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
283 | painter.drawText(430, y+4, 80, 20, Qt::AlignCenter, tr("Type")); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
284 | painter.drawText(510, y+4, 80, 20, Qt::AlignCenter, tr("Form")); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
285 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("Stock")); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
286 | painter.drawText(665, y+4, 70, 20, Qt::AlignLeft, tr("Date")); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
287 | y += 20; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
288 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
289 | query.prepare("SELECT name,type,form,inventory,production_date,short_desc " |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
290 | "FROM inventory_yeasts WHERE inventory > 0 AND laboratory = :my_lab ORDER BY product_id"); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
90
diff
changeset
|
291 | query.bindValue(":my_lab", my_yeastlab); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
292 | query.exec(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
293 | query.first(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
294 | for (int i = 0; i < query.size(); i++) { |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
295 | painter.fillRect( 0, y, 735, 20, (i % 2) ? c_line1:c_line2); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
296 | painter.drawText( 0, y+4, 200, 20, Qt::AlignLeft, query.value(0).toString()); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
297 | painter.drawText(200, y+4, 230, 20, Qt::AlignLeft, query.value(5).toString()); |
155
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
298 | painter.drawText(430, y+4, 80, 20, Qt::AlignCenter, yeast_types[query.value(1).toInt()]); |
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
299 | painter.drawText(510, y+4, 80, 20, Qt::AlignCenter, yeast_forms[query.value(2).toInt()]); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
300 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
301 | if (query.value(2).toInt() == 0) |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
302 | w = QString("%1 %2").arg(query.value(3).toDouble(), 10, 'f', 1).arg(y_unit[query.value(2).toInt()]); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
303 | else |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
304 | w = QString("%1 %2").arg(query.value(3).toDouble() * 1000.0, 10, 'f', 1).arg(y_unit[query.value(2).toInt()]); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
305 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, w); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
306 | painter.drawText(665, y+4, 70, 20, Qt::AlignLeft, query.value(4).toString()); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
307 | query.next(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
308 | y += 20; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
309 | } |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
310 | } else if (p_job == PR_RECIPE) { |
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
311 | |
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
312 | printHeader(&painter); |
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
313 | y = 120; |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
314 | /* Fermentables supplies header */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
315 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
316 | painter.setPen(Qt::black); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
317 | painter.fillRect( 0, y, 735, 20, c_header); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
318 | painter.drawText( 0, y+4, 735, 20, Qt::AlignCenter, tr("Recipe overview")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
319 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
320 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
321 | painter.fillRect( 0, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
322 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Brew type")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
323 | painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, recipe_types[recipe->type]); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
324 | painter.fillRect(435, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
325 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Efficiency")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
326 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 %").arg(recipe->efficiency, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
327 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
328 | painter.fillRect( 0, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
329 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Boil time")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
330 | painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, QString("%1 minutes.").arg(recipe->boil_time, 1, 'f', 0)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
331 | painter.fillRect(435, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
332 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Batch size")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
333 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L.").arg(recipe->batch_size, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
334 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
335 | painter.fillRect( 0, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
336 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Start SG")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
337 | painter.drawText(120, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_og, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
338 | painter.drawText(210, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_og_min, 1, 'f', 3).arg(recipe->st_og_max, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
339 | painter.fillRect(435, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
340 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("End SG")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
341 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_fg, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
342 | painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_fg_min, 1, 'f', 3).arg(recipe->st_fg_max, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
343 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
344 | painter.fillRect( 0, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
345 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Estimated Alcohol")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
346 | painter.drawText(120, y+4, 90, 20, Qt::AlignLeft, QString("%1%").arg(recipe->est_abv, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
347 | painter.drawText(210, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_abv_min, 1, 'f', 1).arg(recipe->st_abv_max, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
348 | painter.fillRect(435, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
349 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Estimated CO2 vol")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
350 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_carb, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
351 | painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_carb_min, 1, 'f', 1).arg(recipe->st_carb_max, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
352 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
353 | painter.fillRect( 0, y, 120, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
354 | painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Color (") + color_method[recipe->color_method] + ")"); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
355 | painter.fillRect(120, y, 180, 20, Utils::ebc_to_color(recipe->est_color)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
356 | if (recipe->est_color > 30) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
357 | painter.setPen(Qt::white); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
358 | painter.drawText(120, y+4, 90, 20, Qt::AlignLeft, QString("%1 EBC").arg(recipe->est_color, 1, 'f', 0)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
359 | painter.drawText(210, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_color_min, 1, 'f', 0).arg(recipe->st_color_max, 1, 'f', 0)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
360 | painter.setPen(Qt::black); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
361 | painter.fillRect(435, y, 300, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
362 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("IBU (") + ibu_method[recipe->ibu_method] + ")"); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
363 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_ibu, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
364 | painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(recipe->st_ibu_min, 1, 'f', 0).arg(recipe->st_ibu_max, 1, 'f', 0)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
365 | y += 40; |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
366 | |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
367 | /* Fermentables */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
368 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
369 | painter.setPen(Qt::black); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
370 | painter.fillRect( 0, y, 735, 20, c_header); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
371 | painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
372 | painter.drawText(265, y+4, 70, 20, Qt::AlignRight, tr("Percent")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
373 | painter.drawText(340, y+4, 70, 20, Qt::AlignRight, tr("Yield")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
374 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
375 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
376 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
377 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
378 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
379 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
380 | double cost_fermentables = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
381 | QString soort, amount, use; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
382 | for (int i = 0; i < recipe->fermentables.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
383 | double cost = recipe->fermentables.at(i).f_amount * recipe->fermentables.at(i).f_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
384 | cost_fermentables += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
385 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
386 | if (recipe->fermentables.at(i).f_type == 0) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
387 | soort = fermentable_graintypes[recipe->fermentables.at(i).f_graintype]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
388 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
389 | soort = fermentable_types[recipe->fermentables.at(i).f_type]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
390 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
391 | if (recipe->fermentables.at(i).f_amount > 100) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
392 | amount = QString("%1 kg").arg(recipe->fermentables.at(i).f_amount, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
393 | else if (recipe->fermentables.at(i).f_amount > 10) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
394 | amount = QString("%1 kg").arg(recipe->fermentables.at(i).f_amount, 1, 'f', 2); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
395 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
396 | amount = QString("%1 gr").arg(recipe->fermentables.at(i).f_amount * 1000, 1, 'f', 0); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
397 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
398 | painter.fillRect( 0, y, 735, 20, f_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
399 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
400 | painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, recipe->fermentables.at(i).f_name + |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
401 | QString(", %1 EBC (").arg(recipe->fermentables.at(i).f_color, 1, 'f', 0) + |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
402 | recipe->fermentables.at(i).f_supplier + ")"); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
403 | painter.drawText(265, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).f_percentage, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
404 | painter.drawText(340, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).f_yield, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
405 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, soort); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
406 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, fermentable_added[recipe->fermentables.at(i).f_added]); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
407 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
408 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
409 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
410 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
411 | painter.fillRect(670, y, 60, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
412 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_fermentables, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
413 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
414 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
415 | /* Hops */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
416 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
417 | painter.fillRect( 0, y, 735, 20, c_header); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
418 | painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, tr("Hop")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
419 | painter.drawText(265, y+4, 70, 20, Qt::AlignRight, tr("Alpha")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
420 | painter.drawText(340, y+4, 70, 20, Qt::AlignRight, tr("IBU")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
421 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
422 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
423 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
424 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
425 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
426 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
427 | double cost_hops = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
428 | for (int i = 0; i < recipe->hops.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
429 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
430 | double cost = recipe->hops.at(i).h_amount * recipe->hops.at(i).h_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
431 | cost_hops += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
432 | double ibu = Utils::toIBU(recipe->hops.at(i).h_useat, recipe->hops.at(i).h_form, recipe->preboil_sg, recipe->batch_size, |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
433 | recipe->hops.at(i).h_amount, recipe->hops.at(i).h_time, recipe->hops.at(i).h_alpha, |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
434 | recipe->ibu_method, 0, recipe->hops.at(i).h_time, 0); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
435 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
436 | if (recipe->hops.at(i).h_useat == 2 || recipe->hops.at(i).h_useat == 4) // Boil or Whirlpool |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
437 | use = hop_useat[recipe->hops.at(i).h_useat] + QString(" %1 min").arg(recipe->hops.at(i).h_time); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
438 | else if (recipe->hops.at(i).h_useat == 5) // Dryhop |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
439 | use = hop_useat[recipe->hops.at(i).h_useat] + QString(" %1 days").arg(recipe->hops.at(i).h_time / 1440); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
440 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
441 | use = hop_useat[recipe->hops.at(i).h_useat]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
442 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
443 | if (recipe->hops.at(i).h_amount > 1) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
444 | amount = QString("%1 kg").arg(recipe->hops.at(i).h_amount, 1, 'f', 3); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
445 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
446 | amount = QString("%1 gr").arg(recipe->hops.at(i).h_amount * 1000, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
447 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
448 | painter.fillRect( 0, y, 735, 20, h_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
449 | painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, recipe->hops.at(i).h_name + " (" + recipe->hops.at(i).h_origin + ")"); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
450 | painter.drawText(265, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->hops.at(i).h_alpha, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
451 | painter.drawText(340, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
452 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, hop_forms[recipe->hops.at(i).h_form]); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
453 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, use); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
454 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
455 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
456 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
457 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
458 | painter.fillRect(670, y, 60, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
459 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_hops, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
460 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
461 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
462 | /* Yeasts */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
463 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
464 | painter.fillRect( 0, y, 735, 20, c_header); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
465 | painter.drawText( 0, y+4, 335, 20, Qt::AlignLeft, tr("Yeast")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
466 | painter.drawText(340, y+4, 70, 20, Qt::AlignRight, tr("Attn")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
467 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
468 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
469 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
470 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
471 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
472 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
473 | double cost_yeasts = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
474 | for (int i = 0; i < recipe->yeasts.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
475 | double cost = recipe->yeasts.at(i).y_amount * recipe->yeasts.at(i).y_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
476 | cost_yeasts += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
477 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
478 | if (recipe->yeasts.at(i).y_form == 0) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
479 | amount = QString("%1 pack").arg(recipe->yeasts.at(i).y_amount, 1, 'f', 0); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
480 | else if (recipe->yeasts.at(i).y_form == 1 || recipe->yeasts.at(i).y_form == 6) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
481 | amount = QString("%1 gr").arg(recipe->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
482 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
483 | amount = QString("%1 ml").arg(recipe->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
484 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
485 | painter.fillRect( 0, y, 735, 20, y_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
486 | painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, recipe->yeasts.at(i).y_laboratory + " " + |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
487 | recipe->yeasts.at(i).y_product_id + " (" + |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
488 | recipe->yeasts.at(i).y_name + ")"); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
489 | painter.drawText(340, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->yeasts.at(i).y_attenuation, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
490 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, yeast_forms[recipe->yeasts.at(i).y_form]); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
491 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, yeast_use[recipe->yeasts.at(i).y_use]); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
492 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
493 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
494 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
495 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
496 | painter.fillRect(670, y, 60, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
497 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
498 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
499 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
500 | /* Miscs */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
501 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
502 | painter.fillRect( 0, y, 735, 20, c_header); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
503 | painter.drawText( 0, y+4, 410, 20, Qt::AlignLeft, tr("Misc ingredient")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
504 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
505 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
506 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
507 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
508 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
509 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
510 | double cost_miscs = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
511 | for (int i = 0; i < recipe->miscs.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
512 | double cost = recipe->miscs.at(i).m_amount * recipe->miscs.at(i).m_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
513 | cost_miscs += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
514 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
515 | if (recipe->miscs.at(i).m_use_use == 2) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
516 | use = misc_uses[recipe->miscs.at(i).m_use_use] + QString(" %1 min").arg(recipe->miscs.at(i).m_time); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
517 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
518 | use = misc_uses[recipe->miscs.at(i).m_use_use]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
519 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
520 | if (recipe->miscs.at(i).m_type == 4) // Water agent |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
521 | painter.fillRect( 0, y, 735, 20, mw_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
522 | else if (recipe->miscs.at(i).m_type == 3) // Fining |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
523 | painter.fillRect( 0, y, 735, 20, mf_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
524 | else if (recipe->miscs.at(i).m_type < 3 || recipe->miscs.at(i).m_type == 5) // Spice, Herb, Flavour, Yeast nutrient |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
525 | painter.fillRect( 0, y, 735, 20, ms_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
526 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
527 | painter.fillRect( 0, y, 735, 20, mo_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
528 | painter.drawText( 0, y+4, 410, 20, Qt::AlignLeft, recipe->miscs.at(i).m_name); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
529 | painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, misc_types[recipe->miscs.at(i).m_type]); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
530 | painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, use); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
531 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
532 | QString("%1 %2").arg(recipe->miscs.at(i).m_amount * 1000.0, 1, 'f', 1).arg(recipe->miscs.at(i).m_amount_is_weight ? "gr":"ml")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
533 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
534 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
535 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
536 | painter.fillRect(670, y, 60, 20, c_line1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
537 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
538 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
539 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
540 | /* Mash */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
541 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
542 | painter.fillRect( 0, y, 735, 20, c_header); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
543 | painter.drawText( 0, y+4, 160, 20, Qt::AlignLeft, tr("Mash step")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
544 | painter.drawText(165, y+4, 90, 20, Qt::AlignLeft, tr("Step type")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
545 | painter.drawText(260, y+4, 60, 20, Qt::AlignRight, tr("Start °C")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
546 | painter.drawText(325, y+4, 60, 20, Qt::AlignRight, tr("End °C")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
547 | painter.drawText(390, y+4, 60, 20, Qt::AlignRight, tr("Time")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
548 | painter.drawText(455, y+4, 60, 20, Qt::AlignRight, tr("Ramp")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
549 | painter.drawText(520, y+4, 60, 20, Qt::AlignRight, tr("L/kg")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
550 | painter.drawText(585, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec L.")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
551 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec °C")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
552 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
553 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
554 | for (int i = 0; i < recipe->mashs.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
555 | painter.fillRect( 0, y, 735, 20, m_line); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
556 | painter.drawText( 0, y+4, 160, 20, Qt::AlignLeft, recipe->mashs.at(i).step_name); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
557 | painter.drawText(165, y+4, 90, 20, Qt::AlignLeft, step_types[recipe->mashs.at(i).step_type]); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
558 | painter.drawText(260, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_temp, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
559 | painter.drawText(325, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).end_temp, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
560 | painter.drawText(390, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_time, 1, 'f', 0)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
561 | painter.drawText(455, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).ramp_time, 1, 'f', 0)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
562 | painter.drawText(520, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_wg_ratio, 1, 'f', 2)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
563 | if (recipe->mashs.at(i).step_type != 1) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
564 | painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_infuse_amount, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
565 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->mashs.at(i).step_infuse_temp, 1, 'f', 1)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
566 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
567 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
568 | } |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
569 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
570 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
571 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
572 | painter.end(); |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
573 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
574 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
575 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
576 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
577 | void PrinterDialog::printHeader(QPainter *painter) |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
578 | { |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
579 | QPixmap outPixmap = QPixmap(); |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
90
diff
changeset
|
580 | outPixmap.loadFromData(my_logoByteArray); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
581 | int w = outPixmap.width(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
582 | int h = outPixmap.height(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
583 | /* Make sure to keep the logo aspect ratio */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
584 | if (w == h) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
585 | painter->drawPixmap(0, 0, 100, 100, outPixmap); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
586 | } else if (w > h) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
587 | painter->drawPixmap(0, 0, 100, (h * 100) / w, outPixmap); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
588 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
589 | painter->drawPixmap(0, 0, (w * 100) / h, 100, outPixmap); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
590 | } |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
591 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
592 | /* The fat header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
593 | painter->setFont(QFont("Helvetica",18, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
594 | if (p_job == PR_SUPPLIES) { |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
90
diff
changeset
|
595 | painter->drawText(120, 0, 500, 40, Qt::AlignLeft, tr("Inventory") + " " + my_brewery_name); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
596 | } else if (p_job == PR_YEASTBANK) { |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
90
diff
changeset
|
597 | painter->drawText(120, 0, 500, 40, Qt::AlignLeft, tr("Yeastbank") + " " + my_brewery_name); |
158
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
598 | } else if (p_job == PR_RECIPE) { |
24bc2de721d9
Activated print recipe button. The recipe record structure is now global. Added global product record structure.
Michiel Broek <mbroek@mbse.eu>
parents:
155
diff
changeset
|
599 | painter->drawText(120, 0, 500, 40, Qt::AlignLeft, recipe->name); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
600 | } else { |
133
08635b028dcf
Load waters during recipe startup. Started calcWater() function. Load profile_setup record global. The print function uses the globals now too instead of loading from the database.
Michiel Broek <mbroek@mbse.eu>
parents:
90
diff
changeset
|
601 | painter->drawText(120, 0, 500, 40, Qt::AlignLeft, "?? " + my_brewery_name); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
602 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
603 | /* The first normal header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
604 | painter->setFont(QFont("Helvetica",10, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
605 | painter->drawText(120,35, 80, 20, Qt::AlignLeft, tr("Date and time")); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
606 | painter->drawText(200,35, 400, 20, Qt::AlignLeft, ": " + QDateTime::currentDateTime().toString("dd-MM-yyyy hh:mm")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
607 | if (p_job == PR_RECIPE) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
608 | painter->drawText(120,55, 80, 20, Qt::AlignLeft, tr("Beer style")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
609 | painter->drawText(200,55, 400, 20, Qt::AlignLeft, ": " + recipe->st_name); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
610 | } |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
611 | /* The report itself may print more lines from y = 55. */ |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
612 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
613 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
614 |