DGENRPD1 ;ALB/CJM - Veterans with no Application and with a Future Appointment Report; 04/28/2004
;;5.3;Registration;**147,568**;Aug 13,1993
;
REPORT ;
N DGENRP
;
;Control variables used in generating report
;DGENRP("BEGIN")=<begining of the date range for appt selection>
;DGENRP("END")=<ending date of range>
;DGENRP("ALL")=1 means to include all clinics for appt selection
;DGENRP("DIVISION",<list of medical center Divisions to include>)=""
;DGENRP("CLINIC",<list of clinics to include>)=""
;DGENRP("JUSTONCE")=<1 means that if the patient has multiple appts to print only the first, 0 means print all the patient's appts>
;
G:'$$ASKRANGE(.DGENRP) EXIT
G:'$$LOCATION(.DGENRP) EXIT
G:'$$JUSTONCE(.DGENRP) EXIT
;
I $$DEVICE() D PRINT^DGENRPD2
EXIT ;
Q
;
DEVICE() ;
;Description: allows the user to select a device.
;Input: none
;
;Output:
; Function Value - Returns 0 if the user decides not to print or to
; queue the report, 1 otherwise.
;
N OK
S OK=1
S %ZIS="MQ"
W !,"*** This report requires a 132 column printer. ******"
D ^%ZIS
S:POP OK=0
D:OK&$D(IO("Q"))
.S ZTRTN="PRINT^DGENRPD2",ZTDESC="Future Appointments with No EnrollmentApplication REPORT",ZTSAVE("DGENRP(")=""
.D ^%ZTLOAD
.W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
.D HOME^%ZIS
.S OK=0
Q OK
;
LOCATION(DGENRP) ;
;Description: asks the user to select locations of future appointments
;
;Input: none
;Output:
; DGENRP - (pass by reference) used to return selected locations
; Function Value: 0 on failure, 1 on success
;
N DIR,SUCCESS
S SUCCESS=1
S DIR("B")="ALL"
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")
S DIR("A")="How do you want to select the clinics to appear in the report? "
S DIR("?")="You have the choice of selecting all clinics, entire divisions, or individual clinics."
D ^DIR
I $D(DIRUT) D
.S SUCCESS=0
E D
.I Y="A" D
..S DGENRP("ALL")=1
.E D
..S DGENRP("ALL")=0
..I Y="C" D
...S SUCCESS=$$CLINIC(.DGENRP)
..E D
...I Y="D" S SUCCESS=$$DIVISION(.DGENRP)
;
Q SUCCESS
;
ASKRANGE(DGENRP) ;
;Description: Asks the user to enter a date range begining no earlier
;than the current date
;
Q:'$$ASKBEGIN(.DGENRP) 0
Q:'$$ASKEND(.DGENRP) 0
Q 1
;
ASKBEGIN(DGENRP) ;
;Description: Asks the user to enter a beginning date.
;
;Input: none
;
;Output:
; Function value=1 if user selected a date, 0 otherwise
; DGENRP("BEGIN")=date selected
;
N DIR,X,Y
S DIR(0)="D^::XO"
S DIR("A")="Enter beginning date for future appointments for."
S DIR("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,1),"D")
S DIR("?")="Enter the first day to list appointments."
REPEAT D ^DIR
Q:$D(DIRUT) 0
I Y'>DT W !,"Date must be later than today!" G REPEAT
S DGENRP("BEGIN")=Y
Q 1
;
ASKEND(DGENRP) ;
;Description: Asks the user to enter an end date.
;
;Input:
; DGENRP("BEGIN") - the earliest possible date
;
;Output:
; Function value=1 if user selected a date, 0 otherwise
; DGENRP("END")=date selected
;
N DIR,X,Y
S DIR(0)="D^::X"
S DIR("A")="Enter ending date"
S DIR("B")=$$FMTE^XLFDT(DGENRP("BEGIN"),"D")
S DIR("?")="Enter the last day to list appointments for."
AGAIN D ^DIR
Q:$D(DIRUT) 0
I (Y<$G(DGENRP("BEGIN"))) W !,"Date must be no earlier than "_DIR("B") G AGAIN
S DGENRP("END")=Y
Q 1
;
DIVISION(DGENRP) ;
;Description: asks divisions to include
;
N DIR,QUIT,SUCCESS
S SUCCESS=1
S DIR(0)="PO^40.8:AEM"
S DIR("A")="Select the medical center divisions to include in the report"
S DIR("?")="Appointments will not be included in the report for divisions that you do not select."
S QUIT=0
F D Q:QUIT
.D ^DIR
.I $D(DUOUT)!$D(DTOUT) S QUIT=1,SUCCESS=0 Q
.I ((+Y)'>0) S QUIT=1 Q
.S DGENRP("DIVISION",+Y)=""
S:'$O(DGENRP("DIVISION",0)) SUCCESS=0
Q SUCCESS
;
CLINIC(DGENRP) ;
;Description: asks clinics to include
;
N DIR,QUIT,SUCCESS
S SUCCESS=1
S DIR(0)="PO^44:AEM"
S DIR("A")="Select the clinics to include in the report"
S DIR("?")="Appointments will not be included in the report for clinics that you do not select."
S DIR("S")="I $P(^(0),""^"",3)=""C"""
S QUIT=0
F D Q:QUIT
.D ^DIR
.I $D(DUOUT)!$D(DTOUT) S QUIT=1,SUCCESS=0 Q
.I ((+Y)'>0) S QUIT=1 Q
.S DGENRP("CLINIC",+Y)=""
S:'$O(DGENRP("CLINIC",0)) SUCCESS=0
Q SUCCESS
;
JUSTONCE(DGENRP) ;
;Description: Asks wether or not to include only the first appointment
;for a patient that has multiple appointments
;
;Output:
; Function Value: reuturns 1 on success, 0 on failure
; DGENRP("JUSTONCE")=<1 for only earliest, 0 for all>
;
N DIR
S DGENRP("JUSTONCE")=0
S DIR(0)="Y"
S DIR("B")="NO"
S DIR("A")="For patients with multiple appointments, should only the first be listed"
D ^DIR
Q:$D(DIRUT) 0
I +Y=1 S DGENRP("JUSTONCE")=1
Q 1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGENRPD1 4953 printed Oct 16, 2024@18:43:43 Page 2
DGENRPD1 ;ALB/CJM - Veterans with no Application and with a Future Appointment Report; 04/28/2004
+1 ;;5.3;Registration;**147,568**;Aug 13,1993
+2 ;
REPORT ;
+1 NEW DGENRP
+2 ;
+3 ;Control variables used in generating report
+4 ;DGENRP("BEGIN")=<begining of the date range for appt selection>
+5 ;DGENRP("END")=<ending date of range>
+6 ;DGENRP("ALL")=1 means to include all clinics for appt selection
+7 ;DGENRP("DIVISION",<list of medical center Divisions to include>)=""
+8 ;DGENRP("CLINIC",<list of clinics to include>)=""
+9 ;DGENRP("JUSTONCE")=<1 means that if the patient has multiple appts to print only the first, 0 means print all the patient's appts>
+10 ;
+11 if '$$ASKRANGE(.DGENRP)
GOTO EXIT
+12 if '$$LOCATION(.DGENRP)
GOTO EXIT
+13 if '$$JUSTONCE(.DGENRP)
GOTO EXIT
+14 ;
+15 IF $$DEVICE()
DO PRINT^DGENRPD2
EXIT ;
+1 QUIT
+2 ;
DEVICE() ;
+1 ;Description: allows the user to select a device.
+2 ;Input: none
+3 ;
+4 ;Output:
+5 ; Function Value - Returns 0 if the user decides not to print or to
+6 ; queue the report, 1 otherwise.
+7 ;
+8 NEW OK
+9 SET OK=1
+10 SET %ZIS="MQ"
+11 WRITE !,"*** This report requires a 132 column printer. ******"
+12 DO ^%ZIS
+13 if POP
SET OK=0
+14 if OK&$DATA(IO("Q"))
Begin DoDot:1
+15 SET ZTRTN="PRINT^DGENRPD2"
SET ZTDESC="Future Appointments with No EnrollmentApplication REPORT"
SET ZTSAVE("DGENRP(")=""
+16 DO ^%ZTLOAD
+17 WRITE !,$SELECT($DATA(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
+18 DO HOME^%ZIS
+19 SET OK=0
End DoDot:1
+20 QUIT OK
+21 ;
LOCATION(DGENRP) ;
+1 ;Description: asks the user to select locations of future appointments
+2 ;
+3 ;Input: none
+4 ;Output:
+5 ; DGENRP - (pass by reference) used to return selected locations
+6 ; Function Value: 0 on failure, 1 on success
+7 ;
+8 NEW DIR,SUCCESS
+9 SET SUCCESS=1
+10 SET DIR("B")="ALL"
+11 SET DIR(0)=$SELECT($PIECE($GET(^DG(43,1,"GL")),"^",2):"S^A:All;D:by Division;C:by Clinic",1:"S^A:All;C:by Clinic")
+12 SET DIR("A")="How do you want to select the clinics to appear in the report? "
+13 SET DIR("?")="You have the choice of selecting all clinics, entire divisions, or individual clinics."
+14 DO ^DIR
+15 IF $DATA(DIRUT)
Begin DoDot:1
+16 SET SUCCESS=0
End DoDot:1
+17 IF '$TEST
Begin DoDot:1
+18 IF Y="A"
Begin DoDot:2
+19 SET DGENRP("ALL")=1
End DoDot:2
+20 IF '$TEST
Begin DoDot:2
+21 SET DGENRP("ALL")=0
+22 IF Y="C"
Begin DoDot:3
+23 SET SUCCESS=$$CLINIC(.DGENRP)
End DoDot:3
+24 IF '$TEST
Begin DoDot:3
+25 IF Y="D"
SET SUCCESS=$$DIVISION(.DGENRP)
End DoDot:3
End DoDot:2
End DoDot:1
+26 ;
+27 QUIT SUCCESS
+28 ;
ASKRANGE(DGENRP) ;
+1 ;Description: Asks the user to enter a date range begining no earlier
+2 ;than the current date
+3 ;
+4 if '$$ASKBEGIN(.DGENRP)
QUIT 0
+5 if '$$ASKEND(.DGENRP)
QUIT 0
+6 QUIT 1
+7 ;
ASKBEGIN(DGENRP) ;
+1 ;Description: Asks the user to enter a beginning date.
+2 ;
+3 ;Input: none
+4 ;
+5 ;Output:
+6 ; Function value=1 if user selected a date, 0 otherwise
+7 ; DGENRP("BEGIN")=date selected
+8 ;
+9 NEW DIR,X,Y
+10 SET DIR(0)="D^::XO"
+11 SET DIR("A")="Enter beginning date for future appointments for."
+12 SET DIR("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,1),"D")
+13 SET DIR("?")="Enter the first day to list appointments."
REPEAT DO ^DIR
+1 if $DATA(DIRUT)
QUIT 0
+2 IF Y'>DT
WRITE !,"Date must be later than today!"
GOTO REPEAT
+3 SET DGENRP("BEGIN")=Y
+4 QUIT 1
+5 ;
ASKEND(DGENRP) ;
+1 ;Description: Asks the user to enter an end date.
+2 ;
+3 ;Input:
+4 ; DGENRP("BEGIN") - the earliest possible date
+5 ;
+6 ;Output:
+7 ; Function value=1 if user selected a date, 0 otherwise
+8 ; DGENRP("END")=date selected
+9 ;
+10 NEW DIR,X,Y
+11 SET DIR(0)="D^::X"
+12 SET DIR("A")="Enter ending date"
+13 SET DIR("B")=$$FMTE^XLFDT(DGENRP("BEGIN"),"D")
+14 SET DIR("?")="Enter the last day to list appointments for."
AGAIN DO ^DIR
+1 if $DATA(DIRUT)
QUIT 0
+2 IF (Y<$GET(DGENRP("BEGIN")))
WRITE !,"Date must be no earlier than "_DIR("B")
GOTO AGAIN
+3 SET DGENRP("END")=Y
+4 QUIT 1
+5 ;
DIVISION(DGENRP) ;
+1 ;Description: asks divisions to include
+2 ;
+3 NEW DIR,QUIT,SUCCESS
+4 SET SUCCESS=1
+5 SET DIR(0)="PO^40.8:AEM"
+6 SET DIR("A")="Select the medical center divisions to include in the report"
+7 SET DIR("?")="Appointments will not be included in the report for divisions that you do not select."
+8 SET QUIT=0
+9 FOR
Begin DoDot:1
+10 DO ^DIR
+11 IF $DATA(DUOUT)!$DATA(DTOUT)
SET QUIT=1
SET SUCCESS=0
QUIT
+12 IF ((+Y)'>0)
SET QUIT=1
QUIT
+13 SET DGENRP("DIVISION",+Y)=""
End DoDot:1
if QUIT
QUIT
+14 if '$ORDER(DGENRP("DIVISION",0))
SET SUCCESS=0
+15 QUIT SUCCESS
+16 ;
CLINIC(DGENRP) ;
+1 ;Description: asks clinics to include
+2 ;
+3 NEW DIR,QUIT,SUCCESS
+4 SET SUCCESS=1
+5 SET DIR(0)="PO^44:AEM"
+6 SET DIR("A")="Select the clinics to include in the report"
+7 SET DIR("?")="Appointments will not be included in the report for clinics that you do not select."
+8 SET DIR("S")="I $P(^(0),""^"",3)=""C"""
+9 SET QUIT=0
+10 FOR
Begin DoDot:1
+11 DO ^DIR
+12 IF $DATA(DUOUT)!$DATA(DTOUT)
SET QUIT=1
SET SUCCESS=0
QUIT
+13 IF ((+Y)'>0)
SET QUIT=1
QUIT
+14 SET DGENRP("CLINIC",+Y)=""
End DoDot:1
if QUIT
QUIT
+15 if '$ORDER(DGENRP("CLINIC",0))
SET SUCCESS=0
+16 QUIT SUCCESS
+17 ;
JUSTONCE(DGENRP) ;
+1 ;Description: Asks wether or not to include only the first appointment
+2 ;for a patient that has multiple appointments
+3 ;
+4 ;Output:
+5 ; Function Value: reuturns 1 on success, 0 on failure
+6 ; DGENRP("JUSTONCE")=<1 for only earliest, 0 for all>
+7 ;
+8 NEW DIR
+9 SET DGENRP("JUSTONCE")=0
+10 SET DIR(0)="Y"
+11 SET DIR("B")="NO"
+12 SET DIR("A")="For patients with multiple appointments, should only the first be listed"
+13 DO ^DIR
+14 if $DATA(DIRUT)
QUIT 0
+15 IF +Y=1
SET DGENRP("JUSTONCE")=1
+16 QUIT 1