Browse Source

Support lifetime range in inventory change summary report.

Neal Wilson 10 years ago
parent
commit
ba9cb94495
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      config/Reports/invchange.xml

+ 12
- 0
config/Reports/invchange.xml View File

@@ -16,6 +16,18 @@
16 16
 		<![CDATA[
17 17
 			this.windowTitle = "Typica - Inventory Change Summary";
18 18
 			var dateSelect = findChildObject(this, 'dates');
19
+			var dateQuery = new QSqlQuery();
20
+			dateQuery.exec("SELECT time::date FROM transactions WHERE time = (SELECT min(time) FROM transactions) OR time = (SELECT max(time) FROM transactions) ORDER BY time ASC");
21
+			dateQuery.next();
22
+			var lifetimeStartDate = dateQuery.value(0);
23
+			var lifetimeEndDate;
24
+			if(dateQuery.next()) {
25
+				lifetimeEndDate = dateQuery.value(0);
26
+			} else {
27
+				lifetimeEndDate = lifetimeStartDate;
28
+			}
29
+			dateSelect.setLifetimeRange(lifetimeStartDate, lifetimeEndDate);
30
+			dateQuery = dateQuery.invalidate();
19 31
 			var unitBox = findChildObject(this, 'unit');
20 32
 			unitBox.addItem("Kg");
21 33
 			unitBox.addItem("Lb");

Loading…
Cancel
Save