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

86 lines
3.5 KiB
Mathematica

FSCLML ;SLC/STAFF-NOIS List Manager - List ;1/13/98 12:36
;;1.1;NOIS;;Sep 06, 1998
;
ENTRY ; from list template - entry code, FSCLMPC, FSCLMPNF, FSCLMPQQ, FSCLMPQU, FSCRPTS
N CALL,DATEO,LIMIT,LIMITOK,LISTCALL,LNUM,SOURCE,TIME
K ^TMP("FSC LIST CALLS",$J)
S FSCLIMIT=$S($G(FSCLIMIT):FSCLIMIT,1:"1^"_$$MAXCALL^FSCUP)
S (LIMIT,LNUM,VALMCNT)=0,FSCUD=$$USERDEF^FSCU(DUZ),VALMCAP=$$CAP^FSCU("L")
I '$G(FSCDEV) W !
I '$G(FSCQUERY) D
.I $E(FSCLNAME,1,4)="MRE:" D Q
..S TIME="" F S TIME=$O(^FSCD("MRE","AUTC",FSCINDX,TIME)) Q:TIME="" D Q:LIMIT
...S CALL=0 F S CALL=$O(^FSCD("MRE","AUTC",FSCINDX,TIME,CALL)) Q:CALL<1 D SETUP Q:LIMIT
.I $E(FSCLNAME,1,4)="MRA:" D Q
..S TIME="" F S TIME=$O(^FSCD("MRA","AUTC",FSCINDX,TIME)) Q:TIME="" D Q:LIMIT
...S CALL=0 F S CALL=$O(^FSCD("MRA","AUTC",FSCINDX,TIME,CALL)) Q:CALL<1 D SETUP Q:LIMIT
.I $L($P(FSCL0,U,4)) D Q
..S SOURCE="^FSCD(""CALL"","_$P(FSCL0,U,4)_$S($G(FSCINDX):","_FSCINDX,1:"")_")"
..S CALL="A" F S CALL=$O(@SOURCE@(CALL),-1) Q:CALL<1 D SETUP Q:LIMIT I (VALMCNT#10)=0 D CHECK(.VALMQUIT) I $D(VALMQUIT) Q
.I $P(FSCL0,U,3)="M" D Q
..D MANUAL^FSCLP(FSCLNUM)
..S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D SETUP Q:LIMIT I (VALMCNT#10)=0 D CHECK(.VALMQUIT) I $D(VALMQUIT) Q
.S LISTCALL="A" F S LISTCALL=$O(^FSCD("LISTS","L",FSCLNUM,LISTCALL),-1) Q:LISTCALL<1 D Q:LIMIT I (VALMCNT#10)=0 D CHECK(.VALMQUIT) I $D(VALMQUIT) Q
..S CALL=+$G(^FSCD("LISTS",LISTCALL,0)) D SETUP
I $G(FSCQUERY) S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D SETUP Q:LIMIT I (VALMCNT#10)=0 D CHECK(.VALMQUIT) I $D(VALMQUIT) Q
I $D(VALMQUIT) S FSCQUERY=0 Q
I $G(FSCLIMIT),FSCLNAME'["(MODIFIED)",LNUM=$P(FSCLIMIT,U,2)!$P(FSCLIMIT,U,3) S FSCLNAME=FSCLNAME_" (MODIFIED)"
S ^TMP("FSC LIST CALLS",$J)=LNUM_U_VALMCNT
D EMPTY^FSCLMPQU
S FSCQUERY=0
Q
;
SETUP ; from FSCUS
I $G(FSCLIMIT) S LIMITOK=1 D Q:'LIMITOK
.I $P(FSCLIMIT,U,2) D Q
..I LNUM'<$P(FSCLIMIT,U,2) S LIMIT=1,LIMITOK=0 W !,"List is restricted to ",$P(FSCLIMIT,U,2)," entries.",$C(7) H 2
.S DATEO=$P(^FSCD("CALL",CALL,0),U,3)
.I DATEO<$P(FSCLIMIT,U,3) S LIMITOK=0 Q
.I DATEO>$P(FSCLIMIT,U,4) S LIMITOK=0 Q
S LNUM=LNUM+1,VALMCNT=VALMCNT+1
S ^TMP("FSC LIST CALLS",$J,VALMCNT,0)=$$SHORT^FSCGETS(CALL,LNUM)
S ^TMP("FSC LIST CALLS",$J,"IDX",LNUM,VALMCNT)=""
S ^TMP("FSC LIST CALLS",$J,"CX",CALL)=""
S ^TMP("FSC LIST CALLS",$J,"ICX",VALMCNT,CALL)=""
I $D(^TMP("FSC LIST CLEANUP",$J,CALL)) D
.S VALMCNT=VALMCNT+1
.S ^TMP("FSC LIST CALLS",$J,VALMCNT,0)=" "_^TMP("FSC LIST CLEANUP",$J,CALL)
Q
;
CHECK(VALMQUIT) ; from FSCLMPQA, FSCLMPQR, FSCLMPQS, FSCUS
I $G(FSCDEV) Q
I 'VALMCNT Q
N X
W "." K VALMQUIT
R X:0 I $T,X=U D
.N DIR,X,Y K DIR
.S DIR(0)="YAO",DIR("A")="Do you want to stop this action? ",DIR("B")="NO"
.S DIR("?",1)="Enter YES to stop processing this action."
.S DIR("?",2)="NOTE: stopping this process will not preserve your previous screen."
.S DIR("?",3)="Enter NO or '^' to continue processing."
.S DIR("?")="^D HELP^FSCU(.DIR)"
.S DIR("??")="FSC U 1 NOIS"
.D ^DIR K DIR
.I Y=1 S VALMQUIT=1
Q
;
HEADER ; from list template - header code, FSCLMPC, FSCLMPNF, FSCLMPQU
S VALMHDR(1)=$$SETSTR^VALM1("# of calls: "_+^TMP("FSC LIST CALLS",$J),"List: "_FSCLNAME,62,18)
Q
;
EXIT ; from list template - exit code
D CLEAR^VALM1
K ^TMP("FSC LIST",$J)
K ^TMP("FSC LIST CALLS",$J)
K ^TMP("FSC SELECT",$J)
K ^TMP("FSC STATS",$J)
Q
;
HELP ; from list template - help code
I $G(X)'["?" Q
S VALMBCK="R"
N XQH
I X="?" S XQH="FSC MENU LIST" D EN^XQH Q
I X="???" S VALMANS="?" D CLEAR^VALM1 S XQH="FSC U1 NOIS" D EN^XQH Q
Q