SR122PST ;BIR/RJS - SRAAIS PROTOCOL 101 UPDATE ;11/21/03
 ;;3.0;SURGERY;**122**;21 Nov 03
START ; THIS ROUTINE IS USED TO UPDATE THE PROTOCOL FILE 101 FOR THE AAIS
 ; SURGERY INTERFACE. IT IS A POST INSTALL ROUTINE FOR SR*3.0*122
 S (SRSNDB,SRLOGB)="SR AAIS",SRRECB="SR SURGERY",SRFDA="101",(SRSND,SRREC,SRLOG,SRBAD)=""
 S SRSND=$O(^HL(771,"B",SRSNDB,SRSND)),SRREC=$O(^HL(771,"B",SRRECB,SRREC)),SRLOG=$O(^HLCS(870,"B",SRLOGB,SRLOG))
 F SRLINE=1:1 S SRTXT=$P($T(SRAAIS+SRLINE),";;",2,99) Q:SRTXT=""  D
 . K SRFIELD S SRIEN=""
 . S SRIEN=$O(^ORD(101,"B",SRTXT,SRIEN))_","
 . S:SRIEN="," SRBAD=1
 . S SRFIELD(SRFDA,SRIEN,"99")=$H,SRFIELD(SRFDA,SRIEN,"770.1")=SRSND
 . S SRFIELD(SRFDA,SRIEN,"770.2")=SRREC,SRFIELD(SRFDA,SRIEN,"770.7")=SRLOG
 . D FILE^DIE("","SRFIELD","SRERR")
 . I $D(SRERR("DIERR",1)) D
 .. S MSGTXT=SRTXT_" NOT UPDATED - ERROR CODE "_SRERR("DIERR",1)
 .. D BMES^XPDUTL(MSGTXT)
 .. K MSGTXT
 . I '$D(SRERR("DIERR",1)) D
 .. S MSGTXT=SRTXT_" SUCCESSFULLY UPDATED"
 .. D BMES^XPDUTL(MSGTXT)
 .. K MSGTXT
 . K SRERR
 . Q
 I SRBAD=1 D BMES^XPDUTL("THERE WAS AN ERROR IN THE POST INSTALL"),BMES^XPDUTL("PLEASE CONTACT EVS")
 K SRSND,SRLOG,SRREC,SRTXT,SRLINE,SRIEN,SRFDA,SRFIELD,SRERR,SRBAD
 D BMES^XPDUTL("PROTOCOL UPDATE COMPLETE")
 Q
SRAAIS ;;
 ;;SR Notification of Appointment Booking
 ;;SR Notification of Appointment Cancellation
 ;;SR Notification of Appointment Deletion
 ;;SR Notification of Appointment Modification
 ;;SR Notification of Appointment Rescheduling
 ;;SR Other Master File Notification
 ;;SR Query for Scheduling Information
 ;;SR Receiver of Appointment Cancellation
 ;;SR Receiver of Appointment Deletion
 ;;SR Receiver of Appointment Modification
 ;;SR Receiver of Appointment Rescheduling
 ;;SR Receiver of Master File Notification
 ;;SR Receiver of New Appointment Booking
 ;;SR Receiver of Observation Unsolicited
 ;;SR Receiver of Scheduling Query
 ;;SR Receiver of Staff Master File Notification
 ;;SR Receiver of Unsolicited Requested Observation
 ;;SR Staff Master File Notification
 ;;SR Unsolicited transmission of AAIS Requested Observation
 ;;SR Unsolicited transmission of VistA Requested Observation
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSR122PST   2200     printed  Sep 23, 2025@20:14:25                                                                                                                                                                                                    Page 2
SR122PST  ;BIR/RJS - SRAAIS PROTOCOL 101 UPDATE ;11/21/03
 +1       ;;3.0;SURGERY;**122**;21 Nov 03
