Sat, 28 May 2022 21:06:58 +0200
Calulate package abv and pressure and store in the global product variable for later use. Finished the product printing module.
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 | } |
1525 | } | |
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
|
1526 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1527 | 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
|
1528 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1529 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1530 | |
237 | 1531 | QString PrinterDialog::strDiff(double v1, double v2, int decimals, QString suffix) |
1532 | { | |
1533 | return QString("%1%2%3").arg((v2 > v1) ? "+":"").arg(v2 - v1, 1, 'f', decimals).arg(suffix); | |
1534 | } | |
1535 | ||
1536 | ||
1537 | QString PrinterDialog::strDensity(double density) | |
1538 | { | |
1539 | 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); | |
1540 | } | |
1541 | ||
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
|
1542 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1543 | 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
|
1544 | { |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1545 | 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
|
1546 | outPixmap.loadFromData(my_logoByteArray); |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1547 | int w = outPixmap.width(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1548 | int h = outPixmap.height(); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1549 | /* Make sure to keep the logo aspect ratio */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1550 | if (w == h) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1551 | painter->drawPixmap(0, 0, 100, 100, outPixmap); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1552 | } else if (w > h) { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1553 | painter->drawPixmap(0, 0, 100, (h * 100) / w, outPixmap); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1554 | } else { |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1555 | painter->drawPixmap(0, 0, (w * 100) / h, 100, outPixmap); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1556 | } |
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
|
1557 | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1558 | /* The fat header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1559 | painter->setFont(QFont("Helvetica",18, QFont::Bold)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1560 | 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
|
1561 | 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
|
1562 | } 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
|
1563 | 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
|
1564 | } 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
|
1565 | painter->drawText(120, 0, 500, 40, Qt::AlignLeft, recipe->name); |
237 | 1566 | } else if (p_job == PR_PRODUCT) { |
1567 | 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
|
1568 | } 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
|
1569 | 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
|
1570 | } |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1571 | /* The first normal header line */ |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1572 | painter->setFont(QFont("Helvetica",10, QFont::Normal)); |
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1573 | painter->drawText(120,35, 80, 20, Qt::AlignLeft, tr("Date and time")); |
237 | 1574 | 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
|
1575 | if (p_job == PR_RECIPE) { |
231f5c8002e3
Added the largest part of print recipe.
Michiel Broek <mbroek@mbse.eu>
parents:
158
diff
changeset
|
1576 | 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
|
1577 | 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
|
1578 | } |
237 | 1579 | if (p_job == PR_PRODUCT) { |
1580 | painter->drawText(120,55, 80, 20, Qt::AlignLeft, tr("Beer style")); | |
1581 | painter->drawText(200,55, 400, 20, Qt::AlignLeft, ": " + product->st_name); | |
1582 | } | |
53
d36879f13d32
Completed printing inventory supplies.
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
1583 | /* 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
|
1584 | } |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1585 | |
ff7b3a41c9b5
After several days experimenting, trials and a lot of errors, a working and nice looking printer support has been added to the application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1586 |