source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENPLV7.m@ 1361

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

initial load of WorldVistAEHR

File size: 6.3 KB
Line 
1ENPLV7 ;(WIRMFO)/SAB-PROJECT VALIDATION, VALIDATE ONE ENTRY (cont) ;9/15/97
2 ;;7.0;ENGINEERING;**28**;Aug 17, 1993
3 ; progress report specific checks
4 I "^MA^MI^MM^NR^SL^"'[(U_ENPR_U) S ENS=1,ENMSG="PROGRAM ("_ENPR_") not supported for Progress Reports." D MSG Q
5 N ENMS,ENMSCP,ENMSL,ENMSOK,ENMSP
6 S ENMSOK=$$MSL^ENPRUTL(ENDA) ; applicable milestone list
7 ; obtain current milestones
8 D MSD^ENPRUTL(ENDA)
9 ; determine last applicable, non-optional entered
10 S (ENMSL("A"),ENMSL("P"))=0
11 F ENI=22:-1:1 I $P(ENMSOK,U,ENI) D
12 . Q:"^1^2^3^13^14^16^17^"[(U_ENI_U) ; optional milestones
13 . I 'ENMSL("A"),ENMS("A",ENI)]"" S ENMSL("A")=ENI
14 . I 'ENMSL("P"),ENMS("P",ENI)]""!(ENMS("R",ENI)]"") S ENMSL("P")=ENI
15 ; loop through milestones and validate
16 S (ENMSP("P"),ENMSP("R"),ENMSP("A"))="" ; init previous milestone
17 F ENI=1:1:22 D
18 . S ENMS=$$MS^ENPRUTL(ENI)
19 . I $P(ENMSOK,U,ENI) D ; applicable milestone
20 . . ; check for incomplete date
21 . . I ENMS("P",ENI)]"",$E(ENMS("P",ENI),4,5)="00" S ENS=1,ENMSG=ENMS_" (PLANNED) is missing the month." D MSG
22 . . I ENMS("R",ENI)]"",$E(ENMS("R",ENI),4,5)="00" S ENS=1,ENMSG=ENMS_" (REVISED) is missing the month." D MSG
23 . . I ENMS("A",ENI)]"",$E(ENMS("A",ENI),4,5)="00" S ENS=1,ENMSG=ENMS_" (ACTUAL) is missing the month." D MSG
24 . . ; check for past due
25 . . S ENMSCP=$S(ENMS("R",ENI)]"":ENMS("R",ENI),1:ENMS("P",ENI)) ; current planned
26 . . I ENMS("A",ENI)="",ENMSCP]"",ENMSCP<DT D
27 . . . S ENS=1,ENMSG=ENMS_" past due. Enter actual or update revised date." D MSG
28 . . ; check % for appropriate milestones
29 . . I "^2^8^10^12^21^"[(U_ENI_U) D
30 . . . I ENMS("A",ENI)]"",ENMS("%",ENI)'=100 D
31 . . . . S ENS=1,ENMSG=ENMS_" (ACTUAL) entered, but percentage not 100" D MSG
32 . . . I ENMS("A",ENI)="" D
33 . . . . I ENMS("A",ENI-1)]"",ENMS("%",ENI)="" D
34 . . . . . S ENS=2,ENMSG=ENMS_" percentage is blank (expected 0-99 since actual start date exists)." D MSG
35 . . . . I ENMS("A",ENI-1)="",ENMS("%",ENI)>0 D
36 . . . . . S ENS=1,ENMSG=ENMS_" percentage > 0 but actual start date is blank." D MSG
37 . . I "^2^16^17^"[(U_ENI_U) D ; optional ms: complete date checks
38 . . . N ENIP
39 . . . S ENIP=$S(ENI=2:1,ENI=16:13,ENI=17:14,1:0) Q:'ENIP ; start ms
40 . . . ; check complete date < start date
41 . . . I ENMS("P",ENI)]"",ENMS("P",ENI)<ENMS("P",ENIP)!(ENMS("P",ENIP)="") D
42 . . . . S ENS=2,ENMSG=ENMS_" (PLANNED) before planned start date." D MSG
43 . . . I ENMS("R",ENI)]"",ENMS("R",ENI)<$S(ENMS("R",ENIP)]"":ENMS("R",ENIP),1:ENMS("P",ENIP))!(ENMS("P",ENIP)=""&(ENMS("R",ENIP)="")) D
44 . . . . S ENS=2,ENMSG=ENMS_" (REVISED) before start date." D MSG
45 . . . I ENMS("A",ENI)]"",ENMS("A",ENI)<ENMS("A",ENIP)!(ENMS("A",ENIP)="") D
46 . . . . S ENS=2,ENMSG=ENMS_" (ACTUAL) before actual start date." D MSG
47 . . Q:"^1^2^3^13^14^16^17^"[(U_ENI_U) ; stop when optional milestones
48 . . ; check for chronological dates
49 . . I ENMS("P",ENI)="",ENI<ENMSL("P") D
50 . . . S ENS=1,ENMSG=ENMS_" (PLANNED) milestone was skipped." D MSG
51 . . I ENMS("A",ENI)="",ENI<ENMSL("A") D
52 . . . S ENS=2,ENMSG=ENMS_" (ACTUAL) milestone was skipped." D MSG
53 . . I ENMS("P",ENI)]"",ENMS("P",ENI)<ENMSP("P") D
54 . . . S ENS=2,ENMSG=ENMS_" (PLANNED) before previous milestone" D MSG
55 . . I ENMS("R",ENI)]"",ENMS("R",ENI)<ENMSP("R") D
56 . . . S ENS=2,ENMSG=ENMS_" (REVISED) before previous milestone" D MSG
57 . . I ENMS("A",ENI)]"",ENMS("A",ENI)<ENMSP("A") D
58 . . . S ENS=2,ENMSG=ENMS_" (ACTUAL) before previous milestone" D MSG
59 . . ; update 'previous' variables
60 . . I ENMS("P",ENI)]"" S (ENMSP("R"),ENMSP("P"))=ENMS("P",ENI)
61 . . I ENMS("R",ENI)]"" S ENMSP("R")=ENMS("R",ENI)
62 . . I ENMS("A",ENI)]"" S ENMSP("A")=ENMS("A",ENI)
63 . I '$P(ENMSOK,U,ENI) D ; inappropriate milestones
64 . . I ENMS("P",ENI)]""!(ENMS("R",ENI)]"")!(ENMS("A",ENI)]"") D
65 . . . S ENS=2,ENMSG=ENMS_" milestone inappropriate for project." D MSG
66 ; compare Status with last actual milestone
67 I ENMSL("A"),$$GET1^DIQ(6925,ENDA,"6:3")<$P("4^4^5^5^6^6^7^7^8^8^9^9^9^9^10^9^9^11^12^12^12^13",U,ENMSL("A")) D
68 . S ENS=2,ENMSG="Status ("_$$GET1^DIQ(6925,ENDA,6)_") appears inappropriate since milestone "_$$MS^ENPRUTL(ENMSL("A"))_" (ACTUAL) exists." D MSG
69 I ENMSL("A")=21,ENMSL("P")'=22,$$GET1^DIQ(6925,ENDA,"6:3")<13 S ENS=2,ENMSG="Project appears to be completed, but has Status ("_$$GET1^DIQ(6925,ENDA,6)_")" D MSG
70 ; check funding years vs. award dates for MA, MI, and MM
71 I "^MA^MI^MM^"[(U_ENPR_U) D
72 . N ENCOFY,ENCOMI
73 . ; select milestone for construction method
74 . S ENI=0,ENCOMI=$$GET1^DIQ(6925,ENDA,8,"I")
75 . I "^1^4^5^"[(U_ENCOMI_U) S ENI=19 ; award
76 . I "^2^"[(U_ENCOMI_U) S ENI=20 ; start
77 . I ENI D
78 . . S ENX=$S(ENMS("A",ENI):ENMS("A",ENI),ENMS("R",ENI):ENMS("R",ENI),ENMS("P",ENI):ENMS("P",ENI),1:"")
79 . . Q:ENX=""
80 . . S ENCOFY=$$GET1^DIQ(6925,ENDA,3.5)
81 . . I $E(ENX+17000000\1,1,4)+$S($E(ENX,4,5)>9:1,1:0)'=ENCOFY S ENS=1,ENMSG=$$MS^ENPRUTL(ENI)_" ("_$$FMTE^XLFDT(ENX,2)_") inconsistant with FUNDING YEAR - CONST ("_ENCOFY_")" D MSG
82 ;
83 I ENPR="NR" D ; NRM program checks
84 . I $P(ENY52,U,7)="" S ENS=1,ENMSG="EPA REPORTABLE (y/n) required for NRM projects." D MSG
85 . I $P(ENY52,U,7)="Y" D
86 . . I $P(ENY52,U,8)="" S ENS=1,ENMSG="EPA REPORTING CATEGORY is required for EPA REPORTABLE (YES)." D MSG
87 . . I $P(ENY52,U,8)]"",ENPCI]"" D
88 . . . D VAL^DIE(6925,ENDA_",",158.7,"","`"_$P(ENY52,U,8),.ENX)
89 . . . I ENX="^" S ENS=1,ENMSG="EPA REPORTING CATEGORY ("_$P($G(^ENG(6925.3,$P(ENY52,U,8),0)),U)_") inconsistent with PROJECT CATEGORY ("_$P($G(^OFM(7336.8,ENPCI,0)),U)_")." D MSG
90 I "^NR^SL^"[(U_ENPR_U) D ; NRM,SL program checks
91 . I $P(ENY52,U,9)]"" D
92 . . S ENX=$P($G(^OFM(7336.8,$P(ENY52,U,9),0)),U)
93 . . I ENX["NHCU" D
94 . . . I $P($G(^ENG("PROJ",ENDA,53)),U,4)="" S ENS=1,ENMSG="NHCU AUTHORIZED BEDS required for BONUS CATEGORY ("_ENX_")." D MSG
95 ;
96 I "^MA^MI^MM^"[(U_ENPR_U) D ; MA,MI,MM program checks
97 . I ENPCI]"" D
98 . . S ENX=$G(^OFM(7336.8,ENPCI,0))
99 . . I $P(ENX,U)["NHCU" D
100 . . . I $P($G(^ENG("PROJ",ENDA,53)),U,4)="" S ENS=1,ENMSG="NHCU AUTHORIZED BEDS required for PROJECT CATEGORY ("_$P(ENX,U)_")." D MSG
101 ;
102 S (ENI,ENX)=0 F S ENI=$O(^ENG("PROJ",ENDA,57,ENI)) Q:'ENI D
103 . S ENX=ENX+$P($G(^ENG("PROJ",ENDA,57,ENI,0)),U,2)
104 I ENX'=+$P(ENY52,U,5) S ENS=1,ENMSG="NHCU BEDS (CONVERTED) ("_$P(ENY52,U,5)_") not equal to sum of NHCU CONVERSION numbers ("_ENX_")." D MSG
105 Q
106MSG ; save message
107 ; ENL(ENS) - last line used in array
108 ; ENMSG - messsage
109 ; ENS - severity (1,2) 1 invalid, 2 warning
110 I ENV>ENS S ENV=ENS
111 S ENL(ENS)=ENL(ENS)+1,^TMP($J,"V",ENDA,ENS,ENL(ENS),0)=ENMSG
112 Q
113 ;ENPLV7
Note: See TracBrowser for help on using the repository browser.