src/InventoryHops.cpp

changeset 373
b02aca4e926c
parent 301
fe6346211b5b
child 380
8f5c03ed4321
--- a/src/InventoryHops.cpp	Tue Jul 26 19:46:44 2022 +0200
+++ b/src/InventoryHops.cpp	Fri Jul 29 13:12:26 2022 +0200
@@ -136,19 +136,27 @@
         item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
         this->tableHops->setItem(ridx, 7, item);
 
-	if (query.value(15).toDouble() > 0)
-	    this->tableHops->setItem(ridx, 8, new QTableWidgetItem(query.value(17).toString()));  /* Harvest */
+	if (query.value("inventory").toDouble() > 0)
+	    this->tableHops->setItem(ridx, 8, new QTableWidgetItem(query.value("production_date").toString()));
 	else
 	    this->tableHops->setItem(ridx, 8, new QTableWidgetItem(QString("")));
 
 	w = QString("");
-	if (query.value(15).toDouble() > 0) {
-	  if (query.value(15).toDouble() < 1.000) {
-	    w = QString("%1 gr").arg(query.value(15).toDouble() * 1000.0, 2, 'f', 1, '0' );
-	  } else {
-            w = QString("%1 kg").arg(query.value(15).toDouble(), 4, 'f', 3, '0' );
-	  }
-	}
+	if (query.value("inventory").toDouble() > 0) {
+	    if (query.value("form").toInt() < HOP_FORMS_CO2EXTRACT) {
+	    	if (query.value("inventory").toDouble() < 1.000) {
+	      	    w = QString("%1 gr").arg(query.value("inventory").toDouble() * 1000.0, 2, 'f', 1, '0' );
+	    	} else {
+              	    w = QString("%1 kg").arg(query.value("inventory").toDouble(), 4, 'f', 3, '0' );
+	    	}
+	    } else {
+            	if (query.value("inventory").toDouble() < 1.000) {
+              	    w = QString("%1 mL").arg(query.value("inventory").toDouble() * 1000.0, 2, 'f', 1, '0' );
+            	} else {
+              	    w = QString("%1 L").arg(query.value("inventory").toDouble(), 4, 'f', 3, '0' );
+            	}
+	    }
+        }
 	item = new QTableWidgetItem(w);
 	item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
 	this->tableHops->setItem(ridx, 9, item);

mercurial