ENFARB ;WIRMFO/SAB-FIXED ASSET RPT, SUMMARY OF SGL $ BALANCES; 12/16/96
;;7.0;ENGINEERING;**39**;Aug 17, 1993
; Summary of $ Balances by Station, [Fund,] and SGL
EN ;
; ask for period (month/year)
S DIR(0)="D^::E^K:($E(Y,4,5)=""00"")!($E(Y,1,5)>$E(DT,1,5)) X"
S DIR("A")="Enter month of desired closing balances"
S X("Y")=$E(DT,1,3),X("M")=$E(DT,4,5)
S X=$S(X("M")="01":(X("Y")-1)_"12",1:X("Y")_$E("00",1,2-$L(X("M")-1))_(X("M")-1))_"00"
S DIR("B")=$$FMTE^XLFDT(X)
K X
S DIR("?",1)="Month and year are required and future dates are invalid."
S DIR("?",2)="This date will be used to select the closing balances"
S DIR("?",3)="that will be shown on the output."
S DIR("?",4)=" "
S DIR("?")="Enter the month and year."
D ^DIR K DIR G:$D(DIRUT) EXIT
S ENDTR=$E(Y,1,5)_"00" ; month to report
; 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
S %ZIS="QM" D ^%ZIS G:POP EXIT
I $D(IO("Q")) D G EXIT
. S ZTRTN="QEN^ENFARB"
. S ZTSAVE("ENDTR")="",ZTSAVE("ENBYFUND")=""
. S ZTDESC="FAP $ Balances"
. D ^%ZTLOAD,HOME^%ZIS K ZTSK
QEN ; queued entry
U IO
COLLECT ; collect data
S END=0 K ENT
I 'ENBYFUND S ENFUND="all"
; loop thru stations
S ENI(1)=0 F S ENI(1)=$O(^ENG(6915.9,ENI(1))) Q:'ENI(1) D
. S ENSN=$$GET1^DIQ(6915.9,ENI(1)_",",.01)
. ; loop thru funds
. S ENI(2)=0 F S ENI(2)=$O(^ENG(6915.9,ENI(1),1,ENI(2))) Q:'ENI(2) D
. . S:ENBYFUND ENFUND=$$GET1^DIQ(6915.91,ENI(2)_","_ENI(1)_",",.01)
. . ; loop thru standard general ledgers
. . S ENI(3)=0
. . F S ENI(3)=$O(^ENG(6915.9,ENI(1),1,ENI(2),1,ENI(3))) Q:'ENI(3) D
. . . S ENSGL=$$GET1^DIQ(6915.911,ENI(3)_","_ENI(2)_","_ENI(1)_",",.01)
. . . S ENBAL=$$GETBAL^ENFABAL(ENI(1),ENI(2),ENI(3),ENDTR)
. . . S:ENBAL>0 ENT(ENSN,ENFUND,ENSGL)=$G(ENT(ENSN,ENFUND,ENSGL))+ENBAL
PRINT ; print results
S ENPG=0 D NOW^%DTC S Y=% D DD^%DT S ENDT=Y
S ENDTR("E")=$$FMTE^XLFDT(ENDTR)
S ENL="",$P(ENL,"-",IOM)=""
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($FN($P(ENT(ENSN,ENFUND,ENSGL),U),",",2),16)
. . . S $P(ENTF,U)=$P(ENTF,U)+$P(ENT(ENSN,ENFUND,ENSGL),U)
. . Q:END
. . S $P(ENTS,U)=$P(ENTS,U)+$P(ENTF,U)
. . Q:'ENBYFUND
. . I $Y+5>IOSL D HD Q:END
. . W !,?30,"-----------------"
. . W !,?30,"$",$J($FN($P(ENTF,U),",",2),16),!
. Q:END
. I $Y+5>IOSL D HD Q:END
. W !,?30,"-----------------"
. W !,?16,"STATION TOTAL"
. W ?30,"$",$J($FN($P(ENTS,U),",",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,DTOUT,DUOUT,X,Y
K ENBAL,ENBYFUND,ENDA,ENDTR,ENFUND,ENI,ENSGL,ENSN,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 !,ENDTR("E")," ",$S($E(ENDTR,1,5)=$E(DT,1,5):"CURRENT",1:"CLOSING")
W " BALANCES FOR STATION: ",ENSN
W ?49,ENDT,?72,"page ",ENPG
W !,ENL
W !!,?20,"STANDARD",?30,"TOTAL"
W !,?20,"GENERAL",?30,"ASSET"
W !,?12,"FUND",?20,"LEDGER",?30,"VALUE"
W !,?12,"------",?20,"--------",?30,"-----------------"
Q
;ENFARB
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENFARB 3598 printed Dec 13, 2024@01:53:44 Page 2
ENFARB ;WIRMFO/SAB-FIXED ASSET RPT, SUMMARY OF SGL $ BALANCES; 12/16/96
+1 ;;7.0;ENGINEERING;**39**;Aug 17, 1993
+2 ; Summary of $ Balances by Station, [Fund,] and SGL
EN ;
+1 ; ask for period (month/year)
+2 SET DIR(0)="D^::E^K:($E(Y,4,5)=""00"")!($E(Y,1,5)>$E(DT,1,5)) X"
+3 SET DIR("A")="Enter month of desired closing balances"
+4 SET X("Y")=$EXTRACT(DT,1,3)
SET X("M")=$EXTRACT(DT,4,5)
+5 SET X=$SELECT(X("M")="01":(X("Y")-1)_"12",1:X("Y")_$EXTRACT("00",1,2-$LENGTH(X("M")-1))_(X("M")-1))_"00"
+6 SET DIR("B")=$$FMTE^XLFDT(X)
+7 KILL X
+8 SET DIR("?",1)="Month and year are required and future dates are invalid."
+9 SET DIR("?",2)="This date will be used to select the closing balances"
+10 SET DIR("?",3)="that will be shown on the output."
+11 SET DIR("?",4)=" "
+12 SET DIR("?")="Enter the month and year."
+13 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
+14 ; month to report
SET ENDTR=$EXTRACT(Y,1,5)_"00"
+15 ; ask type of breakdown
+16 SET DIR(0)="Y"
SET DIR("A")="Report SGL totals by Fund"
+17 SET DIR("B")="YES"
+18 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
+19 SET ENBYFUND=Y
+20 ; ask device
+21 SET %ZIS="QM"
DO ^%ZIS
if POP
GOTO EXIT
+22 IF $DATA(IO("Q"))
Begin DoDot:1
+23 SET ZTRTN="QEN^ENFARB"
+24 SET ZTSAVE("ENDTR")=""
SET ZTSAVE("ENBYFUND")=""
+25 SET ZTDESC="FAP $ Balances"
+26 DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
End DoDot:1
GOTO EXIT
QEN ; queued entry
+1 USE IO
COLLECT ; collect data
+1 SET END=0
KILL ENT
+2 IF 'ENBYFUND
SET ENFUND="all"
+3 ; loop thru stations
+4 SET ENI(1)=0
FOR
SET ENI(1)=$ORDER(^ENG(6915.9,ENI(1)))
if 'ENI(1)
QUIT
Begin DoDot:1
+5 SET ENSN=$$GET1^DIQ(6915.9,ENI(1)_",",.01)
+6 ; loop thru funds
+7 SET ENI(2)=0
FOR
SET ENI(2)=$ORDER(^ENG(6915.9,ENI(1),1,ENI(2)))
if 'ENI(2)
QUIT
Begin DoDot:2
+8 if ENBYFUND
SET ENFUND=$$GET1^DIQ(6915.91,ENI(2)_","_ENI(1)_",",.01)
+9 ; loop thru standard general ledgers
+10 SET ENI(3)=0
+11 FOR
SET ENI(3)=$ORDER(^ENG(6915.9,ENI(1),1,ENI(2),1,ENI(3)))
if 'ENI(3)
QUIT
Begin DoDot:3
+12 SET ENSGL=$$GET1^DIQ(6915.911,ENI(3)_","_ENI(2)_","_ENI(1)_",",.01)
+13 SET ENBAL=$$GETBAL^ENFABAL(ENI(1),ENI(2),ENI(3),ENDTR)
+14 if ENBAL>0
SET ENT(ENSN,ENFUND,ENSGL)=$GET(ENT(ENSN,ENFUND,ENSGL))+ENBAL
End DoDot:3
End DoDot:2
End DoDot:1
PRINT ; print results
+1 SET ENPG=0
DO NOW^%DTC
SET Y=%
DO DD^%DT
SET ENDT=Y
+2 SET ENDTR("E")=$$FMTE^XLFDT(ENDTR)
+3 SET ENL=""
SET $PIECE(ENL,"-",IOM)=""
+4 SET ENSN=""
FOR
SET ENSN=$ORDER(ENT(ENSN))
if ENSN=""
QUIT
Begin DoDot:1
+5 DO HD
if END
QUIT
+6 ; initialize station totals
SET ENTS="0^0"
+7 SET ENFUND=""
FOR
SET ENFUND=$ORDER(ENT(ENSN,ENFUND))
if ENFUND=""
QUIT
Begin DoDot:2
+8 ; initialize fund totals
SET ENTF="0^0"
+9 SET ENSGL=""
+10 FOR
SET ENSGL=$ORDER(ENT(ENSN,ENFUND,ENSGL))
if ENSGL=""
QUIT
Begin DoDot:3
+11 IF $Y+4>IOSL
DO HD
if END
QUIT
+12 WRITE !,?12,ENFUND,?22,ENSGL
+13 WRITE ?30,"$",$JUSTIFY($FNUMBER($PIECE(ENT(ENSN,ENFUND,ENSGL),U),",",2),16)
+14 SET $PIECE(ENTF,U)=$PIECE(ENTF,U)+$PIECE(ENT(ENSN,ENFUND,ENSGL),U)
End DoDot:3
if END
QUIT
+15 if END
QUIT
+16 SET $PIECE(ENTS,U)=$PIECE(ENTS,U)+$PIECE(ENTF,U)
+17 if 'ENBYFUND
QUIT
+18 IF $Y+5>IOSL
DO HD
if END
QUIT
+19 WRITE !,?30,"-----------------"
+20 WRITE !,?30,"$",$JUSTIFY($FNUMBER($PIECE(ENTF,U),",",2),16),!
End DoDot:2
if END
QUIT
+21 if END
QUIT
+22 IF $Y+5>IOSL
DO HD
if END
QUIT
+23 WRITE !,?30,"-----------------"
+24 WRITE !,?16,"STATION TOTAL"
+25 WRITE ?30,"$",$JUSTIFY($FNUMBER($PIECE(ENTS,U),",",2),16)
End DoDot:1
if END
QUIT
+26 IF 'END
IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
+27 DO ^%ZISC
EXIT IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+1 KILL DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+2 KILL ENBAL,ENBYFUND,ENDA,ENDTR,ENFUND,ENI,ENSGL,ENSN,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 !,ENDTR("E")," ",$SELECT($EXTRACT(ENDTR,1,5)=$EXTRACT(DT,1,5):"CURRENT",1:"CLOSING")
+6 WRITE " BALANCES FOR STATION: ",ENSN
+7 WRITE ?49,ENDT,?72,"page ",ENPG
+8 WRITE !,ENL
+9 WRITE !!,?20,"STANDARD",?30,"TOTAL"
+10 WRITE !,?20,"GENERAL",?30,"ASSET"
+11 WRITE !,?12,"FUND",?20,"LEDGER",?30,"VALUE"
+12 WRITE !,?12,"------",?20,"--------",?30,"-----------------"
+13 QUIT
+14 ;ENFARB