source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWCSP.m@ 1746

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

initial load of WorldVistAEHR

File size: 2.2 KB
RevLine 
[613]1ORWCSP ; ALB/MJK - Background Consult Report Print Driver ;1/24/95 15:49
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10**;Dec 17, 1997
3PRINT(ORY,ORIO,DFN,ORID) ; -- print report entry point
4 ; RPC: ORWCS PRINT REPORT
5 ; See RPC definition for details on input and output parameters
6 ;
7 IF '$$CHK() G PRINTQ
8 ; -- task job
9 N TASKDATA
10 S TASKDATA("DESC")="Consult Report Print"
11 S TASKDATA("RTN")="DEQUE^ORWCSP"
12 D TASK(.ORY,.ORIO,.DFN,.ORID,.TASKDATA)
13PRINTQ Q
14 ;
15TASK(ORY,ORIO,DFN,ORID,TASKDATA) ;
16 ;
17 N ZTDTH,ZTRTN,ZTSK,ZTDESC,ZTSAVE
18 S ZTIO=ORIO,ZTDTH=$H
19 S ZTDESC=TASKDATA("DESC")
20 S ZTRTN=TASKDATA("RTN")
21 S ZTSAVE("DFN")="",ZTSAVE("ORID")="",ZTSAVE("DUZ(")=""
22 D ^%ZTLOAD
23 I $D(ZTSK) D
24 . S ORY="0^Report queued. (Task #"_ZTSK_")"
25 E D
26 . S ORY="99^Task Rejected."
27TASKQ Q
28 ;
29CHK() ; -- do checks for required data
30 ; -- this check assumes all parameters in PRINT call are available
31 ;
32 N OROK,FALSE,TRUE,ORRPT
33 S FALSE=0,TRUE=1
34 ;
35 IF $G(ORIO)']"" S OROK=FALSE,ORY="1^No device selected." G CHKQ
36 ;
37 IF '$G(ORID) S OROK=FALSE,ORY="2^No report specified." G CHKQ
38 ;
39 IF '$D(^DPT(+$G(DFN),0)) S OROK=FALSE,ORY="6^Patient specified is not valid." G CHKQ
40 ;
41 S OROK=TRUE
42CHKQ Q OROK
43 ;
44DEQUE ; -- logic to print queued consult report
45 N ROOT,HDRDATA
46 ;
47 ; -- retrieve report text
48 D RPT^ORWCS(.ROOT,.DFN,.ORID)
49 ;
50 ; -- print report text
51 S HDRDATA("TITLE")="Consult Report"
52 S HDRDATA("DFN")=DFN
53 D OUTPUT(.ROOT,.HDRDATA)
54DEQUEQ Q
55 ;
56OUTPUT(ROOT,HDRDATA) ; -- generic print report
57 N I
58 D INIT(.HDRDATA)
59 D HDR(.HDRDATA)
60 S I=0 F S I=$O(@ROOT@(I)) Q:'I D
61 . S HDRDATA("LCNT")=HDRDATA("LCNT")+1
62 . IF IOSL<(HDRDATA("LCNT")+5) D HDR(.HDRDATA)
63 . W !,@ROOT@(I,0)
64 Q
65 ;
66INIT(HDRDATA) ; -- init generic header data
67 N DFN0,DFN,X,VA
68 S DFN=$G(HDRDATA("DFN"))
69 S HDRDATA("PAGE")=0
70 S HDRDATA("LCNT")=0
71 ; -- set up patient variables
72 S DFN0=$G(^DPT(DFN,0)),HDRDATA("NAME")=$P(DFN0,U)
73 D PID^VADPT6 S HDRDATA("PID")=VA("PID")
74 S X=$P(DFN0,U,3),HDRDATA("DOB")=$$FMTE^XLFDT(X,"D")
75 Q
76 ;
77HDR(ORY) ; -- print generic header
78 N LINE
79 S ORY("PAGE")=ORY("PAGE")+1,ORY("LCNT")=5
80 S $P(LINE,"-",80)=""
81 ;
82 W @IOF
83 W !,ORY("TITLE"),?71,"Page: ",ORY("PAGE")
84 W !,"Name: ",ORY("NAME"),?37,"ID: ",ORY("PID"),?56,"DOB: ",ORY("DOB")
85 W !,LINE,!
86 Q
87 ;
Note: See TracBrowser for help on using the repository browser.