Browse Source

Fix report query

Neal Wilson 9 years ago
parent
commit
76ef044ecb
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      config/Reports/dailyproductiondetail.xml

+ 1
- 1
config/Reports/dailyproductiondetail.xml View File

@@ -56,7 +56,7 @@
56 56
 				output.writeTextElement("h1", "Daily Production Report: " + dateString);
57 57
 				output.writeTextElement("h2", "Batches Roasted");
58 58
 				var query = new QSqlQuery();
59
-				var q = "SELECT time, machine, (SELECT name FROM machine WHERE id = machine), (SELECT name FROM items WHERE id = roasted_id), unroasted_id, unroasted_quantity, unroasted_total_quantity, roasted_id, roasted_quantity, annotation, duration, files, (SELECT loss FROM roasting_specification WHERE item = roasted_id AND time <= roasting_log.time), (SELECT tolerance FROM roasting_specification WHERE item = roasted_id AND time <= roasting_log.time), (SELECT notes FROM roasting_specification WHERE item = roasted_id AND time <= roasting_log.time), approval FROM roasting_log WHERE time > '" + dateString + "' AND time < ('" + dateString + "'::date + integer '1') ORDER BY time";
59
+				var q = "SELECT time, machine, (SELECT name FROM machine WHERE id = machine), (SELECT name FROM items WHERE id = roasted_id), unroasted_id, unroasted_quantity, unroasted_total_quantity, roasted_id, roasted_quantity, annotation, duration, files, (SELECT loss FROM roasting_specification WHERE item = roasted_id AND time = (SELECT max(time) FROM roasting_specification WHERE time <= roasting_log.time AND item = roasted_id)), (SELECT tolerance FROM roasting_specification WHERE item = roasted_id AND time = (SELECT max(time) FROM roasting_specification WHERE time <= roasting_log.time AND item = roasted_id)), (SELECT notes FROM roasting_specification WHERE item = roasted_id AND time = (SELECT time FROM roasting_specification WHERE time <= roasting_log.time AND item = roasted_id)), approval FROM roasting_log WHERE time > '" + dateString + "' AND time < ('" + dateString + "'::date + integer '1') ORDER BY time";
60 60
 				query.exec(q);
61 61
 				var times = new Array();
62 62
 				var machines = new Array();

Loading…
Cancel
Save