DVBCSDEV ;ALB/GTS-AMIE C&P APPT EVENT DRIVER ; 10/19/94  3:45 PM
 ;;2.7;AMIE;**1,208**;Apr 10, 1995;Build 1
 ;;Per VHA Directive 2004-038, this routine should not be modified
 ;
 ;** NOTICE: This routine is part of an implementation of a Nationally
 ;**         Controlled Procedure.  Local modifications to this routine
 ;**         are prohibited per VHA Directive 10-93-142
 ;
 ;** Version Changes
 ;   2.7 - New routine (Enhc 13)
 ;
 ;** Variable Descriptions
 ;** DVBAORG = 1 Appointment event (Originating process variable)
 ;** SDAMEVT = 1 Make appointment event
 ;**           2 Cancel appointment event
 ;**           3 No Show appointment event
 ;** I DVBAAUTO exists, AMIE Make Event is not executed because
 ;**  cancel/no show part of auto-rebook updated 396.95
 ;** DVBAXST=1 - ^TMP("SDEVT",$J) exists
 ;** DVBATYPE=1 - C&P type appointment
 ;** If SDMODE=2, AMIE events are not executed because
 ;**  this call is part of a GUI process and cannot interact with
 ;**  the user
 ;
EN ;**AMIE Scheduling event driver main entry point
 Q:$G(SDMODE)=2  ;SDMODE will be set when called from SDAM APPOINTMENT EVENTS ;*zeb 208 10/31/18 skip if called in non-interactive context
 K KDFN I '$D(DFN) N DFN S DFN=$P(SDATA,U,2),KDFN=""
 S DVBAORG=$$SDORGST^DVBCUTL5
 I +DVBAORG=1 DO
 .S DVBAXST=$$SDEVTXST^DVBCUTL5
 .I +DVBAXST=1 DO
 ..S DVBATYPE=$$SDEVTSPC^DVBCUTL5(16)
 ..I +DVBATYPE=1 DO
 ...I +SDAMEVT=1,('$D(DVBAAUTO)) D EN^DVBCMKLK ;** Original Make event
 ...I +SDAMEVT=1,($D(DVBAAUTO)) K DVBAAUTO ;** Auto-rebook Make event
 ...I +SDAMEVT=2!(+SDAMEVT=3) D EN^DVBCCNNS ;** Cancel/No show event
 ..K DVBATYPE
 .K DVBAXST
 K DVBAORG
 I $D(KDFN) K KDFN,DFN
 D KVARS^DVBCMKLK
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBCSDEV   1726     printed  Sep 23, 2025@19:24:42                                                                                                                                                                                                    Page 2
DVBCSDEV  ;ALB/GTS-AMIE C&P APPT EVENT DRIVER ; 10/19/94  3:45 PM
 +1       ;;2.7;AMIE;**1,208**;Apr 10, 1995;Build 1
 +2       ;;Per VHA Directive 2004-038, this routine should not be modified
 +3       ;
 +4       ;** NOTICE: This routine is part of an implementation of a Nationally
 +5       ;**         Controlled Procedure.  Local modifications to this routine
 +6       ;**         are prohibited per VHA Directive 10-93-142
 +7       ;
 +8       ;** Version Changes
 +9       ;   2.7 - New routine (Enhc 13)
 +10      ;
 +11      ;** Variable Descriptions
 +12      ;** DVBAORG = 1 Appointment event (Originating process variable)
 +13      ;** SDAMEVT = 1 Make appointment event
 +14      ;**           2 Cancel appointment event
 +15      ;**           3 No Show appointment event
 +16      ;** I DVBAAUTO exists, AMIE Make Event is not executed because
 +17      ;**  cancel/no show part of auto-rebook updated 396.95
 +18      ;** DVBAXST=1 - ^TMP("SDEVT",$J) exists
 +19      ;** DVBATYPE=1 - C&P type appointment
 +20      ;** If SDMODE=2, AMIE events are not executed because
 +21      ;**  this call is part of a GUI process and cannot interact with
 +22      ;**  the user
 +23      ;
EN        ;**AMIE Scheduling event driver main entry point
 +1       ;SDMODE will be set when called from SDAM APPOINTMENT EVENTS ;*zeb 208 10/31/18 skip if called in non-interactive context
           if $GET(SDMODE)=2
               QUIT 
 +2        KILL KDFN
           IF '$DATA(DFN)
               NEW DFN
               SET DFN=$PIECE(SDATA,U,2)
               SET KDFN=""
 +3        SET DVBAORG=$$SDORGST^DVBCUTL5
 +4        IF +DVBAORG=1
               Begin DoDot:1
 +5                SET DVBAXST=$$SDEVTXST^DVBCUTL5
 +6                IF +DVBAXST=1
                       Begin DoDot:2
 +7                        SET DVBATYPE=$$SDEVTSPC^DVBCUTL5(16)
 +8                        IF +DVBATYPE=1
                               Begin DoDot:3
 +9       ;** Original Make event
                                   IF +SDAMEVT=1
                                       IF ('$DATA(DVBAAUTO))
                                           DO EN^DVBCMKLK
 +10      ;** Auto-rebook Make event
                                   IF +SDAMEVT=1
                                       IF ($DATA(DVBAAUTO))
                                           KILL DVBAAUTO
 +11      ;** Cancel/No show event
                                   IF +SDAMEVT=2!(+SDAMEVT=3)
                                       DO EN^DVBCCNNS
                               End DoDot:3
 +12                       KILL DVBATYPE
                       End DoDot:2
 +13               KILL DVBAXST
               End DoDot:1
 +14       KILL DVBAORG
 +15       IF $DATA(KDFN)
               KILL KDFN,DFN
 +16       DO KVARS^DVBCMKLK
 +17       QUIT