1013 product->yeasts[product->yeasts_row].sg_lo = query.value("sg_lo").toDouble(); |
1013 product->yeasts[product->yeasts_row].sg_lo = query.value("sg_lo").toDouble(); |
1014 product->yeasts[product->yeasts_row].gr_hl_hi = query.value("gr_hl_hi").toInt(); |
1014 product->yeasts[product->yeasts_row].gr_hl_hi = query.value("gr_hl_hi").toInt(); |
1015 product->yeasts[product->yeasts_row].sg_hi = query.value("sg_hi").toDouble(); |
1015 product->yeasts[product->yeasts_row].sg_hi = query.value("sg_hi").toDouble(); |
1016 product->yeasts[product->yeasts_row].cost = query.value("cost").toDouble(); |
1016 product->yeasts[product->yeasts_row].cost = query.value("cost").toDouble(); |
1017 product->yeasts[product->yeasts_row].inventory = query.value("inventory").toDouble(); |
1017 product->yeasts[product->yeasts_row].inventory = query.value("inventory").toDouble(); |
|
1018 product->yeasts[product->yeasts_row].yp_uuid = QString(); |
1018 |
1019 |
1019 /* |
1020 /* |
1020 * Update the visible fields |
1021 * Update the visible fields |
1021 */ |
1022 */ |
1022 const QSignalBlocker blocker1(yamountEdit); |
1023 const QSignalBlocker blocker1(yamountEdit); |
1046 yamountEdit->setSingleStep(0.5); |
1047 yamountEdit->setSingleStep(0.5); |
1047 yamountLabel->setText(tr("Amount in ml:")); |
1048 yamountLabel->setText(tr("Amount in ml:")); |
1048 product->yeast_pitchrate = 0; |
1049 product->yeast_pitchrate = 0; |
1049 } |
1050 } |
1050 |
1051 |
|
1052 /* |
|
1053 * Clear package and rebuild package select table. |
|
1054 */ |
|
1055 this->ypackageEdit->setCurrentIndex(-1); |
|
1056 this->ypackageEdit->clear(); |
|
1057 this->ypackageEdit->addItem(""); // Start with empty value |
|
1058 query1.prepare("SELECT * FROM inventory_yeastpack WHERE laboratory=:laboratory AND form=:form AND valid='1' ORDER BY laboratory,package"); |
|
1059 query1.bindValue(":laboratory", query.value("laboratory").toString()); |
|
1060 query1.bindValue(":form", query.value("form").toInt()); |
|
1061 qDebug() << " search" << query.value("laboratory").toString() << query.value("form").toInt(); |
|
1062 query1.exec(); |
|
1063 while (query1.next()) { |
|
1064 this->ypackageEdit->addItem(query1.value("laboratory").toString()+" - "+query1.value("package").toString()); |
|
1065 qDebug() << " add package" << query1.value("laboratory").toString() << query1.value("package").toString(); |
|
1066 } |
|
1067 |
1051 ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).name)); |
1068 ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).name)); |
1052 ui->yeastsTable->setItem(product->yeasts_row, 1, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).laboratory)); |
1069 ui->yeastsTable->setItem(product->yeasts_row, 1, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).laboratory)); |
1053 ui->yeastsTable->setItem(product->yeasts_row, 2, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).product_id)); |
1070 ui->yeastsTable->setItem(product->yeasts_row, 2, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).product_id)); |
1054 |
1071 |
1055 item = new QTableWidgetItem(QCoreApplication::translate("YeastForm", g_yeast_forms[product->yeasts.at(product->yeasts_row).form])); |
1072 item = new QTableWidgetItem(QCoreApplication::translate("YeastForm", g_yeast_forms[product->yeasts.at(product->yeasts_row).form])); |
1169 qDebug() << "Edit yeast row" << product->yeasts_row; |
1186 qDebug() << "Edit yeast row" << product->yeasts_row; |
1170 #endif |
1187 #endif |
1171 Yeasts backup = product->yeasts.at(product->yeasts_row); |
1188 Yeasts backup = product->yeasts.at(product->yeasts_row); |
1172 |
1189 |
1173 QDialog* dialog = new QDialog(this); |
1190 QDialog* dialog = new QDialog(this); |
1174 dialog->resize(738, 260); |
1191 dialog->resize(738, 290); |
1175 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
1192 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog); |
1176 buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
1193 buttonBox->setObjectName(QString::fromUtf8("buttonBox")); |
1177 buttonBox->setGeometry(QRect(30, 210, 671, 32)); |
1194 buttonBox->setGeometry(QRect(30, 240, 671, 32)); |
1178 buttonBox->setLayoutDirection(Qt::LeftToRight); |
1195 buttonBox->setLayoutDirection(Qt::LeftToRight); |
1179 buttonBox->setOrientation(Qt::Horizontal); |
1196 buttonBox->setOrientation(Qt::Horizontal); |
1180 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); |
1197 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); |
1181 buttonBox->setCenterButtons(true); |
1198 buttonBox->setCenterButtons(true); |
1182 |
1199 |
1203 QLabel *instockLabel = new QLabel(dialog); |
1220 QLabel *instockLabel = new QLabel(dialog); |
1204 instockLabel->setObjectName(QString::fromUtf8("instockLabel")); |
1221 instockLabel->setObjectName(QString::fromUtf8("instockLabel")); |
1205 instockLabel->setText(tr("In stock:")); |
1222 instockLabel->setText(tr("In stock:")); |
1206 instockLabel->setGeometry(QRect(525,100, 121, 20)); |
1223 instockLabel->setGeometry(QRect(525,100, 121, 20)); |
1207 instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1224 instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
|
1225 QLabel *packageLabel = new QLabel(dialog); |
|
1226 packageLabel->setObjectName(QString::fromUtf8("packageLabel")); |
|
1227 packageLabel->setText(tr("Select package:")); |
|
1228 packageLabel->setGeometry(QRect(10,130, 141, 20)); |
|
1229 packageLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1208 yamountLabel = new QLabel(dialog); |
1230 yamountLabel = new QLabel(dialog); |
1209 yamountLabel->setObjectName(QString::fromUtf8("amountLabel")); |
1231 yamountLabel->setObjectName(QString::fromUtf8("amountLabel")); |
1210 if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) |
1232 if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) |
1211 yamountLabel->setText(tr("Total packs:")); |
1233 yamountLabel->setText(tr("Total packs:")); |
1212 else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) |
1234 else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) |
1213 yamountLabel->setText(tr("Amount in gr:")); |
1235 yamountLabel->setText(tr("Amount in gr:")); |
1214 else |
1236 else |
1215 yamountLabel->setText(tr("Amount in ml:")); |
1237 yamountLabel->setText(tr("Amount in ml:")); |
1216 yamountLabel->setGeometry(QRect(10, 130, 141, 20)); |
1238 yamountLabel->setGeometry(QRect(10, 160, 141, 20)); |
1217 yamountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1239 yamountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1218 QLabel *useatLabel = new QLabel(dialog); |
1240 QLabel *useatLabel = new QLabel(dialog); |
1219 useatLabel->setObjectName(QString::fromUtf8("useatLabel")); |
1241 useatLabel->setObjectName(QString::fromUtf8("useatLabel")); |
1220 useatLabel->setText(tr("Use at:")); |
1242 useatLabel->setText(tr("Use at:")); |
1221 useatLabel->setGeometry(QRect(10, 160, 141, 20)); |
1243 useatLabel->setGeometry(QRect(10, 190, 141, 20)); |
1222 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1244 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1223 |
1245 |
1224 ynameEdit = new QLineEdit(dialog); |
1246 ynameEdit = new QLineEdit(dialog); |
1225 ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
1247 ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); |
1226 ynameEdit->setText(product->yeasts.at(product->yeasts_row).name); |
1248 ynameEdit->setText(product->yeasts.at(product->yeasts_row).name); |
1241 yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
1263 yselectEdit->setGeometry(QRect(160,100, 371, 23)); |
1242 yinstockEdit = new QCheckBox(dialog); |
1264 yinstockEdit = new QCheckBox(dialog); |
1243 yinstockEdit->setObjectName(QString::fromUtf8("yinstockEdit")); |
1265 yinstockEdit->setObjectName(QString::fromUtf8("yinstockEdit")); |
1244 yinstockEdit->setGeometry(QRect(655,100, 85, 21)); |
1266 yinstockEdit->setGeometry(QRect(655,100, 85, 21)); |
1245 yinstockEdit->setChecked(true); |
1267 yinstockEdit->setChecked(true); |
|
1268 ypackageEdit = new QComboBox(dialog); |
|
1269 ypackageEdit->setObjectName(QString::fromUtf8("packageEdit")); |
|
1270 ypackageEdit->setGeometry(QRect(160,130, 371, 23)); |
1246 yamountEdit = new QDoubleSpinBox(dialog); |
1271 yamountEdit = new QDoubleSpinBox(dialog); |
1247 yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
1272 yamountEdit->setObjectName(QString::fromUtf8("yamountEdit")); |
1248 yamountEdit->setGeometry(QRect(160, 130, 121, 24)); |
1273 yamountEdit->setGeometry(QRect(160, 160, 121, 24)); |
1249 yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1274 yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
1250 yamountEdit->setAccelerated(true); |
1275 yamountEdit->setAccelerated(true); |
1251 yamountEdit->setMaximum(10000.0); |
1276 yamountEdit->setMaximum(10000.0); |
1252 if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) { |
1277 if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) { |
1253 yamountEdit->setDecimals(0); |
1278 yamountEdit->setDecimals(0); |
1263 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount * 1000.0); |
1288 yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount * 1000.0); |
1264 } |
1289 } |
1265 yamountEdit->setMaximum(1000000000.0); |
1290 yamountEdit->setMaximum(1000000000.0); |
1266 useatEdit = new QComboBox(dialog); |
1291 useatEdit = new QComboBox(dialog); |
1267 useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
1292 useatEdit->setObjectName(QString::fromUtf8("useatEdit")); |
1268 useatEdit->setGeometry(QRect(160, 160, 161, 23)); |
1293 useatEdit->setGeometry(QRect(160, 190, 161, 23)); |
1269 useatEdit->addItem(tr("Primary")); |
1294 useatEdit->addItem(tr("Primary")); |
1270 useatEdit->addItem(tr("Secondary")); |
1295 useatEdit->addItem(tr("Secondary")); |
1271 useatEdit->addItem(tr("Tertiary")); |
1296 useatEdit->addItem(tr("Tertiary")); |
1272 useatEdit->addItem(tr("Bottle")); |
1297 useatEdit->addItem(tr("Bottle")); |
1273 useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).use); |
1298 useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).use); |