VistA-WorldVistAEHR/r/NOIS-FSC/FSCRUDQ.m

84 lines
3.1 KiB
Mathematica

FSCRUDQ ;SLC/STAFF-NOIS Report Utility Dequeued ;6/16/95 14:35
;;1.1;NOIS;;Sep 06, 1998
;
DQPT ;
N CNT,HDR,LINE,OK,PAGE,TOTPAGE K HDR
D
.I $G(PAGEBRK) D PAGE Q
.D ALL
I $D(ZTQUEUED) D CLEANUP^FSCOPTU
Q
;
DQPS ;
N BG,CNT,LINE,LINECNT,LINES,OK,PAGE,TITLE,TOTPAGE
U IO I $D(ZTQUEUED) S ZTREQ="@"
S BG=$G(VALMBG,1),LINES=$G(VALM("LINES"),16),TITLE=$G(VALM("TITLE"),"NOIS")
S PAGE=(BG\LINES)+((BG#LINES)>0),LINECNT=+$P(@VALMAR,U,2),TOTPAGE=(LINECNT\LINES)+((LINECNT#LINES)>0)
S LINECNT=0 I IOST["C-" W @IOF
S LINECNT=LINECNT+1 W !,TITLE,?28,$$FMTE^XLFDT($$NOW^XLFDT)," Page: ",PAGE," of ",$J(TOTPAGE,6)
S LINE=0 F S LINE=$O(VALMHDR(LINE)) Q:LINE<1 S LINECNT=LINECNT+1 W !,VALMHDR(LINE)
S LINECNT=LINECNT+1 W !,VALMCAP
S LINECNT=LINECNT+1,LINE="",$P(LINE,"-",79)="" W !,LINE
S CNT=0,LINE=BG-1 F S LINE=$O(@VALMAR@(LINE)) Q:LINE<1 S CNT=CNT+1 Q:CNT>LINES S LINECNT=LINECNT+1 W !,$E(@VALMAR@(LINE,0),1,79)
I IOST["C-" D
.F S LINECNT=LINECNT+1 Q:LINECNT>25 W ! I $Y'<(IOSL-2) Q
.D PAUSE^FSCU(.OK)
I $D(ZTQUEUED) D CLEANUP^FSCOPTU
Q
;
DQ ;
D SETUP^FSCRPTS I $D(VALMQUIT) Q
N CNT,HDR,LINE,OK,PAGE,TOTPAGE K HDR
S LISTREF=VALMAR,LISTSEL="VVALUES" M FSCFMT=FSCSTYLE D ENTRY^FSCLMV,HEADER^FSCLMV
D
.I $G(PAGEBRK) D PAGE Q
.D ALL
I $D(ZTQUEUED) D CLEANUP^FSCOPTU
Q
;
ALL ;
D SETUP(+$P(@VALMAR,U,2),.HDR,.TOTPAGE)
U IO I $D(ZTQUEUED) S ZTREQ="@"
I '$O(@VALMAR@(0)) S (CNT,PAGE)=0 D HEADER(.PAGE,.HDR,.CNT,.OK) W !!,"No calls to view." Q
S OK=1,(CNT,PAGE,LINE)=0 F S LINE=$O(@VALMAR@(LINE)) Q:LINE<1 D I 'OK Q
.I CNT=0 D HEADER(.PAGE,.HDR,.CNT,.OK) I 'OK Q
.S CNT=CNT+1 W !,$E($G(@VALMAR@(LINE,0)),1,79)
.I $Y'<(IOSL-2) S CNT=0 I IOST["C-" D PAUSE^FSCU(.OK)
I CNT D
.F S CNT=CNT+1 Q:CNT>25 W ! I $Y'<(IOSL-2) Q
.I IOST["C-" D PAUSE^FSCU(.OK)
Q
;
PAGE ;
D SETUP(+$P(@VALMAR,U,2),.HDR,.TOTPAGE)
U IO I $D(ZTQUEUED) S ZTREQ="@"
I '$O(@VALMAR@(0)) S (CNT,PAGE)=0 D HEADER(.PAGE,.HDR,.CNT,.OK) W !!,"No calls to view." Q
N DIVIDER S DIVIDER="",$P(DIVIDER,"=",80)=""
S OK=1,(CNT,PAGE,LINE)=0 F S LINE=$O(@VALMAR@(LINE)) Q:LINE<1 D I 'OK Q
.I CNT=0 D HEADER(.PAGE,.HDR,.CNT,.OK) I 'OK Q
.S CNT=CNT+1 W !,$E($G(@VALMAR@(LINE,0)),1,79)
.I $G(@VALMAR@(LINE,0))=DIVIDER D Q
..F S CNT=CNT+1 Q:CNT>25 W ! I $Y'<(IOSL-2) Q
..S CNT=0 I IOST["C-" D PAUSE^FSCU(.OK)
.I $Y'<(IOSL-2) S CNT=0 I IOST["C-" D PAUSE^FSCU(.OK)
I CNT D
.F S CNT=CNT+1 Q:CNT>25 W ! I $Y'<(IOSL-2) Q
.I IOST["C-" D PAUSE^FSCU(.OK)
Q
;
SETUP(LINECNT,HDR,TOTPAGE) ;
N CNT,LINE K HDR
S CNT=1,LINE=0 F S LINE=$O(VALMHDR(LINE)) Q:LINE<1 S CNT=CNT+1,HDR(CNT)=VALMHDR(LINE)
I $L($G(VALMCAP)) S CNT=CNT+1,HDR(CNT)=VALMCAP
S CNT=CNT+1,HDR(CNT)="",$P(HDR(CNT),"-",79)=""
S TOTPAGE=(LINECNT\(IOSL-CNT-2))+((LINECNT#(IOSL-CNT-2))>0)
S HDR(1)=$$SETSTR^VALM1($$FMTE^XLFDT($$NOW^XLFDT)_" Page:@@@@@@"_$S('$G(PAGEBRK):" of "_$J(TOTPAGE,6),1:""),$G(VALM("TITLE"),"NOIS"),30,51)
Q
;
HEADER(PAGE,HDR,CNT,OK) ;
N LINE S OK=1,PAGE=PAGE+1
W:'(PAGE=1&(IOST'["C-")) @IOF W $$REPLACE^FSCRU(HDR(1),"@@@@@@",$J(PAGE,6))
S LINE=1 F S LINE=$O(HDR(LINE)) Q:LINE<1 S CNT=CNT+1 W !,HDR(LINE)
I $$S^%ZTLOAD S OK=0,ZTSTOP=1 W !!,"Report has been stopped.",!
Q