source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENFACTS.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
RevLine 
[613]1ENFACTS ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD SKIP LIST ;10/23/2000
2 ;;7.0;ENGINEERING;**63**;Aug 17, 1993
3EN ;
4 ; ask device
5 S %ZIS="QM" D ^%ZIS G:POP EXIT
6 I $D(IO("Q")) D G EXIT
7 . S ZTRTN="QEN^ENFACTS"
8 . S ZTDESC="ENG List Equip to Remain Capitalized"
9 . D ^%ZTLOAD,HOME^%ZIS K ZTSK
10 ;
11QEN ; queued entry
12 U IO
13 ;
14COLLECT ; collect data
15 S END=0 ; init flag, =true if user stopped job
16 K ENT ; totals ENT(station,fund,sgl)
17 ; =capitalized count^$^to remain capitalized count^$
18 K ^TMP($J)
19 ;
20 ; loop thru equipment in FA DOCUMENT LOG file
21 S ENDA=0 F S ENDA=$O(^ENG(6915.2,"B",ENDA)) Q:'ENDA D
22 . Q:+$$CHKFA^ENFAUTL(ENDA)'>0 ; not currently reported to FAP
23 . ; get equipment data
24 . S ENSN=$$GET1^DIQ(6914,ENDA_",",60)_" " S:ENSN=" " ENSN="UNK"
25 . S ENFUND=$$GET1^DIQ(6914,ENDA_",",62)_" " S:ENFUND=" " ENFUND="UNK"
26 . S ENSGL=$$GET1^DIQ(6914,ENDA_",",38) S:ENSGL="" ENSGL="UNK"
27 . S ENVAL=$$GET1^DIQ(6914,ENDA_",",12)
28 . ; update capitalized count and amount
29 . S $P(ENT(ENSN,ENFUND,ENSGL),U)=$P($G(ENT(ENSN,ENFUND,ENSGL)),U)+1
30 . S $P(ENT(ENSN,ENFUND,ENSGL),U,2)=$P(ENT(ENSN,ENFUND,ENSGL),U,2)+ENVAL
31 . ; quit if item should be expensed
32 . S ENX=$$CHKEXP^ENFACTU(ENDA)
33 . Q:$P(ENX,U)=1
34 . ; put on sorted list of items that will remain cap. and update counts
35 . S ENSYS=+$$TOPSYS^ENFACTU(ENDA) ; plus value to treat ? as standalone
36 . S ENSYSV=+$S(ENSYS>0:$$SYSVAL^ENFACTU(ENSYS,"C"),1:ENVAL)
37 . S ^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)=ENX
38 . S $P(ENT(ENSN,ENFUND,ENSGL),U,3)=$P(ENT(ENSN,ENFUND,ENSGL),U,3)+1
39 . S $P(ENT(ENSN,ENFUND,ENSGL),U,4)=$P(ENT(ENSN,ENFUND,ENSGL),U,4)+ENVAL
40 ;
41PRINT ; print results
42 S ENPG=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
43 S ENL="",$P(ENL,"-",IOM)=""
44 I '$D(ENT) S ENSN="" D HD W !!,"Nothing to report."
45 ; loop thru ENT( by station
46 S ENSN="" F S ENSN=$O(ENT(ENSN)) Q:ENSN="" D Q:END
47 . D HD Q:END
48 . I '$D(^TMP($J,ENSN)) W !!,"NO EQUIPMENT WILL REMAIN CAPITALIED WHEN TASK RUNS FOR THIS STATION."
49 . ; loop thru system values in ^TMP(
50 . S ENSYSV="" F S ENSYSV=$O(^TMP($J,ENSN,ENSYSV)) Q:ENSYSV="" D Q:END
51 . . ; loop thru system # (will be 0 for standalone items)
52 . . S ENSYS=""
53 . . F S ENSYS=$O(^TMP($J,ENSN,ENSYSV,ENSYS)) Q:ENSYS="" D Q:END
54 . . . ; if system then print parent data and system info
55 . . . I ENSYS>0 D
56 . . . . W !!,?2,"TOP PARENT SYSTEM ENTRY #: ",ENSYS
57 . . . . W ?40,"CMR: ",$E($$GET1^DIQ(6914,ENSYS,19),1,5)
58 . . . . W ?51,"Parent Value: "
59 . . . . I +$$CHKFA^ENFAUTL(ENSYS) W $FN($$GET1^DIQ(6914,ENSYS,12),",",2)
60 . . . . E W "not in FAP"
61 . . . . S ENCSN=$$GET1^DIQ(6914,ENSYS,18)
62 . . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
63 . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENSYS,"18:2"),")"
64 . . . . I +$$CHKFA^ENFAUTL(ENSYS) D
65 . . . . . S ENTSK=$G(^TMP($J,ENSN,ENSYSV,ENSYS,ENSYS))
66 . . . . . I $P(ENTSK,U)=0 W !," Reason: ",$P(ENTSK,U,2)
67 . . . . . I $P(ENTSK,U)="U" W !," Reason: ",$P(ENTSK,U,2)," indicated it should remain capitalized."
68 . . . . W !,?2,"Sum of Capitalized Values in System: "
69 . . . . W $FN(ENSYSV,",",2)
70 . . . ; loop thru equipment
71 . . . S ENDA=0
72 . . . F S ENDA=$O(^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)) Q:'ENDA D Q:END
73 . . . . Q:ENDA=ENSYS ; already displayed as parent of system
74 . . . . I $Y+6>IOSL D HD Q:END W " (continued)"
75 . . . . S ENCSN=$$GET1^DIQ(6914,ENDA,18)
76 . . . . ; print format for component of system
77 . . . . I ENSYS>0 D
78 . . . . . W !!,?6,"COMPONENT ENTRY #: ",ENDA
79 . . . . . W ?36,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
80 . . . . . W ?47,"Component Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
81 . . . . . W !,?6,"CATEGORY STOCK NUMBER: ",ENCSN
82 . . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
83 . . . . ; print format for standalone equipment
84 . . . . I ENSYS=0 D
85 . . . . . W !!,?2,"ENTRY #: ",ENDA
86 . . . . . W ?22,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
87 . . . . . W ?33,"Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
88 . . . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
89 . . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
90 . . . . S ENTSK=$G(^TMP($J,ENSN,ENSYSV,ENSYS,ENDA))
91 . . . . I $P(ENTSK,U)=0 D
92 . . . . . W !," ",$S(ENSYS>0:" ",1:""),"Reason: ",$P(ENTSK,U,2)
93 . . . . I $P(ENTSK,U)="U" D
94 . . . . . W !," ",$S(ENSYS>0:" ",1:""),"Reason: ",$P(ENTSK,U,2)," indicated it should remain capitalized."
95 . Q:END
96 . ; print station totals
97 . I $Y+14>IOSL D HD Q:END W " (continued)"
98 . D HDST
99 . S ENFUND="" F S ENFUND=$O(ENT(ENSN,ENFUND)) Q:ENFUND="" D Q:END
100 . . S ENSGL=""
101 . . F S ENSGL=$O(ENT(ENSN,ENFUND,ENSGL)) Q:ENSGL="" D Q:END
102 . . . I $Y+6>IOSL D HD Q:END W " (continued)" D HDST
103 . . . W !,ENFUND,?7,ENSGL
104 . . . S ENX=$G(ENT(ENSN,ENFUND,ENSGL))
105 . . . W ?12,$J($FN($P(ENX,U,1),","),5)
106 . . . W ?18,$J($FN($P(ENX,U,2),",",2),14)
107 . . . W ?35,$J($FN($P(ENX,U,3),","),5)
108 . . . W ?41,$J($FN($P(ENX,U,4),",",2),14)
109 . . . W ?58,$J($FN($P(ENX,U,1)-$P(ENX,U,3),","),5)
110 . . . W ?64,$J($FN($P(ENX,U,2)-$P(ENX,U,4),",",2),14)
111 . . . ; add sgl to subtotals for station
112 . . . S $P(ENT(ENSN),U,1)=$P($G(ENT(ENSN)),U,1)+$P(ENX,U,1)
113 . . . S $P(ENT(ENSN),U,2)=$P(ENT(ENSN),U,2)+$P(ENX,U,2)
114 . . . S $P(ENT(ENSN),U,3)=$P(ENT(ENSN),U,3)+$P(ENX,U,3)
115 . . . S $P(ENT(ENSN),U,4)=$P(ENT(ENSN),U,4)+$P(ENX,U,4)
116 . W !," ----- -------------- ----- -------------- ----- --------------"
117 . W !,"Station Tot"
118 . W ?12,$J($FN($P(ENT(ENSN),U,1),","),5)
119 . W ?18,$J($FN($P(ENT(ENSN),U,2),",",2),14)
120 . W ?35,$J($FN($P(ENT(ENSN),U,3),","),5)
121 . W ?41,$J($FN($P(ENT(ENSN),U,4),",",2),14)
122 . W ?58,$J($FN($P(ENT(ENSN),U,1)-$P(ENT(ENSN),U,3),","),5)
123 . W ?64,$J($FN($P(ENT(ENSN),U,2)-$P(ENT(ENSN),U,4),",",2),14)
124 I END W !!,"REPORT STOPPED BY USER REQUEST"
125 I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
126 D ^%ZISC
127EXIT I $D(ZTQUEUED) S ZTREQ="@"
128 K ^TMP($J)
129 K DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,END,ENDT,ENL,ENPG
130 K ENCSN,ENDA,ENFUND,ENSGL,ENSN,ENSYS,ENSYSV,ENT,ENTSK,ENVAL,ENX
131 Q
132 ;
133HD ; header
134 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,END=1 Q
135 I $E(IOST,1,2)="C-",ENPG S DIR(0)="E" D ^DIR K DIR I 'Y S END=1 Q
136 I $E(IOST,1,2)="C-"!ENPG W @IOF
137 S ENPG=ENPG+1
138 W !,"EQUIPMENT TO REMAIN CAPITALIZED sorted by value"
139 W ?49,ENDT,?72,"page ",ENPG
140 W !,ENL
141 I ENSN]"" W !,"STATION ",ENSN
142 Q
143 ;
144HDST ; header for station totals
145 W !!," Current Capitalized Remain Capitalized CT Task Will Expense"
146 W !,"Fund SGL Count $ Amount Count $ Amount Count $ Amount"
147 W !,"------ ---- ----- -------------- ----- -------------- ----- --------------"
148 Q
149 ;ENFACTS
Note: See TracBrowser for help on using the repository browser.