1 | ENFACTT ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD TASK ;5/29/2002
|
---|
2 | ;;7.0;ENGINEERING;**63,71**;August 17, 1993
|
---|
3 | Q
|
---|
4 | ;
|
---|
5 | TASK ; One-time task to expense capitalized equipment that does not meet the
|
---|
6 | ; new capitalization threshold
|
---|
7 | ; input ENIO - output device for summary report
|
---|
8 | ;
|
---|
9 | K ^TMP($J,"BAD")
|
---|
10 | K ^XTMP("ENFACTT")
|
---|
11 | ;
|
---|
12 | S ^XTMP("ENFACTT",0)=$$FMADD^XLFDT(DT,21)_U_DT
|
---|
13 | S ^XTMP("ENFACTT",1)=0
|
---|
14 | ;
|
---|
15 | RESTART N ENDA,ENFUND,ENEQ,ENSGL,ENSN,ENVAL,ENT,ENX
|
---|
16 | ;
|
---|
17 | ; 1. Restore values in ENT array if compile needs to be restarted.
|
---|
18 | ; 2. ^XTMP("ENFACTT","RESTART") is setup manaully.
|
---|
19 | ; 3. ^XTMP("ENFACTT",1) has the next record to be processed.
|
---|
20 | ;
|
---|
21 | I $G(^XTMP("ENFACTT","RESTART"))=1 D
|
---|
22 | . M ENT=^XTMP("ENFACTT",2)
|
---|
23 | ;
|
---|
24 | S ENDA=^XTMP("ENFACTT",1) ;Initial value of zero
|
---|
25 | ;
|
---|
26 | ; loop thru equipment in FA DOCUMENT LOG file
|
---|
27 | F S ENDA=$O(^ENG(6915.2,"B",ENDA)) Q:'ENDA D
|
---|
28 | . S ENEQ("DA")=ENDA
|
---|
29 | . ;
|
---|
30 | . S ^XTMP("ENFACTT",1)=ENDA ;Keep track of IEN
|
---|
31 | . ;
|
---|
32 | . Q:+$$CHKFA^ENFAUTL(ENDA)'>0 ; not currently reported to FA
|
---|
33 | . ;
|
---|
34 | . ;Data vaildation - No entry in the Equipment File
|
---|
35 | . I '$D(^ENG(6914,ENDA)) D BAD^ENFACTX("NO ENTRY IN 6914") Q
|
---|
36 | . ;
|
---|
37 | . F I=2,8,9 K ENEQ(I) ;clear array
|
---|
38 | . F I=2,8,9 S ENEQ(I)=$G(^ENG(6914,ENDA,I)) ;Get data from 6914
|
---|
39 | . ;
|
---|
40 | . ;Data vaildation - Check for missing nodes
|
---|
41 | . ; 1. Node 2 has the Total Asset Value
|
---|
42 | . ; 2. Node 8 has the Standard General Ledger
|
---|
43 | . ; 3. Node 9 has Station no. and Fund no.
|
---|
44 | . ;
|
---|
45 | . ;If missing do not place on report
|
---|
46 | . I ENEQ(2)="" D BAD^ENFACTX("NODE 2 MISSING IN 6914")
|
---|
47 | . I ENEQ(8)="" D BAD^ENFACTX("NODE 8 MISSING IN 6914")
|
---|
48 | . I ENEQ(9)="" D BAD^ENFACTX("NODE 9 MISSING IN 6914")
|
---|
49 | . ;
|
---|
50 | . ;Missing pertinent information do not place on the report
|
---|
51 | . I $D(^TMP($J,"BAD",ENDA)) Q
|
---|
52 | . ;
|
---|
53 | . ;Station Number - If missing do not process
|
---|
54 | . S ENSN=$$GET1^DIQ(6914,ENDA_",",60)_" " S:ENSN=" " ENSN="UNK"
|
---|
55 | . I ENSN="UNK" D BAD^ENFACTX("MISSING STATION NUMBER")
|
---|
56 | . ;
|
---|
57 | . ;Fund - If missing do not process
|
---|
58 | . S ENFUND=$$GET1^DIQ(6914,ENDA_",",62)_" " S:ENFUND=" " ENFUND="UNK"
|
---|
59 | . I ENFUND="UNK" D BAD^ENFACTX("MISSING FUND NUMBER")
|
---|
60 | . ;
|
---|
61 | . ;Standard General Ledger - If missing do not process
|
---|
62 | . S ENSGL=$$GET1^DIQ(6914,ENDA_",",38) S:ENSGL="" ENSGL="UNK"
|
---|
63 | . I ENSGL="UNK" D BAD^ENFACTX("MISSING GENERAL LEDGER NUMBER")
|
---|
64 | . ;
|
---|
65 | . ;Total asset value
|
---|
66 | . S ENVAL=$$GET1^DIQ(6914,ENDA_",",12) S:ENVAL="" ENVAL="UNK"
|
---|
67 | . I ENVAL="UNK" D BAD^ENFACTX("MISSING TOTAL ASSET VALUE")
|
---|
68 | . ;
|
---|
69 | . ;Missing pertinent information do not place on the report
|
---|
70 | . I $D(^TMP($J,"BAD",ENDA)) Q
|
---|
71 | . ;
|
---|
72 | . ; update capitalized count and amount
|
---|
73 | . S $P(ENT(ENSN,ENFUND,ENSGL),U,1)=$P($G(ENT(ENSN,ENFUND,ENSGL)),U)+1
|
---|
74 | . S $P(ENT(ENSN,ENFUND,ENSGL),U,2)=$P(ENT(ENSN,ENFUND,ENSGL),U,2)+ENVAL
|
---|
75 | . ;
|
---|
76 | . ; quit if item should not be expensed
|
---|
77 | . Q:$$CHKEXP^ENFACTU(ENDA)'>0
|
---|
78 | . ;
|
---|
79 | . ; expense it
|
---|
80 | . S ENX=$$EXP^ENFACTX(ENDA)
|
---|
81 | . ;
|
---|
82 | . ; if not successful then ensure it is on problem list and quit
|
---|
83 | . I 'ENX S:'$D(^TMP($J,"BAD",ENDA)) ^TMP($J,"BAD",ENDA)="" Q
|
---|
84 | . ;
|
---|
85 | . ; was successful so update expensed count and amount
|
---|
86 | . S $P(ENT(ENSN,ENFUND,ENSGL),U,3)=$P(ENT(ENSN,ENFUND,ENSGL),U,3)+1
|
---|
87 | . S $P(ENT(ENSN,ENFUND,ENSGL),U,4)=$P(ENT(ENSN,ENFUND,ENSGL),U,4)+ENVAL
|
---|
88 | . ;
|
---|
89 | . ; Save data from array
|
---|
90 | . S ^XTMP("ENFACTT",2,ENSN,ENFUND,ENSGL)=ENT(ENSN,ENFUND,ENSGL)
|
---|
91 | ;
|
---|
92 | ; save data for report in XTMP in case of problems during print
|
---|
93 | K ^XTMP("ENFACT")
|
---|
94 | S ^XTMP("ENFACT",0)=$$FMADD^XLFDT(DT,21)_U_DT ; purge date is T+21
|
---|
95 | I $D(^TMP($J,"BAD")) M ^XTMP("ENFACT","BAD")=^TMP($J,"BAD")
|
---|
96 | I $D(ENT) M ^XTMP("ENFACT","ENT")=ENT
|
---|
97 | ;
|
---|
98 | QRPT ; queue a task to report results on device ENIO
|
---|
99 | ; note: if a site needs to reprint the summary report for some reason
|
---|
100 | ; then enter the following commands at the programmer prompt
|
---|
101 | ; >S ENIO=name of an output device (.01 field of DEVICE file)
|
---|
102 | ; >D QRPT^ENFACTT
|
---|
103 | S ZTRTN="RPT^ENFACTT"
|
---|
104 | S ZTDESC="ENG Results of Capitalization Threshold Task"
|
---|
105 | S ZTDTH=$H,ZTIO=ENIO
|
---|
106 | D ^%ZTLOAD K ZTSK
|
---|
107 | ;
|
---|
108 | ; cleanup
|
---|
109 | K ENIO
|
---|
110 | K ^TMP($J,"BAD")
|
---|
111 | S ZTREQ="@"
|
---|
112 | Q
|
---|
113 | ;
|
---|
114 | RPT ; report results
|
---|
115 | ; Input
|
---|
116 | ; ^XTMP("ENFACT","ENT",station,fund,sgl)
|
---|
117 | ; = starting capitalized count ^ $ ^ expensed by task count ^ $
|
---|
118 | ; ^XTMP("ENFACT","BAD",ENDA) = # of problems for an equipment item
|
---|
119 | ; ^XTMP("ENFACT","BAD",ENDA,seqn #) = description of a problem
|
---|
120 | ;
|
---|
121 | N END,ENCAP,ENDA,ENDT,ENEXP,ENFUND,ENI,ENL,ENPG,ENSGL,ENSN,Y
|
---|
122 | ;
|
---|
123 | U IO
|
---|
124 | S (END,ENPG)=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
|
---|
125 | S ENL="",$P(ENL,"-",IOM)=""
|
---|
126 | D RPTHD
|
---|
127 | ;
|
---|
128 | ; first report problems
|
---|
129 | W !,$S($D(^XTMP("ENFACT","BAD")):"Some",1:"No")
|
---|
130 | W " problems were detected while expensing items.",!
|
---|
131 | S ENDA=0 F S ENDA=$O(^XTMP("ENFACT","BAD",ENDA)) Q:'ENDA D
|
---|
132 | . I $Y+6>IOSL D RPTHD
|
---|
133 | . W !,"ERROR : Couldn't create FD Doc. for ENTRY # "_ENDA
|
---|
134 | . W !,"REASON:"
|
---|
135 | . ; List Problems with Equipment/Document if known
|
---|
136 | . S ENI=0 F S ENI=$O(^XTMP("ENFACT","BAD",ENDA,ENI)) Q:'ENI D
|
---|
137 | . . I $Y+4>IOSL D RPTHD
|
---|
138 | . . I ENI=1 W " "_$G(^XTMP("ENFACT","BAD",ENDA,ENI)),! Q
|
---|
139 | . . W " "_$G(^XTMP("ENFACT","BAD",ENDA,ENI)),!
|
---|
140 | ;
|
---|
141 | ; display summary
|
---|
142 | K ENT M ENT=^XTMP("ENFACT","ENT") ; load into local array
|
---|
143 | I $Y+8>IOSL D RPTHD
|
---|
144 | I '$D(ENT) W !,"No capitalized equipment was found."
|
---|
145 | E W ! D RPTHDS
|
---|
146 | ; loop thru ENT( by station, fund, SGL
|
---|
147 | S ENSN="" F S ENSN=$O(ENT(ENSN)) Q:ENSN="" D
|
---|
148 | . S ENFUND="" F S ENFUND=$O(ENT(ENSN,ENFUND)) Q:ENFUND="" D
|
---|
149 | . . S ENSGL="" F S ENSGL=$O(ENT(ENSN,ENFUND,ENSGL)) Q:ENSGL="" D
|
---|
150 | . . . I $Y+6>IOSL D RPTHD,RPTHDS
|
---|
151 | . . . W !,?3,ENSN,?12,ENFUND,?20,ENSGL
|
---|
152 | . . . S ENX=$G(ENT(ENSN,ENFUND,ENSGL))
|
---|
153 | . . . W ?27,$J($FN($P(ENX,U,1),",",0),5)
|
---|
154 | . . . W ?33,$J($FN($P(ENX,U,2),",",2),14)
|
---|
155 | . . . W ?50,$J($FN($P(ENX,U,3),",",0),5)
|
---|
156 | . . . W ?56,$J($FN($P(ENX,U,4),",",2),14)
|
---|
157 | . . . ; add to subtotals for station
|
---|
158 | . . . S $P(ENT(ENSN),U,1)=$P($G(ENT(ENSN)),U,1)+$P(ENX,U,1)
|
---|
159 | . . . S $P(ENT(ENSN),U,2)=$P(ENT(ENSN),U,2)+$P(ENX,U,2)
|
---|
160 | . . . S $P(ENT(ENSN),U,3)=$P(ENT(ENSN),U,3)+$P(ENX,U,3)
|
---|
161 | . . . S $P(ENT(ENSN),U,4)=$P(ENT(ENSN),U,4)+$P(ENX,U,4)
|
---|
162 | . ; print subtotals for station
|
---|
163 | . W !,?27,"-----",?33,"--------------"
|
---|
164 | . W ?50,"-----",?56,"--------------"
|
---|
165 | . W !,?3,ENSN,"totals"
|
---|
166 | . W ?27,$J($FN($P(ENT(ENSN),U,1),",",0),5)
|
---|
167 | . W ?33,$J($FN($P(ENT(ENSN),U,2),",",2),14)
|
---|
168 | . W ?50,$J($FN($P(ENT(ENSN),U,3),",",0),5)
|
---|
169 | . W ?56,$J($FN($P(ENT(ENSN),U,4),",",2),14),!
|
---|
170 | ;
|
---|
171 | ; wrapup
|
---|
172 | K ENT
|
---|
173 | S ZTREQ="@"
|
---|
174 | D ^%ZISC
|
---|
175 | Q
|
---|
176 | ;
|
---|
177 | RPTHD ; page header
|
---|
178 | W @IOF
|
---|
179 | S ENPG=ENPG+1
|
---|
180 | W !,"RESULTS OF ONE-TIME TASK TO EXPENSE EQUIP."
|
---|
181 | W ?48,ENDT,?72,"page ",ENPG
|
---|
182 | W !,ENL
|
---|
183 | Q
|
---|
184 | RPTHDS ; summary header
|
---|
185 | W !," Totals before task Expensed by Task"
|
---|
186 | W !," Station Fund SGL Count $ Amount Count $ Amount"
|
---|
187 | W !," ------- ------ ---- ----- -------------- ----- --------------"
|
---|
188 | Q
|
---|
189 | ;
|
---|
190 | REPRINT ;Call at this tag to reprint (ENG*7*71)
|
---|
191 | ;
|
---|
192 | W !,"PLEASE ENTER A VALID DEVICE TO REPRINT THE REPORT"
|
---|
193 | W !," ** Do Not Use P-Message **",!!
|
---|
194 | ;
|
---|
195 | D ^%ZIS
|
---|
196 | I IO=IO(0) D RPT^ENFACTT Q
|
---|
197 | S ENIO=ION D QRPT^ENFACTT
|
---|
198 | ;
|
---|
199 | Q
|
---|
200 | ;
|
---|
201 | ;ENFACTT
|
---|