ENFACTS ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD SKIP LIST ;10/23/2000
;;7.0;ENGINEERING;**63**;Aug 17, 1993
EN ;
; ask device
S %ZIS="QM" D ^%ZIS G:POP EXIT
I $D(IO("Q")) D G EXIT
. S ZTRTN="QEN^ENFACTS"
. S ZTDESC="ENG List Equip to Remain Capitalized"
. D ^%ZTLOAD,HOME^%ZIS K ZTSK
;
QEN ; queued entry
U IO
;
COLLECT ; collect data
S END=0 ; init flag, =true if user stopped job
K ENT ; totals ENT(station,fund,sgl)
; =capitalized count^$^to remain capitalized count^$
K ^TMP($J)
;
; loop thru equipment in FA DOCUMENT LOG file
S ENDA=0 F S ENDA=$O(^ENG(6915.2,"B",ENDA)) Q:'ENDA D
. Q:+$$CHKFA^ENFAUTL(ENDA)'>0 ; not currently reported to FAP
. ; get equipment data
. S ENSN=$$GET1^DIQ(6914,ENDA_",",60)_" " S:ENSN=" " ENSN="UNK"
. S ENFUND=$$GET1^DIQ(6914,ENDA_",",62)_" " S:ENFUND=" " ENFUND="UNK"
. S ENSGL=$$GET1^DIQ(6914,ENDA_",",38) S:ENSGL="" ENSGL="UNK"
. S ENVAL=$$GET1^DIQ(6914,ENDA_",",12)
. ; update capitalized count and amount
. S $P(ENT(ENSN,ENFUND,ENSGL),U)=$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 be expensed
. S ENX=$$CHKEXP^ENFACTU(ENDA)
. Q:$P(ENX,U)=1
. ; put on sorted list of items that will remain cap. and update counts
. S ENSYS=+$$TOPSYS^ENFACTU(ENDA) ; plus value to treat ? as standalone
. S ENSYSV=+$S(ENSYS>0:$$SYSVAL^ENFACTU(ENSYS,"C"),1:ENVAL)
. S ^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)=ENX
. 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
;
PRINT ; print results
S ENPG=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
S ENL="",$P(ENL,"-",IOM)=""
I '$D(ENT) S ENSN="" D HD W !!,"Nothing to report."
; loop thru ENT( by station
S ENSN="" F S ENSN=$O(ENT(ENSN)) Q:ENSN="" D Q:END
. D HD Q:END
. I '$D(^TMP($J,ENSN)) W !!,"NO EQUIPMENT WILL REMAIN CAPITALIED WHEN TASK RUNS FOR THIS STATION."
. ; loop thru system values in ^TMP(
. S ENSYSV="" F S ENSYSV=$O(^TMP($J,ENSN,ENSYSV)) Q:ENSYSV="" D Q:END
. . ; loop thru system # (will be 0 for standalone items)
. . S ENSYS=""
. . F S ENSYS=$O(^TMP($J,ENSN,ENSYSV,ENSYS)) Q:ENSYS="" D Q:END
. . . ; if system then print parent data and system info
. . . I ENSYS>0 D
. . . . W !!,?2,"TOP PARENT SYSTEM ENTRY #: ",ENSYS
. . . . W ?40,"CMR: ",$E($$GET1^DIQ(6914,ENSYS,19),1,5)
. . . . W ?51,"Parent Value: "
. . . . I +$$CHKFA^ENFAUTL(ENSYS) W $FN($$GET1^DIQ(6914,ENSYS,12),",",2)
. . . . E W "not in FAP"
. . . . S ENCSN=$$GET1^DIQ(6914,ENSYS,18)
. . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
. . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENSYS,"18:2"),")"
. . . . I +$$CHKFA^ENFAUTL(ENSYS) D
. . . . . S ENTSK=$G(^TMP($J,ENSN,ENSYSV,ENSYS,ENSYS))
. . . . . I $P(ENTSK,U)=0 W !," Reason: ",$P(ENTSK,U,2)
. . . . . I $P(ENTSK,U)="U" W !," Reason: ",$P(ENTSK,U,2)," indicated it should remain capitalized."
. . . . W !,?2,"Sum of Capitalized Values in System: "
. . . . W $FN(ENSYSV,",",2)
. . . ; loop thru equipment
. . . S ENDA=0
. . . F S ENDA=$O(^TMP($J,ENSN,ENSYSV,ENSYS,ENDA)) Q:'ENDA D Q:END
. . . . Q:ENDA=ENSYS ; already displayed as parent of system
. . . . I $Y+6>IOSL D HD Q:END W " (continued)"
. . . . S ENCSN=$$GET1^DIQ(6914,ENDA,18)
. . . . ; print format for component of system
. . . . I ENSYS>0 D
. . . . . W !!,?6,"COMPONENT ENTRY #: ",ENDA
. . . . . W ?36,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
. . . . . W ?47,"Component Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
. . . . . W !,?6,"CATEGORY STOCK NUMBER: ",ENCSN
. . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
. . . . ; print format for standalone equipment
. . . . I ENSYS=0 D
. . . . . W !!,?2,"ENTRY #: ",ENDA
. . . . . W ?22,"CMR: ",$E($$GET1^DIQ(6914,ENDA,19),1,5)
. . . . . W ?33,"Value: ",$FN($$GET1^DIQ(6914,ENDA,12),",",2)
. . . . . W !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
. . . . . I ENCSN]"" W " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
. . . . S ENTSK=$G(^TMP($J,ENSN,ENSYSV,ENSYS,ENDA))
. . . . I $P(ENTSK,U)=0 D
. . . . . W !," ",$S(ENSYS>0:" ",1:""),"Reason: ",$P(ENTSK,U,2)
. . . . I $P(ENTSK,U)="U" D
. . . . . W !," ",$S(ENSYS>0:" ",1:""),"Reason: ",$P(ENTSK,U,2)," indicated it should remain capitalized."
. Q:END
. ; print station totals
. I $Y+14>IOSL D HD Q:END W " (continued)"
. D HDST
. S ENFUND="" F S ENFUND=$O(ENT(ENSN,ENFUND)) Q:ENFUND="" D Q:END
. . S ENSGL=""
. . F S ENSGL=$O(ENT(ENSN,ENFUND,ENSGL)) Q:ENSGL="" D Q:END
. . . I $Y+6>IOSL D HD Q:END W " (continued)" D HDST
. . . W !,ENFUND,?7,ENSGL
. . . S ENX=$G(ENT(ENSN,ENFUND,ENSGL))
. . . W ?12,$J($FN($P(ENX,U,1),","),5)
. . . W ?18,$J($FN($P(ENX,U,2),",",2),14)
. . . W ?35,$J($FN($P(ENX,U,3),","),5)
. . . W ?41,$J($FN($P(ENX,U,4),",",2),14)
. . . W ?58,$J($FN($P(ENX,U,1)-$P(ENX,U,3),","),5)
. . . W ?64,$J($FN($P(ENX,U,2)-$P(ENX,U,4),",",2),14)
. . . ; add sgl 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)
. W !," ----- -------------- ----- -------------- ----- --------------"
. W !,"Station Tot"
. W ?12,$J($FN($P(ENT(ENSN),U,1),","),5)
. W ?18,$J($FN($P(ENT(ENSN),U,2),",",2),14)
. W ?35,$J($FN($P(ENT(ENSN),U,3),","),5)
. W ?41,$J($FN($P(ENT(ENSN),U,4),",",2),14)
. W ?58,$J($FN($P(ENT(ENSN),U,1)-$P(ENT(ENSN),U,3),","),5)
. W ?64,$J($FN($P(ENT(ENSN),U,2)-$P(ENT(ENSN),U,4),",",2),14)
I END W !!,"REPORT STOPPED BY USER REQUEST"
I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
D ^%ZISC
EXIT I $D(ZTQUEUED) S ZTREQ="@"
K ^TMP($J)
K DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,END,ENDT,ENL,ENPG
K ENCSN,ENDA,ENFUND,ENSGL,ENSN,ENSYS,ENSYSV,ENT,ENTSK,ENVAL,ENX
Q
;
HD ; header
I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,END=1 Q
I $E(IOST,1,2)="C-",ENPG S DIR(0)="E" D ^DIR K DIR I 'Y S END=1 Q
I $E(IOST,1,2)="C-"!ENPG W @IOF
S ENPG=ENPG+1
W !,"EQUIPMENT TO REMAIN CAPITALIZED sorted by value"
W ?49,ENDT,?72,"page ",ENPG
W !,ENL
I ENSN]"" W !,"STATION ",ENSN
Q
;
HDST ; header for station totals
W !!," Current Capitalized Remain Capitalized CT Task Will Expense"
W !,"Fund SGL Count $ Amount Count $ Amount Count $ Amount"
W !,"------ ---- ----- -------------- ----- -------------- ----- --------------"
Q
;ENFACTS
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENFACTS 6620 printed Nov 22, 2024@17:03:35 Page 2
ENFACTS ;(WCIOFO)/SAB-FAP CAPITALIZATION THRESHOLD SKIP LIST ;10/23/2000
+1 ;;7.0;ENGINEERING;**63**;Aug 17, 1993
EN ;
+1 ; ask device
+2 SET %ZIS="QM"
DO ^%ZIS
if POP
GOTO EXIT
+3 IF $DATA(IO("Q"))
Begin DoDot:1
+4 SET ZTRTN="QEN^ENFACTS"
+5 SET ZTDESC="ENG List Equip to Remain Capitalized"
+6 DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
End DoDot:1
GOTO EXIT
+7 ;
QEN ; queued entry
+1 USE IO
+2 ;
COLLECT ; collect data
+1 ; init flag, =true if user stopped job
SET END=0
+2 ; totals ENT(station,fund,sgl)
KILL ENT
+3 ; =capitalized count^$^to remain capitalized count^$
+4 KILL ^TMP($JOB)
+5 ;
+6 ; loop thru equipment in FA DOCUMENT LOG file
+7 SET ENDA=0
FOR
SET ENDA=$ORDER(^ENG(6915.2,"B",ENDA))
if 'ENDA
QUIT
Begin DoDot:1
+8 ; not currently reported to FAP
if +$$CHKFA^ENFAUTL(ENDA)'>0
QUIT
+9 ; get equipment data
+10 SET ENSN=$$GET1^DIQ(6914,ENDA_",",60)_" "
if ENSN=" "
SET ENSN="UNK"
+11 SET ENFUND=$$GET1^DIQ(6914,ENDA_",",62)_" "
if ENFUND=" "
SET ENFUND="UNK"
+12 SET ENSGL=$$GET1^DIQ(6914,ENDA_",",38)
if ENSGL=""
SET ENSGL="UNK"
+13 SET ENVAL=$$GET1^DIQ(6914,ENDA_",",12)
+14 ; update capitalized count and amount
+15 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U)=$PIECE($GET(ENT(ENSN,ENFUND,ENSGL)),U)+1
+16 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,2)=$PIECE(ENT(ENSN,ENFUND,ENSGL),U,2)+ENVAL
+17 ; quit if item should be expensed
+18 SET ENX=$$CHKEXP^ENFACTU(ENDA)
+19 if $PIECE(ENX,U)=1
QUIT
+20 ; put on sorted list of items that will remain cap. and update counts
+21 ; plus value to treat ? as standalone
SET ENSYS=+$$TOPSYS^ENFACTU(ENDA)
+22 SET ENSYSV=+$SELECT(ENSYS>0:$$SYSVAL^ENFACTU(ENSYS,"C"),1:ENVAL)
+23 SET ^TMP($JOB,ENSN,ENSYSV,ENSYS,ENDA)=ENX
+24 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,3)=$PIECE(ENT(ENSN,ENFUND,ENSGL),U,3)+1
+25 SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,4)=$PIECE(ENT(ENSN,ENFUND,ENSGL),U,4)+ENVAL
End DoDot:1
+26 ;
PRINT ; print results
+1 SET ENPG=0
DO NOW^%DTC
SET Y=%
DO DD^%DT
SET ENDT=Y
+2 SET ENL=""
SET $PIECE(ENL,"-",IOM)=""
+3 IF '$DATA(ENT)
SET ENSN=""
DO HD
WRITE !!,"Nothing to report."
+4 ; loop thru ENT( by station
+5 SET ENSN=""
FOR
SET ENSN=$ORDER(ENT(ENSN))
if ENSN=""
QUIT
Begin DoDot:1
+6 DO HD
if END
QUIT
+7 IF '$DATA(^TMP($JOB,ENSN))
WRITE !!,"NO EQUIPMENT WILL REMAIN CAPITALIED WHEN TASK RUNS FOR THIS STATION."
+8 ; loop thru system values in ^TMP(
+9 SET ENSYSV=""
FOR
SET ENSYSV=$ORDER(^TMP($JOB,ENSN,ENSYSV))
if ENSYSV=""
QUIT
Begin DoDot:2
+10 ; loop thru system # (will be 0 for standalone items)
+11 SET ENSYS=""
+12 FOR
SET ENSYS=$ORDER(^TMP($JOB,ENSN,ENSYSV,ENSYS))
if ENSYS=""
QUIT
Begin DoDot:3
+13 ; if system then print parent data and system info
+14 IF ENSYS>0
Begin DoDot:4
+15 WRITE !!,?2,"TOP PARENT SYSTEM ENTRY #: ",ENSYS
+16 WRITE ?40,"CMR: ",$EXTRACT($$GET1^DIQ(6914,ENSYS,19),1,5)
+17 WRITE ?51,"Parent Value: "
+18 IF +$$CHKFA^ENFAUTL(ENSYS)
WRITE $FNUMBER($$GET1^DIQ(6914,ENSYS,12),",",2)
+19 IF '$TEST
WRITE "not in FAP"
+20 SET ENCSN=$$GET1^DIQ(6914,ENSYS,18)
+21 WRITE !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
+22 IF ENCSN]""
WRITE " (",$$GET1^DIQ(6914,ENSYS,"18:2"),")"
+23 IF +$$CHKFA^ENFAUTL(ENSYS)
Begin DoDot:5
+24 SET ENTSK=$GET(^TMP($JOB,ENSN,ENSYSV,ENSYS,ENSYS))
+25 IF $PIECE(ENTSK,U)=0
WRITE !," Reason: ",$PIECE(ENTSK,U,2)
+26 IF $PIECE(ENTSK,U)="U"
WRITE !," Reason: ",$PIECE(ENTSK,U,2)," indicated it should remain capitalized."
End DoDot:5
+27 WRITE !,?2,"Sum of Capitalized Values in System: "
+28 WRITE $FNUMBER(ENSYSV,",",2)
End DoDot:4
+29 ; loop thru equipment
+30 SET ENDA=0
+31 FOR
SET ENDA=$ORDER(^TMP($JOB,ENSN,ENSYSV,ENSYS,ENDA))
if 'ENDA
QUIT
Begin DoDot:4
+32 ; already displayed as parent of system
if ENDA=ENSYS
QUIT
+33 IF $Y+6>IOSL
DO HD
if END
QUIT
WRITE " (continued)"
+34 SET ENCSN=$$GET1^DIQ(6914,ENDA,18)
+35 ; print format for component of system
+36 IF ENSYS>0
Begin DoDot:5
+37 WRITE !!,?6,"COMPONENT ENTRY #: ",ENDA
+38 WRITE ?36,"CMR: ",$EXTRACT($$GET1^DIQ(6914,ENDA,19),1,5)
+39 WRITE ?47,"Component Value: ",$FNUMBER($$GET1^DIQ(6914,ENDA,12),",",2)
+40 WRITE !,?6,"CATEGORY STOCK NUMBER: ",ENCSN
+41 IF ENCSN]""
WRITE " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
End DoDot:5
+42 ; print format for standalone equipment
+43 IF ENSYS=0
Begin DoDot:5
+44 WRITE !!,?2,"ENTRY #: ",ENDA
+45 WRITE ?22,"CMR: ",$EXTRACT($$GET1^DIQ(6914,ENDA,19),1,5)
+46 WRITE ?33,"Value: ",$FNUMBER($$GET1^DIQ(6914,ENDA,12),",",2)
+47 WRITE !,?2,"CATEGORY STOCK NUMBER: ",ENCSN
+48 IF ENCSN]""
WRITE " (",$$GET1^DIQ(6914,ENDA,"18:2"),")"
End DoDot:5
+49 SET ENTSK=$GET(^TMP($JOB,ENSN,ENSYSV,ENSYS,ENDA))
+50 IF $PIECE(ENTSK,U)=0
Begin DoDot:5
+51 WRITE !," ",$SELECT(ENSYS>0:" ",1:""),"Reason: ",$PIECE(ENTSK,U,2)
End DoDot:5
+52 IF $PIECE(ENTSK,U)="U"
Begin DoDot:5
+53 WRITE !," ",$SELECT(ENSYS>0:" ",1:""),"Reason: ",$PIECE(ENTSK,U,2)," indicated it should remain capitalized."
End DoDot:5
End DoDot:4
if END
QUIT
End DoDot:3
if END
QUIT
End DoDot:2
if END
QUIT
+54 if END
QUIT
+55 ; print station totals
+56 IF $Y+14>IOSL
DO HD
if END
QUIT
WRITE " (continued)"
+57 DO HDST
+58 SET ENFUND=""
FOR
SET ENFUND=$ORDER(ENT(ENSN,ENFUND))
if ENFUND=""
QUIT
Begin DoDot:2
+59 SET ENSGL=""
+60 FOR
SET ENSGL=$ORDER(ENT(ENSN,ENFUND,ENSGL))
if ENSGL=""
QUIT
Begin DoDot:3
+61 IF $Y+6>IOSL
DO HD
if END
QUIT
WRITE " (continued)"
DO HDST
+62 WRITE !,ENFUND,?7,ENSGL
+63 SET ENX=$GET(ENT(ENSN,ENFUND,ENSGL))
+64 WRITE ?12,$JUSTIFY($FNUMBER($PIECE(ENX,U,1),","),5)
+65 WRITE ?18,$JUSTIFY($FNUMBER($PIECE(ENX,U,2),",",2),14)
+66 WRITE ?35,$JUSTIFY($FNUMBER($PIECE(ENX,U,3),","),5)
+67 WRITE ?41,$JUSTIFY($FNUMBER($PIECE(ENX,U,4),",",2),14)
+68 WRITE ?58,$JUSTIFY($FNUMBER($PIECE(ENX,U,1)-$PIECE(ENX,U,3),","),5)
+69 WRITE ?64,$JUSTIFY($FNUMBER($PIECE(ENX,U,2)-$PIECE(ENX,U,4),",",2),14)
+70 ; add sgl to subtotals for station
+71 SET $PIECE(ENT(ENSN),U,1)=$PIECE($GET(ENT(ENSN)),U,1)+$PIECE(ENX,U,1)
+72 SET $PIECE(ENT(ENSN),U,2)=$PIECE(ENT(ENSN),U,2)+$PIECE(ENX,U,2)
+73 SET $PIECE(ENT(ENSN),U,3)=$PIECE(ENT(ENSN),U,3)+$PIECE(ENX,U,3)
+74 SET $PIECE(ENT(ENSN),U,4)=$PIECE(ENT(ENSN),U,4)+$PIECE(ENX,U,4)
End DoDot:3
if END
QUIT
End DoDot:2
if END
QUIT
+75 WRITE !," ----- -------------- ----- -------------- ----- --------------"
+76 WRITE !,"Station Tot"
+77 WRITE ?12,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,1),","),5)
+78 WRITE ?18,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,2),",",2),14)
+79 WRITE ?35,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,3),","),5)
+80 WRITE ?41,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,4),",",2),14)
+81 WRITE ?58,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,1)-$PIECE(ENT(ENSN),U,3),","),5)
+82 WRITE ?64,$JUSTIFY($FNUMBER($PIECE(ENT(ENSN),U,2)-$PIECE(ENT(ENSN),U,4),",",2),14)
End DoDot:1
if END
QUIT
+83 IF END
WRITE !!,"REPORT STOPPED BY USER REQUEST"
+84 IF 'END
IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
+85 DO ^%ZISC
EXIT IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+1 KILL ^TMP($JOB)
+2 KILL DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,END,ENDT,ENL,ENPG
+3 KILL ENCSN,ENDA,ENFUND,ENSGL,ENSN,ENSYS,ENSYSV,ENT,ENTSK,ENVAL,ENX
+4 QUIT
+5 ;
HD ; header
+1 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
SET END=1
QUIT
+2 IF $EXTRACT(IOST,1,2)="C-"
IF ENPG
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET END=1
QUIT
+3 IF $EXTRACT(IOST,1,2)="C-"!ENPG
WRITE @IOF
+4 SET ENPG=ENPG+1
+5 WRITE !,"EQUIPMENT TO REMAIN CAPITALIZED sorted by value"
+6 WRITE ?49,ENDT,?72,"page ",ENPG
+7 WRITE !,ENL
+8 IF ENSN]""
WRITE !,"STATION ",ENSN
+9 QUIT
+10 ;
HDST ; header for station totals
+1 WRITE !!," Current Capitalized Remain Capitalized CT Task Will Expense"
+2 WRITE !,"Fund SGL Count $ Amount Count $ Amount Count $ Amount"
+3 WRITE !,"------ ---- ----- -------------- ----- -------------- ----- --------------"
+4 QUIT
+5 ;ENFACTS