source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENPLV2.m@ 1739

Last change on this file since 1739 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1ENPLV2 ;(WIRMFO)/SAB-PROJECT VALIDATION, VALIDATE ONE ENTRY ;1/27/98
2 ;;7.0;ENGINEERING;**23,28,49**;Aug 17, 1993
3IN ; entry point to validate file 6925 entry
4 ; input variables
5 ; ENDA - ien
6 ; ENTY - type of validation
7 ; F - Five Year Facility Plan
8 ; A - Application
9 ; R - Progress Report
10 ; ENFY - current year of FYFP (only applies if ENTY="F")
11 ; ENXMIT - true if transmission checks should be done
12 ; output variables
13 ; ENV - result
14 ; 1 - invalid
15 ; 2 - valid with warnings
16 ; 3 - valid
17 ; ^TMP($J,"V",ENDA,1,ENL(ENS),0) = invalid detail text (if any)
18 ; ^TMP($J,"V",ENDA,2,ENL(ENS),0) = warning detail text (if any)
19 ;
20 N ENBCI,ENFT,ENI,ENL,ENMCI,ENMSG,ENPCI,ENPN,ENPR,ENS,ENSTATI,ENX
21 N ENY,ENY0,ENY1,ENY19,ENY52
22 ;
23 K ^TMP($J,"V",ENDA)
24 S (ENL(1),ENL(2))=0
25 S ENV=3 ; assume valid
26 ;
27 S ENY0=$G(^ENG("PROJ",ENDA,0)),ENY1=$G(^ENG("PROJ",ENDA,1))
28 S ENY19=$G(^ENG("PROJ",ENDA,19)),ENY52=$G(^ENG("PROJ",ENDA,52))
29 S ENPN=$P(ENY0,U) ; project number
30 S ENMCI=$P(ENY0,U,4) ; medical center
31 S ENPR=$P(ENY0,U,6) ; program
32 S ENSTATI=$P(ENY1,U,3) ; status
33 S ENPCI=$P(ENY52,U) ; project category
34 S ENBCI=$P(ENY52,U,2) ; budget category
35 S ENFT=$P(ENY52,U,6) ; facility type
36 ;
37 ; check required fields
38 I $P(ENY0,U)="" S ENS=1,ENMSG="PROJECT NUMBER is required." D MSG
39 I $P(ENY0,U,3)="" S ENS=1,ENMSG="PROJECT TITLE is required." D MSG
40 I $P(ENY0,U,4)="" S ENS=1,ENMSG="MEDICAL CENTER is required." D MSG
41 I $P(ENY1,U,3)="" S ENS=1,ENMSG="STATUS is required." D MSG
42 I $P(ENY0,U,6)="" S ENS=1,ENMSG="PROGRAM is required." D MSG
43 I $P(ENY52,U,6)="" S ENS=1,ENMSG="FACILITY TYPE is required." D MSG
44 I $P(ENY52,U,1)="" S ENS=1,ENMSG="PROJECT CATEGORY is required." D MSG
45 I $P(ENY52,U,2)="" S ENS=1,ENMSG="BUDGET CATEGORY is required." D MSG
46 ;
47 I ENPN]"" D ; project number checks
48 . I ENMCI]"" D
49 . . S ENX=$E($$GET1^DIQ(4,ENMCI_",",99),1,3)
50 . . I $P(ENPN,"-")'=ENX S ENS=2,ENMSG="MEDICAL CENTER's STATION NUMBER ("_ENX_") inconsistent with PROJECT NUMBER ("_ENPN_")." D MSG
51 . I ENPR]"" D
52 . . 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
53 . . 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
54 . I ENFT]"" D
55 . . I "89"[$E(ENPN),ENFT'="NCS" S ENS=1,ENMSG="FACILITY TYPE is not NCS but PROJECT NUMBER begins with "_$E(ENPN)_"." D MSG
56 . . I "89"'[$E(ENPN),ENFT="NCS" S ENS=1,ENMSG="FACILITY TYPE is NCS but PROJECT NUMBER begins with "_$E(ENPN)_"." D MSG
57 ;
58 I ENFT]"" D ; facility type checks
59 . I ENPR]"" D
60 . . I ENFT="NCS","^MA^MI^SL^LE^"'[(U_ENPR_U) S ENS=1,ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")." D MSG
61 . . 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
62 . . I ENFT="VBA","^MI^MM^NR^LE^"'[(U_ENPR_U) S ENS=1,ENMSG="PROGRAM ("_ENPR_") inconsistent with FACILITY TYPE ("_ENFT_")." D MSG
63 . I ENPCI]"" D
64 . . 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
65 . I ENBCI]"" D
66 . . 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
67 ;
68 D ^ENPLV3
69 D:ENTY="F" ^ENPLV4
70 D:ENTY="A" ^ENPLV5
71 D:ENTY="R" ^ENPLV7
72 ;
73EX ;
74 S:ENL(1) ^TMP($J,"V",ENDA,1,0)=U_U_ENL(1)_U_ENL(1)_U_DT
75 S:ENL(2) ^TMP($J,"V",ENDA,2,0)=U_U_ENL(2)_U_ENL(2)_U_DT
76 Q
77MSG ; save message
78 ; ENL(ENS) - last line used in array
79 ; ENMSG - messsage
80 ; ENS - severity (1,2) 1 invalid, 2 warning
81 I ENV>ENS S ENV=ENS
82 S ENL(ENS)=ENL(ENS)+1,^TMP($J,"V",ENDA,ENS,ENL(ENS),0)=ENMSG
83 Q
84 ;ENPLV2
Note: See TracBrowser for help on using the repository browser.