source: EDIS/trunk/java/tracking-ui-core/src/main/flex/gov/va/med/edp/view/reports/ReportControls.mxml@ 1227

Last change on this file since 1227 was 1227, checked in by George Lilly, 13 years ago

initial load of EDIS 1.0

File size: 10.6 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<mx:VBox
3 xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" xmlns:widget="gov.va.med.edp.widget.*" creationComplete="setDataProviderForReports()" verticalScrollPolicy="off" horizontalScrollPolicy="auto">
4
5 <mx:Script>
6 <![CDATA[
7 import gov.va.med.edp.widget.InfoDialog;
8 import gov.va.med.edp.util.ReportUtil;
9 import gov.va.med.edp.control.DateTimeEvent;
10 import gov.va.med.edp.vo.reports.ReportParamsVO;
11 import gov.va.med.edp.control.reports.ReportEvent;
12 import gov.va.med.edp.model.TrackingModelLocator;
13 import gov.va.med.edp.util.ChangeWatcher;
14 import gov.va.med.edp.util.AccessibilityTools;
15
16 [Bindable]
17 public var reportsDataProvider: Array = [ {label:"Activity Report", data:ReportEvent.EVENT_ACTIVITY_REPORT},
18 {label:"Acuity Report", data:ReportEvent.EVENT_ACUITY_REPORT},
19 {label:"Delay Report", data:ReportEvent.EVENT_DELAY_REPORT},
20 {label:"Delay Summary Rpt", data:ReportEvent.EVENT_SUMMARY_REPORT},
21 {label:"ED BVAC Patients", data:ReportEvent.EVENT_BVAC_REPORT},
22 {label:"Exposure Report", data:ReportEvent.EVENT_EXPOSURE_REPORT},
23 {label:"Missed Opportunities", data:ReportEvent.EVENT_MISSED_OP_REPORT},
24 {label:"Orders By Acuity", data:ReportEvent.EVENT_ORDERS_BY_ACUITY_REPORT},
25 {label:"Patient Intake Rpt", data:ReportEvent.EVENT_PATIENT_INTAKE_REPORT},
26 {label:"Shift Report", data:ReportEvent.EVENT_SHIFT_REPORT},
27 {label:"VA Admissions Rpt", data:ReportEvent.EVENT_VA_ADMISSIONS_REPORT}];
28
29 private function setDataProviderForReports(): void
30 {
31 if (model.session.showProviderReport){
32 reportsDataProvider.push({label:"Provider Report", data:ReportEvent.EVENT_PROVIDER_REPORT});
33 }
34 if (model.session.showPatientCrossReferenceReport){
35 reportsDataProvider.push({label:"Patient xRef Report", data:ReportEvent.EVENT_PATIENT_XREF_REPORT});
36 }
37
38 reportsDataProvider.sortOn("label", Array.CASEINSENSITIVE);
39 report.rowCount = reportsDataProvider.length;
40 }
41
42
43 [Bindable]
44 private var model: TrackingModelLocator = TrackingModelLocator.getInstance();
45
46 private function areDatesCorrect(): Boolean
47 {
48 //Make sure start and end dates are valid..
49 if (startTS._selectedDate == null || endTS._selectedDate == null)
50 {
51 InfoDialog.show("Please enter valid date ranges.", "Invalid Dates", false, startTS.dateInput);
52 clearDisplayArea();
53 return false;
54 }
55 //Make sure start date is less than end date
56 if (startTS._selectedDate > endTS._selectedDate)
57 {
58 InfoDialog.show("Start date cannot be later than stop date.","Invalid Dates", false, startTS.dateInput);
59 clearDisplayArea();
60 return false;
61 }
62 return true;
63 }
64
65
66 private function setCorrectState(): void
67 {
68 if (report.selectedItem.data == ReportEvent.EVENT_EXPOSURE_REPORT)
69 {
70 currentState = "exposureRptState";
71 }
72 else if (report.selectedItem.data == ReportEvent.EVENT_SHIFT_REPORT)
73 {
74 currentState = "shiftRptState";
75 }
76 else
77 {
78 currentState = "";
79 }
80 }
81
82
83 private function clearDisplayArea(): void
84 {
85 model.reports.clearDisplayArea = false;
86 model.reports.clearDisplayArea = true;
87 }
88
89
90 private function displayReport(buttonClicked: Boolean): void
91 {
92 var reportEvent: ReportEvent;
93 var reportParams: ReportParamsVO = new ReportParamsVO();
94
95 switch (report.selectedItem.data){
96 case ReportEvent.EVENT_ACTIVITY_REPORT:
97 reportEvent = new ReportEvent(ReportEvent.EVENT_ACTIVITY_REPORT);
98 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
99 break;
100 case ReportEvent.EVENT_ACUITY_REPORT:
101 reportEvent = new ReportEvent(ReportEvent.EVENT_ACUITY_REPORT);
102 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
103 break;
104 case ReportEvent.EVENT_DELAY_REPORT:
105 reportEvent = new ReportEvent(ReportEvent.EVENT_DELAY_REPORT);
106 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
107 break;
108 case ReportEvent.EVENT_EXPOSURE_REPORT:
109 reportEvent = new ReportEvent(ReportEvent.EVENT_EXPOSURE_REPORT);
110 displayExposureReport(reportEvent, reportParams, buttonClicked);
111 break;
112 case ReportEvent.EVENT_MISSED_OP_REPORT:
113 reportEvent = new ReportEvent(ReportEvent.EVENT_MISSED_OP_REPORT);
114 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
115 break;
116 case ReportEvent.EVENT_PATIENT_INTAKE_REPORT:
117 reportEvent = new ReportEvent(ReportEvent.EVENT_PATIENT_INTAKE_REPORT);
118 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
119 break;
120 case ReportEvent.EVENT_PROVIDER_REPORT:
121 reportEvent = new ReportEvent(ReportEvent.EVENT_PROVIDER_REPORT);
122 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
123 break;
124 case ReportEvent.EVENT_SHIFT_REPORT:
125 reportEvent = new ReportEvent(ReportEvent.EVENT_SHIFT_REPORT);
126 displayShiftReport(reportEvent, reportParams, buttonClicked);
127 break;
128 case ReportEvent.EVENT_SUMMARY_REPORT:
129 reportEvent = new ReportEvent(ReportEvent.EVENT_SUMMARY_REPORT);
130 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
131 break;
132 case ReportEvent.EVENT_PATIENT_XREF_REPORT:
133 reportEvent = new ReportEvent(ReportEvent.EVENT_PATIENT_XREF_REPORT);
134 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
135 break;
136 case ReportEvent.EVENT_VA_ADMISSIONS_REPORT:
137 reportEvent = new ReportEvent(ReportEvent.EVENT_VA_ADMISSIONS_REPORT);
138 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
139 break;
140 case ReportEvent.EVENT_BVAC_REPORT:
141 reportEvent = new ReportEvent(ReportEvent.EVENT_BVAC_REPORT);
142 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
143 break;
144 case ReportEvent.EVENT_ORDERS_BY_ACUITY_REPORT:
145 reportEvent = new ReportEvent(ReportEvent.EVENT_ORDERS_BY_ACUITY_REPORT);
146 displayAllOtherReports(reportEvent, reportParams, buttonClicked);
147 break;
148 default:
149 break;
150 }
151
152 }
153
154 private function displayExposureReport(reportEvent:ReportEvent, reportParams:ReportParamsVO, buttonClicked: Boolean): void
155 {
156 setCorrectState();
157 clearDisplayArea();
158
159 if (buttonClicked)
160 {
161 if (visitIEN.text == "")
162 {
163 InfoDialog.show("Please enter a visit IEN.", "Invalid IEN", false, visitIEN);
164 return;
165 }
166
167 } else
168 {
169 if (visitIEN.text == "")
170 {
171 return;
172 }
173 }
174
175 reportParams.id = visitIEN.text;
176 reportEvent.reportParams = reportParams;
177 reportEvent.dispatch();
178
179 }
180
181
182 private function displayShiftReport(reportEvent:ReportEvent, reportParams:ReportParamsVO, buttonClicked: Boolean): void
183 {
184 setCorrectState();
185 clearDisplayArea();
186 var correctDates: Boolean = true;
187 if (buttonClicked)
188 {
189 if (startTS._selectedDate == null)
190 {
191 InfoDialog.show("Please enter a valid start date.", "Invalid Dates", false, startTS.dateInput);
192 correctDates = false;
193 }
194
195 } else
196 {
197 if (startTS._selectedDate == null)
198 {
199 return;
200 }
201 }
202
203 if (correctDates)
204 {
205 reportParams.startDate = startTS._selectedDate;
206 reportParams.stopDate = ReportUtil.calculateEndTimeForShiftReport(startTS._selectedDate);
207 reportEvent.reportParams = reportParams;
208 reportEvent.dispatch();
209 }
210 }
211
212
213 private function displayAllOtherReports(reportEvent:ReportEvent, reportParams:ReportParamsVO, buttonClicked: Boolean): void
214 {
215 setCorrectState();
216 clearDisplayArea();
217 var correctDates: Boolean = true;
218 if (buttonClicked)
219 {
220 correctDates = areDatesCorrect();
221
222 } else
223 {
224 if (startTS._selectedDate == null || endTS._selectedDate == null)
225 {
226 return;
227 }
228 }
229
230 if (correctDates)
231 {
232 reportParams.startDate = startTS._selectedDate;
233 reportParams.stopDate = endTS._selectedDate;
234 reportEvent.reportParams = reportParams;
235 reportEvent.dispatch();
236 }
237 }
238
239
240 ]]>
241 </mx:Script>
242
243 <mx:HBox width="100%" height="100%" id="reportControlsBox">
244 <mx:FormItem label="Report" styleName="reportLabel" >
245 <mx:ComboBox
246 id="report"
247 initialize="{AccessibilityTools.accessComponentName(report,'Select type to be displayed.')}"
248 dataProvider="{reportsDataProvider}"
249 selectedIndex="0"
250 change="displayReport(false)"
251 width="152"
252 styleName="formField"
253 tabIndex="1001"/>
254 </mx:FormItem>
255 <mx:VRule height="{report.height}" strokeWidth="3" id="reportComboSpacer" />
256
257 <mx:HBox id="dateControlsBox">
258 <mx:FormItem label="Start Date" styleName="reportLabel">
259 <!-- DateTimeChooser eats 4 tabIndices (one for each of its sub controls) -->
260 <widget:DateTimeChooser
261 id="startTS"
262 tabIndexBase="1002"
263 dateType="start"
264 initialize="{AccessibilityTools.accessComponentName(startTS,'Start time')}" />
265 </mx:FormItem>
266 <mx:VRule height="{report.height}" strokeWidth="3"/>
267
268 <mx:HBox id="stopDateBox">
269 <mx:FormItem label="Stop Date" styleName="reportLabel">
270 <!-- DateTimeChooser eats 4 tabIndices (one for each of its sub controls) -->
271 <widget:DateTimeChooser
272 id="endTS"
273 dateType="stop"
274 tabIndexBase="1006"
275 initialize="{AccessibilityTools.accessComponentName(endTS,'Stop time')}"/>
276 </mx:FormItem>
277 <mx:VRule height="{report.height}" strokeWidth="3"/>
278 </mx:HBox>
279 </mx:HBox>
280 <mx:Button label="Run Report" id="btnRunReport" click="displayReport(true)" tabIndex="1010"/>
281 </mx:HBox>
282
283
284 <mx:NumberValidator source="{visitIEN}" property="text"/>
285
286 <mx:states>
287 <mx:State name="exposureRptState">
288 <mx:RemoveChild target="{dateControlsBox}"/>
289 <mx:AddChild relativeTo="{reportComboSpacer}" position="after">
290 <mx:target>
291 <mx:HBox id="visitIENBox">
292 <mx:Label text="visit IEN" styleName="reportLabel"/>
293 <mx:TextInput id="visitIEN" tabIndex="1009"/>
294 <mx:VRule height="{report.height}" strokeWidth="3"/>
295 </mx:HBox>
296 </mx:target>
297 </mx:AddChild>
298 </mx:State>
299 <mx:State name="shiftRptState">
300 <mx:RemoveChild target="{stopDateBox}"/>
301 </mx:State>
302 </mx:states>
303
304
305</mx:VBox>
306
Note: See TracBrowser for help on using the repository browser.