Browse Source

Fix manual production roast entry query

Neal Wilson 6 years ago
parent
commit
a82e0745e5
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      config/Windows/manuallogentry.xml

+ 9
- 2
config/Windows/manuallogentry.xml View File

@@ -448,18 +448,25 @@
448 448
 				var q = "INSERT INTO roasting_log (time, unroasted_id, unroasted_quantity, unroasted_total_quantity, roasted_id, roasted_quantity, transaction_type, annotation, machine, duration, approval, humidity, barometric, indoor_air, outdoor_air, files, person) VALUES (:time, ";
449 449
 				q += productionGreenTable.columnArray(0, 32);
450 450
 				q += ", ";
451
+				var greenSum = 0.0;
451 452
 				for(var i = 0; i < productionGreenTable.data(i, 1, 0).value != ""; i++) {
452
-					productionGreenTable.setData(i, 1, convertToPounds(parseFloat(productionGreenTable.data(i, 1, 0)), produtionGreenUnit.currentText), 32);
453
+					var greenWt = convertToPounds(parseFloat(productionGreenTable.data(i, 1, 0)), productionGreenUnit.currentText);
454
+					productionGreenTable.setData(i, 1, greenWt, 32);
455
+					greenSum += greenWt;
453 456
 				}
454 457
 				q += productionGreenTable.columnArray(1, 32);
455 458
 				q += ", ";
459
+				q += greenWt;
460
+				q += ", ";
456 461
 				q += roastedItem.currentData();
457 462
 				q += ", ";
458 463
 				q += convertToPounds(parseFloat(roastedWeight.text), productionGreenUnit.currentText);
459 464
 				q += ", 'ROAST', :annotation, ";
460 465
 				q += selectedRoasterID;
461 466
 				q += ", :duration, TRUE, NULL, NULL, NULL, NULL, '{";
462
-				q += fileID;
467
+				if(fileID > 0) {
468
+					q += fileID;
469
+				}
463 470
 				q += "}', :user)";
464 471
 				query.prepare(q);
465 472
 				query.bind(":time", roastTime.text);

Loading…
Cancel
Save