ORWTPUA ; SLC/STAFF Personal Preference - Utility Alerts ; 4/20/07 10:01am
;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,243,296**;Oct 24, 2000;Build 19
;
START(USER) ; $$(user) -> user's surrogate start date/time
Q $P($G(^XTV(8992,+$G(USER),0)),U,3)
;
STOP(USER) ; $$(user) -> user's surrogate stop date/time
Q $P($G(^XTV(8992,+$G(USER),0)),U,4)
;
CHKSURR(USER,SURR) ; $$(user,surrogate) -> 1 if ok else 0^reason for reject
N OK,START
S USER=+$G(USER),SURR=+$G(SURR)
I USER=SURR Q "0^You cannot specify yourself as your own surrogate!"
S START=$$GET1^DIQ(8992,(SURR_","),.02,"I")
I START<.5 Q 1
I START=USER Q "0^You are designated as the surrogate for this user - can't do it!"
S OK=1 F S START=$$GET1^DIQ(8992,(START_","),.02,"I") Q:START'>0 I START=USER S OK=0 Q
I 'OK Q "0^This forms a circle which leads back to you - can't do it!"
Q 1
;
GETSURR(USER) ; $$(user ien) -> surrogate ien
Q $$CURRSURO^XQALSURO(+$G(USER))
;
SAVESURR(USER,SURR,START,STOP) ; save user's surrogate info
N RET
D REMVSURO^XQALSURO(USER) Q:SURR=-1 1
S RET=$$SETSURO1^XQALSURO(USER,SURR,START,STOP)
Q RET
ORWTPUA ; SLC/STAFF Personal Preference - Utility Alerts ; 4/20/07 10:01am
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,243,296**;Oct 24, 2000;Build 19
+2 ;
START(USER) ; $$(user) -> user's surrogate start date/time
+1 QUIT $PIECE($GET(^XTV(8992,+$GET(USER),0)),U,3)
+2 ;
STOP(USER) ; $$(user) -> user's surrogate stop date/time
+1 QUIT $PIECE($GET(^XTV(8992,+$GET(USER),0)),U,4)
+2 ;
CHKSURR(USER,SURR) ; $$(user,surrogate) -> 1 if ok else 0^reason for reject
+1 NEW OK,START
+2 SET USER=+$GET(USER)
SET SURR=+$GET(SURR)
+3 IF USER=SURR
QUIT "0^You cannot specify yourself as your own surrogate!"
+4 SET START=$$GET1^DIQ(8992,(SURR_","),.02,"I")
+5 IF START<.5
QUIT 1
+6 IF START=USER
QUIT "0^You are designated as the surrogate for this user - can't do it!"
+7 SET OK=1
FOR
SET START=$$GET1^DIQ(8992,(START_","),.02,"I")
IF START'>0
QUIT
IF START=USER
SET OK=0
QUIT
+8 IF 'OK
QUIT "0^This forms a circle which leads back to you - can't do it!"
+9 QUIT 1
+10 ;
GETSURR(USER) ; $$(user ien) -> surrogate ien
+1 QUIT $$CURRSURO^XQALSURO(+$GET(USER))
+2 ;
SAVESURR(USER,SURR,START,STOP) ; save user's surrogate info
+1 NEW RET
+2 DO REMVSURO^XQALSURO(USER)
IF SURR=-1
QUIT 1
+3 SET RET=$$SETSURO1^XQALSURO(USER,SURR,START,STOP)
+4 QUIT RET