FSCRPXM ;SLC/STAFF-NOIS RPC Menus ;1/13/98 16:51
;;1.1;NOIS;;Sep 06, 1998
;
N CALL,CNT,INDEX,INLINE0,LINE,LIST,MAXMRE,MAXMRA,MAXMRU,NUM,TIME
S MAXMRE=10,MAXMRA=10,MAXMRU=12
S INLINE0=$G(^TMP("FSCRPC",$J,"INPUT",0))
I $P(INLINE,U,6)=0 S $P(OUTLINE,U,6)=$$ALERT(DUZ)
E S $P(OUTLINE,U,6)=1
S $P(OUTLINE,U,7)=$$MRE(DUZ)
S $P(OUTLINE,U,8)=$$MRA(DUZ)
S $P(OUTLINE,U,9)=$$MRU(DUZ)
K ^TMP("FSCRPC",$J,"MENUS")
;
I $P(OUTLINE,U,7)'=$P(INLINE0,U,7) D
.S CNT=0,TIME="" F S TIME=$O(^FSCD("MRE","AUTC",USER,TIME)) Q:TIME="" D Q:CNT=MAXMRE
..S CALL=0 F S CALL=$O(^FSCD("MRE","AUTC",USER,TIME,CALL)) Q:CALL="" D Q:CNT=MAXMRE
...S CNT=CNT+1
...S ^TMP("FSCRPC",$J,"MENUS","MRE",CNT)=CALL_U_$$CALLID(CALL)
;
I $P(OUTLINE,U,8)'=$P(INLINE0,U,8) D
.S CNT=0,TIME="" F S TIME=$O(^FSCD("MRA","AUTC",USER,TIME)) Q:TIME="" D Q:CNT=MAXMRA
..S CALL=0 F S CALL=$O(^FSCD("MRA","AUTC",USER,TIME,CALL)) Q:CALL="" D Q:CNT=MAXMRA
...S CNT=CNT+1
...S ^TMP("FSCRPC",$J,"MENUS","MRA",CNT)=CALL_U_$$CALLID(CALL)
;
I $P(OUTLINE,U,9)'=$P(INLINE0,U,9) D
.S CNT=0,TIME="" F S TIME=$O(^FSCD("MRU","AUTL",USER,TIME)) Q:TIME="" D Q:CNT=MAXMRU
..S LIST=0 F S LIST=$O(^FSCD("MRU","AUTL",USER,TIME,LIST)) Q:LIST="" D Q:CNT=MAXMRU
...S INDEX="" F S INDEX=$O(^FSCD("MRU","AUTL",USER,TIME,LIST,INDEX)) Q:INDEX="" D Q:CNT=MAXMRU
....S CNT=CNT+1
....S ^TMP("FSCRPC",$J,"MENUS","MRU",CNT)=LIST_U_INDEX_U_$P($G(^FSC("LIST",+LIST,0)),U)_$S(INDEX:" "_$$INDXVAL(LIST,INDEX),1:"")_U_$P($G(^FSC("LIST",+LIST,0)),U,8,9)
....I 'INDEX Q
....; append index external value
;
I '$L($O(^TMP("FSCRPC",$J,"MENUS",""))) Q
K ^TMP("FSCRPC",$J,"MENUS","TEMP")
M ^TMP("FSCRPC",$J,"MENUS","TEMP")=^TMP("FSCRPC",$J,"OUTPUT")
K ^TMP("FSCRPC",$J,"OUTPUT")
S CNT=0
;
I $O(^TMP("FSCRPC",$J,"MENUS","MRE",0)) D
.S CNT=CNT+1
.S ^TMP("FSCRPC",$J,"OUTPUT",CNT)="{MRE}"
.S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"MENUS","MRE",NUM)) Q:NUM<1 S LINE=^(NUM) D
..S CNT=CNT+1
..S ^TMP("FSCRPC",$J,"OUTPUT",CNT)=LINE
.S CNT=CNT+1
.S ^TMP("FSCRPC",$J,"OUTPUT",CNT)="^^^"
;
I $O(^TMP("FSCRPC",$J,"MENUS","MRA",0)) D
.S CNT=CNT+1
.S ^TMP("FSCRPC",$J,"OUTPUT",CNT)="{MRA}"
.S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"MENUS","MRA",NUM)) Q:NUM<1 S LINE=^(NUM) D
..S CNT=CNT+1
..S ^TMP("FSCRPC",$J,"OUTPUT",CNT)=LINE
.S CNT=CNT+1
.S ^TMP("FSCRPC",$J,"OUTPUT",CNT)="^^^"
;
I $O(^TMP("FSCRPC",$J,"MENUS","MRU",0)) D
.S CNT=CNT+1
.S ^TMP("FSCRPC",$J,"OUTPUT",CNT)="{MRU}"
.S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"MENUS","MRU",NUM)) Q:NUM<1 S LINE=^(NUM) D
..S CNT=CNT+1
..S ^TMP("FSCRPC",$J,"OUTPUT",CNT)=LINE
.S CNT=CNT+1
.S ^TMP("FSCRPC",$J,"OUTPUT",CNT)="^^^"
;
S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"MENUS","TEMP",NUM)) Q:NUM<1 S LINE=^(NUM) D
.S CNT=CNT+1
.S ^TMP("FSCRPC",$J,"OUTPUT",CNT)=LINE
S ^TMP("FSCRPC",$J,"OUTPUT")=CNT
K ^TMP("FSCRPC",$J,"MENUS")
Q
;
CALLID(CALL) ; $$(call) -> call text for menu
N CALLID
S CALLID=$P($G(^FSCD("CALL",+CALL,0)),U)_" "_$$MODINI^FSCUF($P(^(0),U,8))_U_$$REPLACE^FSCRU($$SHORT^FSCRPXUS(CALL,DUZ),U," ")
Q CALLID
;
ALERT(USER) ; $$(user) -> 1 or 0 if alerts available
I $D(^FSCD("ALERT","ALERT",USER)) Q 1
Q $$XQA(USER,"FSC-")
;
XQA(USER,TEXT) ; $$(user,text) -> 1 or 0 if alerts contains text in ID ** non documented access
N OK,TIME
I '$O(^XTV(8992,USER,"XQA",0)) Q 0
S (OK,TIME)=0 F S TIME=$O(^XTV(8992,USER,"XQA",TIME)) Q:TIME<1 I $P($G(^(TIME,0)),U,2)[TEXT S OK=1 Q
Q OK
;
MRE(USER) ; $$(user) -> timestamp of user's MRE list
Q +$P($G(^FSCD("MRE","AUT",+USER)),".",2)
;
MRA(USER) ; $$(user) -> timestamp of user's MRA list
Q +$P($G(^FSCD("MRA","AUT",+USER)),".",2)
;
MRU(USER) ; $$(user) -> timestamp of user's MRU lists
Q +$P($G(^FSCD("MRU","AUT",+USER)),".",2)
;
INDXVAL(LIST,INDEX) ; $$(list, index) -> external value of index
N FIELD,OFFSET,TYPE
S FIELD=+$P($G(^FSC("LIST",+LIST,0)),U,5)
I 'FIELD Q ""
S TYPE=+$P($P($G(^FSC("FLD",FIELD,0)),U,3),"P",2),OFFSET=$P($G(^(0)),U,6)
I TYPE=7105.2 S TYPE=200
I TYPE Q $$POINTER^FSCDD(INDEX,TYPE,OFFSET)
Q ""
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCRPXM 4164 printed Dec 13, 2024@02:20:04 Page 2
FSCRPXM ;SLC/STAFF-NOIS RPC Menus ;1/13/98 16:51
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
+1 NEW CALL,CNT,INDEX,INLINE0,LINE,LIST,MAXMRE,MAXMRA,MAXMRU,NUM,TIME
+2 SET MAXMRE=10
SET MAXMRA=10
SET MAXMRU=12
+3 SET INLINE0=$GET(^TMP("FSCRPC",$JOB,"INPUT",0))
+4 IF $PIECE(INLINE,U,6)=0
SET $PIECE(OUTLINE,U,6)=$$ALERT(DUZ)
+5 IF '$TEST
SET $PIECE(OUTLINE,U,6)=1
+6 SET $PIECE(OUTLINE,U,7)=$$MRE(DUZ)
+7 SET $PIECE(OUTLINE,U,8)=$$MRA(DUZ)
+8 SET $PIECE(OUTLINE,U,9)=$$MRU(DUZ)
+9 KILL ^TMP("FSCRPC",$JOB,"MENUS")
+10 ;
+11 IF $PIECE(OUTLINE,U,7)'=$PIECE(INLINE0,U,7)
Begin DoDot:1
+12 SET CNT=0
SET TIME=""
FOR
SET TIME=$ORDER(^FSCD("MRE","AUTC",USER,TIME))
if TIME=""
QUIT
Begin DoDot:2
+13 SET CALL=0
FOR
SET CALL=$ORDER(^FSCD("MRE","AUTC",USER,TIME,CALL))
if CALL=""
QUIT
Begin DoDot:3
+14 SET CNT=CNT+1
+15 SET ^TMP("FSCRPC",$JOB,"MENUS","MRE",CNT)=CALL_U_$$CALLID(CALL)
End DoDot:3
if CNT=MAXMRE
QUIT
End DoDot:2
if CNT=MAXMRE
QUIT
End DoDot:1
+16 ;
+17 IF $PIECE(OUTLINE,U,8)'=$PIECE(INLINE0,U,8)
Begin DoDot:1
+18 SET CNT=0
SET TIME=""
FOR
SET TIME=$ORDER(^FSCD("MRA","AUTC",USER,TIME))
if TIME=""
QUIT
Begin DoDot:2
+19 SET CALL=0
FOR
SET CALL=$ORDER(^FSCD("MRA","AUTC",USER,TIME,CALL))
if CALL=""
QUIT
Begin DoDot:3
+20 SET CNT=CNT+1
+21 SET ^TMP("FSCRPC",$JOB,"MENUS","MRA",CNT)=CALL_U_$$CALLID(CALL)
End DoDot:3
if CNT=MAXMRA
QUIT
End DoDot:2
if CNT=MAXMRA
QUIT
End DoDot:1
+22 ;
+23 IF $PIECE(OUTLINE,U,9)'=$PIECE(INLINE0,U,9)
Begin DoDot:1
+24 SET CNT=0
SET TIME=""
FOR
SET TIME=$ORDER(^FSCD("MRU","AUTL",USER,TIME))
if TIME=""
QUIT
Begin DoDot:2
+25 SET LIST=0
FOR
SET LIST=$ORDER(^FSCD("MRU","AUTL",USER,TIME,LIST))
if LIST=""
QUIT
Begin DoDot:3
+26 SET INDEX=""
FOR
SET INDEX=$ORDER(^FSCD("MRU","AUTL",USER,TIME,LIST,INDEX))
if INDEX=""
QUIT
Begin DoDot:4
+27 SET CNT=CNT+1
+28 SET ^TMP("FSCRPC",$JOB,"MENUS","MRU",CNT)=LIST_U_INDEX_U_$PIECE($GET(^FSC("LIST",+LIST,0)),U)_$SELECT(INDEX:" "_$$INDXVAL(LIST,INDEX),1:"")_U_$PIECE($GET(^FSC("LIST",+LIST,0)),U,8,9)
+29 IF 'INDEX
QUIT
+30 ; append index external value
End DoDot:4
if CNT=MAXMRU
QUIT
End DoDot:3
if CNT=MAXMRU
QUIT
End DoDot:2
if CNT=MAXMRU
QUIT
End DoDot:1
+31 ;
+32 IF '$LENGTH($ORDER(^TMP("FSCRPC",$JOB,"MENUS","")))
QUIT
+33 KILL ^TMP("FSCRPC",$JOB,"MENUS","TEMP")
+34 MERGE ^TMP("FSCRPC",$JOB,"MENUS","TEMP")=^TMP("FSCRPC",$JOB,"OUTPUT")
+35 KILL ^TMP("FSCRPC",$JOB,"OUTPUT")
+36 SET CNT=0
+37 ;
+38 IF $ORDER(^TMP("FSCRPC",$JOB,"MENUS","MRE",0))
Begin DoDot:1
+39 SET CNT=CNT+1
+40 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)="{MRE}"
+41 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"MENUS","MRE",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
Begin DoDot:2
+42 SET CNT=CNT+1
+43 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)=LINE
End DoDot:2
+44 SET CNT=CNT+1
+45 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)="^^^"
End DoDot:1
+46 ;
+47 IF $ORDER(^TMP("FSCRPC",$JOB,"MENUS","MRA",0))
Begin DoDot:1
+48 SET CNT=CNT+1
+49 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)="{MRA}"
+50 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"MENUS","MRA",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
Begin DoDot:2
+51 SET CNT=CNT+1
+52 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)=LINE
End DoDot:2
+53 SET CNT=CNT+1
+54 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)="^^^"
End DoDot:1
+55 ;
+56 IF $ORDER(^TMP("FSCRPC",$JOB,"MENUS","MRU",0))
Begin DoDot:1
+57 SET CNT=CNT+1
+58 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)="{MRU}"
+59 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"MENUS","MRU",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
Begin DoDot:2
+60 SET CNT=CNT+1
+61 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)=LINE
End DoDot:2
+62 SET CNT=CNT+1
+63 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)="^^^"
End DoDot:1
+64 ;
+65 SET NUM=0
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"MENUS","TEMP",NUM))
if NUM<1
QUIT
SET LINE=^(NUM)
Begin DoDot:1
+66 SET CNT=CNT+1
+67 SET ^TMP("FSCRPC",$JOB,"OUTPUT",CNT)=LINE
End DoDot:1
+68 SET ^TMP("FSCRPC",$JOB,"OUTPUT")=CNT
+69 KILL ^TMP("FSCRPC",$JOB,"MENUS")
+70 QUIT
+71 ;
CALLID(CALL) ; $$(call) -> call text for menu
+1 NEW CALLID
+2 SET CALLID=$PIECE($GET(^FSCD("CALL",+CALL,0)),U)_" "_$$MODINI^FSCUF($PIECE(^(0),U,8))_U_$$REPLACE^FSCRU($$SHORT^FSCRPXUS(CALL,DUZ),U," ")
+3 QUIT CALLID
+4 ;
ALERT(USER) ; $$(user) -> 1 or 0 if alerts available
+1 IF $DATA(^FSCD("ALERT","ALERT",USER))
QUIT 1
+2 QUIT $$XQA(USER,"FSC-")
+3 ;
XQA(USER,TEXT) ; $$(user,text) -> 1 or 0 if alerts contains text in ID ** non documented access
+1 NEW OK,TIME
+2 IF '$ORDER(^XTV(8992,USER,"XQA",0))
QUIT 0
+3 SET (OK,TIME)=0
FOR
SET TIME=$ORDER(^XTV(8992,USER,"XQA",TIME))
if TIME<1
QUIT
IF $PIECE($GET(^(TIME,0)),U,2)[TEXT
SET OK=1
QUIT
+4 QUIT OK
+5 ;
MRE(USER) ; $$(user) -> timestamp of user's MRE list
+1 QUIT +$PIECE($GET(^FSCD("MRE","AUT",+USER)),".",2)
+2 ;
MRA(USER) ; $$(user) -> timestamp of user's MRA list
+1 QUIT +$PIECE($GET(^FSCD("MRA","AUT",+USER)),".",2)
+2 ;
MRU(USER) ; $$(user) -> timestamp of user's MRU lists
+1 QUIT +$PIECE($GET(^FSCD("MRU","AUT",+USER)),".",2)
+2 ;
INDXVAL(LIST,INDEX) ; $$(list, index) -> external value of index
+1 NEW FIELD,OFFSET,TYPE
+2 SET FIELD=+$PIECE($GET(^FSC("LIST",+LIST,0)),U,5)
+3 IF 'FIELD
QUIT ""
+4 SET TYPE=+$PIECE($PIECE($GET(^FSC("FLD",FIELD,0)),U,3),"P",2)
SET OFFSET=$PIECE($GET(^(0)),U,6)
+5 IF TYPE=7105.2
SET TYPE=200
+6 IF TYPE
QUIT $$POINTER^FSCDD(INDEX,TYPE,OFFSET)
+7 QUIT ""