NURA6D2 ;HIRMFO/MD,RM,FT-FTEE PROFILE BY SERVICE POSITION ;8/24/96 10:29
;;4.0;NURSING SERVICE;**7**;Apr 25, 1997
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
S (NURSUMSW,NUROUT,NURMDSW,NURPLSW,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
W ! D EN2^NURSAGSP G:NUROUT QUIT
D EN5^NURSAGP0 G QUIT:NUROUT
W ! S ZTDESC="FTEE Profile by Service Position",ZTRTN="START^NURA6D2" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
K ^TMP($J),^TMP("NURA",$J) U IO S (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
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 D NL Q:NURQUIT D:NURMDSW FSUB Q:NURQUIT
Q
NL F S NURPROG(2)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2))) Q:NURPROG(2)=""!NURQUIT D:'$G(NURSUMSW) NHDR D NM Q:NURQUIT I $G(NURPLSW),'$G(NURSUMSW) D PSUB Q:NURQUIT
Q
NM S NPRI="" F S NPRI=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI)) Q:NPRI="" D NE Q:NURQUIT D NSUB W:'$G(NURSUMSW) ! Q:NURQUIT
Q
NE S NSPO="" F S NSPO=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPO)) Q:NSPO="" D NN Q:NURQUIT
Q
NN S NFTEE="" F S NFTEE=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPO,NFTEE)) Q:NFTEE=""!NURQUIT D NO Q:NURQUIT
Q
NO S DA(1)=0 F S DA(1)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPO,NFTEE,DA(1))) Q:DA(1)'>0 D NP Q:NURQUIT
Q
NP S DA(2)=0 F S DA(2)=$O(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPO,NFTEE,DA(1),DA(2))) Q:DA(2)'>0 S NURSORT=$G(^(DA(2))) I NURSORT D NQ
Q
NQ S N1="" F S N1=$O(^TMP($J,"L1",NURSORT,N1)) Q:N1="" D NR Q:NURQUIT
Q
NR S DA=0 F S DA=$O(^TMP($J,"L1",NURSORT,N1,DA)) Q:DA'>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:$G(NURSUMSW)
W !,$S(+NFTEE:" ",1:"** ")
W:NSPO'=" BLANK" ?2,NSPO
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 W !,?$$CNTR^NURSUT2(NURFAC(2)),$S($G(NURFAC(2))=" BLANK":"NO FACILITY",1:$G(NURFAC(2)))
W !,"FTEE PROFILE BY SERVICE POSITION" S X="T" D ^%DT D:+Y D^DIQ W ?56,Y,?72,"PAGE: ",NURPAGE
W !!,"SERVICE",?36,"EMPLOYEE"
W !,"POSITION",?22,"FTEE",?36,"NAME",?64,"LOCATION"
W !,$$REPEAT^XLFSTR("-",80)
I NURPLSW,'$G(NURSUMSW) D NHDR1^NURA9D1
Q
NSUB ; SUBTOTAL ROUTINE
I '$G(NURSUMSW) D:($Y>(IOSL-6)) NHDR Q:NURQUIT W !?21,$$REPEAT^XLFSTR("-",5)
I '$G(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 W ! S NURNEN=2,NRPT=3 D EN2^NURA9D11
S X=$O(^TMP($J,"")) I X="" S NURPROG(2)=$S($G(NURPROG)=0:NURPROG(1),1:"") D NHDR W !,"THERE IS NO DATA FOR THIS REPORT" S NUROUT=1
Q
NURA6D2 ;HIRMFO/MD,RM,FT-FTEE PROFILE BY SERVICE POSITION ;8/24/96 10:29
+1 ;;4.0;NURSING SERVICE;**7**;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,NUROUT,NURMDSW,NURPLSW,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 WRITE !
DO EN2^NURSAGSP
IF NUROUT
GOTO QUIT
+9 DO EN5^NURSAGP0
IF NUROUT
GOTO QUIT
+10 WRITE !
SET ZTDESC="FTEE Profile by Service Position"
SET ZTRTN="START^NURA6D2"
DO EN7^NURSUT0
IF POP!($DATA(ZTSK))
GOTO QUIT
START ;
+1 KILL ^TMP($JOB),^TMP("NURA",$JOB)
USE IO
SET (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
+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
DO NL
IF NURQUIT
QUIT
IF NURMDSW
DO FSUB
IF NURQUIT
QUIT
+1 QUIT
NL FOR
SET NURPROG(2)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2)))
IF NURPROG(2)=""!NURQUIT
QUIT
IF '$GET(NURSUMSW)
DO NHDR
DO NM
IF NURQUIT
QUIT
IF $GET(NURPLSW)
IF '$GET(NURSUMSW)
DO PSUB
IF NURQUIT
QUIT
+1 QUIT
NM SET NPRI=""
FOR
SET NPRI=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NPRI))
IF NPRI=""
QUIT
DO NE
IF NURQUIT
QUIT
DO NSUB
IF '$GET(NURSUMSW)
WRITE !
IF NURQUIT
QUIT
+1 QUIT
NE SET NSPO=""
FOR
SET NSPO=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NPRI,NSPO))
IF NSPO=""
QUIT
DO NN
IF NURQUIT
QUIT
+1 QUIT
NN SET NFTEE=""
FOR
SET NFTEE=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NPRI,NSPO,NFTEE))
IF NFTEE=""!NURQUIT
QUIT
DO NO
IF NURQUIT
QUIT
+1 QUIT
NO SET DA(1)=0
FOR
SET DA(1)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NPRI,NSPO,NFTEE,DA(1)))
IF DA(1)'>0
QUIT
DO NP
IF NURQUIT
QUIT
+1 QUIT
NP SET DA(2)=0
FOR
SET DA(2)=$ORDER(^TMP($JOB,"L",NURFAC(2),NURPROG(2),NPRI,NSPO,NFTEE,DA(1),DA(2)))
IF DA(2)'>0
QUIT
SET NURSORT=$GET(^(DA(2)))
IF NURSORT
DO NQ
+1 QUIT
NQ SET N1=""
FOR
SET N1=$ORDER(^TMP($JOB,"L1",NURSORT,N1))
IF N1=""
QUIT
DO NR
IF NURQUIT
QUIT
+1 QUIT
NR SET DA=0
FOR
SET DA=$ORDER(^TMP($JOB,"L1",NURSORT,N1,DA))
IF DA'>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 $GET(NURSUMSW)
QUIT
+7 WRITE !,$SELECT(+NFTEE:" ",1:"** ")
+8 IF NSPO'=" BLANK"
WRITE ?2,NSPO
+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 IF 'NURQUEUE
IF NURSW1
IF $EXTRACT(IOST)="C"
DO ENDPG^NURSUT1
IF NUROUT
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)),$SELECT($GET(NURFAC(2))=" BLANK":"NO FACILITY",1:$GET(NURFAC(2)))
+3 WRITE !,"FTEE PROFILE BY SERVICE POSITION"
SET X="T"
DO ^%DT
IF +Y
DO D^DIQ
WRITE ?56,Y,?72,"PAGE: ",NURPAGE
+4 WRITE !!,"SERVICE",?36,"EMPLOYEE"
+5 WRITE !,"POSITION",?22,"FTEE",?36,"NAME",?64,"LOCATION"
+6 WRITE !,$$REPEAT^XLFSTR("-",80)
+7 IF NURPLSW
IF '$GET(NURSUMSW)
DO NHDR1^NURA9D1
+8 QUIT
NSUB ; SUBTOTAL ROUTINE
+1 IF '$GET(NURSUMSW)
IF ($Y>(IOSL-6))
DO NHDR
IF NURQUIT
QUIT
WRITE !?21,$$REPEAT^XLFSTR("-",5)
+2 IF '$GET(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 WRITE !
SET NURNEN=2
SET NRPT=3
DO EN2^NURA9D11
+1 SET X=$ORDER(^TMP($JOB,""))
IF X=""
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