START     ; THIS ROUTINE IS USED TO UPDATE THE PROTOCOL FILE 101 FOR THE AAIS
 +1       ; SURGERY INTERFACE. IT IS A POST INSTALL ROUTINE FOR SR*3.0*122
 +2        SET (SRSNDB,SRLOGB)="SR AAIS"
           SET SRRECB="SR SURGERY"
           SET SRFDA="101"
           SET (SRSND,SRREC,SRLOG,SRBAD)=""
 +3        SET SRSND=$ORDER(^HL(771,"B",SRSNDB,SRSND))
           SET SRREC=$ORDER(^HL(771,"B",SRRECB,SRREC))
           SET SRLOG=$ORDER(^HLCS(870,"B",SRLOGB,SRLOG))
 +4        FOR SRLINE=1:1
               SET SRTXT=$PIECE($TEXT(SRAAIS+SRLINE),";;",2,99)
               if SRTXT=""
                   QUIT 
               Begin DoDot:1
 +5                KILL SRFIELD
                   SET SRIEN=""
 +6                SET SRIEN=$ORDER(^ORD(101,"B",SRTXT,SRIEN))_","
 +7                if SRIEN=","
                       SET SRBAD=1
 +8                SET SRFIELD(SRFDA,SRIEN,"99")=$HOROLOG
                   SET SRFIELD(SRFDA,SRIEN,"770.1")=SRSND
 +9                SET SRFIELD(SRFDA,SRIEN,"770.2")=SRREC
                   SET SRFIELD(SRFDA,SRIEN,"770.7")=SRLOG
 +10               DO FILE^DIE("","SRFIELD","SRERR")
 +11               IF $DATA(SRERR("DIERR",1))
                       Begin DoDot:2
 +12                       SET MSGTXT=SRTXT_" NOT UPDATED - ERROR CODE "_SRERR("DIERR",1)
 +13                       DO BMES^XPDUTL(MSGTXT)
 +14                       KILL MSGTXT
                       End DoDot:2
 +15               IF '$DATA(SRERR("DIERR",1))
                       Begin DoDot:2
 +16                       SET MSGTXT=SRTXT_" SUCCESSFULLY UPDATED"
 +17                       DO BMES^XPDUTL(MSGTXT)
 +18                       KILL MSGTXT
                       End DoDot:2
 +19               KILL SRERR
 +20               QUIT 
               End DoDot:1
 +21       IF SRBAD=1
               DO BMES^XPDUTL("THERE WAS AN ERROR IN THE POST INSTALL")
               DO BMES^XPDUTL("PLEASE CONTACT EVS")
 +22       KILL SRSND,SRLOG,SRREC,SRTXT,SRLINE,SRIEN,SRFDA,SRFIELD,SRERR,SRBAD
 +23       DO BMES^XPDUTL("PROTOCOL UPDATE COMPLETE")
 +24       QUIT 
SRAAIS    ;;
 +1       ;;SR Notification of Appointment Booking
 +2       ;;SR Notification of Appointment Cancellation
 +3       ;;SR Notification of Appointment Deletion
 +4       ;;SR Notification of Appointment Modification
 +5       ;;SR Notification of Appointment Rescheduling
 +6       ;;SR Other Master File Notification
 +7       ;;SR Query for Scheduling Information
 +8       ;;SR Receiver of Appointment Cancellation
 +9       ;;SR Receiver of Appointment Deletion
 +10      ;;SR Receiver of Appointment Modification
 +11      ;;SR Receiver of Appointment Rescheduling
 +12      ;;SR Receiver of Master File Notification
 +13      ;;SR Receiver of New Appointment Booking
 +14      ;;SR Receiver of Observation Unsolicited
 +15      ;;SR Receiver of Scheduling Query
 +16      ;;SR Receiver of Staff Master File Notification
 +17      ;;SR Receiver of Unsolicited Requested Observation
 +18      ;;SR Staff Master File Notification
 +19      ;;SR Unsolicited transmission of AAIS Requested Observation
 +20      ;;SR Unsolicited transmission of VistA Requested Observation
 +21       QUIT