source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWD2.m@ 1211

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

initial load of WorldVistAEHR

File size: 5.9 KB
RevLine 
[613]1ORWD2 ; SLC/KCM/REV - GUI Prints; 28-JAN-1999 12:51 ;1/9/06 00:35
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,215**;Dec 17, 1997
3 ;
4 ; PUBLIC CALLS
5 ;
6DEVINFO(LST,LOC,NATR,ORDERS) ; Return device info when signing/releasing orders
7 ; Y(0)=Prompt Chart ^ Prompt Label ^ Prompt Requisition ^ Prompt Work
8 ; ^ Chart Device ^ Label Device ^ Requisition Device ^ Work Device
9 ; for Prompt X: *=no print, 0=autoprint, 1=prompt&dev 2=prompt only
10 ; Y(n)=ORIFN;ACT ^ Chart ^ Label ^ Requisition ^ Service ^ Work
11 ; LOC=location (ptr 44), NATR=nature of order (ptr 100.02)
12 ; ORDERS=ORIFN;ACT ^ R | S | E (released, signed, error)
13 N NATCHT,NATWRK,WHENCHT,PRMTCHT,PRMTLBL,PRMTREQ,PRMTWRK
14 N DOCHT,DOLBL,DOREQ,DOWRK,RELEASE,ORDERID,I,J,X
15 N NDCR,NODE,NPCC,NPWC
16 S (DOCHT,DOLBL,DOREQ,DOWRK,I,J)=0,LOC=+LOC_";SC("
17 S NATR=$O(^ORD(100.02,"C",NATR,0))
18 S NATCHT=+$P($G(^ORD(100.02,NATR,1)),U,2),NATWRK=+$P($G(^(1)),U,5)
19 S WHENCHT=$$GET^XPAR("ALL^"_LOC,"ORPF PRINT CHART COPY WHEN",1,"I")
20 I '$L(WHENCHT) S WHENCHT="R"
21 S PRMTCHT=$$GET^XPAR("ALL^"_LOC,"ORPF PROMPT FOR CHART COPY",1,"I")
22 S PRMTLBL=$$GET^XPAR("ALL^"_LOC,"ORPF PROMPT FOR LABELS",1,"I")
23 S PRMTREQ=$$GET^XPAR("ALL^"_LOC,"ORPF PROMPT FOR REQUISITIONS",1,"I")
24 S PRMTWRK=$$GET^XPAR("ALL^"_LOC,"ORPF PROMPT FOR WORK COPY",1,"I")
25 N BBPKG S BBPKG=+$O(^DIC(9.4,"B","VBECS",0))
26 D INSRTBB(.ORDERS) ; insert any blood bank child lab orders into ORDERS array
27 F S I=$O(ORDERS(I)) Q:'I I $P(ORDERS(I),U,2)'["E" D
28 . S ORDERID=$P(ORDERS(I),U),RELEASE=($P(ORDERS(I),U,2)["R")
29 . S J=J+1,LST(J)=ORDERID_"^^^^"
30 . ;AGP this section check the order for DC Reason and grabs the print requirement
31 . ;from the Nature of Order file.
32 . S NPCC=1,NPWC=1
33 . S NDCR=$P($G(^OR(100,+ORDERID,6)),U) I NDCR>0 D
34 . .S NODE=$G(^ORD(100.02,NDCR,1))
35 . .S NPCC=+$P(NODE,U,2)
36 . .S NPWC=+$P(NODE,U,5)
37 . ; skip chart copy if nature doesn't print, no match to 'print when',
38 . ; prompt parameter says don't print, or is lab child of blood bank
39 . I NPCC,NATCHT,($P(ORDERS(I),U,2)[WHENCHT),(PRMTCHT'="*"),$$NOTBB(+ORDERS(I)) S $P(LST(J),U,2)=1,DOCHT=1
40 . ; skip label if not released, no label format, or prompt parameter
41 . ; says don't print
42 . I RELEASE,(PRMTLBL'="*"),$$HASFMTL S $P(LST(J),U,3)=1,DOLBL=1
43 . ; skip requisition if not released, no requistion format, or the
44 . ; prompt parameter says don't print
45 . I RELEASE,(PRMTREQ'="*"),$$HASFMTR S $P(LST(J),U,4)=1,DOREQ=1
46 . ; skip service copy if not releasing
47 . I RELEASE S $P(LST(J),U,5)=1
48 . ; skip work copy if nature doesn't print, not released, no work
49 . ; copy format, or prompt parameter says don't print
50 . I NPWC,NATWRK,RELEASE,(PRMTWRK'="*"),$$HASFMTW,$$NOTBB(+ORDERS(I)) S $P(LST(J),U,6)=1,DOWRK=1
51 S LST(0)=$$DEFDEV
52 Q
53MANUAL(REC,LOC,ORDERS) ; return device info for manual prints
54 N DOCHT,DOLBL,DOREQ,DOWRK,ORDERID,I
55 N PRMTCHT,PRMTLBL,PRMTREQ,PRMTWRK ; (so undefined for DEFDEV call)
56 S (DOLBL,DOREQ,DOWRK,I,J)=0,DOCHT=1,LOC=+LOC_";SC("
57 N BBPKG S BBPKG=+$O(^DIC(9.4,"B","VBECS",0))
58 D INSRTBB(.ORDERS) ; insert any blood bank child lab orders into ORDERS array
59 F S I=$O(ORDERS(I)) Q:'I D Q:DOCHT&DOLBL&DOREQ&DOWRK
60 . S ORDERID=$P(ORDERS(I),U)
61 . I $$HASFMTL S DOLBL=1
62 . I $$HASFMTR S DOREQ=1
63 . I $$HASFMTW,$$NOTBB(+ORDERS(I)) S DOWRK=1
64 S REC=$$DEFDEV
65 Q
66 ;
67 ; PRIVATE CALLS
68 ;
69DEFDEV() ; returns string of prompt flags & default devices
70 ; called from DEVINFO & MANUAL
71 ; expects LOC,DOCHT,DOLBL,DOREQ,DOWRK to be defined
72 ; optionally expects PRMTCHT, PRMTLBL, PRMTREQ, PRMTWRK
73 N X
74 I DOCHT D
75 . S $P(X,U,1)=$G(PRMTCHT,1)
76 . S $P(X,U,5)=$TR($$GET^XPAR("ALL^"_LOC,"ORPF CHART COPY PRINT DEVICE",1,"B"),U,";")
77 E S $P(X,U,1)="*"
78 I DOLBL D
79 . S $P(X,U,2)=$G(PRMTLBL,1)
80 . S $P(X,U,6)=$TR($$GET^XPAR("ALL^"_LOC,"ORPF LABEL PRINT DEVICE",1,"B"),U,";")
81 E S $P(X,U,2)="*"
82 I DOREQ D
83 . S $P(X,U,3)=$G(PRMTREQ,1)
84 . S $P(X,U,7)=$TR($$GET^XPAR("ALL^"_LOC,"ORPF REQUISITION PRINT DEVICE",1,"B"),U,";")
85 E S $P(X,U,3)="*"
86 I DOWRK D
87 . S $P(X,U,4)=$G(PRMTWRK,1)
88 . S $P(X,U,8)=$TR($$GET^XPAR("ALL^"_LOC,"ORPF WORK COPY PRINT DEVICE",1,"B"),U,";")
89 E S $P(X,U,4)="*"
90 Q X
91HASFMTL() ; returns 1 if a label format is available
92 ; called from DEVINFO & MANUAL, expects ORDERID & DOLBL to be defined
93 I DOLBL=1 Q 1 ; already know we're doing at least 1 label
94 N PKG S PKG=+$P($G(^OR(100,+ORDERID,0)),U,14)
95 Q ''$$GET^XPAR("SYS","ORPF WARD LABEL FORMAT",PKG,"I")
96 ;
97HASFMTR() ; returns 1 if a requisition format is available
98 ; called from DEVINFO & MANUAL, expects ORDERID & DOREQ to be defined
99 ;I DOREQ=1 Q 1 ; already know we're doing at least 1 requisition
100 N PKG,DLG S PKG=+$P($G(^OR(100,+ORDERID,0)),U,14),DLG=+$P($G(^OR(100,+ORDERID,0)),U,5)
101 I PKG=$O(^DIC(9.4,"B","DIETETICS",0)),DLG'=$O(^ORD(101.41,"B","FHW SPECIAL MEAL",0)) Q 0 ;no requisitions
102 I DOREQ=1 Q 1 ; already know we're doing at least 1 requisition
103 Q ''$$GET^XPAR("SYS","ORPF WARD REQUISITION FORMAT",PKG,"I")
104 ;
105HASFMTW() ; returns 1 if a work copy format is available
106 ; called from DEVINFO & MANUAL, expects ORDERID & DOWRK to be defined
107 I DOWRK=1 Q 1 ; already know we're doing at least 1 work copy
108 Q ''$$GET^XPAR("SYS","ORPF WORK COPY FORMAT",1,"I") ; not at pkg level
109 ;
110INSRTBB(ORDRLST) ; Insert child lab orders for any orders going to VBECS
111 ; called from DEVINFO, MANUAL
112 ; expects BBPKG to be defined
113 Q:'BBPKG
114 N I,LABPKG,SUBID,CHILD,ACT,KIND
115 S LABPKG=+$O(^DIC(9.4,"B","LAB SERVICE",0)) Q:'LABPKG
116 S I=0 F S I=$O(ORDRLST(I)) Q:'I I $P(ORDRLST(I),U,2)'["E" D
117 . I $P($G(^OR(100,+ORDRLST(I),0)),U,14)'=BBPKG Q
118 . S SUBID=.0001
119 . S CHILD=0 F S CHILD=$O(^OR(100,+ORDRLST(I),2,CHILD)) Q:'CHILD D
120 . . I $P($G(^OR(100,CHILD,0)),U,14)'=LABPKG Q
121 . . S SUBID=SUBID+.0001,ACT=+$P(^OR(100,CHILD,3),U,7),KIND=$P(ORDRLST(I),U,2)
122 . . S ORDRLST(I+SUBID)=CHILD_";"_ACT_U_KIND
123 . S I=I+SUBID
124 Q
125NOTBB(CHILD) ; returns 1 if the order is not a blood bank child lab order
126 ; called from DEVINFO, MANUAL
127 ; expects BBPKG to be defined
128 N PARENT S PARENT=$P(^OR(100,CHILD,3),U,9)
129 I PARENT,$P(^OR(100,PARENT,0),U,14)=BBPKG Q 0
130 Q 1
Note: See TracBrowser for help on using the repository browser.