Browse Source

Add person to item transactions report

Neal Wilson 7 years ago
parent
commit
0fa8b76efe
1 changed files with 153 additions and 77 deletions
  1. 153
    77
      config/Windows/manuallogentry.xml

+ 153
- 77
config/Windows/manuallogentry.xml View File

@@ -1,85 +1,155 @@
1 1
 <window id="manualLogEntry">
2
-	<layout type="horizontal"><!-- Top horizontal layout -->
3
-		<layout type="vertical"><!-- Left vertical layout -->
4
-			<layout type="horizontal">
5
-				<label>Batch Type:</label>
6
-				<sqldrop id="batchType" />
7
-				<stretch />
8
-			</layout>
9
-			<label>Green Coffee:</label>
10
-			<layout type="stack" id="greenInfoLayout"><!-- Green information -->
11
-				<page id="sampleGreen">
12
-					<layout type="vertical">
13
-						<layout type="grid">
14
-							<row>
15
-								<column><label>Name:</label></column>
16
-								<column><line id="sampleGreenName" /></column>
17
-							</row>
18
-							<row>
19
-								<column><label>Weight:</label></column>
20
-								<column><line id="sampleGreenWeight" /></column>
21
-								<column><sqldrop id="sampleGreenUnit" /></column>
22
-							</row>
23
-							<row>
24
-								<column><label>Vendor:</label></column>
25
-								<column><line id="sampleGreenVendor" /></column>
26
-							</row>
27
-							<row>
28
-								<column><label>Arrival Date:</label></column>
29
-								<column><line id="sampleGreenArrivalDate" /></column>
30
-							</row>
31
-						</layout>
32
-						<label>Additional Details:</label>
33
-						<sqltablearray columns="2" id="attributes">
34
-							<column name="Attribute" />
35
-							<column name="Value" />
36
-						</sqltablearray>
2
+	<menu name="File">
3
+		<plugins id="pluginMenu" title="Import" src="ImportFilters" preRun="pluginContext.preRun();" postRun="pluginContext.postRun();"/>
4
+		<separator />
5
+		<item id="quitItem" shortcut="ctrl+Q">Quit</item>
6
+	</menu>
7
+	<layout type="vertical">
8
+		<tabbar id="tabs"/>
9
+		<layout type="stack" id="pages">
10
+			<page>
11
+				<layout type="vertical">
12
+					<layout type="horizontal">
13
+						<label>Batch Type:</label>
14
+						<sqldrop id="batchType" />
15
+						<label>Machine:</label>
16
+						<sqldrop id="machineSelector" />
17
+						<stretch />
37 18
 					</layout>
38
-				</page>
39
-				<page id="productionGreen">
40
-					<layout type="vertical">
41
-						<layout type="horizontal">
42
-							<label>Unit:</label>
43
-							<sqldrop id="productionGreenUnit" />
44
-							<stretch />
45
-						</layout>
46
-						<sqltablearray columns="2" id="productionGreenTable">
47
-							<column name="Coffee" delegate="sql" showdata="true" null="true" nulltext="Delete" nulldata="delete" data="0" display="1">
48
-								<![CDATA[SELECT id, name FROM coffees WHERE quantity <> 0 ORDER BY name]]>
19
+					<label>Green Coffee:</label>
20
+					<layout type="stack" id="greenInfoLayout">
21
+						<page id="sampleGreen">
22
+							<layout type="vertical">
23
+								<layout type="grid">
24
+									<row>
25
+										<column><label>Name:</label></column>
26
+										<column><line id="sampleGreenName" /></column>
27
+									</row>
28
+									<row>
29
+										<column><label>Weight:</label></column>
30
+										<column><line id="sampleGreenWeight" /></column>
31
+										<column><sqldrop id="sampleGreenUnit" /></column>
32
+									</row>
33
+									<row>
34
+										<column><label>Vendor:</label></column>
35
+										<column><line id="sampleGreenVendor" /></column>
36
+									</row>
37
+									<row>
38
+										<column><label>Arrival Date:</label></column>
39
+										<column><line id="sampleGreenArrivalDate" /></column>
40
+									</row>
41
+								</layout>
42
+								<label>Additional Details:</label>
43
+								<sqltablearray columns="2" id="attributes">
44
+									<column name="Attribute" />
45
+									<column name="Value" />
46
+								</sqltablearray>
47
+							</layout>
48
+						</page>
49
+						<page id="productionGreen">
50
+							<layout type="vertical">
51
+								<layout type="horizontal">
52
+									<label>Unit:</label>
53
+									<sqldrop id="productionGreenUnit" />
54
+									<stretch />
55
+								</layout>
56
+								<sqltablearray columns="2" id="productionGreenTable">
57
+									<column name="Coffee" delegate="sql" showdata="true" null="true" nulltext="Delete" nulldata="delete" data="0" display="1">
58
+										<![CDATA[SELECT id, name FROM coffees WHERE quantity <> 0 ORDER BY name]]>
59
+									</column>
60
+									<column name="Weight" delegate="numeric" />
61
+								</sqltablearray>
62
+							</layout>
63
+						</page>
64
+					</layout>
65
+					<label>Roasting Details:</label>
66
+					<layout type="grid">
67
+						<row>
68
+							<column><label>Item:</label></column>
69
+							<column>
70
+								<sqldrop data="0" display="1" showdata="true" id="roastedItem">
71
+									<null />
72
+									<query>SELECT id, name FROM items WHERE category = 'Coffee: Roasted' AND id IN (SELECT item FROM current_items) ORDER BY name</query>
73
+								</sqldrop>
49 74
 							</column>
