NURA7B ;HIRMFO/MD/RM/JH/MD,FT-HOME PHONE NUMBER(S) BY LOCATION ;8/8/96 13:48
;;4.0;NURSING SERVICE;**13**;Apr 25, 1997
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
S (NURPAGE,NURSW1,NURMDSW,NURPLSW,NURQUEUE,NUROUT,NURQUIT)=0
D EN1^NURSAUTL G QUIT:$G(NUROUT) S:NURSZAP=7 NURSZAP=0
I NURMDSW S DIC(0)="AEQZ",NURPLSCR=1 D EN5^NURSAGSP G:$G(NUROUT) QUIT
I NURMDSW=0,NURPLSW=1 S NURPLSCR=1 D PRD^NURSAGSP K NURPLSCR I $G(NUROUT) G QUIT
W ! D EN1^NURSAGSP G QUIT:$G(NUROUT) W !
D EN2^NURSAGSP G:$G(NUROUT) QUIT
W ! S ZTDESC="Nursing Home Phone Numbers by Location",ZTRTN="START^NURA7B" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
K ^TMP($J),^TMP("NURLOC",$J) S NURPAGE=0
D SORT G:$G(NUROUT) QUIT
U IO D PRINT
QUIT K ^TMP($J) D CLOSE^NURSUT1,^NURAKILL
Q
PRINT S NURFAC(2)="" F S NURFAC(2)=$O(^TMP($J,"L",NURFAC(2))) Q:NURFAC(2)="" D P0 Q:NURQUIT
Q
P0 S NURPROG(2)="" F S NURPROG(2)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2))) Q:NURPROG(2)="" D P1 Q:NURQUIT
Q
P1 S NL1="" F S NL1=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NL1)) Q:NL1="" D:NURSW1 HEADER Q:NURQUIT D P2 Q:NURQUIT
Q
P2 S NPRI="" F S NPRI=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NL1,NPRI)) Q:NPRI="" D P3 Q:NURQUIT
Q
P3 S NSPN="" F S NSPN=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NL1,NPRI,NSPN)) Q:NSPN=""!NURQUIT S NURSORT=$G(^(NSPN)) I NURSORT D P4 W ! Q:NURQUIT
Q
P4 S NURN1="" F S NURN1=$O(^TMP($J,"L1",NURSORT,NURN1)) Q:NURN1="" D P5 Q:NURQUIT
Q
P5 F DA(1)=0:0 S DA(1)=$O(^TMP($J,"L1",NURSORT,NURN1,DA(1))) Q:DA(1)'>0 D PRINT1 Q:NURQUIT
Q
; DETAIL LINE PRINT ROUTINE
PRINT1 I ($Y>(IOSL-6))!'(NURSW1) D HEADER Q:NURQUIT
W ! S NURSW1=1 W:NL1'=" BLANK" $E(NL1,1,10)
W:NURN1'=" BLANK" ?15,NURN1
W:NSPN'=" BLANK" ?41,NSPN
F NS2=0:0 S NS2=$O(^NURSF(210,DA(1),2,NS2)) Q:NS2'>0 W:NS2'=$O(^NURSF(210,DA(1),2,0)) ! W:$D(^NURSF(210,DA(1),2,NS2,0)) ?56,$P(^(0),"^",1) S NO=$P(^(0),"^",2) W ?69,$S(NO="S":"SELF",NO="R":"RELATIVE",NO="N":"NEIGHBOR",NO="O":"OTHER",1:"")
Q
S NURPAGE=NURPAGE+1 W:$E(IOST)="C"!(NURPAGE>1) @IOF
I NURMDSW W !?$$CNTR^NURSUT2(NURFAC(2)),$$FACL^NURSUT2(NURFAC(2))
W !,"STAFF PHONE NUMBERS BY LOCATION" S X="T" D ^%DT D:+Y D^DIQ W ?56,Y,?69,"PAGE: ",NURPAGE
W !!,"LOCATION",?15,"EMPLOYEE",?41,"SERVICE",?56,"TELEPHONE",?69,"OWNER OF" W !,?15,"NAME",?41,"POSITION",?56,"NUMBER",?69,"PHONE NO." W !,$$REPEAT^XLFSTR("-",80)
I $G(NURPLSW),$G(NURPROG(2))'="" N Z S Z=$$PROD^NURSUT2(NURPROG(2)),NURLINE="",$P(NURLINE,"-",$L(Z)+1)="" W !,?$$CNTR^NURSUT2(Z),$G(Z),!,?$$CNTR^NURSUT2(Z),$$REPEAT^XLFSTR("-",$L(Z)+1)
Q
SORT S NRPT=10 D EN4^NURAAGS0
I $O(^TMP($J,""))="",'$D(NURSNLOC) S NUROUT=1 S NURPROG(2)=$S($G(NURPROG)=0:NURPROG(1),1:""),NURFAC(2)=$S($G(NURFAC)=0:NURFAC(1),1:"") D HEADER W !,"THERE IS NO DATA FOR THIS REPORT"
I $O(^TMP($J,""))="",$D(NURSNLOC) S NUROUT=1 S NURPROG(2)=$S($G(NURPROG)=0:NURPROG(1),1:""),NURFAC(2)=$S($G(NURFAC)=0:NURFAC(1),1:"") D HEADER S NL1="" F S NL1=$O(NURSNLOC(NL1)) Q:NL1="" D NODATA^NURSUT1
I $O(^TMP($J,""))'="",$D(NURSNLOC) D I NURSW1=1 D ENDPG^NURSUT1 S NURSW1=0
. S (NURY,NURZ,NURX)="" F S NURY=$O(^TMP($J,"L",NURY)) Q:NURY="" F S NURZ=$O(^TMP($J,"L",NURY,NURZ)) Q:NURZ="" F S NURX=$O(^TMP($J,"L",NURY,NURZ,NURX)) Q:NURX="" S ^TMP("NURLOC",$J,NURX)=""
. S NL1="" F S NL1=$O(NURSNLOC(NL1)) Q:NL1="" I '$D(^TMP("NURLOC",$J,NL1)) D
. . S NURPROG(2)=$S($G(NURPROG)=0:NURPROG(1),1:""),NURFAC(2)=$S($G(NURFAC)=0:NURFAC(1),1:"") D:NURSW1=0 HEADER S NURSW1=1 D NODATA^NURSUT1
. . Q
. Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HNURA7B 3623 printed Nov 22, 2024@17:28:31 Page 2
NURA7B ;HIRMFO/MD/RM/JH/MD,FT-HOME PHONE NUMBER(S) BY LOCATION ;8/8/96 13:48
+1 ;;4.0;NURSING SERVICE;**13**;Apr 25, 1997
+2 if '$DATA(^DIC(213.9,1,"OFF"))
QUIT
if $PIECE(^DIC(213.9,1,"OFF"),"^",1)=1
QUIT
+3 SET (NURPAGE,NURSW1,NURMDSW,NURPLSW,NURQUEUE,NUROUT,NURQUIT)=0
+4 DO EN1^NURSAUTL
if $GET(NUROUT)
GOTO QUIT
if NURSZAP=7
SET NURSZAP=0
+5 IF NURMDSW
SET DIC(0)="AEQZ"
SET NURPLSCR=1
DO EN5^NURSAGSP
if $GET(NUROUT)
GOTO QUIT
+6 IF NURMDSW=0
IF NURPLSW=1
SET NURPLSCR=1
DO PRD^NURSAGSP
KILL NURPLSCR
IF $GET(NUROUT)
GOTO QUIT
+7 WRITE !
DO EN1^NURSAGSP
if $GET(NUROUT)
GOTO QUIT
WRITE !
+8 DO EN2^NURSAGSP
if $GET(NUROUT)
GOTO QUIT
+9 WRITE !
SET ZTDESC="Nursing Home Phone Numbers by Location"
SET ZTRTN="START^NURA7B"
DO EN7^NURSUT0
if POP!($DATA(ZTSK))
GOTO QUIT
START ;
+1 KILL ^TMP($JOB),^TMP("NURLOC",$JOB)
SET NURPAGE=0
+2 DO SORT
if $GET(NUROUT)
GOTO QUIT
+3 USE IO
DO PRINT
QUIT KILL ^TMP($JOB)
DO CLOSE^NURSUT1
DO ^NURAKILL
+1 QUIT
PRINT SET NURFAC(2)=""
FOR
SET NURFAC(2)=$ORDER(^TMP($JOB,"L",NURFAC(2)))
if NURFAC(2)=""
QUIT
DO P0
if NURQUIT
QUIT
+1 QUIT
P0 SET NURPROG(2)=""
FOR
SET NURPROG(2)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2)))
if NURPROG(2)=""
QUIT
DO P1
if NURQUIT
QUIT
+1 QUIT
P1 SET NL1=""
FOR
SET NL1=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NL1))
if NL1=""
QUIT
if NURSW1
DO HEADER
if NURQUIT
QUIT
DO P2
if NURQUIT
QUIT
+1 QUIT
P2 SET NPRI=""
FOR
SET NPRI=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NL1,NPRI))
if NPRI=""
QUIT
DO P3
if NURQUIT
QUIT
+1 QUIT
P3 SET NSPN=""
FOR
SET NSPN=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NL1,NPRI,NSPN))
if NSPN=""!NURQUIT
QUIT
SET NURSORT=$GET(^(NSPN))
IF NURSORT
DO P4
WRITE !
if NURQUIT
QUIT
+1 QUIT
P4 SET NURN1=""
FOR
SET NURN1=$ORDER(^TMP($JOB,"L1",NURSORT,NURN1))
if NURN1=""
QUIT
DO P5
if NURQUIT
QUIT
+1 QUIT
P5 FOR DA(1)=0:0
SET DA(1)=$ORDER(^TMP($JOB,"L1",NURSORT,NURN1,DA(1)))
if DA(1)'>0
QUIT
DO PRINT1
if NURQUIT
QUIT
+1 QUIT
+2 ; DETAIL LINE PRINT ROUTINE
PRINT1 IF ($Y>(IOSL-6))!'(NURSW1)
DO HEADER
if NURQUIT
QUIT
+1 WRITE !
SET NURSW1=1
if NL1'=" BLANK"
WRITE $EXTRACT(NL1,1,10)
+2 if NURN1'=" BLANK"
WRITE ?15,NURN1
+3 if NSPN'=" BLANK"
WRITE ?41,NSPN
+4 FOR NS2=0:0
SET NS2=$ORDER(^NURSF(210,DA(1),2,NS2))
if NS2'>0
QUIT
if NS2'=$ORDER(^NURSF(210,DA(1),2,0))
WRITE !
if $DATA(^NURSF(210,DA(1),2,NS2,0))
WRITE ?56,$PIECE(^(0),"^",1)
SET NO=$PIECE(^(0),"^",2)
WRITE ?69,$SELECT(NO="S":"SELF",NO="R":"RELATIVE",NO="N":"NEIGHBOR",NO="O":"OTHER",1:"")
+5 QUIT
IF 'NURQUEUE
IF $EXTRACT(IOST)="C"
IF NURSW1
DO ENDPG^NURSUT1
if NUROUT=1
SET NURQUIT=+NUROUT
if NURQUIT
QUIT
+1 SET NURPAGE=NURPAGE+1
if $EXTRACT(IOST)="C"!(NURPAGE>1)
WRITE @IOF
+2 IF NURMDSW
WRITE !?$$CNTR^NURSUT2(NURFAC(2)),$$FACL^NURSUT2(NURFAC(2))
+3 WRITE !,"STAFF PHONE NUMBERS BY LOCATION"
SET X="T"
DO ^%DT
if +Y
DO D^DIQ
WRITE ?56,Y,?69,"PAGE: ",NURPAGE
+4 WRITE !!,"LOCATION",?15,"EMPLOYEE",?41,"SERVICE",?56,"TELEPHONE",?69,"OWNER OF"
WRITE !,?15,"NAME",?41,"POSITION",?56,"NUMBER",?69,"PHONE NO."
WRITE !,$$REPEAT^XLFSTR("-",80)
+5 IF $GET(NURPLSW)
IF $GET(NURPROG(2))'=""
NEW Z
SET Z=$$PROD^NURSUT2(NURPROG(2))
SET NURLINE=""
SET $PIECE(NURLINE,"-",$LENGTH(Z)+1)=""
WRITE !,?$$CNTR^NURSUT2(Z),$GET(Z),!,?$$CNTR^NURSUT2(Z),$$REPEAT^XLFSTR("-",$LENGTH(Z)+1)
+6 QUIT
SORT SET NRPT=10
DO EN4^NURAAGS0
+1 IF $ORDER(^TMP($JOB,""))=""
IF '$DATA(NURSNLOC)
SET NUROUT=1
SET NURPROG(2)=$SELECT($GET(NURPROG)=0:NURPROG(1),1:"")
SET NURFAC(2)=$SELECT($GET(NURFAC)=0:NURFAC(1),1:"")
DO HEADER
WRITE !,"THERE IS NO DATA FOR THIS REPORT"
+2 IF $ORDER(^TMP($JOB,""))=""
IF $DATA(NURSNLOC)
SET NUROUT=1
SET NURPROG(2)=$SELECT($GET(NURPROG)=0:NURPROG(1),1:"")
SET NURFAC(2)=$SELECT($GET(NURFAC)=0:NURFAC(1),1:"")
DO HEADER
SET NL1=""
FOR
SET NL1=$ORDER(NURSNLOC(NL1))
if NL1=""
QUIT
DO NODATA^NURSUT1
+3 IF $ORDER(^TMP($JOB,""))'=""
IF $DATA(NURSNLOC)
Begin DoDot:1
+4 SET (NURY,NURZ,NURX)=""
FOR
SET NURY=$ORDER(^TMP($JOB,"L",NURY))
if NURY=""
QUIT
FOR
SET NURZ=$ORDER(^TMP($JOB,"L",NURY,NURZ))
if NURZ=""
QUIT
FOR
SET NURX=$ORDER(^TMP($JOB,"L",NURY,NURZ,NURX))
if NURX=""
QUIT
SET ^TMP("NURLOC",$JOB,NURX)=""
+5 SET NL1=""
FOR
SET NL1=$ORDER(NURSNLOC(NL1))
if NL1=""
QUIT
IF '$DATA(^TMP("NURLOC",$JOB,NL1))
Begin DoDot:2
+6 SET NURPROG(2)=$SELECT($GET(NURPROG)=0:NURPROG(1),1:"")
SET NURFAC(2)=$SELECT($GET(NURFAC)=0:NURFAC(1),1:"")
if NURSW1=0
DO HEADER
SET NURSW1=1
DO NODATA^NURSUT1
+7 QUIT
End DoDot:2
+8 QUIT
End DoDot:1
IF NURSW1=1
DO ENDPG^NURSUT1
SET NURSW1=0
+9 QUIT