| 
				
			 | 
			
			
				
				@@ -58,7 +58,7 @@ 
			 | 
		
		
	
		
			
			| 
				58
			 | 
			
				58
			 | 
			
			
				
				 				output.writeTextElement("h1", TTR("dailyproduction", "Daily Production Report: ") + dateString); 
			 | 
		
		
	
		
			
			| 
				59
			 | 
			
				59
			 | 
			
			
				
				 				output.writeTextElement("h2", TTR("dailyproduction", "Batches Roasted")); 
			 | 
		
		
	
		
			
			| 
				60
			 | 
			
				60
			 | 
			
			
				
				 				var query = new QSqlQuery(); 
			 | 
		
		
	
		
			
			| 
				61
			 | 
			
				
			 | 
			
			
				
				-				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 max(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"; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				
				+				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 max(time) FROM roasting_specification WHERE time <= roasting_log.time AND item = roasted_id)), approval, machine || '@' || time AS link FROM roasting_log WHERE time > '" + dateString + "' AND time < ('" + dateString + "'::date + integer '1') ORDER BY time"; 
			 | 
		
		
	
		
			
			| 
				62
			 | 
			
				62
			 | 
			
			
				
				 				query.exec(q); 
			 | 
		
		
	
		
			
			| 
				63
			 | 
			
				63
			 | 
			
			
				
				 				var times = new Array(); 
			 | 
		
		
	
		
			
			| 
				64
			 | 
			
				64
			 | 
			
			
				
				 				var machines = new Array(); 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -106,7 +106,7 @@ 
			 | 
		
		
	
		
			
			| 
				106
			 | 
			
				106
			 | 
			
			
				
				 					output.writeTextElement("td", query.value(2)); 
			 | 
		
		
	
		
			
			| 
				107
			 | 
			
				107
			 | 
			
			
				
				 					output.writeStartElement("td"); 
			 | 
		
		
	
		
			
			| 
				108
			 | 
			
				108
			 | 
			
			
				
				 					output.writeStartElement("a"); 
			 | 
		
		
	
		
			
			| 
				109
			 | 
			
				
			 | 
			
			
				
				-					output.writeAttribute("href", "typica://script/p" + query.value(11).slice(1,-1)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				109
			 | 
			
			
				
				+					output.writeAttribute("href", "typica://script/b/" + query.value(16)); 
			 | 
		
		
	
		
			
			| 
				110
			 | 
			
				110
			 | 
			
			
				
				 					output.writeCDATA(query.value(11)); 
			 | 
		
		
	
		
			
			| 
				111
			 | 
			
				111
			 | 
			
			
				
				 					output.writeEndElement(); 
			 | 
		
		
	
		
			
			| 
				112
			 | 
			
				112
			 | 
			
			
				
				 					output.writeEndElement(); 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -475,21 +475,10 @@ 
			 | 
		
		
	
		
			
			| 
				475
			 | 
			
				475
			 | 
			
			
				
				             }); 
			 | 
		
		
	
		
			
			| 
				476
			 | 
			
				476
			 | 
			
			
				
				 			 
			 | 
		
		
	
		
			
			| 
				477
			 | 
			
				477
			 | 
			
			
				
				 			view.scriptLinkClicked.connect(function(url) { 
			 | 
		
		
	
		
			
			| 
				478
			 | 
			
				
			 | 
			
			
				
				-				var arg = url.slice(1, url.length); 
			 | 
		
		
	
		
			
			| 
				479
			 | 
			
				
			 | 
			
			
				
				-				var details = createWindow("batchDetails"); 
			 | 
		
		
	
		
			
			| 
				480
			 | 
			
				
			 | 
			
			
				
				-				var fakeTable = new Object; 
			 | 
		
		
	
		
			
			| 
				481
			 | 
			
				
			 | 
			
			
				
				-				fakeTable.holding = new Array(7); 
			 | 
		
		
	
		
			
			| 
				482
			 | 
			
				
			 | 
			
			
				
				-				fakeTable.data = function(r, c) { 
			 | 
		
		
	
		
			
			| 
				483
			 | 
			
				
			 | 
			
			
				
				-					return this.holding[c]; 
			 | 
		
		
	
		
			
			| 
				484
			 | 
			
				
			 | 
			
			
				
				-				}; 
			 | 
		
		
	
		
			
			| 
				485
			 | 
			
				
			 | 
			
			
				
				-				var query = new QSqlQuery(); 
			 | 
		
		
	
		
			
			| 
				486
			 | 
			
				
			 | 
			
			
				
				-				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 + "}'"); 
			 | 
		
		
	
		
			
			| 
				487
			 | 
			
				
			 | 
			
			
				
				-				query.next(); 
			 | 
		
		
	
		
			
			| 
				488
			 | 
			
				
			 | 
			
			
				
				-				for(var i = 0; i < 8; i++) { 
			 | 
		
		
	
		
			
			| 
				489
			 | 
			
				
			 | 
			
			
				
				-					fakeTable.holding[i] = query.value(i); 
			 | 
		
		
	
		
			
			| 
				490
			 | 
			
				
			 | 
			
			
				
				-				} 
			 | 
		
		
	
		
			
			| 
				491
			 | 
			
				
			 | 
			
			
				
				-				query = query.invalidate(); 
			 | 
		
		
	
		
			
			| 
				492
			 | 
			
				
			 | 
			
			
				
				-				details.loadData(fakeTable, 0); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				478
			 | 
			
			
				
				+                var arg = decodeURI(url.slice(2, url.length)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				479
			 | 
			
			
				
				+                var key = arg.split("@"); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				480
			 | 
			
			
				
				+                var details = createWindow("batchDetails"); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				481
			 | 
			
			
				
				+                details.loadBatch(key[0], key[1]); 
			 | 
		
		
	
		
			
			| 
				493
			 | 
			
				482
			 | 
			
			
				
				 			}); 
			 | 
		
		
	
		
			
			| 
				494
			 | 
			
				483
			 | 
			
			
				
				 		]]> 
			 | 
		
		
	
		
			
			| 
				495
			 | 
			
				484
			 | 
			
			
				
				 	</program> 
			 |