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

ORWTPUA.m

Go to the documentation of this file.
  1. ORWTPUA ;SLC/STAFF Personal Preference - Utility Alerts ;Jul 19, 2021@12:39:02
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,243,296,539,405**;Oct 24, 2000;Build 211
  1. ;
  1. START(USER) ; $$(user) -> user's surrogate start date/time
  1. Q $P($G(^XTV(8992,+$G(USER),0)),U,3)
  1. ;
  1. STOP(USER) ; $$(user) -> user's surrogate stop date/time
  1. Q $P($G(^XTV(8992,+$G(USER),0)),U,4)
  1. ;
  1. CHKSURR(USER,SURR) ; $$(user,surrogate) -> 1 if ok else 0^reason for reject
  1. N OK,START
  1. S USER=+$G(USER),SURR=+$G(SURR)
  1. I USER=SURR Q "0^You cannot specify yourself as your own surrogate!"
  1. S START=$$GET1^DIQ(8992,(SURR_","),.02,"I")
  1. I START<.5 Q 1
  1. I START=USER Q "0^You are designated as the surrogate for this user - can't do it!"
  1. S OK=1 F S START=$$GET1^DIQ(8992,(START_","),.02,"I") Q:START'>0 I START=USER S OK=0 Q
  1. I 'OK Q "0^This forms a circle which leads back to you - can't do it!"
  1. Q 1
  1. ;
  1. CHKSURRO(USER,SURR,START,STOP) ; Check if surrogate has a surrogate
  1. ; designated for same time period
  1. N OK,RSLT,SURSTOP,SURSTRT,X
  1. S OK=1
  1. I +STOP=0 S STOP=9999999
  1. I +START>0 D
  1. . D GETSURRS^ORWTPR(.RSLT,SURR)
  1. . I RSLT>0 D
  1. .. S X=0
  1. .. F S X=$O(RSLT(X)) Q:X="" D Q:+OK=0
  1. ... S SURSTRT=$P(RSLT(X),U,3)
  1. ... S SURSTOP=$P(RSLT(X),U,4)
  1. ... I +SURSTOP=0 S SURSTOP=9999999
  1. ... I START<=SURSTRT,STOP>=SURSTOP S OK=0 Q
  1. ... I START>SURSTRT,START<SURSTOP S OK=0 Q
  1. ... I STOP>SURSTRT,STOP<SURSTOP S OK=0 Q
  1. .. I OK=0 S OK="0^"_$S(+SURR>0:$P($G(^VA(200,SURR,0)),U,1),1:SURR)_" has a surrogate scheduled during the same time period of "_$$FMTE^XLFDT(SURSTRT,5)_$S(SURSTOP'=9999999:" through "_$$FMTE^XLFDT(SURSTOP,5),1:" with no end date")_"!"
  1. Q OK
  1. ;
  1. GETSURR(USER) ; $$(user ien) -> surrogate ien
  1. Q $$CURRSURO^XQALSURO(+$G(USER))
  1. ;
  1. SAVESURR(USER,SURR,START,STOP) ; save user's surrogate info
  1. N RET
  1. S STOP=$G(STOP)
  1. ;D REMVSURO^XQALSURO(USER,$S(SURR=-1:"",1:SURR),$S(START>0:START,1:"")) Q:((SURR=-1)!(STOP=0)) 1
  1. I (STOP=0)!(SURR=-1) D REMVSURO^XQALSURO(USER,$S(SURR=-1:"",1:SURR),$S(START>0:START,1:"")) Q 1
  1. S RET=$$SETSURO1^XQALSURO(USER,SURR,START,STOP)
  1. Q RET