Browse Source

Use date range widget in Inventory Change Summary report.

Neal Wilson 11 years ago
parent
commit
2ae7447e78
1 changed files with 6 additions and 13 deletions
  1. 6
    13
      config/Reports/invchange.xml

+ 6
- 13
config/Reports/invchange.xml View File

@@ -2,10 +2,7 @@
2 2
 	<reporttitle>Inventory:->Inventory Change Summary</reporttitle>
3 3
 	<layout type="vertical">
4 4
 		<layout type="horizontal">
5
-			<label>Start Date:</label>
6
-			<calendar id="startdate" />
7
-			<label>End Date:</label>
8
-			<calendar id="enddate" />
5
+			<daterange id="dates" initial="19" /><!-- Current Year to Date-->
9 6
 			<label>Weight Unit:</label>
10 7
 			<sqldrop id="unit" />
11 8
 			<stretch />
@@ -18,9 +15,7 @@
18 15
 	<program>
19 16
 		<![CDATA[
20 17
 			this.windowTitle = "Typica - Inventory Change Summary";
21
-			var startDateField = findChildObject(this, 'startdate');
22
-			startDateField.setDate(startDateField.year(), 1, 1);
23
-			var endDateField = findChildObject(this, 'enddate');
18
+			var dateSelect = findChildObject(this, 'dates');
24 19
 			var unitBox = findChildObject(this, 'unit');
25 20
 			unitBox.addItem("Kg");
26 21
 			unitBox.addItem("Lb");
@@ -46,8 +41,9 @@
46 41
 				output.writeTextElement("title", "Inventory Change Summary");
47 42
 				output.writeEndElement();
48 43
 				output.writeStartElement("body");
49
-				var startDate = "" + startDateField.year() + "-" + startDateField.month() + "-" + startDateField.day();
50
-				var endDate = "" + endDateField.year() + "-" + endDateField.month() + "-" + endDateField.day();
44
+				var dateRange = dateSelect.currentRange();
45
+				var startDate = dateRange[0];
46
+				var endDate = dateRange[dateRange.length - 1];
51 47
 				output.writeTextElement("h1", "Inventory Change Summary: " + startDate + " – " + endDate);
52 48
 				var conversion = 1;
53 49
 				if(unitBox.currentIndex == 0) {
@@ -206,10 +202,7 @@
206 202
 				query = query.invalidate();
207 203
 			}
208 204
 			refresh();
209
-			startDateField.dateChanged.connect(function() {
210
-				refresh();
211
-			});
212
-			endDateField.dateChanged.connect(function() {
205
+			dateSelect.rangeUpdated.connect(function() {
213 206
 				refresh();
214 207
 			});
215 208
 			view.scriptLinkClicked.connect(function(url) {

Loading…
Cancel
Save