GMRCACTM ; SLC/DLT,DCM,JFR - Set action menus  ;10/17/01 22:41
 ;;3.0;CONSULT/REQUEST TRACKING;**1,4,11,18,15,17,22,55**;DEC 27, 1997;Build 4
 ;
 ; This routine invokes IA #2425
 ;
CPRS(GMRCPM,GUI) ;Entry point for setting menu actions for CPRS user
 ;Input:
 ;  GMRCPM=a list of File 123 IEN's to check for menu actions.
 ;       Passed in as '300;303;295;309;313'
 ;  GUI =1 if coming from the GUI; return field name in ORFLG also
 ;Output:
 ;  ORFLG(ien)= A^B^C^D^E^F^G^H where:
 ;    Ien = internal entry of record in file 123
 ;    A = a number representing one of the following:
 ;       1 - user has only review capabilities
 ;       2 - user has full update capabilities
 ;       3 - user has administrative update capabilities
 ;       4 - user has full update and admin user capabilities
 ;       5 - user has full update capabilities via unrestricted access
 ;    B = field in file 123.5 (REQUEST SERVICES) that gave the user 
 ;        update authority (ex.  Update user w/o Notification)
 ;    C = Service in file 123.5 (REQUEST SERVICES) that gave the user
 ;        update authority (ex. CARDIOLOGY,NEUROLOGY)
 ;    D = contains a 1 if user is allowed to associate medicine results
 ;        with a consult procedure request
 ;    F = contain a 1 if user can disassociate a medicine result that was
 ;        incorrectly associated with a consult procedure request
 ;    G = contains a 1 if user is allowed to EDIT and RESUBMIT a canceled
 ;        request
 ;    H = 0-4 depending on actions allowed on a Clin. Proc. request
 ;
 I '$L(GMRCPM) S ORFLG=1 Q
 K ORFLG
 N I,GMRCSS,GMRCIEN
 F I=1:1 S ORFLG=1,GMRCIEN=$P(GMRCPM,";",I) Q:GMRCIEN=""  D
 .S ORFLG(GMRCIEN)=1 ;set default answer to read only
 .I $P($G(^GMR(123,GMRCIEN,12)),U,5)="P" D  Q  ;IFC placer so only ED/RES
 .. ;can user edit/resubmit
 .. I $$VALPROV^GMRCEDIT(GMRCIEN) S $P(ORFLG(GMRCIEN),U,6)=1
 .S GMRCSS=+$P($G(^GMR(123,+GMRCIEN,0)),"^",5)
 .Q:'+$G(GMRCSS)
 .;when service is defined, check for service user 
 .D EN
 .S ORFLG(GMRCIEN)=ORFLG
 . ;what actions to allow if a Clincial Procedure
 . S $P(ORFLG(GMRCIEN),U,7)=$$CPACTM^GMRCCP(GMRCIEN)
 .I ORFLG>1 D
 .. ;can DUZ associate med results?  only if not a CP!
 .. N P4
 .. S P4=$S(+$P(ORFLG(GMRCIEN),U,7):0,1:$$CANDOMED^GMRCGUIU(GMRCIEN))
 .. S $P(ORFLG(GMRCIEN),U,4)=P4
 . ;can DUZ disassociate a med result?
 . S $P(ORFLG(GMRCIEN),U,5)=+$$REMUSR^GMRCDIS(GMRCIEN)
 . ;can user edit/resubmit
 . I $$VALPROV^GMRCEDIT(GMRCIEN) S $P(ORFLG(GMRCIEN),U,6)=1
 . Q
 Q
 ;
