source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENFAVAL.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: 5.5 KB
RevLine 
[613]1ENFAVAL ;(WIRMFO)/KLD/SAB; VALIDITY CHECKS FOR Fx DOCS ;2/18/99
2 ;;7.0;ENGINEERING;**25,29,33,38,39,46,60**;Aug 17, 1993
3ST ;
4 N ENC,X
5 S ENC("BAD")=0
6 F I=1:1 X "S T=$P($T("_ENFAP("DOC")_"CHK+I),"";;"",2)" Q:T["END" D
7 . I ENFAP("DOC")="FA" D Q
8 . . Q:$P(ENEQ(+T),U,$P(T,";",2))]"" D SET("Missing "_$P(T,";",3))
9 . Q:$P(ENFAP(+T),U,$P(T,";",2))]"" D SET("Missing "_$P(T,";",3))
10 I ENFAP("DOC")="FA" D FA
11 I ENFAP("DOC")="FC" D FC
12 I ENFAP("DOC")="FD" D FD
13 I ENFAP("DOC")="FR" D FR
14 I ENC("BAD")>0 S ^TMP($J,"BAD",ENEQ("DA"))=ENC("BAD")
15 K I,T Q
16 ;
17FA ;Check for appropriate values of certain required fields
18 I $P(ENEQ(2),U,3)]"" D:$P(ENEQ(2),U,3)'>0 SET("Asset Value must be greater than 0.00")
19 I $P(ENEQ(3),U,4)]"" D:$P(ENEQ(3),U,4)>0 SET("Acquisition Method inappropriate")
20 I $P(ENEQ(0),U,4)]"" D:$P(ENEQ(0),U,4)'="NX" SET("Not non-expendable")
21 D:'$P(ENEQ(8),U,2) SET("Asset not capitalized")
22 I $P(ENEQ(9),U,6)]"" D
23 . S X=$G(^ENG(6914.4,$P(ENEQ(9),U,6),0))
24 . I $P(X,U)="" D SET("BOC invalid pointer")
25 . I $P(X,U,5)]"",$P(X,U,5)'>DT D SET("BOC has been deactivated")
26 I $P(ENEQ(8),U,6)]"" D
27 . I '$D(^ENG(6914.3,$P(ENEQ(8),U,6))) D SET("SGL invalid pointer") Q
28 . S X=$G(^ENG(6914.3,$P(ENEQ(8),U,6),0))
29 . I $P(X,U)="6100" D SET("NX SGL account of 6100")
30 . I $P(X,U,5)]"",$P(X,U,5)'>DT D SET("SGL has been deactivated")
31 I $P(ENEQ(9),U,7)]"" D
32 . S X=$G(^ENG(6914.6,$P(ENEQ(9),U,7),0))
33 . I $P(X,U)="" D SET("FUND invalid pointer")
34 . I $P(X,U,5)]"",$P(X,U,5)'>DT D SET("FUND has been deactivated")
35 I $P(ENEQ(2),U,9)]"" D
36 . S ENFAP("LOC")=$$LOC($$GET1^DIQ(6914,ENEQ("DA"),19))
37 . I ENFAP("LOC")="" D SET("Invalid CMR") Q
38 . I $P(ENEQ(9),U,8)]"" D
39 . . S X=$O(^ENG(6914.9,"B",ENFAP("LOC"),0))
40 . . Q:'X
41 . . S Y=$P($G(^ENG(6914.9,X,0)),U,4)
42 . . I Y]"",Y'=$P(ENEQ(9),U,8) D SET("CMR inappropriate for A/O")
43 I $P(ENEQ(2),U,8)]"" D
44 . S ENFAP("GRP")=$$GROUP($$GET1^DIQ(6914,ENEQ("DA"),18))
45 . I 'ENFAP("GRP") D SET("Invalid CSN") Q
46 . I $P(ENEQ(8),U,6)]"",'$O(^ENG(6914.3,$P(ENEQ(8),U,6),1,"B",ENFAP("GRP"),0)) D SET("CSN inappropriate for SGL")
47 I $P(ENEQ(2),U,4)]"",+$E($P(ENEQ(2),U,4),4,5)'>0 D SET("Acquisition Month Missing")
48 I $P(ENEQ(2),U,10)]"" D
49 . I +$E($P(ENEQ(2),U,10),4,5)'>0 D SET("Replacement Month Missing")
50 . I $P(ENEQ(2),U,4)]"",$P(ENEQ(2),U,10)<$P(ENEQ(2),U,4) D SET("Replacement Date preceeds Acquisition Date")
51 Q
52 ;
53FC ;Check for problems with CSN and/or CMR
54 I $P(ENFAP(100),U)]"" D
55 . I $P(ENFAP(3),U,9)="" D SET("CSN is unacceptable for capitalized NX") Q
56 . I $P(ENEQ(8),U,6)]"",'$O(^ENG(6914.3,$P(ENEQ(8),U,6),1,"B",$P(ENFAP(3),U,9),0)) D SET("CSN inappropriate for SGL")
57 I $P(ENFAP(100),U,2)]"",$P(ENFAP(3),U,10)="" D SET("CMR is unacceptable for capitalized NX")
58 ;check date order (ACQUISITION & REPLACEMENT)
59 I $P(ENFAP(100),U,6)]""!($P(ENFAP(100),U,7)]"") D
60 . N ENAD,ENRD
61 . S ENAD=$S($P(ENFAP(100),U,6)]"":$P(ENFAP(100),U,6),1:$P(ENEQ(2),U,4))
62 . S ENRD=$S($P(ENFAP(100),U,7)]"":$P(ENFAP(100),U,7),1:$P(ENEQ(2),U,10))
63 . I ENAD=""!(ENRD="") Q
64 . I ENRD'>ENAD D SET("REPLACEMENT DATE must follow ACQUISITION DATE.")
65 Q
66 ;
67FD ; Check for probems with disp date
68 I $P(ENFAP(100),U,3)>DT D SET("DISPOSITION DATE must not be later than Today.")
69 Q
70 ;
71FR ; Check for problems with CMR
72 I $P(ENFAP(100),U,6)]"",$$LOC($P($G(^ENG(6914.1,$P(ENFAP(100),U,6),0)),U))="" D SET("CMR is unacceptable for capitalized NX")
73 I $P(ENFAP(100),U,3)]""!($P(ENFAP(100),U,6)]"") D ; new A/O or new CMR
74 . N ENAO,ENCMR
75 . S ENAO=$S($P(ENFAP(100),U,3)]"":$P(ENFAP(100),U,3),1:$P(ENEQ(9),U,8))
76 . S ENCMR=$S($P(ENFAP(100),U,6)]"":$P(ENFAP(100),U,6),1:$P(ENEQ(2),U,9))
77 . I ENAO=""!(ENCMR="") Q
78 . S ENFAP("LOC")=$$LOC($P($G(^ENG(6914.1,ENCMR,0)),U))
79 . I ENFAP("LOC")="" Q
80 . S X=$O(^ENG(6914.9,"B",ENFAP("LOC"),0))
81 . I X'>0 Q
82 . S Y=$P($G(^ENG(6914.9,X,0)),U,4)
83 . I Y]"",Y'=ENAO D SET("CMR inappropriate for A/O")
84 I $P(ENFAP(100),U,5)]"" D
85 . S X=$G(^ENG(6914.4,$P(ENFAP(100),U,5),0))
86 . I $P(X,U)="" D SET("BOC invalid pointer")
87 . I $P(X,U,5)]"",$P(X,U,5)'>DT D SET("BOC has been deactivated")
88 I $P(ENFAP(100),U,2)]"" D
89 . S X=$G(^ENG(6914.6,$P(ENFAP(100),U,2),0))
90 . I $P(X,U)="" D SET("FUND invalid pointer")
91 . I $P(X,U,5)]"",$P(X,U,5)'>DT D SET("FUND has been deactivated")
92 Q
93SET(X) ;Record problems
94 S ENC("BAD")=ENC("BAD")+1,^TMP($J,"BAD",ENEQ("DA"),ENC("BAD"))=X
95 Q
96 ;
97LOC(CMR) ;Accepts CMR and checks 1st two char
98 ;Returns FAP LOCATION (EIL)
99 S ENFAP("LOC")=$E(CMR,1,2) I ENFAP("LOC")'?2N S ENFAP("LOC")="" G LOCDN
100 I ENFAP("LOC")]"",'$D(^ENG(6914.9,"B",ENFAP("LOC"))) S ENFAP("LOC")=""
101 ;I "^73^74^79^"[(U_ENFAP("LOC")_U) S ENFAP("LOC")=""
102 ;I ENFAP("LOC")>83,"^86^88^90^98^99^"'[(U_ENFAP("LOC")_U) S ENFAP("LOC")=""
103LOCDN Q ENFAP("LOC")
104 ;
105GROUP(CSN) ;Accepts CSN and returns FAP GROUP
106 N FSC S FSC=$E(CSN,1,4) ;Federal Supply Classification
107 I FSC'?4N S ENFAP("GRP")=0 G GRPDUN
108 I "7020^7021^7025^7035^7040^7050^7435"[FSC S ENFAP("GRP")=FSC
109 E S ENFAP("GRP")=$E(FSC,1,2)_"00"
110GRPDUN Q ENFAP("GRP")
111 ;
112FACHK ;;
113 ;;0;4;Type of Entry
114 ;;8;6;General Ledger Account
115 ;;2;8;Category Stock Number
116 ;;2;9;CMR
117 ;;2;4;Acquisition Date
118 ;;9;7;Fund
119 ;;9;8;A.O. Code
120 ;;9;6;Budget Object Code
121 ;;2;6;Life Expectancy
122 ;;2;3;Acquisition Value
123 ;;3;4;Acquitition Method
124 ;;9;9;Equity Account
125 ;;END
126FBCHK ;;
127 ;;3;7;Betterment Number
128 ;;3;12;Acquisition Method
129 ;;6;2;Equity Account
130 ;;4;4;Dollar Amount
131 ;;END
132FCCHK ;;
133 ;;3;8;Betterment Number
134 ;;END
135FDCHK ;;
136 ;;5;4;Disposition Method
137 ;;5;5;Disposition Year
138 ;;5;6;Disposition Month
139 ;;5;7;Disposition Day
140 ;;5;8;Selling Price
141 ;;5;9;Disposition Authority
142 ;;END
143FRCHK ;;
144 ;;3;9;New Fund Code
145 ;;3;10;New A.O. Code
146 ;;3;11;New Owning Station
147 ;;3;12;New Xprogram
148 ;;END
Note: See TracBrowser for help on using the repository browser.