NURA6D1 ;HIRMFO/MD,RM,FT-FTEE PROFILE BY SERVICE CATEGORY ;8/23/96 12:06
;;4.0;NURSING SERVICE;;Apr 25, 1997
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
S (NURSUMSW,NURPLSW,NURMDSW,NUROUT,NURQUEUE)=0
D EN1^NURSAUTL G QUIT:NUROUT
D EN9^NURSAGSP
I NURMDSW D EN12^NURSAGSP G:$G(NUROUT) QUIT S DIC(0)="AEMQZ",NURPLSCR=0 D EN5^NURSAGSP K NURPLSCR I $G(NUROUT) G QUIT
I NURMDSW=0,NURPLSW=1 S NURPLSCR=0 D PRD^NURSAGSP K NURPLSCR I $G(NUROUT) G QUIT
D EN3^NURSAGSP G:NUROUT QUIT
D EN5^NURSAGP0 G QUIT:NUROUT
W ! S ZTDESC="FTEE Profile by Service Category",ZTRTN="START^NURA6D1" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
K ^TMP($J),^TMP("NURA",$J) U IO S (NBRK,NURPAGE,NURSW1,NURQUIT,NCT,NTCT,NSUBT,NSUBC,PCT,PSUBT,PSUBC,FCT,FSUBT,FSUBC)=0
D SORT G:NUROUT QUIT D:$G(NURSUMSW) NHDR Q:NURQUIT D NPRINT S:NURQUIT NCT=NCT+NSUBT I ($Y>(IOSL-6)),'NURQUIT D NHDR Q:NURQUIT
S NURLINE="",$P(NURLINE,"*",7)=""
D EN2^NURAED3 W !!,?20,NURLINE,!,"TOTAL",?18,$J(NCT,8,3),!!,"COUNT - ASSIGN.",?18,$J(NTCT,8,3),?36,"PERSONNEL",?61,$J(NTOT,8,3)
W !!,"MEAN - ASSIGN.",?18,$S(NCT>0&(NTCT>0):$J((NCT/NTCT),8,3),1:" 0.000"),?36,"PERSONNEL",?61,$S(NCT>0&(NTOT>0):$J((NCT/NTOT),8,3),1:" 0.000")
QUIT K ^TMP("NURA",$J),^TMP($J) 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 Q:NURQUIT D NJ Q:NURQUIT D:NURMDSW FSUB Q:NURQUIT
Q
NJ F S NURPROG(2)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2))) Q:NURPROG(2)=""!NURQUIT D:'$G(NURSUMSW) NHDR Q:NURQUIT D NK Q:NURQUIT I $G(NURPLSW),'$G(NURSUMSW) D PSUB Q:NURQUIT
Q
NK S NURCAT="" F S NURCAT=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NURCAT)) Q:NURCAT="" D NL Q:NURQUIT D NSUB W:'$G(NURSUMSW) ! Q:NURQUIT
Q
NL S NFTEE="" F S NFTEE=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NURCAT,NFTEE)) Q:NFTEE=""!NURQUIT D NM Q:NURQUIT
Q
NM S DA(1)=0 F S DA(1)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NURCAT,NFTEE,DA(1))) Q:DA(1)'>0 D NN Q:NURQUIT
Q
NN S DA(2)=0 F S DA(2)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NURCAT,NFTEE,DA(1),DA(2))) Q:DA(2)'>0 S NURSORT=$G(^(DA(2))) I NURSORT D NO Q:NURQUIT
Q
NO S N1="" F S N1=$O(^TMP($J,"L1",NURSORT,N1)) Q:N1="" D NP Q:NURQUIT
Q
NP S D1=0 F S D1=$O(^TMP($J,"L1",NURSORT,N1,D1)) Q:D1'>0 D NPPRINT Q:NURQUIT
Q
NPPRINT I ($Y>(IOSL-6)) D NHDR Q:NURQUIT
S NPWARD=$P(^NURSF(211.8,DA(2),0),"^") D EN7^NURSAUTL S NL1=NPWARD
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
Q:NURSUMSW
W !,$S(+NFTEE:" ",1:"** ")
W:NURCAT'=" BLANK" ?2,$$CAT^NURSUT2(NURCAT)
W:NFTEE'=" BLANK" ?18,$J(NFTEE,8,3)
W:N1'=" BLANK" ?36,$E(N1,1,20)
W:NL1'=" BLANK" ?64,NL1 Q:NURQUIT
Q
NHDR ;
I 'NURQUEUE,NURSW1,$E(IOST)="C" D ENDPG^NURSUT1 S:NUROUT NURQUIT=+NUROUT Q:NURQUIT
S NURPAGE=NURPAGE+1 W:$E(IOST)="C"!(NURPAGE>1) @IOF
I NURMDSW,'NURSUMSW W !,?$$CNTR^NURSUT2(NURFAC(2)),$S($G(NURFAC(2))=" BLANK":"NO FACILITY",1:$G(NURFAC(2)))
W !,"FTEE PROFILE BY SERVICE CATEGORY" S X="T" D ^%DT D:+Y D^DIQ W ?56,Y,?72,"PAGE: ",NURPAGE
W !
W !!,"SERVICE",?36,"EMPLOYEE"
W !,"CATEGORY",?22,"FTEE",?36,"NAME",?64,"LOCATION"
W !,$$REPEAT^XLFSTR("-",80)
I NURPLSW,'$G(NURSUMSW) D NHDR1^NURA9D1
Q
NSUB ; SUBTOTAL ROUTINE
I 'NURSUMSW D:($Y>(IOSL-6)) NHDR Q:NURQUIT W !?21,$$REPEAT^XLFSTR("-",5)
I 'NURSUMSW 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,$$REPEAT^XLFSTR("*",6)
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
W:$G(NURSUMSW) !
Q
SORT S NURNEN=1,NRPT=3 D EN2^NURA9D11
S X=$O(^TMP($J,"")) I X="" S NURFAC(2)=$S($G(NURFAC)=0:NURFAC(1),1:""),NURPROG(2)=$S($G(NURPROG)=0:NURPROG(1),1:"") D NHDR W !,"THERE IS NO DATA FOR THIS REPORT" S NUROUT=1
Q
NURA6D1 ;HIRMFO/MD,RM,FT-FTEE PROFILE BY SERVICE CATEGORY ;8/23/96 12:06
+1 ;;4.0;NURSING SERVICE;;Apr 25, 1997
+2 IF '$DATA(^DIC(213.9,1,"OFF"))
QUIT
IF $PIECE(^DIC(213.9,1,"OFF"),"^",1)=1
QUIT
+3 SET (NURSUMSW,NURPLSW,NURMDSW,NUROUT,NURQUEUE)=0
+4 DO EN1^NURSAUTL
IF NUROUT
GOTO QUIT
+5 DO EN9^NURSAGSP
+6 IF NURMDSW
DO EN12^NURSAGSP
IF $GET(NUROUT)
GOTO QUIT
SET DIC(0)="AEMQZ"
SET NURPLSCR=0
DO EN5^NURSAGSP
KILL NURPLSCR
IF $GET(NUROUT)
GOTO QUIT
+7 IF NURMDSW=0
IF NURPLSW=1
SET NURPLSCR=0
DO PRD^NURSAGSP
KILL NURPLSCR
IF $GET(NUROUT)
GOTO QUIT
+8 DO EN3^NURSAGSP
IF NUROUT
GOTO QUIT
+9 DO EN5^NURSAGP0
IF NUROUT
GOTO QUIT
+10 WRITE !
SET ZTDESC="FTEE Profile by Service Category"
SET ZTRTN="START^NURA6D1"
DO EN7^NURSUT0
IF POP!($DATA(ZTSK))
GOTO QUIT
START ;
+1 KILL ^TMP($JOB),^TMP("NURA",$JOB)
USE IO
SET (NBRK,NURPAGE,NURSW1,NURQUIT,NCT,NTCT,NSUBT,NSUBC,PCT,PSUBT,PSUBC,FCT,FSUBT,FSUBC)=0
+2 DO SORT
IF NUROUT
GOTO QUIT
IF $GET(NURSUMSW)
DO NHDR
IF NURQUIT
QUIT
DO NPRINT
IF NURQUIT
SET NCT=NCT+NSUBT
IF ($Y>(IOSL-6))
IF 'NURQUIT
DO NHDR
IF NURQUIT
QUIT
+3 SET NURLINE=""
SET $PIECE(NURLINE,"*",7)=""
+4 DO EN2^NURAED3
WRITE !!,?20,NURLINE,!,"TOTAL",?18,$JUSTIFY(NCT,8,3),!!,"COUNT - ASSIGN.",?18,$JUSTIFY(NTCT,8,3),?36,"PERSONNEL",?61,$JUSTIFY(NTOT,8,3)
+5 WRITE !!,"MEAN - ASSIGN.",?18,$SELECT(NCT>0&(NTCT>0):$JUSTIFY((NCT/NTCT),8,3),1:" 0.000"),?36,"PERSONNEL",?61,$SELECT(NCT>0&(NTOT>0):$JUSTIFY((NCT/NTOT),8,3),1:" 0.000")
QUIT KILL ^TMP("NURA",$JOB),^TMP($JOB)
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
IF NURQUIT
QUIT
DO NJ
IF NURQUIT
QUIT
IF NURMDSW
DO FSUB
IF NURQUIT
QUIT
+1 QUIT
NJ FOR
SET NURPROG(2)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2)))
IF NURPROG(2)=""!NURQUIT
QUIT
IF '$GET(NURSUMSW)
DO NHDR
IF NURQUIT
QUIT
DO NK
IF NURQUIT
QUIT
IF $GET(NURPLSW)
IF '$GET(NURSUMSW)
DO PSUB
IF NURQUIT
QUIT
+1 QUIT
NK SET NURCAT=""
FOR
SET NURCAT=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NURCAT))
IF NURCAT=""
QUIT
DO NL
IF NURQUIT
QUIT
DO NSUB
IF '$GET(NURSUMSW)
WRITE !
IF NURQUIT
QUIT
+1 QUIT
NL SET NFTEE=""
FOR
SET NFTEE=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NURCAT,NFTEE))
IF NFTEE=""!NURQUIT
QUIT
DO NM
IF NURQUIT
QUIT
+1 QUIT
NM SET DA(1)=0
FOR
SET DA(1)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NURCAT,NFTEE,DA(1)))
IF DA(1)'>0
QUIT
DO NN
IF NURQUIT
QUIT
+1 QUIT
NN SET DA(2)=0
FOR
SET DA(2)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NURCAT,NFTEE,DA(1),DA(2)))
IF DA(2)'>0
QUIT
SET NURSORT=$GET(^(DA(2)))
IF NURSORT
DO NO
IF NURQUIT
QUIT
+1 QUIT
NO SET N1=""
FOR
SET N1=$ORDER(^TMP($JOB,"L1",NURSORT,N1))
IF N1=""
QUIT
DO NP
IF NURQUIT
QUIT
+1 QUIT
NP SET D1=0
FOR
SET D1=$ORDER(^TMP($JOB,"L1",NURSORT,N1,D1))
IF D1'>0
QUIT
DO NPPRINT
IF NURQUIT
QUIT
+1 QUIT
NPPRINT IF ($Y>(IOSL-6))
DO NHDR
IF NURQUIT
QUIT
+1 SET NPWARD=$PIECE(^NURSF(211.8,DA(2),0),"^")
DO EN7^NURSAUTL
SET NL1=NPWARD
+2 SET NURSW1=1
SET ^TMP("NURA",$JOB,DA(1),NURSORT)=""
+3 SET NSUBT=NSUBT+NFTEE
SET NSUBC=NSUBC+1
SET NSUBM=NSUBT/NSUBC
+4 SET PSUBT=PSUBT+NFTEE
SET PSUBC=PSUBC+1
SET PSUBM=PSUBT/PSUBC
+5 SET FSUBT=FSUBT+NFTEE
SET FSUBC=FSUBC+1
SET FSUBM=FSUBT/FSUBC
+6 IF NURSUMSW
QUIT
+7 WRITE !,$SELECT(+NFTEE:" ",1:"** ")
+8 IF NURCAT'=" BLANK"
WRITE ?2,$$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,NL1
IF NURQUIT
QUIT
+12 QUIT
NHDR ;
+1 IF 'NURQUEUE
IF NURSW1
IF $EXTRACT(IOST)="C"
DO ENDPG^NURSUT1
IF NUROUT
SET NURQUIT=+NUROUT
IF NURQUIT
QUIT
+2 SET NURPAGE=NURPAGE+1
IF $EXTRACT(IOST)="C"!(NURPAGE>1)
WRITE @IOF
+3 IF NURMDSW
IF 'NURSUMSW
WRITE !,?$$CNTR^NURSUT2(NURFAC(2)),$SELECT($GET(NURFAC(2))=" BLANK":"NO FACILITY",1:$GET(NURFAC(2)))
+4 WRITE !,"FTEE PROFILE BY SERVICE CATEGORY"
SET X="T"
DO ^%DT
IF +Y
DO D^DIQ
WRITE ?56,Y,?72,"PAGE: ",NURPAGE
+5 WRITE !
+6 WRITE !!,"SERVICE",?36,"EMPLOYEE"
+7 WRITE !,"CATEGORY",?22,"FTEE",?36,"NAME",?64,"LOCATION"
+8 WRITE !,$$REPEAT^XLFSTR("-",80)
+9 IF NURPLSW
IF '$GET(NURSUMSW)
DO NHDR1^NURA9D1
+10 QUIT
NSUB ; SUBTOTAL ROUTINE
+1 IF 'NURSUMSW
IF ($Y>(IOSL-6))
DO NHDR
IF NURQUIT
QUIT
WRITE !?21,$$REPEAT^XLFSTR("-",5)
+2 IF 'NURSUMSW
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,$$REPEAT^XLFSTR("*",6)
+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 IF $GET(NURSUMSW)
WRITE !
+6 QUIT
SORT SET NURNEN=1
SET NRPT=3
DO EN2^NURA9D11
+1 SET X=$ORDER(^TMP($JOB,""))
IF X=""
SET NURFAC(2)=$SELECT($GET(NURFAC)=0:NURFAC(1),1:"")
SET NURPROG(2)=$SELECT($GET(NURPROG)=0:NURPROG(1),1:"")
DO NHDR
WRITE !,"THERE IS NO DATA FOR THIS REPORT"
SET NUROUT=1
+2 QUIT