source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP011.m@ 1036

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

initial load of WorldVistAEHR

File size: 4.7 KB
Line 
1RORRP011 ;HCIOFO/SG - RPC: TASK MANAGER (REPORTS) ; 11/21/05 1:02pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 Q
5 ;
6 ;***** ADDS A LINE TO THE RESULTS ARRAY
7ADD(STR) ;
8 S RESULTS(0)=$G(RESULTS(0))+1,RESULTS(RESULTS(0))=STR
9 Q
10 ;
11 ;***** THE REPORT RETRIEVER
12 ; RPC: [ROR REPORT RETRIEVE]
13 ;
14 ; .RORESULT Reference to a local variable where the report
15 ; lines are returned to.
16 ;
17 ; TASK Task number
18 ;
19 ; [FROM] Where to start/continue the rendering process
20 ; (see the $$XMLREP^RORTSK10 function for details).
21 ; By default (if $G(FROM)'>0), the rendering starts
22 ; from the beginning of the report.
23 ;
24 ; [MAXSIZE] Either the maximum number of lines to retrieve or
25 ; the maximum size of the output in bytes (append the
26 ; "B" to the number). By default (if $G(MAXSIZE)'>0,)
27 ; the whole report (starting from the point indicated
28 ; by the FROM parameter if it is defined) is retrieved.
29 ;
30 ; [.SORT] Sort modes for the report
31 ;
32 ; See the description of the ROR REPORT RETRIEVE remote procedure
33 ; for more details.
34 ;
35 ; Return Values:
36 ;
37 ; A negative value of the first "^"-piece of the RESULTS(0) node
38 ; indicates an error (see the RPCSTK^RORERR procedure for details).
39 ;
40GETXML(RORESULT,TASK,FROM,MAXSIZE,SORT) ;
41 N DST,RC,RORERRDL,TMP K RORESULT
42 D CLEAR^RORERR("GETXML^RORRP039",1)
43 ;--- Change the type of the result from the ARRAY to
44 ;--- the GLOBAL ARRAY if a long report is suspected.
45 S DST="RORESULT",MAXSIZE=$G(MAXSIZE)
46 S TMP=$S(MAXSIZE["B":+MAXSIZE,1:MAXSIZE*80)
47 I 'TMP!(TMP>16384),$$RTRNFMT^XWBLIB(4,1) D
48 . S (DST,RORESULT)=$$ALLOC^RORTMP()
49 ;--- Render the report into XML
50 S RC=$$XMLREP^RORTSK10(DST,TASK,.SORT,.FROM,MAXSIZE)
51 I RC<0 K @DST D RPCSTK^RORERR(.RORESULT,RC) Q
52 ;--- Return the starting point for the next call
53 S:MAXSIZE>0 @DST@(0)=$G(FROM)
54 Q
55 ;
56 ;***** RETURNS THE REPORT STYLESHEET
57 ; RPC: [ROR REPORT STYLESHEET]
58 ;
59 ; .RESULTS Reference to a local variable where the XSL
60 ; stylesheet lines are returned to.
61 ;
62 ; RPTCODE Code of the report
63 ;
64 ; [TYPE] Type of the stylesheet
65 ; 1 Report preview (default)
66 ; 2 Comma-separated output
67 ; 3 Printer output
68 ;
69 ; Return Values:
70 ;
71 ; A negative value of the first "^"-piece of the @RESULTS@(0) node
72 ; indicates an error (see the RPCSTK^RORERR procedure for details).
73 ;
74GETXSL(RESULTS,RPTCODE,TYPE) ;
75 N DLG,RC,RORERRDL
76 D CLEAR^RORERR("GETXSL^RORRP039",1)
77 K RESULTS S RESULTS=$$ALLOC^RORTMP()
78 ;--- Check the parameters
79 S DLG=7981000,TYPE=$S($G(TYPE)>0:TYPE/1000,1:.001)
80 I $G(RPTCODE)>0 S:RPTCODE'>999 DLG=DLG+RPTCODE+TYPE
81 ;--- Load the stylesheet into the buffer
82 D BLD^DIALOG(DLG,,,RESULTS)
83 D:$D(@RESULTS)<10
84 . D BLD^DIALOG(7981000+TYPE,,,RESULTS)
85 . D:$D(@RESULTS)<10 BLD^DIALOG(7981000,,,RESULTS)
86 Q
87 ;
88 ;***** RETURNS A LIST OF AVAILABLE REPORTS AND THEIR PARAMETERS
89 ; ROR: [ROR REPORTS AVAILABLE]
90 ;
91 ; .RESULTS Reference to a local variable where the results
92 ; are returned to.
93 ;
94 ; REGIEN Registry IEN
95 ;
96 ; Return Values:
97 ;
98 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
99 ; an error (see the RPCSTK^RORERR procedure for more details).
100 ;
101 ; Otherwise, the report descriptors are returned in the RESULTS array
102 ; (see the $$RPINFO^RORUTL08 entry point for details).
103 ;
104 ; RESULTS(0) Number of available reports
105 ;
106 ; RESULTS(i) XML document that describes the reports
107 ;
108RPAVAIL(RESULTS,REGIEN) ;
109 N BUF,CODE,INFO,NAME,NREP,RC,RPLST
110 D CLEAR^RORERR("RPAVAIL^RORRP039",1)
111 ;--- The the list of available reports
112 S RC=$$RPLIST^RORUTL08(.RPLST,REGIEN)
113 I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
114 ;--- Sort the reports alphabetically
115 S CODE=0
116 F S CODE=$O(RPLST(CODE)) Q:CODE'>0 D
117 . S NAME=$P(RPLST(CODE),U,2)
118 . S:NAME'="" RPLST("B",NAME,CODE)=""
119 ;---
120 K RESULTS
121 D ADD($$XMLHDR^MXMLUTL())
122 D ADD("<REPORTS>")
123 ;--- Get the parameters of the reports
124 S NAME="",(NREP,RC)=0
125 F S NAME=$O(RPLST("B",NAME)) Q:NAME="" D Q:RC<0
126 . S CODE=0
127 . F S CODE=$O(RPLST("B",NAME,CODE)) Q:CODE'>0 D Q:RC<0
128 . . S RC=$$RPINFO^RORUTL08(CODE,.INFO,"E") Q:RC<0
129 . . S NREP=NREP+1
130 . . S BUF="REPORT CODE="""_CODE_""" NAME="""_INFO(1)_""""
131 . . S BUF=BUF_" IEN="""_INFO(5)_""""
132 . . S:'INFO(2) BUF=BUF_" FGP=""1"""
133 . . S:'INFO(7) BUF=BUF_" LOCAL=""1"""
134 . . S:INFO(12) BUF=BUF_" SHARED_TEMPLATES=""1"""
135 . . D ADD("<"_BUF_">")
136 . . D:INFO(6)>0 ADD("<INADT>"_(+INFO(6))_"</INADT>")
137 . . D ADD("<PANELS>"_INFO(8)_"</PANELS>")
138 . . D:INFO(10)?." "1"<PARAMS>"1.E ADD(INFO(10))
139 . . D:INFO(11)?." "1"<SORT_MODES>"1.E ADD(INFO(11))
140 . . D ADD("</REPORT>")
141 ;---
142 I RC'<0 D ADD("</REPORTS>") S RESULTS(0)=NREP
143 E D RPCSTK^RORERR(.RESULTS,RC)
144 Q
Note: See TracBrowser for help on using the repository browser.