RAMAGU10 ;HCIOFO/SG - ORDERS/EXAMS API (RAMISC VALID. #74) ; 3/5/09 2:23pm
 ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
 ;
 Q
 ;
 ;***** VALIDATES RAMISC PARAMETERS RELATED TO THE FILE #74
 ;
 ; RAIENS        IENS of the report (file #74)
 ;
 ; RACTION       Action (can be combined):
 ;                 E  Examined (procedure has been performed)
 ;                 C  Complete
 ;
 ; .RAMISC       Reference to a local array containing miscellaneous
 ;               request parameters.
 ;
 ; .RAFDA(       Reference to a local array where field values will
 ;               be prepared for storage (FileMan FDA array).
 ;
 ;   "RACNT")    This is an additional node that stores counter for
 ;               the IENS placeholders. Do not forget to remove this
 ;               node before passing the array into a FileMan API.
 ;
 ;   "RAIENS")   This is an additional node that stores IENS of the
 ;               record being processed. Do not forget to remove this 
 ;               node before passing the array into a FileMan API.
 ;
 ; [RAFDACNT]    New value for the placeholder counter for the RAFDA. 
 ;               If this parameter is greater than zero, it replaces
 ;               the value stored in the RAFDA("RACNT").
 ;
 ; Input variables:
 ;   RAMSPSDEFS
 ;
 ; Return values:
 ;       <0  Error code
 ;        0  Ok
 ;
VAL74(RAIENS,RACTION,RAMISC,RAFDA,RAFDACNT) ;
 N ERRCNT,RC,TMP
 ;
 ;--- Check required parameters and variables
 S RC=$$CHKREQ^RAUTL22("RACTION,RAIENS")  Q:RC<0 RC
 Q:$TR(RACTION,"EC")'="" $$IPVE^RAERR("RACTION")
 ;
 ;--- Initialize variables
 S RAFDA("RAIENS")=RAIENS
 S:$G(RAFDACNT)>0 RAFDA("RACNT")=+RAFDACNT
 S (ERRCNT,RC)=0
 ;
 ;--- Validate parameters specific to the 'COMPLETE' status
 I RACTION["C"  D  S:TMP<0 ERRCNT=ERRCNT+1
 . S TMP=$$VCOMPLT(RAIENS,RACTION,.RAMISC,.RAFDA)
 ;
 ;--- Error handling and cleanup
 Q $S(ERRCNT>0:-11,1:0)
 ;
 ;+++++ VALIDATES 'COMPLETE' PARAMETERS
VCOMPLT(RAIENS,RACTION,RAMISC,RAFDA) ;
 N ERRCNT,NAME,PNODE,RC,TMP
 S ERRCNT=0
 ;
 ;=== Word-processing fields
 S:$$VALPRM^RAMAGU09("ACLHIST",,RAIENS)<0 ERRCNT=ERRCNT+1
 S:$$VALPRM^RAMAGU09("IMPRESSION",,RAIENS)<0 ERRCNT=ERRCNT+1
 S:$$VALPRM^RAMAGU09("REPORT",,RAIENS,,"R")<0 ERRCNT=ERRCNT+1
 ;
 ;=== Problem statement
 S RC=$$VALPRM^RAMAGU09("PROBSTAT",,RAIENS)
 I RC>0  D
 . K RAFDA(74,RAIENS,25)  ; Do not store directly
 E  S:RC<0 ERRCNT=ERRCNT+1
 ;
 ;=== Report date
 S NAME="RPTDTE"
 S:$D(RAMISC(NAME))#10 RAMISC(NAME)=RAMISC(NAME)\1  ; Strip the time
 S:$$VALPRM^RAMAGU09(NAME,,RAIENS,,"R")<0 ERRCNT=ERRCNT+1
 ;
 ;=== Transcriptionist
 S:$$VALPRM^RAMAGU09("TRANSCRST",,RAIENS)<0 ERRCNT=ERRCNT+1
 ;
 ;=== Verification date
 S:$$VALPRM^RAMAGU09("VERDTE",,RAIENS)<0 ERRCNT=ERRCNT+1
 ;
 ;=== Verifying physician
 S:$$VALPRM^RAMAGU09("VERPHYS",,RAIENS)<0 ERRCNT=ERRCNT+1
 ;
 ;=== Report status
 S PNODE=$NA(RAMISC("RPTSTATUS"))
 S:'($D(@PNODE)#10) @PNODE="V"
 I @PNODE'="V",@PNODE'="EF"  D:$P($G(RAMSPSDEFS("R")),U,12)
 . D IPVE^RAERR(PNODE)  S ERRCNT=ERRCNT+1
 ;
 ;=== Error handling and cleanup
 Q $S(ERRCNT>0:-11,1:0)
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRAMAGU10   3163     printed  Sep 23, 2025@20:13:12                                                                                                                                                                                                    Page 2
RAMAGU10  ;HCIOFO/SG - ORDERS/EXAMS API (RAMISC VALID. #74) ; 3/5/09 2:23pm
 +1       ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
 +2       ;
 +3        QUIT 
 +4       ;
 +5       ;***** VALIDATES RAMISC PARAMETERS RELATED TO THE FILE #74
 +6       ;
 +7       ; RAIENS        IENS of the report (file #74)
 +8       ;
 +9       ; RACTION       Action (can be combined):
 +10      ;                 E  Examined (procedure has been performed)
 +11      ;                 C  Complete
 +12      ;
 +13      ; .RAMISC       Reference to a local array containing miscellaneous
 +14      ;               request parameters.
 +15      ;
 +16      ; .RAFDA(       Reference to a local array where field values will
 +17      ;               be prepared for storage (FileMan FDA array).
 +18      ;
 +19      ;   "RACNT")    This is an additional node that stores counter for
 +20      ;               the IENS placeholders. Do not forget to remove this
 +21      ;               node before passing the array into a FileMan API.
 +22      ;
 +23      ;   "RAIENS")   This is an additional node that stores IENS of the
 +24      ;               record being processed. Do not forget to remove this 
 +25      ;               node before passing the array into a FileMan API.
 +26      ;
 +27      ; [RAFDACNT]    New value for the placeholder counter for the RAFDA. 
 +28      ;               If this parameter is greater than zero, it replaces
 +29      ;               the value stored in the RAFDA("RACNT").
 +30      ;
 +31      ; Input variables:
 +32      ;   RAMSPSDEFS
 +33      ;
 +34      ; Return values:
 +35      ;       <0  Error code
 +36      ;        0  Ok
 +37      ;
VAL74(RAIENS,RACTION,RAMISC,RAFDA,RAFDACNT) ;
 +1        NEW ERRCNT,RC,TMP
 +2       ;
 +3       ;--- Check required parameters and variables
 +4        SET RC=$$CHKREQ^RAUTL22("RACTION,RAIENS")
           if RC<0
               QUIT RC
 +5        if $TRANSLATE(RACTION,"EC")'=""
               QUIT $$IPVE^RAERR("RACTION")
 +6       ;
 +7       ;--- Initialize variables
 +8        SET RAFDA("RAIENS")=RAIENS
 +9        if $GET(RAFDACNT)>0
               SET RAFDA("RACNT")=+RAFDACNT
 +10       SET (ERRCNT,RC)=0
 +11      ;
 +12      ;--- Validate parameters specific to the 'COMPLETE' status
 +13       IF RACTION["C"
               Begin DoDot:1
 +14               SET TMP=$$VCOMPLT(RAIENS,RACTION,.RAMISC,.RAFDA)
               End DoDot:1
               if TMP<0
                   SET ERRCNT=ERRCNT+1
 +15      ;
 +16      ;--- Error handling and cleanup
 +17       QUIT $SELECT(ERRCNT>0:-11,1:0)
 +18      ;
 +19      ;+++++ VALIDATES 'COMPLETE' PARAMETERS
VCOMPLT(RAIENS,RACTION,RAMISC,RAFDA) ;
 +1        NEW ERRCNT,NAME,PNODE,RC,TMP
 +2        SET ERRCNT=0
 +3       ;
 +4       ;=== Word-processing fields
 +5        if $$VALPRM^RAMAGU09("ACLHIST",,RAIENS)<0
               SET ERRCNT=ERRCNT+1
 +6        if $$VALPRM^RAMAGU09("IMPRESSION",,RAIENS)<0
               SET ERRCNT=ERRCNT+1
 +7        if $$VALPRM^RAMAGU09("REPORT",,RAIENS,,"R")<0
               SET ERRCNT=ERRCNT+1
 +8       ;
 +9       ;=== Problem statement
 +10       SET RC=$$VALPRM^RAMAGU09("PROBSTAT",,RAIENS)
 +11       IF RC>0
               Begin DoDot:1
 +12      ; Do not store directly
                   KILL RAFDA(74,RAIENS,25)
               End DoDot:1
 +13      IF '$TEST
               if RC<0
                   SET ERRCNT=ERRCNT+1
 +14      ;
 +15      ;=== Report date
 +16       SET NAME="RPTDTE"
 +17      ; Strip the time
           if $DATA(RAMISC(NAME))#10
               SET RAMISC(NAME)=RAMISC(NAME)\1
 +18       if $$VALPRM^RAMAGU09(NAME,,RAIENS,,"R")<0
               SET ERRCNT=ERRCNT+1
 +19      ;
 +20      ;=== Transcriptionist
 +21       if $$VALPRM^RAMAGU09("TRANSCRST",,RAIENS)<0
               SET ERRCNT=ERRCNT+1
 +22      ;
 +23      ;=== Verification date
 +24       if $$VALPRM^RAMAGU09("VERDTE",,RAIENS)<0
               SET ERRCNT=ERRCNT+1
 +25      ;
 +26      ;=== Verifying physician
 +27       if $$VALPRM^RAMAGU09("VERPHYS",,RAIENS)<0
               SET ERRCNT=ERRCNT+1
 +28      ;
 +29      ;=== Report status
 +30       SET PNODE=$NAME(RAMISC("RPTSTATUS"))
 +31       if '($DATA(@PNODE)#10)
               SET @PNODE="V"
 +32       IF @PNODE'="V"
               IF @PNODE'="EF"
                   if $PIECE($GET(RAMSPSDEFS("R")),U,12)
                       Begin DoDot:1
 +33                       DO IPVE^RAERR(PNODE)
                           SET ERRCNT=ERRCNT+1
                       End DoDot:1
 +34      ;
 +35      ;=== Error handling and cleanup
 +36       QUIT $SELECT(ERRCNT>0:-11,1:0)