ORWTPR ; SLC/STAFF Personal Preference - Reminders ; 4/20/07 10:00am
;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,173,215,243**;Oct 24, 2000;Build 242
;
GETREM(VALUES,USER) ; from ORWTPP
; get user's reminders
N CLASS,CNT,ERR,IEN,NUM,OK,TMPLIST,ZERO K VALUES
D GETLST^XPAR(.TMPLIST,"USR.`"_USER,"ORQQPX SEARCH ITEMS","Q",.ERR)
S CNT=0,IEN=0 F S IEN=$O(^PXD(811.9,IEN)) Q:IEN<1 S ZERO=$G(^(IEN,0)) I $L($P(ZERO,U,3)),'$P(ZERO,U,6) D
.S CNT=CNT+1
.S VALUES(CNT)=IEN_"^0^"_$P(ZERO,U,3)_U_$P(ZERO,U)
.S CLASS=$P($G(^PXD(811.9,IEN,100)),U)
.S $P(VALUES(CNT),U,5)=$S(CLASS="N":"NATIONAL",CLASS="L":"LOCAL",1:CLASS)
.S OK=0,NUM=0 F S NUM=$O(TMPLIST(NUM)) Q:NUM<1 D Q:OK
..I IEN=$P(TMPLIST(NUM),U,2) S OK=1
.I OK S $P(VALUES(CNT),U,2)=$P(TMPLIST(NUM),U)
Q
;
SETREM(OK,VALUES,USER) ; from ORWTPP
; save user's reminders
N NUM,ERR
S OK=1
D NDEL^XPAR("USR.`"_USER,"ORQQPX SEARCH ITEMS",.ERR)
S NUM=0 F S NUM=$O(VALUES(NUM)) Q:NUM<1 D
.D EN^XPAR(USER_";VA(200,","ORQQPX SEARCH ITEMS",$P(VALUES(NUM),U,1),"`"_$P(VALUES(NUM),U,2),.ERR)
Q
;
GETOC(VALUES,USER) ; from ORWTPP
; get user's order checks
N CNT,IEN,LIST,NUM,VAL,VALOK K LIST,VALUES
S IEN=0 F S IEN=$O(^ORD(100.8,IEN)) Q:IEN<1 D
.S VAL=$$GET^XPAR("ALL","ORK PROCESSING FLAG",IEN,"I")
.I '$L(VAL) Q
.S VALOK=$$GET^XPAR("ALL","ORK EDITABLE BY USER",IEN,"I")
.S LIST(IEN)=VAL_U_VALOK
S NUM=0,CNT=0 F S NUM=$O(LIST(NUM)) Q:NUM<1 D
.S CNT=CNT+1
.S VALUES(CNT)=NUM_U_$P($G(^ORD(100.8,NUM,0)),U)_U_$S($P(LIST(NUM),U)="E":"ON",1:"OFF")_U_$S($P(LIST(NUM),U,2)="0":"MANDATORY",1:"")
Q
;
SAVEOC(OK,VALUES,USER) ; from ORWTPP
; save user's order checks
N NUM,ERR
S OK=1
S NUM=0 F S NUM=$O(VALUES(NUM)) Q:NUM<1 D
.D EN^XPAR(USER_";VA(200,","ORK PROCESSING FLAG","`"_+VALUES(NUM),$S($P(VALUES(NUM),U,2)="ON":"E",1:"D"),.ERR)
Q
;
;
GETNOT(VALUES,USER) ; from ORWTPP
; get user's notifications
N CNT,IEN,NAME,RESULT K VALUES
S CNT=0
S NAME="" F S NAME=$O(^ORD(100.9,"B",NAME)) Q:NAME="" D
.S IEN=0 F S IEN=$O(^ORD(100.9,"B",NAME,IEN)) Q:IEN<1 D
..S RESULT=$$ONOFF^ORB3USER(IEN,USER,"","") I $L($G(RESULT)) D
...S CNT=CNT+1
...S VALUES(CNT)=IEN_U_NAME_U_$P(RESULT,U)_U_$S($$UP^XLFSTR($P(RESULT,U,3))["MANDATORY":"MANDATORY",1:"")
Q
;
SAVENOT(OK,VALUES,USER) ; from ORWTPP
; save user's notifications
N ERR,NUM
S OK=1
S NUM=0 F S NUM=$O(VALUES(NUM)) Q:NUM<1 D
.D EN^XPAR(USER_";VA(200,","ORB PROCESSING FLAG","`"_+VALUES(NUM),$S($P(VALUES(NUM),U,2)="ON":"E",1:"D"),.ERR)
Q
;
CLEARNOT(OK,USER) ; from ORWTPP
; clear user's notifications
D RECIPURG^XQALBUTL(USER)
S OK=1
Q
;
GETNOTO(INFO,USER) ; from ORWTPP
; get user's other info for notifications
I $$GET^XPAR("USR.`"_USER,"ORB FLAGGED ORDERS BULLETIN",1,"Q")="Y" S $P(INFO,U,2)=1
I $$GET^XPAR("ALL^USR.`"_USER,"ORB ERASE ALL",1,"Q") S $P(INFO,U,3)=1
Q
;
GETSURR(INFO,USER) ; from ORWTPP
; get user's surrogate info
N SURR
D SUROLIST^XQALSURO(USER,.SURR)
S INFO=$G(SURR(1))
Q
;
SAVESURR(OK,INFO,USER) ; from ORWTPP
; save user's surrogate info
N START,STOP,SURR,RET
S OK=1
S SURR=$P(INFO,U,1)
S START=$P(INFO,U,2)
S STOP=$P(INFO,U,3)
S RET=$$SAVESURR^ORWTPUA(USER,SURR,START,STOP)
I 'RET S OK="0^"_RET
Q
;
SAVENOTO(OK,INFO,USER) ; from ORWTPP
; save user's notification settings
N ERR,FLAG,VAL
S OK=1
S FLAG=$P(INFO,U,3)
S VAL=$S(FLAG>0:"Y",1:"@")
D EN^XPAR(USER_";VA(200,","ORB FLAGGED ORDERS BULLETIN",1,VAL,.ERR)
Q
;
OCDESC(TEXT,IEN) ; from RPC
N CNT,LINE,NUM K TEXT
S IEN=+$G(IEN) I IEN<1 Q
S TEXT(1)=$P($G(^ORD(100.8,IEN,0)),U)
S TEXT(2)=""
S CNT=2
S NUM=0 F S NUM=$O(^ORD(100.8,IEN,1,NUM)) Q:NUM<1 S LINE=$G(^(NUM,0)) D
.S CNT=CNT+1
.S TEXT(CNT)=LINE
S TEXT(CNT+1)=""
Q
;
NOTDESC(TEXT,IEN) ; from RPC
K TEXT
S IEN=+$G(IEN) I IEN<1 Q
S TEXT(1)=$P($G(^ORD(100.9,IEN,0)),U)
S TEXT(2)=""
S TEXT(3)=$P($G(^ORD(100.9,IEN,4)),U)
S TEXT(4)=""
Q
ORWTPR ; SLC/STAFF Personal Preference - Reminders ; 4/20/07 10:00am
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,173,215,243**;Oct 24, 2000;Build 242
+2 ;
GETREM(VALUES,USER) ; from ORWTPP
+1 ; get user's reminders
+2 NEW CLASS,CNT,ERR,IEN,NUM,OK,TMPLIST,ZERO
KILL VALUES
+3 DO GETLST^XPAR(.TMPLIST,"USR.`"_USER,"ORQQPX SEARCH ITEMS","Q",.ERR)
+4 SET CNT=0
SET IEN=0
FOR
SET IEN=$ORDER(^PXD(811.9,IEN))
IF IEN<1
QUIT
SET ZERO=$GET(^(IEN,0))
IF $LENGTH($PIECE(ZERO,U,3))
IF '$PIECE(ZERO,U,6)
Begin DoDot:1
+5 SET CNT=CNT+1
+6 SET VALUES(CNT)=IEN_"^0^"_$PIECE(ZERO,U,3)_U_$PIECE(ZERO,U)
+7 SET CLASS=$PIECE($GET(^PXD(811.9,IEN,100)),U)
+8 SET $PIECE(VALUES(CNT),U,5)=$SELECT(CLASS="N":"NATIONAL",CLASS="L":"LOCAL",1:CLASS)
+9 SET OK=0
SET NUM=0
FOR
SET NUM=$ORDER(TMPLIST(NUM))
IF NUM<1
QUIT
Begin DoDot:2
+10 IF IEN=$PIECE(TMPLIST(NUM),U,2)
SET OK=1
End DoDot:2
IF OK
QUIT
+11 IF OK
SET $PIECE(VALUES(CNT),U,2)=$PIECE(TMPLIST(NUM),U)
End DoDot:1
+12 QUIT
+13 ;
SETREM(OK,VALUES,USER) ; from ORWTPP
+1 ; save user's reminders
+2 NEW NUM,ERR
+3 SET OK=1
+4 DO NDEL^XPAR("USR.`"_USER,"ORQQPX SEARCH ITEMS",.ERR)
+5 SET NUM=0
FOR
SET NUM=$ORDER(VALUES(NUM))
IF NUM<1
QUIT
Begin DoDot:1
+6 DO EN^XPAR(USER_";VA(200,","ORQQPX SEARCH ITEMS",$PIECE(VALUES(NUM),U,1),"`"_$PIECE(VALUES(NUM),U,2),.ERR)
End DoDot:1
+7 QUIT
+8 ;
GETOC(VALUES,USER) ; from ORWTPP
+1 ; get user's order checks
+2 NEW CNT,IEN,LIST,NUM,VAL,VALOK
KILL LIST,VALUES
+3 SET IEN=0
FOR
SET IEN=$ORDER(^ORD(100.8,IEN))
IF IEN<1
QUIT
Begin DoDot:1
+4 SET VAL=$$GET^XPAR("ALL","ORK PROCESSING FLAG",IEN,"I")
+5 IF '$LENGTH(VAL)
QUIT
+6 SET VALOK=$$GET^XPAR("ALL","ORK EDITABLE BY USER",IEN,"I")
+7 SET LIST(IEN)=VAL_U_VALOK
End DoDot:1
+8 SET NUM=0
SET CNT=0
FOR
SET NUM=$ORDER(LIST(NUM))
IF NUM<1
QUIT
Begin DoDot:1
+9 SET CNT=CNT+1
+10 SET VALUES(CNT)=NUM_U_$PIECE($GET(^ORD(100.8,NUM,0)),U)_U_$SELECT($PIECE(LIST(NUM),U)="E":"ON",1:"OFF")_U_$SELECT($PIECE(LIST(NUM),U,2)="0":"MANDATORY",1:"")
End DoDot:1
+11 QUIT
+12 ;
SAVEOC(OK,VALUES,USER) ; from ORWTPP
+1 ; save user's order checks
+2 NEW NUM,ERR
+3 SET OK=1
+4 SET NUM=0
FOR
SET NUM=$ORDER(VALUES(NUM))
IF NUM<1
QUIT
Begin DoDot:1
+5 DO EN^XPAR(USER_";VA(200,","ORK PROCESSING FLAG","`"_+VALUES(NUM),$SELECT($PIECE(VALUES(NUM),U,2)="ON":"E",1:"D"),.ERR)
End DoDot:1
+6 QUIT
+7 ;
+8 ;
GETNOT(VALUES,USER) ; from ORWTPP
+1 ; get user's notifications
+2 NEW CNT,IEN,NAME,RESULT
KILL VALUES
+3 SET CNT=0
+4 SET NAME=""
FOR
SET NAME=$ORDER(^ORD(100.9,"B",NAME))
IF NAME=""
QUIT
Begin DoDot:1
+5 SET IEN=0
FOR
SET IEN=$ORDER(^ORD(100.9,"B",NAME,IEN))
IF IEN<1
QUIT
Begin DoDot:2
+6 SET RESULT=$$ONOFF^ORB3USER(IEN,USER,"","")
IF $LENGTH($GET(RESULT))
Begin DoDot:3
+7 SET CNT=CNT+1
+8 SET VALUES(CNT)=IEN_U_NAME_U_$PIECE(RESULT,U)_U_$SELECT($$UP^XLFSTR($PIECE(RESULT,U,3))["MANDATORY":"MANDATORY",1:"")
End DoDot:3
End DoDot:2
End DoDot:1
+9 QUIT
+10 ;
SAVENOT(OK,VALUES,USER) ; from ORWTPP
+1 ; save user's notifications
+2 NEW ERR,NUM
+3 SET OK=1
+4 SET NUM=0
FOR
SET NUM=$ORDER(VALUES(NUM))
IF NUM<1
QUIT
Begin DoDot:1
+5 DO EN^XPAR(USER_";VA(200,","ORB PROCESSING FLAG","`"_+VALUES(NUM),$SELECT($PIECE(VALUES(NUM),U,2)="ON":"E",1:"D"),.ERR)
End DoDot:1
+6 QUIT
+7 ;
CLEARNOT(OK,USER) ; from ORWTPP
+1 ; clear user's notifications
+2 DO RECIPURG^XQALBUTL(USER)
+3 SET OK=1
+4 QUIT
+5 ;
GETNOTO(INFO,USER) ; from ORWTPP
+1 ; get user's other info for notifications
+2 IF $$GET^XPAR("USR.`"_USER,"ORB FLAGGED ORDERS BULLETIN",1,"Q")="Y"
SET $PIECE(INFO,U,2)=1
+3 IF $$GET^XPAR("ALL^USR.`"_USER,"ORB ERASE ALL",1,"Q")
SET $PIECE(INFO,U,3)=1
+4 QUIT
+5 ;
GETSURR(INFO,USER) ; from ORWTPP
+1 ; get user's surrogate info
+2 NEW SURR
+3 DO SUROLIST^XQALSURO(USER,.SURR)
+4 SET INFO=$GET(SURR(1))
+5 QUIT
+6 ;
SAVESURR(OK,INFO,USER) ; from ORWTPP
+1 ; save user's surrogate info
+2 NEW START,STOP,SURR,RET
+3 SET OK=1
+4 SET SURR=$PIECE(INFO,U,1)
+5 SET START=$PIECE(INFO,U,2)
+6 SET STOP=$PIECE(INFO,U,3)
+7 SET RET=$$SAVESURR^ORWTPUA(USER,SURR,START,STOP)
+8 IF 'RET
SET OK="0^"_RET
+9 QUIT
+10 ;
SAVENOTO(OK,INFO,USER) ; from ORWTPP
+1 ; save user's notification settings
+2 NEW ERR,FLAG,VAL
+3 SET OK=1
+4 SET FLAG=$PIECE(INFO,U,3)
+5 SET VAL=$SELECT(FLAG>0:"Y",1:"@")
+6 DO EN^XPAR(USER_";VA(200,","ORB FLAGGED ORDERS BULLETIN",1,VAL,.ERR)
+7 QUIT
+8 ;
OCDESC(TEXT,IEN) ; from RPC
+1 NEW CNT,LINE,NUM
KILL TEXT
+2 SET IEN=+$GET(IEN)
IF IEN<1
QUIT
+3 SET TEXT(1)=$PIECE($GET(^ORD(100.8,IEN,0)),U)
+4 SET TEXT(2)=""
+5 SET CNT=2
+6 SET NUM=0
FOR
SET NUM=$ORDER(^ORD(100.8,IEN,1,NUM))
IF NUM<1
QUIT
SET LINE=$GET(^(NUM,0))
Begin DoDot:1
+7 SET CNT=CNT+1
+8 SET TEXT(CNT)=LINE
End DoDot:1
+9 SET TEXT(CNT+1)=""
+10 QUIT
+11 ;
NOTDESC(TEXT,IEN) ; from RPC
+1 KILL TEXT
+2 SET IEN=+$GET(IEN)
IF IEN<1
QUIT
+3 SET TEXT(1)=$PIECE($GET(^ORD(100.9,IEN,0)),U)
+4 SET TEXT(2)=""
+5 SET TEXT(3)=$PIECE($GET(^ORD(100.9,IEN,4)),U)
+6 SET TEXT(4)=""
+7 QUIT