Browse Source

Window title and formatting adjustments for batch log report

Neal Wilson 8 years ago
parent
commit
5524def744
1 changed files with 12 additions and 1 deletions
  1. 12
    1
      config/Reports/historyreport.xml

+ 12
- 1
config/Reports/historyreport.xml View File

@@ -20,6 +20,7 @@
20 20
     </menu>
21 21
     <program>
22 22
         <![CDATA[
23
+            this.setWindowTitle("Typica - Batch Log");
23 24
             var dateSelect = findChildObject(this, 'dates');
24 25
             var dateQuery = new QSqlQuery();
25 26
             dateQuery.exec("SELECT time::date FROM roasting_log WHERE time = (SELECT min(time) FROM roasting_log) OR time = (SELECT max(time) FROM roasting_log) ORDER BY time ASC");
@@ -163,24 +164,28 @@
163 164
                 output.writeAttribute("cellpadding", "3px");
164 165
                 output.writeStartElement("thead");
165 166
                 output.writeStartElement("tr");
167
+                output.writeAttribute("valign", "bottom");
166 168
                 output.writeTextElement("th", "Time");
167 169
                 output.writeTextElement("th", "File Numbers");
168 170
                 output.writeTextElement("th", "Operator");
169 171
                 output.writeTextElement("th", "Roasted Coffee");
170 172
                 output.writeEndElement();
171 173
                 output.writeStartElement("tr");
174
+                output.writeAttribute("valign", "bottom");
172 175
                 output.writeEmptyElement("td");
173 176
                 output.writeTextElement("th", "Duration");
174 177
                 output.writeTextElement("th", "Machine");
175 178
                 output.writeTextElement("th", "Green Coffees");
176 179
                 output.writeEndElement();
177 180
                 output.writeStartElement("tr");
181
+                output.writeAttribute("valign", "bottom");
178 182
                 output.writeEmptyElement("td");
179 183
                 output.writeTextElement("th", "Green Weight");
180 184
                 output.writeTextElement("th", "Roasted Weight");
181 185
                 output.writeTextElement("th", "% Weight Loss");
182 186
                 output.writeEndElement();
183 187
                 output.writeStartElement("tr");
188
+                output.writeAttribute("valign", "bottom");
184 189
                 output.writeEmptyElement("td");
185 190
                 output.writeStartElement("th");
186 191
                 output.writeAttribute("colspan", "2");
@@ -192,6 +197,7 @@
192 197
                 output.writeStartElement("tbody");
193 198
                 while(query.next()) {
194 199
                     output.writeStartElement("tr");
200
+                    output.writeAttribute("valign", "top");
195 201
                     output.writeStartElement("td");
196 202
                     output.writeStartElement("a");
197 203
                     output.writeAttribute("href", "typica://script/b/" + query.value(15));
@@ -215,12 +221,14 @@
215 221
                     output.writeEndElement();
216 222
                     output.writeEndElement();
217 223
                     output.writeStartElement("tr");
224
+                    output.writeAttribute("valign", "top");
218 225
                     output.writeEmptyElement("td");
219 226
                     output.writeTextElement("td", query.value(4));
220 227
                     output.writeTextElement("td", query.value(5));
221 228
                     output.writeTextElement("td", query.value(6));
222 229
                     output.writeEndElement();
223 230
                     output.writeStartElement("tr");
231
+                    output.writeAttribute("valign", "top");
224 232
                     output.writeEmptyElement("td");
225 233
                     output.writeTextElement("td", query.value(7));
226 234
                     output.writeTextElement("td", query.value(8));
@@ -237,6 +245,7 @@
237 245
                     output.writeEndElement();
238 246
                     output.writeEndElement();
239 247
                     output.writeStartElement("tr");
248
+                    output.writeAttribute("valign", "top");
240 249
                     output.writeEmptyElement("td");
241 250
                     output.writeStartElement("td");
242 251
                     output.writeAttribute("colspan", "2");
@@ -264,13 +273,15 @@
264 273
                 output.writeEndElement();
265 274
                 output.writeStartElement("tfoot");
266 275
                 output.writeStartElement("tr");
276
+                output.writeAttribute("valign", "bottom");
267 277
                 output.writeTextElement("th", "Total Batches");
268 278
                 output.writeTextElement("th", "Total Duration");
269 279
                 output.writeTextElement("th", "Total Green Weight");
270 280
                 output.writeTextElement("th", "Total Roasted Weight");
271 281
                 output.writeEndElement();
272 282
                 output.writeStartElement("tr");
273
-                q = "WITH qq AS (SELECT roasting_log.time, array_to_string(files, ','), person, (SELECT name || ' (' || id || ')' FROM items WHERE id = roasted_id) AS rname, duration, (SELECT name FROM machine WHERE id = machine) AS mname, array_to_string(ARRAY(SELECT name || ' (' || id || ')' FROM items WHERE id IN (SELECT unnest(unroasted_id))), ',') AS greens, (unroasted_total_quantity/:c1)::numeric(12,2) AS uq, (roasted_quantity/:c2)::numeric(12,2) AS rq, loss, annotation, approval, spec_loss::numeric(12,2) || '±' || spec_tolerance::numeric(12,2) AS lspec, notes, loss_match, machine || '@' || roasting_log.time AS link, files FROM roasting_log, LATERAL (SELECT CASE WHEN (unroasted_total_quantity = 0) THEN NULL ELSE (((unroasted_total_quantity - roasted_quantity)/unroasted_total_quantity)*100)::numeric(12,2) END AS loss) lc, LATERAL (WITH q AS (SELECT (SELECT min(time) - interval '10 years' FROM roasting_log) AS time, NULL::numeric AS loss, NULL::numeric AS tolerance, NULL::text AS notes) SELECT time, (loss*100)::numeric(12,2) AS spec_loss, (tolerance*100)::numeric(12,2) AS spec_tolerance, 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) UNION (SELECT * FROM q) ORDER BY time DESC LIMIT 1) spec, LATERAL (SELECT loss >= spec_loss - spec_tolerance AND loss <= spec_loss + spec_tolerance AS loss_match) m WHERE roasting_log.time >= :sd AND roasting_log.time < :ed::date + interval '1 day'" + approvalClause + batchClause + ") SELECT count(1), sum(duration), sum(uq), sum(rq) FROM qq" + searchClause;
283
+                output.writeAttribute("valign", "top");
284
+                q = "WITH qq AS (SELECT roasting_log.time, array_to_string(files, ','), person, (SELECT name || ' (' || id || ')' FROM items WHERE id = roasted_id) AS rname, duration, (SELECT name FROM machine WHERE id = machine) AS mname, array_to_string(ARRAY(SELECT name || ' (' || id || ')' FROM items WHERE id IN (SELECT unnest(unroasted_id))), ',') AS greens, (unroasted_total_quantity/:c1)::numeric(12,2) AS uq, (roasted_quantity/:c2)::numeric(12,2) AS rq, annotation, approval, files FROM roasting_log WHERE roasting_log.time >= :sd AND roasting_log.time < :ed::date + interval '1 day'" + approvalClause + batchClause + ") SELECT count(1), sum(duration), sum(uq), sum(rq) FROM qq" + searchClause;
274 285
                 var query = new QSqlQuery();
275 286
                 query.prepare(q);
276 287
                 query.bind(":c1", conversion);

Loading…
Cancel
Save