ANRVRP ;BIRM/LDT - VIST ADDRESS/PHONE LIST ; 05 Aug 98 / 2:13 PM
;;4.0; Visual Impairment Service Team ;**1**;12 Jun 98
EN1 ;Entry point for Address List
W @IOF,!!,"VIST ADDRESS/PHONE LIST",!!
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 ADDRESS/PHONE LIST",ZTRTN="DEQ^ANRVRP"
I D ^%ZTLOAD K ZTSK G QUIT
U IO
DEQ ;Entry point when queued.
K ^TMP("ANRV",$J)
S HDR="VIST ROSTER ADDRESS/PHONE LIST"
S (PG,QFLG)=0,$P(LN,"-",81)="" D NOW^%DTC S Y=$E(%,1,12) X ^DD("DD") S HDT=Y
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
D HDR
I '$D(^TMP("ANRV",$J)) W !,"NO DATA TO PRINT!" G QUIT
D REPORT
;
QUIT K %,%H,%I,%T,%Y,ANRVP,ANRV,DFN,HDR,HDT,LN,NAME,PG,POP,QFLG,X,Y,XX,DTOUT,DUOUT,DIRUT,^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
S ^TMP("ANRV",$J,VADM(1))=VADM(1)_U_VAPA(8)_U_VAPA(1)_U_VAPA(2)_U_VAPA(3)_U_VAPA(4)_U_$P(VAPA(5),U)_U_VAPA(6)
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,?44,"Printed ",HDT,?71,"Page ",PG,!!,"NAME",?22,"PHONE NO.",?44,"ADDRESS",!,LN
Q
;
REPORT ;Print Report
S NAME="" F S NAME=$O(^TMP("ANRV",$J,NAME)) Q:NAME="" D D:$Y+4>IOSL HDR Q:QFLG
.F XX=1:1:8 S ANRV(XX)=$P($G(^TMP("ANRV",$J,NAME)),U,XX)
.W !,$E(ANRV(1),1,20),?22,ANRV(2),?44,ANRV(3)
.W:ANRV(4)]"" !?44,ANRV(4) W:ANRV(5)]"" !?44,ANRV(5)
.W:ANRV(6)]"" !?44,ANRV(6)_"," W:ANRV(7)>0 " "_$P(^DIC(5,+ANRV(7),0),U,2) W:ANRV(8)]"" " "_ANRV(8)
.W !
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HANRVRP 1789 printed Nov 22, 2024@17:55:46 Page 2
ANRVRP ;BIRM/LDT - VIST ADDRESS/PHONE LIST ; 05 Aug 98 / 2:13 PM
+1 ;;4.0; Visual Impairment Service Team ;**1**;12 Jun 98
EN1 ;Entry point for Address List
+1 WRITE @IOF,!!,"VIST ADDRESS/PHONE LIST",!!
+2 KILL %ZIS,IOP
SET %ZIS="QM"
SET %ZIS("B")=""
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!!"
GOTO QUIT
+3 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="VIST ROSTER ADDRESS/PHONE LIST"
SET ZTRTN="DEQ^ANRVRP"
+4 IF $TEST
DO ^%ZTLOAD
KILL ZTSK
GOTO QUIT
+5 USE IO
DEQ ;Entry point when queued.
+1 KILL ^TMP("ANRV",$JOB)
+2 SET HDR="VIST ROSTER ADDRESS/PHONE LIST"
+3 SET (PG,QFLG)=0
SET $PIECE(LN,"-",81)=""
DO NOW^%DTC
SET Y=$EXTRACT(%,1,12)
XECUTE ^DD("DD")
SET HDT=Y
+4 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
+5 DO HDR
+6 IF '$DATA(^TMP("ANRV",$JOB))
WRITE !,"NO DATA TO PRINT!"
GOTO QUIT
+7 DO REPORT
+8 ;
QUIT KILL %,%H,%I,%T,%Y,ANRVP,ANRV,DFN,HDR,HDT,LN,NAME,PG,POP,QFLG,X,Y,XX,DTOUT,DUOUT,DIRUT,^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 SET ^TMP("ANRV",$JOB,VADM(1))=VADM(1)_U_VAPA(8)_U_VAPA(1)_U_VAPA(2)_U_VAPA(3)_U_VAPA(4)_U_$PIECE(VAPA(5),U)_U_VAPA(6)
+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,?44,"Printed ",HDT,?71,"Page ",PG,!!,"NAME",?22,"PHONE NO.",?44,"ADDRESS",!,LN
+3 QUIT
+4 ;
REPORT ;Print Report
+1 SET NAME=""
FOR
SET NAME=$ORDER(^TMP("ANRV",$JOB,NAME))
if NAME=""
QUIT
Begin DoDot:1
+2 FOR XX=1:1:8
SET ANRV(XX)=$PIECE($GET(^TMP("ANRV",$JOB,NAME)),U,XX)
+3 WRITE !,$EXTRACT(ANRV(1),1,20),?22,ANRV(2),?44,ANRV(3)
+4 if ANRV(4)]""
WRITE !?44,ANRV(4)
if ANRV(5)]""
WRITE !?44,ANRV(5)
+5 if ANRV(6)]""
WRITE !?44,ANRV(6)_","
if ANRV(7)>0
WRITE " "_$PIECE(^DIC(5,+ANRV(7),0),U,2)
if ANRV(8)]""
WRITE " "_ANRV(8)
+6 WRITE !
End DoDot:1
if $Y+4>IOSL
DO HDR
if QFLG
QUIT
+7 QUIT