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
 	<reporttitle>Inventory:->Inventory Change Summary</reporttitle>
2
 	<reporttitle>Inventory:->Inventory Change Summary</reporttitle>
3
 	<layout type="vertical">
3
 	<layout type="vertical">
4
 		<layout type="horizontal">
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
 			<label>Weight Unit:</label>
6
 			<label>Weight Unit:</label>
10
 			<sqldrop id="unit" />
7
 			<sqldrop id="unit" />
11
 			<stretch />
8
 			<stretch />
18
 	<program>
15
 	<program>
19
 		<![CDATA[
16
 		<![CDATA[
20
 			this.windowTitle = "Typica - Inventory Change Summary";
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
 			var unitBox = findChildObject(this, 'unit');
19
 			var unitBox = findChildObject(this, 'unit');
25
 			unitBox.addItem("Kg");
20
 			unitBox.addItem("Kg");
26
 			unitBox.addItem("Lb");
21
 			unitBox.addItem("Lb");
46
 				output.writeTextElement("title", "Inventory Change Summary");
41
 				output.writeTextElement("title", "Inventory Change Summary");
47
 				output.writeEndElement();
42
 				output.writeEndElement();
48
 				output.writeStartElement("body");
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
 				output.writeTextElement("h1", "Inventory Change Summary: " + startDate + " – " + endDate);
47
 				output.writeTextElement("h1", "Inventory Change Summary: " + startDate + " – " + endDate);
52
 				var conversion = 1;
48
 				var conversion = 1;
53
 				if(unitBox.currentIndex == 0) {
49
 				if(unitBox.currentIndex == 0) {
206
 				query = query.invalidate();
202
 				query = query.invalidate();
207
 			}
203
 			}
208
 			refresh();
204
 			refresh();
209
-			startDateField.dateChanged.connect(function() {
210
-				refresh();
211
-			});
212
-			endDateField.dateChanged.connect(function() {
205
+			dateSelect.rangeUpdated.connect(function() {
213
 				refresh();
206
 				refresh();
214
 			});
207
 			});
215
 			view.scriptLinkClicked.connect(function(url) {
208
 			view.scriptLinkClicked.connect(function(url) {

Loading…
Cancel
Save