BNIGVLU ; IHS/CMI/LAB - GEN RETR UTILITIES ;
;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
;
RZERO(V,L) ;ep right zero fill
NEW %,I
S %=$L(V),Z=L-% F I=1:1:Z S V=V_"0"
Q V
LZERO(V,L) ;left zero fill
NEW %,I
S %=$L(V),Z=L-% F I=1:1:Z S V="0"_V
Q V
LBLK(V,L) ;left blank fill
NEW %,I
S %=$L(V),Z=L-% F I=1:1:Z S V=" "_V
Q V
XTMP(N,D) ;EP - set xtmp 0 node
Q:$G(N)=""
S ^XTMP(N,0)=$$FMADD^XLFDT(DT,14)_"^"_DT_"^"_$G(D)
Q
PROC ;EP
NEW BNIGZ,BNIGY,BNIGP
S BNIGZ=0 F S BNIGZ=$O(^BNIREC("C",DFN,BNIGZ)) Q:BNIGZ="" D
.S BNIGY=$P(^BNIREC(BNIGZ,0),U,12)
.Q:BNIGY<BNIGBD
.Q:BNIGY>BNIGED
.Q:$P(^BNIREC(BNIGZ,0),U,4)=""
.S X($P(^BNIREC(BNIGZ,0),U,4))=""
.Q
K BNIGZ,BNIGY,BNIGP
Q
CALC ;ENTRY POINT
I Y=0!(X=0) S Z="**" G COMMA
S Z=(((X/Y)-1)*100),Z=$FN(Z,"+,",1)
COMMA ;
S X=$FN(X,",")
;S X2=0,X3=$S($L(X)>3:($L(X)+($L(X)\3)),1:$L(X)) D COMMA^%DTC S X=$E(X,1,($L(X)-1))
Q
DONE ;ENTRY POINT - END OF REPORT TIME DISPLAY
I $D(BNIGET) S BNIGTS=(86400*($P(BNIGET,",")-$P(BNIGBT,",")))+($P(BNIGET,",",2)-$P(BNIGBT,",",2)),BNIGH=$P(BNIGTS/3600,".") S:BNIGH="" BNIGH=0 D
.S BNIGTS=BNIGTS-(BNIGH*3600),BNIGM=$P(BNIGTS/60,".") S:BNIGM="" BNIGM=0 S BNIGTS=BNIGTS-(BNIGM*60),BNIGS=BNIGTS W !!,"RUN TIME (H.M.S): ",BNIGH,".",BNIGM,".",BNIGS
I $E(IOST)="C",IO=IO(0) S DIR(0)="EO",DIR("A")="End of report. HIT RETURN" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
W:$D(IOF) @IOF
K BNIGTS,BNIGS,BNIGH,BNIGM,BNIGET
Q
BNIGVLU ; IHS/CMI/LAB - GEN RETR UTILITIES ;
+1 ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
+2 ;
RZERO(V,L) ;ep right zero fill
+1 NEW %,I
+2 SET %=$LENGTH(V)
SET Z=L-%
FOR I=1:1:Z
SET V=V_"0"
+3 QUIT V
LZERO(V,L) ;left zero fill
+1 NEW %,I
+2 SET %=$LENGTH(V)
SET Z=L-%
FOR I=1:1:Z
SET V="0"_V
+3 QUIT V
LBLK(V,L) ;left blank fill
+1 NEW %,I
+2 SET %=$LENGTH(V)
SET Z=L-%
FOR I=1:1:Z
SET V=" "_V
+3 QUIT V
XTMP(N,D) ;EP - set xtmp 0 node
+1 IF $GET(N)=""
QUIT
+2 SET ^XTMP(N,0)=$$FMADD^XLFDT(DT,14)_"^"_DT_"^"_$GET(D)
+3 QUIT
PROC ;EP
+1 NEW BNIGZ,BNIGY,BNIGP
+2 SET BNIGZ=0
FOR
SET BNIGZ=$ORDER(^BNIREC("C",DFN,BNIGZ))
IF BNIGZ=""
QUIT
Begin DoDot:1
+3 SET BNIGY=$PIECE(^BNIREC(BNIGZ,0),U,12)
+4 IF BNIGY<BNIGBD
QUIT
+5 IF BNIGY>BNIGED
QUIT
+6 IF $PIECE(^BNIREC(BNIGZ,0),U,4)=""
QUIT
+7 SET X($PIECE(^BNIREC(BNIGZ,0),U,4))=""
+8 QUIT
End DoDot:1
+9 KILL BNIGZ,BNIGY,BNIGP
+10 QUIT
CALC ;ENTRY POINT
+1 IF Y=0!(X=0)
SET Z="**"
GOTO COMMA
+2 SET Z=(((X/Y)-1)*100)
SET Z=$FNUMBER(Z,"+,",1)
COMMA ;
+1 SET X=$FNUMBER(X,",")
+2 ;S X2=0,X3=$S($L(X)>3:($L(X)+($L(X)\3)),1:$L(X)) D COMMA^%DTC S X=$E(X,1,($L(X)-1))
+3 QUIT
DONE ;ENTRY POINT - END OF REPORT TIME DISPLAY
+1 IF $DATA(BNIGET)
SET BNIGTS=(86400*($PIECE(BNIGET,",")-$PIECE(BNIGBT,",")))+($PIECE(BNIGET,",",2)-$PIECE(BNIGBT,",",2))
SET BNIGH=$PIECE(BNIGTS/3600,".")
IF BNIGH=""
SET BNIGH=0
Begin DoDot:1
+2 SET BNIGTS=BNIGTS-(BNIGH*3600)
SET BNIGM=$PIECE(BNIGTS/60,".")
IF BNIGM=""
SET BNIGM=0
SET BNIGTS=BNIGTS-(BNIGM*60)
SET BNIGS=BNIGTS
WRITE !!,"RUN TIME (H.M.S): ",BNIGH,".",BNIGM,".",BNIGS
End DoDot:1
+3 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
SET DIR(0)="EO"
SET DIR("A")="End of report. HIT RETURN"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+4 IF $DATA(IOF)
WRITE @IOF
+5 KILL BNIGTS,BNIGS,BNIGH,BNIGM,BNIGET
+6 QUIT