NURAMHE ;HIRMFO/MD,FT-NURSING MANHOURS ENTER/EDIT FUNCTION ;8/14/96 09:45
;;4.0;NURSING SERVICE;**20**;Apr 25, 1997
EN1 ;PATIENT CARE ENTRY POINT FROM OPTION NURAMN-MANED
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
S DIC="^NURSF(211.4,",DIC("A")="Select Nursing UNIT: ",DIC(0)="AEQZ"
I DUZ(0)'["n",DUZ(0)'["@" S DIC("S")="I $P($G(^SC(+$G(NURSF(211.4,+Y,0)),0)),U)'[""MAS ONLY"",$P($G(^SC(+$G(NURSF(211.4,+Y,0)),0)),U)'[""MASONLY"",$P($G(^NURSF(211.4,+Y,""I"")),U)'=""I"""
E S DIC("S")="I $P($G(^SC(+$G(^NURSF(211.4,+Y,0)),0)),U)'[""MAS ONLY"",$P($G(^SC(+$G(^NURSF(211.4,+Y,0)),0)),U)'[""MASONLY"""
W ! D ^DIC K DIC I "^"[X!(+Y'>0) G QUIT
S NCWARD=+Y
S NUROUTSW=0,X="T",%DT="" D ^%DT D:+Y D^DIQ S %DT("B")=Y
NXDT S %DT("A")="Select DATE: ",%DT="AEX" W ! D ^%DT K %DT
I "^"[X!(+Y'>0) G QUIT
G:"^"[X QUIT S NURDAY=+Y D SHIFT G:NUROUTSW QUIT D EDIT G:NUROUTSW QUIT
K SHIFT G NXDT
EDIT ; PROCESS SELECTED SHIFT(S)
F NURDA=0:0 S NURDA=$O(SHIFT(NURDA)) Q:NURDA="" S NPWARD=NCWARD D EN6^NURSAUTL W !!,"...Editing "_$S(SHIFT(NURDA)="E":"EVENING",SHIFT(NURDA)="D":"DAY",SHIFT(NURDA)="N":"NIGHT",1:"")_" SHIFT for ward "_NPWARD_"...",! D MAIN Q:NUROUTSW
Q
SHIFT R !!,"Select Shift(s) (Enter N - Night D - DAY E - Evening or A for All Shifts): ",NURSHFT:DTIME,! I "^"[NURSHFT!('$T)!(NURSHFT="") S NUROUTSW=1 Q
I NURSHFT["?" W !,"Enter shift selection(s) (i.e., N,D,E - ND - DE etc)." G SHIFT
I NURSHFT?1L S NURSHFT=$C($A(NURSHFT)-32)
I '((NURSHFT="A")!(NURSHFT="ALL")!(NURSHFT="N")!(NURSHFT="D")!(NURSHFT="E"))&($L(NURSHFT)'>1) G MSG
I $L(NURSHFT)>1 F I=1:1:5 I $E(NURSHFT,I)'=","&($E(NURSHFT,I)'="D")&($E(NURSHFT,I)'="N")&($E(NURSHFT,I)'="E")&($E(NURSHFT,I)'="") G MSG
I NURSHFT="A"!(NURSHFT="ALL") F NURX=1:1:3 S SHIFT(NURX)=$S(NURX=1:"N",NURX=2:"D",1:"E")
E F NURX=1:1:$L(NURSHFT) S:$E(NURSHFT,NURX)'="," SHIFT($S($E(NURSHFT,NURX)="N":1,$E(NURSHFT,NURX)="D":2,$E(NURSHFT,NURX)="E":3,1:0))=$E(NURSHFT,NURX)
Q
QUIT D ^NURAKILL
Q
MAIN ;LOOP PROCESS
S NURSHFT=SHIFT(NURDA) S X=NURDAY_NURSHFT_NCWARD D EN1^NURAMHU S SAVENODE=$P(^NURSA(213.4,DA,0),"^",2,4) L +^NURSA(213.4,DA,0):1 I '$T W !!,"ANOTHER PROCESS IS WORKING ON THIS ENTRY",$C(7) S NUROUTSW=1 Q
S DIE="^NURSA(213.4,",DR="[NURA-I-PATHOURS]" D ^DIE L -^NURSA(213.4,DA,0)
S NURNODE=$P(^NURSA(213.4,DA,0),"^",2,4) I '(SAVENODE=NURNODE) S DR="10////^S X=DUZ" D ^DIE
I $D(^NURSA(213.4,DA,0)),$P(^(0),"^",8) W !!,"ENTERED BY: ",$P(^VA(200,$P(^NURSA(213.4,DA,0),"^",8),0),"^")
Q
MSG W !,$C(7)," ** IMPROPER SHIFT SELECTION **" G SHIFT
NURAMHE ;HIRMFO/MD,FT-NURSING MANHOURS ENTER/EDIT FUNCTION ;8/14/96 09:45
+1 ;;4.0;NURSING SERVICE;**20**;Apr 25, 1997
EN1 ;PATIENT CARE ENTRY POINT FROM OPTION NURAMN-MANED
+1 IF '$DATA(^DIC(213.9,1,"OFF"))
QUIT
IF $PIECE(^DIC(213.9,1,"OFF"),"^",1)=1
QUIT
+2 SET DIC="^NURSF(211.4,"
SET DIC("A")="Select Nursing UNIT: "
SET DIC(0)="AEQZ"
+3 IF DUZ(0)'["n"
IF DUZ(0)'["@"
SET DIC("S")="I $P($G(^SC(+$G(NURSF(211.4,+Y,0)),0)),U)'[""MAS ONLY"",$P($G(^SC(+$G(NURSF(211.4,+Y,0)),0)),U)'[""MASONLY"",$P($G(^NURSF(211.4,+Y,""I"")),U)'=""I"""
+4 IF '$TEST
SET DIC("S")="I $P($G(^SC(+$G(^NURSF(211.4,+Y,0)),0)),U)'[""MAS ONLY"",$P($G(^SC(+$G(^NURSF(211.4,+Y,0)),0)),U)'[""MASONLY"""
+5 WRITE !
DO ^DIC
KILL DIC
IF "^"[X!(+Y'>0)
GOTO QUIT
+6 SET NCWARD=+Y
+7 SET NUROUTSW=0
SET X="T"
SET %DT=""
DO ^%DT
IF +Y
DO D^DIQ
SET %DT("B")=Y
NXDT SET %DT("A")="Select DATE: "
SET %DT="AEX"
WRITE !
DO ^%DT
KILL %DT
+1 IF "^"[X!(+Y'>0)
GOTO QUIT
+2 IF "^"[X
GOTO QUIT
SET NURDAY=+Y
DO SHIFT
IF NUROUTSW
GOTO QUIT
DO EDIT
IF NUROUTSW
GOTO QUIT
+3 KILL SHIFT
GOTO NXDT
EDIT ; PROCESS SELECTED SHIFT(S)
+1 FOR NURDA=0:0
SET NURDA=$ORDER(SHIFT(NURDA))
IF NURDA=""
QUIT
SET NPWARD=NCWARD
DO EN6^NURSAUTL
WRITE !!,"...Editing "_$SELECT(SHIFT(NURDA)="E":"EVENING",SHIFT(NURDA)="D":"DAY",SHIFT(NURDA)="N":"NIGHT",1:"")_" SHIFT for ward "_NPWARD_"...",!
DO MAIN
IF NUROUTSW
QUIT
+2 QUIT
SHIFT READ !!,"Select Shift(s) (Enter N - Night D - DAY E - Evening or A for All Shifts): ",NURSHFT:DTIME,!
IF "^"[NURSHFT!('$TEST)!(NURSHFT="")
SET NUROUTSW=1
QUIT
+1 IF NURSHFT["?"
WRITE !,"Enter shift selection(s) (i.e., N,D,E - ND - DE etc)."
GOTO SHIFT
+2 IF NURSHFT?1L
SET NURSHFT=$CHAR($ASCII(NURSHFT)-32)
+3 IF '((NURSHFT="A")!(NURSHFT="ALL")!(NURSHFT="N")!(NURSHFT="D")!(NURSHFT="E"))&($LENGTH(NURSHFT)'>1)
GOTO MSG
+4 IF $LENGTH(NURSHFT)>1
FOR I=1:1:5
IF $EXTRACT(NURSHFT,I)'=","&($EXTRACT(NURSHFT,I)'="D")&($EXTRACT(NURSHFT,I)'="N")&($EXTRACT(NURSHFT,I)'="E")&($EXTRACT(NURSHFT,I)'="")
GOTO MSG
+5 IF NURSHFT="A"!(NURSHFT="ALL")
FOR NURX=1:1:3
SET SHIFT(NURX)=$SELECT(NURX=1:"N",NURX=2:"D",1:"E")
+6 IF '$TEST
FOR NURX=1:1:$LENGTH(NURSHFT)
IF $EXTRACT(NURSHFT,NURX)'=","
SET SHIFT($SELECT($EXTRACT(NURSHFT,NURX)="N":1,$EXTRACT(NURSHFT,NURX)="D":2,$EXTRACT(NURSHFT,NURX)="E":3,1:0))=$EXTRACT(NURSHFT,NURX)
+7 QUIT
QUIT DO ^NURAKILL
+1 QUIT
MAIN ;LOOP PROCESS
+1 SET NURSHFT=SHIFT(NURDA)
SET X=NURDAY_NURSHFT_NCWARD
DO EN1^NURAMHU
SET SAVENODE=$PIECE(^NURSA(213.4,DA,0),"^",2,4)
LOCK +^NURSA(213.4,DA,0):1
IF '$TEST
WRITE !!,"ANOTHER PROCESS IS WORKING ON THIS ENTRY",$CHAR(7)
SET NUROUTSW=1
QUIT
+2 SET DIE="^NURSA(213.4,"
SET DR="[NURA-I-PATHOURS]"
DO ^DIE
LOCK -^NURSA(213.4,DA,0)
+3 SET NURNODE=$PIECE(^NURSA(213.4,DA,0),"^",2,4)
IF '(SAVENODE=NURNODE)
SET DR="10////^S X=DUZ"
DO ^DIE
+4 IF $DATA(^NURSA(213.4,DA,0))
IF $PIECE(^(0),"^",8)
WRITE !!,"ENTERED BY: ",$PIECE(^VA(200,$PIECE(^NURSA(213.4,DA,0),"^",8),0),"^")
+5 QUIT
MSG WRITE !,$CHAR(7)," ** IMPROPER SHIFT SELECTION **"
GOTO SHIFT