ENFACTT ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD TASK ;5/29/2002
;;7.0;ENGINEERING;**63,71**;August 17, 1993
Q
;
TASK ; One-time task to expense capitalized equipment that does not meet the
; new capitalization threshold
; input ENIO - output device for summary report
;
K ^TMP($J,"BAD")
K ^XTMP("ENFACTT")
;
S ^XTMP("ENFACTT",0)=$$FMADD^XLFDT(DT,21)_U_DT
S ^XTMP("ENFACTT",1)=0
;
RESTART N ENDA,ENFUND,ENEQ,ENSGL,ENSN,ENVAL,ENT,ENX
;
; 1. Restore values in ENT array if compile needs to be restarted.
; 2. ^XTMP("ENFACTT","RESTART") is setup manaully.
; 3. ^XTMP("ENFACTT",1) has the next record to be processed.
;
I $G(^XTMP("ENFACTT","RESTART"))=1 D
. M ENT=^XTMP("ENFACTT",2)
;
S ENDA=^XTMP("ENFACTT",1) ;Initial value of zero
;
; loop thru equipment in FA DOCUMENT LOG file
F S ENDA=$O(^ENG(6915.2,"B",ENDA)) Q:'ENDA D
. S ENEQ("DA")=ENDA
. ;
. S ^XTMP("ENFACTT",1)=ENDA ;Keep track of IEN
. ;
. Q:+$$CHKFA^ENFAUTL(ENDA)'>0 ; not currently reported to FA
. ;
. ;Data vaildation - No entry in the Equipment File
. I '$D(^ENG(6914,ENDA)) D BAD^ENFACTX("NO ENTRY IN 6914") Q
. ;
. F I=2,8,9 K ENEQ(I) ;clear array
. F I=2,8,9 S ENEQ(I)=$G(^ENG(6914,ENDA,I)) ;Get data from 6914
. ;
. ;Data vaildation - Check for missing nodes
. ; 1. Node 2 has the Total Asset Value
. ; 2. Node 8 has the Standard General Ledger
. ; 3. Node 9 has Station no. and Fund no.
. ;
. ;If missing do not place on report
. I ENEQ(2)="" D BAD^ENFACTX("NODE 2 MISSING IN 6914")
. I ENEQ(8)="" D BAD^ENFACTX("NODE 8 MISSING IN 6914")
. I ENEQ(9)="" D BAD^ENFACTX("NODE 9 MISSING IN 6914")
. ;
. ;Missing pertinent information do not place on the report
. I $D(^TMP($J,"BAD",ENDA)) Q
. ;
. ;Station Number - If missing do not process
. S ENSN=$$GET1^DIQ(6914,ENDA_",",60)_" " S:ENSN=" " ENSN="UNK"
. I ENSN="UNK" D BAD^ENFACTX("MISSING STATION NUMBER")
. ;
. ;Fund - If missing do not process
. S ENFUND=$$GET1^DIQ(6914,ENDA_",",62)_" " S:ENFUND=" " ENFUND="UNK"
. I ENFUND="UNK" D BAD^ENFACTX("MISSING FUND NUMBER")
. ;
. ;Standard General Ledger - If missing do not process
. S ENSGL=$$GET1^DIQ(6914,ENDA_",",38) S:ENSGL="" ENSGL="UNK"
. I ENSGL="UNK" D BAD^ENFACTX("MISSING GENERAL LEDGER NUMBER")
. ;
. ;Total asset value
. S ENVAL=$$GET1^DIQ(6914,ENDA_",",12) S:ENVAL="" ENVAL="UNK"
. I ENVAL="UNK" D BAD^ENFACTX("MISSING TOTAL ASSET VALUE")
. ;
. ;Missing pertinent information do not place on the report
. I $D(^TMP($J,"BAD",ENDA)) Q
. ;
. ; update capitalized count and amount
. S $P(ENT(ENSN,ENFUND,ENSGL),U,1)=$P($G(ENT(ENSN,ENFUND,ENSGL)),U)+1
. S $P(ENT(ENSN,ENFUND,ENSGL),U,2)=$P(ENT(ENSN,ENFUND,ENSGL),U,2)+ENVAL
. ;
. ; quit if item should not be expensed
. Q:$$CHKEXP^ENFACTU(ENDA)'>0
. ;
. ; expense it
. S ENX=$$EXP^ENFACTX(ENDA)
. ;
. ; if not successful then ensure it is on problem list and quit
. I 'ENX S:'$D(^TMP($J,"BAD",ENDA)) ^TMP($J,"BAD",ENDA)="" Q
. ;
. ; was successful so update expensed count and amount
. S $P(ENT(ENSN,ENFUND,ENSGL),U,3)=$P(ENT(ENSN,ENFUND,ENSGL),U,3)+1
. S $P(ENT(ENSN,ENFUND,ENSGL),U,4)=$P(ENT(ENSN,ENFUND,ENSGL),U,4)+ENVAL
. ;
. ; Save data from array
. S ^XTMP("ENFACTT",2,ENSN,ENFUND,ENSGL)=ENT(ENSN,ENFUND,ENSGL)
;
; save data for report in XTMP in case of problems during print
K ^XTMP("ENFACT")
S ^XTMP("ENFACT",0)=$$FMADD^XLFDT(DT,21)_U_DT ; purge date is T+21
I $D(^TMP($J,"BAD")) M ^XTMP("ENFACT","BAD")=^TMP($J,"BAD")
I $D(ENT) M ^XTMP("ENFACT","ENT")=ENT
;
QRPT ; queue a task to report results on device ENIO
; note: if a site needs to reprint the summary report for some reason
; then enter the following commands at the programmer prompt
; >S ENIO=name of an output device (.01 field of DEVICE file)
; >D QRPT^ENFACTT
S ZTRTN="RPT^ENFACTT"
S ZTDESC="ENG Results of Capitalization Threshold Task"
S ZTDTH=$H,ZTIO=ENIO
D ^%ZTLOAD K ZTSK
;
; cleanup
K ENIO
K ^TMP($J,"BAD")
S ZTREQ="@"
Q
;
RPT ; report results
; Input
; ^XTMP("ENFACT","ENT",station,fund,sgl)
; = starting capitalized count ^ $ ^ expensed by task count ^ $
; ^XTMP("ENFACT","BAD",ENDA) = # of problems for an equipment item
; ^XTMP("ENFACT","BAD",ENDA,seqn #) = description of a problem
;
N END,ENCAP,ENDA,ENDT,ENEXP,ENFUND,ENI,ENL,ENPG,ENSGL,ENSN,Y
;
U IO
S (END,ENPG)=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
S ENL="",$P(ENL,"-",IOM)=""
D RPTHD
;
; first report problems
W !,$S($D(^XTMP("ENFACT","BAD")):"Some",1:"No")
W " problems were detected while expensing items.",!
S ENDA=0 F S ENDA=$O(^XTMP("ENFACT","BAD",ENDA)) Q:'ENDA D
. I $Y+6>IOSL D RPTHD
. W !,"ERROR : Couldn't create FD Doc. for ENTRY # "_ENDA
. W !,"REASON:"
. ; List Problems with Equipment/Document if known
. S ENI=0 F S ENI=$O(^XTMP("ENFACT","BAD",ENDA,ENI)) Q:'ENI D
. . I $Y+4>IOSL D RPTHD
. . I ENI=1 W " "_$G(^XTMP("ENFACT","BAD",ENDA,ENI)),! Q
. . W " "_$G(^XTMP("ENFACT","BAD",ENDA,ENI)),!
;
; display summary
K ENT M ENT=^XTMP("ENFACT","ENT") ; load into local array
I $Y+8>IOSL D RPTHD
I '$D(ENT) W !,"No capitalized equipment was found."
E W ! D RPTHDS
; loop thru ENT( by station, fund, SGL
S ENSN="" F S ENSN=$O(ENT(ENSN)) Q:ENSN="" D
. S ENFUND="" F S ENFUND=$O(ENT(ENSN,ENFUND)) Q:ENFUND="" D
. . S ENSGL="" F S ENSGL=$O(ENT(ENSN,ENFUND,ENSGL)) Q:ENSGL="" D
. . . I $Y+6>IOSL D RPTHD,RPTHDS
. . . W !,?3,ENSN,?12,ENFUND,?20,ENSGL
. . . S ENX=$G(ENT(ENSN,ENFUND,ENSGL))
. . . W ?27,$J($FN($P(ENX,U,1),",",0),5)
. . . W ?33,$J($FN($P(ENX,U,2),",",2),14)
. . . W ?50,$J($FN($P(ENX,U,3),",",0),5)
. . . W ?56,$J($FN($P(ENX,U,4),",",2),14)
. . . ; add to subtotals for station
. . . S $P(ENT(ENSN),U,1)=$P($G(ENT(ENSN)),U,1)+$P(ENX,U,1)
. . . S $P(ENT(ENSN),U,2)=$P(ENT(ENSN),U,2)+$P(ENX,U,2)
. . . S $P(ENT(ENSN),U,3)=$P(ENT(ENSN),U,3)+$P(ENX,U,3)
. . . S $P(ENT(ENSN),U,4)=$P(ENT(ENSN),U,4)+$P(ENX,U,4)
. ; print subtotals for station
. W !,?27,"-----",?33,"--------------"
. W ?50,"-----",?56,"--------------"
. W !,?3,ENSN,"totals"
. W ?27,$J($FN($P(ENT(ENSN),U,1),",",0),5)
. W ?33,$J($FN($P(ENT(ENSN),U,2),",",2),14)
. W ?50,$J($FN($P(ENT(ENSN),U,3),",",0),5)
. W ?56,$J($FN($P(ENT(ENSN),U,4),",",2),14),!
;
; wrapup
K ENT
S ZTREQ="@"
D ^%ZISC
Q
;
RPTHD ; page header
W @IOF
S ENPG=ENPG+1
W !,"RESULTS OF ONE-TIME TASK TO EXPENSE EQUIP."
W ?48,ENDT,?72,"page ",ENPG
W !,ENL
Q
RPTHDS ; summary header
W !," Totals before task Expensed by Task"
W !," Station Fund SGL Count $ Amount Count $ Amount"
W !," ------- ------ ---- ----- -------------- ----- --------------"
Q
;
REPRINT ;Call at this tag to reprint (ENG*7*71)
;
W !,"PLEASE ENTER A VALID DEVICE TO REPRINT THE REPORT"
W !," ** Do Not Use P-Message **",!!
;
D ^%ZIS
I IO=IO(0) D RPT^ENFACTT Q
S ENIO=ION D QRPT^ENFACTT
;
Q
;
;ENFACTT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENFACTT 7104 printed Dec 13, 2024@01:53:27 Page 2
ENFACTT ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD TASK ;5/29/2002
+1 ;;7.0;ENGINEERING;**63,71**;August 17, 1993
+2 QUIT
+3 ;
TASK ; One-time task to expense capitalized equipment that does not meet the
+1 ; new capitalization threshold
+2 ; input ENIO - output device for summary report
+3 ;
+4 KILL ^TMP($JOB,"BAD")
+5 KILL ^XTMP("ENFACTT")
+6 ;
+7 SET ^XTMP("ENFACTT",0)=$$FMADD^XLFDT(DT,21)_U_DT
+8 SET ^XTMP("ENFACTT",1)=0
+9 ;
RESTART NEW ENDA,ENFUND,ENEQ,ENSGL,ENSN,ENVAL,ENT,ENX
+1 ;
+2 ; 1. Restore values in ENT array if compile needs to be restarted.
+3 ; 2. ^XTMP("ENFACTT","RESTART") is setup manaully.
+4 ; 3. ^XTMP("ENFACTT",1) has the next record to be processed.
+5 ;
+6 IF $GET(^XTMP("ENFACTT","RESTART"))=1
Begin DoDot:1
+7 MERGE ENT=^XTMP("ENFACTT",2)
End DoDot:1
+8 ;
+9 ;Initial value of zero
SET ENDA=^XTMP("ENFACTT",1)
+10 ;
+11 ; loop thru equipment in FA DOCUMENT LOG file
+12 FOR
SET ENDA=$ORDER(^ENG(6915.2,"B",ENDA))
if 'ENDA
QUIT
Begin DoDot:1
+13 SET ENEQ("DA")=ENDA
+14 ;
+15 ;Keep track of IEN
SET ^XTMP("ENFACTT",1)=ENDA
+16 ;
+17 ; not currently reported to FA
if +$$CHKFA^ENFAUTL(ENDA)'>0
QUIT
+18 ;
+19 ;Data vaildation - No entry in the Equipment File
+20 IF '$DATA(^ENG(6914,ENDA))
DO BAD^ENFACTX("NO ENTRY IN 6914")
QUIT
+21 ;
+22 ;clear array
FOR I=2,8,9
KILL ENEQ(I)
+23 ;Get data from 6914
FOR I=2,8,9
SET ENEQ(I)=$GET(^ENG(6914,ENDA,I))
+24 ;
+25 ;Data vaildation - Check for missing nodes
+26 ; 1. Node 2 has the Total Asset Value
+27 ; 2. Node 8 has the Standard General Ledger
+28 ; 3. Node 9 has Station no. and Fund no.
+29 ;
+30 ;If missing do not place on report
+31 IF ENEQ(2)=""
DO BAD^ENFACTX("NODE 2 MISSING IN 6914")
+32 IF ENEQ(8)=""
DO BAD^ENFACTX("NODE 8 MISSING IN 6914")
+33 IF ENEQ(9)=""
DO BAD^ENFACTX("NODE 9 MISSING IN 6914")
+34 ;
+35 ;Missing pertinent information do not place on the report
+36 IF $DATA(^TMP($JOB,"BAD",ENDA))
QUIT
+37 ;
+38 ;Station Number - If missing do not process
+39 SET ENSN=$$GET1^DIQ(6914,ENDA_",",60)_" "
if ENSN=" "
SET ENSN="UNK"
+40 IF ENSN="UNK"
DO BAD^ENFACTX("MISSING STATION NUMBER")
+41 ;
+42 ;Fund - If missing do not process
+43 SET ENFUND=$$GET1^DIQ(6914,ENDA_",",62)_" "
if ENFUND=" "
SET ENFUND="UNK"
+44 IF ENFUND="UNK"
DO BAD^ENFACTX("MISSING FUND NUMBER")
+45 ;
+46 ;Standard General Ledger - If missing do not process
+47 SET ENSGL=$$GET1^DIQ(6914,ENDA_",",38)
if ENSGL=""
SET ENSGL="UNK"
+48 IF ENSGL="UNK"
DO BAD^ENFACTX("MISSING GENERAL LEDGER NUMBER")
+49 ;
+50 ;Total asset value
+51 SET ENVAL=$$GET1^DIQ(6914,ENDA_",",12)
if ENVAL=""
SET ENVAL="UNK"
+52 IF ENVAL="UNK"
DO BAD^ENFACTX("MISSING TOTAL ASSET VALUE")
+53 ;
+54 ;Missing pertinent information do not place on the report
+55 IF $DATA(^TMP($JOB,"BAD",ENDA))
QUIT
+56 ;
+57 ; update capitalized count and amount
+58 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,1)=$PIECE($GET(ENT(ENSN,ENFUND,ENSGL)),U)+1
+59 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,2)=$PIECE(ENT(ENSN,ENFUND,ENSGL),U,2)+ENVAL
+60 ;
+61 ; quit if item should not be expensed
+62 if $$CHKEXP^ENFACTU(ENDA)'>0
QUIT
+63 ;
+64 ; expense it
+65 SET ENX=$$EXP^ENFACTX(ENDA)
+66 ;
+67 ; if not successful then ensure it is on problem list and quit
+68 IF 'ENX
if '$DATA(^TMP($JOB,"BAD",ENDA))
SET ^TMP($JOB,"BAD",ENDA)=""
QUIT
+69 ;
+70 ; was successful so update expensed count and amount
+71 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,3)=$PIECE(ENT(ENSN,ENFUND,ENSGL),U,3)+1
+72 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,4)=$PIECE(ENT(ENSN,ENFUND,ENSGL),U,4)+ENVAL
+73 ;
+74 ; Save data from array
+75 SET ^XTMP("ENFACTT",2,ENSN,ENFUND,ENSGL)=ENT(ENSN,ENFUND,ENSGL)
End DoDot:1
+76 ;
+77 ; save data for report in XTMP in case of problems during print
+78 KILL ^XTMP("ENFACT")
+79 ; purge date is T+21
SET ^XTMP("ENFACT",0)=$$FMADD^XLFDT(DT,21)_U_DT
+80 IF $DATA(^TMP($JOB,"BAD"))
MERGE ^XTMP("ENFACT","BAD")=^TMP($JOB,"BAD")
+81 IF $DATA(ENT)
MERGE ^XTMP("ENFACT","ENT")=ENT
+82 ;
QRPT ; queue a task to report results on device ENIO
+1 ; note: if a site needs to reprint the summary report for some reason
+2 ; then enter the following commands at the programmer prompt
+3 ; >S ENIO=name of an output device (.01 field of DEVICE file)
+4 ; >D QRPT^ENFACTT
+5 SET ZTRTN="RPT^ENFACTT"
+6 SET ZTDESC="ENG Results of Capitalization Threshold Task"
+7 SET ZTDTH=$HOROLOG
SET ZTIO=ENIO
+8 DO ^%ZTLOAD
KILL ZTSK
+9 ;
+10 ; cleanup
+11 KILL ENIO
+12 KILL ^TMP($JOB,"BAD")
+13 SET ZTREQ="@"
+14 QUIT
+15 ;
RPT ; report results
+1 ; Input
+2 ; ^XTMP("ENFACT","ENT",station,fund,sgl)
+3 ; = starting capitalized count ^ $ ^ expensed by task count ^ $
+4 ; ^XTMP("ENFACT","BAD",ENDA) = # of problems for an equipment item
+5 ; ^XTMP("ENFACT","BAD",ENDA,seqn #) = description of a problem
+6 ;
+7 NEW END,ENCAP,ENDA,ENDT,ENEXP,ENFUND,ENI,ENL,ENPG,ENSGL,ENSN,Y
+8 ;
+9 USE IO
+10 SET (END,ENPG)=0
DO NOW^%DTC
SET Y=%
DO DD^%DT
SET ENDT=Y
+11 SET ENL=""
SET $PIECE(ENL,"-",IOM)=""
+12 DO RPTHD
+13 ;
+14 ; first report problems
+15 WRITE !,$SELECT($DATA(^XTMP("ENFACT","BAD")):"Some",1:"No")
+16 WRITE " problems were detected while expensing items.",!
+17 SET ENDA=0
FOR
SET ENDA=$ORDER(^XTMP("ENFACT","BAD",ENDA))
if 'ENDA
QUIT
Begin DoDot:1
+18 IF $Y+6>IOSL
DO RPTHD
+19 WRITE !,"ERROR : Couldn't create FD Doc. for ENTRY # "_ENDA
+20 WRITE !,"REASON:"
+21 ; List Problems with Equipment/Document if known
+22 SET ENI=0
FOR
SET ENI=$ORDER(^XTMP("ENFACT","BAD",ENDA,ENI))
if 'ENI
QUIT
Begin DoDot:2
+23 IF $Y+4>IOSL
DO RPTHD
+24 IF ENI=1
WRITE " "_$GET(^XTMP("ENFACT","BAD",ENDA,ENI)),!
QUIT
+25 WRITE " "_$GET(^XTMP("ENFACT","BAD",ENDA,ENI)),!
End DoDot:2
End DoDot:1
+26 ;
+27 ; display summary
+28 ; load into local array
KILL ENT
MERGE ENT=^XTMP("ENFACT","ENT")
+29 IF $Y+8>IOSL
DO RPTHD
+30 IF '$DATA(ENT)
WRITE !,"No capitalized equipment was found."
+31 IF '$TEST
WRITE !
DO RPTHDS
+32 ; loop thru ENT( by station, fund, SGL
+33 SET ENSN=""
FOR
SET ENSN=$ORDER(ENT(ENSN))
if ENSN=""
QUIT
Begin DoDot:1
+34 SET ENFUND=""
FOR
SET ENFUND=$ORDER(ENT(ENSN,ENFUND))
if ENFUND=""
QUIT
Begin DoDot:2
+35 SET ENSGL=""
FOR
SET ENSGL=$ORDER(ENT(ENSN,ENFUND,ENSGL))
if ENSGL=""
QUIT
Begin DoDot:3
+36 IF $Y+6>IOSL
DO RPTHD
DO RPTHDS
+37 WRITE !,?3,ENSN,?12,ENFUND,?20,ENSGL
+38 SET ENX=$GET(ENT(ENSN,ENFUND,ENSGL))
+39 WRITE ?27,$JUSTIFY($FNUMBER($PIECE(ENX,U,1),",",0),5)
+40 WRITE ?33,$JUSTIFY($FNUMBER($PIECE(ENX,U,2),",",2),14)
+41 WRITE ?50,$JUSTIFY($FNUMBER($PIECE(ENX,U,3),",",0),5)
+42 WRITE ?56,$JUSTIFY($FNUMBER($PIECE(ENX,U,4),",",2),14)
+43 ; add to subtotals for station
+44 SET $PIECE(ENT(ENSN),U,1)=$PIECE($GET(ENT(ENSN)),U,1)+$PIECE(ENX,U,1)
+45 SET $PIECE(ENT(ENSN),U,2)=$PIECE(ENT(ENSN),U,2)+$PIECE(ENX,U,2)
+46 SET $PIECE(ENT(ENSN),U,3)=$PIECE(ENT(ENSN),U,3)+$PIECE(ENX,U,3)
+47 SET $PIECE(ENT(ENSN),U,4)=$PIECE(ENT(ENSN),U,4)+$PIECE(ENX,U,4)
End DoDot:3
End DoDot:2
+48 ; print subtotals for station
+49 WRITE !,?27,"-----",?33,"--------------"
+50 WRITE ?50,"-----",?56,"--------------"
+51 WRITE !,?3,ENSN,"totals"
+52 WRITE ?27,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,1),",",0),5)
+53 WRITE ?33,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,2),",",2),14)
+54 WRITE ?50,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,3),",",0),5)
+55 WRITE ?56,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,4),",",2),14),!
End DoDot:1
+56 ;
+57 ; wrapup
+58 KILL ENT
+59 SET ZTREQ="@"
+60 DO ^%ZISC
+61 QUIT
+62 ;
RPTHD ; page header
+1 WRITE @IOF
+2 SET ENPG=ENPG+1
+3 WRITE !,"RESULTS OF ONE-TIME TASK TO EXPENSE EQUIP."
+4 WRITE ?48,ENDT,?72,"page ",ENPG
+5 WRITE !,ENL
+6 QUIT
RPTHDS ; summary header
+1 WRITE !," Totals before task Expensed by Task"
+2 WRITE !," Station Fund SGL Count $ Amount Count $ Amount"
+3 WRITE !," ------- ------ ---- ----- -------------- ----- --------------"
+4 QUIT
+5 ;
REPRINT ;Call at this tag to reprint (ENG*7*71)
+1 ;
+2 WRITE !,"PLEASE ENTER A VALID DEVICE TO REPRINT THE REPORT"
+3 WRITE !," ** Do Not Use P-Message **",!!
+4 ;
+5 DO ^%ZIS
+6 IF IO=IO(0)
DO RPT^ENFACTT
QUIT
+7 SET ENIO=ION
DO QRPT^ENFACTT
+8 ;
+9 QUIT
+10 ;
+11 ;ENFACTT