VistA-WorldVistAEHR/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHRCV.m

73 lines
2.6 KiB
Mathematica

PRCHRCV ;DJM/WISC-IFCAP BAR DISPLAY ROUTINE ;7/25/94 3:33 PM
V ;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
SETUP(COUNT) ;ENTER HERE TO SET UP THE BAR GRAPH DISPLAY.
;YOUR ROUTINE USING THIS BAR GRAPH MUST NOT WRITE ANYTHING TO THE SCREEN.
;
; 'COUNT' IS THE NUMBER OF ENTRIES BEING PROCESSED.
; THIS NUMBER WILL BECOME 100% ON THE BAR GRAPH.
;
I $Y>2 W @IOF
I COUNT="" W !!,"THERE IS NO 'COUNT' TO WORK WITH. I QUIT." Q
S TREC=COUNT
I $E(IOST)="C",'$D(ZTQUEUED) S X="IORVON;IORVOFF" D ENDR^%ZISS
I $D(IORVON),$D(IORVOFF) S CURSOR=IORVON_" "_IORVOFF
D WAIT^PRCFYN
S CREC=$S($E(IOST)="C":1.24,1:4.99)
S X="There are "_TREC_" records to process." D MSG^PRCFQ
S LINE="---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+"
I TREC>80,$E(IOST)="C" W !!,?25,"P E R C E N T C O M P L E T E",!!," 10 20 30 40 50 60 70 80 90 100",!,LINE,!
S (MX,NX)=0,(XPOS,XCOUNT)=0
S:$Y>22 Y=22 S A=$Y,N=0,M=0,BTIME=$P($H,",",2)
Q
;
UPDATE(INIT) ;ENTER HERE AFTER EACH RECORD IS PROCESSED.
; INIT=CURRENT NUMBER OF RECORDS PROCESSED.
; INIT DOES NOT NEED TO BE ENTERED.
; ENTERING INIT WILL PRESET THE BAR GRAPH TO WHATEVER PERCENT
; XCOUNT IS OF COUNT.
;
;IF ENOUGH RECORDS HAVE BEEN COMPLETED THE BAR GRAPH WILL BE UPDATED.
S TEST=INIT
S XCOUNT=$S(INIT>0:INIT,1:XCOUNT)
S XCOUNT=XCOUNT+1 D:'$D(ZTQUEUED) PERCENT
I PERCENT=100 S DX=0,DY=A+4 I $E(IOST)="C" X IOXY
QUIT
END K FY,BFY,EFY,CFY,AFY,NX,MX,ZERONODE,FLAG,X,Y,TREC,CREC,LREC,XPOS,DX,CY,MOP,ARCBIT,DIC,DLAYGO,A,N,M,PERCENT
QUIT
;
PERCENT ;
S PERCENT=XCOUNT/TREC*100\1
F Q:PERCENT'>CREC I PERCENT>CREC D
. W:$E(IOST)="C" CURSOR S XPOS=XPOS+1
. DO
. . W !,XCOUNT," of ",TREC," processed. ",$J((PERCENT/1),0,0),"% complete "
. . S TIME=$P($H,",",2)
. . S:BTIME>TIME TIME=TIME+86400
. . S TIME=TIME-BTIME D TIME(TIME)
. . W:$E(IOST)="C" !
. . W:HOURS HOURS," Hours, "
. . W MIN," Minutes, ",SEC," Seconds elapsed. "
. . I PERCENT<50 D QUIT
. . . S DX=XPOS,DY=A
. . . I $E(IOST)="C" X IOXY
. . . QUIT
. . S TTIME=TIME/(PERCENT*.01),RTIME=TTIME-TIME
. . S RTIME=$P(RTIME,".")
. . S HOURS=0,MIN=0
. . I RTIME>3600 S HOURS=RTIME\3600,RTIME=RTIME#3600
. . S MIN=RTIME\60,SEC=RTIME#60
. . W:$E(IOST)="C" ! W:HOURS HOURS," Hours, "
. . W MIN," Minutes, ",SEC," Seconds, remaining. "
. . S DX=XPOS,DY=A
. . I $E(IOST)="C" X IOXY
. . QUIT
. S CREC=CREC+$S($E(IOST)="C":1.25,1:5)
. QUIT
QUIT
TIME(X) ;
S HOURS=0,MIN=0,SEC=0
I X>3600 S HOURS=X\3600,X=X#3600
S MIN=X\60,SEC=X#60
Q