|
@@ -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 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 <= 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";
|
60
|
60
|
query.exec(q);
|
61
|
61
|
var times = new Array();
|
62
|
62
|
var machines = new Array();
|
|
@@ -65,6 +65,7 @@
|
65
|
65
|
output.writeAttribute("cellpadding", "3px");
|
66
|
66
|
output.writeStartElement("thead");
|
67
|
67
|
output.writeStartElement("tr");
|
|
68
|
+ output.writeAttribute("valign", "bottom");
|
68
|
69
|
output.writeTextElement("th", "Time");
|
69
|
70
|
output.writeTextElement("th", "Machine");
|
70
|
71
|
output.writeTextElement("th", "Batch ID");
|
|
@@ -93,6 +94,7 @@
|
93
|
94
|
output.writeEndElement();
|
94
|
95
|
output.writeEndElement();
|
95
|
96
|
output.writeStartElement("tbody");
|
|
97
|
+ output.writeAttribute("valign", "top");
|
96
|
98
|
while(query.next())
|
97
|
99
|
{
|
98
|
100
|
times.push(query.value(0));
|
|
@@ -164,11 +166,45 @@
|
164
|
166
|
output.writeCDATA(query.value(8));
|
165
|
167
|
break;
|
166
|
168
|
}
|
167
|
|
- output.writeTextElement("td", query.value(3) + " (" + query.value(7) + ")");
|
|
169
|
+ output.writeStartElement("td");
|
|
170
|
+ output.writeStartElement("span");
|
|
171
|
+ if(query.value(15) == "false") {
|
|
172
|
+ output.writeAttribute("style", "color:#FF0000");
|
|
173
|
+ }
|
|
174
|
+ output.writeCharacters(query.value(3) + " (" + query.value(7) + ")");
|
|
175
|
+ output.writeEndElement();
|
|
176
|
+ output.writeEndElement();
|
168
|
177
|
if(Number(query.value(6)) > 0) {
|
169
|
178
|
var loss = (Number(query.value(6)) - Number(query.value(8)))/Number(query.value(6));
|
|
179
|
+ var lossMin;
|
|
180
|
+ var lossMax;
|
|
181
|
+ var lossColor;
|
|
182
|
+ var useLoss;
|
|
183
|
+ if(query.value(12) > 0) {
|
|
184
|
+ useLoss = true;
|
|
185
|
+ lossMin = Number(query.value(12)) - Number(query.value(13));
|
|
186
|
+ lossMax = Number(query.value(12)) + Number(query.value(13));
|
|
187
|
+ if(loss >= lossMin && loss <= lossMax) {
|
|
188
|
+ lossColor = '#00FF00';
|
|
189
|
+ } else {
|
|
190
|
+ lossColor = '#FF0000';
|
|
191
|
+ }
|
|
192
|
+ } else {
|
|
193
|
+ lossColor = '#000000';
|
|
194
|
+ useLoss = false;
|
|
195
|
+ }
|
170
|
196
|
loss *= 100;
|
171
|
|
- output.writeTextElement("td", loss.toFixed(2)+"%");
|
|
197
|
+ var lossSpec = Number(query.value(12)) * 100;
|
|
198
|
+ var lossTol = Number(query.value(13)) * 100;
|
|
199
|
+ output.writeStartElement("td");
|
|
200
|
+ output.writeStartElement("span");
|
|
201
|
+ output.writeAttribute("style", "color:"+lossColor);
|
|
202
|
+ if(useLoss) {
|
|
203
|
+ output.writeAttribute("title", lossSpec.toFixed(2) + "+/-" + lossTol.toFixed(2) + "%");
|
|
204
|
+ }
|
|
205
|
+ output.writeCharacters(loss.toFixed(2) + "%");
|
|
206
|
+ output.writeEndElement();
|
|
207
|
+ output.writeEndElement();
|
172
|
208
|
} else {
|
173
|
209
|
output.writeTextElement("td", "Undefined");
|
174
|
210
|
}
|
|
@@ -188,7 +224,7 @@
|
188
|
224
|
var annotations = annotationFromRecord(files[0]);
|
189
|
225
|
output.writeStartElement("tr");
|
190
|
226
|
output.writeStartElement("td");
|
191
|
|
- output.writeAttribute("colspan", "9");
|
|
227
|
+ output.writeAttribute("colspan", "5");
|
192
|
228
|
output.writeTextElement("strong", "Profile Summary");
|
193
|
229
|
var buffer2 = new QBuffer("<points>"+annotations+"</points>");
|
194
|
230
|
buffer2.open(1);
|
|
@@ -265,6 +301,13 @@
|
265
|
301
|
output.writeEndElement();
|
266
|
302
|
output.writeEndElement();
|
267
|
303
|
output.writeEndElement();
|
|
304
|
+ output.writeStartElement("td");
|
|
305
|
+ output.writeAttribute("colspan", "4");
|
|
306
|
+ if(query.value(14)) {
|
|
307
|
+ output.writeTextElement("strong", "Roast Specification Notes");
|
|
308
|
+ output.writeTextElement("p", query.value(14));
|
|
309
|
+ }
|
|
310
|
+ output.writeEndElement();
|
268
|
311
|
output.writeEndElement();
|
269
|
312
|
}
|
270
|
313
|
output.writeEndElement();
|