Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: NURARWL5

NURARWL5.m

Go to the documentation of this file.
NURARWL5 ;HIRMFO/MD-MANHOURS AMIS 1106a WORK LOAD STATISTICS CONT OF NURARWL4 ;9/20/96
 ;;4.0;NURSING SERVICE;;Apr 25, 1997
 I $G(NWARD) S NDATE="" D HEADER^NURARWL8
 S NDATE=0 F  S NDATE=$O(^TMP($J,NDATE)) Q:NDATE'>0  D:$G(NWARD)&'($G(NURSUMSW)) DATE^NURARWL8 D  Q:$G(NUROUT)  I $G(NURSUMSW)!($G(NWARD)="") D DAYTL^NURARWL7 Q:$G(NUROUT)  S:'NURMDSW NBRK=0
 .S NPFAC="" F  S NPFAC=$O(^TMP($J,NDATE,NPFAC)) Q:NPFAC=""  D:'$G(NWARD) HEADER^NURARWL8 D  Q:$G(NUROUT)  I NURMDSW,$G(NWARD)="" D FACTOT^NURARWL9
 ..S NPLOC="" F  S NPLOC=$O(^TMP($J,NDATE,NPFAC,NPLOC)) Q:NPLOC=""  D  Q:$G(NUROUT)  D BRK^NURARWL6 Q:$G(NUROUT)  S NBRK=0
 ...S NSEC="" F  S NSEC=$O(^TMP($J,NDATE,NPFAC,NPLOC,NSEC)) Q:NSEC=""  D  Q:$G(NUROUT)  D AVG^NURARWL8,BEDTOT^NURARWL6  Q:$G(NUROUT)
 ....S NSHFT=0 F  S NSHFT=$O(^TMP($J,NDATE,NPFAC,NPLOC,NSEC,NSHFT)) Q:NSHFT'>0  D  Q:$G(NUROUT)
 .....S NDA=0 F  S NDA=$O(^TMP($J,NDATE,NPFAC,NPLOC,NSEC,NSHFT,NDA)) Q:NDA'>0!($G(NUROUT))  S D1=0 F  S D1=$O(^TMP($J,NDATE,NPFAC,NPLOC,NSEC,NSHFT,NDA,D1)) Q:D1'>0  D DETAIL Q:$G(NUROUT)
 .....Q
 ....Q
 ...Q
 ..Q
 .Q
 Q
DETAIL ; DETAIL LINE PROCESSING
 S (NBSEC,X)=0 F  S X=$O(^TMP($J,NDATE,NPFAC,NPLOC,X)) Q:X=""  S NBSEC=NBSEC+1
 S NADATA=^NURSA(213.4,NDA,1,D1,0),NJ=$P(NADATA,U) Q:NJ'>0!('$D(^NURSF(213.3,NJ,1)))  S NL1=^TMP($J,NDATE,NPFAC,NPLOC,NSEC,NSHFT,NDA,D1)
 F Z=1:1:5 S $P(NPC(NSHFT),U,Z)=0
 S NPCC(NSHFT)=0 F Z=1,2,3 S $P(NREQ(NSHFT),U,Z)=0,$P(NVAR(NSHFT),U,Z)=0 S $P(NPROD(NSHFT),U,Z)=$S(NURSZAP'>6:0,1:"")
 ;
 ; DETAIL CALCULATIONS FOR PERCENTAGES-VARIANCES-PERCENT PRODUCTIVITY
 ;
 S NURS213=^NURSF(213.3,NJ,1),SECT=$P(NURS213,U),NPERCEN=0 F X=1:1:5 S $P(NPC(NSHFT),U,X)=+$P(NADATA,U,(X+1)),NPCC(NSHFT)=NPCC(NSHFT)+$P(NPC(NSHFT),U,X)
 F X="DOM","REC","HEM" I SECT=X S (COUNTSW,COUNTSW(1))=1
 I +^TMP($J,"CEN",NDATE,NPFAC,NPLOC,NSHFT) S NPERCEN=(NPCC(NSHFT)/^TMP($J,"CEN",NDATE,NPFAC,NPLOC,NSHFT))
 ;
 ; CALCULATE SHIFT REQUIRED STAFF
 ;
 S:NSHFT=2 NTLFTEE(2)=(($P(NPC(2),U)*$P(NURS213,U,2))+($P(NPC(2),U,2)*$P(NURS213,U,3))+($P(NPC(2),U,3)*$P(NURS213,U,4))+($P(NPC(2),U,4)*$P(NURS213,U,5))+($P(NPC(2),U,5)*$P(NURS213,U,14)))/8.5
 S:NSHFT=3 NTLFTEE(3)=(($P(NPC(3),U)*$P(NURS213,U,6))+($P(NPC(3),U,2)*$P(NURS213,U,7))+($P(NPC(3),U,3)*$P(NURS213,U,8))+($P(NPC(3),U,4)*$P(NURS213,U,9))+($P(NPC(3),U,5)*$P(NURS213,U,15)))/8.5
 S:NSHFT=1 NTLFTEE(1)=(($P(NPC(1),U)*$P(NURS213,U,10))+($P(NPC(1),U,2)*$P(NURS213,U,11))+($P(NPC(1),U,3)*$P(NURS213,U,12))+($P(NPC(1),U,4)*$P(NURS213,U,13))+($P(NPC(1),U,5)*$P(NURS213,U,16)))/8
 ;
 ; GET MANHOURS DATA AND CONVERT TO FTEE
 ;
 S X=$S($D(^NURSA(213.4,NDA,0)):^(0),1:"0^0^0^0"),$P(NFTEE(NSHFT),U)=$S($P(X,U,2):$P(X,U,2)/8,1:0),$P(NFTEE(NSHFT),U,2)=$S($P(X,U,3):$P(X,U,3)/8,1:0),$P(NFTEE(NSHFT),U,3)=$S($P(X,U,4):$P(X,U,4)/8,1:0)
 ;
 ; CHECK PROF PERCENTAGE
 ;
 S Z=NTLFTEE(NSHFT) I $D(^NURSF(211.4,NL1,1)),$P(^(1),U,2) S Y=^(1),NTLFTEE("PROF")=Z/(100/$P(Y,U,2)) S NTLFTEE("NPROF")=$S($P(Y,U,2)<100:Z/(100/(100-$P(Y,U,2))),1:0)
 E  S Y=^DIC(213.9,1,0),NTLFTEE("PROF")=Z/(100/$P(Y,U,7)) S NTLFTEE("NPROF")=$S($P(Y,U,7)<100:Z/(100/(100-$P(Y,U,7))),1:0)
 S $P(NREQ(NSHFT),U)=NTLFTEE("PROF"),$P(NREQ(NSHFT),U,2)=(NTLFTEE("NPROF")/2),$P(NREQ(NSHFT),U,3)=(NTLFTEE("NPROF")/2)
 D ALLOCATE^NURARWL4
 S:NPCC(NSHFT) NAVG=NAVG+1
 D PRINT^NURARWL7
 ;
 ; ACCUMULATE BED SEC TOTALS
 ;
 F X=1:1:5 S $P(NBPC,U,X)=$P(NBPC,U,X)+$P(NPC(NSHFT),U,X)
 S NBPCC=NBPCC+NPCC(NSHFT) I COUNTSW,'(SECT="HEM"),'(SECT="REC"),'(SECT="DOM") S COUNTSW=0
 Q