EN ;Set GMRCACTM with appropriate menu of actions based on user
 ;If ORFLG is DEFINED then GMRCACTM is returned as a set of codes:
 ;    1 = GMRCACTM USER REVIEW SCREEN - simple actions
 ;    2 = GMRCACTM SERVICE ACTION menu  - all actions possible for
 ;        clinical user in service
 ;    3 =  administrative user
 ; initialize GMRCACTM for read only
 S GMRCACTM="GMRCACTM USER REVIEW SCREEN"
 ; if service and entry aren't defined, assume read only access
 I '$D(XQADATA),$S('+$G(GMRCSS):1,1:0) D  Q
 .I $D(ORFLG) S ORFLG(GMRCIEN)=1 K GMRCACTM
 .Q
 ;
 ;Get the users service update level
 N GMRCFLG
 S GMRCFLG=$$VALID^GMRCAU(+GMRCSS,"",,$G(GUI))
 S:+GMRCFLG=1 GMRCFLG=$S(($D(ORFLG)&($$PATCH^XPDUTL("OR*3.0*243"))):"5^"_$P(GMRCFLG,U,2,9999),1:"2^"_$P(GMRCFLG,U,2,9999))
 ;
 ;If ORFLG is all that should be returned, than set and exit
 I $D(ORFLG) D  Q
 . K GMRCACTM
 . I GMRCFLG=0 S ORFLG=1 Q
 . S ORFLG=GMRCFLG Q
 ;
 ; If GMRCSS=and IFC sending service, only allow review screen
 I $D(^GMR(123.5,+GMRCSS,"IFC")),$P(^("IFC"),U) S GMRCFLG=0
 ;
 ;Process the GMRCFLG value to get the GMRCACTM defined.
 I GMRCFLG>0 D  Q
 . S GMRCACTM="GMRCACTM SERVICE ACTION MENU"
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRCACTM   3759     printed  Sep 23, 2025@19:20:57                                                                                                                                                                                                    Page 2
GMRCACTM  ; SLC/DLT,DCM,JFR - Set action menus  ;10/17/01 22:41
 +1       ;;3.0;CONSULT/REQUEST TRACKING;**1,4,11,18,15,17,22,55**;DEC 27, 1997;Build 4
 +2       ;
 +3       ; This routine invokes IA #2425
 +4       ;
CPRS(GMRCPM,GUI) ;Entry point for setting menu actions for CPRS user
 +1       ;Input:
 +2       ;  GMRCPM=a list of File 123 IEN's to check for menu actions.
 +3       ;       Passed in as '300;303;295;309;313'
 +4       ;  GUI =1 if coming from the GUI; return field name in ORFLG also
 +5       ;Output:
 +6       ;  ORFLG(ien)= A^B^C^D^E^F^G^H where:
 +7       ;    Ien = internal entry of record in file 123
 +8       ;    A = a number representing one of the following:
 +9       ;       1 - user has only review capabilities
 +10      ;       2 - user has full update capabilities
 +11      ;       3 - user has administrative update capabilities
 +12      ;       4 - user has full update and admin user capabilities
 +13      ;       5 - user has full update capabilities via unrestricted access
 +14      ;    B = field in file 123.5 (REQUEST SERVICES) that gave the user 
 +15      ;        update authority (ex.  Update user w/o Notification)
 +16      ;    C = Service in file 123.5 (REQUEST SERVICES) that gave the user
 +17      ;        update authority (ex. CARDIOLOGY,NEUROLOGY)
 +18      ;    D = contains a 1 if user is allowed to associate medicine results
 +19      ;        with a consult procedure request
 +20      ;    F = contain a 1 if user can disassociate a medicine result that was
 +21      ;        incorrectly associated with a consult procedure request
 +22      ;    G = contains a 1 if user is allowed to EDIT and RESUBMIT a canceled
 +23      ;        request
 +24      ;    H = 0-4 depending on actions allowed on a Clin. Proc. request
 +25      ;
 +26       IF '$LENGTH(GMRCPM)
               SET ORFLG=1
               QUIT 
 +27       KILL ORFLG
 +28       NEW I,GMRCSS,GMRCIEN
 +29       FOR I=1:1
               SET ORFLG=1
               SET GMRCIEN=$PIECE(GMRCPM,";",I)
               if GMRCIEN=""
                   QUIT 
               Begin DoDot:1
 +30      ;set default answer to read only
                   SET ORFLG(GMRCIEN)=1
 +31      ;IFC placer so only ED/RES
                   IF $PIECE($GET(^GMR(123,GMRCIEN,12)),U,5)="P"
                       Begin DoDot:2
 +32      ;can user edit/resubmit
 +33                       IF $$VALPROV^GMRCEDIT(GMRCIEN)
                               SET $PIECE(ORFLG(GMRCIEN),U,6)=1
                       End DoDot:2
                       QUIT 
 +34               SET GMRCSS=+$PIECE($GET(^GMR(123,+GMRCIEN,0)),"^",5)
 +35               if '+$GET(GMRCSS)
                       QUIT 
 +36      ;when service is defined, check for service user 
 +37               DO EN
 +38               SET ORFLG(GMRCIEN)=ORFLG
 +39      ;what actions to allow if a Clincial Procedure
 +40               SET $PIECE(ORFLG(GMRCIEN),U,7)=$$CPACTM^GMRCCP(GMRCIEN)
 +41               IF ORFLG>1
                       Begin DoDot:2
 +42      ;can DUZ associate med results?  only if not a CP!
 +43                       NEW P4
 +44                       SET P4=$SELECT(+$PIECE(ORFLG(GMRCIEN),U,7):0,1:$$CANDOMED^GMRCGUIU(GMRCIEN))
 +45                       SET $PIECE(ORFLG(GMRCIEN),U,4)=P4
                       End DoDot:2
 +46      ;can DUZ disassociate a med result?
 +47               SET $PIECE(ORFLG(GMRCIEN),U,5)=+$$REMUSR^GMRCDIS(GMRCIEN)
 +48      ;can user edit/resubmit
 +49               IF $$VALPROV^GMRCEDIT(GMRCIEN)
                       SET $PIECE(ORFLG(GMRCIEN),U,6)=1
 +50               QUIT 
               End DoDot:1
 +51       QUIT 
 +52      ;
