NURA9D1 ;HIRMFO/MD,RM,FT-FTEE PROFILE BY LOCATION AND SERVICE CATEGORY ;5/2/97 10:16
;;4.0;NURSING SERVICE;**1,13**;Apr 25, 1997
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
S (NURPLSW,NUROUT,NURMDSW,NURQUEUE)=0
D EN1^NURSAUTL G QUIT:$G(NUROUT)
D EN9^NURSAGSP
I NURMDSW S DIC(0)="AEMQZ",NURPLSCR=1 D EN5^NURSAGSP K NURPLSCR I $G(NUROUT) G QUIT
I NURMDSW=0,NURPLSW=1 S NURPLSCR=1 D PRD^NURSAGSP K NURPLSCR I $G(NUROUT) G QUIT
W ! D EN1^NURSAGSP G:$G(NUROUT) QUIT
D EN3^NURSAGSP G:$G(NUROUT) QUIT
D EN5^NURSAGP0 W ! G QUIT:$G(NUROUT)
S ZTDESC="Nursing FTEE Profile by Location & Service Category",ZTRTN="START^NURA9D1" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
K ^TMP($J),^TMP("NURA",$J),^TMP("NURLOC",$J) U IO S (NBRK,NURPAGE,NURSW1,NURQUIT,NTCT,NCT,NSUBT,NSUBC,PCT,PSUBT,PSUBC,FCT,FSUBT,FSUBC)=0
D SORT G:NUROUT QUIT D NPRINT S:NURQUIT NCT=NCT+NSUBT I ($Y>(IOSL-6)),'NURQUIT D NHDR
S NURLINE="",$P(NURLINE,"*",7)=""
D EN2^NURAED3 W !!,?20,NURLINE,!,"REPORT TOTAL",?18,$J(NCT,8,3),!!,"COUNT - ASSIGN.",?18,$J(NTCT,8,3) W ?36,"PERSONNEL",?62,$J(NTOT,8,3)
W !!,"MEAN - ASSIGN.",?18,$S(NCT>0&(NTCT>0):$J((NCT/NTCT),8,3),1:" 0.000"),?36,"PERSONNEL",?62,$S(NCT>0&(NTOT>0):$J((NCT/NTOT),8,3),1:" 0.000")
QUIT K ^TMP("NURA",$J),^TMP($J),NTOUR,NUR,NUM D CLOSE^NURSUT1,^NURAKILL
Q
NPRINT S (NURPROG(2),NURFAC(2))="" F S NURFAC(2)=$O(^TMP($J,"L",NURFAC(2))) Q:NURFAC(2)=""!NURQUIT D NK Q:NURQUIT D:NURMDSW FSUB Q:NURQUIT
Q
NK F S NURPROG(2)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2))) Q:NURPROG(2)=""!NURQUIT D NHDR Q:NURQUIT D NL Q:NURQUIT I NURPLSW D PSUB Q:NURQUIT
Q
NL S NL1="" F S NL1=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NL1)) Q:NL1=""!NURQUIT D NM Q:NURQUIT D NHDR Q:NURQUIT
Q
NM S NURCAT="" F S NURCAT=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NL1,NURCAT)) Q:NURCAT=""!NURQUIT D NN Q:NURQUIT D NSUB W ! Q:NURQUIT
Q
NN S NFTEE="" F S NFTEE=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NL1,NURCAT,NFTEE)) Q:NFTEE=""!NURQUIT S NURSORT=$G(^(NFTEE)) I NURSORT D NOT Q:NURQUIT
Q
NOT S N1="" F S N1=$O(^TMP($J,"L1",NURSORT,N1)) Q:N1=""!NURQUIT S NUM(1)=0 F S NUM(1)=$O(^TMP($J,"L1",NURSORT,N1,NUM(1))) Q:NUM(1)'>0!NURQUIT D NOT1
Q
NOT1 S NUM(2)=0 F S NUM(2)=$O(^TMP($J,"L1",NURSORT,N1,NUM(1),NUM(2))) Q:NUM(2)'>0 D NP Q:NURQUIT
Q
NP S DA(1)=0 F S DA(1)=$O(^TMP($J,"L1",NURSORT,N1,NUM(1),NUM(2),DA(1))) Q:DA(1)'>0 D NPPRINT Q:NURQUIT
Q
NPPRINT I ($Y>(IOSL-6)) D NHDR Q:NURQUIT
S NTOUR=DA(1) D S NTOUR=NUR(1)
.N DA S DA=NTOUR D EN9^NURSUT0
S NURSW1=1 S ^TMP("NURA",$J,DA(1),NURSORT)=""
S NSUBT=NSUBT+NFTEE,NSUBC=NSUBC+1,NSUBM=NSUBT/NSUBC
S PSUBT=PSUBT+NFTEE,PSUBC=PSUBC+1,PSUBM=PSUBT/PSUBC
S FSUBT=FSUBT+NFTEE,FSUBC=FSUBC+1,FSUBM=FSUBT/FSUBC
W !,$S(+NFTEE:" ",1:"** ")
W:NURCAT'=" BLANK" $$CAT^NURSUT2(NURCAT)
W:NFTEE'=" BLANK" ?18,$J(NFTEE,8,3)
W:N1'=" BLANK" ?36,$E(N1,1,20)
W:NL1'=" BLANK" ?64,$E(NL1,1,15) W:IOM>120 ?85,NTOUR Q:NURQUIT
Q
NHDR I 'NURQUEUE,NURSW1,$E(IOST)="C" D ENDPG^NURSUT1 S:$G(NUROUT) NURQUIT=+NUROUT Q:NURQUIT
S NURPAGE=NURPAGE+1 W:$E(IOST)="C"!(NURPAGE>1) @IOF
I NURMDSW,$G(NWRD)="" W !,?$$CNTR^NURSUT2($G(NURFAC(2))),$S($G(NURFAC(2))=" BLANK":"NO FACILITY",1:$G(NURFAC(2)))
W !,"FTEE PROFILE BY LOCATION AND SERVICE CATEGORY" S X="T" D ^%DT D:+Y D^DIQ W ?56,Y,?72,"PAGE: ",NURPAGE
W !,"SERVICE",?36,"EMPLOYEE"
W !,"CATEGORY",?22,"FTEE",?36,"NAME",?64,"LOCATION" W:IOM>120 ?85,"TOUR"
W !
S NURLINE="",$P(NURLINE,"-",IOM)="" W NURLINE
NHDR1 I $G(NURPROG(2))'="",$G(NURPROG(2))'=" BLANK" W !?$$CNTR^NURSUT2(NURPROG(2)),$S($E(NURPROG(2),1)=" ":$E(NURPROG(2),2,99),1:$G(NURPROG(2))) W !?$$CNTR^NURSUT2(NURPROG(2)),$$REPEAT^XLFSTR("-",$L(NURPROG(2))+1),!
Q
NSUB ; SUBTOTAL ROUTINE
D:($Y>(IOSL-6)) NHDR Q:NURQUIT W !?21,"-----"
W !,"SUBTOTAL",?18,$J(NSUBT,8,3),!,"SUBCOUNT",?18,$J(NSUBC,8,3),!,"SUBMEAN" W ?18,$S(NSUBC'=0:$J((NSUBT/NSUBC),8,3),1:" 0.000")
S NCT=NSUBT+NCT,NTCT=NTCT+NSUBC
S (NSUBC,NSUBM,NSUBT)=0
Q
PSUB ; PRODUCT LINE SUBTOTAL ROUTINE
D:($Y>(IOSL-6)) NHDR Q:NURQUIT W !,$S($E(NURPROG(2),1)=" ":$E(NURPROG(2),2,99),1:NURPROG(2))_" TOTALS" W !?20,"******"
W !,"SUBTOTAL",?18,$J(PSUBT,8,3) W:PSUBC'=(0.0) !,"SUBCOUNT",?18,$J(PSUBC,8,3),!,"SUBMEAN" W ?18,$S(PSUBC'=0:$J((PSUBT/PSUBC),8,3),1:" 0.000"),!!
S PCT=PSUBT+PCT
S (PSUBC,PSUBM,PSUBT)=0
Q
FSUB ; FACILITY SUBTOTAL ROUTINE
D:($Y>(IOSL-6)) NHDR Q:NURQUIT W !,NURFAC(2)_" TOTALS" S NURLINE="",$P(NURLINE,"*",7)="" W !?20,NURLINE
W !,"SUBTOTAL",?18,$J(FSUBT,8,3) W:FSUBC'=(0.0) !,"SUBCOUNT",?18,$J(FSUBC,8,3),!,"SUBMEAN" W ?18,$S(FSUBC'=0:$J((FSUBT/FSUBC),8,3),1:" 0>000")
S FCT=FSUBT+FCT
S (FSUBC,FSUBM,FSUBT)=0
Q
SORT W ! S NRPT=3 D EN1^NURA9D11
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 NHDR 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 NHDR 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 NHDR S NURSW1=1 D NODATA^NURSUT1
. . Q
. Q
Q
NURA9D1 ;HIRMFO/MD,RM,FT-FTEE PROFILE BY LOCATION AND SERVICE CATEGORY ;5/2/97 10:16
+1 ;;4.0;NURSING SERVICE;**1,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 (NURPLSW,NUROUT,NURMDSW,NURQUEUE)=0
+4 DO EN1^NURSAUTL
IF $GET(NUROUT)
GOTO QUIT
+5 DO EN9^NURSAGSP
+6 IF NURMDSW
SET DIC(0)="AEMQZ"
SET NURPLSCR=1
DO EN5^NURSAGSP
KILL NURPLSCR
IF $GET(NUROUT)
GOTO QUIT
+7 IF NURMDSW=0
IF NURPLSW=1
SET NURPLSCR=1
DO PRD^NURSAGSP
KILL NURPLSCR
IF $GET(NUROUT)
GOTO QUIT
+8 WRITE !
DO EN1^NURSAGSP
IF $GET(NUROUT)
GOTO QUIT
+9 DO EN3^NURSAGSP
IF $GET(NUROUT)
GOTO QUIT
+10 DO EN5^NURSAGP0
WRITE !
IF $GET(NUROUT)
GOTO QUIT
+11 SET ZTDESC="Nursing FTEE Profile by Location & Service Category"
SET ZTRTN="START^NURA9D1"
DO EN7^NURSUT0
IF POP!($DATA(ZTSK))
GOTO QUIT
START ;
+1 KILL ^TMP($JOB),^TMP("NURA",$JOB),^TMP("NURLOC",$JOB)
USE IO
SET (NBRK,NURPAGE,NURSW1,NURQUIT,NTCT,NCT,NSUBT,NSUBC,PCT,PSUBT,PSUBC,FCT,FSUBT,FSUBC)=0
+2 DO SORT
IF NUROUT
GOTO QUIT
DO NPRINT
IF NURQUIT
SET NCT=NCT+NSUBT
IF ($Y>(IOSL-6))
IF 'NURQUIT
DO NHDR
+3 SET NURLINE=""
SET $PIECE(NURLINE,"*",7)=""
+4 DO EN2^NURAED3
WRITE !!,?20,NURLINE,!,"REPORT TOTAL",?18,$JUSTIFY(NCT,8,3),!!,"COUNT - ASSIGN.",?18,$JUSTIFY(NTCT,8,3)
WRITE ?36,"PERSONNEL",?62,$JUSTIFY(NTOT,8,3)
+5 WRITE !!,"MEAN - ASSIGN.",?18,$SELECT(NCT>0&(NTCT>0):$JUSTIFY((NCT/NTCT),8,3),1:" 0.000"),?36,"PERSONNEL",?62,$SELECT(NCT>0&(NTOT>0):$JUSTIFY((NCT/NTOT),8,3),1:" 0.000")
QUIT KILL ^TMP("NURA",$JOB),^TMP($JOB),NTOUR,NUR,NUM
DO CLOSE^NURSUT1
DO ^NURAKILL
+1 QUIT
NPRINT SET (NURPROG(2),NURFAC(2))=""
FOR
SET NURFAC(2)=$ORDER(^TMP($JOB,"L",NURFAC(2)))
IF NURFAC(2)=""!NURQUIT
QUIT
DO NK
IF NURQUIT
QUIT
IF NURMDSW
DO FSUB
IF NURQUIT
QUIT
+1 QUIT
NK FOR
SET NURPROG(2)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2)))
IF NURPROG(2)=""!NURQUIT
QUIT
DO NHDR
IF NURQUIT
QUIT
DO NL
IF NURQUIT
QUIT
IF NURPLSW
DO PSUB
IF NURQUIT
QUIT
+1 QUIT
NL SET NL1=""
FOR
SET NL1=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NL1))
IF NL1=""!NURQUIT
QUIT
DO NM
IF NURQUIT
QUIT
DO NHDR
IF NURQUIT
QUIT
+1 QUIT
NM SET NURCAT=""
FOR
SET NURCAT=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NL1,NURCAT))
IF NURCAT=""!NURQUIT
QUIT
DO NN
IF NURQUIT
QUIT
DO NSUB
WRITE !
IF NURQUIT
QUIT
+1 QUIT
NN SET NFTEE=""
FOR
SET NFTEE=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NL1,NURCAT,NFTEE))
IF NFTEE=""!NURQUIT
QUIT
SET NURSORT=$GET(^(NFTEE))
IF NURSORT
DO NOT
IF NURQUIT
QUIT
+1 QUIT
NOT SET N1=""
FOR
SET N1=$ORDER(^TMP($JOB,"L1",NURSORT,N1))
IF N1=""!NURQUIT
QUIT
SET NUM(1)=0
FOR
SET NUM(1)=$ORDER(^TMP($JOB,"L1",NURSORT,N1,NUM(1)))
IF NUM(1)'>0!NURQUIT
QUIT
DO NOT1
+1 QUIT
NOT1 SET NUM(2)=0
FOR
SET NUM(2)=$ORDER(^TMP($JOB,"L1",NURSORT,N1,NUM(1),NUM(2)))
IF NUM(2)'>0
QUIT
DO NP
IF NURQUIT
QUIT
+1 QUIT
NP SET DA(1)=0
FOR
SET DA(1)=$ORDER(^TMP($JOB,"L1",NURSORT,N1,NUM(1),NUM(2),DA(1)))
IF DA(1)'>0
QUIT
DO NPPRINT
IF NURQUIT
QUIT
+1 QUIT
NPPRINT IF ($Y>(IOSL-6))
DO NHDR
IF NURQUIT
QUIT
+1 SET NTOUR=DA(1)
Begin DoDot:1
+2 NEW DA
SET DA=NTOUR
DO EN9^NURSUT0
End DoDot:1
SET NTOUR=NUR(1)
+3 SET NURSW1=1
SET ^TMP("NURA",$JOB,DA(1),NURSORT)=""
+4 SET NSUBT=NSUBT+NFTEE
SET NSUBC=NSUBC+1
SET NSUBM=NSUBT/NSUBC
+5 SET PSUBT=PSUBT+NFTEE
SET PSUBC=PSUBC+1
SET PSUBM=PSUBT/PSUBC
+6 SET FSUBT=FSUBT+NFTEE
SET FSUBC=FSUBC+1
SET FSUBM=FSUBT/FSUBC
+7 WRITE !,$SELECT(+NFTEE:" ",1:"** ")
+8 IF NURCAT'=" BLANK"
WRITE $$CAT^NURSUT2(NURCAT)
+9 IF NFTEE'=" BLANK"
WRITE ?18,$JUSTIFY(NFTEE,8,3)
+10 IF N1'=" BLANK"
WRITE ?36,$EXTRACT(N1,1,20)
+11 IF NL1'=" BLANK"
WRITE ?64,$EXTRACT(NL1,1,15)
IF IOM>120
WRITE ?85,NTOUR
IF NURQUIT
QUIT
+12 QUIT
NHDR IF 'NURQUEUE
IF NURSW1
IF $EXTRACT(IOST)="C"
DO ENDPG^NURSUT1
IF $GET(NUROUT)
SET NURQUIT=+NUROUT
IF NURQUIT
QUIT
+1 SET NURPAGE=NURPAGE+1
IF $EXTRACT(IOST)="C"!(NURPAGE>1)
WRITE @IOF
+2 IF NURMDSW
IF $GET(NWRD)=""
WRITE !,?$$CNTR^NURSUT2($GET(NURFAC(2))),$SELECT($GET(NURFAC(2))=" BLANK":"NO FACILITY",1:$GET(NURFAC(2)))
+3 WRITE !,"FTEE PROFILE BY LOCATION AND SERVICE CATEGORY"
SET X="T"
DO ^%DT
IF +Y
DO D^DIQ
WRITE ?56,Y,?72,"PAGE: ",NURPAGE
+4 WRITE !,"SERVICE",?36,"EMPLOYEE"
+5 WRITE !,"CATEGORY",?22,"FTEE",?36,"NAME",?64,"LOCATION"
IF IOM>120
WRITE ?85,"TOUR"
+6 WRITE !
+7 SET NURLINE=""
SET $PIECE(NURLINE,"-",IOM)=""
WRITE NURLINE
NHDR1 IF $GET(NURPROG(2))'=""
IF $GET(NURPROG(2))'=" BLANK"
WRITE !?$$CNTR^NURSUT2(NURPROG(2)),$SELECT($EXTRACT(NURPROG(2),1)=" ":$EXTRACT(NURPROG(2),2,99),1:$GET(NURPROG(2)))
WRITE !?$$CNTR^NURSUT2(NURPROG(2)),$$REPEAT^XLFSTR("-",$LENGTH(NURPROG(2))+1),!
+1 QUIT
NSUB ; SUBTOTAL ROUTINE
+1 IF ($Y>(IOSL-6))
DO NHDR
IF NURQUIT
QUIT
WRITE !?21,"-----"
+2 WRITE !,"SUBTOTAL",?18,$JUSTIFY(NSUBT,8,3),!,"SUBCOUNT",?18,$JUSTIFY(NSUBC,8,3),!,"SUBMEAN"
WRITE ?18,$SELECT(NSUBC'=0:$JUSTIFY((NSUBT/NSUBC),8,3),1:" 0.000")
+3 SET NCT=NSUBT+NCT
SET NTCT=NTCT+NSUBC
+4 SET (NSUBC,NSUBM,NSUBT)=0
+5 QUIT
PSUB ; PRODUCT LINE SUBTOTAL ROUTINE
+1 IF ($Y>(IOSL-6))
DO NHDR
IF NURQUIT
QUIT
WRITE !,$SELECT($EXTRACT(NURPROG(2),1)=" ":$EXTRACT(NURPROG(2),2,99),1:NURPROG(2))_" TOTALS"
WRITE !?20,"******"
+2 WRITE !,"SUBTOTAL",?18,$JUSTIFY(PSUBT,8,3)
IF PSUBC'=(0.0)
WRITE !,"SUBCOUNT",?18,$JUSTIFY(PSUBC,8,3),!,"SUBMEAN"
WRITE ?18,$SELECT(PSUBC'=0:$JUSTIFY((PSUBT/PSUBC),8,3),1:" 0.000"),!!
+3 SET PCT=PSUBT+PCT
+4 SET (PSUBC,PSUBM,PSUBT)=0
+5 QUIT
FSUB ; FACILITY SUBTOTAL ROUTINE
+1 IF ($Y>(IOSL-6))
DO NHDR
IF NURQUIT
QUIT
WRITE !,NURFAC(2)_" TOTALS"
SET NURLINE=""
SET $PIECE(NURLINE,"*",7)=""
WRITE !?20,NURLINE
+2 WRITE !,"SUBTOTAL",?18,$JUSTIFY(FSUBT,8,3)
IF FSUBC'=(0.0)
WRITE !,"SUBCOUNT",?18,$JUSTIFY(FSUBC,8,3),!,"SUBMEAN"
WRITE ?18,$SELECT(FSUBC'=0:$JUSTIFY((FSUBT/FSUBC),8,3),1:" 0>000")
+3 SET FCT=FSUBT+FCT
+4 SET (FSUBC,FSUBM,FSUBT)=0
+5 QUIT
SORT WRITE !
SET NRPT=3
DO EN1^NURA9D11
+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 NHDR
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 NHDR
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 NHDR
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