Sat, 21 Jan 2023 16:18:37 +0100
Some final changes for now.
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" |
175
f1ed3a2a94e9
Initial import of EditProduct, the part from EditRecipe is ported.
Michiel Broek <mbroek@mbse.eu>
parents:
160
diff
changeset
|
20 | #include "EditProduct.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
|
21 | #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
|
22 | #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
|
23 | |
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
|
24 | #include <QPrintPreviewDialog> |
90
2396457a8167
Moved functions from bmsapp.cpp to MainWindow.cpp
Michiel Broek <mbroek@mbse.eu>
parents:
88
diff
changeset
|
25 | #include <QDebug> |
2396457a8167
Moved functions from bmsapp.cpp to MainWindow.cpp
Michiel Broek <mbroek@mbse.eu>
parents:
88
diff
changeset
|
26 | #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
|
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 | |
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 | 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
|
30 | { |
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 | 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
|
32 | |
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_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
|
34 | 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
|
35 | |
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 | 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
|
37 | 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
|
38 | 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
|
39 | 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
|
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 | |
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
|
42 | |
88
64cf5468fd22
Improve the CMakeLists.txt. Cleanup unused variables. Removed som debug messages.
Michiel Broek <mbroek@mbse.eu>
parents:
83
diff
changeset
|
43 | 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
|
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 | |
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 | 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
|
47 | { |
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 | 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
|
49 | |
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 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
|
51 | 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
|
52 | 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
|
53 | QString w; |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
54 | 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
|
55 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
56 | 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
|
57 | 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
|
58 | 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
|
59 | 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
|
60 | 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
|
61 | 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
|
62 | 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
|
63 | 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
|
64 | 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
|
65 | const QColor mo_line( 210, 245, 255, 255); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
66 | const QColor line( 175, 175, 255, 255); // also y_line |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
67 | 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
|
68 | |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
69 | 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
|
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) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
76 | qInfo() << "Print supplies"; |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
77 | |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
78 | /* |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
79 | * Print supplies in stock |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
80 | */ |
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
|
81 | 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
|
82 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
83 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
84 | 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
|
85 | /* 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
|
86 | 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
|
87 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
88 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
89 | painter.drawText( 20, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
90 | painter.drawText(100, y+4, 100, 20, Qt::AlignLeft, tr("Supplier")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
91 | painter.drawText(200, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable")); |
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
|
92 | 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
|
93 | 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
|
94 | 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
|
95 | 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
|
96 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
97 | 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
|
98 | 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
|
99 | for (int i = 0 ; i < query.size() ; i++ ) { |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
100 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
101 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
102 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
103 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
104 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
105 | painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
106 | painter.drawText( 20, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("FermentableType", g_fermentable_types[query.value(0).toInt()])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
107 | painter.drawText(100, y+4, 100, 20, Qt::AlignLeft, query.value(2).toString()); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
108 | painter.drawText(200, y+4, 260, 20, Qt::AlignLeft, query.value(1).toString()); |
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
|
109 | 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
|
110 | 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
|
111 | 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
|
112 | 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
|
113 | 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
|
114 | 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
|
115 | 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
|
116 | 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
|
117 | 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
|
118 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
119 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
120 | painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
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
|
121 | 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
|
122 | 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
|
123 | 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
|
124 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
125 | /* 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
|
126 | 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
|
127 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
128 | 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
|
129 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
130 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
131 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
132 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
133 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
134 | } |
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
|
135 | 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
|
136 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
137 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
138 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Country")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
139 | painter.drawText(140, y+4, 240, 20, Qt::AlignLeft, tr("Hop 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
|
140 | 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
|
141 | 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
|
142 | 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
|
143 | 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
|
144 | 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
|
145 | 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
|
146 | for (int i = 0; i < query.size(); i++) { |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
147 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
148 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
149 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
150 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
151 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
152 | painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
153 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, query.value(2).toString()); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
154 | painter.drawText(140, y+4, 240, 20, Qt::AlignLeft, query.value(0).toString()); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
155 | painter.drawText(380, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("HopForm", g_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
|
156 | 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
|
157 | 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
|
158 | 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
|
159 | 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
|
160 | 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
|
161 | 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
|
162 | 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
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
169 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
170 | painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
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
|
171 | 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
|
172 | 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
|
173 | 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
|
174 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
175 | /* 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
|
176 | 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
|
177 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
178 | 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
|
179 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
180 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
181 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
182 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
183 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
184 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
185 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
186 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
187 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
188 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Laboratory")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
189 | painter.drawText(140, y+4, 120, 20, Qt::AlignLeft, tr("Product")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
190 | painter.drawText(260, y+4, 235, 20, Qt::AlignLeft, tr("Yeast")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
191 | painter.drawText(495, y+4, 80, 20, Qt::AlignRight, tr("Stock")); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
192 | 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
|
193 | 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
|
194 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
195 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
196 | for (int i = 0; i < query.size(); i++) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
197 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
198 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
199 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
200 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
201 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
202 | painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
203 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, query.value(1).toString()); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
204 | painter.drawText(140, y+4, 120, 20, Qt::AlignLeft, query.value(2).toString()); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
205 | painter.drawText(260, y+4, 235, 20, Qt::AlignLeft, query.value(0).toString()); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
206 | if (query.value(3).toInt() == 0) |
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(), 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 | else |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
209 | w = QString("%1 %2").arg(query.value(4).toDouble() * 1000.0, 10, 'f', 1).arg(y_unit[query.value(3).toInt()]); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
210 | painter.drawText(495, y+4, 80, 20, Qt::AlignRight, w); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
211 | 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
|
212 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
213 | 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
|
214 | tot_yeasts += (query.value(4).toDouble() * query.value(5).toDouble()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
215 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
216 | query.next(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
217 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
218 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
219 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
220 | painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
221 | w = QString("%1 €").arg(tot_yeasts, 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
222 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
223 | 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
|
224 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
225 | /* 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
|
226 | 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
|
227 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
228 | 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
|
229 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
230 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
231 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
232 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
233 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
234 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
235 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
236 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
237 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
238 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
239 | painter.drawText(140, y+4, 320, 20, Qt::AlignLeft, tr("Ingredient")); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
240 | 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
|
241 | 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
|
242 | 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
|
243 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
244 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
245 | for (int i = 0; i < query.size(); i++) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
246 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
247 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
248 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
249 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
250 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
251 | painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
252 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, QCoreApplication::translate("MiscType", g_misc_types[query.value(1).toInt()])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
253 | painter.drawText(140, y+4, 320, 20, Qt::AlignLeft, query.value(0).toString()); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
254 | if (query.value(2).toInt()) |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
255 | 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
|
256 | else |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
257 | 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
|
258 | painter.drawText(460, y+4, 115, 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(4).toDouble(), 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
260 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
261 | 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
|
262 | tot_miscs += (query.value(3).toDouble() * query.value(4).toDouble()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
263 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
264 | query.next(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
265 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
266 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
267 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
268 | painter.drawText( 20, y+4, 100, 20, Qt::AlignLeft, tr("Total")); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
269 | w = QString("%1 €").arg(tot_miscs, 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
270 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
271 | y += 20; |
54
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 | } else if (p_job == PR_YEASTBANK) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
274 | qInfo() << "Print yeastbank"; |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
275 | |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
276 | /* |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
277 | * Print yeast in the private yeast bank. |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
278 | */ |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
279 | printHeader(&painter); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
280 | y = 120; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
281 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
282 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
283 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
284 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
285 | painter.drawText( 20, y+4, 180, 20, Qt::AlignLeft, tr("Yeast")); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
286 | 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
|
287 | 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
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | y += 20; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
292 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
293 | 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
|
294 | "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
|
295 | query.bindValue(":my_lab", my_yeastlab); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
296 | query.exec(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
297 | query.first(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
298 | for (int i = 0; i < query.size(); i++) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
299 | painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
300 | painter.drawText( 20, y+4, 180, 20, Qt::AlignLeft, query.value(0).toString()); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
301 | painter.drawText(200, y+4, 230, 20, Qt::AlignLeft, query.value(5).toString()); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
302 | painter.drawText(430, y+4, 80, 20, Qt::AlignCenter, QCoreApplication::translate("YeastType", g_yeast_types[query.value(1).toInt()])); |
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
303 | painter.drawText(510, y+4, 80, 20, Qt::AlignCenter, QCoreApplication::translate("YeastForm", g_yeast_forms[query.value(2).toInt()])); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
304 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
305 | if (query.value(2).toInt() == 0) |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
306 | 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
|
307 | else |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
308 | 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
|
309 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, w); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
310 | 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
|
311 | query.next(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
312 | y += 20; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
313 | } |
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
|
314 | } 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
|
315 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
316 | qInfo() << "Print recipe" << recipe->record; |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
317 | |
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
|
318 | 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
|
319 | y = 120; |
160 | 320 | /* Generic header */ |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
321 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
322 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
323 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
324 | painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe overview")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
325 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
326 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
327 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
328 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Brew type")); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
329 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("Recipe_type", g_recipe_types[recipe->type])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
330 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
331 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Efficiency")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
332 | 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
|
333 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
334 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
335 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Boil time")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
336 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 minutes.").arg(recipe->boil_time, 1, 'f', 0)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
337 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
338 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Batch size")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
339 | 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
|
340 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
341 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
342 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Start SG")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
343 | painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(recipe->est_og, 1, 'f', 3)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
344 | painter.drawText(260, 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)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
345 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
346 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("End SG")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
347 | 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
|
348 | 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
|
349 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
350 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
351 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Estimated Alcohol")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
352 | painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1%").arg(recipe->est_abv, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
353 | painter.drawText(260, 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)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
354 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
355 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Estimated CO2 vol")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
356 | 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
|
357 | 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
|
358 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
359 | painter.fillRect( 20, y, 150, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
360 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Color (") + color_method[recipe->color_method] + ")"); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
361 | painter.fillRect(170, y, 180, 20, Utils::ebc_to_color(recipe->est_color)); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
362 | if (recipe->est_color > 30) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
363 | painter.setPen(Qt::white); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
364 | painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1 EBC").arg(recipe->est_color, 1, 'f', 0)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
365 | painter.drawText(260, 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)); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
366 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
367 | painter.fillRect(405, y, 330, 20, c_line1); |
336
e97f9e87d94b
IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
368 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("IBU (") + g_ibu_method[recipe->ibu_method] + ")"); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
369 | 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
|
370 | 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
|
371 | 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
|
372 | |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
373 | /* Fermentables */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
374 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
375 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
376 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
377 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
378 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Percent")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
379 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Yield")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
380 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
381 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
382 | 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
|
383 | 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
|
384 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
385 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
386 | double cost_fermentables = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
387 | QString soort, amount, use; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
388 | for (int i = 0; i < recipe->fermentables.size(); i++) { |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
389 | double cost = recipe->fermentables.at(i).amount * recipe->fermentables.at(i).cost; |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
390 | cost_fermentables += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
391 | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
392 | if (recipe->fermentables.at(i).type == 0) |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
393 | soort = QCoreApplication::translate("FermentableGraintype", g_fermentable_graintypes[recipe->fermentables.at(i).graintype]); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
394 | else |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
395 | soort = QCoreApplication::translate("FermentableType", g_fermentable_types[recipe->fermentables.at(i).type]); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
396 | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
397 | if (recipe->fermentables.at(i).amount > 100) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
398 | amount = QString("%1 kg").arg(recipe->fermentables.at(i).amount, 1, 'f', 1); |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
399 | else if (recipe->fermentables.at(i).amount > 10) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
400 | amount = QString("%1 kg").arg(recipe->fermentables.at(i).amount, 1, 'f', 2); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
401 | else |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
402 | amount = QString("%1 gr").arg(recipe->fermentables.at(i).amount * 1000, 1, 'f', 0); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
403 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
404 | painter.fillRect( 20, y, 715, 20, f_line); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
405 | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
406 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->fermentables.at(i).name + |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
407 | QString(", %1 EBC (").arg(recipe->fermentables.at(i).color, 1, 'f', 0) + |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
408 | recipe->fermentables.at(i).supplier + ")"); |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
409 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).percentage, 1, 'f', 1)); |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
410 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).yield, 1, 'f', 1)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
411 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
412 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("FermentableAdded", g_fermentable_added[recipe->fermentables.at(i).added])); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
413 | 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
|
414 | 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
|
415 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
416 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
417 | 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
|
418 | 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
|
419 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
420 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
421 | /* Hops */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
422 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
423 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
424 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Hop")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
425 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Alpha")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
426 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("IBU")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
427 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
428 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
429 | 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
|
430 | 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
|
431 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
432 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
433 | double cost_hops = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
434 | 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
|
435 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
436 | double cost = recipe->hops.at(i).amount * recipe->hops.at(i).cost; |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
437 | cost_hops += cost; |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
438 | double ibu = Utils::toIBU(recipe->hops.at(i).useat, recipe->hops.at(i).form, recipe->preboil_sg, recipe->est_og, recipe->batch_size, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
439 | recipe->hops.at(i).amount, recipe->hops.at(i).time, recipe->hops.at(i).alpha, |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
440 | recipe->ibu_method, 0, recipe->hops.at(i).time, 0, recipe->boil_time, 0, 0, 0, |
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
441 | recipe->hops.at(i).utilisation, recipe->hops.at(i).bu_factor); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
442 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
443 | if (recipe->hops.at(i).useat == 2 || recipe->hops.at(i).useat == 4) // Boil or Whirlpool |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
444 | use = QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]) + QString(" %1 min").arg(recipe->hops.at(i).time); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
445 | else if (recipe->hops.at(i).useat == 5) // Dryhop |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
446 | use = QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]) + QString(" %1 days").arg(recipe->hops.at(i).time / 1440); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
447 | else |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
448 | use = QCoreApplication::translate("HopUse", g_hop_useat[recipe->hops.at(i).useat]); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
449 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
450 | if (recipe->hops.at(i).amount > 1) |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
451 | amount = QString("%1 kg").arg(recipe->hops.at(i).amount, 1, 'f', 3); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
452 | else |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
453 | amount = QString("%1 gr").arg(recipe->hops.at(i).amount * 1000, 1, 'f', 1); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
454 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
455 | painter.fillRect( 20, y, 715, 20, h_line); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
456 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->hops.at(i).name + " (" + recipe->hops.at(i).origin + ")"); |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
457 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->hops.at(i).alpha, 1, 'f', 1)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
458 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1)); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
459 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("HopForm", g_hop_forms[recipe->hops.at(i).form])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
460 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
461 | 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
|
462 | 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
|
463 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
464 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
465 | 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
|
466 | 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
|
467 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
468 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
469 | /* Yeasts */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
470 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
471 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
472 | painter.drawText( 20, y+4, 335, 20, Qt::AlignLeft, tr("Yeast")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
473 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Attn")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
474 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
475 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
476 | 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
|
477 | 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
|
478 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
479 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
480 | double cost_yeasts = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
481 | for (int i = 0; i < recipe->yeasts.size(); i++) { |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
482 | double cost = recipe->yeasts.at(i).amount * recipe->yeasts.at(i).cost; |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
483 | cost_yeasts += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
484 | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
485 | if (recipe->yeasts.at(i).form == 0) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
486 | amount = QString("%1 pack").arg(recipe->yeasts.at(i).amount, 1, 'f', 0); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
487 | else if (recipe->yeasts.at(i).form == 1 || recipe->yeasts.at(i).form == 6) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
488 | amount = QString("%1 gr").arg(recipe->yeasts.at(i).amount * 1000.0, 1, 'f', 1); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
489 | else |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
490 | amount = QString("%1 ml").arg(recipe->yeasts.at(i).amount * 1000.0, 1, 'f', 1); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
491 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
492 | painter.fillRect( 20, y, 715, 20, y_line); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
493 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->yeasts.at(i).laboratory + " " + |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
494 | recipe->yeasts.at(i).product_id + " (" + |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
495 | recipe->yeasts.at(i).name + ")"); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
496 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->yeasts.at(i).attenuation, 1, 'f', 1)); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
497 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastForm", g_yeast_forms[recipe->yeasts.at(i).form])); |
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
498 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastUse", g_yeast_use[recipe->yeasts.at(i).use])); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
499 | 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
|
500 | 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
|
501 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
502 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
503 | 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
|
504 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3)); |
160 | 505 | |
506 | if ((y + 80 + (recipe->miscs.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ | |
507 | printer->newPage(); | |
508 | printHeader(&painter); | |
509 | y = 120; | |
510 | } else { | |
511 | y += 40; | |
512 | } | |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
513 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
514 | /* Miscs */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
515 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
516 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
517 | painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, tr("Misc ingredient")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
518 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
519 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
520 | 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
|
521 | 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
|
522 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
523 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
524 | double cost_miscs = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
525 | for (int i = 0; i < recipe->miscs.size(); i++) { |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
526 | double cost = recipe->miscs.at(i).amount * recipe->miscs.at(i).cost; |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
527 | cost_miscs += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
528 | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
529 | if (recipe->miscs.at(i).use_use == 2) |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
530 | use = QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(i).use_use]) + QString(" %1 min").arg(recipe->miscs.at(i).time); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
531 | else |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
532 | use = QCoreApplication::translate("MiscUse", g_misc_uses[recipe->miscs.at(i).use_use]); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
533 | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
534 | if (recipe->miscs.at(i).type == 4) // Water agent |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
535 | painter.fillRect( 20, y, 715, 20, mw_line); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
536 | else if (recipe->miscs.at(i).type == 3) // Fining |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
537 | painter.fillRect( 20, y, 715, 20, mf_line); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
538 | else if (recipe->miscs.at(i).type < 3 || recipe->miscs.at(i).type == 5) // Spice, Herb, Flavour, Yeast nutrient |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
539 | painter.fillRect( 20, y, 715, 20, ms_line); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
540 | else |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
541 | painter.fillRect( 20, y, 715, 20, mo_line); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
542 | painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, recipe->miscs.at(i).name); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
543 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("MiscType", g_misc_types[recipe->miscs.at(i).type])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
544 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
545 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, |
379
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
546 | QString("%1 %2").arg(recipe->miscs.at(i).amount * 1000.0, 1, 'f', 2).arg(recipe->miscs.at(i).amount_is_weight ? "gr":"ml")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
547 | 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
|
548 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
549 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
550 | 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
|
551 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3)); |
160 | 552 | |
553 | if ((y + 60 + (recipe->mashs.size() * 20)) > painter.device()->height()) { /* Rows + header + blank */ | |
554 | printer->newPage(); | |
555 | printHeader(&painter); | |
556 | y = 120; | |
557 | } else { | |
558 | y += 40; | |
559 | } | |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
560 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
561 | /* Mash */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
562 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
563 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
564 | painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, tr("Mash step")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
565 | painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, tr("Step type")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | 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
|
570 | 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
|
571 | 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
|
572 | 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
|
573 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
574 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
575 | for (int i = 0; i < recipe->mashs.size(); i++) { |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
576 | painter.fillRect( 20, y, 715, 20, line); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
577 | painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, recipe->mashs.at(i).step_name); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
578 | painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("StepType", g_step_types[recipe->mashs.at(i).step_type])); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
579 | 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
|
580 | 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
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | 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
|
586 | 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
|
587 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
588 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
589 | } |
160 | 590 | |
366
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
591 | if ((y + 100 + ((recipe->w2_amount > 0) ? 40:0)) > painter.device()->height()) { /* waters + header + blank */ |
160 | 592 | printer->newPage(); |
593 | printHeader(&painter); | |
594 | y = 120; | |
595 | } else { | |
596 | y += 40; | |
597 | } | |
598 | ||
599 | /* Water */ | |
600 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
601 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
602 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Water source")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
603 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, tr("Volume")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
604 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, tr("Ca")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
605 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, tr("Mg")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
606 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, tr("CaCO3")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
607 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, tr("Na")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
608 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, tr("Cl")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
609 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("SO4")); |
160 | 610 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("pH")); |
611 | y += 20; | |
612 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
613 | painter.fillRect( 20, y, 715, 20, w_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
614 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, recipe->w1_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
615 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(recipe->w1_amount, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
616 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
617 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
618 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
619 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
620 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
621 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_sulfate, 1, 'f', 1)); |
160 | 622 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_ph, 1, 'f', 2)); |
623 | y += 20; | |
624 | if (recipe->w2_amount > 0) { | |
625 | /* | |
626 | * If there is dillution water, show it and the mixed result too. | |
627 | */ | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
628 | painter.fillRect( 20, y, 715, 20, w_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
629 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, recipe->w2_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
630 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(recipe->w2_amount, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
631 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
632 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
633 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
634 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
635 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
636 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_sulfate, 1, 'f', 1)); |
160 | 637 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_ph, 1, 'f', 2)); |
638 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
639 | painter.fillRect( 20, y, 715, 20, w_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
640 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Mixed water")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
641 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(recipe->wg_amount, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
642 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
643 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
644 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
645 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
646 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
647 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_sulfate, 1, 'f', 1)); |
160 | 648 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_ph, 1, 'f', 2)); |
649 | y += 20; | |
650 | } | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
651 | painter.fillRect( 20, y, 715, 20, w_line); |
366
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
652 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated mash water")); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
653 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
654 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
655 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
656 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
657 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
658 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sulfate, 1, 'f', 1)); |
160 | 659 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_ph, 1, 'f', 2)); |
660 | y += 20; | |
366
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
661 | painter.fillRect( 20, y, 715, 20, w_line); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
662 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated sparge water")); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
663 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(recipe->sparge_volume, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
664 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->ws_calcium, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
665 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->ws_magnesium, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
666 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->ws_total_alkalinity, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
667 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->ws_sodium, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
668 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->ws_chloride, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
669 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->ws_sulfate, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
670 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->sparge_ph, 1, 'f', 2)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
671 | y += 20; |
237 | 672 | |
673 | /* | |
674 | * Print recipe notes if present. | |
675 | */ | |
676 | if (recipe->notes.length()) { | |
677 | QStringList lines = recipe->notes.split("\n"); | |
678 | ||
679 | if (lines.size() && recipe->notes != "") { | |
680 | if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) { | |
681 | printer->newPage(); | |
682 | printHeader(&painter); | |
683 | y = 120; | |
684 | } else { | |
685 | y += 40; | |
686 | } | |
687 | ||
688 | /* Notes header */ | |
689 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
690 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
691 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
692 | painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe notes")); |
237 | 693 | y += 20; |
694 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
695 | for (int i = 0; i < lines.size(); i++) { | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
696 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
697 | painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]); |
237 | 698 | y += 20; |
699 | } | |
700 | } | |
701 | } | |
702 | ||
703 | } else if (p_job == PR_PRODUCT) { | |
704 | ||
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
705 | qInfo() << "print product" << product->record; |
237 | 706 | printHeader(&painter); |
707 | y = 120; | |
708 | /* Generic header */ | |
709 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
710 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
711 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
712 | painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Product overview")); |
237 | 713 | y += 20; |
714 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
715 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
716 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Brew type")); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
717 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("RecipeType", g_recipe_types[product->type])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
718 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
719 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Efficiency")); |
237 | 720 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 %").arg(product->efficiency, 1, 'f', 1)); |
721 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
722 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
723 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Boil time")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
724 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 minutes.").arg(product->boil_time, 1, 'f', 0)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
725 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
726 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Batch size")); |
272
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
727 | if (product->divide_type) { |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
728 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L. of %2 L.").arg(product->batch_size, 1, 'f', 1) |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
729 | .arg(product->batch_size / product->divide_factor, 1, 'f', 1)); |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
730 | } else { |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
731 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L.").arg(product->batch_size, 1, 'f', 1)); |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
732 | } |
237 | 733 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
734 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
735 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Start SG")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
736 | painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_og, 1, 'f', 3)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
737 | painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_og_min, 1, 'f', 3).arg(product->st_og_max, 1, 'f', 3)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
738 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
739 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("End SG")); |
237 | 740 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_fg, 1, 'f', 3)); |
741 | painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_fg_min, 1, 'f', 3).arg(product->st_fg_max, 1, 'f', 3)); | |
742 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
743 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
744 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Estimated Alcohol")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
745 | painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1%").arg(product->est_abv, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
746 | painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_abv_min, 1, 'f', 1).arg(product->st_abv_max, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
747 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
748 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Estimated CO2 vol")); |
237 | 749 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_carb, 1, 'f', 1)); |
750 | painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_carb_min, 1, 'f', 1).arg(product->st_carb_max, 1, 'f', 1)); | |
751 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
752 | painter.fillRect( 20, y, 150, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
753 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Color (") + color_method[product->color_method] + ")"); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
754 | painter.fillRect(170, y, 180, 20, Utils::ebc_to_color(product->est_color)); |
237 | 755 | if (product->est_color > 30) |
756 | painter.setPen(Qt::white); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
757 | painter.drawText(170, y+4, 90, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->est_color, 1, 'f', 0)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
758 | painter.drawText(260, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_color_min, 1, 'f', 0).arg(product->st_color_max, 1, 'f', 0)); |
237 | 759 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
760 | painter.fillRect(405, y, 330, 20, c_line1); |
336
e97f9e87d94b
IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents:
301
diff
changeset
|
761 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("IBU (") + g_ibu_method[product->ibu_method] + ")"); |
237 | 762 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_ibu, 1, 'f', 1)); |
763 | painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_ibu_min, 1, 'f', 0).arg(product->st_ibu_max, 1, 'f', 0)); | |
764 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
765 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
766 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Beer style")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
767 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->st_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
768 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
769 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Stage")); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
770 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("ProdStages", g_prod_stages[product->stage])); |
272
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
771 | if (product->divide_parts) { |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
772 | y += 20; |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
773 | painter.fillRect( 20, y, 330, 20, c_line1); |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
774 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Split batch")); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
775 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QCoreApplication::translate("Splitter", g_prod_split[product->divide_type])); |
272
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
776 | painter.fillRect(405, y, 330, 20, c_line1); |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
777 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Batch number")); |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
778 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 of %2").arg(product->divide_part + 1).arg(product->divide_parts + 1)); |
4f0281b7b0bb
Show split batch status in print product.
Michiel Broek <mbroek@mbse.eu>
parents:
260
diff
changeset
|
779 | } |
237 | 780 | y += 40; |
781 | ||
782 | /* Fermentables */ | |
783 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
784 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
785 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
786 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
787 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Percent")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
788 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Yield")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
789 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
790 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 791 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
792 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
793 | y += 20; | |
794 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
795 | double cost_fermentables = 0; | |
796 | QString soort, amount, use; | |
797 | for (int i = 0; i < product->fermentables.size(); i++) { | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
798 | double cost = product->fermentables.at(i).amount * product->fermentables.at(i).cost; |
237 | 799 | cost_fermentables += cost; |
800 | ||
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
801 | if (product->fermentables.at(i).type == 0) |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
802 | soort = QCoreApplication::translate("FermentableGraintype", g_fermentable_graintypes[product->fermentables.at(i).graintype]); |
237 | 803 | else |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
804 | soort = QCoreApplication::translate("FermentableType", g_fermentable_types[product->fermentables.at(i).type]); |
237 | 805 | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
806 | if (product->fermentables.at(i).amount > 100) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
807 | amount = QString("%1 kg").arg(product->fermentables.at(i).amount, 1, 'f', 1); |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
808 | else if (product->fermentables.at(i).amount > 10) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
809 | amount = QString("%1 kg").arg(product->fermentables.at(i).amount, 1, 'f', 2); |
237 | 810 | else |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
811 | amount = QString("%1 gr").arg(product->fermentables.at(i).amount * 1000, 1, 'f', 0); |
237 | 812 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
813 | painter.fillRect( 20, y, 715, 20, f_line); |
237 | 814 | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
815 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->fermentables.at(i).name + |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
816 | QString(", %1 EBC (").arg(product->fermentables.at(i).color, 1, 'f', 0) + |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
817 | product->fermentables.at(i).supplier + ")"); |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
818 | if (product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
819 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).percentage, 1, 'f', 1)); |
237 | 820 | else |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
821 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, ""); |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
822 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).yield, 1, 'f', 1)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
823 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
824 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("FermentableAdded", g_fermentable_added[product->fermentables.at(i).added])); |
237 | 825 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
826 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); | |
827 | y += 20; | |
828 | } | |
829 | painter.fillRect(670, y, 60, 20, c_line1); | |
830 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_fermentables, 1, 'f', 3)); | |
831 | y += 40; | |
832 | ||
833 | /* Hops */ | |
834 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
835 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
836 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, tr("Hop")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
837 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Alpha")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
838 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("IBU")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
839 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
840 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 841 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
842 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
843 | y += 20; | |
844 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
845 | double cost_hops = 0; | |
846 | for (int i = 0; i < product->hops.size(); i++) { | |
847 | ||
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
848 | double cost = product->hops.at(i).amount * product->hops.at(i).cost; |
237 | 849 | cost_hops += cost; |
373
b02aca4e926c
First load of changes for hops. In EditHop load the dropdown buttons from the global table. Use named query fields. Added database utilisation and bu_factor fields for hop extracts. Added edit fields for these new fields. Added post boil SG, utilisation and bu_factor parameters to the toIBU function. Added hops form parameter to the hopFlavourContribution and hopAromaContribution display bars. In the hops inventory list dispay volumes instead of weight for hop extracts. Modified the TinsethIBU function to use utilisation and bu_factor parameters. Add calculations for co2 and iso hop extracts, this is work in progress. The toIBU function makes use of the preSG and postSG values to use the correct SG to caall the TinsethIBU function. This results in a bit lower IBU values mostly affecting the late additions. Added use hop at bottling for iso hop extracts like Tetra hops using the formula from BarthHaas.
Michiel Broek <mbroek@mbse.eu>
parents:
367
diff
changeset
|
850 | double ibu = Utils::toIBU(product->hops.at(i).useat, product->hops.at(i).form, product->preboil_sg, product->est_og3, product->batch_size, |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
851 | product->hops.at(i).amount, product->hops.at(i).time, product->hops.at(i).alpha, |
340
b9af88bfe972
Added cooling parameters to the toIBU function.
Michiel Broek <mbroek@mbse.eu>
parents:
336
diff
changeset
|
852 | product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, |
440
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
419
diff
changeset
|
853 | product->boil_time, product->brew_cooling_method, product->eq_chiller_to79, product->eq_chiller_lpm, |
349c0c5bd512
Implemented IBU calculation for chilling.
Michiel Broek <mbroek@mbse.eu>
parents:
419
diff
changeset
|
854 | product->hops.at(i).utilisation, product->hops.at(i).bu_factor); |
237 | 855 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
856 | if (product->hops.at(i).useat == 2 || product->hops.at(i).useat == 4) // Boil or Whirlpool |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
857 | use = QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat]) + QString(" %1 min").arg(product->hops.at(i).time); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
858 | else if (product->hops.at(i).useat == 5) // Dryhop |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
859 | use = QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat]) + QString(" %1 days").arg(product->hops.at(i).time / 1440); |
237 | 860 | else |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
861 | use = QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat]); |
237 | 862 | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
863 | if (product->hops.at(i).amount > 1) |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
864 | amount = QString("%1 kg").arg(product->hops.at(i).amount, 1, 'f', 3); |
237 | 865 | else |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
866 | amount = QString("%1 gr").arg(product->hops.at(i).amount * 1000, 1, 'f', 1); |
237 | 867 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
868 | painter.fillRect( 20, y, 715, 20, h_line); |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
869 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->hops.at(i).name + " (" + product->hops.at(i).origin + ")"); |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
870 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->hops.at(i).alpha, 1, 'f', 1)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
871 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1)); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
872 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("HopForm", g_hop_forms[product->hops.at(i).form])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
873 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use); |
237 | 874 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
875 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); | |
876 | y += 20; | |
877 | } | |
878 | painter.fillRect(670, y, 60, 20, c_line1); | |
879 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_hops, 1, 'f', 3)); | |
880 | y += 40; | |
881 | ||
882 | /* Yeasts */ | |
883 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
884 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
885 | painter.drawText( 20, y+4, 335, 20, Qt::AlignLeft, tr("Yeast")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
886 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("Attn")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
887 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
888 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 889 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
890 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
891 | y += 20; | |
892 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
893 | double cost_yeasts = 0; | |
894 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
895 | double cost = product->yeasts.at(i).amount * product->yeasts.at(i).cost; |
237 | 896 | cost_yeasts += cost; |
897 | ||
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
898 | if (product->yeasts.at(i).form == 0) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
899 | amount = QString("%1 pack").arg(product->yeasts.at(i).amount, 1, 'f', 0); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
900 | else if (product->yeasts.at(i).form == 1 || product->yeasts.at(i).form == 6) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
901 | amount = QString("%1 gr").arg(product->yeasts.at(i).amount * 1000.0, 1, 'f', 1); |
237 | 902 | else |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
903 | amount = QString("%1 ml").arg(product->yeasts.at(i).amount * 1000.0, 1, 'f', 1); |
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
|
904 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
905 | painter.fillRect( 20, y, 715, 20, y_line); |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
906 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->yeasts.at(i).laboratory + " " + |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
907 | product->yeasts.at(i).product_id + " (" + |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
908 | product->yeasts.at(i).name + ")"); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
909 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->yeasts.at(i).attenuation, 1, 'f', 1)); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
910 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastForm", g_yeast_forms[product->yeasts.at(i).form])); |
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
911 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("YeastUse", g_yeast_use[product->yeasts.at(i).use])); |
237 | 912 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
913 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); | |
914 | y += 20; | |
915 | } | |
916 | if (product->starter_enable && product->prop_volume[0]) { | |
917 | int st = 0; | |
918 | double sv = 0; | |
919 | for (int i = 0; i < 4; i++) { | |
920 | if (product->prop_volume[i] > 0.0) { | |
921 | st++; | |
922 | if (product->prop_volume[i] > sv) | |
923 | sv = product->prop_volume[i]; | |
924 | } | |
925 | } | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
926 | painter.fillRect( 20, y, 715, 20, y_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
927 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, QString(tr("%1 step yeaststarter")).arg(st)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
928 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QString(tr("Before"))); |
237 | 929 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, QString("%1 L").arg(sv, 1, 'f', 3)); |
930 | y += 20; | |
931 | } | |
932 | painter.fillRect(670, y, 60, 20, c_line1); | |
933 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3)); | |
934 | ||
935 | if ((y + 80 + (product->miscs.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ | |
936 | printer->newPage(); | |
937 | printHeader(&painter); | |
938 | y = 120; | |
939 | } else { | |
940 | y += 40; | |
941 | } | |
942 | ||
943 | /* Miscs */ | |
944 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
945 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
946 | painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, tr("Misc ingredient")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
947 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, tr("Type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
948 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 949 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
950 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
951 | y += 20; | |
952 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
953 | double cost_miscs = 0; | |
954 | for (int i = 0; i < product->miscs.size(); i++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
955 | double cost = product->miscs.at(i).amount * product->miscs.at(i).cost; |
237 | 956 | cost_miscs += cost; |
957 | ||
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
958 | if (product->miscs.at(i).use_use == 2) |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
959 | use = QCoreApplication::translate("MiscUse", g_misc_uses[product->miscs.at(i).use_use]) + QString(" %1 min").arg(product->miscs.at(i).time); |
237 | 960 | else |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
961 | use = QCoreApplication::translate("MiscUse", g_misc_uses[product->miscs.at(i).use_use]); |
237 | 962 | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
963 | if (product->miscs.at(i).type == 4) // Water agent |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
964 | painter.fillRect( 20, y, 715, 20, mw_line); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
965 | else if (product->miscs.at(i).type == 3) // Fining |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
966 | painter.fillRect( 20, y, 715, 20, mf_line); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
967 | else if (product->miscs.at(i).type < 3 || product->miscs.at(i).type == 5) // Spice, Herb, Flavour, Yeast nutrient |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
968 | painter.fillRect( 20, y, 715, 20, ms_line); |
237 | 969 | else |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
970 | painter.fillRect( 20, y, 715, 20, mo_line); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
971 | painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, product->miscs.at(i).name); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
972 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("MiscType", g_misc_types[product->miscs.at(i).type])); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
973 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use); |
237 | 974 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, |
379
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
975 | QString("%1 %2").arg(product->miscs.at(i).amount * 1000.0, 1, 'f', 2).arg(product->miscs.at(i).amount_is_weight ? "gr":"ml")); |
237 | 976 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
977 | y += 20; | |
978 | } | |
979 | painter.fillRect(670, y, 60, 20, c_line1); | |
980 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3)); | |
981 | ||
982 | if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) { /* Rows + header + blank */ | |
983 | printer->newPage(); | |
984 | printHeader(&painter); | |
985 | y = 120; | |
986 | } else { | |
987 | y += 40; | |
988 | } | |
160 | 989 | |
237 | 990 | /* Mash */ |
991 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
992 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
993 | painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, tr("Mash step")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
994 | painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, tr("Step type")); |
237 | 995 | painter.drawText(260, y+4, 60, 20, Qt::AlignRight, tr("Start °C")); |
996 | painter.drawText(325, y+4, 60, 20, Qt::AlignRight, tr("End °C")); | |
997 | painter.drawText(390, y+4, 60, 20, Qt::AlignRight, tr("Time")); | |
998 | painter.drawText(455, y+4, 60, 20, Qt::AlignRight, tr("Ramp")); | |
999 | painter.drawText(520, y+4, 60, 20, Qt::AlignRight, tr("L/kg")); | |
1000 | painter.drawText(585, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec L.")); | |
1001 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec °C")); | |
1002 | y += 20; | |
1003 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
1004 | for (int i = 0; i < product->mashs.size(); i++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1005 | painter.fillRect( 20, y, 715, 20, line); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1006 | painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, product->mashs.at(i).step_name); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
1007 | painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, QCoreApplication::translate("StepType", g_step_types[product->mashs.at(i).step_type])); |
237 | 1008 | painter.drawText(260, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_temp, 1, 'f', 1)); |
1009 | painter.drawText(325, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).end_temp, 1, 'f', 1)); | |
1010 | painter.drawText(390, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0)); | |
1011 | painter.drawText(455, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).ramp_time, 1, 'f', 0)); | |
1012 | painter.drawText(520, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_wg_ratio, 1, 'f', 2)); | |
1013 | if (product->mashs.at(i).step_type != 1) { | |
1014 | painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_amount, 1, 'f', 1)); | |
1015 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1)); | |
1016 | } | |
1017 | y += 20; | |
1018 | } | |
1019 | ||
364
1efe29f64551
Initial setup to print sparge water.
Michiel Broek <mbroek@mbse.eu>
parents:
341
diff
changeset
|
1020 | if ((y + 100 + ((product->w2_amount > 0) ? 40:0)) > painter.device()->height()) { /* waters + header + blank */ |
237 | 1021 | printer->newPage(); |
1022 | printHeader(&painter); | |
1023 | y = 120; | |
1024 | } else { | |
1025 | y += 40; | |
1026 | } | |
1027 | ||
1028 | /* Water */ | |
1029 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1030 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1031 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Water source")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1032 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, tr("Volume")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1033 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, tr("Ca")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1034 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, tr("Mg")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1035 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, tr("CaCO3")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1036 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, tr("Na")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1037 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, tr("Cl")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1038 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("SO4")); |
237 | 1039 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("pH")); |
1040 | y += 20; | |
1041 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1042 | painter.fillRect( 20, y, 715, 20, w_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1043 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, product->w1_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1044 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->w1_amount, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1045 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1046 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1047 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1048 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1049 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1050 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_sulfate, 1, 'f', 1)); |
237 | 1051 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_ph, 1, 'f', 2)); |
1052 | y += 20; | |
1053 | if (product->w2_amount > 0) { | |
1054 | /* | |
1055 | * If there is dillution water, show it and the mixed result too. | |
1056 | */ | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1057 | painter.fillRect( 20, y, 715, 20, w_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1058 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, product->w2_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1059 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->w2_amount, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1060 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1061 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1062 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1063 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1064 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1065 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_sulfate, 1, 'f', 1)); |
237 | 1066 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_ph, 1, 'f', 2)); |
1067 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1068 | painter.fillRect( 20, y, 715, 20, w_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1069 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Mixed water")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1070 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->wg_amount, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1071 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1072 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1073 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1074 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1075 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1076 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_sulfate, 1, 'f', 1)); |
237 | 1077 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_ph, 1, 'f', 2)); |
1078 | y += 20; | |
1079 | } | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1080 | painter.fillRect( 20, y, 715, 20, w_line); |
364
1efe29f64551
Initial setup to print sparge water.
Michiel Broek <mbroek@mbse.eu>
parents:
341
diff
changeset
|
1081 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated mash water")); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1082 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_calcium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1083 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_magnesium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1084 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_total_alkalinity, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1085 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_sodium, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1086 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_chloride, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1087 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_sulfate, 1, 'f', 1)); |
237 | 1088 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_ph, 1, 'f', 2)); |
1089 | y += 20; | |
364
1efe29f64551
Initial setup to print sparge water.
Michiel Broek <mbroek@mbse.eu>
parents:
341
diff
changeset
|
1090 | painter.fillRect( 20, y, 715, 20, w_line); |
1efe29f64551
Initial setup to print sparge water.
Michiel Broek <mbroek@mbse.eu>
parents:
341
diff
changeset
|
1091 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated sparge water")); |
1efe29f64551
Initial setup to print sparge water.
Michiel Broek <mbroek@mbse.eu>
parents:
341
diff
changeset
|
1092 | painter.drawText(170, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->sparge_volume, 1, 'f', 1)); |
366
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
1093 | painter.drawText(240, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->ws_calcium, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
1094 | painter.drawText(310, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->ws_magnesium, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
1095 | painter.drawText(380, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->ws_total_alkalinity, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
1096 | painter.drawText(450, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->ws_sodium, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
1097 | painter.drawText(520, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->ws_chloride, 1, 'f', 1)); |
43bf6cccc4ab
Added printing sparge water details.
Michiel Broek <mbroek@mbse.eu>
parents:
364
diff
changeset
|
1098 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->ws_sulfate, 1, 'f', 1)); |
364
1efe29f64551
Initial setup to print sparge water.
Michiel Broek <mbroek@mbse.eu>
parents:
341
diff
changeset
|
1099 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->sparge_ph, 1, 'f', 2)); |
1efe29f64551
Initial setup to print sparge water.
Michiel Broek <mbroek@mbse.eu>
parents:
341
diff
changeset
|
1100 | y += 20; |
237 | 1101 | |
1102 | /* | |
1103 | * Print product notes if present. | |
1104 | */ | |
1105 | if (product->notes.length()) { | |
1106 | QStringList lines = product->notes.split("\n"); | |
1107 | ||
1108 | if (lines.size() && product->notes != "") { | |
1109 | if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) { | |
1110 | printer->newPage(); | |
1111 | printHeader(&painter); | |
1112 | y = 120; | |
1113 | } else { | |
1114 | y += 40; | |
1115 | } | |
1116 | ||
1117 | /* Notes header */ | |
1118 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
1119 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1120 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1121 | painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe notes")); |
237 | 1122 | y += 20; |
1123 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
1124 | for (int i = 0; i < lines.size(); i++) { | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1125 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1126 | painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]); |
237 | 1127 | y += 20; |
1128 | } | |
1129 | } | |
1130 | } | |
1131 | ||
1132 | if (product->stage > PROD_STAGE_BREW) { | |
1133 | if ((y + 100) > painter.device()->height()) { | |
1134 | printer->newPage(); | |
1135 | printHeader(&painter); | |
1136 | y = 120; | |
160 | 1137 | } else { |
1138 | y += 40; | |
1139 | } | |
237 | 1140 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
160 | 1141 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1142 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1143 | painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Product brewday")); |
237 | 1144 | y += 20; |
1145 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1146 | painter.fillRect( 20, y, 300, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1147 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Brewday start")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1148 | painter.drawText(140, y+4, 180, 20, Qt::AlignLeft, product->brew_date_start.toString("dd MMM yyyy hh:mm")); |
237 | 1149 | painter.fillRect(435, y, 300, 20, c_line1); |
1150 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Brewday end")); | |
1151 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, product->brew_date_end.toString("dd MMM yyyy hh:mm")); | |
1152 | ||
1153 | /* Mash history */ | |
1154 | if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) { | |
1155 | printer->newPage(); | |
1156 | printHeader(&painter); | |
1157 | y = 120; | |
1158 | } else { | |
1159 | y += 40; | |
1160 | } | |
1161 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1162 | painter.fillRect( 20, y, 715, 20, line); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1163 | painter.drawText( 40, y+4, 250, 20, Qt::AlignLeft, tr("Mash step")); |
237 | 1164 | painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, tr("Step type")); |
1165 | painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, tr("Temperature")); | |
1166 | painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, tr("Minutes")); | |
1167 | painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, tr("SG")); | |
1168 | painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, tr("pH")); | |
1169 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
1170 | y += 20; | |
1171 | for (int i = 0; i < product->mashs.size(); i++) { | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1172 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1173 | painter.drawText( 20, y+4, 20, 20, Qt::AlignCenter, QString("%1").arg(i + 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1174 | painter.drawText( 40, y+4, 250, 20, Qt::AlignLeft, product->mashs.at(i).step_name); |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
1175 | painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, QCoreApplication::translate("StepType", g_step_types[product->mashs.at(i).step_type])); |
237 | 1176 | painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, QString("%1 - %2°C"). |
1177 | arg(product->mashs.at(i).step_temp, 1, 'f', 1).arg(product->mashs.at(i).end_temp, 1, 'f', 1)); | |
1178 | painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0)); | |
1179 | painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_sg, 1, 'f', 3)); | |
1180 | painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_ph, 1, 'f', 1)); | |
1181 | y += 20; | |
1182 | } | |
1183 | ||
1184 | /* Brew history */ | |
1185 | if ((y + 470) > painter.device()->height()) { | |
1186 | printer->newPage(); | |
1187 | printHeader(&painter); | |
1188 | y = 120; | |
1189 | } else { | |
1190 | y += 20; | |
1191 | } | |
1192 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1193 | painter.fillRect( 20, y, 715, 20, line); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1194 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Brew item")); |
237 | 1195 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, tr("Expected")); |
1196 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, tr("Reached")); | |
1197 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, tr("Difference")); | |
1198 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
1199 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1200 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1201 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash pH")); |
237 | 1202 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->mash_ph, 1, 'f', 2)); |
1203 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_mash_ph, 1, 'f', 2)); | |
1204 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->mash_ph, product->brew_mash_ph, 2, " pH")); | |
1205 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1206 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1207 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash density")); |
237 | 1208 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_mash_sg)); |
1209 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_mash_sg)); | |
1210 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_mash_sg, product->brew_mash_sg, 3, " SG")); | |
1211 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1212 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1213 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash efficiency")); |
237 | 1214 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, "100%"); |
1215 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_mash_efficiency, 1, 'f', 1)); | |
1216 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(100.0, product->brew_mash_efficiency, 1, "%")); | |
1217 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1218 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1219 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Sparge pH")); |
237 | 1220 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->sparge_ph, 1, 'f', 2)); |
1221 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_sparge_ph, 1, 'f', 2)); | |
1222 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->sparge_ph, product->brew_sparge_ph, 2, " pH")); | |
1223 | y += 25; | |
1224 | ||
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1225 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1226 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil pH")); |
237 | 1227 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2)); |
1228 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1229 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1230 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil density")); |
237 | 1231 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->preboil_sg)); |
1232 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_preboil_sg)); | |
1233 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->preboil_sg, product->brew_preboil_sg, 3, " SG")); | |
1234 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1235 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1236 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil volume")); |
237 | 1237 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->boil_size * 1.04, 1, 'f', 1)); |
1238 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_preboil_volume, 1, 'f', 1)); | |
1239 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->boil_size * 1.04, product->brew_preboil_volume, 1, " L")); | |
1240 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1241 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1242 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil efficiency")); |
237 | 1243 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1)); |
1244 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_preboil_efficiency, 1, 'f', 1)); | |
1245 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_preboil_efficiency, 1, "%")); | |
1246 | y += 25; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1247 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1248 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil pH")); |
237 | 1249 | //painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2)); |
1250 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_aboil_ph, 1, 'f', 2)); | |
1251 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1252 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1253 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil density")); |
237 | 1254 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og)); |
1255 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_aboil_sg)); | |
1256 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_aboil_sg, 3, " SG")); | |
1257 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1258 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1259 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil volume")); |
237 | 1260 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size * 1.04, 1, 'f', 1)); |
1261 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_aboil_volume, 1, 'f', 1)); | |
1262 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size * 1.04, product->brew_aboil_volume, 1, " L")); | |
1263 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1264 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1265 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil efficiency")); |
237 | 1266 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1)); |
1267 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_aboil_efficiency, 1, 'f', 1)); | |
1268 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_aboil_efficiency, 1, "%")); | |
1269 | y += 25; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1270 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1271 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Chiller and trub loss")); |
458
ac216a75ca9b
Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents:
440
diff
changeset
|
1272 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_trub_loss, 1, 'f', 1)); |
237 | 1273 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_tcloss, 1, 'f', 1)); |
458
ac216a75ca9b
Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents:
440
diff
changeset
|
1274 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_trub_loss, product->brew_fermenter_tcloss, 1, " L")); |
237 | 1275 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1276 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1277 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Top up water")); |
237 | 1278 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_top_up_water, 1, 'f', 1)); |
1279 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_extrawater, 1, 'f', 1)); | |
1280 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_top_up_water, product->brew_fermenter_extrawater, 1, " L")); | |
1281 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1282 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1283 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter volume")); |
458
ac216a75ca9b
Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents:
440
diff
changeset
|
1284 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size - product->eq_trub_loss - product->boil_absorb, 1, 'f', 1)); |
237 | 1285 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_volume, 1, 'f', 1)); |
458
ac216a75ca9b
Renamed trub_chiller_loss fields to trub_loss
Michiel Broek <mbroek@mbse.eu>
parents:
440
diff
changeset
|
1286 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size - product->eq_trub_loss - product->boil_absorb, product->brew_fermenter_volume, 1, " L")); |
237 | 1287 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1288 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1289 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter density")); |
237 | 1290 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og)); |
1291 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_fermenter_sg)); | |
1292 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_fermenter_sg, 3, " SG")); | |
1293 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1294 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1295 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter color")); |
237 | 1296 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->est_color, 1, 'f', 0)); |
1297 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->brew_fermenter_color, 1, 'f', 0)); | |
1298 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_color, product->brew_fermenter_color, 0, " EBC")); | |
1299 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1300 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1301 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter IBU")); |
237 | 1302 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->est_ibu, 1, 'f', 0)); |
1303 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->brew_fermenter_ibu, 1, 'f', 0)); | |
1304 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_ibu, product->brew_fermenter_ibu, 0, " IBU")); | |
1305 | y += 25; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1306 | painter.fillRect( 20, y, 430, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1307 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling method")); |
341
1b1e2d4c1a3e
Cooling method dropdown table loads from a global table. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents:
340
diff
changeset
|
1308 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QCoreApplication::translate("ChillerType", g_chiller_types[product->brew_cooling_method])); |
237 | 1309 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1310 | painter.fillRect( 20, y, 430, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1311 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling temperature")); |
237 | 1312 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1°C").arg(product->brew_cooling_to, 1, 'f', 1)); |
1313 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1314 | painter.fillRect( 20, y, 430, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1315 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling time")); |
237 | 1316 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 min").arg(product->brew_cooling_time, 1, 'f', 0)); |
1317 | } | |
1318 | ||
1319 | if (product->stage > PROD_STAGE_TERTIARY) { | |
1320 | if ((y + 200) > painter.device()->height()) { | |
1321 | printer->newPage(); | |
1322 | printHeader(&painter); | |
1323 | y = 120; | |
1324 | } else { | |
1325 | y += 40; | |
1326 | } | |
1327 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
1328 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1329 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1330 | painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Product fermentation")); |
160 | 1331 | y += 20; |
1332 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1333 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1334 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Primary start temp")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1335 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_start_temp, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1336 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1337 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Primary peak temp")); |
237 | 1338 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_max_temp, 1, 'f', 1)); |
1339 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1340 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1341 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Primary end temp")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1342 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_end_temp, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1343 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1344 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Primary density")); |
237 | 1345 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->primary_end_sg, 1, 'f', 3)); |
1346 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1347 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1348 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Primary end date")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1349 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->primary_end_date.toString("dd MMM yyyy")); |
237 | 1350 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1351 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1352 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Secondary end temp")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1353 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->secondary_temp, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1354 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1355 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Secondary density")); |
237 | 1356 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->secondary_end_sg, 1, 'f', 3)); |
1357 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1358 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1359 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Secondary end date")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1360 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->secondary_end_date.toString("dd MMM yyyy")); |
237 | 1361 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1362 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1363 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Tertiary temperature")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1364 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->tertiary_temp, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1365 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1366 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Final density")); |
237 | 1367 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->fg, 1, 'f', 3)); |
1368 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1369 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1370 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Tertiary end date")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1371 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->package_date.toString("dd MMM yyyy")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1372 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1373 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Apperant attenuation")); |
237 | 1374 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(Utils::calc_svg(product->brew_fermenter_sg, product->fg), 1, 'f', 1)); |
1375 | } | |
1376 | ||
1377 | if (product->stage > PROD_STAGE_PACKAGE) { | |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1378 | if ((y + ((product->package_infuse_amount > 0) ? 305:265)) > painter.device()->height()) { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1379 | printer->newPage(); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1380 | printHeader(&painter); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1381 | y = 120; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1382 | } else { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1383 | y += 40; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1384 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1385 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1386 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1387 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1388 | painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Package product")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1389 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1390 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1391 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1392 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Package date")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1393 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->package_date.toString("dd MMM yyyy")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1394 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1395 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Package volume")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1396 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->package_volume, 1, 'f', 1)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1397 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1398 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1399 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1400 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Alcohol volume")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1401 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->package_abv, 1, 'f', 2)); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1402 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1403 | if (product->package_infuse_amount > 0) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1404 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1405 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Infuse volume")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1406 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->package_infuse_amount, 1, 'f', 3)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1407 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1408 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Infuse alcohol")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1409 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->package_infuse_abv, 1, 'f', 2)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1410 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1411 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1412 | painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, product->package_infuse_notes); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1413 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1414 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1415 | y += 5; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1416 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1417 | painter.fillRect( 20, y, 330, 20, line); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1418 | painter.drawText( 20, y+2, 330, 20, Qt::AlignCenter, tr("Bottles")); |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1419 | painter.fillRect(405, y, 330, 20, line); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1420 | painter.drawText(405, y+2, 330, 20, Qt::AlignCenter, tr("Kegs")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1421 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1422 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1423 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1424 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Bottles volume")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1425 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->bottle_amount, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1426 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1427 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Kegs volume")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1428 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->keg_amount, 1, 'f', 1)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1429 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1430 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1431 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Bottles CO2 volumes")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1432 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->bottle_carbonation, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1433 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1434 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Kegs CO2 volumes")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1435 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->keg_carbonation, 1, 'f', 1)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1436 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1437 | QString bsugar = "", ksugar = ""; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1438 | double bamount = 0, kamount = 0; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1439 | for (int i = 0; i < product->fermentables.size(); i++) { |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1440 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE) { |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1441 | bsugar = product->fermentables.at(i).name; |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1442 | bamount = product->fermentables.at(i).amount; |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1443 | } |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1444 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) { |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1445 | ksugar = product->fermentables.at(i).name; |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1446 | kamount = product->fermentables.at(i).amount; |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1447 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1448 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1449 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1450 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Sugar")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1451 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, bsugar); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1452 | painter.fillRect(405, y, 330, 20, c_line1); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1453 | if (product->keg_forced_carb) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1454 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Forced carbonation")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1455 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, tr("Yes")); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1456 | } else { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1457 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Sugar")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1458 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, ksugar); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1459 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1460 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1461 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1462 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Sugar amount")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1463 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 Kg").arg(bamount, 1, 'f', 3)); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1464 | if (! product->keg_forced_carb) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1465 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1466 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Sugar amount")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1467 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 Kg").arg(kamount, 1, 'f', 3)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1468 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1469 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1470 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1471 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Water amount")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1472 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->bottle_priming_water, 1, 'f', 3)); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1473 | if (! product->keg_forced_carb) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1474 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1475 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Water amount")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1476 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L").arg(product->keg_priming_water, 1, 'f', 3)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1477 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1478 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1479 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1480 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Alcohol volume")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1481 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->bottle_abv, 1, 'f', 2)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1482 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1483 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Alcohol volume")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1484 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(product->keg_abv, 1, 'f', 2)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1485 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1486 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1487 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Pressure")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1488 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1 bar").arg(product->bottle_bar, 1, 'f', 2)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1489 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1490 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Pressure")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1491 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 bar").arg(product->keg_bar, 1, 'f', 2)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1492 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1493 | painter.fillRect( 20, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1494 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Carbonation temp")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1495 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->bottle_carbonation_temp, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1496 | painter.fillRect(405, y, 330, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1497 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Carbonation temp")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1498 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->keg_carbonation_temp, 1, 'f', 1)); |
237 | 1499 | } |
1500 | ||
1501 | if (product->stage > PROD_STAGE_TASTE) { | |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1502 | QStringList lines = product->taste_notes.split("\n"); |
237 | 1503 | |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1504 | if (lines.size() && (product->taste_notes != "")) { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1505 | if ((y + 220 + (lines.size() * 20)) > painter.device()->height()) { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1506 | printer->newPage(); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1507 | printHeader(&painter); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1508 | y = 120; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1509 | } else { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1510 | y += 40; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1511 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1512 | } else { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1513 | if ((y + 220) > painter.device()->height()) { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1514 | printer->newPage(); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1515 | printHeader(&painter); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1516 | y = 120; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1517 | } else { |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1518 | y += 40; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1519 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1520 | } |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1521 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1522 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1523 | painter.fillRect( 20, y, 715, 20, c_header); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1524 | painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Tasting notes")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1525 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1526 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1527 | painter.fillRect( 20, y, 300, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1528 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Tasting date")); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1529 | painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, product->taste_date.toString("dd MMM yyyy")); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1530 | painter.fillRect(435, y, 300, 20, c_line1); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1531 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Taste score")); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1532 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1").arg(product->taste_rate, 1, 'f', 1)); |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1533 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1534 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1535 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Color")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1536 | painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_color); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1537 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1538 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1539 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Transparency")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1540 | painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_transparency); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1541 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1542 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1543 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Head")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1544 | painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_head); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1545 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1546 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1547 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Aroma")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1548 | painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_aroma); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1549 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1550 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1551 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Taste")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1552 | painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_taste); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1553 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1554 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1555 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Mouthfeel")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1556 | painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_mouthfeel); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1557 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1558 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1559 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, tr("Aftertaste")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1560 | painter.drawText(120, y+4, 595, 20, Qt::AlignLeft, product->taste_aftertaste); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1561 | y += 25; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1562 | for (int i = 0; i < lines.size(); i++) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1563 | painter.fillRect( 20, y, 715, 20, c_line1); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1564 | painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]); |
238
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1565 | y += 20; |
047e99c90848
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
Michiel Broek <mbroek@mbse.eu>
parents:
237
diff
changeset
|
1566 | } |
160 | 1567 | } |
240 | 1568 | |
1569 | } else if (p_job == PR_CHECKLIST) { | |
1570 | ||
1571 | double factor = 1.0 / product->divide_factor; | |
1572 | double mashwater = 0; | |
1573 | int numsalts = 0; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1574 | |
260
42b88d85fefc
Fix default divide_size field in products. Update miscs table column 6 and 7 tooltips and display of the buttons after sort. After a new misc product is selected, update the current row index because the row may be moved. Fix some display misc values in the checklist, they were not multiplied by 1000. Fix display of some bars if the value was 24.
Michiel Broek <mbroek@mbse.eu>
parents:
255
diff
changeset
|
1575 | qInfo() << "Print checklist" << product->record << "factor" << factor << product->divide_factor; |
240 | 1576 | printHeader(&painter); |
1577 | y = 120; | |
1578 | ||
1579 | /* First item, a yeast starter if needed, days before brewday. */ | |
1580 | if (product->starter_enable && product->prop_volume[0]) { | |
1581 | checkHeader(&painter, &y, tr("Make a yeast starter")); | |
1582 | int days = 0; | |
1583 | int last = 0; | |
1584 | QString s = ""; | |
1585 | for (int i = 0; i < 4; i++) { | |
1586 | if (product->prop_volume[i]) { | |
1587 | last = i; | |
1588 | if (product->prop_type[i] == STARTERS_STIRRED) | |
1589 | days += 2; | |
1590 | else if (product->prop_type[i] == STARTERS_SHAKEN) | |
1591 | days += 4; | |
1592 | else | |
1593 | days += 6; // Simple starter | |
1594 | } | |
1595 | } | |
1596 | checkLine(&painter, &y, QString(tr("Start about %1 days before brewday with the starter.")).arg(days)); | |
1597 | for (int i = 0; i < 4; i++) { | |
1598 | if (product->prop_volume[i]) { | |
1599 | checkLine(&painter, &y, QString(tr("Starter step %1 of %2 liter with SG %3")).arg(i+1).arg(product->prop_volume[i], 1, 'f', 3). | |
1600 | arg(product->starter_sg, 1, 'f', 3)); | |
1601 | QString w = tr(" until there is enough yeast"); | |
1602 | if (product->prop_type[i] == STARTERS_STIRRED) | |
1603 | checkLine(&painter, &y, QString(tr("about 24 hours on a stirplate"))+w); | |
1604 | else if (product->prop_type[i] == STARTERS_SHAKEN) | |
1605 | checkLine(&painter, &y, QString(tr("shake often for a few days"))+w); | |
1606 | else | |
1607 | checkLine(&painter, &y, QString(tr("let it rest for almost a week"))+w); | |
1608 | if (i < last) { | |
1609 | checkLine(&painter, &y, QString(tr("place starter in the fridge for 24 hours"))); | |
1610 | checkLine(&painter, &y, QString(tr("remove starter from the fridge and decant"))); | |
1611 | } else { | |
1612 | checkLine(&painter, &y, QString(tr("place starter in the fridge until brewday"))); | |
1613 | checkLine(&painter, &y, QString(tr("remove starter from the fridge and decant"))); | |
1614 | } | |
1615 | } | |
1616 | } | |
1617 | y += 20; | |
1618 | } | |
1619 | ||
1620 | checkHeader(&painter, &y, tr("Mash water and treatment")); | |
367
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1621 | checkLine(&painter, &y, QString("%1 liter water `%2`").arg(product->w1_amount * factor, 1, 'f', 1).arg(product->w1_name)); |
240 | 1622 | mashwater += product->w1_amount * factor; |
1623 | if (product->w2_name != "" && product->w2_amount > 0) { | |
367
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1624 | checkLine(&painter, &y, QString("%1 liter water `%2`").arg(product->w2_amount * factor, 1, 'f', 1).arg(product->w2_name)); |
240 | 1625 | mashwater += product->w2_amount * factor; |
1626 | } | |
1627 | for (int i = 0; i < product->miscs.size(); i++) { | |
367
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1628 | if (product->miscs.at(i).type == MISC_TYPES_WATER_AGENT && product->miscs.at(i).use_use == MISC_USES_MASH) { |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1629 | QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml"; |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1630 | checkLine(&painter, &y, QString("%1 %2 %3").arg(product->miscs.at(i).amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(i).name)); |
240 | 1631 | numsalts++; |
1632 | } | |
1633 | } | |
1634 | y += 20; | |
1635 | ||
367
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1636 | checkHeader(&painter, &y, tr("Sparge water and treatment")); |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1637 | QString sw = ""; |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1638 | if (product->sparge_source == 0) { |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1639 | checkLine(&painter, &y, QString("%1 liter water `%2`").arg(product->sparge_volume * factor, 1, 'f', 1).arg(product->w1_name)); |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1640 | } else if (product->sparge_source == 1) { |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1641 | checkLine(&painter, &y, QString("%1 liter water `%2`").arg(product->sparge_volume * factor, 1, 'f', 1).arg(product->w2_name)); |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1642 | } else if (product->sparge_source == 2) { |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1643 | checkLine(&painter, &y, QString("%1 liter water `%2`") |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1644 | .arg(product->sparge_volume * (product->w1_amount / (product->w1_amount+product->w2_amount)) * factor, 1, 'f', 1) |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1645 | .arg(product->w1_name)); |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1646 | checkLine(&painter, &y, QString("%1 liter water `%2`") |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1647 | .arg(product->sparge_volume * (product->w2_amount / (product->w1_amount+product->w2_amount)) * factor, 1, 'f', 1) |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1648 | .arg(product->w2_name)); |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1649 | } |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1650 | for (int i = 0; i < product->miscs.size(); i++) { |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1651 | if (product->miscs.at(i).type == MISC_TYPES_WATER_AGENT && product->miscs.at(i).use_use == MISC_USES_SPARGE) { |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1652 | QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml"; |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1653 | checkLine(&painter, &y, QString("%1 %2 %3").arg(product->miscs.at(i).amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(i).name)); |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1654 | numsalts++; |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1655 | } |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1656 | } |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1657 | y += 20; |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1658 | |
240 | 1659 | checkHeader(&painter, &y, tr("Weight and mill the malts")); |
1660 | for (int i = 0; i < product->fermentables.size(); i++) { | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1661 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1662 | checkLine(&painter, &y, QString("%1 kg `%2` (%3)").arg(product->fermentables.at(i).amount * factor, 1, 'f', 3). |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1663 | arg(product->fermentables.at(i).name).arg(product->fermentables.at(i).supplier)); |
240 | 1664 | } |
1665 | } | |
1666 | checkLine(&painter, &y, QString(tr("Mill the malts"))); | |
405
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1667 | |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1668 | int lines = 0; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1669 | int loop = 0; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1670 | for (int i = 0; i < product->mashs.size(); i++) { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1671 | if (loop == 0) { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1672 | lines += 3; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1673 | if (numsalts > 0) |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1674 | lines++; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1675 | for (int j = 0; j < product->hops.size(); j++) { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1676 | if (product->hops.at(j).useat == HOP_USEAT_MASH) { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1677 | lines++; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1678 | } |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1679 | } |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1680 | for (int j = 0; j < product->miscs.size(); j++) { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1681 | if ((product->miscs.at(j).use_use == MISC_USES_MASH) && (product->miscs.at(j).type != MISC_TYPES_WATER_AGENT)) { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1682 | lines++; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1683 | } |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1684 | } |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1685 | } else { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1686 | lines++; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1687 | } |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1688 | lines++; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1689 | loop++; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1690 | } |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1691 | lines++; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1692 | qDebug() << "check" << lines << y + (lines * 20) << painter.device()->height(); |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1693 | if ((y + (lines * 20)) > painter.device()->height()) { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1694 | printer->newPage(); |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1695 | printHeader(&painter); |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1696 | y = 120; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1697 | } else { |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1698 | y += 20; |
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1699 | } |
240 | 1700 | |
1701 | checkHeader(&painter, &y, tr("Mash")); | |
405
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1702 | loop = 0; |
240 | 1703 | double l, mvol = 0, msugars = 0; |
1704 | for (int i = 0; i < product->mashs.size(); i++) { | |
1705 | if (product->mashs.at(i).step_type == 0) | |
1706 | mvol += product->mashs.at(i).step_infuse_amount * factor; // We need this later | |
1707 | if (loop == 0) { | |
1708 | if (product->mashs.at(i).step_type == 0) | |
1709 | l = product->mashs.at(i).step_infuse_amount * factor; | |
1710 | else | |
1711 | l = mashwater; | |
1712 | checkLine(&painter, &y, QString(tr("Heat %1 liter water to %2°C (%3 cm below kettle top)")) | |
1713 | .arg(mashwater, 1, 'f', 1).arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1) | |
1714 | .arg(Utils::kettle_cm(l, product->eq_tun_volume, product->eq_tun_height), 1, 'f', 1)); | |
1715 | if (numsalts > 0) | |
1716 | checkLine(&painter, &y, QString(tr("Add brouwzouten"))); | |
1717 | checkLine(&painter, &y, QString(tr("Add malts and dough-in"))); | |
1718 | for (int j = 0; j < product->hops.size(); j++) { | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1719 | if (product->hops.at(j).useat == HOP_USEAT_MASH) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1720 | checkLine(&painter, &y, QString(tr("Add %1 gram `%2` hop")).arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 1) |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1721 | .arg(product->hops.at(j).name)); |
240 | 1722 | } |
1723 | } | |
1724 | for (int j = 0; j < product->miscs.size(); j++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1725 | if ((product->miscs.at(j).use_use == MISC_USES_MASH) && (product->miscs.at(j).type != MISC_TYPES_WATER_AGENT)) { |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1726 | QString unit = (product->miscs.at(j).amount_is_weight) ? "gr":"ml"; |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1727 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3`")).arg(product->miscs.at(j).amount * 1000 * factor, 1, 'f', 2) |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1728 | .arg(unit).arg(product->miscs.at(j).name)); |
240 | 1729 | } |
1730 | } | |
1731 | } else { // loop > 0 | |
1732 | if (product->mashs.at(i).step_type == 0) { // Infusion | |
1733 | checkLine(&painter, &y, QString(tr("Add %1 liter water of %2°C")).arg(product->mashs.at(i).step_infuse_amount * factor, 1, 'f', 1) | |
1734 | .arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1)); | |
1735 | } else if (product->mashs.at(i).step_type == 1) { // Direct heat | |
1736 | checkLine(&painter, &y, QString(tr("Heat upto %1°C")).arg(product->mashs.at(i).step_temp, 1, 'f', 1)); | |
1737 | } else { // Decoction | |
1738 | checkLine(&painter, &y, QString(tr("Take, heat, boil and return %1 part of the mash")) | |
1739 | .arg(product->mashs.at(i).step_infuse_amount * factor, 1, 'f', 1)); | |
1740 | } | |
1741 | } | |
1742 | if (product->mashs.at(i).step_temp != product->mashs.at(i).end_temp) { | |
1743 | checkInput(&painter, &y, QString(tr("%1 minutes from %2°C to %3°C")).arg(product->mashs.at(i).step_time) | |
1744 | .arg(product->mashs.at(i).step_temp, 1, 'f', 1).arg(product->mashs.at(i).end_temp, 1, 'f', 1), QString(tr("Brix"))); | |
1745 | } else { | |
1746 | checkInput(&painter, &y, QString(tr("%1 minutes at %2°C")).arg(product->mashs.at(i).step_time) | |
1747 | .arg(product->mashs.at(i).step_temp, 1, 'f', 1), QString(tr("Brix"))); | |
1748 | } | |
1749 | if (loop == 0) | |
1750 | checkInput(&painter, &y, QString(tr("Measure and adjust pH (target %1 pH)")).arg(product->mash_ph, 1, 'f', 2), QString(tr("pH"))); | |
1751 | loop++; | |
1752 | } | |
411 | 1753 | double sugardensity = 1.611, grainabsorption = 0; |
240 | 1754 | for (int i = 0; i < product->fermentables.size(); i++) { |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1755 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_MASH) { |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1756 | double d = product->fermentables.at(i).amount * factor * (product->fermentables.at(i).yield / 100) * |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1757 | (1 - product->fermentables.at(i).moisture / 100); |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1758 | mvol += product->fermentables.at(i).amount * factor * (product->fermentables.at(i).moisture / 100); |
411 | 1759 | grainabsorption += my_grain_absorption * product->fermentables.at(i).amount * factor; |
240 | 1760 | msugars += d; |
1761 | } | |
1762 | } | |
1763 | double v = msugars / sugardensity + mvol; | |
1764 | double plato = 1000.0 * msugars / (v * 10.0); // deg. Plato | |
1765 | double mash_sg = Utils::plato_to_sg(plato); | |
1766 | checkInput(&painter, &y, QString(tr("Target SG end mash: ")) + strDensity(mash_sg), QString(tr("SG"))); | |
1767 | if ((y + 140) > painter.device()->height()) { | |
1768 | printer->newPage(); | |
1769 | printHeader(&painter); | |
1770 | y = 120; | |
1771 | } else { | |
1772 | y += 20; | |
1773 | } | |
1774 | ||
1775 | checkHeader(&painter, &y, tr("Lauter and Sparge")); | |
367
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1776 | checkLine(&painter, &y, QString(tr("Heat sparge water to %1°C")).arg(product->sparge_temp, 1, 'f', 1)); |
60c493e08800
Added new sparge water data to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
366
diff
changeset
|
1777 | checkInput(&painter, &y, QString(tr("Bring water to %1 pH with %2 ml. `%3`")).arg(product->sparge_ph, 1, 'f', 2) |
240 | 1778 | .arg(product->sparge_acid_amount * 1000 * factor, 1, 'f', 2).arg(my_acids.at(product->sparge_acid_type).name_en), QString(tr("pH"))); |
1779 | checkLine(&painter, &y, QString(tr("Sparge with close to %1 liter water")) | |
411 | 1780 | .arg(((product->boil_size * factor) - mashwater + grainabsorption + product->eq_lauter_deadspace) * 1.03, 1, 'f', 1)); |
240 | 1781 | checkInput(&painter, &y, QString(tr("Target volume in boil kettle: %1 liter (%2 cm below kettle top)")) |
1782 | .arg(product->boil_size * factor * 1.04, 1, 'f', 1) | |
1783 | .arg(Utils::kettle_cm(product->boil_size * factor * 1.04, product->eq_kettle_volume, product->eq_kettle_height), 1, 'f', 1), | |
1784 | QString(tr("cm"))); | |
1785 | checkInput(&painter, &y, QString(tr("Target SG in boil kettle: ")) + strDensity(product->preboil_sg), QString(tr("SG"))); | |
1786 | checkInput(&painter, &y, "", QString(tr("pH"))); | |
1787 | for (int i = 0; i < product->hops.size(); i++) { | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1788 | if (product->hops.at(i).useat == HOP_USEAT_FWH) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1789 | checkLine(&painter, &y, QString(tr("Add %1 gr `%2` hop after sparge")).arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1) |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1790 | .arg(product->hops.at(i).name)); |
240 | 1791 | } |
1792 | } | |
1793 | ||
1794 | if (checkSplit(&painter, &y, 1)) | |
1795 | factor = 1; | |
1796 | /* Boil, how much space do we need */ | |
405
2c828cc3d943
Fix checklist mash steps overflow.
Michiel Broek <mbroek@mbse.eu>
parents:
386
diff
changeset
|
1797 | lines = 0; |
240 | 1798 | if (product->boil_time == 0) { |
1799 | lines = 3; | |
1800 | } else { | |
1801 | lines = 5; | |
419
d49f38cc76a0
The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
1802 | if (product->brew_cooling_method == CHILLER_TYPE_IMMERSION) |
240 | 1803 | lines++; |
1804 | for (int i = 0; i < product->fermentables.size(); i++) { | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1805 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOIL) |
240 | 1806 | lines++; |
1807 | } | |
1808 | for (int i = 0; i < product->hops.size(); i++) { | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1809 | if (product->hops.at(i).useat == HOP_USEAT_BOIL || product->hops.at(i).useat == HOP_USEAT_AROMA) |
240 | 1810 | lines++; |
1811 | } | |
1812 | for (int i = 0; i < product->miscs.size(); i++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1813 | if (product->miscs.at(i).use_use == MISC_USES_BOIL) |
240 | 1814 | lines++; |
1815 | } | |
1816 | } | |
1817 | qDebug() << "check" << lines << y + (lines * 20) << painter.device()->height(); | |
1818 | if ((y + (lines * 20)) > painter.device()->height()) { | |
1819 | printer->newPage(); | |
1820 | printHeader(&painter); | |
1821 | y = 120; | |
1822 | } else { | |
1823 | y += 20; | |
1824 | } | |
1825 | checkHeader(&painter, &y, tr("Boil")); | |
1826 | if (product->boil_time > 0) { | |
1827 | checkLine(&painter, &y, QString(tr("Total boiltime: %1 minutes")).arg(product->boil_time, 1, 'f', 0)); | |
1828 | for (int i = product->boil_time; i >= 0; i--) { | |
1829 | if (i == 10) { | |
1830 | for (int j = 0; j < product->fermentables.size(); j++) { | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1831 | if (product->fermentables.at(j).added == FERMENTABLE_ADDED_BOIL) |
240 | 1832 | checkLine(&painter, &y, QString(tr("%1 kg `%2` at 10 minutes before end of boil")) |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1833 | .arg(product->fermentables.at(j).amount * factor, 1, 'f', 3) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1834 | .arg(product->fermentables.at(j).name)); |
240 | 1835 | } |
419
d49f38cc76a0
The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
1836 | if (product->brew_cooling_method == CHILLER_TYPE_IMMERSION) |
d49f38cc76a0
The equipment editor uses named fields for database io. Edit field 'trub chiller loss' is now called 'trub loss', but will be renamed again. Removed editing hop_utilization, lauter_volume and lauter_height. These fields were never used in the application. Not yet removed from the database. Added chiller_type, chiller_to79, chiller_volume, chiller_lpm and chiller_loss fields so that we can tie a chiller to the equipment setup. Renamed some chiller names.
Michiel Broek <mbroek@mbse.eu>
parents:
413
diff
changeset
|
1837 | checkLine(&painter, &y, QString(tr("Place immersion chiller at 10 minutes before end of boil"))); |
240 | 1838 | } |
1839 | for (int j = 0; j < product->hops.size(); j++) { | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1840 | if ((product->hops.at(j).useat == HOP_USEAT_BOIL || product->hops.at(j).useat == HOP_USEAT_AROMA) && product->hops.at(j).time == i) { |
240 | 1841 | if (i == 0) |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1842 | checkLine(&painter, &y, QString(tr("%1 gr `%2` at flameout")).arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 2) |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1843 | .arg(product->hops.at(j).name)); |
240 | 1844 | else |
1845 | checkLine(&painter, &y, QString(tr("%1 gr `%2` at %3 minutes before end of boil")) | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1846 | .arg(product->hops.at(j).amount * 1000 * factor, 1, 'f', 2).arg(product->hops.at(j).name).arg(i)); |
240 | 1847 | } |
1848 | } | |
1849 | for (int j = 0; j < product->miscs.size(); j++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1850 | if (product->miscs.at(j).use_use == MISC_USES_BOIL && product->miscs.at(j).time == i) { |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1851 | QString unit = (product->miscs.at(j).amount_is_weight) ? "gr":"ml"; |
240 | 1852 | if (i == 0) |
1853 | checkLine(&painter, &y, QString(tr("%1 %2 `%3` at flameout")) | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1854 | .arg(product->miscs.at(j).amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(j).name)); |
240 | 1855 | else |
1856 | checkLine(&painter, &y, QString(tr("%1 %2 `%3` at %4 minutes before end of boil")) | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1857 | .arg(product->miscs.at(j).amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(j).name).arg(i)); |
240 | 1858 | } |
1859 | } | |
1860 | } | |
1861 | checkInput(&painter, &y, QString(tr("Target volume at end of boil: %1 liter (%2 cm below kettle top)")) | |
459
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1862 | .arg(((product->batch_size * 1.04) + product->eq_chiller_volume) * factor, 1, 'f', 1) |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1863 | .arg(Utils::kettle_cm(((product->batch_size * 1.04) + product->eq_chiller_volume) * factor, product->eq_kettle_volume, product->eq_kettle_height)), |
240 | 1864 | QString(tr("cm"))); |
1865 | checkInput(&painter, &y, QString(tr("Target SG at end of boil: ")) + strDensity(product->est_og3), QString(tr("SG"))); | |
459
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1866 | if (product->brew_cooling_method == CHILLER_TYPE_IMMERSION) { |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1867 | messageInput(&painter, &y, QString(tr("Note: target volume includes chiller %1 liter")) |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1868 | .arg(product->eq_chiller_volume, 1, 'f', 1), QString(tr("pH"))); |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1869 | } else { |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1870 | checkInput(&painter, &y, "", QString(tr("pH"))); |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
1871 | } |
240 | 1872 | if (checkSplit(&painter, &y, 2)) |
1873 | factor = 1; | |
1874 | } else { | |
1875 | checkLine(&painter, &y, QString(tr("This is a `no-boil` recipe"))); | |
1876 | } | |
1877 | ||
1878 | /* Whirlpools and chilling */ | |
1879 | lines = 5; | |
1880 | if (product->brew_whirlpool9) | |
1881 | lines++; | |
1882 | if (product->brew_whirlpool7) | |
1883 | lines++; | |
1884 | if (product->brew_whirlpool6) | |
1885 | lines++; | |
1886 | if (product->brew_whirlpool2) | |
1887 | lines++; | |
1888 | for (int i = 0; i < product->hops.size(); i++) { | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1889 | if (product->hops.at(i).useat == HOP_USEAT_WHIRLPOOL) |
240 | 1890 | lines++; |
1891 | } | |
1892 | if ((y + (lines * 20)) > painter.device()->height()) { | |
1893 | printer->newPage(); | |
1894 | printHeader(&painter); | |
1895 | y = 120; | |
1896 | } else { | |
1897 | y += 20; | |
1898 | } | |
1899 | if ((product->brew_whirlpool9 + product->brew_whirlpool7 + product->brew_whirlpool6 + product->brew_whirlpool2) > 0) { | |
1900 | checkHeader(&painter, &y, tr("Whirlpool(s) and cooling")); | |
1901 | if (product->brew_whirlpool9 > 0) | |
1902 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp above 85°C")).arg(product->brew_whirlpool9, 1, 'f', 0)); | |
1903 | if (product->brew_whirlpool7 > 0) | |
1904 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp between 72 and 79°C")).arg(product->brew_whirlpool7, 1, 'f', 0)); | |
1905 | if (product->brew_whirlpool6 > 0) | |
1906 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp between 60 and 66°C")).arg(product->brew_whirlpool6, 1, 'f', 0)); | |
1907 | for (int i = 0; i < product->hops.size(); i++) { | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1908 | if (product->hops.at(i).useat == HOP_USEAT_WHIRLPOOL) |
240 | 1909 | checkLine(&painter, &y, QString(tr("%1 gr `%2` for %3 minutes in the whirlpool")) |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1910 | .arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1).arg(product->hops.at(i).name) |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
1911 | .arg(product->hops.at(i).time)); |
240 | 1912 | } |
1913 | checkLine(&painter, &y, QString(tr("Cool to %1°C")).arg(product->brew_cooling_to, 1, 'f', 1)); | |
1914 | if (product->brew_whirlpool2 > 0) | |
1915 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes.")).arg(product->brew_whirlpool2, 1, 'f', 0)); | |
1916 | } else { | |
1917 | checkHeader(&painter, &y, tr("Cooling")); | |
1918 | checkLine(&painter, &y, QString(tr("Cool to %1°C")).arg(product->brew_cooling_to, 1, 'f', 1)); | |
1919 | } | |
1920 | checkLine(&painter, &y, QString(tr("Desinfect fermenter and pump and hoses if needed"))); | |
413
8ea791d4cab6
Version 0.2.28. Use calculated hop absorption during boil to correct the volume to the fermenter.
Michiel Broek <mbroek@mbse.eu>
parents:
411
diff
changeset
|
1921 | checkInput(&painter, &y, QString(tr("Transfer about %1 liter wort to the fermenter")).arg(product->brew_fermenter_volume, 1, 'f', 1), |
8ea791d4cab6
Version 0.2.28. Use calculated hop absorption during boil to correct the volume to the fermenter.
Michiel Broek <mbroek@mbse.eu>
parents:
411
diff
changeset
|
1922 | QString(tr("Liter"))); |
240 | 1923 | if (checkSplit(&painter, &y, 3)) |
1924 | factor = 1; | |
1925 | ||
1926 | double climate = product->brew_cooling_to; | |
1927 | lines = 3; | |
1928 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1929 | if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { |
240 | 1930 | lines++; |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1931 | if (product->yeasts.at(i).type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).pitch_temperature > 0)) |
240 | 1932 | lines++; |
1933 | } | |
1934 | } | |
1935 | if (product->brew_aeration_type > 0) | |
1936 | lines++; | |
1937 | if (product->brew_fermenter_extrawater > 0) | |
1938 | lines++; | |
1939 | if ((y + (lines * 20)) > painter.device()->height()) { | |
1940 | printer->newPage(); | |
1941 | printHeader(&painter); | |
1942 | y = 120; | |
1943 | } else { | |
1944 | y += 20; | |
1945 | } | |
1946 | double dry = 0; | |
1947 | checkHeader(&painter, &y, tr("Yeast pitching and fermentation")); | |
1948 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1949 | if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1950 | switch (product->yeasts.at(i).form) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1951 | case YEAST_FORMS_LIQUID: checkLine(&painter, &y, QString(tr("%1 pack %2, `%3` yeast")).arg(product->yeasts.at(i).amount) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1952 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 1953 | break; |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1954 | case YEAST_FORMS_DRY: dry += product->yeasts.at(i).amount * 1000 * factor; |
240 | 1955 | case YEAST_FORMS_DRIED: checkLine(&painter, &y, QString(tr("%1 gram %2, `%3` yeast")) |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1956 | .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1957 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 1958 | break; |
1959 | default: checkLine(&painter, &y, QString(tr("%1 ml %2, `%3` yeast")) | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1960 | .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 0) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1961 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 1962 | break; |
1963 | } | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1964 | if (product->yeasts.at(i).type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).pitch_temperature > 0)) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1965 | checkLine(&painter, &y, QString(tr("Pitch yeast at %1°C")).arg(product->yeasts.at(i).pitch_temperature, 1, 'f', 1)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
1966 | climate = product->yeasts.at(i).pitch_temperature; |
240 | 1967 | } |
1968 | } | |
1969 | } | |
1970 | if (dry > 0) { | |
1971 | checkLine(&painter, &y, QString(tr("Pitch yeast dry into the wort"))); | |
1972 | } else { | |
1973 | if (product->starter_enable && product->prop_volume[0]) | |
1974 | checkLine(&painter, &y, QString(tr("Add decanted yeast starter"))); | |
1975 | else | |
1976 | checkLine(&painter, &y, QString(tr("Add the yeast"))); | |
1977 | } | |
1978 | if (product->brew_fermenter_extrawater) | |
1979 | checkLine(&painter, &y, QString(tr("Add %1 liter water in the fermenter")).arg(product->brew_fermenter_extrawater * factor, 1, 'f', 1)); | |
1980 | if (product->brew_aeration_type > 0) | |
1981 | checkLine(&painter, &y, QString(tr("Aerate %1 minutes with %2")).arg(product->brew_aeration_time) | |
1982 | .arg((product->brew_aeration_type == 1) ? "air":"oxygen")); | |
1983 | checkLine(&painter, &y, QString(tr("Set fermentation start temperature to %1°C")).arg(climate, 1, 'f', 1)); | |
1984 | checkLine(&painter, &y, QString(tr("Start fermentation"))); | |
1985 | ||
1986 | /* During primary fermentation */ | |
1987 | lines = 0; | |
1988 | for (int i = 0; i < product->fermentables.size(); i++) | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
1989 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION) |
240 | 1990 | lines++; |
1991 | for (int i = 0; i < product->miscs.size(); i++) | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
1992 | if (product->miscs.at(i).use_use == MISC_USES_PRIMARY) |
240 | 1993 | lines++; |
1994 | if (lines) { | |
1995 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
1996 | printer->newPage(); | |
1997 | printHeader(&painter); | |
1998 | y = 120; | |
1999 | } else { | |
2000 | y += 20; | |
2001 | } | |
2002 | checkHeader(&painter, &y, tr("Primary fermentation")); | |
2003 | for (int i = 0; i < product->fermentables.size(); i++) { | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2004 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_FERMENTATION) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2005 | checkLine(&painter, &y, QString(tr("Add %1 kg `%2` on day 3 or 4")).arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2006 | .arg(product->fermentables.at(i).name)); |
240 | 2007 | } |
2008 | for (int i = 0; i < product->miscs.size(); i++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2009 | if (product->miscs.at(i).use_use == MISC_USES_PRIMARY) { |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2010 | QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml"; |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2011 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` on day 3 or 4")).arg(product->miscs.at(i).amount * 1000 * factor, 1, 'f', 3) |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2012 | .arg(unit).arg(product->miscs.at(i).name)); |
240 | 2013 | } |
2014 | } | |
2015 | } | |
2016 | if (checkSplit(&painter, &y, 4)) | |
2017 | factor = 1; | |
2018 | ||
2019 | /* During secondary fermentation, yeast */ | |
2020 | lines = 0; | |
2021 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2022 | if (product->yeasts.at(i).use == YEAST_USE_SECONDARY) |
240 | 2023 | lines++; |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2024 | if (product->yeasts.at(i).harvest_time > 0) |
240 | 2025 | lines++; |
2026 | } | |
2027 | if (lines) { | |
2028 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
2029 | printer->newPage(); | |
2030 | printHeader(&painter); | |
2031 | y = 120; | |
2032 | } else { | |
2033 | y += 20; | |
2034 | } | |
2035 | checkHeader(&painter, &y, tr("Secondary fermentation")); | |
2036 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2037 | if (product->yeasts.at(i).use == YEAST_USE_SECONDARY) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2038 | if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) { |
240 | 2039 | checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)")) |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2040 | .arg(product->yeasts.at(i).amount).arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2041 | } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2042 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2043 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 2044 | } else { |
2045 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` yeast (with starter if needed)")) | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2046 | .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2047 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 2048 | } |
2049 | } | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2050 | if (product->yeasts.at(i).harvest_time > 0) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2051 | checkLine(&painter, &y, QString(tr("After %1 hours harvest yeast from the %2")).arg(product->yeasts.at(i).harvest_time) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2052 | .arg((product->yeasts.at(i).harvest_top > 0) ? "top":"bottom")); |
240 | 2053 | } |
2054 | } | |
2055 | } | |
2056 | if (checkSplit(&painter, &y, 5)) | |
2057 | factor = 1; | |
2058 | ||
2059 | /* During tertiary fermentation */ | |
2060 | lines = 0; | |
2061 | for (int i = 0; i < product->fermentables.size(); i++) | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2062 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING) |
240 | 2063 | lines++; |
2064 | for (int i = 0; i < product->hops.size(); i++) | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
2065 | if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP) |
240 | 2066 | lines++; |
2067 | for (int i = 0; i < product->miscs.size(); i++) | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2068 | if (product->miscs.at(i).use_use == MISC_USES_SECONDARY) |
240 | 2069 | lines++; |
2070 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2071 | if (product->yeasts.at(i).use == YEAST_USE_TERTIARY) |
240 | 2072 | lines++; |
2073 | } | |
2074 | if (lines) { | |
2075 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
2076 | printer->newPage(); | |
2077 | printHeader(&painter); | |
2078 | y = 120; | |
2079 | } else { | |
2080 | y += 20; | |
2081 | } | |
2082 | checkHeader(&painter, &y, tr("Tertiary fermentation")); | |
2083 | for (int i = 0; i < product->fermentables.size(); i++) { | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2084 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_LAGERING) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2085 | checkLine(&painter, &y, QString(tr("Add %1 kg `%2`")).arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2086 | .arg(product->fermentables.at(i).name)); |
240 | 2087 | } |
2088 | for (int i = 0; i < product->hops.size(); i++) { | |
282
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
2089 | if (product->hops.at(i).useat == HOP_USEAT_DRY_HOP) { |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
2090 | checkLine(&painter, &y, QString(tr("Add %1 gram `%2` for %3 days")).arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 1) |
d1d208a857b0
Member names for hops normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
280
diff
changeset
|
2091 | .arg(product->hops.at(i).name).arg(product->hops.at(i).time / 1440)); |
240 | 2092 | } |
2093 | } | |
2094 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2095 | if (product->yeasts.at(i).use == YEAST_USE_TERTIARY) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2096 | if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) { |
240 | 2097 | checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)")) |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2098 | .arg(product->yeasts.at(i).amount).arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2099 | } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2100 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2101 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 2102 | } else { |
2103 | checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` yeast (with starter if needed)")) | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2104 | .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2105 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 2106 | } |
2107 | } | |
2108 | } | |
2109 | for (int i = 0; i < product->miscs.size(); i++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2110 | if (product->miscs.at(i).use_use == MISC_USES_SECONDARY) { |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2111 | QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml"; |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2112 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` for %4 days")).arg(product->miscs.at(i).amount * 1000.0 * factor, 1, 'f', 2) |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2113 | .arg(unit).arg(product->miscs.at(i).name).arg(product->miscs.at(i).time / 1440)); |
240 | 2114 | } |
2115 | } | |
2116 | } | |
2117 | if (checkSplit(&painter, &y, 6)) | |
2118 | factor = 1; | |
2119 | ||
2120 | /* During packaging */ | |
2121 | lines = 0; | |
2122 | for (int i = 0; i < product->fermentables.size(); i++) | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2123 | if (product->fermentables.at(i).added >= FERMENTABLE_ADDED_BOTTLE) |
240 | 2124 | lines++; |
379
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2125 | for (int i = 0; i < product->hops.size(); i++) |
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2126 | if (product->hops.at(i).useat == HOP_USEAT_BOTTLING) |
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2127 | lines++; |
240 | 2128 | for (int i = 0; i < product->miscs.size(); i++) |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2129 | if (product->miscs.at(i).use_use == MISC_USES_BOTTLING) |
240 | 2130 | lines++; |
2131 | for (int i = 0; i < product->yeasts.size(); i++) | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2132 | if (product->yeasts.at(i).use == YEAST_USE_BOTTLE) |
240 | 2133 | lines++; |
2134 | if (lines) { | |
2135 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
2136 | printer->newPage(); | |
2137 | printHeader(&painter); | |
2138 | y = 120; | |
2139 | } else { | |
2140 | y += 20; | |
2141 | } | |
2142 | checkHeader(&painter, &y, tr("Packaging")); | |
2143 | for (int i = 0; i < product->fermentables.size(); i++) { | |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2144 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_BOTTLE) |
240 | 2145 | checkLine(&painter, &y, QString(tr("Bottling add %1 kg `%2` with %3 liter water")) |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2146 | .arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2147 | .arg(product->fermentables.at(i).name).arg(product->bottle_priming_water * factor, 1, 'f', 3)); |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2148 | if (product->fermentables.at(i).added == FERMENTABLE_ADDED_KEGS) |
240 | 2149 | checkLine(&painter, &y, QString(tr("Kegging add %1 kg `%2` with %3 liter water")) |
283
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2150 | .arg(product->fermentables.at(i).amount * factor, 1, 'f', 3) |
242a68fa7186
Member names for fermentables normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
282
diff
changeset
|
2151 | .arg(product->fermentables.at(i).name).arg(product->keg_priming_water * factor, 1, 'f', 3)); |
240 | 2152 | } |
2153 | for (int i = 0; i < product->yeasts.size(); i++) { | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2154 | if (product->yeasts.at(i).use == YEAST_USE_BOTTLE) { |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2155 | if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) { |
240 | 2156 | checkLine(&painter, &y, QString(tr("Add %1, `%2` as bottle yeast")) |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2157 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2158 | } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { |
240 | 2159 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` as bottle yeast")) |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2160 | .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2161 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 2162 | } else { |
2163 | checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` as bottle yeast")) | |
284
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2164 | .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) |
33bb98c33e6a
Member names for yeasts normalized.
Michiel Broek <mbroek@mbse.eu>
parents:
283
diff
changeset
|
2165 | .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); |
240 | 2166 | } |
2167 | } | |
2168 | } | |
2169 | for (int i = 0; i < product->miscs.size(); i++) { | |
280
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2170 | if (product->miscs.at(i).use_use == MISC_USES_BOTTLING) { |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2171 | QString unit = (product->miscs.at(i).amount_is_weight) ? "gr":"ml"; |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2172 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` during bottling")).arg(product->miscs.at(i).amount * 1000 * factor, 1, 'f', 2) |
efc213beb605
Member names of miscs normalized. This was a leftover from porting from php code.
Michiel Broek <mbroek@mbse.eu>
parents:
272
diff
changeset
|
2173 | .arg(unit).arg(product->miscs.at(i).name)); |
240 | 2174 | } |
2175 | } | |
379
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2176 | for (int i = 0; i < product->hops.size(); i++) { |
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2177 | if (product->hops.at(i).useat == HOP_USEAT_BOTTLING) { |
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2178 | checkLine(&painter, &y, QString(tr("Add %1 gr `%2`")).arg(product->hops.at(i).amount * 1000 * factor, 1, 'f', 2) |
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2179 | .arg(product->hops.at(i).name)); |
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2180 | } |
0f2ce4ebd1b8
Print recipe and product, miscs weights have 2 decimals. Add hop extract during bottling to the checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
373
diff
changeset
|
2181 | } |
240 | 2182 | } |
386
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2183 | } else if (p_job == PR_REP_TOTAL) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2184 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2185 | qInfo() << "Print total production"; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2186 | printHeader(&painter); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2187 | y = 120; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2188 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2189 | /* Report header */ |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2190 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2191 | painter.setPen(Qt::black); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2192 | painter.fillRect( 20, y, 540, 20, c_header); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2193 | painter.drawText( 20, y+4, 80, 20, Qt::AlignHCenter, tr("Number")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2194 | painter.drawText(100, y+4, 80, 20, Qt::AlignHCenter, tr("Year")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2195 | painter.drawText(180, y+4, 120, 20, Qt::AlignRight, tr("Brew sessions")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2196 | painter.drawText(300, y+4, 120, 20, Qt::AlignRight, tr("Brew volume")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2197 | painter.drawText(420, y+4, 120, 20, Qt::AlignRight, tr("Average volume")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2198 | y += 20; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2199 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2200 | query.exec("SELECT DISTINCT YEAR(package_date) FROM products WHERE package_date ORDER BY package_date"); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2201 | query.first(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2202 | int regel = 0, brews = 0, total = 0; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2203 | double packaged = 0, tvolume = 0, average; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2204 | QString year = ""; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2205 | for (int i = 0 ; i < query.size() ; i++ ) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2206 | if ((y + 20) > painter.device()->height()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2207 | printer->newPage(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2208 | printHeader(&painter); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2209 | y = 120; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2210 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2211 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2212 | brews = 0; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2213 | packaged = 0; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2214 | regel++; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2215 | year = query.value(0).toString(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2216 | QSqlQuery query2; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2217 | query2.exec("SELECT package_volume FROM products WHERE package_date AND YEAR(package_date) = '" + year + "'"); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2218 | while (query2.next()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2219 | brews++; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2220 | total++; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2221 | packaged += query2.value(0).toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2222 | tvolume += query2.value(0).toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2223 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2224 | average = packaged / brews; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2225 | painter.fillRect( 20, y, 540, 20, (i % 2) ? c_line1:c_line2); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2226 | painter.drawText( 20, y+4, 80, 20, Qt::AlignCenter, QString("%1").arg(regel)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2227 | painter.drawText(100, y+4, 100, 20, Qt::AlignCenter, year); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2228 | painter.drawText(180, y+4, 120, 20, Qt::AlignRight, QString("%1").arg(brews)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2229 | painter.drawText(300, y+4, 120, 20, Qt::AlignRight, QString("%1 L").arg(packaged, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2230 | painter.drawText(420, y+4, 120, 20, Qt::AlignRight, QString("%1 L").arg(average, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2231 | query.next(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2232 | y += 20; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2233 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2234 | average = tvolume / total; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2235 | painter.fillRect(180, y, 360, 20, w_line); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2236 | painter.drawText(180, y+4, 120, 20, Qt::AlignRight, QString("%1").arg(total)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2237 | painter.drawText(300, y+4, 120, 20, Qt::AlignRight, QString("%1 L").arg(tvolume, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2238 | painter.drawText(420, y+4, 120, 20, Qt::AlignRight, QString("%1 L").arg(average, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2239 | y += 20; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2240 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2241 | } else if (p_job == PR_REP_EFF) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2242 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2243 | qInfo() << "Print efficiency"; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2244 | y = painter.device()->height() + 100; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2245 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2246 | query.exec("SELECT * FROM products WHERE package_date AND type='2' ORDER BY code"); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2247 | query.first(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2248 | for (int i = 0 ; i < query.size() ; i++ ) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2249 | if ((y + 20) > painter.device()->height()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2250 | if (i > 0) |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2251 | printer->newPage(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2252 | printHeader(&painter); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2253 | y = 120; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2254 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2255 | /* Report header */ |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2256 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2257 | painter.setPen(Qt::black); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2258 | painter.fillRect( 20, y, 715, 20, c_header); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2259 | painter.drawText( 25, y+4, 65, 20, Qt::AlignLeft, tr("Code")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2260 | painter.drawText( 90, y+4, 200, 20, Qt::AlignLeft, tr("Name")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2261 | painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, tr("Beer style")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2262 | painter.drawText(410, y+4, 80, 20, Qt::AlignRight, tr("Max extract")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2263 | painter.drawText(490, y+4, 80, 20, Qt::AlignRight, tr("Mash eff.")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2264 | painter.drawText(570, y+4, 80, 20, Qt::AlignRight, tr("Sparge eff")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2265 | painter.drawText(650, y+4, 80, 20, Qt::AlignRight, tr("Boil eff")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2266 | y += 20; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2267 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2268 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2269 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2270 | /* |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2271 | * Data is not always available, calculate the missing pieces. |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2272 | */ |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2273 | double mvol = 0, msugars = 0, ssugars = 0; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2274 | QJsonParseError parseError; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2275 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2276 | const auto& ma_json = query.value("json_mashs").toString().trimmed(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2277 | if (!ma_json.trimmed().isEmpty()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2278 | const auto& formattedJson = QString("%1").arg(ma_json); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2279 | QJsonDocument mashs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2280 | if (parseError.error != QJsonParseError::NoError) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2281 | qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2282 | } else if (mashs.isArray()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2283 | for (int j = 0; j < mashs.array().size(); j++) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2284 | QJsonObject obj = mashs.array().at(j).toObject(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2285 | if (obj["step_type"].toInt() == 0) |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2286 | mvol += obj["step_infuse_amount"].toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2287 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2288 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2289 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2290 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2291 | const auto& f_json = query.value("json_fermentables").toString(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2292 | if (!f_json.trimmed().isEmpty()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2293 | const auto& formattedJson = QString("%1").arg(f_json); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2294 | QJsonDocument fermentables = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2295 | if (parseError.error != QJsonParseError::NoError) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2296 | qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2297 | } else if (fermentables.isArray()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2298 | for (int j = 0; j < fermentables.array().size(); j++) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2299 | QJsonObject obj = fermentables.array().at(j).toObject(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2300 | if (obj["f_added"].toInt() == 0) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2301 | double d = obj["f_amount"].toDouble() * (obj["f_yield"].toDouble() / 100) * (1 - obj["f_moisture"].toDouble() / 100); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2302 | ssugars += obj["f_amount"].toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2303 | mvol += obj["f_amount"].toDouble() * obj["f_moisture"].toDouble() / 100; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2304 | msugars += d; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2305 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2306 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2307 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2308 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2309 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2310 | double sugardensity = 1.611; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2311 | double v = msugars / sugardensity + mvol; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2312 | double plato = 1000 * msugars / (v * 10); // deg. Plato |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2313 | double mash_efficiency = query.value("brew_mash_efficiency").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2314 | double mash_sg = query.value("brew_mash_sg").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2315 | if ((mash_efficiency == 0) && (mash_sg > 1)) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2316 | mash_efficiency = 100 * Utils::sg_to_plato(mash_sg) / plato; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2317 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2318 | double mash_extract = 100 * msugars / ssugars; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2319 | double preboil_sg = query.value("brew_preboil_sg").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2320 | double preboil_volume = query.value("brew_preboil_volume").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2321 | double est_preboil_plato = Utils::sg_to_plato(preboil_sg) * (preboil_volume / 1.04) * preboil_sg * 10 / 1000; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2322 | double preboil_efficiency = query.value("brew_preboil_efficiency").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2323 | if ((msugars > 0) && (preboil_efficiency == 0)) |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2324 | preboil_efficiency = est_preboil_plato / msugars * 100; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2325 | if (preboil_efficiency < 0) |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2326 | preboil_efficiency = 0; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2327 | double aboil_efficiency = query.value("brew_aboil_efficiency").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2328 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2329 | painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2330 | painter.drawText( 25, y+4, 65, 20, Qt::AlignLeft, query.value("code").toString()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2331 | painter.drawText( 90, y+4, 200, 20, Qt::AlignLeft, query.value("name").toString()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2332 | painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, query.value("st_name").toString()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2333 | painter.drawText(410, y+4, 80, 20, Qt::AlignRight, QString("%1%").arg(mash_extract, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2334 | painter.drawText(490, y+4, 80, 20, Qt::AlignRight, QString("%1%").arg(mash_efficiency, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2335 | painter.drawText(570, y+4, 80, 20, Qt::AlignRight, QString("%1%").arg(preboil_efficiency, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2336 | painter.drawText(650, y+4, 80, 20, Qt::AlignRight, QString("%1%").arg(aboil_efficiency, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2337 | query.next(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2338 | y += 20; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2339 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2340 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2341 | } else if (p_job == PR_REP_SVG) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2342 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2343 | qInfo() << "Print fermentations"; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2344 | y = painter.device()->height() + 100; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2345 | QString y_name, y_lab, y_product; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2346 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2347 | /* |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2348 | * Works from MariaDB 10.6.x and later, MySQL 8.x and later. |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2349 | * Pick the first yeast record, that should be the one used for primary. |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2350 | */ |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2351 | query.exec("SELECT code,name,brew_date_end,primary_end_temp,primary_end_date,secondary_temp,secondary_end_date,tertiary_temp," |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2352 | "package_date,brew_fermenter_sg,fg,json_yeasts," |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2353 | "JSON_EXTRACT(json_yeasts, '$[0].y_laboratory') AS yeastLab,JSON_EXTRACT(json_yeasts, '$[0].y_product_id') AS yeastID " |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2354 | "FROM products WHERE package_date AND type='2' ORDER BY yeastID"); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2355 | query.first(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2356 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2357 | for (int i = 0 ; i < query.size() ; i++ ) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2358 | if ((y + 20) > painter.device()->height()) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2359 | if (i > 0) |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2360 | printer->newPage(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2361 | printHeader(&painter); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2362 | y = 120; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2363 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2364 | /* Report header */ |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2365 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2366 | painter.setPen(Qt::black); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2367 | painter.fillRect( 20, y, 715, 20, c_header); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2368 | painter.drawText( 25, y+4, 65, 20, Qt::AlignLeft, tr("Code")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2369 | painter.drawText( 90, y+4, 180, 20, Qt::AlignLeft, tr("Name")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2370 | painter.drawText(270, y+4, 110, 20, Qt::AlignLeft, tr("Yeast")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2371 | painter.drawText(380, y+4, 60, 20, Qt::AlignHCenter, tr("Primary")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2372 | painter.drawText(440, y+4, 60, 20, Qt::AlignHCenter, tr("Secondary")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2373 | painter.drawText(500, y+4, 60, 20, Qt::AlignHCenter, tr("Tertiary")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2374 | painter.drawText(560, y+4, 40, 20, Qt::AlignRight, tr("Days")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2375 | painter.drawText(600, y+4, 40, 20, Qt::AlignRight, tr("OG")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2376 | painter.drawText(640, y+4, 40, 20, Qt::AlignRight, tr("FG")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2377 | painter.drawText(680, y+4, 50, 20, Qt::AlignRight, tr("AA")); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2378 | y += 20; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2379 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2380 | } |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2381 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2382 | int primary = query.value("brew_date_end").toDate().daysTo(query.value("primary_end_date").toDate()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2383 | int secondary = query.value("primary_end_date").toDate().daysTo(query.value("secondary_end_date").toDate()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2384 | int tertiary = query.value("secondary_end_date").toDate().daysTo(query.value("package_date").toDate()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2385 | int total = query.value("brew_date_end").toDate().daysTo(query.value("package_date").toDate()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2386 | double og = query.value("brew_fermenter_sg").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2387 | double fg = query.value("fg").toDouble(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2388 | double aa = Utils::calc_svg(og, fg); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2389 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2390 | painter.fillRect( 20, y, 715, 20, (i % 2) ? c_line1:c_line2); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2391 | painter.drawText( 25, y+4, 65, 20, Qt::AlignLeft, query.value("code").toString()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2392 | painter.drawText( 90, y+4, 180, 20, Qt::AlignLeft, query.value("name").toString()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2393 | painter.drawText(270, y+4, 110, 20, Qt::AlignLeft, query.value("yeastID").toString() + " " + query.value("yeastLab").toString()); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2394 | painter.drawText(380, y+4, 40, 20, Qt::AlignRight, QString("%1°").arg(query.value("primary_end_temp").toDouble(), 2, 'f', 1)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2395 | painter.drawText(420, y+4, 20, 20, Qt::AlignRight, QString("%1").arg(primary)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2396 | painter.drawText(440, y+4, 40, 20, Qt::AlignRight, QString("%1°").arg(query.value("secondary_temp").toDouble(), 2, 'f', 1)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2397 | painter.drawText(480, y+4, 20, 20, Qt::AlignRight, QString("%1").arg(secondary)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2398 | painter.drawText(500, y+4, 40, 20, Qt::AlignRight, QString("%1°").arg(query.value("tertiary_temp").toDouble(), 2, 'f', 1)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2399 | painter.drawText(540, y+4, 20, 20, Qt::AlignRight, QString("%1").arg(tertiary)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2400 | painter.drawText(560, y+4, 40, 20, Qt::AlignRight, QString("%1").arg(total)); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2401 | painter.drawText(600, y+4, 40, 20, Qt::AlignRight, QString("%1").arg(og, 4, 'f', 3, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2402 | painter.drawText(640, y+4, 40, 20, Qt::AlignRight, QString("%1").arg(fg, 4, 'f', 3, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2403 | painter.drawText(680, y+4, 50, 20, Qt::AlignRight, QString("%1%").arg(aa, 2, 'f', 1, '0')); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2404 | |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2405 | query.next(); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2406 | y += 20; |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2407 | } |
160 | 2408 | } |
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
|
2409 | |
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
|
2410 | 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
|
2411 | } |
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
|
2412 | |
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
|
2413 | |
240 | 2414 | void PrinterDialog::checkHeader(QPainter *painter, qreal *y, QString text) |
2415 | { | |
2416 | painter->setFont(QFont("Arial", 10, QFont::Bold)); | |
2417 | painter->setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2418 | painter->drawText(50, *y, 700, 20, Qt::AlignLeft, text); |
240 | 2419 | painter->setFont(QFont("Arial", 10, QFont::Normal)); |
2420 | *y += 20; | |
2421 | } | |
2422 | ||
2423 | ||
2424 | /* | |
2425 | * Draw a checkbox and text. | |
2426 | */ | |
2427 | void PrinterDialog::checkLine(QPainter *painter, qreal *y, QString text) | |
2428 | { | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2429 | painter->drawRect(24, *y, 16, 16); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2430 | painter->drawText(50, *y,630, 20, Qt::AlignLeft, text); |
240 | 2431 | *y += 20; |
2432 | } | |
2433 | ||
2434 | ||
2435 | void PrinterDialog::checkInput(QPainter *painter, qreal *y, QString text, QString prompt) | |
2436 | { | |
2437 | if (text != "") { | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2438 | painter->drawRect(24, *y, 16, 16); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2439 | painter->drawText(50, *y,480, 20, Qt::AlignLeft, text); |
240 | 2440 | } |
2441 | painter->drawText(515, *y, 150, 20, Qt::AlignRight, QString(tr("Measured:")) + QString(" _________")); | |
2442 | painter->drawText(675, *y, 60, 20, Qt::AlignLeft, prompt); | |
2443 | *y += 20; | |
2444 | } | |
2445 | ||
2446 | ||
459
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2447 | void PrinterDialog::messageInput(QPainter *painter, qreal *y, QString text, QString prompt) |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2448 | { |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2449 | if (text != "") { |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2450 | painter->drawText(50, *y,480, 20, Qt::AlignLeft, text); |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2451 | } |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2452 | painter->drawText(515, *y, 150, 20, Qt::AlignRight, QString(tr("Measured:")) + QString(" _________")); |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2453 | painter->drawText(675, *y, 60, 20, Qt::AlignLeft, prompt); |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2454 | *y += 20; |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2455 | } |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2456 | |
fbb250c725bb
In print checklist show volume after boil inclusive immersion chiller volume. Improved some prompts in equipment edit.
Michiel Broek <mbroek@mbse.eu>
parents:
458
diff
changeset
|
2457 | |
240 | 2458 | bool PrinterDialog::checkSplit(QPainter *painter, qreal *y, int moment) |
2459 | { | |
2460 | if (product->divide_type && product->divide_type == moment) { | |
2461 | *y += 20; | |
2462 | painter->setFont(QFont("Helvetica", 14, QFont::Bold)); | |
301
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
2463 | painter->drawText(20, *y, 715, 20, Qt::AlignCenter, |
fe6346211b5b
Finally the translation of string arrays is working.
Michiel Broek <mbroek@mbse.eu>
parents:
284
diff
changeset
|
2464 | QString(tr("%1 split the batch here!")).arg(QCoreApplication::translate("Splitter", g_prod_split[product->divide_type]))); |
240 | 2465 | painter->setFont(QFont("Arial", 10, QFont::Normal)); |
2466 | *y += 26; | |
2467 | return true; | |
2468 | } | |
2469 | return false; | |
2470 | } | |
2471 | ||
2472 | ||
237 | 2473 | QString PrinterDialog::strDiff(double v1, double v2, int decimals, QString suffix) |
2474 | { | |
2475 | return QString("%1%2%3").arg((v2 > v1) ? "+":"").arg(v2 - v1, 1, 'f', decimals).arg(suffix); | |
2476 | } | |
2477 | ||
2478 | ||
2479 | QString PrinterDialog::strDensity(double density) | |
2480 | { | |
2481 | return QString("%1 SG %2°Brix %3°P").arg(density, 1, 'f', 3).arg(Utils::sg_to_brix(density), 1, 'f', 1).arg(Utils::sg_to_plato(density), 1, 'f', 1); | |
2482 | } | |
2483 | ||
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
|
2484 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2485 | 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
|
2486 | { |
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
|
2487 | 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
|
2488 | outPixmap.loadFromData(my_logoByteArray); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2489 | int w = outPixmap.width(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2490 | int h = outPixmap.height(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2491 | /* Make sure to keep the logo aspect ratio */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2492 | if (w == h) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2493 | painter->drawPixmap(20, 0, 100, 100, outPixmap); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2494 | } else if (w > h) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2495 | painter->drawPixmap(20, 0, 100, (h * 100) / w, outPixmap); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2496 | } else { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2497 | painter->drawPixmap(20, 0, (w * 100) / h, 100, outPixmap); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2498 | } |
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
|
2499 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2500 | /* The fat header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2501 | painter->setFont(QFont("Helvetica",18, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2502 | if (p_job == PR_SUPPLIES) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2503 | painter->drawText(140, 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
|
2504 | } else if (p_job == PR_YEASTBANK) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2505 | painter->drawText(140, 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
|
2506 | } else if (p_job == PR_RECIPE) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2507 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, recipe->name); |
240 | 2508 | } else if (p_job == PR_PRODUCT || p_job == PR_CHECKLIST) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2509 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, product->code + " " + product->name); |
386
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2510 | } else if (p_job == PR_REP_TOTAL) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2511 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, tr("Year production") + " " + my_brewery_name); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2512 | } else if (p_job == PR_REP_EFF) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2513 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, tr("Brew efficiency") + " " + my_brewery_name); |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2514 | } else if (p_job == PR_REP_SVG) { |
2e30c9c20d22
Added reports, total production, fermentations and efficiency.
Michiel Broek <mbroek@mbse.eu>
parents:
379
diff
changeset
|
2515 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, tr("Fermentations") + " " + my_brewery_name); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2516 | } else { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2517 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, "?? " + my_brewery_name); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2518 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2519 | /* The first normal header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2520 | painter->setFont(QFont("Helvetica",10, QFont::Normal)); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2521 | painter->drawText(140,35, 80, 20, Qt::AlignLeft, tr("Date and time")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2522 | painter->drawText(220,35, 400, 20, Qt::AlignLeft, ": " + QDateTime::currentDateTime().toString("dd-MMM-yyyy hh:mm")); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
2523 | if (p_job == PR_RECIPE) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2524 | painter->drawText(140,55, 80, 20, Qt::AlignLeft, tr("Beer style")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2525 | painter->drawText(220,55, 400, 20, Qt::AlignLeft, ": " + recipe->st_name); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
2526 | } |
240 | 2527 | if (p_job == PR_PRODUCT || p_job == PR_CHECKLIST) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2528 | painter->drawText(140,55, 80, 20, Qt::AlignLeft, tr("Beer style")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2529 | painter->drawText(220,55, 400, 20, Qt::AlignLeft, ": " + product->st_name); |
237 | 2530 | } |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2531 | /* 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
|
2532 | } |
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
|
2533 | |
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
|
2534 |