ENFAR5B ;WIRMFO/SAB-FIXED ASSET RPT, VOUCHER SUMMARY (CONT); 5/22/97
;;7.0;ENGINEERING;**29,39**;Aug 17, 1993
GETBAL ; get balances from file #6915.9
; find station
S ENI(1)=$$FIND1^DIC(6915.9,"","X",ENSNR,"B") Q:'ENI(1)
; loop thru fund
S ENI(2)=0 F S ENI(2)=$O(^ENG(6915.9,ENI(1),1,ENI(2))) Q:'ENI(2) D
. S ENFUND=$$GET1^DIQ(6915.91,ENI(2)_","_ENI(1)_",",.01)
. ; loop thru sgl
. 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)
. . ; get two balances
. . S ENBAL1=$$GETBAL^ENFABAL(ENI(1),ENI(2),ENI(3),ENDTM1)
. . S ENBAL2=$$GETBAL^ENFABAL(ENI(1),ENI(2),ENI(3),ENDTM2)
. . ; save balances in ^tmp
. . S:ENBAL1>0!(ENBAL2>0) ^TMP($J,ENFUND,ENSGL)=ENBAL1_U_ENBAL2
Q
PRINT ; print results
S (END,ENPG)=0 D NOW^%DTC S Y=% D DD^%DT S ENDTR=Y
S ENL="",$P(ENL,"-",IOM)=""
I '$D(^TMP($J)) S ENFUND="" D HD W !!,"No activity in selected period",!
S ENDTMO=$$FMTE^XLFDT($E(ENDTS,1,5)_"00"),ENDTMC=$$FMTE^XLFDT(ENDTM2)
S ENFUND="" F S ENFUND=$O(^TMP($J,ENFUND)) Q:ENFUND="" D Q:END
. S ENFUND("I")=$O(^ENG(6914.6,"B",ENFUND,0))
. S ENFUND("A")=$S(ENFUND("I"):$P($G(^ENG(6914.6,ENFUND("I"),0)),U,4),1:"")
. D HD Q:END
. S ENSGL="" F S ENSGL=$O(^TMP($J,ENFUND,ENSGL)) Q:ENSGL="" D Q:END
. . S ENBAL=$G(^TMP($J,ENFUND,ENSGL))
. . S ENSGL("I")=$O(^ENG(6914.3,"B",ENSGL,0))
. . S ENSGL("A")=$S(ENSGL("I"):$P($G(^ENG(6914.3,ENSGL("I"),0)),U,4),1:"")
. . W !!,?2,"SGL: ",ENSGL W:ENSGL("A")]"" " ",ENSGL("A")
. . S ENT("SGL")=0 ; initialize SGL net activity
. . W !,?12,"Opening Balance for ",ENDTMO,":"
. . W ?43,$J("$"_$FN(+$P(ENBAL,U,1),",",2),16)
. . S ENDT=""
. . F S ENDT=$O(^TMP($J,ENFUND,ENSGL,ENDT)) Q:ENDT="" D Q:END
. . . S ENY=""
. . . F S ENY=$O(^TMP($J,ENFUND,ENSGL,ENDT,ENY)) Q:ENY="" D Q:END
. . . . I $Y+4>IOSL D HD Q:END D HDSGL
. . . . S ENFILE=$P(ENY,";"),ENDA("F?")=$P(ENY,";",2)
. . . . S ENAMT=$P(^TMP($J,ENFUND,ENSGL,ENDT,ENY),U)
. . . . S ENY1=$G(^ENG(ENFILE,ENDA("F?"),1))
. . . . S ENDA=$P($G(^ENG(ENFILE,ENDA("F?"),0)),U)
. . . . W !,?4,$P(ENY1,U,6),?9,$P(ENY1,U,9),?21,$$FMTE^XLFDT(ENDT,"2D")
. . . . W ?31,ENDA,?43,$J($FN(ENAMT,",",2),16)
. . . . W ?61,$P($G(^ENG(6914,ENDA,2)),U,2) ; p.o.
. . . . I ENFILE=6915.3 D
. . . . . S ENNOTE=$P($G(^ENG(ENFILE,ENDA("F?"),3)),U,8)
. . . . . I ENNOTE]"" W !,?9,"Desc: ",ENNOTE
. . . . I ENFILE=6915.5 D
. . . . . S ENNOTE=$P($G(^ENG(ENFILE,ENDA("F?"),5)),U,8)
. . . . . I ENNOTE>0 W !,?9,"Sold: $",$FN(ENNOTE,",",2)
. . . . S ENT("SGL")=ENT("SGL")+ENAMT
. . Q:END
. . W !,?12,"G/L Acct "_ENSGL_" Net Activity: "
. . W ?43,$J($FN(ENT("SGL"),",",2),16)
. . W !,?12,"Closing Balance for ",ENDTMC,":"
. . W ?43,$J("$"_$FN(+$P(ENBAL,U,2),",",2),16)
I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
K ENDTMC,ENDTMO
Q
HD ; page 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 !,"VOUCHER SUMMARY FOR STATION: ",ENSNR,?49,ENDTR,?72,"page ",ENPG
W !," FUND: ",ENFUND W:$G(ENFUND("A"))]"" " ",ENFUND("A")
W ?32," ACCOUNTING PERIOD FROM ",$$FMTE^XLFDT(ENDTS,"2D")
W " TO ",$$FMTE^XLFDT(ENDTE,"2D")
W !!,?4,"TRANSACTION",?31,"EQUIP ID#",?43,"NET AMOUNT",?61,"EQUIP P.O.#"
W !,?4,"CODE NUMBER DATE"
W !,?4,"---- ----------- --------",?31,"----------"
W ?43,"----------------",?61,"------------"
Q
HDSGL ; header for continued SGL
W !,?2,"SGL: ",ENSGL W:ENSGL("A")]"" " ",ENSGL("A") W " (continued)"
Q
;ENFAR5B
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENFAR5B 3650 printed Nov 22, 2024@17:03:46 Page 2
ENFAR5B ;WIRMFO/SAB-FIXED ASSET RPT, VOUCHER SUMMARY (CONT); 5/22/97
+1 ;;7.0;ENGINEERING;**29,39**;Aug 17, 1993
GETBAL ; get balances from file #6915.9
+1 ; find station
+2 SET ENI(1)=$$FIND1^DIC(6915.9,"","X",ENSNR,"B")
if 'ENI(1)
QUIT
+3 ; loop thru fund
+4 SET ENI(2)=0
FOR
SET ENI(2)=$ORDER(^ENG(6915.9,ENI(1),1,ENI(2)))
if 'ENI(2)
QUIT
Begin DoDot:1
+5 SET ENFUND=$$GET1^DIQ(6915.91,ENI(2)_","_ENI(1)_",",.01)
+6 ; loop thru sgl
+7 SET ENI(3)=0
+8 FOR
SET ENI(3)=$ORDER(^ENG(6915.9,ENI(1),1,ENI(2),1,ENI(3)))
if 'ENI(3)
QUIT
Begin DoDot:2
+9 SET ENSGL=$$GET1^DIQ(6915.911,ENI(3)_","_ENI(2)_","_ENI(1)_",",.01)
+10 ; get two balances
+11 SET ENBAL1=$$GETBAL^ENFABAL(ENI(1),ENI(2),ENI(3),ENDTM1)
+12 SET ENBAL2=$$GETBAL^ENFABAL(ENI(1),ENI(2),ENI(3),ENDTM2)
+13 ; save balances in ^tmp
+14 if ENBAL1>0!(ENBAL2>0)
SET ^TMP($JOB,ENFUND,ENSGL)=ENBAL1_U_ENBAL2
End DoDot:2
End DoDot:1
+15 QUIT
PRINT ; print results
+1 SET (END,ENPG)=0
DO NOW^%DTC
SET Y=%
DO DD^%DT
SET ENDTR=Y
+2 SET ENL=""
SET $PIECE(ENL,"-",IOM)=""
+3 IF '$DATA(^TMP($JOB))
SET ENFUND=""
DO HD
WRITE !!,"No activity in selected period",!
+4 SET ENDTMO=$$FMTE^XLFDT($EXTRACT(ENDTS,1,5)_"00")
SET ENDTMC=$$FMTE^XLFDT(ENDTM2)
+5 SET ENFUND=""
FOR
SET ENFUND=$ORDER(^TMP($JOB,ENFUND))
if ENFUND=""
QUIT
Begin DoDot:1
+6 SET ENFUND("I")=$ORDER(^ENG(6914.6,"B",ENFUND,0))
+7 SET ENFUND("A")=$SELECT(ENFUND("I"):$PIECE($GET(^ENG(6914.6,ENFUND("I"),0)),U,4),1:"")
+8 DO HD
if END
QUIT
+9 SET ENSGL=""
FOR
SET ENSGL=$ORDER(^TMP($JOB,ENFUND,ENSGL))
if ENSGL=""
QUIT
Begin DoDot:2
+10 SET ENBAL=$GET(^TMP($JOB,ENFUND,ENSGL))
+11 SET ENSGL("I")=$ORDER(^ENG(6914.3,"B",ENSGL,0))
+12 SET ENSGL("A")=$SELECT(ENSGL("I"):$PIECE($GET(^ENG(6914.3,ENSGL("I"),0)),U,4),1:"")
+13 WRITE !!,?2,"SGL: ",ENSGL
if ENSGL("A")]""
WRITE " ",ENSGL("A")
+14 ; initialize SGL net activity
SET ENT("SGL")=0
+15 WRITE !,?12,"Opening Balance for ",ENDTMO,":"
+16 WRITE ?43,$JUSTIFY("$"_$FNUMBER(+$PIECE(ENBAL,U,1),",",2),16)
+17 SET ENDT=""
+18 FOR
SET ENDT=$ORDER(^TMP($JOB,ENFUND,ENSGL,ENDT))
if ENDT=""
QUIT
Begin DoDot:3
+19 SET ENY=""
+20 FOR
SET ENY=$ORDER(^TMP($JOB,ENFUND,ENSGL,ENDT,ENY))
if ENY=""
QUIT
Begin DoDot:4
+21 IF $Y+4>IOSL
DO HD
if END
QUIT
DO HDSGL
+22 SET ENFILE=$PIECE(ENY,";")
SET ENDA("F?")=$PIECE(ENY,";",2)
+23 SET ENAMT=$PIECE(^TMP($JOB,ENFUND,ENSGL,ENDT,ENY),U)
+24 SET ENY1=$GET(^ENG(ENFILE,ENDA("F?"),1))
+25 SET ENDA=$PIECE($GET(^ENG(ENFILE,ENDA("F?"),0)),U)
+26 WRITE !,?4,$PIECE(ENY1,U,6),?9,$PIECE(ENY1,U,9),?21,$$FMTE^XLFDT(ENDT,"2D")
+27 WRITE ?31,ENDA,?43,$JUSTIFY($FNUMBER(ENAMT,",",2),16)
+28 ; p.o.
WRITE ?61,$PIECE($GET(^ENG(6914,ENDA,2)),U,2)
+29 IF ENFILE=6915.3
Begin DoDot:5
+30 SET ENNOTE=$PIECE($GET(^ENG(ENFILE,ENDA("F?"),3)),U,8)
+31 IF ENNOTE]""
WRITE !,?9,"Desc: ",ENNOTE
End DoDot:5
+32 IF ENFILE=6915.5
Begin DoDot:5
+33 SET ENNOTE=$PIECE($GET(^ENG(ENFILE,ENDA("F?"),5)),U,8)
+34 IF ENNOTE>0
WRITE !,?9,"Sold: $",$FNUMBER(ENNOTE,",",2)
End DoDot:5
+35 SET ENT("SGL")=ENT("SGL")+ENAMT
End DoDot:4
if END
QUIT
End DoDot:3
if END
QUIT
+36 if END
QUIT
+37 WRITE !,?12,"G/L Acct "_ENSGL_" Net Activity: "
+38 WRITE ?43,$JUSTIFY($FNUMBER(ENT("SGL"),",",2),16)
+39 WRITE !,?12,"Closing Balance for ",ENDTMC,":"
+40 WRITE ?43,$JUSTIFY("$"_$FNUMBER(+$PIECE(ENBAL,U,2),",",2),16)
End DoDot:2
if END
QUIT
End DoDot:1
if END
QUIT
+41 IF 'END
IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
+42 KILL ENDTMC,ENDTMO
+43 QUIT
HD ; page 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 !,"VOUCHER SUMMARY FOR STATION: ",ENSNR,?49,ENDTR,?72,"page ",ENPG
+6 WRITE !," FUND: ",ENFUND
if $GET(ENFUND("A"))]""
WRITE " ",ENFUND("A")
+7 WRITE ?32," ACCOUNTING PERIOD FROM ",$$FMTE^XLFDT(ENDTS,"2D")
+8 WRITE " TO ",$$FMTE^XLFDT(ENDTE,"2D")
+9 WRITE !!,?4,"TRANSACTION",?31,"EQUIP ID#",?43,"NET AMOUNT",?61,"EQUIP P.O.#"
+10 WRITE !,?4,"CODE NUMBER DATE"
+11 WRITE !,?4,"---- ----------- --------",?31,"----------"
+12 WRITE ?43,"----------------",?61,"------------"
+13 QUIT
HDSGL ; header for continued SGL
+1 WRITE !,?2,"SGL: ",ENSGL
if ENSGL("A")]""
WRITE " ",ENSGL("A")
WRITE " (continued)"
+2 QUIT
+3 ;ENFAR5B