RAIPS222 ;HISC/GJC - Post-init Driver, patch 222 ; Jan 03, 2025@08:56:22
 ;;5.0;Radiology/Nuclear Medicine;**222**;Mar 16, 1998;Build 1
 ;
 ;IA          Type    File         Routine     Tag
 ;-----------------------------------------------------
 ;1157        (S)                  XPDMENU     LOCK
 ;1157        (S)                  XPDMENU     LKOPT
 ;2056        (S)                  DIQ         GET1
 ;10141       (S)                  XPDUTL      BMES
 ;
 Q
 ;
EN ;The called tag referenced in the RA*5.0*222 build description.
 ;
KEY2OPT ;Add the RA DELETEXAM key to the RA DELETEXAM 'Exam Deletion' option.
 N RAIEN,RAKEYNM,RAKEY,RAOPT,RATXT
 S (RAKEY,RAOPT)="RA DELETEXAM"
 S RAIEN=$$LKOPT^XPDMENU(RAOPT)_"," ;IEN of 'Exam Deletion' option
 I +RAIEN=0 D  Q
 .S RATXT="'"_RAOPT_"' option not found. Contact the national radiology developers."
 .Q
 ;associate the new key to our option
 D LOCK^XPDMENU(RAOPT,RAKEY)
 ;did the key to option association succeed or fail?
 S RAKEYNM=$$GET1^DIQ(19,RAIEN,3)
 I RAKEYNM=RAKEY D  ;success
 .S RATXT=RAKEY_" has been assigned as the key for option '"_RAOPT_"'."
 .D BMES^XPDUTL(RATXT)
 .Q
 E  D  ;failure
 .S RATXT=RAKEY_" has NOT been assigned as the key for option '"_RAOPT_"'."
 .D BMES^XPDUTL(RATXT)
 .Q
 ;
