source: FOIAVistA/tag/r/ENGINEERING-EN/ENFACTU.m@ 949

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

initial load of FOIAVistA 6/30/08 version

File size: 2.8 KB
Line 
1ENFACTU ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD UTILITIES ;5/22/2002
2 ;;7.0;ENGINEERING;**63,71**;August 17, 1993
3TOPSYS(ENDA) ; Topmost System
4 ; input ENDA - equipment entry #
5 ; returns
6 ; entry # of topmost equipment in system of which ENDA is a part
7 ; OR 0 if ENDA is not part of a system (parent or component)
8 ; OR ?^message if error detected
9 ;
10 N ENDAC,ENDAP,ENPL,ENRET
11 S ENRET=""
12 ;
13 ; start with ENDA as component and determine top-most item in system
14 S ENPL=U ; init list of parents (used for detection of endless loop)
15 S ENDAC=ENDA ; start with ENDA as a component
16 ; traverse parent chain
17 F S ENDAP=$P($G(^ENG(6914,ENDAC,0)),U,3) Q:ENDAP=""!(ENPL[(U_ENDAP_U)) S ENDAC=ENDAP,ENPL=ENPL_ENDAP_U
18 I ENDAP]"" S ENRET="?^ENDLESS LOOP DETECTED"
19 ;
20 ; use topmost parent if found
21 I ENRET="",ENDAC'=ENDA S ENRET=ENDAC
22 ; if not component then is item a parent?
23 I ENRET="",$O(^ENG(6914,"AE",ENDA,""))]"" S ENRET=ENDA
24 ; must not be part of system
25 I ENRET="" S ENRET=0
26 ;
27 Q ENRET
28 ;
29SYSVAL(ENDAT,ENSW) ; System Value
30 ; input ENDAT - entry # parent for system
31 ; ENSW - optional switch
32 ; contains "C" if only capitalized values should be
33 ; included in return value
34 ; returns sum of asset values for parent and all it's components
35 ;
36 N ENDA,ENMD,ENNODE,ENSUM,ENDA
37 S ENSW=$G(ENSW)
38 S ENSUM=0
39 ;
40 ; build list of all items in the system
41 K ^TMP("ENSYS",$J)
42 S ENMD=1
43 D GETC^ENEQRP6(ENDAT,"","^TMP(""ENSYS"",$J,")
44 ;
45 ; loop thru all equipment on system list and sum asset values
46 S ENNODE="^TMP(""ENSYS"",$J,"""")"
47 F S ENNODE=$Q(@ENNODE) Q:$QS(ENNODE,1)_$QS(ENNODE,2)'=("ENSYS"_$J) D
48 . S ENDA=$QS(ENNODE,$QL(ENNODE))
49 . I ENSW["C",$$CHKFA^ENFAUTL(ENDA)'>0 Q ; if only capitalized $
50 . S ENSUM=ENSUM+$P($G(^ENG(6914,ENDA,2)),U,3)
51 ;
52 K ^TMP("ENSYS",$J)
53 Q ENSUM
54 ;
55CHKEXP(ENDA) ; Check if capitalized equipment item should be expensed
56 ; input ENDA - equipment Entry # if check
57 ; returns
58 ; 1 (true) if it should be expensed
59 ; 0^reason if it should not be expensed due to system criteria
60 ; U^username if it should not be expensed due to user edit
61 ;
62 N ENSYS,ENUSER
63 ; must be reported to Fixed Assets/FMS to be an issue
64 I $$CHKFA^ENFAUTL(ENDA)'>0 Q "0^NOT CURRENTLY REPORTED TO FAP"
65 ;
66 ; does item meet any of the system criteria to remain capitalized?
67 I $$GET1^DIQ(6914,ENDA,38)="1524" Q "0^SGL 1524 (EXCESS)"
68 I $$GET1^DIQ(6914,ENDA,62)="4539" Q "0^FUND 4539 (FRANCHISE)"
69 I $$GET1^DIQ(6914,ENDA,12)>99999.99 Q "0^ASSET VALUE > 99999.99"
70 S ENSYS=$$TOPSYS(ENDA) ; if part of system then check system value
71 I ENSYS,$$SYSVAL(ENSYS,"C")>99999.99 Q "0^SYSTEM VALUE > 99999.99"
72 ;
73 ; did user specify that item should remain capitalized
74 S ENUSER=$$GET1^DIQ(6914,ENDA,99,"E")
75 I ENUSER]"" Q "U^"_ENUSER
76 ;
77 ; item did not meet any of criteria to remain capitalized
78 Q 1
79 ;
80 ;ENFACTU
Note: See TracBrowser for help on using the repository browser.