1 | DGENRPD1 ;ALB/CJM - Veterans with no Application and with a Future Appointment Report; 04/28/2004
|
---|
2 | ;;5.3;Registration;**147,568**;Aug 13,1993
|
---|
3 | ;
|
---|
4 | REPORT ;
|
---|
5 | N DGENRP
|
---|
6 | ;
|
---|
7 | ;Control variables used in generating report
|
---|
8 | ;DGENRP("BEGIN")=<begining of the date range for appt selection>
|
---|
9 | ;DGENRP("END")=<ending date of range>
|
---|
10 | ;DGENRP("ALL")=1 means to include all clinics for appt selection
|
---|
11 | ;DGENRP("DIVISION",<list of medical center Divisions to include>)=""
|
---|
12 | ;DGENRP("CLINIC",<list of clinics to include>)=""
|
---|
13 | ;DGENRP("JUSTONCE")=<1 means that if the patient has multiple appts to print only the first, 0 means print all the patient's appts>
|
---|
14 | ;
|
---|
15 | G:'$$ASKRANGE(.DGENRP) EXIT
|
---|
16 | G:'$$LOCATION(.DGENRP) EXIT
|
---|
17 | G:'$$JUSTONCE(.DGENRP) EXIT
|
---|
18 | ;
|
---|
19 | I $$DEVICE() D PRINT^DGENRPD2
|
---|
20 | EXIT ;
|
---|
21 | Q
|
---|
22 | ;
|
---|
23 | DEVICE() ;
|
---|
24 | ;Description: allows the user to select a device.
|
---|
25 | ;Input: none
|
---|
26 | ;
|
---|
27 | ;Output:
|
---|
28 | ; Function Value - Returns 0 if the user decides not to print or to
|
---|
29 | ; queue the report, 1 otherwise.
|
---|
30 | ;
|
---|
31 | N OK
|
---|
32 | S OK=1
|
---|
33 | S %ZIS="MQ"
|
---|
34 | W !,"*** This report requires a 132 column printer. ******"
|
---|
35 | D ^%ZIS
|
---|
36 | S:POP OK=0
|
---|
37 | D:OK&$D(IO("Q"))
|
---|
38 | .S ZTRTN="PRINT^DGENRPD2",ZTDESC="Future Appointments with No EnrollmentApplication REPORT",ZTSAVE("DGENRP(")=""
|
---|
39 | .D ^%ZTLOAD
|
---|
40 | .W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
|
---|
41 | .D HOME^%ZIS
|
---|
42 | .S OK=0
|
---|
43 | Q OK
|
---|
44 | ;
|
---|
45 | LOCATION(DGENRP) ;
|
---|
46 | ;Description: asks the user to select locations of future appointments
|
---|
47 | ;
|
---|
48 | ;Input: none
|
---|
49 | ;Output:
|
---|
50 | ; DGENRP - (pass by reference) used to return selected locations
|
---|
51 | ; Function Value: 0 on failure, 1 on success
|
---|
52 | ;
|
---|
53 | N DIR,SUCCESS
|
---|
54 | S SUCCESS=1
|
---|
55 | S DIR("B")="ALL"
|
---|
56 | S DIR(0)=$S($P($G(^DG(43,1,"GL")),"^",2):"S^A:All;D:by Division;C:by Clinic",1:"S^A:All;C:by Clinic")
|
---|
57 | S DIR("A")="How do you want to select the clinics to appear in the report? "
|
---|
58 | S DIR("?")="You have the choice of selecting all clinics, entire divisions, or individual clinics."
|
---|
59 | D ^DIR
|
---|
60 | I $D(DIRUT) D
|
---|
61 | .S SUCCESS=0
|
---|
62 | E D
|
---|
63 | .I Y="A" D
|
---|
64 | ..S DGENRP("ALL")=1
|
---|
65 | .E D
|
---|
66 | ..S DGENRP("ALL")=0
|
---|
67 | ..I Y="C" D
|
---|
68 | ...S SUCCESS=$$CLINIC(.DGENRP)
|
---|
69 | ..E D
|
---|
70 | ...I Y="D" S SUCCESS=$$DIVISION(.DGENRP)
|
---|
71 | ;
|
---|
72 | Q SUCCESS
|
---|
73 | ;
|
---|
74 | ASKRANGE(DGENRP) ;
|
---|
75 | ;Description: Asks the user to enter a date range begining no earlier
|
---|
76 | ;than the current date
|
---|
77 | ;
|
---|
78 | Q:'$$ASKBEGIN(.DGENRP) 0
|
---|
79 | Q:'$$ASKEND(.DGENRP) 0
|
---|
80 | Q 1
|
---|
81 | ;
|
---|
82 | ASKBEGIN(DGENRP) ;
|
---|
83 | ;Description: Asks the user to enter a beginning date.
|
---|
84 | ;
|
---|
85 | ;Input: none
|
---|
86 | ;
|
---|
87 | ;Output:
|
---|
88 | ; Function value=1 if user selected a date, 0 otherwise
|
---|
89 | ; DGENRP("BEGIN")=date selected
|
---|
90 | ;
|
---|
91 | N DIR,X,Y
|
---|
92 | S DIR(0)="D^::XO"
|
---|
93 | S DIR("A")="Enter beginning date for future appointments for."
|
---|
94 | S DIR("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,1),"D")
|
---|
95 | S DIR("?")="Enter the first day to list appointments."
|
---|
96 | REPEAT D ^DIR
|
---|
97 | Q:$D(DIRUT) 0
|
---|
98 | I Y'>DT W !,"Date must be later than today!" G REPEAT
|
---|
99 | S DGENRP("BEGIN")=Y
|
---|
100 | Q 1
|
---|
101 | ;
|
---|
102 | ASKEND(DGENRP) ;
|
---|
103 | ;Description: Asks the user to enter an end date.
|
---|
104 | ;
|
---|
105 | ;Input:
|
---|
106 | ; DGENRP("BEGIN") - the earliest possible date
|
---|
107 | ;
|
---|
108 | ;Output:
|
---|
109 | ; Function value=1 if user selected a date, 0 otherwise
|
---|
110 | ; DGENRP("END")=date selected
|
---|
111 | ;
|
---|
112 | N DIR,X,Y
|
---|
113 | S DIR(0)="D^::X"
|
---|
114 | S DIR("A")="Enter ending date"
|
---|
115 | S DIR("B")=$$FMTE^XLFDT(DGENRP("BEGIN"),"D")
|
---|
116 | S DIR("?")="Enter the last day to list appointments for."
|
---|
117 | AGAIN D ^DIR
|
---|
118 | Q:$D(DIRUT) 0
|
---|
119 | I (Y<$G(DGENRP("BEGIN"))) W !,"Date must be no earlier than "_DIR("B") G AGAIN
|
---|
120 | S DGENRP("END")=Y
|
---|
121 | Q 1
|
---|
122 | ;
|
---|
123 | DIVISION(DGENRP) ;
|
---|
124 | ;Description: asks divisions to include
|
---|
125 | ;
|
---|
126 | N DIR,QUIT,SUCCESS
|
---|
127 | S SUCCESS=1
|
---|
128 | S DIR(0)="PO^40.8:AEM"
|
---|
129 | S DIR("A")="Select the medical center divisions to include in the report"
|
---|
130 | S DIR("?")="Appointments will not be included in the report for divisions that you do not select."
|
---|
131 | S QUIT=0
|
---|
132 | F D Q:QUIT
|
---|
133 | .D ^DIR
|
---|
134 | .I $D(DUOUT)!$D(DTOUT) S QUIT=1,SUCCESS=0 Q
|
---|
135 | .I ((+Y)'>0) S QUIT=1 Q
|
---|
136 | .S DGENRP("DIVISION",+Y)=""
|
---|
137 | S:'$O(DGENRP("DIVISION",0)) SUCCESS=0
|
---|
138 | Q SUCCESS
|
---|
139 | ;
|
---|
140 | CLINIC(DGENRP) ;
|
---|
141 | ;Description: asks clinics to include
|
---|
142 | ;
|
---|
143 | N DIR,QUIT,SUCCESS
|
---|
144 | S SUCCESS=1
|
---|
145 | S DIR(0)="PO^44:AEM"
|
---|
146 | S DIR("A")="Select the clinics to include in the report"
|
---|
147 | S DIR("?")="Appointments will not be included in the report for clinics that you do not select."
|
---|
148 | S DIR("S")="I $P(^(0),""^"",3)=""C"""
|
---|
149 | S QUIT=0
|
---|
150 | F D Q:QUIT
|
---|
151 | .D ^DIR
|
---|
152 | .I $D(DUOUT)!$D(DTOUT) S QUIT=1,SUCCESS=0 Q
|
---|
153 | .I ((+Y)'>0) S QUIT=1 Q
|
---|
154 | .S DGENRP("CLINIC",+Y)=""
|
---|
155 | S:'$O(DGENRP("CLINIC",0)) SUCCESS=0
|
---|
156 | Q SUCCESS
|
---|
157 | ;
|
---|
158 | JUSTONCE(DGENRP) ;
|
---|
159 | ;Description: Asks wether or not to include only the first appointment
|
---|
160 | ;for a patient that has multiple appointments
|
---|
161 | ;
|
---|
162 | ;Output:
|
---|
163 | ; Function Value: reuturns 1 on success, 0 on failure
|
---|
164 | ; DGENRP("JUSTONCE")=<1 for only earliest, 0 for all>
|
---|
165 | ;
|
---|
166 | N DIR
|
---|
167 | S DGENRP("JUSTONCE")=0
|
---|
168 | S DIR(0)="Y"
|
---|
169 | S DIR("B")="NO"
|
---|
170 | S DIR("A")="For patients with multiple appointments, should only the first be listed"
|
---|
171 | D ^DIR
|
---|
172 | Q:$D(DIRUT) 0
|
---|
173 | I +Y=1 S DGENRP("JUSTONCE")=1
|
---|
174 | Q 1
|
---|