VistA-FOIAVistA/r/NURSING_SERVICE-NUR/NURA6D1.m

82 lines
4.4 KiB
Mathematica

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