|
@@ -1,47 +1,63 @@
|
1
|
1
|
<window id="editBatchDetails">
|
2
|
2
|
<layout type="vertical">
|
3
|
|
- <button type="check" name="Approved" id="approval" />
|
4
|
|
- <layout type="horizontal">
|
5
|
|
- <label>Annotation</label>
|
6
|
|
- <textarea id="annotation" />
|
7
|
|
- </layout>
|
8
|
|
- <button type="push" id="submit" name="Submit" />
|
9
|
|
- </layout>
|
|
3
|
+ <layout type="horizontal">
|
|
4
|
+ <label>Roasted Weight: </label>
|
|
5
|
+ <line id="roasted" validator="numeric" />
|
|
6
|
+ <line id="roastunit" writable="false" />
|
|
7
|
+ </layout>
|
|
8
|
+ <button type="check" name="Approved" id="approval" />
|
|
9
|
+ <layout type="horizontal">
|
|
10
|
+ <label>Annotation</label>
|
|
11
|
+ <textarea id="annotation" />
|
|
12
|
+ </layout>
|
|
13
|
+ <button type="push" id="submit" name="Submit" />
|
|
14
|
+ </layout>
|
10
|
15
|
<program>
|
11
|
16
|
<![CDATA[
|
12
|
|
- var window = this;
|
13
|
|
- var approvalButton = findChildObject(this, 'approval');
|
14
|
|
- var annotationField = findChildObject(this, 'annotation');
|
15
|
|
- var parentWindow;
|
16
|
|
- var tableReference;
|
17
|
|
- var rowReference;
|
18
|
|
- var timeKey;
|
19
|
|
- var machineKey;
|
20
|
|
- var submit = findChildObject(this, 'submit');
|
21
|
|
- submit.enabled = false;
|
22
|
|
- this.loadData = function(parent, table, row, time, machine, approval, annotation) {
|
23
|
|
- parentWindow = parent;
|
24
|
|
- tableReference = table;
|
25
|
|
- rowReference = row;
|
26
|
|
- if(approval == "true") {
|
27
|
|
- approvalButton.checked = true;
|
28
|
|
- }
|
29
|
|
- annotationField.plainText = annotation;
|
30
|
|
- timeKey = time;
|
31
|
|
- machineKey = machine;
|
32
|
|
- submit.enabled = true;
|
33
|
|
- };
|
34
|
|
- submit.clicked.connect(function() {
|
35
|
|
- var query = new QSqlQuery;
|
36
|
|
- query.prepare("UPDATE roasting_log SET approval = :approval, annotation = :annotation WHERE time = :time AND machine = :machine");
|
37
|
|
- query.bind("approval", approvalButton.checked);
|
38
|
|
- query.bind("annotation", annotationField.plainText);
|
39
|
|
- query.bind("time", timeKey);
|
40
|
|
- query.bind("machine", machineKey);
|
41
|
|
- query.exec();
|
42
|
|
- parentWindow.loadData(tableReference, rowReference);
|
43
|
|
- window.close();
|
44
|
|
- });
|
|
17
|
+ var window = this;
|
|
18
|
+ var approvalButton = findChildObject(this, 'approval');
|
|
19
|
+ var annotationField = findChildObject(this, 'annotation');
|
|
20
|
+ var parentWindow;
|
|
21
|
+ var tableReference;
|
|
22
|
+ var rowReference;
|
|
23
|
+ var timeKey;
|
|
24
|
+ var machineKey;
|
|
25
|
+ var submit = findChildObject(this, 'submit');
|
|
26
|
+ submit.enabled = false;
|
|
27
|
+ var roastedEdit = findChildObject(this, 'roasted');
|
|
28
|
+ var unitEdit = findChildObject(this, 'roastunit');
|
|
29
|
+ var conversion = 1;
|
|
30
|
+ this.loadData = function(parent, table, row, time, machine, approval, annotation, roastWeight, unit) {
|
|
31
|
+ parentWindow = parent;
|
|
32
|
+ tableReference = table;
|
|
33
|
+ rowReference = row;
|
|
34
|
+ if(approval == "true") {
|
|
35
|
+ approvalButton.checked = true;
|
|
36
|
+ }
|
|
37
|
+ annotationField.plainText = annotation;
|
|
38
|
+ timeKey = time;
|
|
39
|
+ machineKey = machine;
|
|
40
|
+ submit.enabled = true;
|
|
41
|
+ roastedEdit.text = roastWeight;
|
|
42
|
+ if(unit == 0) {
|
|
43
|
+ unitEdit.text = "Kg";
|
|
44
|
+ conversion = 2.2;
|
|
45
|
+ } else {
|
|
46
|
+ unitEdit.text = "Lb";
|
|
47
|
+ }
|
|
48
|
+ };
|
|
49
|
+ submit.clicked.connect(function() {
|
|
50
|
+ var query = new QSqlQuery;
|
|
51
|
+ query.prepare("UPDATE roasting_log SET roasted_quantity = :roasted, approval = :approval, annotation = :annotation WHERE time = :time AND machine = :machine");
|
|
52
|
+ query.bind(":approval", approvalButton.checked);
|
|
53
|
+ query.bind(":annotation", annotationField.plainText);
|
|
54
|
+ query.bind(":roasted", Number(roastedEdit.text)/conversion);
|
|
55
|
+ query.bind(":time", timeKey);
|
|
56
|
+ query.bind(":machine", Number(machineKey));
|
|
57
|
+ query.exec();
|
|
58
|
+ parentWindow.loadData(tableReference, rowReference);
|
|
59
|
+ window.close();
|
|
60
|
+ });
|
45
|
61
|
]]>
|
46
|
62
|
</program>
|
47
|
63
|
</window>
|