50
-							<column name="Weight" delegate="numeric" />
51
-						</sqltablearray>
75
+						</row>
76
+						<row>
77
+							<column><label>Weight:</label></column>
78
+							<column><line id="roastedWeight" validator="numeric" /></column>
79
+						</row>
80
+						<row>
81
+							<column><label>Time:</label></column>
82
+							<column><calendar id="roastTime" time="true"/></column>
83
+						</row>
84
+						<row>
85
+							<column><label>Duration:</label></column>
86
+							<column><timeedit id="roastDuration" /></column>
87
+						</row>
88
+						<row>
89
+							<column><label>Notes:</label></column>
90
+							<column><textarea id="notes" /></column>
91
+						</row>
52 92
 					</layout>
53
-				</page>
54
-			</layout><!-- End of green information -->
55
-			<label>Roasting Details:</label>
56
-			<layout type="grid">
57
-				<row>
58
-					<column><label>Item:</label></column>
59
-					<column>
60
-						<sqldrop data="0" display="1" showdata="true" id="roastedItem">
61
-							<null />
62
-							<query>SELECT id, name FROM items WHERE category = 'Coffee: Roasted' AND id IN (SELECT item FROM current_items) ORDER BY name</query>
63
-						</sqldrop>
64
-					</column>
65
-				</row>
66
-				<row>
67
-					<column><label>Weight:</label></column>
68
-					<column><line id="roastedWeight" validator="numeric" /></column>
69
-				</row>
70
-				<row>
71
-					<column><label>Time:</label></column>
72
-					<column><line id="roastTime" /></column>
73
-				</row>
74
-				<row>
75
-					<column><label>Duration:</label></column>
76
-					<column><line id="roastDuration" /></column>
77
-				</row>
78
-			</layout>
79
-		</layout><!-- End of left vertical layout -->
80
-	</layout><!-- End of top horizontal layout -->
93
+				</layout>
94
+			</page>
95
+			<page>
96
+				<layout type="vertical">
97
+					<splitter type="horizontal" id="roastdatasplit">
98
+						<measurementtable id="log" />
99
+						<graph id="graph" />
100
+					</splitter>
101
+				</layout>
102
+			</page>
103
+			<page>
104
+				
105
+			</page>
106
+		</layout>
107
+		<layout type="horizontal">
108
+			<stretch />
109
+			<button name="Submit" id="submit" type="push" />
110
+		</layout>
111
+	</layout>
81 112
 	<program>
82 113
 	<![CDATA[
114
+		var window = this;
115
+		this.windowTitle = "Typica - Manual Log Entry";
116
+		quitItem = findChildObject(this, 'quitItem');
117
+		quitItem.triggered.connect(function() {
118
+			Application.quit();
119
+		});
120
+		pluginContext = {};
121
+		pluginContext.table = findChildObject(this, 'log');
122
+		pluginContext.graph = findChildObject(this, 'graph');
123
+		pluginContext.preRun = function() {
124
+			var filename = QFileDialog.getOpenFileName(window, TTR("manualLogEntry", "Import"), QSettings.value('script/lastDir', '') + '/');
125
+			var file = new QFile(filename);
126
+			if(file.open(1)) {
127
+				pluginContext.data = file.readToString();
128
+				file.close();
129
+				pluginContext.table.clear();
130
+				pluginContext.graph.clear();
131
+				QSettings.setValue("script/lastDir", dir(filename));
132
+			} else {
133
+				throw new Error("Failed to open file, aborting import.");
134
+			}
135
+		};
136
+		pluginContext.postRun = function() {
137
+			
138
+		};
139
+		pluginContext.newMeasurement = function(m, c) {
140
+			pluginContext.table.newMeasurement(m, c);
141
+			pluginContext.graph.newMeasurement(m, c);
142
+		}
143
+		pluginMenu = findChildObject(this, 'pluginMenu');
144
+		pluginMenu.setProperty("activationObject", pluginContext);
145
+		tabs = findChildObject(this, 'tabs');
146
+		tabs.addTab("Batch Data");
147
+		tabs.addTab("Roast Data");
148
+		tabs.addTab("Roast Data Configuration");
149
+		pages = findChildObject(this, 'pages');
150
+		tabs.currentChanged.connect(function(index) {
151
+			pages.setCurrentIndex(index);
152
+		});
83 153
 		greenInfoLayout = findChildObject(this, 'greenInfoLayout');
84 154
 		roastedItem = findChildObject(this, 'roastedItem');
85 155
 		batchType = findChildObject(this, 'batchType');
@@ -91,7 +161,13 @@
91 161
 			roastedItem.enabled = (batchTypeIndex == 1);
92 162
 		});
93 163
 		batchType.setCurrentIndex(QSettings.value("script/manual_batchType", 1));
94
-		roastedItem.enabled = (batchTypeIndex == 1);
164
+		var machineSelector = findChildObject(this, 'machineSelector');
165
+        var machineModel = new DeviceTreeModel;
166
+        machineSelector.setModel(machineModel);
167
+        machineSelector.currentIndex = QSettings.value("script/manualMachineSelection", 0);
168
+        machineSelector['currentIndexChanged(int)'].connect(function(index) {
169
+            QSettings.setValue("script/manualMachineSelection", index);
170
+        });
95 171
 		sampleGreenUnit = findChildObject(this, 'sampleGreenUnit');
96 172
 		sampleGreenUnit.addItem("g");
97 173
 		sampleGreenUnit.addItem("Kg");

Loading…
Cancel
Save