source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWD1.m@ 1361

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

initial load of WorldVistAEHR

File size: 5.7 KB
Line 
1ORWD1 ; SLC/KCM/REV - GUI Prints; 28-JAN-1999 12:51 ;7/31/06 11:34
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,85,140,215,260**;Dec 17, 1997;Build 26
3PRINTS(PRTLST,HLOC,ORWDEV) ; Do the auto-prints after signing orders
4 ; PRTLST(n)=ORIFN;ACT^Chart^Label^Requisition^Service^Work
5 Q:$G(A7RNDBI) ; per NDBI, to suppress prints during integration
6 N ADEVICE,TMPLST S HLOC=+HLOC_";SC("
7 ; if there is a print device for chart copies, print chart copies
8 D MKLST(2) I $D(TMPLST)>1 D ; Print Chart Copies
9 . S ADEVICE=+$P($G(ORWDEV),U,1)
10 . I 'ADEVICE S ADEVICE=$$GET^XPAR(HLOC,"ORPF CHART COPY PRINT DEVICE",1,"I")
11 . I ADEVICE D GUI^ORPR02(.TMPLST,ADEVICE,"C",HLOC)
12 D MKLST(3) I $D(TMPLST)>1 D ; Print Labels
13 . S ADEVICE=+$P($G(ORWDEV),U,2)
14 . I 'ADEVICE S ADEVICE=$$GET^XPAR(HLOC,"ORPF LABEL PRINT DEVICE",1,"I")
15 . I ADEVICE D GUI^ORPR02(.TMPLST,ADEVICE,"L",HLOC)
16 D MKLST(4) I $D(TMPLST)>1 D ; Print Requisitions
17 . S ADEVICE=+$P($G(ORWDEV),U,3)
18 . I 'ADEVICE S ADEVICE=$$GET^XPAR(HLOC,"ORPF REQUISITION PRINT DEVICE",1,"I")
19 . I ADEVICE D GUI^ORPR02(.TMPLST,ADEVICE,"R",HLOC)
20 D MKLST(5) I $D(TMPLST)>1 D ; Print Service Copies
21 . D GUI^ORPR02(.TMPLST,"","S",HLOC)
22 D MKLST(6) I $D(TMPLST)>1 D ; Print Work Copies
23 . S ADEVICE=+$P($G(ORWDEV),U,4)
24 . I 'ADEVICE S ADEVICE=$$GET^XPAR(HLOC,"ORPF WORK COPY PRINT DEVICE",1,"I")
25 . I ADEVICE D GUI^ORPR02(.TMPLST,ADEVICE,"W",HLOC)
26 Q
27MKLST(APIECE) ; Make a list to pass to GUI^ORPR02, called only from PRINTS
28 ; expect PRTLST to be defined, creates new TMPLST
29 N I,J,ORIFN,ACT,NOA,PKG,DLG K TMPLST
30 S I="",J=0 F S I=$O(PRTLST(I)) Q:I'>0 D
31 . I ($L(PRTLST(I),U)>1),'$P(PRTLST(I),"^",APIECE) Q
32 . S ORIFN=+PRTLST(I),ACT=+$P(PRTLST(I),";",2)
33 . S NOA=+$P($G(^OR(100,ORIFN,8,ACT,0)),U,12)
34 . I APIECE=2,'$P($G(^ORD(100.02,NOA,1)),U,2) Q ; no chart copies
35 . I APIECE=6,'$P($G(^ORD(100.02,NOA,1)),U,5) Q ; no work copies
36 . S PKG=+$P($G(^OR(100,+ORIFN,0)),U,14),DLG=+$P($G(^OR(100,+ORIFN,0)),U,5)
37 . I APIECE=4,PKG=$O(^DIC(9.4,"B","DIETETICS",0)),DLG'=$O(^ORD(101.41,"B","FHW SPECIAL MEAL",0)) Q ;no requisitions
38 . S J=J+1,TMPLST(J)=$P(PRTLST(I),U)
39 Q
40PARAM(Y,LOC) ;Returns in 'Y' the print parameters
41 ;Y=Prompt for CC^Prompt for L ^Prompt for R ^Prompt for W ^CC device ^L Device ^R Device ^WC device
42 ;Device Params returned in internal;external format, the rest are internal
43 ;CC=Chart Copy
44 ;L=Label
45 ;R=Requisitions
46 ;WC=Work Copy
47 ;'Prompt for' values (internal):
48 ;0 for no prompts- chart copy is automatically generated.
49 ;1 to prompt for chart copy and ask which printer should be used.
50 ;2 to prompt for chart copy and automatically print to the
51 ; printer defined in the CHART COPY PRINT DEVICE field.
52 ;* don't print.
53 ;LOC=Ptr to location ^SC(LOC,
54 Q:'$G(LOC)
55 S Y=$$BLDIT(LOC)
56 Q
57BLDIT(LOC) ;Get Print parameters
58 Q:'$G(LOC) ""
59 N PARAM,I
60 S PARAM=""
61 F I="ORPF PROMPT FOR CHART COPY","ORPF PROMPT FOR LABELS","ORPF PROMPT FOR REQUISITIONS","ORPF PROMPT FOR WORK COPY" D
62 . S PARAM=PARAM_$$XPAR(I,LOC,"Q")_"^"
63 S PARAM=PARAM_$$XPAR("ORPF CHART COPY PRINT DEVICE",LOC)_"^"
64 S PARAM=PARAM_$$XPAR("ORPF LABEL PRINT DEVICE",LOC)_"^"
65 S PARAM=PARAM_$$XPAR("ORPF REQUISITION PRINT DEVICE",LOC)_"^"
66 S PARAM=PARAM_$$XPAR("ORPF WORK COPY PRINT DEVICE",LOC)_"^"
67 Q PARAM
68COMLOC(LOC,ORDERS) ; Return common location for orders in list, if any
69 N I
70 S LOC=0,I=0
71 ; get the location for the first order that was signed or released
72 F S I=$O(ORDERS(I)) Q:'I D Q:LOC
73 . I $P(ORDERS(I),U,2)'["R",($P(ORDERS(I),U,2)'["S") Q
74 . S LOC=+$P($G(^OR(100,+ORDERS(I),0)),U,10)
75 ; compare the location to the following orders
76 I LOC F S I=$O(ORDERS(I)) Q:'I D Q:'LOC
77 . I $P(ORDERS(I),U,2)'["R",($P(ORDERS(I),U,2)'["S") Q
78 . I (+$P($G(^OR(100,+ORDERS(I),0)),U,10)'=LOC) S LOC=0
79 Q
80SIG4ONE(REQ,ANORDER) ; Return 1 if order requires a signature
81 S REQ=0
82 I +$P($G(^OR(100,+ANORDER,0)),U,16) S REQ=1
83 Q
84SIG4ANY(REQ,ORDERS) ; Return 1 if any order requires a signature
85 N I
86 S I=0,REQ=0
87 F S I=$O(ORDERS(I)) Q:'I D Q:REQ
88 . I +$P($G(^OR(100,+ORDERS(I),0)),U,16) S REQ=1
89 Q
90XPAR(NAME,LOC,FMT) ;Get parameter values
91 Q:'$L(NAME) ""
92 S:'$D(FMT) FMT="B"
93 Q $TR($$GET^XPAR("ALL^"_+LOC_";SC(",NAME,1,FMT),"^",";")
94 ;
95PRINTGUI(ORESULT,HLOC,ORWDEV,PRTLST) ; File|Print orders from GUI
96 ;ORRACT is set here to identify this as a manual reprint
97 N ADEVICE,ORRACT,ORPLST,I,PKG,DLG
98 N BBPKG S BBPKG=+$O(^DIC(9.4,"B","VBECS",0))
99 S PRTLST="",I=0
100 K ORPLST M ORPLST=PRTLST
101 S ORRACT=1,ADEVICE=$P(ORWDEV,U,1),ORESULT=1
102 I +ADEVICE D GUI^ORPR02(.ORPLST,ADEVICE,"C",HLOC)
103 S ADEVICE=$P(ORWDEV,U,2)
104 K ORPLST M ORPLST=PRTLST
105 D INSRTBB^ORWD2(.ORPLST) ; insert BB child Lab orders into ORPLST for printing labels
106 I +ADEVICE D GUI^ORPR02(.ORPLST,ADEVICE,"L",HLOC)
107 ;
108 S ADEVICE=$P(ORWDEV,U,3)
109 K ORPLST M ORPLST=PRTLST
110 ;no FH order requisitions except special meals
111 F S I=$O(ORPLST(I)) Q:'I D
112 . S PKG=+$P($G(^OR(100,+ORPLST(I),0)),U,14),DLG=+$P($G(^OR(100,+ORPLST(I),0)),U,5)
113 . I PKG=$O(^DIC(9.4,"B","DIETETICS",0)),DLG'=$O(^ORD(101.41,"B","FHW SPECIAL MEAL",0)) K ORPLST(I)
114 D INSRTBB^ORWD2(.ORPLST) ; insert BB child Lab orders into ORPLST for printing requisitions
115 I +ADEVICE,$D(ORPLST) D GUI^ORPR02(.ORPLST,ADEVICE,"R",HLOC)
116 ;
117 S ADEVICE=$P(ORWDEV,U,4)
118 K ORPLST M ORPLST=PRTLST
119 I +ADEVICE D GUI^ORPR02(.ORPLST,ADEVICE,"W",HLOC)
120 ; D GUI^ORPR02(.ORPLST,"","S",HLOC) no svc copies from File|Print
121 Q
122RVPRINT(OK,HLOC,ORWDEV,PRTLST) ; print orders from review/sign actions
123 D PRINTS(.PRTLST,HLOC,ORWDEV) S OK=1
124 Q
125SVONLY(OK,HLOC,PRTLST) ; print service copies only
126 Q:$G(A7RNDBI) ; per NDBI, to suppress prints during integration
127 N TMPLST,I,J
128 S HLOC=+HLOC_";SC(",OK=1
129 S I="",J=0 F S I=$O(PRTLST(I)) Q:I'>0 D
130 . I ($L(PRTLST(I),U)>1),'$P(PRTLST(I),U,5) Q
131 . S J=J+1,TMPLST(J)=$P(PRTLST(I),U)
132 I $D(TMPLST)>1 D GUI^ORPR02(.TMPLST,"","S",HLOC)
133 Q
Note: See TracBrowser for help on using the repository browser.