DGENRPC1 ;ALB/CJM - Enrollees by Status, Priority, Preferred Facility Report; May 12, 1999
;;5.3;Registration;**147,232**;Aug 13,1993
;
REPORT ;
N DGENRP,DGENFLG
;
;Control variables used in generating report
;DGENRP("LIST")=1 if patients should be listed
;DGENRP("PRIORITY",<priority to include>)=""
;DGENRP("PRIORITY","ALL")=1 means to include all
;DGENRP("STATUS",<status to include>)=""
;DGENRP("STATUS","ALL")=1 means to include all
;DGENRP("FACILITY",<preferred facility to include>)=""
;DGENRP("FACILITY","ALL")=1 means to include all
;
G:'$$ASKINST(.DGENRP) EXIT
;
G:'$$ASKLIST(.DGENRP) EXIT
I DGENRP("LIST") D G:'DGENFLG EXIT
.S DGENFLG=$$ASKSTATS(.DGENRP) Q:'DGENFLG
.S DGENFLG=$$ASKPRTY(.DGENRP)
;
;
I $$DEVICE() D PRINT^DGENRPC2
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^DGENRPC2",ZTDESC="Enrollments by Status, Priority, Preferred Facility REPORT",ZTSAVE("DGENRP(")=""
.D ^%ZTLOAD
.W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
.D HOME^%ZIS
.S OK=0
Q OK
;
ASKLIST(DGENRP) ;
;Description: Asks user if he wants patient listing and sets to DGENRP("LIST")
;
;Outpu: Function returns 1 on success, 0 on failure (i.e., user "^" out)
;
N DIR
S DGENRP("LIST")=0
S DIR(0)="Y"
S DIR("A")="Do you want a list of selected patients"
S DIR("?")="Answer NO if you just want the summary statistics."
S DIR("B")="NO"
D ^DIR
I $D(DIRUT) Q 0
S DGENRP("LIST")=Y
Q 1
;
ASKSTATS(DGENRP) ;
;Description: ask status codes to include
;
N DIR
S DGENRP("STATUS","ALL")=0
S DIR(0)="Y"
S DIR("A")="Do you want to include all Enrollment Statuses in the patient listing"
S DIR("?")="Answer NO if the report should include only selected Enrollment Statuses."
S DIR("B")="NO"
D ^DIR
I $D(DIRUT) Q 0
I Y S DGENRP("STATUS","ALL")=1 Q 1
F Q:'$$STATUS(.DGENRP)
I '$O(DGENRP("STATUS",0)) Q 0
Q 1
;
STATUS(DGENRP) ;
;Description: Ask user to select a status code
N DIR
S DIR(0)="27.11,.04O"
D ^DIR
Q:$D(DIRUT) 0
S DGENRP("STATUS",+Y)=""
Q 1
;
ASKPRTY(DGENRP) ;
;Description: ask enrollment priorities to include
;
N DIR
S DGENRP("PRIORITY","ALL")=0
S DIR(0)="Y"
S DIR("A")="Do you want to include all Enrollment Priorities in the patient listing"
S DIR("?")="Answer NO if the report should inlclude only selected Enrollment Priorities."
S DIR("B")="NO"
D ^DIR
I $D(DIRUT) Q 0
I Y S DGENRP("PRIORITY","ALL")=1 Q 1
F Q:'$$PRIORITY(.DGENRP)
I '$O(DGENRP("PRIORITY",0)) Q 0
Q 1
;
;
PRIORITY(DGENRP) ;
;Description: Asks user to select an Enrollment Priority
N DIR
S DIR(0)="27.11,.07O"
D ^DIR
Q:$D(DIRUT) 0
S DGENRP("PRIORITY",Y)=""
Q 1
;
ASKINST(DGENRP) ;
;Description: ask preferred facilities to include
;
N DIR
S DGENRP("FACILITY","ALL")=0
S DIR(0)="Y"
S DIR("A")="Do you want to include all Preferred Facilities"
S DIR("?")="Answer NO if you want all enrollments found regardless of when the patient's Preferred Facility."
S DIR("B")="NO"
D ^DIR
I $D(DIRUT) Q 0
I Y S DGENRP("FACILITY","ALL")=1 Q 1
F Q:'$$FACILITY
I '$O(DGENRP("FACILITY",0)) Q 0
Q 1
;
;
FACILITY() ;
;Description: Asks user to select an institution
N DIR
S DIR(0)="PO^4:AEM"
S DIR("A")="Preferred Facility"
S DIR("?")="Selection of Preferred Facilities to include is made from the Institution file."
D ^DIR
Q:$D(DIRUT) 0
S:+Y DGENRP("FACILITY",+Y)=""
Q 1
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGENRPC1 3803 printed Nov 22, 2024@17:53:01 Page 2
DGENRPC1 ;ALB/CJM - Enrollees by Status, Priority, Preferred Facility Report; May 12, 1999
+1 ;;5.3;Registration;**147,232**;Aug 13,1993
+2 ;
REPORT ;
+1 NEW DGENRP,DGENFLG
+2 ;
+3 ;Control variables used in generating report
+4 ;DGENRP("LIST")=1 if patients should be listed
+5 ;DGENRP("PRIORITY",<priority to include>)=""
+6 ;DGENRP("PRIORITY","ALL")=1 means to include all
+7 ;DGENRP("STATUS",<status to include>)=""
+8 ;DGENRP("STATUS","ALL")=1 means to include all
+9 ;DGENRP("FACILITY",<preferred facility to include>)=""
+10 ;DGENRP("FACILITY","ALL")=1 means to include all
+11 ;
+12 if '$$ASKINST(.DGENRP)
GOTO EXIT
+13 ;
+14 if '$$ASKLIST(.DGENRP)
GOTO EXIT
+15 IF DGENRP("LIST")
Begin DoDot:1
+16 SET DGENFLG=$$ASKSTATS(.DGENRP)
if 'DGENFLG
QUIT
+17 SET DGENFLG=$$ASKPRTY(.DGENRP)
End DoDot:1
if 'DGENFLG
GOTO EXIT
+18 ;
+19 ;
+20 IF $$DEVICE()
DO PRINT^DGENRPC2
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^DGENRPC2"
SET ZTDESC="Enrollments by Status, Priority, Preferred Facility 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 ;
ASKLIST(DGENRP) ;
+1 ;Description: Asks user if he wants patient listing and sets to DGENRP("LIST")
+2 ;
+3 ;Outpu: Function returns 1 on success, 0 on failure (i.e., user "^" out)
+4 ;
+5 NEW DIR
+6 SET DGENRP("LIST")=0
+7 SET DIR(0)="Y"
+8 SET DIR("A")="Do you want a list of selected patients"
+9 SET DIR("?")="Answer NO if you just want the summary statistics."
+10 SET DIR("B")="NO"
+11 DO ^DIR
+12 IF $DATA(DIRUT)
QUIT 0
+13 SET DGENRP("LIST")=Y
+14 QUIT 1
+15 ;
ASKSTATS(DGENRP) ;
+1 ;Description: ask status codes to include
+2 ;
+3 NEW DIR
+4 SET DGENRP("STATUS","ALL")=0
+5 SET DIR(0)="Y"
+6 SET DIR("A")="Do you want to include all Enrollment Statuses in the patient listing"
+7 SET DIR("?")="Answer NO if the report should include only selected Enrollment Statuses."
+8 SET DIR("B")="NO"
+9 DO ^DIR
+10 IF $DATA(DIRUT)
QUIT 0
+11 IF Y
SET DGENRP("STATUS","ALL")=1
QUIT 1
+12 FOR
if '$$STATUS(.DGENRP)
QUIT
+13 IF '$ORDER(DGENRP("STATUS",0))
QUIT 0
+14 QUIT 1
+15 ;
STATUS(DGENRP) ;
+1 ;Description: Ask user to select a status code
+2 NEW DIR
+3 SET DIR(0)="27.11,.04O"
+4 DO ^DIR
+5 if $DATA(DIRUT)
QUIT 0
+6 SET DGENRP("STATUS",+Y)=""
+7 QUIT 1
+8 ;
ASKPRTY(DGENRP) ;
+1 ;Description: ask enrollment priorities to include
+2 ;
+3 NEW DIR
+4 SET DGENRP("PRIORITY","ALL")=0
+5 SET DIR(0)="Y"
+6 SET DIR("A")="Do you want to include all Enrollment Priorities in the patient listing"
+7 SET DIR("?")="Answer NO if the report should inlclude only selected Enrollment Priorities."
+8 SET DIR("B")="NO"
+9 DO ^DIR
+10 IF $DATA(DIRUT)
QUIT 0
+11 IF Y
SET DGENRP("PRIORITY","ALL")=1
QUIT 1
+12 FOR
if '$$PRIORITY(.DGENRP)
QUIT
+13 IF '$ORDER(DGENRP("PRIORITY",0))
QUIT 0
+14 QUIT 1
+15 ;
+16 ;
PRIORITY(DGENRP) ;
+1 ;Description: Asks user to select an Enrollment Priority
+2 NEW DIR
+3 SET DIR(0)="27.11,.07O"
+4 DO ^DIR
+5 if $DATA(DIRUT)
QUIT 0
+6 SET DGENRP("PRIORITY",Y)=""
+7 QUIT 1
+8 ;
ASKINST(DGENRP) ;
+1 ;Description: ask preferred facilities to include
+2 ;
+3 NEW DIR
+4 SET DGENRP("FACILITY","ALL")=0
+5 SET DIR(0)="Y"
+6 SET DIR("A")="Do you want to include all Preferred Facilities"
+7 SET DIR("?")="Answer NO if you want all enrollments found regardless of when the patient's Preferred Facility."
+8 SET DIR("B")="NO"
+9 DO ^DIR
+10 IF $DATA(DIRUT)
QUIT 0
+11 IF Y
SET DGENRP("FACILITY","ALL")=1
QUIT 1
+12 FOR
if '$$FACILITY
QUIT
+13 IF '$ORDER(DGENRP("FACILITY",0))
QUIT 0
+14 QUIT 1
+15 ;
+16 ;
FACILITY() ;
+1 ;Description: Asks user to select an institution
+2 NEW DIR
+3 SET DIR(0)="PO^4:AEM"
+4 SET DIR("A")="Preferred Facility"
+5 SET DIR("?")="Selection of Preferred Facilities to include is made from the Institution file."
+6 DO ^DIR
+7 if $DATA(DIRUT)
QUIT 0
+8 if +Y
SET DGENRP("FACILITY",+Y)=""
+9 QUIT 1
+10 ;