ENFAR2 ;WIRMFO/SAB-FIXED ASSET RPT, CAPITALIZED EQUIPMENT SUMMARY; 7/19/96
;;7.0;ENGINEERING;**25,33**;Aug 17, 1993
; Summary of Capitalized NX Equipment Assets by Station, Fund, SGL
EN ;
; ask type of breakdown
S DIR(0)="Y",DIR("A")="Report SGL totals by Fund"
S DIR("B")="YES"
D ^DIR K DIR G:$D(DIRUT) EXIT
S ENBYFUND=Y
; ask device
W !!,"This report searches the entire equipment file and may take some"
W !,"time to complete. Consider queuing this report to run after-hours."
S %ZIS="QM" D ^%ZIS G:POP EXIT
I $D(IO("Q")) D G EXIT
. S ZTRTN="QEN^ENFAR2",ZTSAVE("ENBYFUND")=""
. S ZTDESC="Capitalized NX Equip. Summary for Station"
. D ^%ZTLOAD,HOME^%ZIS K ZTSK
QEN ; queued entry
U IO
; collect data
S (ENC,END)=0 K ENT
S ENSND=$$GET1^DIQ(6910,"1,",1) S:ENSND="" ENSND="Unk" ; default station
I 'ENBYFUND S ENFUND="all"
S ENDA=0 F S ENDA=$O(^ENG(6914,ENDA)) Q:'ENDA D Q:END
. S ENC=ENC+1
. I '(ENC#500),$D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,END=1 Q
. S ENY8=$G(^ENG(6914,ENDA,8))
. Q:$P(ENY8,U,2)'=1 ; not capitalized
. Q:$P($G(^ENG(6914,ENDA,3)),U,11)]"" ; disposition date exists
. Q:$P($G(^ENG(6914,ENDA,0)),U,4)'="NX" ; not NX
. S ENY9=$G(^ENG(6914,ENDA,9))
. S ENSN=$P(ENY9,U,5) S:ENSN="" ENSN=ENSND
. I ENBYFUND S X=$P(ENY9,U,7),ENFUND=$S(X:$P($G(^ENG(6914.6,X,0)),U),1:"<null>")
. S ENSGL=$$GET1^DIQ(6914,ENDA_",",38) I ENSGL="" S ENSGL="<null>"
. S:ENSGL="" ENSGL="<null>" ; for dangling pointers
. S $P(ENT(ENSN,ENFUND,ENSGL),U)=$P($G(ENT(ENSN,ENFUND,ENSGL)),U)+1 ; count
. S $P(ENT(ENSN,ENFUND,ENSGL),U,2)=$P($G(ENT(ENSN,ENFUND,ENSGL)),U,2)+$P($G(^ENG(6914,ENDA,2)),U,3) ; asset value
K ENY8,ENY9
; print results
S ENPG=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
S ENL="",$P(ENL,"-",IOM)=""
I 'END S ENSN="" F S ENSN=$O(ENT(ENSN)) Q:ENSN="" D Q:END
. D HD Q:END
. S ENTS="0^0" ; initialize station totals
. S ENFUND="" F S ENFUND=$O(ENT(ENSN,ENFUND)) Q:ENFUND="" D Q:END
. . S ENTF="0^0" ; initialize fund totals
. . S ENSGL=""
. . F S ENSGL=$O(ENT(ENSN,ENFUND,ENSGL)) Q:ENSGL="" D Q:END
. . . I $Y+4>IOSL D HD Q:END
. . . W !,?12,ENFUND,?22,ENSGL
. . . W ?30,$J($P(ENT(ENSN,ENFUND,ENSGL),U),5)
. . . W ?38,"$",$J($FN($P(ENT(ENSN,ENFUND,ENSGL),U,2),",",2),16)
. . . S $P(ENTF,U)=$P(ENTF,U)+$P(ENT(ENSN,ENFUND,ENSGL),U)
. . . S $P(ENTF,U,2)=$P(ENTF,U,2)+$P(ENT(ENSN,ENFUND,ENSGL),U,2)
. . S $P(ENTS,U)=$P(ENTS,U)+$P(ENTF,U)
. . S $P(ENTS,U,2)=$P(ENTS,U,2)+$P(ENTF,U,2)
. . Q:'ENBYFUND
. . I $Y+5>IOSL D HD Q:END
. . W !,?30,"-----",?38,"-----------------"
. . W !,?30,$J($P(ENTF,U),5),?38,"$",$J($FN($P(ENTF,U,2),",",2),16),!
. I $Y+5>IOSL D HD Q:END
. W !,?30,"-----",?38,"-----------------"
. W !,?16,"STATION TOTAL"
. W ?30,$J($P(ENTS,U),5),?38,"$",$J($FN($P(ENTS,U,2),",",2),16)
I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
D ^%ZISC
EXIT I $D(ZTQUEUED) S ZTREQ="@"
K DIR,DIROUT,DIRUT,DIWF,DIWL,DTOUT,DUOUT,X,Y
K ENBYFUND,ENC,ENDA,ENFUND,ENSGL,ENSN,ENSND,ENT,ENTF,ENTS
K END,ENDT,ENL,ENPG
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 !,"CAPITALIZED NX EQUIP. SUMMARY FOR STATION: ",ENSN
W ?49,ENDT,?72,"page ",ENPG
W !,ENL
W !!,?20,"STANDARD",?38,"TOTAL"
W !,?20,"GENERAL",?30,"ITEM",?38,"ASSET"
W !,?12,"FUND",?20,"LEDGER",?30,"COUNT",?38,"VALUE"
W !,?12,"------",?20,"--------",?30,"-----",?38,"-----------------"
Q
;ENFAR2
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENFAR2 3551 printed Nov 22, 2024@17:03:41 Page 2
ENFAR2 ;WIRMFO/SAB-FIXED ASSET RPT, CAPITALIZED EQUIPMENT SUMMARY; 7/19/96
+1 ;;7.0;ENGINEERING;**25,33**;Aug 17, 1993
+2 ; Summary of Capitalized NX Equipment Assets by Station, Fund, SGL
EN ;
+1 ; ask type of breakdown
+2 SET DIR(0)="Y"
SET DIR("A")="Report SGL totals by Fund"
+3 SET DIR("B")="YES"
+4 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
+5 SET ENBYFUND=Y
+6 ; ask device
+7 WRITE !!,"This report searches the entire equipment file and may take some"
+8 WRITE !,"time to complete. Consider queuing this report to run after-hours."
+9 SET %ZIS="QM"
DO ^%ZIS
if POP
GOTO EXIT
+10 IF $DATA(IO("Q"))
Begin DoDot:1
+11 SET ZTRTN="QEN^ENFAR2"
SET ZTSAVE("ENBYFUND")=""
+12 SET ZTDESC="Capitalized NX Equip. Summary for Station"
+13 DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
End DoDot:1
GOTO EXIT
QEN ; queued entry
+1 USE IO
+2 ; collect data
+3 SET (ENC,END)=0
KILL ENT
+4 ; default station
SET ENSND=$$GET1^DIQ(6910,"1,",1)
if ENSND=""
SET ENSND="Unk"
+5 IF 'ENBYFUND
SET ENFUND="all"
+6 SET ENDA=0
FOR
SET ENDA=$ORDER(^ENG(6914,ENDA))
if 'ENDA
QUIT
Begin DoDot:1
+7 SET ENC=ENC+1
+8 IF '(ENC#500)
IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
SET END=1
QUIT
+9 SET ENY8=$GET(^ENG(6914,ENDA,8))
+10 ; not capitalized
if $PIECE(ENY8,U,2)'=1
QUIT
+11 ; disposition date exists
if $PIECE($GET(^ENG(6914,ENDA,3)),U,11)]""
QUIT
+12 ; not NX
if $PIECE($GET(^ENG(6914,ENDA,0)),U,4)'="NX"
QUIT
+13 SET ENY9=$GET(^ENG(6914,ENDA,9))
+14 SET ENSN=$PIECE(ENY9,U,5)
if ENSN=""
SET ENSN=ENSND
+15 IF ENBYFUND
SET X=$PIECE(ENY9,U,7)
SET ENFUND=$SELECT(X:$PIECE($GET(^ENG(6914.6,X,0)),U),1:"<null>")
+16 SET ENSGL=$$GET1^DIQ(6914,ENDA_",",38)
IF ENSGL=""
SET ENSGL="<null>"
+17 ; for dangling pointers
if ENSGL=""
SET ENSGL="<null>"
+18 ; count
SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U)=$PIECE($GET(ENT(ENSN,ENFUND,ENSGL)),U)+1
+19 ; asset value
SET $PIECE(ENT(ENSN,ENFUND,ENSGL),U,2)=$PIECE($GET(ENT(ENSN,ENFUND,ENSGL)),U,2)+$PIECE($GET(^ENG(6914,ENDA,2)),U,3)
End DoDot:1
if END
QUIT
+20 KILL ENY8,ENY9
+21 ; print results
+22 SET ENPG=0
DO NOW^%DTC
SET Y=%
DO DD^%DT
SET ENDT=Y
+23 SET ENL=""
SET $PIECE(ENL,"-",IOM)=""
+24 IF 'END
SET ENSN=""
FOR
SET ENSN=$ORDER(ENT(ENSN))
if ENSN=""
QUIT
Begin DoDot:1
+25 DO HD
if END
QUIT
+26 ; initialize station totals
SET ENTS="0^0"
+27 SET ENFUND=""
FOR
SET ENFUND=$ORDER(ENT(ENSN,ENFUND))
if ENFUND=""
QUIT
Begin DoDot:2
+28 ; initialize fund totals
SET ENTF="0^0"
+29 SET ENSGL=""
+30 FOR
SET ENSGL=$ORDER(ENT(ENSN,ENFUND,ENSGL))
if ENSGL=""
QUIT
Begin DoDot:3
+31 IF $Y+4>IOSL
DO HD
if END
QUIT
+32 WRITE !,?12,ENFUND,?22,ENSGL
+33 WRITE ?30,$JUSTIFY($PIECE(ENT(ENSN,ENFUND,ENSGL),U),5)
+34 WRITE ?38,"$",$JUSTIFY($FNUMBER($PIECE(ENT(ENSN,ENFUND,ENSGL),U,2),",",2),16)
+35 SET $PIECE(ENTF,U)=$PIECE(ENTF,U)+$PIECE(ENT(ENSN,ENFUND,ENSGL),U)
+36 SET $PIECE(ENTF,U,2)=$PIECE(ENTF,U,2)+$PIECE(ENT(ENSN,ENFUND,ENSGL),U,2)
End DoDot:3
if END
QUIT
+37 SET $PIECE(ENTS,U)=$PIECE(ENTS,U)+$PIECE(ENTF,U)
+38 SET $PIECE(ENTS,U,2)=$PIECE(ENTS,U,2)+$PIECE(ENTF,U,2)
+39 if 'ENBYFUND
QUIT
+40 IF $Y+5>IOSL
DO HD
if END
QUIT
+41 WRITE !,?30,"-----",?38,"-----------------"
+42 WRITE !,?30,$JUSTIFY($PIECE(ENTF,U),5),?38,"$",$JUSTIFY($FNUMBER($PIECE(ENTF,U,2),",",2),16),!
End DoDot:2
if END
QUIT
+43 IF $Y+5>IOSL
DO HD
if END
QUIT
+44 WRITE !,?30,"-----",?38,"-----------------"
+45 WRITE !,?16,"STATION TOTAL"
+46 WRITE ?30,$JUSTIFY($PIECE(ENTS,U),5),?38,"$",$JUSTIFY($FNUMBER($PIECE(ENTS,U,2),",",2),16)
End DoDot:1
if END
QUIT
+47 IF 'END
IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
+48 DO ^%ZISC
EXIT IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+1 KILL DIR,DIROUT,DIRUT,DIWF,DIWL,DTOUT,DUOUT,X,Y
+2 KILL ENBYFUND,ENC,ENDA,ENFUND,ENSGL,ENSN,ENSND,ENT,ENTF,ENTS
+3 KILL END,ENDT,ENL,ENPG
+4 QUIT
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 !,"CAPITALIZED NX EQUIP. SUMMARY FOR STATION: ",ENSN
+6 WRITE ?49,ENDT,?72,"page ",ENPG
+7 WRITE !,ENL
+8 WRITE !!,?20,"STANDARD",?38,"TOTAL"
+9 WRITE !,?20,"GENERAL",?30,"ITEM",?38,"ASSET"
+10 WRITE !,?12,"FUND",?20,"LEDGER",?30,"COUNT",?38,"VALUE"
+11 WRITE !,?12,"------",?20,"--------",?30,"-----",?38,"-----------------"
+12 QUIT
+13 ;ENFAR2