SDAMEVT2 ;ALB/CAW - Add/Edit Event Driver Utilities ; 10/15/92
;;5.3;Scheduling;**132,1015**;Aug 13, 1993;Build 21
;
BEFORE(SDOE,SDHDL) ;
D CAPTURE("BEFORE",.SDOE,.SDHDL)
Q
;
AFTER(SDOE,SDHDL) ;
D CAPTURE("AFTER",.SDOE,SDHDL)
Q
;
CAPTURE(SDCAP,SDOE,SDHDL) ;
N OP
; -- set up 'OP'posite variable
S OP=$S(SDCAP="BEFORE":"AFTER",1:"BEFORE")
;
; -- next lines are redunant data with OE^SDAMEVT but consistent
; with appt and disp ^TMP strurcture
S ^TMP("SDEVT",$J,SDHDL,2,"STANDALONE",0,SDCAP)=$G(^SCE(SDOE,0))
S:'$D(^TMP("SDEVT",$J,SDHDL,2,"STANDALONE",0,OP)) ^(OP)=""
;
D OE^SDAMEVT(.SDCAP,2,SDOE,SDHDL)
Q
;
EVT(SDOE,SDEVT,SDHDL,SDOEP) ;
D AFTER(SDOE,SDHDL)
D EVTGO
Q
;
EVTGO ; -- do it!
N SDATA,SDHDLX
S SDHDLX="SDHDL"_SDHDL_" SAVE"
; for compatibility in IB
D SWAP("SDAMEVT",SDHDLX)
S SDATA="0^0^0^0",(SDATA("BEFORE","STATUS"),SDATA("AFTER","STATUS"))=""
S (^TMP("SDAMEVT",$J,"BEFORE","STATUS"),^TMP("SDAMEVT",$J,"AFTER","STATUS"))=""
D EVT^SDAMEVT(.SDATA,SDEVT,0,SDHDL),SWAP(SDHDLX,"SDAMEVT")
Q
;
SWAP(FR,TO) ; -- save/restore data for compatibility
N NODE,SDCAP
K ^TMP(TO,$J)
I $D(^TMP(FR,$J)) D K ^TMP(FR,$J)
.F SDCAP="BEFORE","AFTER" S NODE="" F S NODE=$O(^TMP(FR,$J,SDCAP,NODE)) Q:NODE="" S ^TMP(TO,$J,SDCAP,NODE)=^TMP(FR,$J,SDCAP,NODE)
Q
;
SDAMEVT2 ;ALB/CAW - Add/Edit Event Driver Utilities ; 10/15/92
+1 ;;5.3;Scheduling;**132,1015**;Aug 13, 1993;Build 21
+2 ;
BEFORE(SDOE,SDHDL) ;
+1 DO CAPTURE("BEFORE",.SDOE,.SDHDL)
+2 QUIT
+3 ;
AFTER(SDOE,SDHDL) ;
+1 DO CAPTURE("AFTER",.SDOE,SDHDL)
+2 QUIT
+3 ;
CAPTURE(SDCAP,SDOE,SDHDL) ;
+1 NEW OP
+2 ; -- set up 'OP'posite variable
+3 SET OP=$SELECT(SDCAP="BEFORE":"AFTER",1:"BEFORE")
+4 ;
+5 ; -- next lines are redunant data with OE^SDAMEVT but consistent
+6 ; with appt and disp ^TMP strurcture
+7 SET ^TMP("SDEVT",$JOB,SDHDL,2,"STANDALONE",0,SDCAP)=$GET(^SCE(SDOE,0))
+8 IF '$DATA(^TMP("SDEVT",$JOB,SDHDL,2,"STANDALONE",0,OP))
SET ^(OP)=""
+9 ;
+10 DO OE^SDAMEVT(.SDCAP,2,SDOE,SDHDL)
+11 QUIT
+12 ;
EVT(SDOE,SDEVT,SDHDL,SDOEP) ;
+1 DO AFTER(SDOE,SDHDL)
+2 DO EVTGO
+3 QUIT
+4 ;
EVTGO ; -- do it!
+1 NEW SDATA,SDHDLX
+2 SET SDHDLX="SDHDL"_SDHDL_" SAVE"
+3 ; for compatibility in IB
+4 DO SWAP("SDAMEVT",SDHDLX)
+5 SET SDATA="0^0^0^0"
SET (SDATA("BEFORE","STATUS"),SDATA("AFTER","STATUS"))=""
+6 SET (^TMP("SDAMEVT",$JOB,"BEFORE","STATUS"),^TMP("SDAMEVT",$JOB,"AFTER","STATUS"))=""
+7 DO EVT^SDAMEVT(.SDATA,SDEVT,0,SDHDL)
DO SWAP(SDHDLX,"SDAMEVT")
+8 QUIT
+9 ;
SWAP(FR,TO) ; -- save/restore data for compatibility
+1 NEW NODE,SDCAP
+2 KILL ^TMP(TO,$JOB)
+3 IF $DATA(^TMP(FR,$JOB))
Begin DoDot:1
+4 FOR SDCAP="BEFORE","AFTER"
SET NODE=""
FOR
SET NODE=$ORDER(^TMP(FR,$JOB,SDCAP,NODE))
IF NODE=""
QUIT
SET ^TMP(TO,$JOB,SDCAP,NODE)=^TMP(FR,$JOB,SDCAP,NODE)
End DoDot:1
KILL ^TMP(FR,$JOB)
+5 QUIT
+6 ;