ANRVRP7 ;BIRM/LDT - VIST ROSTER PRINTOUT ; 27 Apr 98 / 9:20 AM
;;4.0; Visual Impairment Service Team ;;12 Jun 98
EN1 ;Entry point for Roster Printout.
K ANRVLP W @IOF,!!,"VIST ROSTER PRINTOUT",!!
D SEL I '$D(ANRVLP),SEL'="A" G QUIT
W !!,"The right margin for this report is 132.",!
K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!!" G QUIT
I $D(IO("Q")) K IO("Q") S ZTDESC="VIST ROSTER PRINTOUT",ZTRTN="DEQ^ANRVRP7" S:$D(ANRVLP) ZTSAVE("ANRVLP(")="" S:$D(SEL) ZTSAVE("SEL")=""
I D ^%ZTLOAD K ZTSK G QUIT
U IO
DEQ ;Entry point when queued.
K ^TMP("ANRV",$J)
S ANRVP=0 F S ANRVP=$O(ANRVLP(ANRVP)) Q:'ANRVP S DFN=$P($G(^ANRV(2040,ANRVP,0)),U) D 2^VADPT,SETTMP
S HDR="VIST ROSTER PRINTOUT"
S (PG,QFLG)=0,$P(LN,"-",133)="" D NOW^%DTC S Y=$E(%,1,12) X ^DD("DD") S HDT=Y D HDR
I '$D(^TMP("ANRV",$J)) W !,"NO DATA TO PRINT!" G QUIT
D REPORT
;
QUIT K %,%H,%I,%T,%Y,ANRVP,ANRV,ANRVLP,DFN,HDR,HDT,JJ,LN,NAME,PG,POP,SEL,QFLG,X,Y,XX,^TMP("ANRV",$J) D KVAR^VADPT,KVA^VADPT
W:$E(IOST)'="C" @IOF D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
Q
;
SETTMP ;Set TMP global
S:VADM(6)="" ^TMP("ANRV",$J,VADM(1))=VADM(1)_U_$P(VADM(2),U,2)_U_$P($G(^ANRV(2040,ANRVP,13)),U,2)_U_$P(VAEL(2),U,2)_U_$G(^ANRV(2040,ANRVP,2))
Q
;
HDR ;Report header
I $E(IOST)="C",PG>0 S DIR(0)="E" D ^DIR K DIR I 'Y S QFLG=1 Q
S PG=PG+1 W:$Y!($E(IOST)="C") @IOF Q:(PG>1)&($E(IOST)="C") W !,HDR,?73,"Printed ",HDT,?100,"Page ",PG,!!,"NAME",?27,"SSN",?47,"VIST ELIGIBLE",?73,"PERIOD OF",?93,"VIST ELIGIBILITY"
W !?73,"SERVICE",!,LN
Q
;
REPORT ;Print Report
S NAME="" F S NAME=$O(^TMP("ANRV",$J,NAME)) Q:NAME="" D:$Y+13>IOSL HDR Q:QFLG D
.F XX=1:1:5 S ANRV(XX)=$P($G(^TMP("ANRV",$J,NAME)),U,XX)
.D:$Y+13>IOSL HDR Q:QFLG W !,ANRV(1),?27,ANRV(2),?47,$S(ANRV(3)="001":"YES (001)",ANRV(3)="002":"NO - REVIEWED FOR BRC",ANRV(3)="003":"NO - OTHER (003)",ANRV(3)="NO":"NO - NOT LEGALLY BLIN",1:""),?73,ANRV(4),?93,ANRV(5)
Q
SEL W !!,"Do you want the report to list:",!?3,"(A)ll patients, or",!?3,"(S)elect patients",!!
S DIR(0)="SAOBM^A:ALL;S:SELECTED",DIR("A")="Choose A or S: ",DIR("?")="^D HELPSEL^ANRVRP7" D ^DIR K DIR
S SEL=Y I SEL="A" G ANRVLP
S:SEL="" SEL="^" G:SEL="^" QUIT2
W !
ASKPT S DIC="^ANRV(2040,",DIC(0)="QEAM",DIC("S")="I $P($G(^ANRV(2040,+Y,13)),U,2)'=""I""" D ^DIC K DIC I Y<0 Q
S DFN=$P($G(^ANRV(2040,+Y,0)),U),ANRVP=+Y D DEM^VADPT I VADM(6) W !?5,"Patient died "_$P($P(VADM(6),"^",2),"@")_"." G ASKPT
S ANRVLP(ANRVP)="" G ASKPT
QUIT2 K:SEL="^"!(SEL="") %,DIC,X,Y Q
HELPSEL ;
W !!,"Enter ""A"" to select all patients from the VIST ROSTER file.",!?6,"""S"" to select only specific patients.",!?6,"""^"" or <return> to halt." Q
ANRVLP ;Set ANRVLP for all patients who are not inactive for AMIS
S JJ=0 F S JJ=$O(^ANRV(2040,JJ)) Q:'JJ I $P($G(^ANRV(2040,JJ,13)),U,2)'="I" S ANRVLP(JJ)=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HANRVRP7 2882 printed Dec 13, 2024@02:46 Page 2
ANRVRP7 ;BIRM/LDT - VIST ROSTER PRINTOUT ; 27 Apr 98 / 9:20 AM
+1 ;;4.0; Visual Impairment Service Team ;;12 Jun 98
EN1 ;Entry point for Roster Printout.
+1 KILL ANRVLP
WRITE @IOF,!!,"VIST ROSTER PRINTOUT",!!
+2 DO SEL
IF '$DATA(ANRVLP)
IF SEL'="A"
GOTO QUIT
+3 WRITE !!,"The right margin for this report is 132.",!
+4 KILL %ZIS,IOP
SET %ZIS="QM"
SET %ZIS("B")=""
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!!"
GOTO QUIT
+5 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="VIST ROSTER PRINTOUT"
SET ZTRTN="DEQ^ANRVRP7"
if $DATA(ANRVLP)
SET ZTSAVE("ANRVLP(")=""
if $DATA(SEL)
SET ZTSAVE("SEL")=""
+6 IF $TEST
DO ^%ZTLOAD
KILL ZTSK
GOTO QUIT
+7 USE IO
DEQ ;Entry point when queued.
+1 KILL ^TMP("ANRV",$JOB)
+2 SET ANRVP=0
FOR
SET ANRVP=$ORDER(ANRVLP(ANRVP))
if 'ANRVP
QUIT
SET DFN=$PIECE($GET(^ANRV(2040,ANRVP,0)),U)
DO 2^VADPT
DO SETTMP
+3 SET HDR="VIST ROSTER PRINTOUT"
+4 SET (PG,QFLG)=0
SET $PIECE(LN,"-",133)=""
DO NOW^%DTC
SET Y=$EXTRACT(%,1,12)
XECUTE ^DD("DD")
SET HDT=Y
DO HDR
+5 IF '$DATA(^TMP("ANRV",$JOB))
WRITE !,"NO DATA TO PRINT!"
GOTO QUIT
+6 DO REPORT
+7 ;
QUIT KILL %,%H,%I,%T,%Y,ANRVP,ANRV,ANRVLP,DFN,HDR,HDT,JJ,LN,NAME,PG,POP,SEL,QFLG,X,Y,XX,^TMP("ANRV",$JOB)
DO KVAR^VADPT
DO KVA^VADPT
+1 if $EXTRACT(IOST)'="C"
WRITE @IOF
DO ^%ZISC
if $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 QUIT
+3 ;
SETTMP ;Set TMP global
+1 if VADM(6)=""
SET ^TMP("ANRV",$JOB,VADM(1))=VADM(1)_U_$PIECE(VADM(2),U,2)_U_$PIECE($GET(^ANRV(2040,ANRVP,13)),U,2)_U_$PIECE(VAEL(2),U,2)_U_$GET(^ANRV(2040,ANRVP,2))
+2 QUIT
+3 ;
HDR ;Report header
+1 IF $EXTRACT(IOST)="C"
IF PG>0
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET QFLG=1
QUIT
+2 SET PG=PG+1
if $Y!($EXTRACT(IOST)="C")
WRITE @IOF
if (PG>1)&($EXTRACT(IOST)="C")
QUIT
WRITE !,HDR,?73,"Printed ",HDT,?100,"Page ",PG,!!,"NAME",?27,"SSN",?47,"VIST ELIGIBLE",?73,"PERIOD OF",?93,"VIST ELIGIBILITY"
+3 WRITE !?73,"SERVICE",!,LN
+4 QUIT
+5 ;
REPORT ;Print Report
+1 SET NAME=""
FOR
SET NAME=$ORDER(^TMP("ANRV",$JOB,NAME))
if NAME=""
QUIT
if $Y+13>IOSL
DO HDR
if QFLG
QUIT
Begin DoDot:1
+2 FOR XX=1:1:5
SET ANRV(XX)=$PIECE($GET(^TMP("ANRV",$JOB,NAME)),U,XX)
+3 if $Y+13>IOSL
DO HDR
if QFLG
QUIT
WRITE !,ANRV(1),?27,ANRV(2),?47,$SELECT(ANRV(3)="001":"YES (001)",ANRV(3)="002":"NO - REVIEWED FOR BRC",ANRV(3)="003":"NO - OTHER (003)",ANRV(3)="NO":"NO - NOT LEGALLY BLIN",1:""),?73,ANRV(4),?93,ANRV(5)
End DoDot:1
+4 QUIT
SEL WRITE !!,"Do you want the report to list:",!?3,"(A)ll patients, or",!?3,"(S)elect patients",!!
+1 SET DIR(0)="SAOBM^A:ALL;S:SELECTED"
SET DIR("A")="Choose A or S: "
SET DIR("?")="^D HELPSEL^ANRVRP7"
DO ^DIR
KILL DIR
+2 SET SEL=Y
IF SEL="A"
GOTO ANRVLP
+3 if SEL=""
SET SEL="^"
if SEL="^"
GOTO QUIT2
+4 WRITE !
ASKPT SET DIC="^ANRV(2040,"
SET DIC(0)="QEAM"
SET DIC("S")="I $P($G(^ANRV(2040,+Y,13)),U,2)'=""I"""
DO ^DIC
KILL DIC
IF Y<0
QUIT
+1 SET DFN=$PIECE($GET(^ANRV(2040,+Y,0)),U)
SET ANRVP=+Y
DO DEM^VADPT
IF VADM(6)
WRITE !?5,"Patient died "_$PIECE($PIECE(VADM(6),"^",2),"@")_"."
GOTO ASKPT
+2 SET ANRVLP(ANRVP)=""
GOTO ASKPT
QUIT2 if SEL="^"!(SEL="")
KILL %,DIC,X,Y
QUIT
HELPSEL ;
+1 WRITE !!,"Enter ""A"" to select all patients from the VIST ROSTER file.",!?6,"""S"" to select only specific patients.",!?6,"""^"" or <return> to halt."
QUIT
ANRVLP ;Set ANRVLP for all patients who are not inactive for AMIS
+1 SET JJ=0
FOR
SET JJ=$ORDER(^ANRV(2040,JJ))
if 'JJ
QUIT
IF $PIECE($GET(^ANRV(2040,JJ,13)),U,2)'="I"
SET ANRVLP(JJ)=""
+2 QUIT