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