source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENFACTL.m@ 1800

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

initial load of WorldVistAEHR

File size: 5.7 KB
RevLine 
[613]1ENFACTL ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD LIST ;10/14/1999
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^ENFACTL"
8 . S ZTDESC="ENG List Equip to be Expensed"
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 be expensed 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 not be expensed
32 . Q:$P($$CHKEXP^ENFACTU(ENDA),U)'=1
33 . ; put on sorted list of items that will be expensed and update counts
34 . S ENSYS=+$$TOPSYS^ENFACTU(ENDA) ; plus value to treat ? as standalone
35 . S ENSYSV=+$S(ENSYS>0:$$SYSVAL^ENFACTU(ENSYS,"C"),1:ENVAL)
36 . S ^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)=""
37 . S $P(ENT(ENSN,ENFUND,ENSGL),U,3)=$P(ENT(ENSN,ENFUND,ENSGL),U,3)+1
38 . S $P(ENT(ENSN,ENFUND,ENSGL),U,4)=$P(ENT(ENSN,ENFUND,ENSGL),U,4)+ENVAL
39 ;
40PRINT ; print results
41 S ENPG=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
42 S ENL="",$P(ENL,"-",IOM)=""
43 I '$D(ENT) S ENSN="" D HD W !!,"Nothing to report."
44 ; loop thru ENT( by station
45 S ENSN="" F S ENSN=$O(ENT(ENSN)) Q:ENSN="" D Q:END
46 . D HD Q:END
47 . I '$D(^TMP($J,ENSN)) W !!,"NO EQUIPMENT WILL BE EXPENSED BY CT TASK FOR THIS STATION."
48 . ; loop thru system values in ^TMP(
49 . S ENSYSV="" F S ENSYSV=$O(^TMP($J,ENSN,ENSYSV)) Q:ENSYSV="" D Q:END
50 . . ; loop thru system # (will be 0 for standalone items)
51 . . S ENSYS=""
52 . . F S ENSYS=$O(^TMP($J,ENSN,ENSYSV,ENSYS)) Q:ENSYS="" D Q:END
53 . . . ; if system then print parent data and system info
54 . . . I ENSYS>0 D
55 . . . . W !!,?2,"TOP PARENT SYSTEM ENTRY #: ",ENSYS
56 . . . . W ?40,"CMR: ",$E($$GET1^DIQ(6914,ENSYS,19),1,5)
57 . . . . W ?51,"Parent Value: "
58 . . . . I +$$CHKFA^ENFAUTL(ENSYS) W $FN($$GET1^DIQ(6914,ENSYS,12),",",2)
59 . . . . E W "not in FAP"
60 . . . . S ENCSN=$$GET1^DIQ(6914,ENSYS,18)
61 . . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
62 . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENSYS,"18:2"),")"
63 . . . . W !,?2,"Sum of Capitalized Values in System: "
64 . . . . W $FN(ENSYSV,",",2)
65 . . . ; loop thru equipment
66 . . . S ENDA=0
67 . . . F S ENDA=$O(^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)) Q:'ENDA D Q:END
68 . . . . Q:ENDA=ENSYS ; already displayed as parent of system
69 . . . . I $Y+4>IOSL D HD Q:END W " (continued)"
70 . . . . S ENCSN=$$GET1^DIQ(6914,ENDA,18)
71 . . . . ; print format for component of system
72 . . . . I ENSYS>0 D
73 . . . . . W !!,?6,"COMPONENT ENTRY #: ",ENDA
74 . . . . . W ?36,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
75 . . . . . W ?47,"Component Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
76 . . . . . W !,?6,"CATEGORY STOCK NUMBER: ",ENCSN
77 . . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
78 . . . . ; print format for standalone equipment
79 . . . . I ENSYS=0 D
80 . . . . . W !!,?2,"ENTRY #: ",ENDA
81 . . . . . W ?22,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
82 . . . . . W ?33,"Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
83 . . . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
84 . . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
85 . Q:END
86 . ; print station totals
87 . I $Y+14>IOSL D HD Q:END W " (continued)"
88 . D HDST
89 . S ENFUND="" F S ENFUND=$O(ENT(ENSN,ENFUND)) Q:ENFUND="" D Q:END
90 . . S ENSGL=""
91 . . F S ENSGL=$O(ENT(ENSN,ENFUND,ENSGL)) Q:ENSGL="" D Q:END
92 . . . I $Y+6>IOSL D HD Q:END W " (continued)" D HDST
93 . . . W !,ENFUND,?7,ENSGL
94 . . . S ENX=$G(ENT(ENSN,ENFUND,ENSGL))
95 . . . W ?12,$J($FN($P(ENX,U,1),","),5)
96 . . . W ?18,$J($FN($P(ENX,U,2),",",2),14)
97 . . . W ?35,$J($FN($P(ENX,U,3),","),5)
98 . . . W ?41,$J($FN($P(ENX,U,4),",",2),14)
99 . . . W ?58,$J($FN($P(ENX,U,1)-$P(ENX,U,3),","),5)
100 . . . W ?64,$J($FN($P(ENX,U,2)-$P(ENX,U,4),",",2),14)
101 . . . ; add sgl to subtotals for station
102 . . . S $P(ENT(ENSN),U,1)=$P($G(ENT(ENSN)),U,1)+$P(ENX,U,1)
103 . . . S $P(ENT(ENSN),U,2)=$P(ENT(ENSN),U,2)+$P(ENX,U,2)
104 . . . S $P(ENT(ENSN),U,3)=$P(ENT(ENSN),U,3)+$P(ENX,U,3)
105 . . . S $P(ENT(ENSN),U,4)=$P(ENT(ENSN),U,4)+$P(ENX,U,4)
106 . W !," ----- -------------- ----- -------------- ----- --------------"
107 . W !,"Station Tot"
108 . W ?12,$J($FN($P(ENT(ENSN),U,1),","),5)
109 . W ?18,$J($FN($P(ENT(ENSN),U,2),",",2),14)
110 . W ?35,$J($FN($P(ENT(ENSN),U,3),","),5)
111 . W ?41,$J($FN($P(ENT(ENSN),U,4),",",2),14)
112 . W ?58,$J($FN($P(ENT(ENSN),U,1)-$P(ENT(ENSN),U,3),","),5)
113 . W ?64,$J($FN($P(ENT(ENSN),U,2)-$P(ENT(ENSN),U,4),",",2),14)
114 I END W !!,"REPORT STOPPED BY USER REQUEST"
115 I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
116 D ^%ZISC
117EXIT I $D(ZTQUEUED) S ZTREQ="@"
118 K ^TMP($J)
119 K DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,END,ENDT,ENL,ENPG
120 K ENCSN,ENDA,ENFUND,ENSGL,ENSN,ENSYS,ENSYSV,ENT,ENVAL,ENX
121 Q
122 ;
123HD ; header
124 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,END=1 Q
125 I $E(IOST,1,2)="C-",ENPG S DIR(0)="E" D ^DIR K DIR I 'Y S END=1 Q
126 I $E(IOST,1,2)="C-"!ENPG W @IOF
127 S ENPG=ENPG+1
128 W !,"EQUIPMENT CT TASK WILL EXPENSE sorted by value"
129 W ?49,ENDT,?72,"page ",ENPG
130 W !,ENL
131 I ENSN]"" W !,"STATION ",ENSN
132 Q
133 ;
134HDST ; header for station totals
135 W !!," Current Capitalized CT Task Will Expense Remain Capitalized"
136 W !,"Fund SGL Count $ Amount Count $ Amount Count $ Amount"
137 W !,"------ ---- ----- -------------- ----- -------------- ----- --------------"
138 Q
139 ;ENFACTL
Note: See TracBrowser for help on using the repository browser.