Browse Source

Fix manual production roast entry query

Neal Wilson 7 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
 				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, ";
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
 				q += productionGreenTable.columnArray(0, 32);
449
 				q += productionGreenTable.columnArray(0, 32);
450
 				q += ", ";
450
 				q += ", ";
451
+				var greenSum = 0.0;
451
 				for(var i = 0; i < productionGreenTable.data(i, 1, 0).value != ""; i++) {
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
 				q += productionGreenTable.columnArray(1, 32);
457
 				q += productionGreenTable.columnArray(1, 32);
455
 				q += ", ";
458
 				q += ", ";
459
+				q += greenWt;
460
+				q += ", ";
456
 				q += roastedItem.currentData();
461
 				q += roastedItem.currentData();
457
 				q += ", ";
462
 				q += ", ";
458
 				q += convertToPounds(parseFloat(roastedWeight.text), productionGreenUnit.currentText);
463
 				q += convertToPounds(parseFloat(roastedWeight.text), productionGreenUnit.currentText);
459
 				q += ", 'ROAST', :annotation, ";
464
 				q += ", 'ROAST', :annotation, ";
460
 				q += selectedRoasterID;
465
 				q += selectedRoasterID;
461
 				q += ", :duration, TRUE, NULL, NULL, NULL, NULL, '{";
466
 				q += ", :duration, TRUE, NULL, NULL, NULL, NULL, '{";
462
-				q += fileID;
467
+				if(fileID > 0) {
468
+					q += fileID;
469
+				}
463
 				q += "}', :user)";
470
 				q += "}', :user)";
464
 				query.prepare(q);
471
 				query.prepare(q);
465
 				query.bind(":time", roastTime.text);
472
 				query.bind(":time", roastTime.text);

Loading…
Cancel
Save