VistA-FOIAVistA/r/ORDER_ENTRY_RESULTS_REPORTI.../ORWGN.m

24 lines
784 B
Mathematica

ORWGN ;;SLC/JDL- Group Notes
;;3.0;ORDER ENTRY/RESULTS REPORTING;**222**
AUTHUSR(ORY) ;Does user has permission to access GN?
S ORY=0
I $D(^XUSEC("OR GN ACCESS",DUZ)) S ORY=1
Q
;
GNLOC(ORY,ORFROM,DIR) ;Is valid GN location? 1: true 0: false
; .ORY=returned list, ORFROM=text to $O from, DIR=$O direction.
N IX,ORLST,CHKVAL,ORERR,ORX
K ^TMP("ORGN",$J)
S (ORLST,ORERR)="",CHKVAL=0
D GETLST^XPAR(.ORLST,"ALL","OR GN LOCATIONS","N",.ORERR)
I ORERR S ORY=ORERR Q
Q:$D(ORLST)=1
S IX=0 F S IX=$O(ORLST(IX)) Q:'IX D
. S CHKVAL=ORLST(IX)
. S:($$ACTLOC^ORWU(+CHKVAL)) ^TMP("ORGN",$J,$P(CHKVAL,U,2))=ORLST(IX)
N I,CNT S I=0,CNT=44,ORY=""
Q:$D(^TMP("ORGN",$J))<10
F Q:I'<CNT S ORFROM=$O(^TMP("ORGN",$J,ORFROM),DIR) Q:ORFROM="" D
. S I=I+1,ORY(I)=^TMP("ORGN",$J,ORFROM)
Q