|
@@ -22,7 +22,6 @@
|
22
|
22
|
<button id="save" type="push" name="Save" />
|
23
|
23
|
</layout>
|
24
|
24
|
</layout>
|
25
|
|
- <svgwidget id="boxplot" />
|
26
|
25
|
</layout>
|
27
|
26
|
<program>
|
28
|
27
|
<![CDATA[
|
|
@@ -33,7 +32,6 @@
|
33
|
32
|
var tolerance = findChildObject(this, 'tolerance');
|
34
|
33
|
var notes = findChildObject(this, 'notes');
|
35
|
34
|
var savebutton = findChildObject(this, 'save');
|
36
|
|
- var boxplot = findChildObject(this, 'boxplot');
|
37
|
35
|
var updateDisplay = function() {
|
38
|
36
|
var query = new QSqlQuery();
|
39
|
37
|
query.prepare("SELECT loss, tolerance, notes FROM roasting_specification WHERE item = :id1 AND time = (SELECT max(time) FROM roasting_specification WHERE item = :id2)");
|
|
@@ -56,48 +54,7 @@
|
56
|
54
|
expected.text = "";
|
57
|
55
|
tolerance.text = "";
|
58
|
56
|
notes.plainText = "";
|
59
|
|
- }
|
60
|
|
- query.prepare("SELECT (unroasted_total_quantity - roasted_quantity)/unroasted_total_quantity AS loss FROM roasting_log WHERE roasted_id = :id1 AND unroasted_id = (SELECT unroasted_id FROM roasting_log WHERE time = (SELECT max(time) FROM roasting_log WHERE roasted_id = :id2) AND roasted_id = :id3) AND approval = true ORDER BY loss ASC");
|
61
|
|
- query.bind(":id1", selector.currentData());
|
62
|
|
- query.bind(":id2", selector.currentData());
|
63
|
|
- query.bind(":id3", selector.currentData());
|
64
|
|
- query.exec();
|
65
|
|
- var buffer = new QBuffer;
|
66
|
|
- buffer.open(3);
|
67
|
|
- var output = new XmlWriter(buffer);
|
68
|
|
- output.writeStartDocument("1.0");
|
69
|
|
- output.writeDTD('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">');
|
70
|
|
- output.writeStartElement("svg");
|
71
|
|
- output.writeAttribute("width", "40");
|
72
|
|
- output.writeAttribute("height", "320");
|
73
|
|
- output.writeStartElement("g");
|
74
|
|
- output.writeAttribute("stroke", "black");
|
75
|
|
- output.writeAttribute("stroke-width", "2");
|
76
|
|
- output.writeStartElement("line");
|
77
|
|
- output.writeAttribute("x1", "15");
|
78
|
|
- output.writeAttribute("x2", "25");
|
79
|
|
- output.writeAttribute("y1", "278.25");
|
80
|
|
- output.writeAttribute("y2", "278.26");
|
81
|
|
- output.writeTextElement("title", "17.71");
|
82
|
|
- output.writeEndElement();
|
83
|
|
- output.writeStartElement("line");
|
84
|
|
- output.writeAttribute("x1", "20");
|
85
|
|
- output.writeAttribute("x2", "20");
|
86
|
|
- output.writeAttribute("y1", "278.25");
|
87
|
|
- output.writeAttribute("y2", "247.5");
|
88
|
|
- output.writeEndElement();
|
89
|
|
- output.writeStartElement("line");
|
90
|
|
- output.writeAttribute("x1", "10");
|
91
|
|
- output.writeAttribute("x2", "30");
|
92
|
|
- output.writeAttribute("y1", "247.5");
|
93
|
|
- output.writeAttribute("y2", "247.5");
|
94
|
|
- output.writeEndElement();
|
95
|
|
-
|
96
|
|
- output.writeEndElement();
|
97
|
|
- output.writeEndElement();
|
98
|
|
- output.writeEndDocument();
|
99
|
|
- boxplot.loadDevice(buffer);
|
100
|
|
- buffer.close();
|
|
57
|
+ }
|
101
|
58
|
query = query.invalidate();
|
102
|
59
|
};
|
103
|
60
|
updateDisplay();
|