ENPLV2 ;(WIRMFO)/SAB-PROJECT VALIDATION, VALIDATE ONE ENTRY ;1/27/98
;;7.0;ENGINEERING;**23,28,49**;Aug 17, 1993
IN ; entry point to validate file 6925 entry
; input variables
; ENDA - ien
; ENTY - type of validation
; F - Five Year Facility Plan
; A - Application
; R - Progress Report
; ENFY - current year of FYFP (only applies if ENTY="F")
; ENXMIT - true if transmission checks should be done
; output variables
; ENV - result
; 1 - invalid
; 2 - valid with warnings
; 3 - valid
; ^TMP($J,"V",ENDA,1,ENL(ENS),0) = invalid detail text (if any)
; ^TMP($J,"V",ENDA,2,ENL(ENS),0) = warning detail text (if any)
;
N ENBCI,ENFT,ENI,ENL,ENMCI,ENMSG,ENPCI,ENPN,ENPR,ENS,ENSTATI,ENX
N ENY,ENY0,ENY1,ENY19,ENY52
;
K ^TMP($J,"V",ENDA)
S (ENL(1),ENL(2))=0
S ENV=3 ; assume valid
;
S ENY0=$G(^ENG("PROJ",ENDA,0)),ENY1=$G(^ENG("PROJ",ENDA,1))
S ENY19=$G(^ENG("PROJ",ENDA,19)),ENY52=$G(^ENG("PROJ",ENDA,52))
S ENPN=$P(ENY0,U) ; project number
S ENMCI=$P(ENY0,U,4) ; medical center
S ENPR=$P(ENY0,U,6) ; program
S ENSTATI=$P(ENY1,U,3) ; status
S ENPCI=$P(ENY52,U) ; project category
S ENBCI=$P(ENY52,U,2) ; budget category
S ENFT=$P(ENY52,U,6) ; facility type
;
; check required fields
I $P(ENY0,U)="" S ENS=1,ENMSG="PROJECT NUMBER is required." D MSG
I $P(ENY0,U,3)="" S ENS=1,ENMSG="PROJECT TITLE is required." D MSG
I $P(ENY0,U,4)="" S ENS=1,ENMSG="MEDICAL CENTER is required." D MSG
I $P(ENY1,U,3)="" S ENS=1,ENMSG="STATUS is required." D MSG
I $P(ENY0,U,6)="" S ENS=1,ENMSG="PROGRAM is required." D MSG
I $P(ENY52,U,6)="" S ENS=1,ENMSG="FACILITY TYPE is required." D MSG
I $P(ENY52,U,1)="" S ENS=1,ENMSG="PROJECT CATEGORY is required." D MSG
I $P(ENY52,U,2)="" S ENS=1,ENMSG="BUDGET CATEGORY is required." D MSG
;
I ENPN]"" D ; project number checks
. I ENMCI]"" D
. . S ENX=$E($$GET1^DIQ(4,ENMCI_",",99),1,3)
. . I $P(ENPN,"-")'=ENX S ENS=2,ENMSG="MEDICAL CENTER's STATION NUMBER ("_ENX_") inconsistent with PROJECT NUMBER ("_ENPN_")." D MSG
. I ENPR]"" D
. . I "^NR^SL^LE^"[(U_ENPR_U),$L(ENPN,"-")'=3 S ENS=1,ENMSG="PROGRAM ("_ENPR_") inconsistent with format of PROJECT NUMBER ("_ENPN_")." D MSG
. . I "^MA^MI^MM^"[(U_ENPR_U),$L(ENPN,"-")'=2 S ENS=1,ENMSG="PROGRAM ("_ENPR_") inconsistent with format of PROJECT NUMBER ("_ENPN_")." D MSG
. I ENFT]"" D
. . I "89"[$E(ENPN),ENFT'="NCS" S ENS=1,ENMSG="FACILITY TYPE is not NCS but PROJECT NUMBER begins with "_$E(ENPN)_"." D MSG
. . I "89"'[$E(ENPN),ENFT="NCS" S ENS=1,ENMSG="FACILITY TYPE is NCS but PROJECT NUMBER begins with "_$E(ENPN)_"." D MSG
;
I ENFT]"" D ; facility type checks
. I ENPR]"" D
. . I ENFT="NCS","^MA^MI^SL^LE^"'[(U_ENPR_U) S ENS=1,ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")." D MSG
. . I ENFT="VHA","^MA^MI^MM^NR^SL^LE^"'[(U_ENPR_U) S ENS=1,ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")." D MSG
. . I ENFT="VBA","^MI^MM^NR^LE^"'[(U_ENPR_U) S ENS=1,ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")." D MSG
. I ENPCI]"" D
. . S ENX=$G(^OFM(7336.8,ENPCI,0)) I $P(ENX,U,6)'[ENFT S ENS=1,ENMSG="PROJECT CATEGORY ("_$P(ENX,U)_") inconsistent with FACILITY TYPE ("_ENFT_")." D MSG
. I ENBCI]"" D
. . S ENX=$G(^OFM(7336.9,ENBCI,0)) I $P(ENX,U,3)'[ENFT S ENS=1,ENMSG="BUDGET CATEGORY ("_$P(ENX,U)_") inconsistent with FACILITY TYPE ("_ENFT_")." D MSG
;
D ^ENPLV3
D:ENTY="F" ^ENPLV4
D:ENTY="A" ^ENPLV5
D:ENTY="R" ^ENPLV7
;
EX ;
S:ENL(1) ^TMP($J,"V",ENDA,1,0)=U_U_ENL(1)_U_ENL(1)_U_DT
S:ENL(2) ^TMP($J,"V",ENDA,2,0)=U_U_ENL(2)_U_ENL(2)_U_DT
Q
MSG ; save message
; ENL(ENS) - last line used in array
; ENMSG - messsage
; ENS - severity (1,2) 1 invalid, 2 warning
I ENV>ENS S ENV=ENS
S ENL(ENS)=ENL(ENS)+1,^TMP($J,"V",ENDA,ENS,ENL(ENS),0)=ENMSG
Q
;ENPLV2
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENPLV2 3922 printed Dec 13, 2024@01:55:09 Page 2
ENPLV2 ;(WIRMFO)/SAB-PROJECT VALIDATION, VALIDATE ONE ENTRY ;1/27/98
+1 ;;7.0;ENGINEERING;**23,28,49**;Aug 17, 1993
IN ; entry point to validate file 6925 entry
+1 ; input variables
+2 ; ENDA - ien
+3 ; ENTY - type of validation
+4 ; F - Five Year Facility Plan
+5 ; A - Application
+6 ; R - Progress Report
+7 ; ENFY - current year of FYFP (only applies if ENTY="F")
+8 ; ENXMIT - true if transmission checks should be done
+9 ; output variables
+10 ; ENV - result
+11 ; 1 - invalid
+12 ; 2 - valid with warnings
+13 ; 3 - valid
+14 ; ^TMP($J,"V",ENDA,1,ENL(ENS),0) = invalid detail text (if any)
+15 ; ^TMP($J,"V",ENDA,2,ENL(ENS),0) = warning detail text (if any)
+16 ;
+17 NEW ENBCI,ENFT,ENI,ENL,ENMCI,ENMSG,ENPCI,ENPN,ENPR,ENS,ENSTATI,ENX
+18 NEW ENY,ENY0,ENY1,ENY19,ENY52
+19 ;
+20 KILL ^TMP($JOB,"V",ENDA)
+21 SET (ENL(1),ENL(2))=0
+22 ; assume valid
SET ENV=3
+23 ;
+24 SET ENY0=$GET(^ENG("PROJ",ENDA,0))
SET ENY1=$GET(^ENG("PROJ",ENDA,1))
+25 SET ENY19=$GET(^ENG("PROJ",ENDA,19))
SET ENY52=$GET(^ENG("PROJ",ENDA,52))
+26 ; project number
SET ENPN=$PIECE(ENY0,U)
+27 ; medical center
SET ENMCI=$PIECE(ENY0,U,4)
+28 ; program
SET ENPR=$PIECE(ENY0,U,6)
+29 ; status
SET ENSTATI=$PIECE(ENY1,U,3)
+30 ; project category
SET ENPCI=$PIECE(ENY52,U)
+31 ; budget category
SET ENBCI=$PIECE(ENY52,U,2)
+32 ; facility type
SET ENFT=$PIECE(ENY52,U,6)
+33 ;
+34 ; check required fields
+35 IF $PIECE(ENY0,U)=""
SET ENS=1
SET ENMSG="PROJECT NUMBER is required."
DO MSG
+36 IF $PIECE(ENY0,U,3)=""
SET ENS=1
SET ENMSG="PROJECT TITLE is required."
DO MSG
+37 IF $PIECE(ENY0,U,4)=""
SET ENS=1
SET ENMSG="MEDICAL CENTER is required."
DO MSG
+38 IF $PIECE(ENY1,U,3)=""
SET ENS=1
SET ENMSG="STATUS is required."
DO MSG
+39 IF $PIECE(ENY0,U,6)=""
SET ENS=1
SET ENMSG="PROGRAM is required."
DO MSG
+40 IF $PIECE(ENY52,U,6)=""
SET ENS=1
SET ENMSG="FACILITY TYPE is required."
DO MSG
+41 IF $PIECE(ENY52,U,1)=""
SET ENS=1
SET ENMSG="PROJECT CATEGORY is required."
DO MSG
+42 IF $PIECE(ENY52,U,2)=""
SET ENS=1
SET ENMSG="BUDGET CATEGORY is required."
DO MSG
+43 ;
+44 ; project number checks
IF ENPN]""
Begin DoDot:1
+45 IF ENMCI]""
Begin DoDot:2
+46 SET ENX=$EXTRACT($$GET1^DIQ(4,ENMCI_",",99),1,3)
+47 IF $PIECE(ENPN,"-")'=ENX
SET ENS=2
SET ENMSG="MEDICAL CENTER's STATION NUMBER ("_ENX_") inconsistent with PROJECT NUMBER ("_ENPN_")."
DO MSG
End DoDot:2
+48 IF ENPR]""
Begin DoDot:2
+49 IF "^NR^SL^LE^"[(U_ENPR_U)
IF $LENGTH(ENPN,"-")'=3
SET ENS=1
SET ENMSG="PROGRAM ("_ENPR_") inconsistent with format of PROJECT NUMBER ("_ENPN_")."
DO MSG
+50 IF "^MA^MI^MM^"[(U_ENPR_U)
IF $LENGTH(ENPN,"-")'=2
SET ENS=1
SET ENMSG="PROGRAM ("_ENPR_") inconsistent with format of PROJECT NUMBER ("_ENPN_")."
DO MSG
End DoDot:2
+51 IF ENFT]""
Begin DoDot:2
+52 IF "89"[$EXTRACT(ENPN)
IF ENFT'="NCS"
SET ENS=1
SET ENMSG="FACILITY TYPE is not NCS but PROJECT NUMBER begins with "_$EXTRACT(ENPN)_"."
DO MSG
+53 IF "89"'[$EXTRACT(ENPN)
IF ENFT="NCS"
SET ENS=1
SET ENMSG="FACILITY TYPE is NCS but PROJECT NUMBER begins with "_$EXTRACT(ENPN)_"."
DO MSG
End DoDot:2
End DoDot:1
+54 ;
+55 ; facility type checks
IF ENFT]""
Begin DoDot:1
+56 IF ENPR]""
Begin DoDot:2
+57 IF ENFT="NCS"
IF "^MA^MI^SL^LE^"'[(U_ENPR_U)
SET ENS=1
SET ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")."
DO MSG
+58 IF ENFT="VHA"
IF "^MA^MI^MM^NR^SL^LE^"'[(U_ENPR_U)
SET ENS=1
SET ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")."
DO MSG
+59 IF ENFT="VBA"
IF "^MI^MM^NR^LE^"'[(U_ENPR_U)
SET ENS=1
SET ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")."
DO MSG
End DoDot:2
+60 IF ENPCI]""
Begin DoDot:2
+61 SET ENX=$GET(^OFM(7336.8,ENPCI,0))
IF $PIECE(ENX,U,6)'[ENFT
SET ENS=1
SET ENMSG="PROJECT CATEGORY ("_$PIECE(ENX,U)_") inconsistent with FACILITY TYPE ("_ENFT_")."
DO MSG
End DoDot:2
+62 IF ENBCI]""
Begin DoDot:2
+63 SET ENX=$GET(^OFM(7336.9,ENBCI,0))
IF $PIECE(ENX,U,3)'[ENFT
SET ENS=1
SET ENMSG="BUDGET CATEGORY ("_$PIECE(ENX,U)_") inconsistent with FACILITY TYPE ("_ENFT_")."
DO MSG
End DoDot:2
End DoDot:1
+64 ;
+65 DO ^ENPLV3
+66 if ENTY="F"
DO ^ENPLV4
+67 if ENTY="A"
DO ^ENPLV5
+68 if ENTY="R"
DO ^ENPLV7
+69 ;
EX ;
+1 if ENL(1)
SET ^TMP($JOB,"V",ENDA,1,0)=U_U_ENL(1)_U_ENL(1)_U_DT
+2 if ENL(2)
SET ^TMP($JOB,"V",ENDA,2,0)=U_U_ENL(2)_U_ENL(2)_U_DT
+3 QUIT
MSG ; save message
+1 ; ENL(ENS) - last line used in array
+2 ; ENMSG - messsage
+3 ; ENS - severity (1,2) 1 invalid, 2 warning
+4 IF ENV>ENS
SET ENV=ENS
+5 SET ENL(ENS)=ENL(ENS)+1
SET ^TMP($JOB,"V",ENDA,ENS,ENL(ENS),0)=ENMSG
+6 QUIT
+7 ;ENPLV2