ANRVRP2 ;BIRM/LDT - VIST COUNTY LIST ; 18 Sep 98 / 8:37 AM
;;4.0; Visual Impairment Service Team ;**1**;12 Jun 98
EN1 ;Entry point for County List
K ANRVLP W @IOF,!!,"SORT BY COUNTY",!!
D SEL I '$D(ANRVLP),SEL'="A" G QUIT
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 LIST BY COUNTY",ZTRTN="DEQ^ANRVRP2" 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(^ANRV(2040,ANRVP)) Q:'ANRVP I $P($G(^ANRV(2040,ANRVP,13)),U,2)'="I" S DFN=$P($G(^ANRV(2040,ANRVP,0)),U) D 4^VADPT,SETTMP
S HDR="VIST ROSTER LIST BY COUNTY"
S (PG,QFLG)=0,$P(LN,"-",81)="" 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,CNTY,CNTY2,DFN,DTOUT,DUOUT,DIRUT,HDR,HDT,LN,NAME,PG,POP,QFLG,SEL,SUB,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 for report
I $D(ANRVLP),VAPA(7)]"",$P(VAPA(7),U,2)]"",$D(ANRVLP($P(VAPA(7),U,2))) S ^TMP("ANRV",$J,$P(VAPA(7),U,2),VADM(1))=VADM(1)_U_$P(VADM(2),U,2)_U_$P(VAPA(7),U,2)_U_$P($G(^DIC(5,+VAPA(5),1,+VAPA(7),0)),U,3)
I $D(SEL),SEL="A" S SUB=$S($P(VAPA(7),U,2)]"":$P(VAPA(7),U,2),1:"zzz"),^TMP("ANRV",$J,SUB,VADM(1))=VADM(1)_U_$P(VADM(2),U,2)_U_$S(SUB="zzz":"",1:SUB)_U_$S(SUB="zzz":"",1:$P($G(^DIC(5,+VAPA(5),1,+VAPA(7),0)),U,3))
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,?45,"Printed ",HDT,?72,"Page ",PG,!!,"NAME",?27,"SSN",?47,"COUNTY",!,LN
Q
;
REPORT ;Print Report
S (CNTY,CNTY2,NAME)="" F S CNTY=$O(^TMP("ANRV",$J,CNTY)) Q:CNTY="" F S NAME=$O(^TMP("ANRV",$J,CNTY,NAME)) Q:NAME="" D
.Q:QFLG D:$Y+5>IOSL HDR Q:QFLG I CNTY'=CNTY2 W !?10,"==> COUNTY: ",$S(CNTY="zzz":"UNSPECIFIED",1:CNTY),!
.F XX=1:1:4 S ANRV(XX)=$P($G(^TMP("ANRV",$J,CNTY,NAME)),U,XX)
.Q:QFLG D:$Y+5>IOSL HDR Q:QFLG W !,ANRV(1),?27,ANRV(2),?47,ANRV(3)_$S(CNTY="zzz":"",1:" ("_ANRV(4)_")")
.S CNTY2=CNTY W !
Q
SEL W !!,"Do you want the report to list:",!?3,"(A)ll counties or",!?3,"(S)elect county/counties",!!
S DIR(0)="SAOBM^A:ALL;S:SELECTED",DIR("A")="Choose A or S: ",DIR("?")="^D HELPSEL^ANRVRP2" D ^DIR K DIR
S SEL=Y I SEL="A" Q
S:SEL="" SEL="^" G:SEL="^" QUIT2
W !
ASKCTY S DIR(0)="FAO^1:30",DIR("A")="Select COUNTY NAME: " D ^DIR K DIR
I Y]"",Y'="^" D SETLP G ASKCTY
QUIT2 K:SEL="^"!(SEL="") %,DIR,X,Y Q
SETLP I Y?1U.E S ANRVLP($TR(Y,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ"))=""
I Y?1L.E S ANRVLP($TR(Y,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ"))=""
S ANRVLP(Y)=""
Q
HELPSEL ;
W !!,"Enter:",!?3,"""A"" to list patients for ALL counties from the VIST ROSTER file.",!?3,"""S"" to select only a specific county or counties.",!?3,"""^"" or <return> to halt." Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HANRVRP2 3081 printed Nov 22, 2024@17:55:47 Page 2
ANRVRP2 ;BIRM/LDT - VIST COUNTY LIST ; 18 Sep 98 / 8:37 AM
+1 ;;4.0; Visual Impairment Service Team ;**1**;12 Jun 98
EN1 ;Entry point for County List
+1 KILL ANRVLP
WRITE @IOF,!!,"SORT BY COUNTY",!!
+2 DO SEL
IF '$DATA(ANRVLP)
IF SEL'="A"
GOTO QUIT
+3 KILL %ZIS,IOP
SET %ZIS="QM"
SET %ZIS("B")=""
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!!"
GOTO QUIT
+4 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="VIST ROSTER LIST BY COUNTY"
SET ZTRTN="DEQ^ANRVRP2"
if $DATA(ANRVLP)
SET ZTSAVE("ANRVLP(")=""
if $DATA(SEL)
SET ZTSAVE("SEL")=""
+5 IF $TEST
DO ^%ZTLOAD
KILL ZTSK
GOTO QUIT
+6 USE IO
DEQ ;Entry point when queued.
+1 KILL ^TMP("ANRV",$JOB)
+2 SET ANRVP=0
FOR
SET ANRVP=$ORDER(^ANRV(2040,ANRVP))
if 'ANRVP
QUIT
IF $PIECE($GET(^ANRV(2040,ANRVP,13)),U,2)'="I"
SET DFN=$PIECE($GET(^ANRV(2040,ANRVP,0)),U)
DO 4^VADPT
DO SETTMP
+3 SET HDR="VIST ROSTER LIST BY COUNTY"
+4 SET (PG,QFLG)=0
SET $PIECE(LN,"-",81)=""
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,CNTY,CNTY2,DFN,DTOUT,DUOUT,DIRUT,HDR,HDT,LN,NAME,PG,POP,QFLG,SEL,SUB,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 for report
+1 IF $DATA(ANRVLP)
IF VAPA(7)]""
IF $PIECE(VAPA(7),U,2)]""
IF $DATA(ANRVLP($PIECE(VAPA(7),U,2)))
SET ^TMP("ANRV",$JOB,$PIECE(VAPA(7),U,2),VADM(1))=VADM(1)_U_$PIECE(VADM(2),U,2)_U_$PIECE(VAPA(7),U,2)_U_$PIECE($GET(^DIC(5,+VAPA(5),1,+VAPA(7),0)),U,3)
+2 IF $DATA(SEL)
IF SEL="A"
SET SUB=$SELECT($PIECE(VAPA(7),U,2)]"":$PIECE(VAPA(7),U,2),1:"zzz")
SET ^TMP("ANRV",$JOB,SUB,VADM(1))=VADM(1)_U_$PIECE(VADM(2),U,2)_U_$SELECT(SUB="zzz":"",1:SUB)_U_$SELECT(SUB="zzz":"",1:$PIECE($GET(^DIC(5,+VAPA(5),1,+VAPA(7),0)),U,3))
+3 QUIT
+4 ;
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,?45,"Printed ",HDT,?72,"Page ",PG,!!,"NAME",?27,"SSN",?47,"COUNTY",!,LN
+3 QUIT
+4 ;
REPORT ;Print Report
+1 SET (CNTY,CNTY2,NAME)=""
FOR
SET CNTY=$ORDER(^TMP("ANRV",$JOB,CNTY))
if CNTY=""
QUIT
FOR
SET NAME=$ORDER(^TMP("ANRV",$JOB,CNTY,NAME))
if NAME=""
QUIT
Begin DoDot:1
+2 if QFLG
QUIT
if $Y+5>IOSL
DO HDR
if QFLG
QUIT
IF CNTY'=CNTY2
WRITE !?10,"==> COUNTY: ",$SELECT(CNTY="zzz":"UNSPECIFIED",1:CNTY),!
+3 FOR XX=1:1:4
SET ANRV(XX)=$PIECE($GET(^TMP("ANRV",$JOB,CNTY,NAME)),U,XX)
+4 if QFLG
QUIT
if $Y+5>IOSL
DO HDR
if QFLG
QUIT
WRITE !,ANRV(1),?27,ANRV(2),?47,ANRV(3)_$SELECT(CNTY="zzz":"",1:" ("_ANRV(4)_")")
+5 SET CNTY2=CNTY
WRITE !
End DoDot:1
+6 QUIT
SEL WRITE !!,"Do you want the report to list:",!?3,"(A)ll counties or",!?3,"(S)elect county/counties",!!
+1 SET DIR(0)="SAOBM^A:ALL;S:SELECTED"
SET DIR("A")="Choose A or S: "
SET DIR("?")="^D HELPSEL^ANRVRP2"
DO ^DIR
KILL DIR
+2 SET SEL=Y
IF SEL="A"
QUIT
+3 if SEL=""
SET SEL="^"
if SEL="^"
GOTO QUIT2
+4 WRITE !
ASKCTY SET DIR(0)="FAO^1:30"
SET DIR("A")="Select COUNTY NAME: "
DO ^DIR
KILL DIR
+1 IF Y]""
IF Y'="^"
DO SETLP
GOTO ASKCTY
QUIT2 if SEL="^"!(SEL="")
KILL %,DIR,X,Y
QUIT
SETLP IF Y?1U.E
SET ANRVLP($TRANSLATE(Y,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ"))=""
+1 IF Y?1L.E
SET ANRVLP($TRANSLATE(Y,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ"))=""
+2 SET ANRVLP(Y)=""
+3 QUIT
HELPSEL ;
+1 WRITE !!,"Enter:",!?3,"""A"" to list patients for ALL counties from the VIST ROSTER file.",!?3,"""S"" to select only a specific county or counties.",!?3,"""^"" or <return> to halt."
QUIT