BEHOQOW ;MSC/IND/PLS - Quick Order Wizard Support ;17-Oct-2013 11:56;PLS
;;1.1;BEH COMPONENTS;**039001,039002**;Mar 20, 2007
;=================================================================
; Return List of Display Groups
; Input: GRPTYP - 0 = common, 1=user
; GRPUSR - if GRPTYP=1, use this user to retrieve groups
DISGRP(DATA,GRPTYP,GRPUSR) ;EP
N IEN,NODE,CNT,NAME
S GRPTYP=$G(GRPTYP,0) ; default to all users
S DATA=$$TMPGBL^CIAVMRPC()
Q:GRPTYP&'$G(GRPUSR) ; if type is of user, must have a user
S CNT=0
S IEN=0 F S IEN=$O(^ORD(100.98,IEN)) Q:'IEN D
.S NODE=^ORD(100.98,IEN,0)
.;Q:'$P(^ORD(100.98,IEN,0),U,4) ; Must have a default dialog
.Q:'$$VALIDGP(IEN)
.S CNT=CNT+1,@DATA@(CNT)=IEN_U_$P(NODE,U)_U_$P(NODE,U,2)_U_$S(GRPTYP=1:+$$CNTFUSR(IEN,GRPUSR),1:+$$CNTGRP(IEN))
Q
; Return true if group should be included in the list of groups
VALIDGP(IEN) ;
N FLG
S FLG=''$P(^ORD(100.98,IEN,0),U,4)
I 'FLG D
.S FLG=$$CHKGPH(IEN)
Q FLG
; Return true if group has a hierarchical link to a default dialog
CHKGPH(IEN) ;
N FLG,LP
S LP=0,FLG=0
F S LP=$O(^ORD(100.98,"AD",IEN,LP)) Q:'LP!FLG D
.S FLG=$$VALIDGP(LP)
Q FLG
; Return Main Display Group
DEFDISGP(DATA,GRP) ;EP
S DATA=+$P($G(^ORD(100.98,GRP,0)),U,4)
S DATA=$S('DATA:+$O(^ORD(100.98,"AD",GRP,0)),1:GRP)
Q:$Q DATA
;I 'DATA S DATA=+$O(^ORD(100.98,"AD",GRP,0))
;E S DATA=GRP
Q
; Return list of Quick Orders from Order Dialog File
; Input: GRP - Display Group IEN (default=all groups)
; USR - IEN of User (default=all users)
QOITEMS(DATA,GRP,USR) ;EP
N IEN,NODE,CNT,NAM,QOV,LP
S GRP=$G(GRP,0)
S USR=$G(USR,0)
S DATA=$$TMPGBL^CIAVMRPC()
S CNT=0
I 'USR D
.S NAM="" F S NAM=$O(^ORD(101.41,"C",NAM)) Q:NAM="" D
..S IEN=0 F S IEN=$O(^ORD(101.41,"C",NAM,IEN)) Q:'IEN D
...S NODE=^ORD(101.41,IEN,0)
...Q:$P(NODE,U,4)'="Q"
...I GRP,$P(NODE,U,5)'=GRP Q
...;S CNT=CNT+1,@DATA@(CNT)=IEN_U_NAM_U_$P(NODE,U,5)_U_$P(NODE,U,1)
...S CNT=CNT+1,@DATA@(CNT)=IEN_U_$P(NODE,U,1)_U_$P(NODE,U,5)_U_NAM
E D
.S QOV=+$P($$GETQOV(GRP,USR),U,2)
.I QOV D
..S LP=0 F S LP=$O(^ORD(101.44,+QOV,10,LP)) Q:'LP S IEN=+^(LP,0) D
...S NODE=$G(^ORD(101.41,IEN,0))
...Q:$P(NODE,U,4)'="Q"
...S CNT=CNT+1,@DATA@(CNT)=IEN_U_$P(NODE,U)_U_$P(NODE,U,5)_U_$P(^ORD(101.44,+QOV,10,LP,0),U,2) ;$P(NODE,U,2)
Q
; Return value of field for given quick order
; Input: IEN - IEN to File 101.41
; FLD - Field Number (defaults to .01)
; FLG - 0=actual (default), 1=Uppercase
QOFVAL(DATA,IEN,FLD,FLG) ;EP
S FLD=$G(FLD,.01)
S FLG=$G(FLG,0)
S DATA=$$GET1^DIQ(101.41,IEN,FLD)
S:FLG DATA=$$UP^XLFSTR(DATA)
Q
; Count quick orders for a given display group
; Input: GRP - Display Group IEN
CNTGRP(GRP) ;
N CNT,IEN
S CNT=0
S IEN=0 F S IEN=$O(^ORD(101.41,IEN)) Q:'IEN D
.Q:$P($G(^ORD(101.41,IEN,0)),U,4)'="Q"
.Q:$P($G(^ORD(101.41,IEN,0)),U,5)'=GRP
.S CNT=CNT+1
Q CNT
; Returns Quick Order View information for given Display Group and User.
; Input: DGIEN - Display Group IEN
; GRPUSR - User IEN
; Output: Count of Order Dialogs^IEN to Quick Order View for user
CNTFUSR(DGIEN,GRPUSR) ;
N QOV,VAL
S VAL="0^0"
S QOV=$$GETQOV(DGIEN,GRPUSR)
Q +$$QVCNT(+$P(QOV,U,2))_U_+$P(QOV,U,2)
; Returns Item Count for given Quick Order View
QVCNT(QOV) ;
N LP,CNT
S:'QOV QOV=$O(^ORD(101.44,"B",QOV,0))
Q:'QOV 0
S (CNT,LP)=0 F S LP=$O(^ORD(101.44,QOV,10,LP)) Q:'LP D
.S:$D(^ORD(101.41,+^ORD(101.44,QOV,10,LP,0),0)) CNT=CNT+1
Q CNT
; Return Quick Order View entry for given user
; Input: DGIEN - IEN to Display Group (File 100.98)
; USR - IEN to File 200
; Output: QOV Name^QOV IEN
GETQOV(DGIEN,USR) ;
N QOV
S QOV=$$GET^XPAR("USR.`"_USR,"ORWDQ QUICK VIEW",DGIEN,"I")
S:$L(QOV) QOV=QOV_U_+$O(^ORD(101.44,"B",QOV,0))
Q QOV
; Return Disabled Status of Order Dialog
; Input: BEHOQO - IEN to Order Dialog File (101.41)
GETDISAB(DATA,BEHOQO) ;EP
S DATA=$L($$GET1^DIQ(101.41,BEHOQO,3))>0
Q
; Set Disabled Message for given Order Dialog
; Input: BEHOQO - IEN to Order Dialog File (101.41)
; MSG - Message set (Text will disable; '@' will clear);
SETDISAB(DATA,BEHOQO,MSG) ;EP
N FDA,F,IENS,ERR
S F=101.41
S FDA(F,BEHOQO_",",3)=MSG
D UPDATE^DIE("","FDA","IENS","ERR")
S DATA(1)=$S($G(ERR):"Unable to perform action.",1:"")
Q
; Return Delete Status of Order Dialog
; Input: BEHOQO - IEN to Order Dialog File (101.41)
; USR - IEN to File 200 - If >0, always return ability to delete.
CANDEL(DATA,BEHOQO,USR) ;EP
S DATA=0
S:USR DATA=1
;IHS/MSC/PLS - 10/17/2013 - Non-personal quick orders can't be deleted
;S:'DATA DATA='($D(^ORD(101.41,"AD",BEHOQO))!($$INUSE^ORCMEDT5(BEHOQO))!($E($$GET1^DIQ(101.41,BEHOQO,.01),1,6)="ORWDQ "))
Q:$Q DATA
Q
; Delete given Order Dialog
; Input: BEHOQO - IEN to Order Dialog File (101.41)
; USR - File 200 IEN. If >0 indicates operation is to be done on
; user quick view list vs Order Dialog File.
; (Default = 0)
; DGRP - Display Group
; DNM - Display Name
DELETEQO(DATA,BEHOQO,USR,DGRP,DNM) ;EP
N DA,DIK
S USR=$G(USR,0)
I USR D
.S DATA=$$DUSRQVI(BEHOQO,USR,DGRP,DNM)
E D
.S DA=BEHOQO,DIK="^ORD(101.41," D ^DIK
.S DATA='$D(^ORD(101.41,DA,0))
Q
; Delete Order Quick View entry for given user, order dialog and display group.
; Input: QOIEN - IEN to File 101.41
; USR - IEN to File 200
; DGRP - IEN to File 100.98
DUSRQVI(QOIEN,USR,DGRP,DNM) ;
N DFLG,SNM,QVNM,QVIEN,DA,DIK,ROOT
S DFLG=0
Q:'QOIEN!'USR!'DGRP!'$L(DNM) DFLG
S SNM=$$GET1^DIQ(100.98,DGRP,3)
S QVIEN=$$FIND1^DIC(101.44,"","X","ORWDQ USR"_USR_" "_SNM)
Q:'QVIEN DFLG
S DA(1)=QVIEN
S ROOT="^ORD(101.44,"_DA(1)_",10)"
S DIK=$P(ROOT,")")_",",DA=0
F S DA=$O(@ROOT@(DA)) Q:'DA!DFLG D
.I $P(@ROOT@(DA,0),U,1,2)=(QOIEN_U_DNM) D
..D ^DIK
..S DFLG=1
;CPRS 27 removes the view dialogs and then the actual QO
S DA=QOIEN,DIK="^ORD(101.41," D ^DIK
Q DFLG
; Return Window Form ID for given Display Group default dialog
GRPDEFWD(DATA,GRP) ;EP
S DATA=+$$GET1^DIQ(101.41,$$DEFDLG^ORWDXQ(GRP),55,"I")
Q:$Q DATA
Q
; Return properties of given quick order
; Input: CIAQO - IEN to Order Dialog File (101.41)
PROPERTY(DATA,CIAQO) ;EP
N ORDIALOG,F
S DATA=$$TMPGBL^CIAVMRPC()
I '$G(CIAQO,0) D Q
.S @DATA@(1)="Quick Order entry not available."
D GETQDLG^ORCD(CIAQO)
D CAPTURE^CIAUHFS("D DISPLAY^ORCDLG",DATA,50)
S F=101.41
S @DATA@(1.01)="Number: "_CIAQO
S @DATA@(1.1)="Name: "_$$GET1^DIQ(F,CIAQO,.01)
S @DATA@(1.11)="Display Text: "_$$GET1^DIQ(F,CIAQO,2)
S @DATA@(1.12)="Disable: "_$$GET1^DIQ(F,CIAQO,3)
S @DATA@(1.13)="Type: "_$$UP^XLFSTR($$GET1^DIQ(F,CIAQO,4))
S @DATA@(1.14)="Display Group: "_$$GET1^DIQ(F,CIAQO,5)
S @DATA@(1.15)="Signature Required: "_$$GET1^DIQ(F,CIAQO,6)
S @DATA@(1.16)="Package: "_$$GET1^DIQ(F,CIAQO,7)
S @DATA@(1.17)="Verify Order: "_$$GET1^DIQ(F,CIAQO,8)
S @DATA@(1.18)="Ask For Another Order: "_$$GET1^DIQ(F,CIAQO,9)
S @DATA@(1.19)="Auto-Accept Quick Order: "_$$GET1^DIQ(F,CIAQO,58)
S @DATA@(1.2)=""
S @DATA@(1.3)="Order Dialog Responses:"
S @DATA@(1.4)=""
Q
; Save Order Dialog
; Input:
; IEN - IEN to 101.41 or 0 for new dialog
; TYP - Common QO (0) or User QO (1) (Default: 0)
; NM - Order Dialog Name
; DNM - Display Text
; DGRP - Display Group
; EACT - Entry Action
; VER - Verify Order
; RSP - Dialog Responses
SAVEDLG(DATA,IEN,TYP,NM,DNM,DGRP,EACT,VER,RSP) ;EP
S DATA=0,RSP=$$DEFDLG^ORWDXQ(DGRP) Q:'RSP
S TYP=$G(TYP,0)
D GETDLG1^ORCD(RSP)
N FDA,FDAIEN,DIERR,ORDG,ORQDLG,NODE
S:IEN FDAIEN(1)=IEN
S NODE=$S(IEN:IEN,1:"+1")_","
S FDA(101.41,NODE,.01)=NM
S FDA(101.41,NODE,2)=DNM
S FDA(101.41,NODE,4)="Q"
S FDA(101.41,NODE,5)=DGRP
S FDA(101.41,NODE,8)=VER
S FDA(101.41,NODE,30)=EACT
I IEN D
.D FILE^DIE("","FDA","DIERR")
E D
.D UPDATE^DIE("","FDA","FDAIEN","DIERR")
S DATA=+$G(FDAIEN(1))
I '$D(DIERR) D
.S ORQDLG=FDAIEN(1)
.D SAVE^ORCMEDT1
Q
; Update Quick Order Responses
; Always returns 0
UPDRSP(DATA,IEN,DGRP,ORDIALOG) ;EP
N ORQDLG
S DATA=0,ORDIALOG=$$DEFDLG^ORWDXQ(DGRP) Q:'ORDIALOG
D GETDLG1^ORCD(ORDIALOG)
S ORQDLG=IEN
D SAVE^ORCMEDT1
Q
;
;Return Package IEN for given Display Group
GETPKG(DATA,DISGRP) ;EP
N DEFGRP,DLG,PKG
S DLG=$$DEFDLG^ORWDXQ(DISGRP)
S DATA=$$GET1^DIQ(101.41,DLG,7,"I")
;S DEFGRP=$$DEFDISGP(DISGRP)
;S DLG=
;S DATA=PKG
Q:$Q DATA
Q
; Move Reponses to Cloned Entry
; Input: FIEN - IEN in 101.41 of entry to clone
; TIEN - IEN in 101.41 of new entry
CLONE(DATA,FIEN,TIEN) ;EP
S DATA=0
Q:'FIEN!('TIEN)
Q:'$D(^ORD(101.41,FIEN))!('$D(^ORD(101.41,TIEN)))
M ^ORD(101.41,TIEN,6)=^ORD(101.41,FIEN,6)
S DATA=1
Q
;Returns quick order dialog info
ITMINFO(DATA,IEN) ;EP-
N NODE
S NODE=$G(^ORD(101.41,IEN,0))
S DATA=IEN_U_$P(NODE,U)_U_$P(NODE,U,5)_U_$$UP^XLFSTR($P(NODE,U,2))
Q
BEHOQOW ;MSC/IND/PLS - Quick Order Wizard Support ;17-Oct-2013 11:56;PLS
+1 ;;1.1;BEH COMPONENTS;**039001,039002**;Mar 20, 2007
+2 ;=================================================================
+3 ; Return List of Display Groups
+4 ; Input: GRPTYP - 0 = common, 1=user
+5 ; GRPUSR - if GRPTYP=1, use this user to retrieve groups
DISGRP(DATA,GRPTYP,GRPUSR) ;EP
+1 NEW IEN,NODE,CNT,NAME
+2 ; default to all users
SET GRPTYP=$GET(GRPTYP,0)
+3 SET DATA=$$TMPGBL^CIAVMRPC()
+4 ; if type is of user, must have a user
IF GRPTYP&'$GET(GRPUSR)
QUIT
+5 SET CNT=0
+6 SET IEN=0
FOR
SET IEN=$ORDER(^ORD(100.98,IEN))
IF 'IEN
QUIT
Begin DoDot:1
+7 SET NODE=^ORD(100.98,IEN,0)
+8 ;Q:'$P(^ORD(100.98,IEN,0),U,4) ; Must have a default dialog
+9 IF '$$VALIDGP(IEN)
QUIT
+10 SET CNT=CNT+1
SET @DATA@(CNT)=IEN_U_$PIECE(NODE,U)_U_$PIECE(NODE,U,2)_U_$SELECT(GRPTYP=1:+$$CNTFUSR(IEN,GRPUSR),1:+$$CNTGRP(IEN))
End DoDot:1
+11 QUIT
+12 ; Return true if group should be included in the list of groups
VALIDGP(IEN) ;
+1 NEW FLG
+2 SET FLG=''$PIECE(^ORD(100.98,IEN,0),U,4)
+3 IF 'FLG
Begin DoDot:1
+4 SET FLG=$$CHKGPH(IEN)
End DoDot:1
+5 QUIT FLG
+6 ; Return true if group has a hierarchical link to a default dialog
CHKGPH(IEN) ;
+1 NEW FLG,LP
+2 SET LP=0
SET FLG=0
+3 FOR
SET LP=$ORDER(^ORD(100.98,"AD",IEN,LP))
IF 'LP!FLG
QUIT
Begin DoDot:1
+4 SET FLG=$$VALIDGP(LP)
End DoDot:1
+5 QUIT FLG
+6 ; Return Main Display Group
DEFDISGP(DATA,GRP) ;EP
+1 SET DATA=+$PIECE($GET(^ORD(100.98,GRP,0)),U,4)
+2 SET DATA=$SELECT('DATA:+$ORDER(^ORD(100.98,"AD",GRP,0)),1:GRP)
+3 IF $QUIT
QUIT DATA
+4 ;I 'DATA S DATA=+$O(^ORD(100.98,"AD",GRP,0))
+5 ;E S DATA=GRP
+6 QUIT
+7 ; Return list of Quick Orders from Order Dialog File
+8 ; Input: GRP - Display Group IEN (default=all groups)
+9 ; USR - IEN of User (default=all users)
QOITEMS(DATA,GRP,USR) ;EP
+1 NEW IEN,NODE,CNT,NAM,QOV,LP
+2 SET GRP=$GET(GRP,0)
+3 SET USR=$GET(USR,0)
+4 SET DATA=$$TMPGBL^CIAVMRPC()
+5 SET CNT=0
+6 IF 'USR
Begin DoDot:1
+7 SET NAM=""
FOR
SET NAM=$ORDER(^ORD(101.41,"C",NAM))
IF NAM=""
QUIT
Begin DoDot:2
+8 SET IEN=0
FOR
SET IEN=$ORDER(^ORD(101.41,"C",NAM,IEN))
IF 'IEN
QUIT
Begin DoDot:3
+9 SET NODE=^ORD(101.41,IEN,0)
+10 IF $PIECE(NODE,U,4)'="Q"
QUIT
+11 IF GRP
IF $PIECE(NODE,U,5)'=GRP
QUIT
+12 ;S CNT=CNT+1,@DATA@(CNT)=IEN_U_NAM_U_$P(NODE,U,5)_U_$P(NODE,U,1)
+13 SET CNT=CNT+1
SET @DATA@(CNT)=IEN_U_$PIECE(NODE,U,1)_U_$PIECE(NODE,U,5)_U_NAM
End DoDot:3
End DoDot:2
End DoDot:1
+14 IF '$TEST
Begin DoDot:1
+15 SET QOV=+$PIECE($$GETQOV(GRP,USR),U,2)
+16 IF QOV
Begin DoDot:2
+17 SET LP=0
FOR
SET LP=$ORDER(^ORD(101.44,+QOV,10,LP))
IF 'LP
QUIT
SET IEN=+^(LP,0)
Begin DoDot:3
+18 SET NODE=$GET(^ORD(101.41,IEN,0))
+19 IF $PIECE(NODE,U,4)'="Q"
QUIT
+20 ;$P(NODE,U,2)
SET CNT=CNT+1
SET @DATA@(CNT)=IEN_U_$PIECE(NODE,U)_U_$PIECE(NODE,U,5)_U_$PIECE(^ORD(101.44,+QOV,10,LP,0),U,2)
End DoDot:3
End DoDot:2
End DoDot:1
+21 QUIT
+22 ; Return value of field for given quick order
+23 ; Input: IEN - IEN to File 101.41
+24 ; FLD - Field Number (defaults to .01)
+25 ; FLG - 0=actual (default), 1=Uppercase
QOFVAL(DATA,IEN,FLD,FLG) ;EP
+1 SET FLD=$GET(FLD,.01)
+2 SET FLG=$GET(FLG,0)
+3 SET DATA=$$GET1^DIQ(101.41,IEN,FLD)
+4 IF FLG
SET DATA=$$UP^XLFSTR(DATA)
+5 QUIT
+6 ; Count quick orders for a given display group
+7 ; Input: GRP - Display Group IEN
CNTGRP(GRP) ;
+1 NEW CNT,IEN
+2 SET CNT=0
+3 SET IEN=0
FOR
SET IEN=$ORDER(^ORD(101.41,IEN))
IF 'IEN
QUIT
Begin DoDot:1
+4 IF $PIECE($GET(^ORD(101.41,IEN,0)),U,4)'="Q"
QUIT
+5 IF $PIECE($GET(^ORD(101.41,IEN,0)),U,5)'=GRP
QUIT
+6 SET CNT=CNT+1
End DoDot:1
+7 QUIT CNT
+8 ; Returns Quick Order View information for given Display Group and User.
+9 ; Input: DGIEN - Display Group IEN
+10 ; GRPUSR - User IEN
+11 ; Output: Count of Order Dialogs^IEN to Quick Order View for user
CNTFUSR(DGIEN,GRPUSR) ;
+1 NEW QOV,VAL
+2 SET VAL="0^0"
+3 SET QOV=$$GETQOV(DGIEN,GRPUSR)
+4 QUIT +$$QVCNT(+$PIECE(QOV,U,2))_U_+$PIECE(QOV,U,2)
+5 ; Returns Item Count for given Quick Order View
QVCNT(QOV) ;
+1 NEW LP,CNT
+2 IF 'QOV
SET QOV=$ORDER(^ORD(101.44,"B",QOV,0))
+3 IF 'QOV
QUIT 0
+4 SET (CNT,LP)=0
FOR
SET LP=$ORDER(^ORD(101.44,QOV,10,LP))
IF 'LP
QUIT
Begin DoDot:1
+5 IF $DATA(^ORD(101.41,+^ORD(101.44,QOV,10,LP,0),0))
SET CNT=CNT+1
End DoDot:1
+6 QUIT CNT
+7 ; Return Quick Order View entry for given user
+8 ; Input: DGIEN - IEN to Display Group (File 100.98)
+9 ; USR - IEN to File 200
+10 ; Output: QOV Name^QOV IEN
GETQOV(DGIEN,USR) ;
+1 NEW QOV
+2 SET QOV=$$GET^XPAR("USR.`"_USR,"ORWDQ QUICK VIEW",DGIEN,"I")
+3 IF $LENGTH(QOV)
SET QOV=QOV_U_+$ORDER(^ORD(101.44,"B",QOV,0))
+4 QUIT QOV
+5 ; Return Disabled Status of Order Dialog
+6 ; Input: BEHOQO - IEN to Order Dialog File (101.41)
GETDISAB(DATA,BEHOQO) ;EP
+1 SET DATA=$LENGTH($$GET1^DIQ(101.41,BEHOQO,3))>0
+2 QUIT
+3 ; Set Disabled Message for given Order Dialog
+4 ; Input: BEHOQO - IEN to Order Dialog File (101.41)
+5 ; MSG - Message set (Text will disable; '@' will clear);
SETDISAB(DATA,BEHOQO,MSG) ;EP
+1 NEW FDA,F,IENS,ERR
+2 SET F=101.41
+3 SET FDA(F,BEHOQO_",",3)=MSG
+4 DO UPDATE^DIE("","FDA","IENS","ERR")
+5 SET DATA(1)=$SELECT($GET(ERR):"Unable to perform action.",1:"")
+6 QUIT
+7 ; Return Delete Status of Order Dialog
+8 ; Input: BEHOQO - IEN to Order Dialog File (101.41)
+9 ; USR - IEN to File 200 - If >0, always return ability to delete.
CANDEL(DATA,BEHOQO,USR) ;EP
+1 SET DATA=0
+2 IF USR
SET DATA=1
+3 ;IHS/MSC/PLS - 10/17/2013 - Non-personal quick orders can't be deleted
+4 ;S:'DATA DATA='($D(^ORD(101.41,"AD",BEHOQO))!($$INUSE^ORCMEDT5(BEHOQO))!($E($$GET1^DIQ(101.41,BEHOQO,.01),1,6)="ORWDQ "))
+5 IF $QUIT
QUIT DATA
+6 QUIT
+7 ; Delete given Order Dialog
+8 ; Input: BEHOQO - IEN to Order Dialog File (101.41)
+9 ; USR - File 200 IEN. If >0 indicates operation is to be done on
+10 ; user quick view list vs Order Dialog File.
+11 ; (Default = 0)
+12 ; DGRP - Display Group
+13 ; DNM - Display Name
DELETEQO(DATA,BEHOQO,USR,DGRP,DNM) ;EP
+1 NEW DA,DIK
+2 SET USR=$GET(USR,0)
+3 IF USR
Begin DoDot:1
+4 SET DATA=$$DUSRQVI(BEHOQO,USR,DGRP,DNM)
End DoDot:1
+5 IF '$TEST
Begin DoDot:1
+6 SET DA=BEHOQO
SET DIK="^ORD(101.41,"
DO ^DIK
+7 SET DATA='$DATA(^ORD(101.41,DA,0))
End DoDot:1
+8 QUIT
+9 ; Delete Order Quick View entry for given user, order dialog and display group.
+10 ; Input: QOIEN - IEN to File 101.41
+11 ; USR - IEN to File 200
+12 ; DGRP - IEN to File 100.98
DUSRQVI(QOIEN,USR,DGRP,DNM) ;
+1 NEW DFLG,SNM,QVNM,QVIEN,DA,DIK,ROOT
+2 SET DFLG=0
+3 IF 'QOIEN!'USR!'DGRP!'$LENGTH(DNM)
QUIT DFLG
+4 SET SNM=$$GET1^DIQ(100.98,DGRP,3)
+5 SET QVIEN=$$FIND1^DIC(101.44,"","X","ORWDQ USR"_USR_" "_SNM)
+6 IF 'QVIEN
QUIT DFLG
+7 SET DA(1)=QVIEN
+8 SET ROOT="^ORD(101.44,"_DA(1)_",10)"
+9 SET DIK=$PIECE(ROOT,")")_","
SET DA=0
+10 FOR
SET DA=$ORDER(@ROOT@(DA))
IF 'DA!DFLG
QUIT
Begin DoDot:1
+11 IF $PIECE(@ROOT@(DA,0),U,1,2)=(QOIEN_U_DNM)
Begin DoDot:2
+12 DO ^DIK
+13 SET DFLG=1
End DoDot:2
End DoDot:1
+14 ;CPRS 27 removes the view dialogs and then the actual QO
+15 SET DA=QOIEN
SET DIK="^ORD(101.41,"
DO ^DIK
+16 QUIT DFLG
+17 ; Return Window Form ID for given Display Group default dialog
GRPDEFWD(DATA,GRP) ;EP
+1 SET DATA=+$$GET1^DIQ(101.41,$$DEFDLG^ORWDXQ(GRP),55,"I")
+2 IF $QUIT
QUIT DATA
+3 QUIT
+4 ; Return properties of given quick order
+5 ; Input: CIAQO - IEN to Order Dialog File (101.41)
PROPERTY(DATA,CIAQO) ;EP
+1 NEW ORDIALOG,F
+2 SET DATA=$$TMPGBL^CIAVMRPC()
+3 IF '$GET(CIAQO,0)
Begin DoDot:1
+4 SET @DATA@(1)="Quick Order entry not available."
End DoDot:1
QUIT
+5 DO GETQDLG^ORCD(CIAQO)
+6 DO CAPTURE^CIAUHFS("D DISPLAY^ORCDLG",DATA,50)
+7 SET F=101.41
+8 SET @DATA@(1.01)="Number: "_CIAQO
+9 SET @DATA@(1.1)="Name: "_$$GET1^DIQ(F,CIAQO,.01)
+10 SET @DATA@(1.11)="Display Text: "_$$GET1^DIQ(F,CIAQO,2)
+11 SET @DATA@(1.12)="Disable: "_$$GET1^DIQ(F,CIAQO,3)
+12 SET @DATA@(1.13)="Type: "_$$UP^XLFSTR($$GET1^DIQ(F,CIAQO,4))
+13 SET @DATA@(1.14)="Display Group: "_$$GET1^DIQ(F,CIAQO,5)
+14 SET @DATA@(1.15)="Signature Required: "_$$GET1^DIQ(F,CIAQO,6)
+15 SET @DATA@(1.16)="Package: "_$$GET1^DIQ(F,CIAQO,7)
+16 SET @DATA@(1.17)="Verify Order: "_$$GET1^DIQ(F,CIAQO,8)
+17 SET @DATA@(1.18)="Ask For Another Order: "_$$GET1^DIQ(F,CIAQO,9)
+18 SET @DATA@(1.19)="Auto-Accept Quick Order: "_$$GET1^DIQ(F,CIAQO,58)
+19 SET @DATA@(1.2)=""
+20 SET @DATA@(1.3)="Order Dialog Responses:"
+21 SET @DATA@(1.4)=""
+22 QUIT
+23 ; Save Order Dialog
+24 ; Input:
+25 ; IEN - IEN to 101.41 or 0 for new dialog
+26 ; TYP - Common QO (0) or User QO (1) (Default: 0)
+27 ; NM - Order Dialog Name
+28 ; DNM - Display Text
+29 ; DGRP - Display Group
+30 ; EACT - Entry Action
+31 ; VER - Verify Order
+32 ; RSP - Dialog Responses
SAVEDLG(DATA,IEN,TYP,NM,DNM,DGRP,EACT,VER,RSP) ;EP
+1 SET DATA=0
SET RSP=$$DEFDLG^ORWDXQ(DGRP)
IF 'RSP
QUIT
+2 SET TYP=$GET(TYP,0)
+3 DO GETDLG1^ORCD(RSP)
+4 NEW FDA,FDAIEN,DIERR,ORDG,ORQDLG,NODE
+5 IF IEN
SET FDAIEN(1)=IEN
+6 SET NODE=$SELECT(IEN:IEN,1:"+1")_","
+7 SET FDA(101.41,NODE,.01)=NM
+8 SET FDA(101.41,NODE,2)=DNM
+9 SET FDA(101.41,NODE,4)="Q"
+10 SET FDA(101.41,NODE,5)=DGRP
+11 SET FDA(101.41,NODE,8)=VER
+12 SET FDA(101.41,NODE,30)=EACT
+13 IF IEN
Begin DoDot:1
+14 DO FILE^DIE("","FDA","DIERR")
End DoDot:1
+15 IF '$TEST
Begin DoDot:1
+16 DO UPDATE^DIE("","FDA","FDAIEN","DIERR")
End DoDot:1
+17 SET DATA=+$GET(FDAIEN(1))
+18 IF '$DATA(DIERR)
Begin DoDot:1
+19 SET ORQDLG=FDAIEN(1)
+20 DO SAVE^ORCMEDT1
End DoDot:1
+21 QUIT
+22 ; Update Quick Order Responses
+23 ; Always returns 0
UPDRSP(DATA,IEN,DGRP,ORDIALOG) ;EP
+1 NEW ORQDLG
+2 SET DATA=0
SET ORDIALOG=$$DEFDLG^ORWDXQ(DGRP)
IF 'ORDIALOG
QUIT
+3 DO GETDLG1^ORCD(ORDIALOG)
+4 SET ORQDLG=IEN
+5 DO SAVE^ORCMEDT1
+6 QUIT
+7 ;
+8 ;Return Package IEN for given Display Group
GETPKG(DATA,DISGRP) ;EP
+1 NEW DEFGRP,DLG,PKG
+2 SET DLG=$$DEFDLG^ORWDXQ(DISGRP)
+3 SET DATA=$$GET1^DIQ(101.41,DLG,7,"I")
+4 ;S DEFGRP=$$DEFDISGP(DISGRP)
+5 ;S DLG=
+6 ;S DATA=PKG
+7 IF $QUIT
QUIT DATA
+8 QUIT
+9 ; Move Reponses to Cloned Entry
+10 ; Input: FIEN - IEN in 101.41 of entry to clone
+11 ; TIEN - IEN in 101.41 of new entry
CLONE(DATA,FIEN,TIEN) ;EP
+1 SET DATA=0
+2 IF 'FIEN!('TIEN)
QUIT
+3 IF '$DATA(^ORD(101.41,FIEN))!('$DATA(^ORD(101.41,TIEN)))
QUIT
+4 MERGE ^ORD(101.41,TIEN,6)=^ORD(101.41,FIEN,6)
+5 SET DATA=1
+6 QUIT
+7 ;Returns quick order dialog info
ITMINFO(DATA,IEN) ;EP-
+1 NEW NODE
+2 SET NODE=$GET(^ORD(101.41,IEN,0))
+3 SET DATA=IEN_U_$PIECE(NODE,U)_U_$PIECE(NODE,U,5)_U_$$UP^XLFSTR($PIECE(NODE,U,2))
+4 QUIT