ANSUWR ;IHS/OIRM/DSD/CSC - UNIT WORKLOAD REPORT; [ 02/25/98 10:32 AM ]
;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
;;UNIT WORKLOAD REPORT
EN D EN1
EXIT K ANSHIFT,ANSCAT1,ANSCAT2,ANSCAT3,ANSCAT4,ANSCAT5,ANSCAT6
Q
EN1 ;
D DATES^ANSDATE
Q:$D(ANSQUIT)!$D(ANSOUT)!'$G(ANSBEGIN)
S:'$G(ANSEND) ANSEND=DT
D UNIT^ANSUD
Q:'$G(ANSUN)
D DATA Q
D HEAD,SHEAD^ANSUWR1,PERCENT
Q
DATA S ANSDATE=ANSBEGIN
F S ANSDATE=$O(^ANSR("AB",ANSDATE)) Q:'ANSDATE!(ANSDATE>ANSEND) D
.S ANSX=0
.F S ANSX=$O(^ANSR("AB",ANSDATE,ANSUN,ANSX)) Q:'ANSX S ANSZ=^ANSR(ANSX,0) D
..W !,ANSZ
..S ANSZ=0
..F S ANSZ=$O(^ANSR(ANSX,"L",ANSZ)) Q:'ANSZ S ANS=$G(^ANSR(ANSX,"L",ANSZ,0)) D ;;CSC 9-10-96
...S L=$P(ANS,U,2)
...I L>4,$P(^ANSD(59,+ANS,0),U,L) S L=$P(^(0),U,L)
Q
HEAD ;HEADER
W @IOF,?25,"UNIT WORKLOAD REPORT"
W !!,"UNIT........: ",ANSUNIT
W !,"DATE........: "
S Y=ANSDATE
X ^DD("DD")
W Y
W !,"DATE PRINTED: "
S Y=DT
X ^DD("DD")
W Y
Q
PERCENT ;
S ANSHIFT(1)=45
W !!,"PERCENT OF STAFF IN 24 HOURS",!,"ASSIGNED TO ",ANSHIFT," SHIFT: ",$J(ANSHIFT(1),3)," %"
W !!?10,"+--------------------------+"
W !?10,"| |"
W !?10,"| STAFF HOURS REQUIRED |"
W !?10,"| |"
W !?10,"|--------------------------|"
W !?10,"| | | |"
W !?10,"| HOURS | | |"
W !?10,"| FOR ALL| DISTRI-| |"
W !?10,"| PAT'S | BUTION | RESULT |"
W !?10,"| | | |"
W !?10,"|--------------------------|"
W !?10,"| | | |"
F J=1:1:4 S Z=$S(J=1:"ANSRN",J=2:"ANSLPN",J=3:"ANSNA",J=4:"ANSALL") D P1 W !?10,"|",$J(X,6)," |",$J(ANSHIFT(1),6)," |",$J($FN(X*ANSHIFT(1)/100,"P"),8),"|"
W !?10,"| | | |"
W !?10,"+--------------------------+"
Q
P1 S X=0
F I=1:1:6 S X=X+$P(@Z@(I),U,2)
Q
ANSUWR ;IHS/OIRM/DSD/CSC - UNIT WORKLOAD REPORT; [ 02/25/98 10:32 AM ]
+1 ;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
+2 ;;UNIT WORKLOAD REPORT
EN DO EN1
EXIT KILL ANSHIFT,ANSCAT1,ANSCAT2,ANSCAT3,ANSCAT4,ANSCAT5,ANSCAT6
+1 QUIT
EN1 ;
+1 DO DATES^ANSDATE
+2 IF $DATA">DATA(ANSQUIT)!$DATA">DATA(ANSOUT)!'$GET(ANSBEGIN)
QUIT
+3 IF '$GET(ANSEND)
SET ANSEND=DT
+4 DO UNIT^ANSUD
+5 IF '$GET(ANSUN)
QUIT
+6 DO DATA
QUIT
+7 DO HEAD
DO SHEAD^ANSUWR1
DO PERCENT
+8 QUIT
DATA SET ANSDATE=ANSBEGIN
+1 FOR
SET ANSDATE=$ORDER(^ANSR("AB",ANSDATE))
IF 'ANSDATE!(ANSDATE>ANSEND)
QUIT
Begin DoDot:1
+2 SET ANSX=0
+3 FOR
SET ANSX=$ORDER(^ANSR("AB",ANSDATE,ANSUN,ANSX))
IF 'ANSX
QUIT
SET ANSZ=^ANSR(ANSX,0)
Begin DoDot:2
+4 WRITE !,ANSZ
+5 SET ANSZ=0
+6 ;;CSC 9-10-96
FOR
SET ANSZ=$ORDER(^ANSR(ANSX,"L",ANSZ))
IF 'ANSZ
QUIT
SET ANS=$GET(^ANSR(ANSX,"L",ANSZ,0))
Begin DoDot:3
+7 SET L=$PIECE(ANS,U,2)
+8 IF L>4
IF $PIECE(^ANSD(59,+ANS,0),U,L)
SET L=$PIECE(^(0),U,L)
End DoDot:3
End DoDot:2
End DoDot:1
+9 QUIT
HEAD ;HEADER
+1 WRITE @IOF,?25,"UNIT WORKLOAD REPORT"
+2 WRITE !!,"UNIT........: ",ANSUNIT
+3 WRITE !,"DATE........: "
+4 SET Y=ANSDATE
+5 XECUTE ^DD("DD")
+6 WRITE Y
+7 WRITE !,"DATE PRINTED: "
+8 SET Y=DT
+9 XECUTE ^DD("DD")
+10 WRITE Y
+11 QUIT
PERCENT ;
+1 SET ANSHIFT(1)=45
+2 WRITE !!,"PERCENT OF STAFF IN 24 HOURS",!,"ASSIGNED TO ",ANSHIFT," SHIFT: ",$JUSTIFY(ANSHIFT(1),3)," %"
+3 WRITE !!?10,"+--------------------------+"
+4 WRITE !?10,"| |"
+5 WRITE !?10,"| STAFF HOURS REQUIRED |"
+6 WRITE !?10,"| |"
+7 WRITE !?10,"|--------------------------|"
+8 WRITE !?10,"| | | |"
+9 WRITE !?10,"| HOURS | | |"
+10 WRITE !?10,"| FOR ALL| DISTRI-| |"
+11 WRITE !?10,"| PAT'S | BUTION | RESULT |"
+12 WRITE !?10,"| | | |"
+13 WRITE !?10,"|--------------------------|"
+14 WRITE !?10,"| | | |"
+15 FOR J=1:1:4
SET Z=$SELECT(J=1:"ANSRN",J=2:"ANSLPN",J=3:"ANSNA",J=4:"ANSALL")
DO P1
WRITE !?10,"|",$JUSTIFY(X,6)," |",$JUSTIFY(ANSHIFT(1),6)," |",$JUSTIFY($FNUMBER(X*ANSHIFT(1)/100,"P"),8),"|"
+16 WRITE !?10,"| | | |"
+17 WRITE !?10,"+--------------------------+"
+18 QUIT
P1 SET X=0
+1 FOR I=1:1:6
SET X=X+$PIECE(@Z@(I),U,2)
+2 QUIT