Neal Wilson 10 years ago
parent
commit
6ea4acfa54
1 changed files with 24 additions and 1 deletions
  1. 24
    1
      config/Reports/dailyproductiondetail.xml

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

100
 					output.writeStartElement("tr");
100
 					output.writeStartElement("tr");
101
 					output.writeTextElement("td", String(query.value(0)).split("T")[1]);
101
 					output.writeTextElement("td", String(query.value(0)).split("T")[1]);
102
 					output.writeTextElement("td", query.value(2));
102
 					output.writeTextElement("td", query.value(2));
103
-					output.writeTextElement("td", query.value(11));
103
+					output.writeStartElement("td");
104
+					output.writeStartElement("a");
105
+					output.writeAttribute("href", "typica://script/p" + query.value(11).slice(1,-1));
106
+					output.writeCDATA(query.value(11));
107
+					output.writeEndElement();
108
+					output.writeEndElement();
104
 					var unroastedWeightsList = sqlToArray(query.value(5));
109
 					var unroastedWeightsList = sqlToArray(query.value(5));
105
 					output.writeStartElement("td");
110
 					output.writeStartElement("td");
106
 					for(var i = 0; i < unroastedWeightsList.length; i++)
111
 					for(var i = 0; i < unroastedWeightsList.length; i++)
407
 			dateField.dateChanged.connect(function() {
412
 			dateField.dateChanged.connect(function() {
408
 				refresh();
413
 				refresh();
409
 			});
414
 			});
415
+			
416
+			view.scriptLinkClicked.connect(function(url) {
417
+				var arg = url.slice(1, url.length);
418
+				var details = createWindow("batchDetails");
419
+				var fakeTable = new Object;
420
+				fakeTable.holding = new Array(7);
421
+				fakeTable.data = function(r, c) {
422
+					return this.holding[c];
423
+				};
424
+				var query = new QSqlQuery();
425
+				query.exec("SELECT time, machine, (SELECT name FROM items WHERE id = roasted_id) AS name, unroasted_total_quantity AS green, roasted_quantity AS roasted, ((unroasted_total_quantity - roasted_quantity) / unroasted_total_quantity * 100::numeric)::numeric(12,2) AS weight_loss, duration, annotation FROM roasting_log WHERE files = '{" + arg + "}'");
426
+				query.next();
427
+				for(var i = 0; i < 8; i++) {
428
+					fakeTable.holding[i] = query.value(i);
429
+				}
430
+				query = query.invalidate();
431
+				details.loadData(fakeTable, 0);
432
+			});
410
 		]]>
433
 		]]>
411
 	</program>
434
 	</program>
412
 </window>
435
 </window>

Loading…
Cancel
Save