NURA5C ;HIRMFO/MD,FT-SALARY REPORT BY LOCATION AND SVC. CATEGORY
;;4.0;NURSING SERVICE;**21**;Apr 25, 1997
S X=$G(^DIC(213.9,1,"OFF")) Q:X=""!(X=1)
W !
S (NURQUEUE,NURSW1,NURPAGE,NUROUT)=0
D EN1^NURSAUTL G QUIT:NUROUT
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:$G(NUROUT) QUIT
D EN3^NURSAGSP G:$G(NUROUT) QUIT
W ! S ZTDESC="Salary Report by location and service category",ZTRTN="START^NURA5C" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
K ^TMP($J) S (CAVG,NAVG,FAVG,LAVG,PAVG,NSALT,PSALT,FSALT,CSALT,LSALT,CSUBC,NSUBC,PSUBC,FSUBC,LSUBC)=0
S X="" F I=0:0 S X=$O(^NURSF(210,"AC",X)) Q:X="" I X'="R" F DA=0:0 S DA=$O(^NURSF(210,"AC",X,DA)) Q:DA'>0 I $D(^NURSF(210,DA,0)),+$P(^(0),U) S DA(1)=$P(^(0),U) D BLD1
I '$D(^TMP($J)) S NURPROG(2)=$S($G(NURPROG(1))'="":NURPROG(1),1:"") D HEADER W !,"THERE IS NO DATA FOR THIS REPORT" G QUIT
U IO D PRINT
S:NUROUT NSALT=NSALT+CSALT D:'NUROUT PGCHK Q:NUROUT
S:+NSALT>0 NAVG=NSALT/NSUBC S X="",$P(X,"*",13)="" W !!?22,X,!,"EMPLOYEES COUNTED",?25,$J(NSUBC,9,2),!,"REPORT TOTAL ",?22,$J(NSALT,12,2),!,"AVERAGE SALARY ",?22,$J(NAVG,12,2)
QUIT K ^TMP($J) D CLOSE^NURSUT1,^NURAKILL
Q
BLD1 F NURNODE4=0:0 S NURNODE4=$O(^NURSF(211.8,"C",DA(1),NURNODE4)) Q:NURNODE4'>0 F NURNODE5=0:0 S NURNODE5=$O(^NURSF(211.8,"C",DA(1),NURNODE4,NURNODE5)) Q:NURNODE5'>0 D
.I $D(^NURSF(211.8,NURNODE4,1,NURNODE5,0)),$P(^(0),U)'>DT&(('$P(^(0),U,6))!($P(^(0),U,6)'
7&(NURSZDA'=DA) S NURSZORT=1 D EN3^NURSAUTL:NURSZAP>6,EN2^NURSAUTL:NURSZORT&NURSZAP Q:'NURSZORT
S NLOCN=$S($D(^NURSF(211.8,NURNODE4,0)):$P(^(0),U),1:" BLANK")
I +NLOCN S NPWARD=NLOCN D EN7^NURSAUTL S NLOCN(1)=$S(NPWARD'="":$E(NPWARD,1,10),1:" BLANK")
W:$E(IOST)="C"&($R(100)) "." S NURNEN=4 D SETFAC^NURAAGS1,SETPROG^NURAAGS1,SETCAT^NURAAGS1
I $G(NURMDSW),$G(NURFAC)=0,$G(NURFAC(1))'=$G(NURFAC(2)) Q
I $G(NURHOSP)=0,'$D(NURSNLOC(NLOCN(1))) Q
I $G(NURPLSW),$G(NURPROG)=0,$G(NURPROG(1))'=$G(NURPROG(2)) Q
I $E($G(NURSCATY))="O",$P($G(NURSCATY),"O ",2)="" S NURSCATY="O"
I $S($E(NURSCATY)'="O":'$D(^TMP("NURSCAT",$J,NURSCATY)),$P($G(NURSCATY),"O ",2)'="":'$D(^TMP("NURSCAT",$J,$E(NURSCATY,3,99))),$P($G(NURSCATY),"O ",2)="":'$D(^TMP("NURSCAT",$J,"O")),1:0) Q
I $D(^VA(200,DA(1),0)),$P(^(0),U,1)'="" S N1=$P(^(0),U)
E S N1=" BLANK"
I $G(NURMDSW),$G(NURFAC)=0,$G(NURFAC(1))'=$G(NURFAC(2)) Q
S ^TMP($J,NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,N1,DA)=+$P($G(^NURSF(211.8,NURNODE4,1,NURNODE5,0)),U,4)
Q
; DETAIL LINE PRINT ROUTINE
PRINT S NURFAC(2)="" F S NURFAC(2)=$O(^TMP($J,NURFAC(2))) Q:NURFAC(2)=""!(NUROUT) D P0 Q:NUROUT D:NURMDSW FSUB Q:NUROUT
Q
P0 S NURPROG(2)="" F S NURPROG(2)=$O(^TMP($J,NURFAC(2),NURPROG(2))) Q:NURPROG(2)=""!(NUROUT) D P1 Q:NUROUT I NURPLSW D PSUB Q:NUROUT
Q
P1 S NLOC="" F S NLOC=$O(^TMP($J,NURFAC(2),NURPROG(2),NLOC)) Q:NLOC=""!NUROUT D HEADER Q:NUROUT D P2 Q:NUROUT D LSUB Q:NUROUT
Q
P2 S NURCAT="" F S NURCAT=$O(^TMP($J,NURFAC(2),NURPROG(2),NLOC,NURCAT)) Q:NURCAT=""!(NUROUT) D P3 Q:NUROUT D CSUB Q:NUROUT W !
Q
P3 S N1="" F S N1=$O(^TMP($J,NURFAC(2),NURPROG(2),NLOC,NURCAT,N1)) Q:N1=""!(NUROUT) S DA=0 F S DA=$O(^TMP($J,NURFAC(2),NURPROG(2),NLOC,NURCAT,N1,DA)) Q:DA'>0 S NFTEE=+^(DA) D WRITE Q:NUROUT
Q
WRITE D PGCHK Q:NUROUT
S NURSAL=(+$$EN12^NURSUT0(DA)*NFTEE)
I $P($G(^VA(200,$P(^NURSF(210,DA,0),U),0)),U)'="" W !,$S(+NURSAL'>0:"** ",1:" "),$E($P(^(0),U),1,20)
E Q
W:NURCAT'=" BLANK" ?28,$$CAT^NURSUT2(NURCAT) W ?42,NLOC
S DATA=$G(^NURSF(210,DA,7))
S DATA(1)=$S($G(^NURSF(211.1,+DATA,0))'="":^(0),1:"")
W:DATA(1)'="" ?56,$P(DATA(1),U) W:+NURSAL>0 ?69,$J(NURSAL,6,2)
I NURSAL>0 S FSALT=FSALT+NURSAL,FSUBC=FSUBC+1,LSALT=LSALT+NURSAL,LSUBC=LSUBC+1,CSALT=CSALT+NURSAL,CSUBC=CSUBC+1,PSALT=PSALT+NURSAL,PSUBC=PSUBC+1,NSALT=NSALT+NURSAL,NSUBC=NSUBC+1
Q
CSUB ; CATEGORY SUBTLS/AVG
D PGCHK Q:NUROUT W !!?20,"-------------"
S:CSALT>0 CAVG=CSALT/CSUBC
W !,"EMPLOYEES COUNTED:",?25,$J(CSUBC,8,2)
W !,"CATEGORY SUBTOTAL:",?22,$J(CSALT,11,2)
W !,"AVERAGE SALARY:",?22,$J(CAVG,11,2)
S (CSALT,CSUBC,CAVG)=0
Q
PSUB ; PRODUCT LINE SUBTLS/AVG
D PGCHK Q:NUROUT W !?20,"-------------"
S:PSALT>0 PAVG=PSALT/PSUBC
W !,"EMPLOYEES COUNTED:",?25,$J(PSUBC,8,2)
W !,"PRODUCT LINE SUBTOTAL:",?22,$J(PSALT,11,2)
W !,"AVERAGE SALARY:",?22,$J(PAVG,11,2)
S (PAVG,PSALT,PSUBC)=0
Q
FSUB ; FACILITY SUBTLS/AVG
D PGCHK Q:NUROUT W !?22,"------------"
S:FSALT>0 FAVG=FSALT/FSUBC
W !,"EMPLOYEES COUNTED:",?25,$J(FSUBC,9,2)
W !,"FACILITY SUBTOTAL:",?22,$J(FSALT,12,2)
W !,"AVERAGE SALARY:",?22,$J(FAVG,12,2)
S (FAVG,FSALT,FSUBC)=0
Q
LSUB ;LOCATION SUBTLS/AVG
D PGCHK Q:NUROUT W !?20,"-------------"
S:LSALT>0 LAVG=LSALT/LSUBC
W !,"EMPLOYEES COUNTED:",?25,$J(LSUBC,8,2)
W !,"UNIT SUBTOTAL:",?22,$J(LSALT,11,2)
W !,"AVERAGE SALARY:",?22,$J(LAVG,11,2)
S (LAVG,LSALT,LSUBC)=0
Q
PGCHK ; FORM FEED CHECK
I ($Y>(IOSL-6)) D HEADER
Q
HEADER I 'NURQUEUE,$E(IOST)="C",NURSW1 D ENDPG^NURSUT1 Q:NUROUT
S NURPAGE=NURPAGE+1,NURSW1=1 W:$E(IOST)="C"!(NURPAGE>1) @IOF
I NURMDSW,$G(NURFAC(2))'="" W ?$$CNTR^NURSUT2(NURFAC(2)),$$FACL^NURSUT2(NURFAC(2))
W !!,"STAFF SALARIES BY LOCATION AND SERVICE CATEGORY" S X="T" D ^%DT D:+Y D^DIQ W ?54,Y,?69,"PAGE: ",NURPAGE
W !!,?28,"SERVICE",?56,"GRADE/STEP",?69,"GRADE/STEP" W !,"EMPLOYEE NAME",?28,"CATEGORY",?42,"LOCATION",?56,"CODE",?69,"SALARY" W !,$$REPEAT^XLFSTR("-",80)
I $G(NURPLSW),$G(NURPROG(2))'="" N Z S Z=$$PROD^NURSUT2(NURPROG(2)) W !,?$$CNTR^NURSUT2(NURPROG(2)),$G(Z),!,?$$CNTR^NURSUT2(NURPROG(2)),$$REPEAT^XLFSTR("-",$L(Z)+1)
Q