Sun, 05 Jun 2022 20:54:58 +0200
Reformatted output by inserting intend of 20 pixels.
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); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
66 | const QColor m_line( 175, 175, 255, 255); // also y_line |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
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 ibu_method({ "Tinseth", "Rager", "Daniels", "Garetz", "Mosher", "Noonan" }); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
71 | const QStringList color_method({ "Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" }); |
237 | 72 | const QStringList cooling_method({"-", tr("Emersion chiller"), tr("Counterflow chiller"), tr("Au bain marie"), tr("Natural") }); |
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
|
73 | |
ff7b3a41c9b5
After several days experimenting, trials and a 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 | 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
|
75 | 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
|
76 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | if (p_job == PR_SUPPLIES) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
78 | qInfo() << "Print supplies"; |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
79 | |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
80 | /* |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
81 | * Print supplies in stock |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
82 | */ |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | 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
|
84 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
85 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
86 | 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
|
87 | /* 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
|
88 | 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
|
89 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
90 | 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
|
91 | 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
|
92 | 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
|
93 | 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
|
94 | 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
|
95 | 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
|
96 | 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
|
97 | 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
|
98 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
99 | 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
|
100 | 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
|
101 | for (int i = 0 ; i < query.size() ; i++ ) { |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
102 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
103 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
104 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
105 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
106 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
107 | 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
|
108 | painter.drawText( 20, y+4, 80, 20, Qt::AlignLeft, fermentable_types[query.value(0).toInt()]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
109 | 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
|
110 | 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
|
111 | 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
|
112 | 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
|
113 | 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
|
114 | 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
|
115 | 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
|
116 | 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
|
117 | 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
|
118 | 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
|
119 | 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
|
120 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
121 | 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
|
122 | 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
|
123 | 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
|
124 | 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
|
125 | 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
|
126 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
127 | /* 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
|
128 | 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
|
129 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
130 | 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
|
131 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
132 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
133 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
134 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
135 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
136 | } |
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
|
137 | 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
|
138 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
139 | 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
|
140 | 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
|
141 | 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
|
142 | 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
|
143 | 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
|
144 | 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
|
145 | 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
|
146 | 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
|
147 | 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
|
148 | for (int i = 0; i < query.size(); i++) { |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
149 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
150 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
151 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
152 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
153 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
154 | 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
|
155 | 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
|
156 | painter.drawText(140, y+4, 240, 20, Qt::AlignLeft, query.value(0).toString()); |
155
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
157 | painter.drawText(380, y+4, 80, 20, Qt::AlignLeft, hop_forms[query.value(1).toInt()]); |
52
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | 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
|
159 | 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
|
160 | 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
|
161 | 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
|
162 | 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
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | 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
|
169 | 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
|
170 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
171 | 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
|
172 | 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
|
173 | 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
|
174 | 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
|
175 | 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
|
176 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
177 | /* 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
|
178 | 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
|
179 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
180 | 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
|
181 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
182 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
183 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
184 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
185 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
186 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
187 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
188 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
189 | 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
|
190 | 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
|
191 | 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
|
192 | 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
|
193 | 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
|
194 | 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
|
195 | 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
|
196 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
197 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
198 | for (int i = 0; i < query.size(); i++) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
199 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
200 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
201 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
202 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
203 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
204 | 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
|
205 | 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
|
206 | 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
|
207 | 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
|
208 | if (query.value(3).toInt() == 0) |
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(), 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
|
210 | else |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
211 | 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
|
212 | 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
|
213 | 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
|
214 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
215 | 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
|
216 | tot_yeasts += (query.value(4).toDouble() * query.value(5).toDouble()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
217 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
218 | query.next(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
219 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
220 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
221 | 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
|
222 | 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
|
223 | w = QString("%1 €").arg(tot_yeasts, 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
224 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
225 | 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
|
226 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
227 | /* 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
|
228 | 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
|
229 | query.first(); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
230 | 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
|
231 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
232 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
233 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
234 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
235 | y += 40; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
236 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
237 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
238 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
239 | 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
|
240 | 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
|
241 | 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
|
242 | 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
|
243 | 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
|
244 | 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
|
245 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
246 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
247 | for (int i = 0; i < query.size(); i++) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
248 | if ((y + 20) > painter.device()->height()) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
249 | printer->newPage(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
250 | printHeader(&painter); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
251 | y = 120; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
252 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
253 | 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
|
254 | painter.drawText( 20, y+4, 120, 20, Qt::AlignLeft, misc_types[query.value(1).toInt()]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
255 | 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
|
256 | if (query.value(2).toInt()) |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
257 | 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
|
258 | else |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
259 | 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
|
260 | painter.drawText(460, y+4, 115, 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(4).toDouble(), 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
262 | painter.drawText(575, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
263 | 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
|
264 | tot_miscs += (query.value(3).toDouble() * query.value(4).toDouble()); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
265 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
266 | query.next(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
267 | y += 20; |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
268 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
269 | 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
|
270 | 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
|
271 | w = QString("%1 €").arg(tot_miscs, 8, 'f', 2); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
272 | painter.drawText(655, y+4, 80, 20, Qt::AlignRight, w); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
273 | y += 20; |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
274 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
275 | } 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
|
276 | qInfo() << "Print yeastbank"; |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
277 | |
54
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 | * Print yeast in the private yeast bank. |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
280 | */ |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
281 | printHeader(&painter); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
282 | y = 120; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
283 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
284 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
285 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
286 | 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
|
287 | 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
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | 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
|
292 | 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
|
293 | y += 20; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
294 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
295 | 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
|
296 | "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
|
297 | query.bindValue(":my_lab", my_yeastlab); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
298 | query.exec(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
299 | query.first(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
300 | 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
|
301 | 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
|
302 | 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
|
303 | painter.drawText(200, y+4, 230, 20, Qt::AlignLeft, query.value(5).toString()); |
155
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
304 | painter.drawText(430, y+4, 80, 20, Qt::AlignCenter, yeast_types[query.value(1).toInt()]); |
f671c599f65b
Moved more QStringList arrays to global.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
305 | painter.drawText(510, y+4, 80, 20, Qt::AlignCenter, yeast_forms[query.value(2).toInt()]); |
54
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
306 | |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
307 | if (query.value(2).toInt() == 0) |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
308 | 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
|
309 | else |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
310 | 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
|
311 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, w); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
312 | 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
|
313 | query.next(); |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
314 | y += 20; |
bba7be9034be
Added print private yeastbank
Michiel Broek <mbroek@mbse.eu>
parents:
53
diff
changeset
|
315 | } |
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
|
316 | } 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
|
317 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
318 | qInfo() << "Print recipe" << recipe->record; |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
319 | |
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
|
320 | 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
|
321 | y = 120; |
160 | 322 | /* Generic header */ |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
323 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
324 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
325 | 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
|
326 | 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
|
327 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
328 | 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
|
329 | 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
|
330 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Brew type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
331 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, recipe_types[recipe->type]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
332 | 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
|
333 | 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
|
334 | 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
|
335 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
336 | 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
|
337 | 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
|
338 | 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
|
339 | 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
|
340 | 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
|
341 | 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
|
342 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
343 | 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
|
344 | 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
|
345 | 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
|
346 | 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
|
347 | 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
|
348 | 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
|
349 | 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
|
350 | 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
|
351 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
352 | 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
|
353 | 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
|
354 | 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
|
355 | 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
|
356 | 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
|
357 | 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
|
358 | 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
|
359 | 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
|
360 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
361 | 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
|
362 | 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
|
363 | 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
|
364 | if (recipe->est_color > 30) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
365 | painter.setPen(Qt::white); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
366 | 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
|
367 | 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
|
368 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
369 | 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
|
370 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("IBU (") + ibu_method[recipe->ibu_method] + ")"); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
371 | 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
|
372 | 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
|
373 | 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
|
374 | |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
375 | /* Fermentables */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
376 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
377 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
378 | 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
|
379 | 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
|
380 | 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
|
381 | 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
|
382 | 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
|
383 | 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
|
384 | 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
|
385 | 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
|
386 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
387 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
388 | double cost_fermentables = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
389 | QString soort, amount, use; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
390 | for (int i = 0; i < recipe->fermentables.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
391 | double cost = recipe->fermentables.at(i).f_amount * recipe->fermentables.at(i).f_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
392 | cost_fermentables += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
393 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
394 | if (recipe->fermentables.at(i).f_type == 0) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
395 | soort = fermentable_graintypes[recipe->fermentables.at(i).f_graintype]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
396 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
397 | soort = fermentable_types[recipe->fermentables.at(i).f_type]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
398 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
399 | if (recipe->fermentables.at(i).f_amount > 100) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
400 | amount = QString("%1 kg").arg(recipe->fermentables.at(i).f_amount, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
401 | else if (recipe->fermentables.at(i).f_amount > 10) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
402 | amount = QString("%1 kg").arg(recipe->fermentables.at(i).f_amount, 1, 'f', 2); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
403 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
404 | amount = QString("%1 gr").arg(recipe->fermentables.at(i).f_amount * 1000, 1, 'f', 0); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
405 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
406 | 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
|
407 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
408 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->fermentables.at(i).f_name + |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
409 | QString(", %1 EBC (").arg(recipe->fermentables.at(i).f_color, 1, 'f', 0) + |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
410 | recipe->fermentables.at(i).f_supplier + ")"); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
411 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).f_percentage, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
412 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->fermentables.at(i).f_yield, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
413 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
414 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, fermentable_added[recipe->fermentables.at(i).f_added]); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
415 | 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
|
416 | 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
|
417 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
418 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
419 | 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
|
420 | 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
|
421 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
422 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
423 | /* Hops */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
424 | 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
|
425 | 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
|
426 | 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
|
427 | 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
|
428 | 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
|
429 | 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
|
430 | 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
|
431 | 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
|
432 | 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
|
433 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
434 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
435 | double cost_hops = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
436 | 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
|
437 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
438 | double cost = recipe->hops.at(i).h_amount * recipe->hops.at(i).h_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
439 | cost_hops += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
440 | double ibu = Utils::toIBU(recipe->hops.at(i).h_useat, recipe->hops.at(i).h_form, recipe->preboil_sg, recipe->batch_size, |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
441 | recipe->hops.at(i).h_amount, recipe->hops.at(i).h_time, recipe->hops.at(i).h_alpha, |
208
615afedbcd25
Fixed 0 IBU for First Wort Hop or Mashhop is used.
Michiel Broek <mbroek@mbse.eu>
parents:
175
diff
changeset
|
442 | recipe->ibu_method, 0, recipe->hops.at(i).h_time, 0, recipe->boil_time); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
443 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
444 | if (recipe->hops.at(i).h_useat == 2 || recipe->hops.at(i).h_useat == 4) // Boil or Whirlpool |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
445 | use = hop_useat[recipe->hops.at(i).h_useat] + QString(" %1 min").arg(recipe->hops.at(i).h_time); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
446 | else if (recipe->hops.at(i).h_useat == 5) // Dryhop |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
447 | use = hop_useat[recipe->hops.at(i).h_useat] + QString(" %1 days").arg(recipe->hops.at(i).h_time / 1440); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
448 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
449 | use = hop_useat[recipe->hops.at(i).h_useat]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
450 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
451 | if (recipe->hops.at(i).h_amount > 1) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
452 | amount = QString("%1 kg").arg(recipe->hops.at(i).h_amount, 1, 'f', 3); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
453 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
454 | amount = QString("%1 gr").arg(recipe->hops.at(i).h_amount * 1000, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
455 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
456 | painter.fillRect( 20, y, 715, 20, h_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
457 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->hops.at(i).h_name + " (" + recipe->hops.at(i).h_origin + ")"); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
458 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->hops.at(i).h_alpha, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
459 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
460 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, hop_forms[recipe->hops.at(i).h_form]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
461 | 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
|
462 | 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
|
463 | 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
|
464 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
465 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
466 | 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
|
467 | 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
|
468 | y += 40; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
469 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
470 | /* Yeasts */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
471 | 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
|
472 | 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
|
473 | 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
|
474 | 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
|
475 | 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
|
476 | 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
|
477 | 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
|
478 | 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
|
479 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
480 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
481 | double cost_yeasts = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
482 | for (int i = 0; i < recipe->yeasts.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
483 | double cost = recipe->yeasts.at(i).y_amount * recipe->yeasts.at(i).y_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
484 | cost_yeasts += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
485 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
486 | if (recipe->yeasts.at(i).y_form == 0) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
487 | amount = QString("%1 pack").arg(recipe->yeasts.at(i).y_amount, 1, 'f', 0); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
488 | else if (recipe->yeasts.at(i).y_form == 1 || recipe->yeasts.at(i).y_form == 6) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
489 | amount = QString("%1 gr").arg(recipe->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
490 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
491 | amount = QString("%1 ml").arg(recipe->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
492 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
493 | 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
|
494 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->yeasts.at(i).y_laboratory + " " + |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
495 | recipe->yeasts.at(i).y_product_id + " (" + |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
496 | recipe->yeasts.at(i).y_name + ")"); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
497 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->yeasts.at(i).y_attenuation, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
498 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, yeast_forms[recipe->yeasts.at(i).y_form]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
499 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, yeast_use[recipe->yeasts.at(i).y_use]); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
500 | 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
|
501 | 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
|
502 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
503 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
504 | 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
|
505 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3)); |
160 | 506 | |
507 | if ((y + 80 + (recipe->miscs.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ | |
508 | printer->newPage(); | |
509 | printHeader(&painter); | |
510 | y = 120; | |
511 | } else { | |
512 | y += 40; | |
513 | } | |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
514 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
515 | /* Miscs */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
516 | 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
|
517 | 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
|
518 | 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
|
519 | 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
|
520 | 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
|
521 | 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
|
522 | 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
|
523 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
524 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
525 | double cost_miscs = 0; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
526 | for (int i = 0; i < recipe->miscs.size(); i++) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
527 | double cost = recipe->miscs.at(i).m_amount * recipe->miscs.at(i).m_cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
528 | cost_miscs += cost; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
529 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
530 | if (recipe->miscs.at(i).m_use_use == 2) |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
531 | use = misc_uses[recipe->miscs.at(i).m_use_use] + QString(" %1 min").arg(recipe->miscs.at(i).m_time); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
532 | else |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
533 | use = misc_uses[recipe->miscs.at(i).m_use_use]; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
534 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
535 | if (recipe->miscs.at(i).m_type == 4) // Water agent |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
536 | painter.fillRect( 20, y, 715, 20, mw_line); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
537 | else if (recipe->miscs.at(i).m_type == 3) // Fining |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
538 | painter.fillRect( 20, y, 715, 20, mf_line); |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
539 | else if (recipe->miscs.at(i).m_type < 3 || recipe->miscs.at(i).m_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
|
540 | 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
|
541 | else |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
542 | painter.fillRect( 20, y, 715, 20, mo_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
543 | painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, recipe->miscs.at(i).m_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
544 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, misc_types[recipe->miscs.at(i).m_type]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
545 | 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
|
546 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
547 | QString("%1 %2").arg(recipe->miscs.at(i).m_amount * 1000.0, 1, 'f', 1).arg(recipe->miscs.at(i).m_amount_is_weight ? "gr":"ml")); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
548 | 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
|
549 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
550 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
551 | 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
|
552 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3)); |
160 | 553 | |
554 | if ((y + 60 + (recipe->mashs.size() * 20)) > painter.device()->height()) { /* Rows + header + blank */ | |
555 | printer->newPage(); | |
556 | printHeader(&painter); | |
557 | y = 120; | |
558 | } else { | |
559 | y += 40; | |
560 | } | |
159
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
561 | |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
562 | /* Mash */ |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
563 | 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
|
564 | 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
|
565 | 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
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | 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
|
570 | 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
|
571 | 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
|
572 | 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
|
573 | 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
|
574 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
575 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
576 | for (int i = 0; i < recipe->mashs.size(); i++) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
577 | painter.fillRect( 20, y, 715, 20, m_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
578 | painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, recipe->mashs.at(i).step_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
579 | painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, 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
|
580 | 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
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | 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
|
586 | 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
|
587 | 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
|
588 | } |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
589 | y += 20; |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
590 | } |
160 | 591 | |
592 | if ((y + 80 + ((recipe->w2_amount > 0) ? 40:0)) > painter.device()->height()) { /* waters + header + blank */ | |
593 | printer->newPage(); | |
594 | printHeader(&painter); | |
595 | y = 120; | |
596 | } else { | |
597 | y += 40; | |
598 | } | |
599 | ||
600 | /* Water */ | |
601 | 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
|
602 | 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
|
603 | 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
|
604 | 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
|
605 | 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
|
606 | 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
|
607 | 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
|
608 | 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
|
609 | 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
|
610 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("SO4")); |
160 | 611 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("pH")); |
612 | y += 20; | |
613 | 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
|
614 | 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
|
615 | 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
|
616 | 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
|
617 | 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
|
618 | 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
|
619 | 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
|
620 | 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
|
621 | 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
|
622 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_sulfate, 1, 'f', 1)); |
160 | 623 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w1_ph, 1, 'f', 2)); |
624 | y += 20; | |
625 | if (recipe->w2_amount > 0) { | |
626 | /* | |
627 | * If there is dillution water, show it and the mixed result too. | |
628 | */ | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
629 | 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
|
630 | 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
|
631 | 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
|
632 | 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
|
633 | 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
|
634 | 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
|
635 | 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
|
636 | 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
|
637 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_sulfate, 1, 'f', 1)); |
160 | 638 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->w2_ph, 1, 'f', 2)); |
639 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
640 | 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
|
641 | 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
|
642 | 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
|
643 | 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
|
644 | 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
|
645 | 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
|
646 | 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
|
647 | 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
|
648 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_sulfate, 1, 'f', 1)); |
160 | 649 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wg_ph, 1, 'f', 2)); |
650 | y += 20; | |
651 | } | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
652 | 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
|
653 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated water")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
654 | 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
|
655 | 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
|
656 | 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
|
657 | 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
|
658 | 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
|
659 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sulfate, 1, 'f', 1)); |
160 | 660 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_ph, 1, 'f', 2)); |
661 | y += 20; | |
237 | 662 | |
663 | /* | |
664 | * Print recipe notes if present. | |
665 | */ | |
666 | if (recipe->notes.length()) { | |
667 | QStringList lines = recipe->notes.split("\n"); | |
668 | ||
669 | if (lines.size() && recipe->notes != "") { | |
670 | if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) { | |
671 | printer->newPage(); | |
672 | printHeader(&painter); | |
673 | y = 120; | |
674 | } else { | |
675 | y += 40; | |
676 | } | |
677 | ||
678 | /* Notes header */ | |
679 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
680 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
681 | 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
|
682 | painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe notes")); |
237 | 683 | y += 20; |
684 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
685 | 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
|
686 | 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
|
687 | painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]); |
237 | 688 | y += 20; |
689 | } | |
690 | } | |
691 | } | |
692 | ||
693 | } else if (p_job == PR_PRODUCT) { | |
694 | ||
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
695 | qInfo() << "print product" << product->record; |
237 | 696 | printHeader(&painter); |
697 | y = 120; | |
698 | /* Generic header */ | |
699 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
700 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
701 | 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
|
702 | painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Product overview")); |
237 | 703 | y += 20; |
704 | 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
|
705 | 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
|
706 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Brew type")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
707 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, recipe_types[product->type]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
708 | 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
|
709 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Efficiency")); |
237 | 710 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 %").arg(product->efficiency, 1, 'f', 1)); |
711 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
712 | 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
|
713 | 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
|
714 | 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
|
715 | 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
|
716 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Batch size")); |
237 | 717 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L.").arg(product->batch_size, 1, 'f', 1)); |
718 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
719 | 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
|
720 | 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
|
721 | 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
|
722 | 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
|
723 | 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
|
724 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("End SG")); |
237 | 725 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_fg, 1, 'f', 3)); |
726 | 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)); | |
727 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
728 | 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
|
729 | 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
|
730 | 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
|
731 | 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
|
732 | 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
|
733 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Estimated CO2 vol")); |
237 | 734 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_carb, 1, 'f', 1)); |
735 | 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)); | |
736 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
737 | 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
|
738 | 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
|
739 | painter.fillRect(170, y, 180, 20, Utils::ebc_to_color(product->est_color)); |
237 | 740 | if (product->est_color > 30) |
741 | painter.setPen(Qt::white); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
742 | 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
|
743 | 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 | 744 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
745 | 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
|
746 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("IBU (") + ibu_method[product->ibu_method] + ")"); |
237 | 747 | painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_ibu, 1, 'f', 1)); |
748 | 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)); | |
749 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
750 | 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
|
751 | 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
|
752 | 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
|
753 | 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
|
754 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Stage")); |
237 | 755 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, prod_stages[product->stage]); |
756 | y += 40; | |
757 | ||
758 | /* Fermentables */ | |
759 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
760 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
761 | 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
|
762 | 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
|
763 | 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
|
764 | 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
|
765 | 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
|
766 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 767 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
768 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
769 | y += 20; | |
770 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
771 | double cost_fermentables = 0; | |
772 | QString soort, amount, use; | |
773 | for (int i = 0; i < product->fermentables.size(); i++) { | |
774 | double cost = product->fermentables.at(i).f_amount * product->fermentables.at(i).f_cost; | |
775 | cost_fermentables += cost; | |
776 | ||
777 | if (product->fermentables.at(i).f_type == 0) | |
778 | soort = fermentable_graintypes[product->fermentables.at(i).f_graintype]; | |
779 | else | |
780 | soort = fermentable_types[product->fermentables.at(i).f_type]; | |
781 | ||
782 | if (product->fermentables.at(i).f_amount > 100) | |
783 | amount = QString("%1 kg").arg(product->fermentables.at(i).f_amount, 1, 'f', 1); | |
784 | else if (product->fermentables.at(i).f_amount > 10) | |
785 | amount = QString("%1 kg").arg(product->fermentables.at(i).f_amount, 1, 'f', 2); | |
786 | else | |
787 | amount = QString("%1 gr").arg(product->fermentables.at(i).f_amount * 1000, 1, 'f', 0); | |
788 | ||
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
789 | painter.fillRect( 20, y, 715, 20, f_line); |
237 | 790 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
791 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->fermentables.at(i).f_name + |
237 | 792 | QString(", %1 EBC (").arg(product->fermentables.at(i).f_color, 1, 'f', 0) + |
793 | product->fermentables.at(i).f_supplier + ")"); | |
794 | if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
795 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).f_percentage, 1, 'f', 1)); |
237 | 796 | else |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
797 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, ""); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
798 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).f_yield, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
799 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, soort); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
800 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, fermentable_added[product->fermentables.at(i).f_added]); |
237 | 801 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
802 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); | |
803 | y += 20; | |
804 | } | |
805 | painter.fillRect(670, y, 60, 20, c_line1); | |
806 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_fermentables, 1, 'f', 3)); | |
807 | y += 40; | |
808 | ||
809 | /* Hops */ | |
810 | 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
|
811 | 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
|
812 | 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
|
813 | 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
|
814 | 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
|
815 | 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
|
816 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 817 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
818 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
819 | y += 20; | |
820 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
821 | double cost_hops = 0; | |
822 | for (int i = 0; i < product->hops.size(); i++) { | |
823 | ||
824 | double cost = product->hops.at(i).h_amount * product->hops.at(i).h_cost; | |
825 | cost_hops += cost; | |
826 | double ibu = Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, product->batch_size, | |
827 | product->hops.at(i).h_amount, product->hops.at(i).h_time, product->hops.at(i).h_alpha, | |
828 | product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); | |
829 | ||
830 | if (product->hops.at(i).h_useat == 2 || product->hops.at(i).h_useat == 4) // Boil or Whirlpool | |
831 | use = hop_useat[product->hops.at(i).h_useat] + QString(" %1 min").arg(product->hops.at(i).h_time); | |
832 | else if (product->hops.at(i).h_useat == 5) // Dryhop | |
833 | use = hop_useat[product->hops.at(i).h_useat] + QString(" %1 days").arg(product->hops.at(i).h_time / 1440); | |
834 | else | |
835 | use = hop_useat[product->hops.at(i).h_useat]; | |
836 | ||
837 | if (product->hops.at(i).h_amount > 1) | |
838 | amount = QString("%1 kg").arg(product->hops.at(i).h_amount, 1, 'f', 3); | |
839 | else | |
840 | amount = QString("%1 gr").arg(product->hops.at(i).h_amount * 1000, 1, 'f', 1); | |
841 | ||
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
842 | painter.fillRect( 20, y, 715, 20, h_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
843 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->hops.at(i).h_name + " (" + product->hops.at(i).h_origin + ")"); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
844 | painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->hops.at(i).h_alpha, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
845 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
846 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, hop_forms[product->hops.at(i).h_form]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
847 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use); |
237 | 848 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
849 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); | |
850 | y += 20; | |
851 | } | |
852 | painter.fillRect(670, y, 60, 20, c_line1); | |
853 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_hops, 1, 'f', 3)); | |
854 | y += 40; | |
855 | ||
856 | /* Yeasts */ | |
857 | 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
|
858 | 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
|
859 | 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
|
860 | 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
|
861 | 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
|
862 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 863 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
864 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
865 | y += 20; | |
866 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
867 | double cost_yeasts = 0; | |
868 | for (int i = 0; i < product->yeasts.size(); i++) { | |
869 | double cost = product->yeasts.at(i).y_amount * product->yeasts.at(i).y_cost; | |
870 | cost_yeasts += cost; | |
871 | ||
872 | if (product->yeasts.at(i).y_form == 0) | |
873 | amount = QString("%1 pack").arg(product->yeasts.at(i).y_amount, 1, 'f', 0); | |
874 | else if (product->yeasts.at(i).y_form == 1 || product->yeasts.at(i).y_form == 6) | |
875 | amount = QString("%1 gr").arg(product->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); | |
876 | else | |
877 | amount = QString("%1 ml").arg(product->yeasts.at(i).y_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
|
878 | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
879 | 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
|
880 | painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->yeasts.at(i).y_laboratory + " " + |
237 | 881 | product->yeasts.at(i).y_product_id + " (" + |
882 | product->yeasts.at(i).y_name + ")"); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
883 | painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->yeasts.at(i).y_attenuation, 1, 'f', 1)); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
884 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, yeast_forms[product->yeasts.at(i).y_form]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
885 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, yeast_use[product->yeasts.at(i).y_use]); |
237 | 886 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
887 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); | |
888 | y += 20; | |
889 | } | |
890 | if (product->starter_enable && product->prop_volume[0]) { | |
891 | int st = 0; | |
892 | double sv = 0; | |
893 | for (int i = 0; i < 4; i++) { | |
894 | if (product->prop_volume[i] > 0.0) { | |
895 | st++; | |
896 | if (product->prop_volume[i] > sv) | |
897 | sv = product->prop_volume[i]; | |
898 | } | |
899 | } | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
900 | 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
|
901 | 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
|
902 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, QString(tr("Before"))); |
237 | 903 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, QString("%1 L").arg(sv, 1, 'f', 3)); |
904 | y += 20; | |
905 | } | |
906 | painter.fillRect(670, y, 60, 20, c_line1); | |
907 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3)); | |
908 | ||
909 | if ((y + 80 + (product->miscs.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ | |
910 | printer->newPage(); | |
911 | printHeader(&painter); | |
912 | y = 120; | |
913 | } else { | |
914 | y += 40; | |
915 | } | |
916 | ||
917 | /* Miscs */ | |
918 | 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
|
919 | 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
|
920 | 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
|
921 | 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
|
922 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, tr("Use at")); |
237 | 923 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
924 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); | |
925 | y += 20; | |
926 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
927 | double cost_miscs = 0; | |
928 | for (int i = 0; i < product->miscs.size(); i++) { | |
929 | double cost = product->miscs.at(i).m_amount * product->miscs.at(i).m_cost; | |
930 | cost_miscs += cost; | |
931 | ||
932 | if (product->miscs.at(i).m_use_use == 2) | |
933 | use = misc_uses[product->miscs.at(i).m_use_use] + QString(" %1 min").arg(product->miscs.at(i).m_time); | |
934 | else | |
935 | use = misc_uses[product->miscs.at(i).m_use_use]; | |
936 | ||
937 | if (product->miscs.at(i).m_type == 4) // Water agent | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
938 | painter.fillRect( 20, y, 715, 20, mw_line); |
237 | 939 | else if (product->miscs.at(i).m_type == 3) // Fining |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
940 | painter.fillRect( 20, y, 715, 20, mf_line); |
237 | 941 | else if (product->miscs.at(i).m_type < 3 || product->miscs.at(i).m_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
|
942 | painter.fillRect( 20, y, 715, 20, ms_line); |
237 | 943 | else |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
944 | painter.fillRect( 20, y, 715, 20, mo_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
945 | painter.drawText( 20, y+4, 410, 20, Qt::AlignLeft, product->miscs.at(i).m_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
946 | painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, misc_types[product->miscs.at(i).m_type]); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
947 | painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, use); |
237 | 948 | painter.drawText(605, y+4, 60, 20, Qt::AlignRight, |
949 | QString("%1 %2").arg(product->miscs.at(i).m_amount * 1000.0, 1, 'f', 1).arg(product->miscs.at(i).m_amount_is_weight ? "gr":"ml")); | |
950 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); | |
951 | y += 20; | |
952 | } | |
953 | painter.fillRect(670, y, 60, 20, c_line1); | |
954 | painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3)); | |
955 | ||
956 | if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) { /* Rows + header + blank */ | |
957 | printer->newPage(); | |
958 | printHeader(&painter); | |
959 | y = 120; | |
960 | } else { | |
961 | y += 40; | |
962 | } | |
160 | 963 | |
237 | 964 | /* Mash */ |
965 | 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
|
966 | 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
|
967 | 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
|
968 | painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, tr("Step type")); |
237 | 969 | painter.drawText(260, y+4, 60, 20, Qt::AlignRight, tr("Start °C")); |
970 | painter.drawText(325, y+4, 60, 20, Qt::AlignRight, tr("End °C")); | |
971 | painter.drawText(390, y+4, 60, 20, Qt::AlignRight, tr("Time")); | |
972 | painter.drawText(455, y+4, 60, 20, Qt::AlignRight, tr("Ramp")); | |
973 | painter.drawText(520, y+4, 60, 20, Qt::AlignRight, tr("L/kg")); | |
974 | painter.drawText(585, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec L.")); | |
975 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec °C")); | |
976 | y += 20; | |
977 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
978 | 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
|
979 | painter.fillRect( 20, y, 715, 20, m_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
980 | painter.drawText( 20, y+4, 160, 20, Qt::AlignLeft, product->mashs.at(i).step_name); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
981 | painter.drawText(180, y+4, 80, 20, Qt::AlignLeft, step_types[product->mashs.at(i).step_type]); |
237 | 982 | painter.drawText(260, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_temp, 1, 'f', 1)); |
983 | painter.drawText(325, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).end_temp, 1, 'f', 1)); | |
984 | painter.drawText(390, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0)); | |
985 | painter.drawText(455, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).ramp_time, 1, 'f', 0)); | |
986 | painter.drawText(520, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_wg_ratio, 1, 'f', 2)); | |
987 | if (product->mashs.at(i).step_type != 1) { | |
988 | painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_amount, 1, 'f', 1)); | |
989 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1)); | |
990 | } | |
991 | y += 20; | |
992 | } | |
993 | ||
994 | if ((y + 80 + ((product->w2_amount > 0) ? 40:0)) > painter.device()->height()) { /* waters + header + blank */ | |
995 | printer->newPage(); | |
996 | printHeader(&painter); | |
997 | y = 120; | |
998 | } else { | |
999 | y += 40; | |
1000 | } | |
1001 | ||
1002 | /* Water */ | |
1003 | 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
|
1004 | 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
|
1005 | 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
|
1006 | 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
|
1007 | 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
|
1008 | 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
|
1009 | 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
|
1010 | 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
|
1011 | 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
|
1012 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, tr("SO4")); |
237 | 1013 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("pH")); |
1014 | y += 20; | |
1015 | 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
|
1016 | 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
|
1017 | 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
|
1018 | 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
|
1019 | 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
|
1020 | 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
|
1021 | 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
|
1022 | 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
|
1023 | 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
|
1024 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_sulfate, 1, 'f', 1)); |
237 | 1025 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_ph, 1, 'f', 2)); |
1026 | y += 20; | |
1027 | if (product->w2_amount > 0) { | |
1028 | /* | |
1029 | * If there is dillution water, show it and the mixed result too. | |
1030 | */ | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1031 | 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
|
1032 | 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
|
1033 | 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
|
1034 | 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
|
1035 | 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
|
1036 | 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
|
1037 | 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
|
1038 | 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
|
1039 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_sulfate, 1, 'f', 1)); |
237 | 1040 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_ph, 1, 'f', 2)); |
1041 | y += 20; | |
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, tr("Mixed water")); |
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->wg_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->wg_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->wg_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->wg_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->wg_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->wg_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->wg_sulfate, 1, 'f', 1)); |
237 | 1051 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_ph, 1, 'f', 2)); |
1052 | y += 20; | |
1053 | } | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1054 | 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
|
1055 | painter.drawText( 20, y+4, 150, 20, Qt::AlignLeft, tr("Treated water")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1056 | 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
|
1057 | 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
|
1058 | 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
|
1059 | 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
|
1060 | 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
|
1061 | painter.drawText(590, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_sulfate, 1, 'f', 1)); |
237 | 1062 | painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_ph, 1, 'f', 2)); |
1063 | y += 20; | |
1064 | ||
1065 | /* | |
1066 | * Print product notes if present. | |
1067 | */ | |
1068 | if (product->notes.length()) { | |
1069 | QStringList lines = product->notes.split("\n"); | |
1070 | ||
1071 | if (lines.size() && product->notes != "") { | |
1072 | if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) { | |
1073 | printer->newPage(); | |
1074 | printHeader(&painter); | |
1075 | y = 120; | |
1076 | } else { | |
1077 | y += 40; | |
1078 | } | |
1079 | ||
1080 | /* Notes header */ | |
1081 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
1082 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1083 | 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
|
1084 | painter.drawText( 20, y+4, 715, 20, Qt::AlignCenter, tr("Recipe notes")); |
237 | 1085 | y += 20; |
1086 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
1087 | 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
|
1088 | 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
|
1089 | painter.drawText( 20, y+4, 715, 20, Qt::AlignLeft, lines[i]); |
237 | 1090 | y += 20; |
1091 | } | |
1092 | } | |
1093 | } | |
1094 | ||
1095 | if (product->stage > PROD_STAGE_BREW) { | |
1096 | if ((y + 100) > painter.device()->height()) { | |
1097 | printer->newPage(); | |
1098 | printHeader(&painter); | |
1099 | y = 120; | |
160 | 1100 | } else { |
1101 | y += 40; | |
1102 | } | |
237 | 1103 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
160 | 1104 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1105 | 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
|
1106 | painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Product brewday")); |
237 | 1107 | y += 20; |
1108 | 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
|
1109 | 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
|
1110 | 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
|
1111 | painter.drawText(140, y+4, 180, 20, Qt::AlignLeft, product->brew_date_start.toString("dd MMM yyyy hh:mm")); |
237 | 1112 | painter.fillRect(435, y, 300, 20, c_line1); |
1113 | painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Brewday end")); | |
1114 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, product->brew_date_end.toString("dd MMM yyyy hh:mm")); | |
1115 | ||
1116 | /* Mash history */ | |
1117 | if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) { | |
1118 | printer->newPage(); | |
1119 | printHeader(&painter); | |
1120 | y = 120; | |
1121 | } else { | |
1122 | y += 40; | |
1123 | } | |
1124 | 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
|
1125 | painter.fillRect( 20, y, 715, 20, m_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1126 | painter.drawText( 40, y+4, 250, 20, Qt::AlignLeft, tr("Mash step")); |
237 | 1127 | painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, tr("Step type")); |
1128 | painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, tr("Temperature")); | |
1129 | painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, tr("Minutes")); | |
1130 | painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, tr("SG")); | |
1131 | painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, tr("pH")); | |
1132 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
1133 | y += 20; | |
1134 | 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
|
1135 | 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
|
1136 | 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
|
1137 | painter.drawText( 40, y+4, 250, 20, Qt::AlignLeft, product->mashs.at(i).step_name); |
237 | 1138 | painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, step_types[product->mashs.at(i).step_type]); |
1139 | painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, QString("%1 - %2°C"). | |
1140 | arg(product->mashs.at(i).step_temp, 1, 'f', 1).arg(product->mashs.at(i).end_temp, 1, 'f', 1)); | |
1141 | painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0)); | |
1142 | painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_sg, 1, 'f', 3)); | |
1143 | painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_ph, 1, 'f', 1)); | |
1144 | y += 20; | |
1145 | } | |
1146 | ||
1147 | /* Brew history */ | |
1148 | if ((y + 470) > painter.device()->height()) { | |
1149 | printer->newPage(); | |
1150 | printHeader(&painter); | |
1151 | y = 120; | |
1152 | } else { | |
1153 | y += 20; | |
1154 | } | |
1155 | 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
|
1156 | painter.fillRect( 20, y, 715, 20, m_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1157 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Brew item")); |
237 | 1158 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, tr("Expected")); |
1159 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, tr("Reached")); | |
1160 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, tr("Difference")); | |
1161 | painter.setFont(QFont("Helvetica", 9, QFont::Normal)); | |
1162 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1163 | 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
|
1164 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash pH")); |
237 | 1165 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->mash_ph, 1, 'f', 2)); |
1166 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_mash_ph, 1, 'f', 2)); | |
1167 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->mash_ph, product->brew_mash_ph, 2, " pH")); | |
1168 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1169 | 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
|
1170 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash density")); |
237 | 1171 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_mash_sg)); |
1172 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_mash_sg)); | |
1173 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_mash_sg, product->brew_mash_sg, 3, " SG")); | |
1174 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1175 | 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
|
1176 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Mash efficiency")); |
237 | 1177 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, "100%"); |
1178 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_mash_efficiency, 1, 'f', 1)); | |
1179 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(100.0, product->brew_mash_efficiency, 1, "%")); | |
1180 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1181 | 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
|
1182 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Sparge pH")); |
237 | 1183 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->sparge_ph, 1, 'f', 2)); |
1184 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_sparge_ph, 1, 'f', 2)); | |
1185 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->sparge_ph, product->brew_sparge_ph, 2, " pH")); | |
1186 | y += 25; | |
1187 | ||
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1188 | 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
|
1189 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil pH")); |
237 | 1190 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2)); |
1191 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1192 | 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
|
1193 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil density")); |
237 | 1194 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->preboil_sg)); |
1195 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_preboil_sg)); | |
1196 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->preboil_sg, product->brew_preboil_sg, 3, " SG")); | |
1197 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1198 | 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
|
1199 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil volume")); |
237 | 1200 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->boil_size * 1.04, 1, 'f', 1)); |
1201 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_preboil_volume, 1, 'f', 1)); | |
1202 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->boil_size * 1.04, product->brew_preboil_volume, 1, " L")); | |
1203 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1204 | 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
|
1205 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Pre boil efficiency")); |
237 | 1206 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1)); |
1207 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_preboil_efficiency, 1, 'f', 1)); | |
1208 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_preboil_efficiency, 1, "%")); | |
1209 | y += 25; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1210 | 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
|
1211 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil pH")); |
237 | 1212 | //painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2)); |
1213 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_aboil_ph, 1, 'f', 2)); | |
1214 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1215 | 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
|
1216 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil density")); |
237 | 1217 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og)); |
1218 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_aboil_sg)); | |
1219 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_aboil_sg, 3, " SG")); | |
1220 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1221 | 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
|
1222 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil volume")); |
237 | 1223 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size * 1.04, 1, 'f', 1)); |
1224 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_aboil_volume, 1, 'f', 1)); | |
1225 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size * 1.04, product->brew_aboil_volume, 1, " L")); | |
1226 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1227 | 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
|
1228 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("After boil efficiency")); |
237 | 1229 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1)); |
1230 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_aboil_efficiency, 1, 'f', 1)); | |
1231 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_aboil_efficiency, 1, "%")); | |
1232 | y += 25; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1233 | 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
|
1234 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Chiller and trub loss")); |
237 | 1235 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_trub_chiller_loss, 1, 'f', 1)); |
1236 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_tcloss, 1, 'f', 1)); | |
1237 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_trub_chiller_loss, product->brew_fermenter_tcloss, 1, " L")); | |
1238 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1239 | 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
|
1240 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Top up water")); |
237 | 1241 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_top_up_water, 1, 'f', 1)); |
1242 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_extrawater, 1, 'f', 1)); | |
1243 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_top_up_water, product->brew_fermenter_extrawater, 1, " L")); | |
1244 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1245 | 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
|
1246 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter volume")); |
237 | 1247 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size - product->eq_trub_chiller_loss, 1, 'f', 1)); |
1248 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_volume, 1, 'f', 1)); | |
1249 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size - product->eq_trub_chiller_loss, product->brew_fermenter_volume, 1, " L")); | |
1250 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1251 | 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
|
1252 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter density")); |
237 | 1253 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og)); |
1254 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_fermenter_sg)); | |
1255 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_fermenter_sg, 3, " SG")); | |
1256 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1257 | 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
|
1258 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter color")); |
237 | 1259 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->est_color, 1, 'f', 0)); |
1260 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->brew_fermenter_color, 1, 'f', 0)); | |
1261 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_color, product->brew_fermenter_color, 0, " EBC")); | |
1262 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1263 | 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
|
1264 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Fermenter IBU")); |
237 | 1265 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->est_ibu, 1, 'f', 0)); |
1266 | painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->brew_fermenter_ibu, 1, 'f', 0)); | |
1267 | painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_ibu, product->brew_fermenter_ibu, 0, " IBU")); | |
1268 | y += 25; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1269 | 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
|
1270 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling method")); |
237 | 1271 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, cooling_method[product->brew_cooling_method]); |
1272 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1273 | 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
|
1274 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling temperature")); |
237 | 1275 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1°C").arg(product->brew_cooling_to, 1, 'f', 1)); |
1276 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1277 | 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
|
1278 | painter.drawText( 20, y+4, 230, 20, Qt::AlignLeft, tr("Cooling time")); |
237 | 1279 | painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 min").arg(product->brew_cooling_time, 1, 'f', 0)); |
1280 | } | |
1281 | ||
1282 | if (product->stage > PROD_STAGE_TERTIARY) { | |
1283 | if ((y + 200) > painter.device()->height()) { | |
1284 | printer->newPage(); | |
1285 | printHeader(&painter); | |
1286 | y = 120; | |
1287 | } else { | |
1288 | y += 40; | |
1289 | } | |
1290 | painter.setFont(QFont("Helvetica", 9, QFont::Bold)); | |
1291 | painter.setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1292 | 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
|
1293 | painter.drawText( 20, y+2, 715, 20, Qt::AlignCenter, tr("Product fermentation")); |
160 | 1294 | y += 20; |
1295 | 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
|
1296 | 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
|
1297 | 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
|
1298 | 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
|
1299 | 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
|
1300 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Primary peak temp")); |
237 | 1301 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_max_temp, 1, 'f', 1)); |
1302 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1303 | 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
|
1304 | 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
|
1305 | 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
|
1306 | 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
|
1307 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Primary density")); |
237 | 1308 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->primary_end_sg, 1, 'f', 3)); |
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, 330, 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, 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
|
1312 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->primary_end_date.toString("dd MMM yyyy")); |
237 | 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, 330, 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, 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
|
1316 | 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
|
1317 | 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
|
1318 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Secondary density")); |
237 | 1319 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->secondary_end_sg, 1, 'f', 3)); |
1320 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1321 | 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
|
1322 | 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
|
1323 | painter.drawText(170, y+4, 180, 20, Qt::AlignLeft, product->secondary_end_date.toString("dd MMM yyyy")); |
237 | 1324 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1325 | 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
|
1326 | 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
|
1327 | 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
|
1328 | 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
|
1329 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Final density")); |
237 | 1330 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->fg, 1, 'f', 3)); |
1331 | y += 20; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1332 | 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
|
1333 | 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
|
1334 | 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
|
1335 | 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
|
1336 | painter.drawText(405, y+4, 150, 20, Qt::AlignLeft, tr("Apperant attenuation")); |
237 | 1337 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(Utils::calc_svg(product->brew_fermenter_sg, product->fg), 1, 'f', 1)); |
1338 | } | |
1339 | ||
1340 | 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
|
1341 | 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
|
1342 | 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
|
1343 | 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
|
1344 | 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
|
1345 | } 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
|
1346 | 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
|
1347 | } |
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
|
1348 | 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
|
1349 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1350 | 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
|
1351 | 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
|
1352 | 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
|
1353 | 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
|
1354 | 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
|
1355 | 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
|
1356 | 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
|
1357 | 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
|
1358 | 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
|
1359 | 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
|
1360 | 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
|
1361 | 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
|
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("Alcohol volume")); |
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%").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
|
1365 | 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
|
1366 | 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
|
1367 | 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
|
1368 | 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
|
1369 | 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
|
1370 | 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
|
1371 | 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
|
1372 | 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
|
1373 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1374 | 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
|
1375 | 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
|
1376 | 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
|
1377 | } |
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 | 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
|
1379 | 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
|
1380 | painter.fillRect( 20, y, 330, 20, m_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1381 | painter.drawText( 20, y+2, 330, 20, Qt::AlignCenter, tr("Bottles")); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1382 | painter.fillRect(405, y, 330, 20, m_line); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1383 | 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
|
1384 | 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
|
1385 | 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
|
1386 | 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
|
1387 | 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
|
1388 | 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
|
1389 | 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
|
1390 | 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
|
1391 | 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
|
1392 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1393 | 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
|
1394 | 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
|
1395 | 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
|
1396 | 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
|
1397 | 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
|
1398 | 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
|
1399 | 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
|
1400 | 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
|
1401 | 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
|
1402 | for (int i = 0; i < product->fermentables.size(); i++) { |
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->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE) { |
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
|
1404 | bsugar = product->fermentables.at(i).f_name; |
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
|
1405 | bamount = product->fermentables.at(i).f_amount; |
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
|
1406 | } |
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
|
1407 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS) { |
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
|
1408 | ksugar = product->fermentables.at(i).f_name; |
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 | kamount = product->fermentables.at(i).f_amount; |
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 | } |
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
|
1411 | } |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1412 | 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
|
1413 | 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
|
1414 | 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
|
1415 | 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
|
1416 | if (product->keg_forced_carb) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1417 | 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
|
1418 | 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
|
1419 | } else { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1420 | 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
|
1421 | 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
|
1422 | } |
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
|
1423 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1424 | 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
|
1425 | 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
|
1426 | 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
|
1427 | if (! product->keg_forced_carb) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1428 | 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
|
1429 | 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
|
1430 | 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
|
1431 | } |
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
|
1432 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1433 | 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
|
1434 | 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
|
1435 | 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
|
1436 | if (! product->keg_forced_carb) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1437 | 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
|
1438 | 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
|
1439 | 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
|
1440 | } |
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
|
1441 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1442 | 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
|
1443 | 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
|
1444 | 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
|
1445 | 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
|
1446 | 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
|
1447 | 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
|
1448 | y += 20; |
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("Pressure")); |
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, 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
|
1452 | 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
|
1453 | 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
|
1454 | 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
|
1455 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1456 | 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
|
1457 | 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
|
1458 | 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
|
1459 | 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
|
1460 | 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
|
1461 | painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->keg_carbonation_temp, 1, 'f', 1)); |
237 | 1462 | } |
1463 | ||
1464 | 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
|
1465 | QStringList lines = product->taste_notes.split("\n"); |
237 | 1466 | |
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 | 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
|
1468 | 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
|
1469 | 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
|
1470 | 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
|
1471 | 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
|
1472 | } 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
|
1473 | 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
|
1474 | } |
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
|
1475 | } 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
|
1476 | 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
|
1477 | 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
|
1478 | 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
|
1479 | 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
|
1480 | } 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
|
1481 | 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
|
1482 | } |
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
|
1483 | } |
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.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
|
1485 | painter.setPen(Qt::black); |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1486 | 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
|
1487 | 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
|
1488 | 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
|
1489 | 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
|
1490 | 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
|
1491 | 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
|
1492 | 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
|
1493 | 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
|
1494 | 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
|
1495 | 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
|
1496 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1497 | 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
|
1498 | 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
|
1499 | 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
|
1500 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1501 | 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
|
1502 | 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
|
1503 | 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
|
1504 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1505 | 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
|
1506 | 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
|
1507 | 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
|
1508 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1509 | 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
|
1510 | 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
|
1511 | 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
|
1512 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1513 | 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
|
1514 | 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
|
1515 | 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
|
1516 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1517 | 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
|
1518 | 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
|
1519 | 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
|
1520 | y += 20; |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1521 | 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
|
1522 | 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
|
1523 | 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
|
1524 | 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
|
1525 | 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
|
1526 | 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
|
1527 | 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
|
1528 | 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
|
1529 | } |
160 | 1530 | } |
240 | 1531 | |
1532 | } else if (p_job == PR_CHECKLIST) { | |
1533 | ||
1534 | double factor = 1.0 / product->divide_factor; | |
1535 | double mashwater = 0; | |
1536 | int numsalts = 0; | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1537 | |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
1538 | qInfo() << "Print checklist" << product->record; |
240 | 1539 | printHeader(&painter); |
1540 | y = 120; | |
1541 | ||
1542 | /* First item, a yeast starter if needed, days before brewday. */ | |
1543 | if (product->starter_enable && product->prop_volume[0]) { | |
1544 | checkHeader(&painter, &y, tr("Make a yeast starter")); | |
1545 | int days = 0; | |
1546 | int last = 0; | |
1547 | QString s = ""; | |
1548 | for (int i = 0; i < 4; i++) { | |
1549 | if (product->prop_volume[i]) { | |
1550 | last = i; | |
1551 | if (product->prop_type[i] == STARTERS_STIRRED) | |
1552 | days += 2; | |
1553 | else if (product->prop_type[i] == STARTERS_SHAKEN) | |
1554 | days += 4; | |
1555 | else | |
1556 | days += 6; // Simple starter | |
1557 | } | |
1558 | } | |
1559 | checkLine(&painter, &y, QString(tr("Start about %1 days before brewday with the starter.")).arg(days)); | |
1560 | for (int i = 0; i < 4; i++) { | |
1561 | if (product->prop_volume[i]) { | |
1562 | 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). | |
1563 | arg(product->starter_sg, 1, 'f', 3)); | |
1564 | QString w = tr(" until there is enough yeast"); | |
1565 | if (product->prop_type[i] == STARTERS_STIRRED) | |
1566 | checkLine(&painter, &y, QString(tr("about 24 hours on a stirplate"))+w); | |
1567 | else if (product->prop_type[i] == STARTERS_SHAKEN) | |
1568 | checkLine(&painter, &y, QString(tr("shake often for a few days"))+w); | |
1569 | else | |
1570 | checkLine(&painter, &y, QString(tr("let it rest for almost a week"))+w); | |
1571 | if (i < last) { | |
1572 | checkLine(&painter, &y, QString(tr("place starter in the fridge for 24 hours"))); | |
1573 | checkLine(&painter, &y, QString(tr("remove starter from the fridge and decant"))); | |
1574 | } else { | |
1575 | checkLine(&painter, &y, QString(tr("place starter in the fridge until brewday"))); | |
1576 | checkLine(&painter, &y, QString(tr("remove starter from the fridge and decant"))); | |
1577 | } | |
1578 | } | |
1579 | } | |
1580 | y += 20; | |
1581 | } | |
1582 | ||
1583 | checkHeader(&painter, &y, tr("Mash water and treatment")); | |
1584 | checkLine(&painter, &y, QString("%1 liter water %2").arg(product->w1_amount * factor, 1, 'f', 1).arg(product->w1_name)); | |
1585 | mashwater += product->w1_amount * factor; | |
1586 | if (product->w2_name != "" && product->w2_amount > 0) { | |
1587 | checkLine(&painter, &y, QString("%1 liter water %2").arg(product->w2_amount * factor, 1, 'f', 1).arg(product->w2_name)); | |
1588 | mashwater += product->w2_amount * factor; | |
1589 | } | |
1590 | for (int i = 0; i < product->miscs.size(); i++) { | |
1591 | if (product->miscs.at(i).m_type == MISC_TYPES_WATER_AGENT) { | |
1592 | QString unit = (product->miscs.at(i).m_amount_is_weight) ? "gr":"ml"; | |
1593 | checkLine(&painter, &y, QString("%1 %2 %3").arg(product->miscs.at(i).m_amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(i).m_name)); | |
1594 | numsalts++; | |
1595 | } | |
1596 | } | |
1597 | y += 20; | |
1598 | ||
1599 | checkHeader(&painter, &y, tr("Weight and mill the malts")); | |
1600 | for (int i = 0; i < product->fermentables.size(); i++) { | |
1601 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { | |
1602 | checkLine(&painter, &y, QString("%1 kg `%2` (%3)").arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3). | |
1603 | arg(product->fermentables.at(i).f_name).arg(product->fermentables.at(i).f_supplier)); | |
1604 | } | |
1605 | } | |
1606 | checkLine(&painter, &y, QString(tr("Mill the malts"))); | |
1607 | y += 20; | |
1608 | ||
1609 | checkHeader(&painter, &y, tr("Mash")); | |
1610 | int loop = 0; | |
1611 | double l, mvol = 0, msugars = 0; | |
1612 | for (int i = 0; i < product->mashs.size(); i++) { | |
1613 | if (product->mashs.at(i).step_type == 0) | |
1614 | mvol += product->mashs.at(i).step_infuse_amount * factor; // We need this later | |
1615 | if (loop == 0) { | |
1616 | if (product->mashs.at(i).step_type == 0) | |
1617 | l = product->mashs.at(i).step_infuse_amount * factor; | |
1618 | else | |
1619 | l = mashwater; | |
1620 | checkLine(&painter, &y, QString(tr("Heat %1 liter water to %2°C (%3 cm below kettle top)")) | |
1621 | .arg(mashwater, 1, 'f', 1).arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1) | |
1622 | .arg(Utils::kettle_cm(l, product->eq_tun_volume, product->eq_tun_height), 1, 'f', 1)); | |
1623 | if (numsalts > 0) | |
1624 | checkLine(&painter, &y, QString(tr("Add brouwzouten"))); | |
1625 | checkLine(&painter, &y, QString(tr("Add malts and dough-in"))); | |
1626 | for (int j = 0; j < product->hops.size(); j++) { | |
1627 | if (product->hops.at(j).h_useat == HOP_USEAT_MASH) { | |
1628 | checkLine(&painter, &y, QString(tr("Add %1 gram `%2` hop")).arg(product->hops.at(j).h_amount * 1000 * factor, 1, 'f', 1) | |
1629 | .arg(product->hops.at(j).h_name)); | |
1630 | } | |
1631 | } | |
1632 | for (int j = 0; j < product->miscs.size(); j++) { | |
1633 | if ((product->miscs.at(j).m_use_use == MISC_USES_MASH) && (product->miscs.at(j).m_type != MISC_TYPES_WATER_AGENT)) { | |
1634 | QString unit = (product->miscs.at(j).m_amount_is_weight) ? "gr":"ml"; | |
1635 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3`")).arg(product->miscs.at(j).m_amount * 1000 * factor, 1, 'f', 2) | |
1636 | .arg(unit).arg(product->miscs.at(j).m_name)); | |
1637 | } | |
1638 | } | |
1639 | } else { // loop > 0 | |
1640 | if (product->mashs.at(i).step_type == 0) { // Infusion | |
1641 | checkLine(&painter, &y, QString(tr("Add %1 liter water of %2°C")).arg(product->mashs.at(i).step_infuse_amount * factor, 1, 'f', 1) | |
1642 | .arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1)); | |
1643 | } else if (product->mashs.at(i).step_type == 1) { // Direct heat | |
1644 | checkLine(&painter, &y, QString(tr("Heat upto %1°C")).arg(product->mashs.at(i).step_temp, 1, 'f', 1)); | |
1645 | } else { // Decoction | |
1646 | checkLine(&painter, &y, QString(tr("Take, heat, boil and return %1 part of the mash")) | |
1647 | .arg(product->mashs.at(i).step_infuse_amount * factor, 1, 'f', 1)); | |
1648 | } | |
1649 | } | |
1650 | if (product->mashs.at(i).step_temp != product->mashs.at(i).end_temp) { | |
1651 | checkInput(&painter, &y, QString(tr("%1 minutes from %2°C to %3°C")).arg(product->mashs.at(i).step_time) | |
1652 | .arg(product->mashs.at(i).step_temp, 1, 'f', 1).arg(product->mashs.at(i).end_temp, 1, 'f', 1), QString(tr("Brix"))); | |
1653 | } else { | |
1654 | checkInput(&painter, &y, QString(tr("%1 minutes at %2°C")).arg(product->mashs.at(i).step_time) | |
1655 | .arg(product->mashs.at(i).step_temp, 1, 'f', 1), QString(tr("Brix"))); | |
1656 | } | |
1657 | if (loop == 0) | |
1658 | checkInput(&painter, &y, QString(tr("Measure and adjust pH (target %1 pH)")).arg(product->mash_ph, 1, 'f', 2), QString(tr("pH"))); | |
1659 | loop++; | |
1660 | } | |
1661 | double est_masg_sg = 0, sugardensity = 1.611, grainabsorbtion = 0; | |
1662 | for (int i = 0; i < product->fermentables.size(); i++) { | |
1663 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_MASH) { | |
1664 | double d = product->fermentables.at(i).f_amount * factor * (product->fermentables.at(i).f_yield / 100) * | |
1665 | (1 - product->fermentables.at(i).f_moisture / 100); | |
1666 | mvol += product->fermentables.at(i).f_amount * factor * (product->fermentables.at(i).f_moisture / 100); | |
1667 | grainabsorbtion += my_grain_absorbtion * product->fermentables.at(i).f_amount * factor; | |
1668 | msugars += d; | |
1669 | } | |
1670 | } | |
1671 | double v = msugars / sugardensity + mvol; | |
1672 | double plato = 1000.0 * msugars / (v * 10.0); // deg. Plato | |
1673 | double mash_sg = Utils::plato_to_sg(plato); | |
1674 | checkInput(&painter, &y, QString(tr("Target SG end mash: ")) + strDensity(mash_sg), QString(tr("SG"))); | |
1675 | if ((y + 140) > painter.device()->height()) { | |
1676 | printer->newPage(); | |
1677 | printHeader(&painter); | |
1678 | y = 120; | |
1679 | } else { | |
1680 | y += 20; | |
1681 | } | |
1682 | ||
1683 | checkHeader(&painter, &y, tr("Lauter and Sparge")); | |
1684 | checkLine(&painter, &y, QString(tr("Heat %1 liter sparge water to %2°C")).arg(product->sparge_volume * factor, 1, 'f', 1) | |
1685 | .arg(product->sparge_temp, 1, 'f', 1)); | |
1686 | checkInput(&painter, &y, QString(tr("Bring to %1 pH with %2 ml. `%3`")).arg(product->sparge_ph, 1, 'f', 2) | |
1687 | .arg(product->sparge_acid_amount * 1000 * factor, 1, 'f', 2).arg(my_acids.at(product->sparge_acid_type).name_en), QString(tr("pH"))); | |
1688 | checkLine(&painter, &y, QString(tr("Sparge with close to %1 liter water")) | |
1689 | .arg(((product->boil_size * factor) - mashwater + grainabsorbtion + product->eq_lauter_deadspace) * 1.03, 1, 'f', 1)); | |
1690 | checkInput(&painter, &y, QString(tr("Target volume in boil kettle: %1 liter (%2 cm below kettle top)")) | |
1691 | .arg(product->boil_size * factor * 1.04, 1, 'f', 1) | |
1692 | .arg(Utils::kettle_cm(product->boil_size * factor * 1.04, product->eq_kettle_volume, product->eq_kettle_height), 1, 'f', 1), | |
1693 | QString(tr("cm"))); | |
1694 | checkInput(&painter, &y, QString(tr("Target SG in boil kettle: ")) + strDensity(product->preboil_sg), QString(tr("SG"))); | |
1695 | checkInput(&painter, &y, "", QString(tr("pH"))); | |
1696 | for (int i = 0; i < product->hops.size(); i++) { | |
1697 | if (product->hops.at(i).h_useat == HOP_USEAT_FWH) { | |
1698 | checkLine(&painter, &y, QString(tr("Add %1 gr `%2` hop after sparge")).arg(product->hops.at(i).h_amount * 1000 * factor, 1, 'f', 1) | |
1699 | .arg(product->hops.at(i).h_name)); | |
1700 | } | |
1701 | } | |
1702 | ||
1703 | if (checkSplit(&painter, &y, 1)) | |
1704 | factor = 1; | |
1705 | /* Boil, how much space do we need */ | |
1706 | int lines = 0; | |
1707 | if (product->boil_time == 0) { | |
1708 | lines = 3; | |
1709 | } else { | |
1710 | lines = 5; | |
1711 | if (product->brew_cooling_method == 1) | |
1712 | lines++; | |
1713 | for (int i = 0; i < product->fermentables.size(); i++) { | |
1714 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOIL) | |
1715 | lines++; | |
1716 | } | |
1717 | for (int i = 0; i < product->hops.size(); i++) { | |
1718 | if (product->hops.at(i).h_useat == HOP_USEAT_BOIL || product->hops.at(i).h_useat == HOP_USEAT_AROMA) | |
1719 | lines++; | |
1720 | } | |
1721 | for (int i = 0; i < product->miscs.size(); i++) { | |
1722 | if (product->miscs.at(i).m_use_use == MISC_USES_BOIL) | |
1723 | lines++; | |
1724 | } | |
1725 | } | |
1726 | qDebug() << "check" << lines << y + (lines * 20) << painter.device()->height(); | |
1727 | if ((y + (lines * 20)) > painter.device()->height()) { | |
1728 | printer->newPage(); | |
1729 | printHeader(&painter); | |
1730 | y = 120; | |
1731 | } else { | |
1732 | y += 20; | |
1733 | } | |
1734 | checkHeader(&painter, &y, tr("Boil")); | |
1735 | if (product->boil_time > 0) { | |
1736 | checkLine(&painter, &y, QString(tr("Total boiltime: %1 minutes")).arg(product->boil_time, 1, 'f', 0)); | |
1737 | for (int i = product->boil_time; i >= 0; i--) { | |
1738 | if (i == 10) { | |
1739 | for (int j = 0; j < product->fermentables.size(); j++) { | |
1740 | if (product->fermentables.at(j).f_added == FERMENTABLE_ADDED_BOIL) | |
1741 | checkLine(&painter, &y, QString(tr("%1 kg `%2` at 10 minutes before end of boil")) | |
1742 | .arg(product->fermentables.at(j).f_amount * factor, 1, 'f', 3) | |
1743 | .arg(product->fermentables.at(j).f_name)); | |
1744 | } | |
1745 | if (product->brew_cooling_method == 1) | |
1746 | checkLine(&painter, &y, QString(tr("Place emersion chiller at 10 minutes before end of boil"))); | |
1747 | } | |
1748 | for (int j = 0; j < product->hops.size(); j++) { | |
1749 | if ((product->hops.at(j).h_useat == HOP_USEAT_BOIL || product->hops.at(j).h_useat == HOP_USEAT_AROMA) && product->hops.at(j).h_time == i) { | |
1750 | if (i == 0) | |
1751 | checkLine(&painter, &y, QString(tr("%1 gr `%2` at flameout")).arg(product->hops.at(j).h_amount * 1000 * factor, 1, 'f', 2) | |
1752 | .arg(product->hops.at(j).h_name)); | |
1753 | else | |
1754 | checkLine(&painter, &y, QString(tr("%1 gr `%2` at %3 minutes before end of boil")) | |
1755 | .arg(product->hops.at(j).h_amount * 1000 * factor, 1, 'f', 2).arg(product->hops.at(j).h_name).arg(i)); | |
1756 | } | |
1757 | } | |
1758 | for (int j = 0; j < product->miscs.size(); j++) { | |
1759 | if (product->miscs.at(j).m_use_use == MISC_USES_BOIL && product->miscs.at(j).m_time == i) { | |
1760 | QString unit = (product->miscs.at(j).m_amount_is_weight) ? "gr":"ml"; | |
1761 | if (i == 0) | |
1762 | checkLine(&painter, &y, QString(tr("%1 %2 `%3` at flameout")) | |
1763 | .arg(product->miscs.at(j).m_amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(j).m_name)); | |
1764 | else | |
1765 | checkLine(&painter, &y, QString(tr("%1 %2 `%3` at %4 minutes before end of boil")) | |
1766 | .arg(product->miscs.at(j).m_amount * 1000 * factor, 1, 'f', 2).arg(unit).arg(product->miscs.at(j).m_name).arg(i)); | |
1767 | } | |
1768 | } | |
1769 | } | |
1770 | checkInput(&painter, &y, QString(tr("Target volume at end of boil: %1 liter (%2 cm below kettle top)")) | |
1771 | .arg(product->batch_size * 1.04 * factor, 1, 'f', 1) | |
1772 | .arg(Utils::kettle_cm(product->batch_size * 1.04 * factor, product->eq_kettle_volume, product->eq_kettle_height)), | |
1773 | QString(tr("cm"))); | |
1774 | checkInput(&painter, &y, QString(tr("Target SG at end of boil: ")) + strDensity(product->est_og3), QString(tr("SG"))); | |
1775 | checkInput(&painter, &y, "", QString(tr("pH"))); | |
1776 | if (checkSplit(&painter, &y, 2)) | |
1777 | factor = 1; | |
1778 | } else { | |
1779 | checkLine(&painter, &y, QString(tr("This is a `no-boil` recipe"))); | |
1780 | } | |
1781 | ||
1782 | /* Whirlpools and chilling */ | |
1783 | lines = 5; | |
1784 | if (product->brew_whirlpool9) | |
1785 | lines++; | |
1786 | if (product->brew_whirlpool7) | |
1787 | lines++; | |
1788 | if (product->brew_whirlpool6) | |
1789 | lines++; | |
1790 | if (product->brew_whirlpool2) | |
1791 | lines++; | |
1792 | for (int i = 0; i < product->hops.size(); i++) { | |
1793 | if (product->hops.at(i).h_useat == HOP_USEAT_WHIRLPOOL) | |
1794 | lines++; | |
1795 | } | |
1796 | if ((y + (lines * 20)) > painter.device()->height()) { | |
1797 | printer->newPage(); | |
1798 | printHeader(&painter); | |
1799 | y = 120; | |
1800 | } else { | |
1801 | y += 20; | |
1802 | } | |
1803 | if ((product->brew_whirlpool9 + product->brew_whirlpool7 + product->brew_whirlpool6 + product->brew_whirlpool2) > 0) { | |
1804 | checkHeader(&painter, &y, tr("Whirlpool(s) and cooling")); | |
1805 | if (product->brew_whirlpool9 > 0) | |
1806 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp above 85°C")).arg(product->brew_whirlpool9, 1, 'f', 0)); | |
1807 | if (product->brew_whirlpool7 > 0) | |
1808 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp between 72 and 79°C")).arg(product->brew_whirlpool7, 1, 'f', 0)); | |
1809 | if (product->brew_whirlpool6 > 0) | |
1810 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes. Keep temp between 60 and 66°C")).arg(product->brew_whirlpool6, 1, 'f', 0)); | |
1811 | for (int i = 0; i < product->hops.size(); i++) { | |
1812 | if (product->hops.at(i).h_useat == HOP_USEAT_WHIRLPOOL) | |
1813 | checkLine(&painter, &y, QString(tr("%1 gr `%2` for %3 minutes in the whirlpool")) | |
1814 | .arg(product->hops.at(i).h_amount * 1000 * factor, 1, 'f', 1).arg(product->hops.at(i).h_name) | |
1815 | .arg(product->hops.at(i).h_time)); | |
1816 | } | |
1817 | checkLine(&painter, &y, QString(tr("Cool to %1°C")).arg(product->brew_cooling_to, 1, 'f', 1)); | |
1818 | if (product->brew_whirlpool2 > 0) | |
1819 | checkLine(&painter, &y, QString(tr("Wirlpool for %1 minutes.")).arg(product->brew_whirlpool2, 1, 'f', 0)); | |
1820 | } else { | |
1821 | checkHeader(&painter, &y, tr("Cooling")); | |
1822 | checkLine(&painter, &y, QString(tr("Cool to %1°C")).arg(product->brew_cooling_to, 1, 'f', 1)); | |
1823 | } | |
1824 | checkLine(&painter, &y, QString(tr("Desinfect fermenter and pump and hoses if needed"))); | |
1825 | checkInput(&painter, &y, QString(tr("Transfer wort to fermenter")), QString(tr("Liter"))); | |
1826 | if (checkSplit(&painter, &y, 3)) | |
1827 | factor = 1; | |
1828 | ||
1829 | double climate = product->brew_cooling_to; | |
1830 | lines = 3; | |
1831 | for (int i = 0; i < product->yeasts.size(); i++) { | |
1832 | if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { | |
1833 | lines++; | |
1834 | if (product->yeasts.at(i).y_type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).y_pitch_temperature > 0)) | |
1835 | lines++; | |
1836 | } | |
1837 | } | |
1838 | if (product->brew_aeration_type > 0) | |
1839 | lines++; | |
1840 | if (product->brew_fermenter_extrawater > 0) | |
1841 | lines++; | |
1842 | if ((y + (lines * 20)) > painter.device()->height()) { | |
1843 | printer->newPage(); | |
1844 | printHeader(&painter); | |
1845 | y = 120; | |
1846 | } else { | |
1847 | y += 20; | |
1848 | } | |
1849 | double dry = 0; | |
1850 | checkHeader(&painter, &y, tr("Yeast pitching and fermentation")); | |
1851 | for (int i = 0; i < product->yeasts.size(); i++) { | |
1852 | if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { | |
1853 | switch (product->yeasts.at(i).y_form) { | |
1854 | case YEAST_FORMS_LIQUID: checkLine(&painter, &y, QString(tr("%1 pack %2, `%3` yeast")).arg(product->yeasts.at(i).y_amount) | |
1855 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
1856 | break; | |
1857 | case YEAST_FORMS_DRY: dry += product->yeasts.at(i).y_amount * 1000 * factor; | |
1858 | case YEAST_FORMS_DRIED: checkLine(&painter, &y, QString(tr("%1 gram %2, `%3` yeast")) | |
1859 | .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) | |
1860 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
1861 | break; | |
1862 | default: checkLine(&painter, &y, QString(tr("%1 ml %2, `%3` yeast")) | |
1863 | .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 0) | |
1864 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
1865 | break; | |
1866 | } | |
1867 | if (product->yeasts.at(i).y_type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).y_pitch_temperature > 0)) { | |
1868 | checkLine(&painter, &y, QString(tr("Pitch yeast at %1°C")).arg(product->yeasts.at(i).y_pitch_temperature, 1, 'f', 1)); | |
1869 | climate = product->yeasts.at(i).y_pitch_temperature; | |
1870 | } | |
1871 | } | |
1872 | } | |
1873 | if (dry > 0) { | |
1874 | checkLine(&painter, &y, QString(tr("Pitch yeast dry into the wort"))); | |
1875 | } else { | |
1876 | if (product->starter_enable && product->prop_volume[0]) | |
1877 | checkLine(&painter, &y, QString(tr("Add decanted yeast starter"))); | |
1878 | else | |
1879 | checkLine(&painter, &y, QString(tr("Add the yeast"))); | |
1880 | } | |
1881 | if (product->brew_fermenter_extrawater) | |
1882 | checkLine(&painter, &y, QString(tr("Add %1 liter water in the fermenter")).arg(product->brew_fermenter_extrawater * factor, 1, 'f', 1)); | |
1883 | if (product->brew_aeration_type > 0) | |
1884 | checkLine(&painter, &y, QString(tr("Aerate %1 minutes with %2")).arg(product->brew_aeration_time) | |
1885 | .arg((product->brew_aeration_type == 1) ? "air":"oxygen")); | |
1886 | checkLine(&painter, &y, QString(tr("Set fermentation start temperature to %1°C")).arg(climate, 1, 'f', 1)); | |
1887 | checkLine(&painter, &y, QString(tr("Start fermentation"))); | |
1888 | ||
1889 | /* During primary fermentation */ | |
1890 | lines = 0; | |
1891 | for (int i = 0; i < product->fermentables.size(); i++) | |
1892 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION) | |
1893 | lines++; | |
1894 | for (int i = 0; i < product->miscs.size(); i++) | |
1895 | if (product->miscs.at(i).m_use_use == MISC_USES_PRIMARY) | |
1896 | lines++; | |
1897 | if (lines) { | |
1898 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
1899 | printer->newPage(); | |
1900 | printHeader(&painter); | |
1901 | y = 120; | |
1902 | } else { | |
1903 | y += 20; | |
1904 | } | |
1905 | checkHeader(&painter, &y, tr("Primary fermentation")); | |
1906 | for (int i = 0; i < product->fermentables.size(); i++) { | |
1907 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_FERMENTATION) | |
1908 | checkLine(&painter, &y, QString(tr("Add %1 kg `%2` on day 3 or 4")).arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) | |
1909 | .arg(product->fermentables.at(i).f_name)); | |
1910 | } | |
1911 | for (int i = 0; i < product->miscs.size(); i++) { | |
1912 | if (product->miscs.at(i).m_use_use == MISC_USES_PRIMARY) { | |
1913 | QString unit = (product->miscs.at(i).m_amount_is_weight) ? "gr":"ml"; | |
1914 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` on day 3 or 4")).arg(product->miscs.at(i).m_amount * factor, 1, 'f', 3) | |
1915 | .arg(unit).arg(product->miscs.at(i).m_name)); | |
1916 | } | |
1917 | } | |
1918 | } | |
1919 | if (checkSplit(&painter, &y, 4)) | |
1920 | factor = 1; | |
1921 | ||
1922 | /* During secondary fermentation, yeast */ | |
1923 | lines = 0; | |
1924 | for (int i = 0; i < product->yeasts.size(); i++) { | |
1925 | if (product->yeasts.at(i).y_use == YEAST_USE_SECONDARY) | |
1926 | lines++; | |
1927 | if (product->yeasts.at(i).y_harvest_time > 0) | |
1928 | lines++; | |
1929 | } | |
1930 | if (lines) { | |
1931 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
1932 | printer->newPage(); | |
1933 | printHeader(&painter); | |
1934 | y = 120; | |
1935 | } else { | |
1936 | y += 20; | |
1937 | } | |
1938 | checkHeader(&painter, &y, tr("Secondary fermentation")); | |
1939 | for (int i = 0; i < product->yeasts.size(); i++) { | |
1940 | if (product->yeasts.at(i).y_use == YEAST_USE_SECONDARY) { | |
1941 | if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { | |
1942 | checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)")) | |
1943 | .arg(product->yeasts.at(i).y_amount).arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
1944 | } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { | |
1945 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) | |
1946 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
1947 | } else { | |
1948 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` yeast (with starter if needed)")) | |
1949 | .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) | |
1950 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
1951 | } | |
1952 | } | |
1953 | if (product->yeasts.at(i).y_harvest_time > 0) { | |
1954 | checkLine(&painter, &y, QString(tr("After %1 hours harvest yeast from the %2")).arg(product->yeasts.at(i).y_harvest_time) | |
1955 | .arg((product->yeasts.at(i).y_harvest_top > 0) ? "top":"bottom")); | |
1956 | } | |
1957 | } | |
1958 | } | |
1959 | if (checkSplit(&painter, &y, 5)) | |
1960 | factor = 1; | |
1961 | ||
1962 | /* During tertiary fermentation */ | |
1963 | lines = 0; | |
1964 | for (int i = 0; i < product->fermentables.size(); i++) | |
1965 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING) | |
1966 | lines++; | |
1967 | for (int i = 0; i < product->hops.size(); i++) | |
1968 | if (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP) | |
1969 | lines++; | |
1970 | for (int i = 0; i < product->miscs.size(); i++) | |
1971 | if (product->miscs.at(i).m_use_use == MISC_USES_SECONDARY) | |
1972 | lines++; | |
1973 | for (int i = 0; i < product->yeasts.size(); i++) { | |
1974 | if (product->yeasts.at(i).y_use == YEAST_USE_TERTIARY) | |
1975 | lines++; | |
1976 | } | |
1977 | if (lines) { | |
1978 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
1979 | printer->newPage(); | |
1980 | printHeader(&painter); | |
1981 | y = 120; | |
1982 | } else { | |
1983 | y += 20; | |
1984 | } | |
1985 | checkHeader(&painter, &y, tr("Tertiary fermentation")); | |
1986 | for (int i = 0; i < product->fermentables.size(); i++) { | |
1987 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_LAGERING) | |
1988 | checkLine(&painter, &y, QString(tr("Add %1 kg `%2`")).arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) | |
1989 | .arg(product->fermentables.at(i).f_name)); | |
1990 | } | |
1991 | for (int i = 0; i < product->hops.size(); i++) { | |
1992 | if (product->hops.at(i).h_useat == HOP_USEAT_DRY_HOP) { | |
1993 | checkLine(&painter, &y, QString(tr("Add %1 gram `%2` for %3 days")).arg(product->hops.at(i).h_amount * 1000 * factor, 1, 'f', 1) | |
1994 | .arg(product->hops.at(i).h_name).arg(product->hops.at(i).h_time / 1440)); | |
1995 | } | |
1996 | } | |
1997 | for (int i = 0; i < product->yeasts.size(); i++) { | |
1998 | if (product->yeasts.at(i).y_use == YEAST_USE_TERTIARY) { | |
1999 | if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { | |
2000 | checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)")) | |
2001 | .arg(product->yeasts.at(i).y_amount).arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
2002 | } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { | |
2003 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) | |
2004 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
2005 | } else { | |
2006 | checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` yeast (with starter if needed)")) | |
2007 | .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) | |
2008 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
2009 | } | |
2010 | } | |
2011 | } | |
2012 | for (int i = 0; i < product->miscs.size(); i++) { | |
2013 | if (product->miscs.at(i).m_use_use == MISC_USES_SECONDARY) { | |
2014 | QString unit = (product->miscs.at(i).m_amount_is_weight) ? "gr":"ml"; | |
2015 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` for %4 days")).arg(product->miscs.at(i).m_amount * factor, 1, 'f', 3) | |
2016 | .arg(unit).arg(product->miscs.at(i).m_name).arg(product->miscs.at(i).m_time / 1440)); | |
2017 | } | |
2018 | } | |
2019 | } | |
2020 | if (checkSplit(&painter, &y, 6)) | |
2021 | factor = 1; | |
2022 | ||
2023 | /* During packaging */ | |
2024 | lines = 0; | |
2025 | for (int i = 0; i < product->fermentables.size(); i++) | |
2026 | if (product->fermentables.at(i).f_added >= FERMENTABLE_ADDED_BOTTLE) | |
2027 | lines++; | |
2028 | for (int i = 0; i < product->miscs.size(); i++) | |
2029 | if (product->miscs.at(i).m_use_use == MISC_USES_BOTTLING) | |
2030 | lines++; | |
2031 | for (int i = 0; i < product->yeasts.size(); i++) | |
2032 | if (product->yeasts.at(i).y_use == YEAST_USE_BOTTLE) | |
2033 | lines++; | |
2034 | if (lines) { | |
2035 | if ((y + 20 + (lines * 20)) > painter.device()->height()) { | |
2036 | printer->newPage(); | |
2037 | printHeader(&painter); | |
2038 | y = 120; | |
2039 | } else { | |
2040 | y += 20; | |
2041 | } | |
2042 | checkHeader(&painter, &y, tr("Packaging")); | |
2043 | for (int i = 0; i < product->fermentables.size(); i++) { | |
2044 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_BOTTLE) | |
2045 | checkLine(&painter, &y, QString(tr("Bottling add %1 kg `%2` with %3 liter water")) | |
2046 | .arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) | |
2047 | .arg(product->fermentables.at(i).f_name).arg(product->bottle_priming_water * factor, 1, 'f', 3)); | |
2048 | if (product->fermentables.at(i).f_added == FERMENTABLE_ADDED_KEGS) | |
2049 | checkLine(&painter, &y, QString(tr("Kegging add %1 kg `%2` with %3 liter water")) | |
2050 | .arg(product->fermentables.at(i).f_amount * factor, 1, 'f', 3) | |
2051 | .arg(product->fermentables.at(i).f_name).arg(product->keg_priming_water * factor, 1, 'f', 3)); | |
2052 | } | |
2053 | for (int i = 0; i < product->yeasts.size(); i++) { | |
2054 | if (product->yeasts.at(i).y_use == YEAST_USE_BOTTLE) { | |
2055 | if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { | |
2056 | checkLine(&painter, &y, QString(tr("Add %1, `%2` as bottle yeast")) | |
2057 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
2058 | } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { | |
2059 | checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` as bottle yeast")) | |
2060 | .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) | |
2061 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
2062 | } else { | |
2063 | checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` as bottle yeast")) | |
2064 | .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) | |
2065 | .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); | |
2066 | } | |
2067 | } | |
2068 | } | |
2069 | for (int i = 0; i < product->miscs.size(); i++) { | |
2070 | if (product->miscs.at(i).m_use_use == MISC_USES_BOTTLING) { | |
2071 | QString unit = (product->miscs.at(i).m_amount_is_weight) ? "gr":"ml"; | |
2072 | checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` during bottling")).arg(product->miscs.at(i).m_amount * factor, 1, 'f', 3) | |
2073 | .arg(unit).arg(product->miscs.at(i).m_name)); | |
2074 | } | |
2075 | } | |
2076 | } | |
160 | 2077 | } |
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
|
2078 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2079 | 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
|
2080 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2081 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2082 | |
240 | 2083 | void PrinterDialog::checkHeader(QPainter *painter, qreal *y, QString text) |
2084 | { | |
2085 | painter->setFont(QFont("Arial", 10, QFont::Bold)); | |
2086 | painter->setPen(Qt::black); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2087 | painter->drawText(50, *y, 700, 20, Qt::AlignLeft, text); |
240 | 2088 | painter->setFont(QFont("Arial", 10, QFont::Normal)); |
2089 | *y += 20; | |
2090 | } | |
2091 | ||
2092 | ||
2093 | /* | |
2094 | * Draw a checkbox and text. | |
2095 | */ | |
2096 | void PrinterDialog::checkLine(QPainter *painter, qreal *y, QString text) | |
2097 | { | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2098 | painter->drawRect(24, *y, 16, 16); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2099 | painter->drawText(50, *y,630, 20, Qt::AlignLeft, text); |
240 | 2100 | *y += 20; |
2101 | } | |
2102 | ||
2103 | ||
2104 | void PrinterDialog::checkInput(QPainter *painter, qreal *y, QString text, QString prompt) | |
2105 | { | |
2106 | if (text != "") { | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2107 | painter->drawRect(24, *y, 16, 16); |
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2108 | painter->drawText(50, *y,480, 20, Qt::AlignLeft, text); |
240 | 2109 | } |
2110 | painter->drawText(515, *y, 150, 20, Qt::AlignRight, QString(tr("Measured:")) + QString(" _________")); | |
2111 | painter->drawText(675, *y, 60, 20, Qt::AlignLeft, prompt); | |
2112 | *y += 20; | |
2113 | } | |
2114 | ||
2115 | ||
2116 | bool PrinterDialog::checkSplit(QPainter *painter, qreal *y, int moment) | |
2117 | { | |
2118 | if (product->divide_type && product->divide_type == moment) { | |
2119 | *y += 20; | |
2120 | painter->setFont(QFont("Helvetica", 14, QFont::Bold)); | |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2121 | painter->drawText(20, *y, 715, 20, Qt::AlignCenter, QString(tr("%1 split the batch here!")).arg(prod_split[product->divide_type])); |
240 | 2122 | painter->setFont(QFont("Arial", 10, QFont::Normal)); |
2123 | *y += 26; | |
2124 | return true; | |
2125 | } | |
2126 | return false; | |
2127 | } | |
2128 | ||
2129 | ||
237 | 2130 | QString PrinterDialog::strDiff(double v1, double v2, int decimals, QString suffix) |
2131 | { | |
2132 | return QString("%1%2%3").arg((v2 > v1) ? "+":"").arg(v2 - v1, 1, 'f', decimals).arg(suffix); | |
2133 | } | |
2134 | ||
2135 | ||
2136 | QString PrinterDialog::strDensity(double density) | |
2137 | { | |
2138 | 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); | |
2139 | } | |
2140 | ||
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
|
2141 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2142 | 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
|
2143 | { |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2144 | 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
|
2145 | outPixmap.loadFromData(my_logoByteArray); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2146 | int w = outPixmap.width(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2147 | int h = outPixmap.height(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2148 | /* Make sure to keep the logo aspect ratio */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2149 | if (w == h) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2150 | painter->drawPixmap(20, 0, 100, 100, outPixmap); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2151 | } else if (w > h) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2152 | painter->drawPixmap(20, 0, 100, (h * 100) / w, outPixmap); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2153 | } else { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2154 | painter->drawPixmap(20, 0, (w * 100) / h, 100, outPixmap); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2155 | } |
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
|
2156 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2157 | /* The fat header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2158 | painter->setFont(QFont("Helvetica",18, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2159 | if (p_job == PR_SUPPLIES) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2160 | 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
|
2161 | } 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
|
2162 | 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
|
2163 | } 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
|
2164 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, recipe->name); |
240 | 2165 | } 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
|
2166 | painter->drawText(140, 0, 500, 40, Qt::AlignLeft, product->code + " " + product->name); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2167 | } else { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2168 | 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
|
2169 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2170 | /* The first normal header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2171 | 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
|
2172 | 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
|
2173 | 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
|
2174 | if (p_job == PR_RECIPE) { |
255
f237db73d4c8
Reformatted output by inserting intend of 20 pixels.
Michiel Broek <mbroek@mbse.eu>
parents:
240
diff
changeset
|
2175 | 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
|
2176 | 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
|
2177 | } |
240 | 2178 | 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
|
2179 | 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
|
2180 | painter->drawText(220,55, 400, 20, Qt::AlignLeft, ": " + product->st_name); |
237 | 2181 | } |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
2182 | /* 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
|
2183 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2184 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2185 |