OPT ; *** Now update the DESCRIPTION (#3.5) field for the RA EXAM ORDER SYNCH option record in the OPTION (#19) file. ***
 ;find the option record IEN
 S RAIEN=$$FIND1^DIC(19,"","CX","RA EXAM ORDER SYNCH","B","","RAERR(19)")
 ;if RAIEN is null likely an error, Display error and quit.
 I $D(RAERR(19,"DIERR"))#2 DO  QUIT
 .N RAI,RAJ,RATXT S RAJ=$P(RAERR(19,"DIERR"),U,2)
 .F RAI=1:1:RAJ S RATXT(RAI)=$G(RAERR(19,"DIERR",RAI,"TEXT",1))
 .D BMES^XPDUTL(.RATXT)
 .Q
 I RAIEN'>0 D BMES^XPDUTL("Option: RA EXAM ORDER SYNCH was not found.") QUIT
 ;
 ;we know the IEN, time to update the DESCRIPTION (#3.5) field!
 K RATXT(19,"SYNCH")
 S RATXT(19,"SYNCH",1,0)="The RA EXAM ORDER SYNCH option will allow the user to enter a patient name"
 S RATXT(19,"SYNCH",2,0)="to identify radiology exams in a CANCELLED or COMPLETE examination status"
 S RATXT(19,"SYNCH",3,0)="which are linked to an existing VistA Radiology (RIS) order that"
 S RATXT(19,"SYNCH",4,0)="references (points to) a CPRS order in a status other than DISCONTINUED"
 S RATXT(19,"SYNCH",5,0)="(paired with the CANCELLED exam status) or COMPLETE."
 S RAIEN=RAIEN_"," D WP^DIE(19,RAIEN,3.5,"K","RATXT(19,""SYNCH"")","RAERR(19)")
 K RATXT(19,"SYNCH")
 I $D(RAERR(19)) DO  QUIT
 .K RATXT S RATXT(1)="Error: The DESCRIPTION field for the option RA EXAM ORDER SYNCH was not updated."
 .S RATXT(2)="Contact the VistA RIS National Development team regarding this error with RA*5.0*222."
 .D BMES^XPDUTL(.RATXT) K RATXT
 .QUIT
 E  D BMES^XPDUTL("The DESCRIPTION field for the option RA EXAM ORDER SYNCH was updated.")
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRAIPS222   2888     printed  Sep 23, 2025@20:12:30                                                                                                                                                                                                    Page 2
RAIPS222  ;HISC/GJC - Post-init Driver, patch 222 ; Jan 03, 2025@08:56:22
 +1       ;;5.0;Radiology/Nuclear Medicine;**222**;Mar 16, 1998;Build 1
 +2       ;
 +3       ;IA          Type    File         Routine     Tag
 +4       ;-----------------------------------------------------
 +5       ;1157        (S)                  XPDMENU     LOCK
 +6       ;1157        (S)                  XPDMENU     LKOPT
 +7       ;2056        (S)                  DIQ         GET1
 +8       ;10141       (S)                  XPDUTL      BMES
 +9       ;
 +10       QUIT 
 +11      ;
EN        ;The called tag referenced in the RA*5.0*222 build description.
 +1       ;
KEY2OPT   ;Add the RA DELETEXAM key to the RA DELETEXAM 'Exam Deletion' option.
 +1        NEW RAIEN,RAKEYNM,RAKEY,RAOPT,RATXT
 +2        SET (RAKEY,RAOPT)="RA DELETEXAM"
 +3       ;IEN of 'Exam Deletion' option
           SET RAIEN=$$LKOPT^XPDMENU(RAOPT)_","
 +4        IF +RAIEN=0
               Begin DoDot:1
 +5                SET RATXT="'"_RAOPT_"' option not found. Contact the national radiology developers."
 +6                QUIT 
               End DoDot:1
               QUIT 
 +7       ;associate the new key to our option
 +8        DO LOCK^XPDMENU(RAOPT,RAKEY)
 +9       ;did the key to option association succeed or fail?
 +10       SET RAKEYNM=$$GET1^DIQ(19,RAIEN,3)
 +11      ;success
           IF RAKEYNM=RAKEY
               Begin DoDot:1
 +12               SET RATXT=RAKEY_" has been assigned as the key for option '"_RAOPT_"'."
 +13               DO BMES^XPDUTL(RATXT)
 +14               QUIT 
               End DoDot:1
 +15      ;failure
          IF '$TEST
               Begin DoDot:1
 +16               SET RATXT=RAKEY_" has NOT been assigned as the key for option '"_RAOPT_"'."
 +17               DO BMES^XPDUTL(RATXT)
 +18               QUIT 
               End DoDot:1
 +19      ;
OPT       ; *** Now update the DESCRIPTION (#3.5) field for the RA EXAM ORDER SYNCH option record in the OPTION (#19) file. ***
 +1       ;find the option record IEN
 +2        SET RAIEN=$$FIND1^DIC(19,"","CX","RA EXAM ORDER SYNCH","B","","RAERR(19)")
 +3       ;if RAIEN is null likely an error, Display error and quit.
 +4        IF $DATA(RAERR(19,"DIERR"))#2
               Begin DoDot:1
 +5                NEW RAI,RAJ,RATXT
                   SET RAJ=$PIECE(RAERR(19,"DIERR"),U,2)
 +6                FOR RAI=1:1:RAJ
                       SET RATXT(RAI)=$GET(RAERR(19,"DIERR",RAI,"TEXT",1))
 +7                DO BMES^XPDUTL(.RATXT)
 +8                QUIT 
               End DoDot:1
               QUIT 
 +9        IF RAIEN'>0
               DO BMES^XPDUTL("Option: RA EXAM ORDER SYNCH was not found.")
               QUIT 
 +10      ;
 +11      ;we know the IEN, time to update the DESCRIPTION (#3.5) field!
 +12       KILL RATXT(19,"SYNCH")
 +13       SET RATXT(19,"SYNCH",1,0)="The RA EXAM ORDER SYNCH option will allow the user to enter a patient name"
 +14       SET RATXT(19,"SYNCH",2,0)="to identify radiology exams in a CANCELLED or COMPLETE examination status"
 +15       SET RATXT(19,"SYNCH",3,0)="which are linked to an existing VistA Radiology (RIS) order that"
 +16       SET RATXT(19,"SYNCH",4,0)="references (points to) a CPRS order in a status other than DISCONTINUED"
 +17       SET RATXT(19,"SYNCH",5,0)="(paired with the CANCELLED exam status) or COMPLETE."
 +18       SET RAIEN=RAIEN_","
           DO WP^DIE(19,RAIEN,3.5,"K","RATXT(19,""SYNCH"")","RAERR(19)")
 +19       KILL RATXT(19,"SYNCH")
 +20       IF $DATA(RAERR(19))
               Begin DoDot:1
 +21               KILL RATXT
                   SET RATXT(1)="Error: The DESCRIPTION field for the option RA EXAM ORDER SYNCH was not updated."
 +22               SET RATXT(2)="Contact the VistA RIS National Development team regarding this error with RA*5.0*222."
 +23               DO BMES^XPDUTL(.RATXT)
                   KILL RATXT
 +24               QUIT 
               End DoDot:1
               QUIT 
 +25      IF '$TEST
               DO BMES^XPDUTL("The DESCRIPTION field for the option RA EXAM ORDER SYNCH was updated.")
 +26       QUIT 
 +27      ;