source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWDXM.m@ 1314

Last change on this file since 1314 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.1 KB
Line 
1ORWDXM ; SLC/KCM/JLI - Order Dialogs, Menus;10:42 AM 3/29/02 10:47AM 4/3/2002 11AM 4/5/2002 4:30PM
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,132**;Dec 17, 1997
3 ;
4MENU(LST,DLG) ; Return menu contents for an order dialog
5 ; LST(0)=name^# cols^path switch^^^ Key Variables (pieces 6-20)
6 ; LST(n)=col^row^type^ien^formid^autoaccept^display text^mnemonic
7 ; ^displayonly
8 N ILST,I,COL,ROW,IEN,TYP,FID,AUT,MNE,DON,X,X0,X5,NUMCOL
9 S X0=$G(^ORD(101.41,DLG,0)),X5=$G(^(5)),ILST=0,NUMCOL=1
10 ;S COL=$P(X5,U) S:'COL COL=80 S COL=80\COL
11 S LST(0)=$P(X0,U,2)_U_NUMCOL_U_$P(X5,U,3)
12 S $P(LST(0),U,6)=$$KEYVAR^ORWDXM3(DLG) ; key vars start at 6th piece
13 S I=0 F S I=$O(^ORD(101.41,DLG,10,I)) Q:'I D
14 . S X=$G(^ORD(101.41,DLG,10,I,0))
15 . S ROW=$P(X,U),COL=$P(ROW,".",2),ROW=$P(ROW,".",1)
16 . I COL>NUMCOL S NUMCOL=COL
17 . S IEN=+$P(X,U,2),MNE=$P(X,U,3),DON=$P(X,U,5),X=$P(X,U,4)
18 . S X0=$G(^ORD(101.41,IEN,0)),X5=$G(^(5))
19 . S TYP=$P(X0,U,4),FID=+$P(X5,U,5),AUT=$P(X5,U,8)
20 . I '$L(X) S X=$P($G(^ORD(101.41,IEN,0)),U,2)
21 . S ILST=ILST+1,LST(ILST)=COL_U_ROW_U_TYP_U_IEN_U_FID_U_AUT_U_X_U_MNE_U_DON
22 S $P(LST(0),U,2)=NUMCOL
23 Q
24PROMPTS(LST,DLG) ; Return prompting info for generic dialog
25 ; LST(n)=ID^REQ^HID^PROMPT^TYPE^DOMAIN^DEFAULT^IDFLT^HELP^XREF^SCR
26 N I,X,ILST,SEQ,REQ,HID,ITM,IDX,PRMT,HLP,DFLT,IDFLT,TYP,DOM,ID,WP,SCR
27 S ILST=0
28 S SEQ=0 F S SEQ=$O(^ORD(101.41,DLG,10,"B",SEQ)) Q:'SEQ D
29 . S I=0 F S I=$O(^ORD(101.41,DLG,10,"B",SEQ,I)) Q:'I D
30 . . S X=$G(^ORD(101.41,DLG,10,I,0))
31 . . S ITM=$P(X,U,2),REQ=+$P(X,U,6),IDX=$P(X,U,10),PRMT=$P(X,U,14)
32 . . I '$L(PRMT) S PRMT=$P(X,U,4)
33 . . S HLP=$P($G(^ORD(101.41,DLG,10,I,1)),U,1)
34 . . S HID=$E($G(^ORD(101.41,DLG,10,I,3)),1,3)="I 0"
35 . . S SCR="" I $L($G(^ORD(101.41,DLG,10,I,4))) S SCR=DLG_":"_I
36 . . S X=$G(^ORD(101.41,ITM,0)) I '$L(PRMT) S PRMT=$P(X,U,2)
37 . . S X=$G(^ORD(101.41,ITM,1)),TYP=$P(X,U),DOM=$P(X,U,2),ID=$P(X,U,3)
38 . . S X=$G(^ORD(101.41,DLG,10,I,7)) D XDFLT(X,TYP,DOM,.IDFLT,.DFLT)
39 . . I '$L(ID) S ID="ID"_ITM
40 . . S ILST=ILST+1
41 . . S LST(ILST)="~"_ID_U_REQ_U_HID_U_PRMT_U_TYP_U_DOM_U_DFLT_U_IDFLT_U_HLP_U_IDX_U_SCR
42 . . ; loop here to append any default word processing
43 . . S WP=0 F S WP=$O(^ORD(101.41,DLG,10,I,8,WP)) Q:'WP D
44 . . . S ILST=ILST+1,LST(ILST)="t"_$G(^ORD(101.41,DLG,10,I,8,WP,0))
45 Q
46XDFLT(CODE,TYPE,DOMAIN,IVAL,EVAL) ; return internal, external default values
47 S (IVAL,EVAL)="" Q:'$L(CODE)
48 ; set err trap here?
49 N ID,REQ,HID,PRMT,TYP,DOM,DFLT,IDFLT,HLP,Y ; to protect PROMPTS
50 X CODE
51 S IVAL=$G(Y),EVAL=IVAL
52 I TYPE="D",IVAL S EVAL=$$FMTE^XLFDT(IVAL)
53 I TYPE="P",IVAL,DOMAIN S EVAL=$$GET1^DIQ(+DOMAIN,IVAL_",",.01)
54 I TYPE="S",$L(IVAL) S EVAL=$P($P(DOMAIN,IVAL_":",2),";",1)
55 I TYPE="Y",$L(IVAL) S EVAL=$S(IVAL=1:"YES",1:"NO")
56 Q
57DLGNAME(VAL,DLG) ; Return name(s) of dialog & base dialog given IEN
58 ; VAL=InternalName^DisplayName^BaseDialogIEN^BaseDialogName
59 N INT,EXT,BIEN,BNAM
60 S INT=$P($G(^ORD(101.41,DLG,0)),U),EXT=$P($G(^(0)),U,2)
61 S BNAM=INT,BIEN=DLG
62 I $P(^ORD(101.41,DLG,0),U,4)="Q" D
63 . N DGRP S DGRP=$P($G(^ORD(101.41,DLG,0)),U,5) Q:'DGRP
64 . S BIEN=$$DEFDLG^ORWDXQ(DGRP),BNAM=$P(^ORD(101.41,BIEN,0),U)
65 S VAL=INT_U_EXT_U_BIEN_U_BNAM
66 Q
67FORMID(VAL,DLG) ; Return the FormID for a dialog
68 S VAL=+$P($G(^ORD(101.41,DLG,5)),U,5) Q:VAL
69 I $P($G(^ORD(101.41,DLG,0)),U,4)="Q" D
70 . N DGRP S DGRP=$P($G(^ORD(101.41,DLG,0)),U,5) Q:'DGRP
71 . S DLG=$$DEFDLG^ORWDXQ(DGRP) Q:'DLG
72 . S VAL=+$P($G(^ORD(101.41,DLG,5)),U,5)
73 I 'VAL,$P($G(^ORD(101.41,DLG,0)),U,7)=$O(^DIC(9.4,"C","OR",0)) D
74 . S VAL=152 ; use generic "on the fly" form
75 Q
76MSTYLE(VAL) ; Return the menu style for the system
77 S VAL=+$$GET^XPAR("SYS","ORWDXM ORDER MENU STYLE",1,"I")
78 Q
79LOADSET(LST,DLG) ; Return the contents of an order set
80 ; LST(0): SetDisplayText^Key Variables
81 ; LST(n): DlgIEN^DlgType^DisplayText^OrderableItemIENs(OIIEN;OIIEN;..)
82 N SEQ,DA,ITM,TYP,ILST,X,OIENS,PKGINFO
83 S LST(0)=$P(^ORD(101.41,DLG,0),U,2)_U_$$KEYVAR^ORWDXM3(DLG),ILST=0
84 S SEQ="" F S SEQ=$O(^ORD(101.41,DLG,10,"B",SEQ)) Q:SEQ="" D
85 . S DA=0 F S DA=$O(^ORD(101.41,DLG,10,"B",SEQ,DA)) Q:'DA D
86 . . S X=$G(^ORD(101.41,DLG,10,DA,0)),ITM=$P(X,U,2),X=$P(X,U,4)
87 . . Q:'ITM Q:'$D(^ORD(101.41,+ITM,0))
88 . . S (OIENS,PKGINFO)=""
89 . . S TYP=$P(^ORD(101.41,ITM,0),U,4)
90 . . S OIENS=$$OIIFN(+ITM)
91 . . S PKGINFO=$$PKGINF(+ITM)
92 . . I '$L(X) S X=$P($G(^ORD(101.41,ITM,5)),U,4)
93 . . I '$L(X) S X=$P($G(^ORD(101.41,ITM,0)),U,2)
94 . . I '$L(X) S X="Display Name Missing"
95 . . S ILST=ILST+1,LST(ILST)=ITM_U_TYP_U_X_U_OIENS_U_PKGINFO
96 Q
97PKGINF(DLG) ; Get Package based on the DLG ID
98 N PKGID,PKGNM
99 S PKGID="",PKGNM=""
100 S:$D(^ORD(101.41,DLG,0)) PKGID=$P(^(0),U,7)
101 I PKGID D
102 . S:$D(^DIC(9.4,PKGID,0)) PKGNM=$P(^(0),U,2)
103 Q PKGNM
104OIIFN(DLG) ; Get Orderable Item IENs based on the DLG
105 N OIDX,OINODE,OINUM,OIIENS,OI0
106 S (OIIENS,OINODE,OIIENS)=""
107 S OINUM=0
108 S OIDX=$O(^ORD(101.41,"B","OR GTX ORDERABLE ITEM",0))
109 S:$D(^ORD(101.41,DLG,6,"D",OIDX)) OINODE=$O(^(OIDX,0))
110 S:OINODE OINUM=$P(^ORD(101.41,DLG,6,OINODE,0),U,3)
111 I OINUM F OI0=1:1:OINUM S OIIENS=OIIENS_^(OI0)_";"
112 Q OIIENS
113AUTOACK(REC,ORVP,ORNP,ORL,ORIT) ; Place a quick order without verify step
114 N ORDG,ORDUZ,ORSTS,OREVENT,ORCAT,ORDA,ORTS,ORNEW,ORCHECK,ORLOG
115 N ORDIALOG,ORIFN,ORLEAD,ORTRAIL
116 S ORVP=ORVP_";DPT(",ORL(2)=ORL_";SC(",ORL=ORL(2)
117 S DGRP=$P($G(^ORD(101.41,ORIT,0)),U,5) Q:'DGRP
118 S ORDIALOG=$$DEFDLG^ORWDXQ(DGRP)
119 I ORDIALOG=$O(^ORD(101.41,"B","PSO OERR",0)) S ORCAT="O" ; temp
120 I ORDIALOG=$O(^ORD(101.41,"B","PSJ OR PAT OE",0)) S ORCAT="I" ; temp
121 D GETDLG1^ORCD(ORDIALOG)
122 D GETORDER^ORCD("^ORD(101.41,"_ORIT_",6)")
123 ; check required fields?
124 D EN^ORCSAVE
125 S REC="" I ORIFN D GETBYIFN^ORWORR(.REC,ORIFN)
126 Q
127ALLRSP(QUIK) ; Return 1 if quick order has values for all responses
128 N ALLOK,DLG,ITM,PRMT
129 S ALLOK=1,DLG=+$$DEFDLG^ORWDXQ(+$P($G(^ORD(101.41,QUIK,0)),U,5))
130 S ITM=0 F S ITM=$O(^ORD(101.41,DLG,10,ITM)) Q:'ITM D Q:'ALLOK
131 . Q:$P($G(^ORD(101.41,DLG,10,ITM,0)),U,8)=1
132 . S PRMT=$P(^ORD(101.41,DLG,10,ITM,0),U,2)
133 . I '$$HASRSP(QUIK,PRMT) S ALLOK=0
134 Q ALLOK
135HASRSP(QUIK,PRMT) ; Return 1 if quick order has response for prompt
136 N FND,RSP S FND=0
137 S RSP=0 F S RSP=$O(^ORD(101.41,QUIK,6,RSP)) Q:'RSP D Q:FND
138 . I $P(^ORD(101.41,QUIK,6,RSP,0),U,2)=PRMT S FND=1
139 Q FND
140
Note: See TracBrowser for help on using the repository browser.