src/InventoryYeasts.cpp

changeset 155
f671c599f65b
parent 90
2396457a8167
child 290
93820a8ffbff
equal deleted inserted replaced
154:1af9f7b7f317 155:f671c599f65b
16 */ 16 */
17 #include "InventoryYeasts.h" 17 #include "InventoryYeasts.h"
18 #include "EditYeast.h" 18 #include "EditYeast.h"
19 #include "MainWindow.h" 19 #include "MainWindow.h"
20 #include "config.h" 20 #include "config.h"
21 #include "global.h"
21 22
22 23
23 InventoryYeasts::InventoryYeasts(QWidget *parent) : QDialog(parent) 24 InventoryYeasts::InventoryYeasts(QWidget *parent) : QDialog(parent)
24 { 25 {
25 qDebug() << "InventoryYeasts start"; 26 qDebug() << "InventoryYeasts start";
100 101
101 qDebug() << "InventoryYeasts reload"; 102 qDebug() << "InventoryYeasts reload";
102 103
103 QSqlQuery query("SELECT * FROM inventory_yeasts ORDER BY laboratory,product_id,name"); 104 QSqlQuery query("SELECT * FROM inventory_yeasts ORDER BY laboratory,product_id,name");
104 const QStringList labels({tr("Laboratory"), tr("Product id"), tr("Name"), tr("Type"), tr("Form"), tr("SVG %"), tr("Tol %"), tr("POF+"), tr("STA1"), tr("Stock"), tr("Edit")}); 105 const QStringList labels({tr("Laboratory"), tr("Product id"), tr("Name"), tr("Type"), tr("Form"), tr("SVG %"), tr("Tol %"), tr("POF+"), tr("STA1"), tr("Stock"), tr("Edit")});
105 const QStringList types({tr("Lager"), tr("Ale"), tr("Wheat"), tr("Wine"), tr("Champagne"), tr("Brett"), tr("Kveik"), tr("Hybrid")});
106 const QStringList form({tr("Liquid"), tr("Dry"), tr("Slant"), tr("Culture"), tr("Frozen"), tr("Bottle"), tr("Dried")});
107 106
108 /* origin supplier name type graintype color yield inventory Edit */ 107 /* origin supplier name type graintype color yield inventory Edit */
109 this->tableYeasts->setColumnCount(11); 108 this->tableYeasts->setColumnCount(11);
110 this->tableYeasts->setColumnWidth(0, 120); /* Laboratory */ 109 this->tableYeasts->setColumnWidth(0, 120); /* Laboratory */
111 this->tableYeasts->setColumnWidth(1, 120); /* Product ID */ 110 this->tableYeasts->setColumnWidth(1, 120); /* Product ID */
128 query.first(); 127 query.first();
129 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { 128 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) {
130 this->tableYeasts->setItem(ridx, 0, new QTableWidgetItem(query.value(4).toString())); /* Laboratory */ 129 this->tableYeasts->setItem(ridx, 0, new QTableWidgetItem(query.value(4).toString())); /* Laboratory */
131 this->tableYeasts->setItem(ridx, 1, new QTableWidgetItem(query.value(5).toString())); /* Product id */ 130 this->tableYeasts->setItem(ridx, 1, new QTableWidgetItem(query.value(5).toString())); /* Product id */
132 this->tableYeasts->setItem(ridx, 2, new QTableWidgetItem(query.value(1).toString())); /* Name */ 131 this->tableYeasts->setItem(ridx, 2, new QTableWidgetItem(query.value(1).toString())); /* Name */
133 this->tableYeasts->setItem(ridx, 3, new QTableWidgetItem(types[query.value(2).toInt()])); /* Type */ 132 this->tableYeasts->setItem(ridx, 3, new QTableWidgetItem(yeast_types[query.value(2).toInt()])); /* Type */
134 this->tableYeasts->setItem(ridx, 4, new QTableWidgetItem(form[query.value(3).toInt()])); /* Form */ 133 this->tableYeasts->setItem(ridx, 4, new QTableWidgetItem(yeast_forms[query.value(3).toInt()])); /* Form */
135 w = QString("%1 %").arg(query.value(9).toDouble(), 2, 'f', 1, '0' ); /* Attenuation% */ 134 w = QString("%1 %").arg(query.value(9).toDouble(), 2, 'f', 1, '0' ); /* Attenuation% */
136 QTableWidgetItem *item = new QTableWidgetItem(w); 135 QTableWidgetItem *item = new QTableWidgetItem(w);
137 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); 136 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
138 this->tableYeasts->setItem(ridx, 5, item); 137 this->tableYeasts->setItem(ridx, 5, item);
139 w = QString(""); 138 w = QString("");

mercurial