Neal Wilson 9 years ago
parent
commit
fc6c3fcb7f
1 changed files with 302 additions and 221 deletions
  1. 302
    221
      config/Windows/newbatch.xml

+ 302
- 221
config/Windows/newbatch.xml View File

@@ -20,9 +20,10 @@
20 20
             <stretch />
21 21
         </layout>
22 22
         <label>Green Coffee:</label>
23
-        <sqltablearray columns="2" id="greens">
23
+        <sqltablearray columns="3" id="greens">
24 24
             <column name="Coffee" delegate="sql" showdata="true" null="true" nulltext="Delete" nulldata="delete" data="0" display="1">SELECT id, name FROM coffees WHERE quantity &lt;&gt; 0 ORDER BY name</column>
25 25
             <column name="Weight" delegate="numeric" />
26
+            <column name="Remaining" />
26 27
         </sqltablearray>
27 28
         <layout type="horizontal">
28 29
             <label>Green Weight:</label>
@@ -62,79 +63,168 @@
62 63
 	</layout>
63 64
     <program>
64 65
         <![CDATA[
65
-			var unitBox = findChildObject(this, 'unit');
66
-			unitBox.addItem("g");
67
-			unitBox.addItem("Kg");
68
-			unitBox.addItem("oz");
69
-			unitBox.addItem("lb");
70
-			unitBox.currentIndex = (QSettings.value("script/batch_unit", unitBox.findText("lb")));
71
-			var machine = findChildObject(this, "machine");
72
-			machine.setText(selectedRoasterName + " (" + selectedRoasterID + ")");
73
-			var newMenu = findChildObject(this, 'new');
74
-			newMenu.triggered.connect(function() {
75
-				var bwindow = createWindow("batchWindow");
76
-				bwindow.windowTitle = "Typica - [*]New Batch";
77
-			});
78
-			var batch = this;
79
-			var table = findChildObject(this, 'greens');
80
-			var green = findChildObject(this, 'green');
81
-			var model = table.model();
66
+            var unitBox = findChildObject(this, 'unit');
67
+            unitBox.addItem("g");
68
+            unitBox.addItem("Kg");
69
+            unitBox.addItem("oz");
70
+            unitBox.addItem("lb");
71
+            unitBox.currentIndex = (QSettings.value("script/batch_unit", unitBox.findText("lb")));
72
+            var machine = findChildObject(this, "machine");
73
+            machine.setText(selectedRoasterName + " (" + selectedRoasterID + ")");
74
+            var newMenu = findChildObject(this, 'new');
75
+            newMenu.triggered.connect(function() {
76
+                    var bwindow = createWindow("batchWindow");
77
+                    bwindow.windowTitle = "Typica - [*]New Batch";
78
+            });
79
+            var batch = this;
80
+            var table = findChildObject(this, 'greens');
81
+            var green = findChildObject(this, 'green');
82
+            var model = table.model();
82 83
             var lossField = findChildObject(this, 'wloss');
83 84
             lossField.maximumWidth = 80;
84 85
             var roasted = findChildObject(this, 'roasted');
85 86
             var roastwt = findChildObject(this, 'roast');
86 87
             roastwt.maximumWidth = 80;
87
-			var scalesLayout = findChildObject(this, 'scales');
88
-			scalesLayout.spacing = 10;
89
-			if(navigationwindow.loggingWindow.scales.length > 0) {
90
-				for(var i = 0; i < navigationwindow.loggingWindow.scales.length; i++) {
91
-					var scale = navigationwindow.loggingWindow.scales[i];
92
-					var label = new DragLabel();
93
-					var weighButton = new QPushButton();
94
-					weighButton.text = "Weigh";
95
-					weighButton.clicked.connect(scale.weigh);
96
-					label.updateMeasurement = function(m, u) {
97
-						switch(unitBox.currentIndex) {
98
-							case 0:
99
-								this.text = Units.convertWeight(m, u, Units.Gram).toFixed(1);
100
-								break;
101
-							case 1:
102
-								this.text = Units.convertWeight(m, u, Units.Kilogram).toFixed(4);
103
-								break;
104
-							case 2:
105
-								this.text = Units.convertWeight(m, u, Units.Ounce).toFixed(3);
106
-								break;
107
-							case 3:
108
-								this.text = Units.convertWeight(m, u, Units.Pound).toFixed(4);
109
-								break;
110
-						}
111
-					};
112
-					scalesLayout.addWidget(label);
113
-					scalesLayout.addWidget(weighButton);
114
-					scale.newMeasurement.connect(function(m, u) {
115
-						label.updateMeasurement(m, u);
116
-					});
117
-					scale.weigh();
118
-					unitBox['currentIndexChanged(int)'].connect(scale.weigh);
119
-				}
120
-			}
121
-			model.dataChanged.connect(function() {
122
-				var deleteRow = -1;
123
-				/* The combo box delegate updates user data before display data
124
-				   and this code is executed before the model update is fully
125
-				   complete. Rather than rely on this behavior continuing, we
126
-				   check that the display value has also been updated and defer
127
-				   row removal until both updates are complete.
128
-				*/
129
-				while((deleteRow = table.findData("delete", 0)) > -1) {
130
-					if(table.data(deleteRow, 0, 0) == "Delete") {
131
-						table.removeRow(table.findData("delete", 0));
132
-					} else {
133
-						break;
134
-					}
135
-				}
136
-				green.text = table.columnSum(1, 0);
137
-				table.resizeColumnToContents(0);
88
+            var scalesLayout = findChildObject(this, 'scales');
89
+            scalesLayout.spacing = 10;
90
+            if(navigationwindow.loggingWindow.scales.length > 0) {
91
+                    for(var i = 0; i < navigationwindow.loggingWindow.scales.length; i++) {
92
+                            var scale = navigationwindow.loggingWindow.scales[i];
93
+                            var label = new DragLabel();
94
+                            var weighButton = new QPushButton();
95
+                            weighButton.text = "Weigh";
96
+                            weighButton.clicked.connect(scale.weigh);
97
+                            label.updateMeasurement = function(m, u) {
98
+                                    switch(unitBox.currentIndex) {
99
+                                            case 0:
100
+                                                    this.text = Units.convertWeight(m, u, Units.Gram).toFixed(1);
101
+                                                    break;
102
+                                            case 1:
103
+                                                    this.text = Units.convertWeight(m, u, Units.Kilogram).toFixed(4);
104
+                                                    break;
105
+                                            case 2:
106
+                                                    this.text = Units.convertWeight(m, u, Units.Ounce).toFixed(3);
107
+                                                    break;
108
+                                            case 3:
109
+                                                    this.text = Units.convertWeight(m, u, Units.Pound).toFixed(4);
110
+                                                    break;
111
+                                    }
112
+                            };
113
+                            scalesLayout.addWidget(label);
114
+                            scalesLayout.addWidget(weighButton);
115
+                            scale.newMeasurement.connect(function(m, u) {
116
+                                    label.updateMeasurement(m, u);
117
+                            });
118
+                            scale.weigh();
119
+                            unitBox['currentIndexChanged(int)'].connect(scale.weigh);
120
+                    }
121
+            }
122
+            var remainingStock = new Array();
123
+            var query = new QSqlQuery();
124
+            query.exec("SELECT id, quantity, (SELECT conversion FROM lb_bag_conversion WHERE item = id) FROM coffees WHERE quantity <> 0");
125
+            while(query.next()) {
126
+                remainingStock.push({id: query.value(0),
127
+                                     quantity: query.value(1),
128
+                                     conversion: query.value(2)});
129
+            }
130
+            query = query.invalidate();
131
+            var convertToPounds = function(w, u) {
132
+                switch(u) {
133
+                    case "g":
134
+                        return w * 0.0022;
135
+                    case "oz":
136
+                        return w * 0.0625;
137
+                    case "Kg":
138
+                        return w * 2.2;
139
+                }
140
+                return w;
141
+            };
142
+            var convertFromPounds = function(w, u) {
143
+                switch(u) {
144
+                    case "g":
145
+                        return w / 0.0022;
146
+                    case "oz":
147
+                        return w / 0.0625;
148
+                    case "Kg":
149
+                        return w / 2.2;
150
+                }
151
+                return w;
152
+            };
153
+            var updateGreenTable = function() {
154
+                var deleteRow = -1;
155
+                /* The combo box delegate updates user data before display data
156
+                and this code is executed before the model update is fully
157
+                complete. Rather than rely on this behavior continuing, we
158
+                check that the display value has also been updated and defer
159
+                row removal until both updates are complete.
160
+                */
161
+                while((deleteRow = table.findData("delete", 0)) > -1) {
162
+                        if(table.data(deleteRow, 0, 0) == "Delete") {
163
+                                table.removeRow(table.findData("delete", 0));
164
+                        } else {
165
+                                break;
166
+                        }
167
+                }
168
+                green.text = table.columnSum(1, 0);
169
+                table.resizeColumnToContents(0);
170
+                var gid = 0;
171
+                var r = 0;
172
+                while(gid >= 0)
173
+                {
174
+                    gid = Number(table.data(r, 0, 32));
175
+                    if(isNaN(gid))
176
+                    {
177
+                        gid = -1;
178
+                        break;
179
+                    }
180
+                    var bagConversion = 1;
181
+                    for(var i = 0; i < remainingStock.length; i++)
182
+                    {
183
+                        if(gid == Number(remainingStock[i].id))
184
+                        {
185
+                            var displayValue = Number(remainingStock[i].quantity);
186
+                            bagConversion = Number(remainingStock[i].conversion);
187
+                            if(!isNaN(Number(table.data(r, 1, 0))))
188
+                            {
189
+                                var change = Number(table.data(r, 1, 0));
190
+                                switch(unitBox.currentIndex)
191
+                                {
192
+                                    case 0:
193
+                                        change = convertToPounds(change, "g");
194
+                                        break;
195
+                                    case 1:
196
+                                        change = convertToPounds(change, "Kg");
197
+                                        break;
198
+                                    case 2:
199
+                                        change = convertToPounds(change, "oz");
200
+                                        break;
201
+                                }
202
+                                displayValue -= change;
203
+                            }
204
+                            switch(unitBox.currentIndex)
205
+                            {
206
+                                case 0:
207
+                                    displayValue = convertFromPounds(displayValue, "g");
208
+                                    break;
209
+                                case 1:
210
+                                    displayValue = convertFromPounds(displayValue, "Kg");
211
+                                    break;
212
+                                case 2:
213
+                                    displayValue = convertFromPounds(displayValue, "oz");
214
+                                    break;
215
+                            }
216
+                            var bagCount = (displayValue / bagConversion).toFixed(2);
217
+                            displayValue = "" + displayValue + " (" + bagCount + " bags)";
218
+                            if(table.data(r, 2, 0) != displayValue)
219
+                            {
220
+                                table.setData(r, 2, displayValue, 0);
221
+                                table.setData(r, 2, displayValue, 2);
222
+                                table.resizeColumnToContents(2);
223
+                            }
224
+                        }
225
+                    }
226
+                    r++;
227
+                }
138 228
                 if(parseFloat(green.text) > 0)
139 229
                 {
140 230
                     if(parseFloat(roastwt.text) > 0)
@@ -146,7 +236,9 @@
146 236
                         lossField.text = "100%";
147 237
                     }
148 238
                 }
149
-			});
239
+            };
240
+            model.dataChanged.connect(updateGreenTable);
241
+            unitBox['currentIndexChanged(int)'].connect(updateGreenTable);
150 242
             roastwt.textChanged.connect(function() {
151 243
                 if(parseFloat(green.text) > 0)
152 244
                 {
@@ -160,21 +252,10 @@
160 252
                     }
161 253
                 }
162 254
             });