EN        ;Set GMRCACTM with appropriate menu of actions based on user
 +1       ;If ORFLG is DEFINED then GMRCACTM is returned as a set of codes:
 +2       ;    1 = GMRCACTM USER REVIEW SCREEN - simple actions
 +3       ;    2 = GMRCACTM SERVICE ACTION menu  - all actions possible for
 +4       ;        clinical user in service
 +5       ;    3 =  administrative user
 +6       ; initialize GMRCACTM for read only
 +7        SET GMRCACTM="GMRCACTM USER REVIEW SCREEN"
 +8       ; if service and entry aren't defined, assume read only access
 +9        IF '$DATA(XQADATA)
               IF $SELECT('+$GET(GMRCSS):1,1:0)
                   Begin DoDot:1
 +10                   IF $DATA(ORFLG)
                           SET ORFLG(GMRCIEN)=1
                           KILL GMRCACTM
 +11                   QUIT 
                   End DoDot:1
                   QUIT 
 +12      ;
 +13      ;Get the users service update level
 +14       NEW GMRCFLG
 +15       SET GMRCFLG=$$VALID^GMRCAU(+GMRCSS,"",,$GET(GUI))
 +16       if +GMRCFLG=1
               SET GMRCFLG=$SELECT(($DATA(ORFLG)&($$PATCH^XPDUTL("OR*3.0*243"))):"5^"_$PIECE(GMRCFLG,U,2,9999),1:"2^"_$PIECE(GMRCFLG,U,2,9999))
 +17      ;
 +18      ;If ORFLG is all that should be returned, than set and exit
 +19       IF $DATA(ORFLG)
               Begin DoDot:1
 +20               KILL GMRCACTM
 +21               IF GMRCFLG=0
                       SET ORFLG=1
                       QUIT 
 +22               SET ORFLG=GMRCFLG
                   QUIT 
               End DoDot:1
               QUIT 
 +23      ;
 +24      ; If GMRCSS=and IFC sending service, only allow review screen
 +25       IF $DATA(^GMR(123.5,+GMRCSS,"IFC"))
               IF $PIECE(^("IFC"),U)
                   SET GMRCFLG=0
 +26      ;
 +27      ;Process the GMRCFLG value to get the GMRCACTM defined.
 +28       IF GMRCFLG>0
               Begin DoDot:1
 +29               SET GMRCACTM="GMRCACTM SERVICE ACTION MENU"
               End DoDot:1
               QUIT 
 +30       QUIT