source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENFARC3.m@ 1271

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

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1ENFARC3 ;WIRMFO/SAB-FIXED ASSET RPT, TRANSACTION REGISTER (CONT); 12/16/1998
2 ;;7.0;ENGINEERING;**39,60**;Aug 17, 1993
3 Q
4 ;
5FCPVAL(ENFILE,ENIEN,ENFAIEN) ; Determine prior values at time of FC
6 ; Input Variables
7 ; ENFILE - FAP document file for the input document
8 ; ENIEN - IEN of the input document in ENFILE
9 ; ENFAIEN - IEN of the assoicated FA document
10 ; Returns
11 ; EN(30) - previous DESCRIPTION
12 ; EN(34) - previous ACQ METHOD CODE
13 ; EN(105) - previous ACQ DATE (FileMan format)
14 ; also when betterment = 00
15 ; EN(29) - previous LOCATION (NATIONAL EIL)
16 ; EN(37) - previous USEFUL LIFE
17 ; EN(106) - previous REPL DATE (FileMan format)
18 Q:ENFILE'=6915.4 ; must be FC Document
19 N ENDA,ENDOC,ENDTC,ENFC,ENY
20 ; get initial values (from FA or FB)
21 S (EN(30),EN(34),EN(105),EN(29),EN(37),EN(106))=""
22 S ENFC("BETR")=$P($G(^ENG(ENFILE,ENIEN,3)),U,8)
23 I ENFC("BETR")="00" D
24 . S ENDTC("I")=$P($G(^ENG(6915.2,ENFAIEN,0)),U,2) ; date/time of FA
25 . S ENY(3)=$G(^ENG(6915.2,ENFAIEN,3))
26 . S EN(30)=$P(ENY(3),U,15)
27 . S EN(34)=$P(ENY(3),U,19)
28 . I $P(ENY(3),U,16)]"" D
29 . . S EN(105)=$P(ENY(3),U,16)-1700
30 . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,17)))_$P(ENY(3),U,17)
31 . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,18)))_$P(ENY(3),U,18)
32 . S EN(29)=$P(ENY(3),U,8)
33 . S EN(37)=$P(ENY(3),U,24)
34 . I $P(ENY(3),U,21)]"" D
35 . . S EN(106)=$P(ENY(3),U,21)-1700
36 . . S EN(106)=EN(106)_$E("00",1,2-$L($P(ENY(3),U,22)))_$P(ENY(3),U,22)
37 . . S EN(106)=EN(106)_$E("00",1,2-$L($P(ENY(3),U,23)))_$P(ENY(3),U,23)
38 I ENFC("BETR")'="00" D
39 . S ENFC("FB")=$P($G(^ENG(6915.4,ENIEN,100)),U,5) ; betterment pointer
40 . S ENDTC("I")=$P($G(^ENG(6915.3,ENFC("FB"),0)),U,2) ; date/time of FB
41 . S ENY(3)=$S(ENFC("FB"):$G(^ENG(6915.3,ENFC("FB"),3)),1:"")
42 . S EN(30)=$P(ENY(3),U,8)
43 . S EN(34)=$P(ENY(3),U,12)
44 . I $P(ENY(3),U,9)]"" D
45 . . S EN(105)=$P(ENY(3),U,9)-1700
46 . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,10)))_$P(ENY(3),U,10)
47 . . S EN(105)=EN(105)_$E("00",1,2-$L($P(ENY(3),U,11)))_$P(ENY(3),U,11)
48 ; Construct chrono list of FC and FR in time frame for Equipment
49 S ENY(0)=$G(^ENG(ENFILE,ENIEN,0))
50 S ENDA("EQ")=$P(ENY(0),U) ; equip id
51 S ENDTC("F?")=$P(ENY(0),U,2) ; date/time of input doc
52 ; add FC documents to list
53 S ENDA("FC")=0
54 F S ENDA("FC")=$O(^ENG(6915.4,"B",ENDA("EQ"),ENDA("FC"))) Q:'ENDA("FC") D
55 . S ENDTC("FC")=$P($G(^ENG(6915.4,ENDA("FC"),0)),U,2)
56 . I ENDTC("FC")>ENDTC("I"),ENDTC("FC")<ENDTC("F?") D
57 . . Q:ENFC("BETR")'=$P($G(^ENG(ENFILE,ENDA("FC"),3)),U,8) ; diff betr
58 . . S ENDOC(ENDTC("FC"),"6915.4;"_ENDA("FC"))=""
59 ; add FR documents to list
60 S ENDA("FR")=0
61 F S ENDA("FR")=$O(^ENG(6915.6,"B",ENDA("EQ"),ENDA("FR"))) Q:'ENDA("FR") D
62 . S ENDTC("FR")=$P($G(^ENG(6915.6,ENDA("FR"),0)),U,2)
63 . I ENDTC("FR")>ENDTC("I"),ENDTC("FR")<ENDTC("F?") D
64 . . S ENDOC(ENDTC("FR"),"6915.6;"_ENDA("FR"))=""
65 ; Loop thru chrono list and update initial values as appropriate
66 S ENDTC="" F S ENDTC=$O(ENDOC(ENDTC)) Q:ENDTC="" D
67 . S ENY="" F S ENY=$O(ENDOC(ENDTC,ENY)) Q:ENY="" D
68 . . S ENFILE=$P(ENY,";"),ENDA=$P(ENY,";",2)
69 . . I ENFILE=6915.4 D ; FC Document
70 . . . S ENY(3)=$G(^ENG(6915.4,ENDA,3))
71 . . . S ENY(4)=$G(^ENG(6915.4,ENDA,4))
72 . . . S ENY(100)=$G(^ENG(6915.4,ENDA,100))
73 . . . S:$P(ENY(3),U,11)]"" EN(30)=$P(ENY(3),U,11)
74 . . . S:$P(ENY(3),U,15)]"" EN(34)=$P(ENY(3),U,15)
75 . . . S:$P(ENY(100),U,6)]"" EN(105)=$P(ENY(100),U,6)
76 . . . S:$P(ENY(3),U,10)]"" EN(29)=$P(ENY(3),U,10)
77 . . . S:$P(ENY(4),U,3)]"" EN(37)=$P(ENY(4),U,3)
78 . . . S:$P(ENY(100),U,7)]"" EN(106)=$P(ENY(100),U,Y)
79 . . I ENFILE=6915.6 D ; FR Document
80 . . . S ENY(3)=$G(^ENG(6915.6,ENDA,3))
81 . . . S:$P(ENY(3),U,14)]"" EN(29)=$P(ENY(3),U,14)
82 Q
83FRPVAL(ENFILE,ENIEN,ENFAIEN) ; Determine prior values at time of FR
84 ; Input Variables
85 ; ENFILE - FAP document file for the input document
86 ; ENIEN - IEN of the input document in ENFILE
87 ; ENFAIEN - IEN of the assoicated FA document
88 ; Returns
89 ; EN(28) - previous FUND
90 ; EN(29) - previous A/O
91 ; EN(32) - previous BOC
92 ; EN(33) - previous LOCATION (NATIONAL EIL)
93 ; EN(34) - previous COST CENTER
94 ; EN(37) - previous XAREA (CMR)
95 Q:ENFILE'=6915.6 ; must be FR Document
96 N ENDA,ENDOC,ENDTC,ENFC,ENY
97 ; get initial values (from FA)
98 S (EN(28),EN(29),EN(32),EN(33),EN(34))=""
99 S ENDTC("I")=$P($G(^ENG(6915.2,ENFAIEN,0)),U,2) ; date/time of FA
100 S ENY(3)=$G(^ENG(6915.2,ENFAIEN,3))
101 S EN(28)=$P(ENY(3),U,10)
102 S EN(29)=$P(ENY(3),U,11)
103 S EN(32)=$P(ENY(3),U,14)
104 S EN(33)=$P(ENY(3),U,8)
105 S EN(34)=$P(ENY(3),U,28)
106 S EN(37)=$P(ENY(3),U,31)
107 ; Construct chrono list of FC and FR in time frame for Equipment
108 S ENY(0)=$G(^ENG(ENFILE,ENIEN,0))
109 S ENDA("EQ")=$P(ENY(0),U) ; equip id
110 S ENDTC("F?")=$P(ENY(0),U,2) ; date/time of input doc
111 ; add FC documents to list
112 S ENDA("FC")=0
113 F S ENDA("FC")=$O(^ENG(6915.4,"B",ENDA("EQ"),ENDA("FC"))) Q:'ENDA("FC") D
114 . S ENDTC("FC")=$P($G(^ENG(6915.4,ENDA("FC"),0)),U,2)
115 . I ENDTC("FC")>ENDTC("I"),ENDTC("FC")<ENDTC("F?") D
116 . . Q:$P($G(^ENG(ENFILE,ENDA("FC"),3)),U,8)'="00" ; not FC to FA
117 . . S ENDOC(ENDTC("FC"),"6915.4;"_ENDA("FC"))=""
118 ; add FR documents to list
119 S ENDA("FR")=0
120 F S ENDA("FR")=$O(^ENG(6915.6,"B",ENDA("EQ"),ENDA("FR"))) Q:'ENDA("FR") D
121 . S ENDTC("FR")=$P($G(^ENG(6915.6,ENDA("FR"),0)),U,2)
122 . I ENDTC("FR")>ENDTC("I"),ENDTC("FR")<ENDTC("F?") D
123 . . S ENDOC(ENDTC("FR"),"6915.6;"_ENDA("FR"))=""
124 ; Loop thru chrono list and update initial values as appropriate
125 S ENDTC="" F S ENDTC=$O(ENDOC(ENDTC)) Q:ENDTC="" D
126 . S ENY="" F S ENY=$O(ENDOC(ENDTC,ENY)) Q:ENY="" D
127 . . S ENFILE=$P(ENY,";"),ENDA=$P(ENY,";",2)
128 . . I ENFILE=6915.4 D ; FC Document
129 . . . S ENY(3)=$G(^ENG(6915.4,ENDA,3))
130 . . . S:$P(ENY(3),U,10)]"" EN(33)=$P(ENY(3),U,10) ; location
131 . . I ENFILE=6915.6 D ; FR Document
132 . . . S ENY(3)=$G(^ENG(6915.6,ENDA,3))
133 . . . S:$P(ENY(3),U,9)]"" EN(28)=$P(ENY(3),U,9) ; fund
134 . . . S:$P(ENY(3),U,10)]"" EN(29)=$P(ENY(3),U,10) ; a/o
135 . . . S:$P(ENY(3),U,13)]"" EN(32)=$P(ENY(3),U,13) ; boc
136 . . . S:$P(ENY(3),U,14)]"" EN(33)=$P(ENY(3),U,14) ; location
137 . . . S:$P(ENY(3),U,15)]"" EN(34)=$P(ENY(3),U,15) ; cost ctr
138 . . . S:$P(ENY(3),U,18)]"" EN(37)=$P(ENY(3),U,18) ; xarea
139 Q
140 ;ENFARC3
Note: See TracBrowser for help on using the repository browser.