163
-			var convertToPounds = function(w, u) {
164
-				switch(u) {
165
-					case "g":
166
-						return w * 0.0022;
167
-					case "oz":
168
-						return w * 0.0625;
169
-					case "Kg":
170
-						return w * 2.2;
171
-				}
172
-				return w;
173
-			};
174 255
             var profilebutton = findChildObject(this, 'load');
175 256
             profilebutton.setEnabled(false);
176 257
             roasted['currentIndexChanged(int)'].connect(function() {
177
-				table.clear();
258
+                table.clear();
178 259
                 var query = new QSqlQuery();
179 260
                 var q = "SELECT EXISTS(SELECT 1 FROM item_files WHERE item = ";
180 261
                 q = q + roasted.currentData();
@@ -235,151 +316,151 @@
235 316
                     }
236 317
                 }
237 318
             });
238
-			profilebutton.clicked.connect(function() {
239
-				batch.windowModified = true;
240
-				currentBatchInfo = batch;
241
-				query = new QSqlQuery();
319
+            profilebutton.clicked.connect(function() {
320
+                batch.windowModified = true;
321
+                currentBatchInfo = batch;
322
+                query = new QSqlQuery();
242 323
                 var q = "SELECT files FROM item_files WHERE item = :item AND time = (SELECT max(time) FROM item_files WHERE item = :again)";
243
-				query.prepare(q);
324
+                query.prepare(q);
244 325
                 query.bind(":item", Number(roasted.currentData()));
245 326
                 query.bind(":again", Number(roasted.currentData()));
246
-				query.exec();
247
-				var graph;
248
-				var log;
249
-				if(query.next())
250
-				{
251
-					var files = query.value(0);
252
-					files = files.replace("{", "(");
253
-					files = files.replace("}", ")");
254
-					q = "SELECT file, name FROM files WHERE id IN ";
255
-					q = q + files;
256
-					q = q + " AND type = 'profile'";
257
-					query.exec(q);
258
-					if(query.next())
259
-					{
260
-						var targetseries = -1;
261
-						var buffer = new QBuffer(query.value(0));
262
-						var pname = query.value(1);
263
-						var input = new XMLInput(buffer, 1);
264
-						graph = findChildObject(navigationwindow.loggingWindow, 'graph');
265
-						log = findChildObject(navigationwindow.loggingWindow, 'log');
266
-						log.clear();
267
-						graph.clear();
268
-						input.newTemperatureColumn.connect(log.setHeaderData);
269
-						input.newTemperatureColumn.connect(function(col, text) {
270
-							if(text == navigationwindow.loggingWindow.targetcolumnname)
271
-							{
272
-								targetseries = col;
273
-							}
274
-						});
275
-						input.newAnnotationColumn.connect(log.setHeaderData);
276
-						input.measure.connect(graph.newMeasurement);
277
-						input.measure.connect(log.newMeasurement);
278
-						input.measure.connect(function(data, series) {
279
-							if(series == targetseries)
280
-							{
281
-								targetDetector.newMeasurement(data);
282
-							}
283
-						});
284
-						var lc;
285
-						input.lastColumn.connect(function(c) {
286
-							lc = c;
287
-							QSettings.setValue("liveColumn", c + 1);
288
-							navigationwindow.loggingWindow.postLoadColumnSetup(c)
289
-						});
290
-						input.annotation.connect(function(note, tcol, ncol) {
291
-							for(var i = tcol; i < ncol; i++) {
292
-								log.newAnnotation(note, i, ncol);
293
-							}
294
-						});
295
-					}
296
-				}
327
+                query.exec();
328
+                var graph;
329
+                var log;
330
+                if(query.next())
331
+                {
332
+                        var files = query.value(0);
333
+                        files = files.replace("{", "(");
334
+                        files = files.replace("}", ")");
335
+                        q = "SELECT file, name FROM files WHERE id IN ";
336
+                        q = q + files;
337
+                        q = q + " AND type = 'profile'";
338
+                        query.exec(q);
339
+                        if(query.next())
340
+                        {
341
+                                var targetseries = -1;
342
+                                var buffer = new QBuffer(query.value(0));
343
+                                var pname = query.value(1);
344
+                                var input = new XMLInput(buffer, 1);
345
+                                graph = findChildObject(navigationwindow.loggingWindow, 'graph');
346
+                                log = findChildObject(navigationwindow.loggingWindow, 'log');
347
+                                log.clear();
348
+                                graph.clear();
349
+                                input.newTemperatureColumn.connect(log.setHeaderData);
350
+                                input.newTemperatureColumn.connect(function(col, text) {
351
+                                        if(text == navigationwindow.loggingWindow.targetcolumnname)
352
+                                        {
353
+                                                targetseries = col;
354
+                                        }
355
+                                });
356
+                                input.newAnnotationColumn.connect(log.setHeaderData);
357
+                                input.measure.connect(graph.newMeasurement);
358
+                                input.measure.connect(log.newMeasurement);
359
+                                input.measure.connect(function(data, series) {
360
+                                        if(series == targetseries)
361
+                                        {
362
+                                                targetDetector.newMeasurement(data);
363
+                                        }
364
+                                });
365
+                                var lc;
366
+                                input.lastColumn.connect(function(c) {
367
+                                        lc = c;
368
+                                        QSettings.setValue("liveColumn", c + 1);
369
+                                        navigationwindow.loggingWindow.postLoadColumnSetup(c)
370
+                                });
371
+                                input.annotation.connect(function(note, tcol, ncol) {
372
+                                        for(var i = tcol; i < ncol; i++) {
373
+                                                log.newAnnotation(note, i, ncol);
374
+                                        }
375
+                                });
376
+                        }
377
+                }
297 378
                 query = query.invalidate();
298
-				navigationwindow.loggingWindow.windowTitle = "Typica - [*]" + pname;
299
-				navigationwindow.loggingWindow.raise();
300
-				navigationwindow.loggingWindow.activateWindow();
301
-				graph.updatesEnabled = false;
302
-				log.updatesEnabled = false;
303
-				input.input();
304
-				log.updatesEnabled = true;
305
-				graph.updatesEnabled = true;
306
-				log.newAnnotation("End", 1, lc);
307
-			});
308
-			var noprofilebutton = findChildObject(this, 'noprofile');
309
-			noprofilebutton.clicked.connect(function() {
310
-				batch.windowModified = true;
311
-				currentBatchInfo = batch;
312
-				navigationwindow.loggingWindow.raise();
313
-				navigationwindow.loggingWindow.activateWindow();
314
-			});
315
-			var submitbutton = findChildObject(this, 'submit');
316
-			var timefield = findChildObject(this, 'time');
317
-			var notes = findChildObject(this, 'annotation');
318
-			var duration = findChildObject(this, 'duration');
319
-			var approval = findChildObject(this, 'approval');
320
-			approval.checked = true;
321
-			var target = findChildObject(this, 'target');
322
-			submitbutton.clicked.connect(function() {
323
-				checkQuery = new QSqlQuery();
324
-				checkQuery.exec("SELECT 1 FROM machine WHERE id = " + selectedRoasterID);
325
-				if(!checkQuery.next())
326
-				{
327
-					checkQuery.prepare("INSERT INTO machine (id, name) VALUES(:id, :name)");
328
-					checkQuery.bind(":id", selectedRoasterID);
329
-					checkQuery.bind(":name", selectedRoasterName);
330
-					checkQuery.exec();
331
-				}
332
-				checkQuery = checkQuery.invalidate();
333
-				var q = "INSERT INTO files (id, name, type, note, file) VALUES(default, :name, 'profile', NULL, :data) RETURNING id";
334
-				query = new QSqlQuery();
335
-				query.prepare(q);
336
-				query.bind(":name", timefield.text + " " + roasted.currentText);
337
-				query.bindFileData(":data", batch.tempData);
338
-				query.exec();
339
-				query.next();
340
-				var fileno = query.value(0);
341
-				var file = new QFile(batch.tempData);
342
-				file.remove();
343
-				var q2 = "INSERT INTO roasting_log (time, unroasted_id, unroasted_quantity, unroasted_total_quantity, roasted_id, roasted_quantity, transaction_type, annotation, machine, duration, approval, humidity, barometric, indoor_air, outdoor_air, files) VALUES(:time, ";
344
-				q2 = q2 + table.columnArray(0, 32);
345
-				q2 = q2 + ", ";
346
-				for(var i = 0; table.data(i, 1, 0).value != ""; i++)
347
-				{
348
-					table.setData(i, 1, convertToPounds(parseFloat(table.data(i, 1, 0)), unitBox.currentText) ,32)
349
-				}
350
-				q2 = q2 + table.columnArray(1, 32);
351
-				q2 = q2 + ", ";
352
-				q2 = q2 + convertToPounds(parseFloat(green.text), unitBox.currentText);
353
-				q2 = q2 + ", ";
354
-				q2 = q2 + roasted.currentData();
355
-				q2 = q2 + ", ";
356
-				q2 = q2 + convertToPounds(parseFloat(roastwt.text), unitBox.currentText);
357
-				q2 = q2 + ", 'ROAST', :annotation, ";
358
-				q2 = q2 + selectedRoasterID;
359
-				q2 = q2 + ", :duration, :approval, NULL, NULL, NULL, NULL, '{";
360
-				q2 = q2 + fileno;
361
-				q2 = q2 + "}')";
362
-				query2 = new QSqlQuery();
363
-				query2.prepare(q2);
364
-				query2.bind(":time", timefield.text);
365
-				query2.bind(":annotation", notes.plainText);
366
-				query2.bind(":duration", duration.text);
367
-				query2.bind(":approval", approval.checked);
368
-				query2.exec();
379
+                navigationwindow.loggingWindow.windowTitle = "Typica - [*]" + pname;
380
+                navigationwindow.loggingWindow.raise();
381
+                navigationwindow.loggingWindow.activateWindow();
382
+                graph.updatesEnabled = false;
383
+                log.updatesEnabled = false;
384
+                input.input();
385
+                log.updatesEnabled = true;
386
+                graph.updatesEnabled = true;
387
+                log.newAnnotation("End", 1, lc);
388
+            });
389
+            var noprofilebutton = findChildObject(this, 'noprofile');
390
+            noprofilebutton.clicked.connect(function() {
391
+                    batch.windowModified = true;
392
+                    currentBatchInfo = batch;
393
+                    navigationwindow.loggingWindow.raise();
394
+                    navigationwindow.loggingWindow.activateWindow();
395
+            });
396
+            var submitbutton = findChildObject(this, 'submit');
397
+            var timefield = findChildObject(this, 'time');
398
+            var notes = findChildObject(this, 'annotation');
399
+            var duration = findChildObject(this, 'duration');
400
+            var approval = findChildObject(this, 'approval');
401
+            approval.checked = true;
402
+            var target = findChildObject(this, 'target');
403
+            submitbutton.clicked.connect(function() {
404
+                checkQuery = new QSqlQuery();
405
+                checkQuery.exec("SELECT 1 FROM machine WHERE id = " + selectedRoasterID);
406
+                if(!checkQuery.next())
407
+                {
408
+                        checkQuery.prepare("INSERT INTO machine (id, name) VALUES(:id, :name)");
409
+                        checkQuery.bind(":id", selectedRoasterID);
410
+                        checkQuery.bind(":name", selectedRoasterName);
411
+                        checkQuery.exec();
412
+                }
413
+                checkQuery = checkQuery.invalidate();
414
+                var q = "INSERT INTO files (id, name, type, note, file) VALUES(default, :name, 'profile', NULL, :data) RETURNING id";
415
+                query = new QSqlQuery();
416
+                query.prepare(q);
417
+                query.bind(":name", timefield.text + " " + roasted.currentText);
418
+                query.bindFileData(":data", batch.tempData);
419
+                query.exec();
420
+                query.next();
421
+                var fileno = query.value(0);
422
+                var file = new QFile(batch.tempData);
423
+                file.remove();
424
+                var q2 = "INSERT INTO roasting_log (time, unroasted_id, unroasted_quantity, unroasted_total_quantity, roasted_id, roasted_quantity, transaction_type, annotation, machine, duration, approval, humidity, barometric, indoor_air, outdoor_air, files) VALUES(:time, ";
425
+                q2 = q2 + table.columnArray(0, 32);
426
+                q2 = q2 + ", ";
427
+                for(var i = 0; table.data(i, 1, 0).value != ""; i++)
428
+                {
429
+                        table.setData(i, 1, convertToPounds(parseFloat(table.data(i, 1, 0)), unitBox.currentText) ,32)
430
+                }
431
+                q2 = q2 + table.columnArray(1, 32);
432
+                q2 = q2 + ", ";
433
+                q2 = q2 + convertToPounds(parseFloat(green.text), unitBox.currentText);
434
+                q2 = q2 + ", ";
435
+                q2 = q2 + roasted.currentData();
436
+                q2 = q2 + ", ";
437
+                q2 = q2 + convertToPounds(parseFloat(roastwt.text), unitBox.currentText);
438
+                q2 = q2 + ", 'ROAST', :annotation, ";
439
+                q2 = q2 + selectedRoasterID;
440
+                q2 = q2 + ", :duration, :approval, NULL, NULL, NULL, NULL, '{";
441
+                q2 = q2 + fileno;
442
+                q2 = q2 + "}')";
443
+                query2 = new QSqlQuery();
444
+                query2.prepare(q2);
445
+                query2.bind(":time", timefield.text);
446
+                query2.bind(":annotation", notes.plainText);
447
+                query2.bind(":duration", duration.text);
448
+                query2.bind(":approval", approval.checked);
449
+                query2.exec();
369 450
                 query2 = query2.invalidate();
370
-				if(target.checked) {
371
-					var q3 = "INSERT INTO item_files (time, item, files) VALUES(:time, :item, '{";
372
-					q3 = q3 + fileno;
373
-					q3 = q3 + "}')";
374
-					query.prepare(q3);
375
-					query.bind(":time", timefield.text);
376
-					query.bind(":item", roasted.currentData());
377
-					query.exec();
378
-				}
451
+                if(target.checked) {
452
+                    var q3 = "INSERT INTO item_files (time, item, files) VALUES(:time, :item, '{";
453
+                    q3 = q3 + fileno;
454
+                    q3 = q3 + "}')";
455
+                    query.prepare(q3);
456
+                    query.bind(":time", timefield.text);
457
+                    query.bind(":item", roasted.currentData());
458
+                    query.exec();
459
+                }
379 460
                 query = query.invalidate();
380
-				batch.windowModified = false;
381
-				batch.close();
382
-			});
461
+                batch.windowModified = false;
462
+                batch.close();
463
+            });
383 464
         ]]>
384 465
     </program>
385 466
 </window>

Loading…
Cancel
Save