RORRP011 ;HCIOFO/SG - RPC: TASK MANAGER (REPORTS) ; 11/21/05 1:02pm
;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
;
Q
;
;***** ADDS A LINE TO THE RESULTS ARRAY
ADD(STR) ;
S RESULTS(0)=$G(RESULTS(0))+1,RESULTS(RESULTS(0))=STR
Q
;
;***** THE REPORT RETRIEVER
; RPC: [ROR REPORT RETRIEVE]
;
; .RORESULT Reference to a local variable where the report
; lines are returned to.
;
; TASK Task number
;
; [FROM] Where to start/continue the rendering process
; (see the $$XMLREP^RORTSK10 function for details).
; By default (if $G(FROM)'>0), the rendering starts
; from the beginning of the report.
;
; [MAXSIZE] Either the maximum number of lines to retrieve or
; the maximum size of the output in bytes (append the
; "B" to the number). By default (if $G(MAXSIZE)'>0,)
; the whole report (starting from the point indicated
; by the FROM parameter if it is defined) is retrieved.
;
; [.SORT] Sort modes for the report
;
; See the description of the ROR REPORT RETRIEVE remote procedure
; for more details.
;
; Return Values:
;
; A negative value of the first "^"-piece of the RESULTS(0) node
; indicates an error (see the RPCSTK^RORERR procedure for details).
;
GETXML(RORESULT,TASK,FROM,MAXSIZE,SORT) ;
N DST,RC,RORERRDL,TMP K RORESULT
D CLEAR^RORERR("GETXML^RORRP039",1)
;--- Change the type of the result from the ARRAY to
;--- the GLOBAL ARRAY if a long report is suspected.
S DST="RORESULT",MAXSIZE=$G(MAXSIZE)
S TMP=$S(MAXSIZE["B":+MAXSIZE,1:MAXSIZE*80)
I 'TMP!(TMP>16384),$$RTRNFMT^XWBLIB(4,1) D
. S (DST,RORESULT)=$$ALLOC^RORTMP()
;--- Render the report into XML
S RC=$$XMLREP^RORTSK10(DST,TASK,.SORT,.FROM,MAXSIZE)
I RC<0 K @DST D RPCSTK^RORERR(.RORESULT,RC) Q
;--- Return the starting point for the next call
S:MAXSIZE>0 @DST@(0)=$G(FROM)
Q
;
;***** RETURNS THE REPORT STYLESHEET
; RPC: [ROR REPORT STYLESHEET]
;
; .RESULTS Reference to a local variable where the XSL
; stylesheet lines are returned to.
;
; RPTCODE Code of the report
;
; [TYPE] Type of the stylesheet
; 1 Report preview (default)
; 2 Comma-separated output
; 3 Printer output
;
; Return Values:
;
; A negative value of the first "^"-piece of the @RESULTS@(0) node
; indicates an error (see the RPCSTK^RORERR procedure for details).
;
GETXSL(RESULTS,RPTCODE,TYPE) ;
N DLG,RC,RORERRDL
D CLEAR^RORERR("GETXSL^RORRP039",1)
K RESULTS S RESULTS=$$ALLOC^RORTMP()
;--- Check the parameters
S DLG=7981000,TYPE=$S($G(TYPE)>0:TYPE/1000,1:.001)
I $G(RPTCODE)>0 S:RPTCODE'>999 DLG=DLG+RPTCODE+TYPE
;--- Load the stylesheet into the buffer
D BLD^DIALOG(DLG,,,RESULTS)
D:$D(@RESULTS)<10
. D BLD^DIALOG(7981000+TYPE,,,RESULTS)
. D:$D(@RESULTS)<10 BLD^DIALOG(7981000,,,RESULTS)
Q
;
;***** RETURNS A LIST OF AVAILABLE REPORTS AND THEIR PARAMETERS
; ROR: [ROR REPORTS AVAILABLE]
;
; .RESULTS Reference to a local variable where the results
; are returned to.
;
; REGIEN Registry IEN
;
; Return Values:
;
; A negative value of the first "^"-piece of the RESULTS(0) indicates
; an error (see the RPCSTK^RORERR procedure for more details).
;
; Otherwise, the report descriptors are returned in the RESULTS array
; (see the $$RPINFO^RORUTL08 entry point for details).
;
; RESULTS(0) Number of available reports
;
; RESULTS(i) XML document that describes the reports
;
RPAVAIL(RESULTS,REGIEN) ;
N BUF,CODE,INFO,NAME,NREP,RC,RPLST
D CLEAR^RORERR("RPAVAIL^RORRP039",1)
;--- The the list of available reports
S RC=$$RPLIST^RORUTL08(.RPLST,REGIEN)
I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
;--- Sort the reports alphabetically
S CODE=0
F S CODE=$O(RPLST(CODE)) Q:CODE'>0 D
. S NAME=$P(RPLST(CODE),U,2)
. S:NAME'="" RPLST("B",NAME,CODE)=""
;---
K RESULTS
D ADD($$XMLHDR^MXMLUTL())
D ADD("<REPORTS>")
;--- Get the parameters of the reports
S NAME="",(NREP,RC)=0
F S NAME=$O(RPLST("B",NAME)) Q:NAME="" D Q:RC<0
. S CODE=0
. F S CODE=$O(RPLST("B",NAME,CODE)) Q:CODE'>0 D Q:RC<0
. . S RC=$$RPINFO^RORUTL08(CODE,.INFO,"E") Q:RC<0
. . S NREP=NREP+1
. . S BUF="REPORT CODE="""_CODE_""" NAME="""_INFO(1)_""""
. . S BUF=BUF_" IEN="""_INFO(5)_""""
. . S:'INFO(2) BUF=BUF_" FGP=""1"""
. . S:'INFO(7) BUF=BUF_" LOCAL=""1"""
. . S:INFO(12) BUF=BUF_" SHARED_TEMPLATES=""1"""
. . D ADD("<"_BUF_">")
. . D:INFO(6)>0 ADD("<INADT>"_(+INFO(6))_"</INADT>")
. . D ADD("<PANELS>"_INFO(8)_"</PANELS>")
. . D:INFO(10)?." "1"<PARAMS>"1.E ADD(INFO(10))
. . D:INFO(11)?." "1"<SORT_MODES>"1.E ADD(INFO(11))
. . D ADD("</REPORT>")
;---
I RC'<0 D ADD("</REPORTS>") S RESULTS(0)=NREP
E D RPCSTK^RORERR(.RESULTS,RC)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORRP011 5002 printed Oct 16, 2024@17:43:46 Page 2
RORRP011 ;HCIOFO/SG - RPC: TASK MANAGER (REPORTS) ; 11/21/05 1:02pm
+1 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
+2 ;
+3 QUIT
+4 ;
+5 ;***** ADDS A LINE TO THE RESULTS ARRAY
ADD(STR) ;
+1 SET RESULTS(0)=$GET(RESULTS(0))+1
SET RESULTS(RESULTS(0))=STR
+2 QUIT
+3 ;
+4 ;***** THE REPORT RETRIEVER
+5 ; RPC: [ROR REPORT RETRIEVE]
+6 ;
+7 ; .RORESULT Reference to a local variable where the report
+8 ; lines are returned to.
+9 ;
+10 ; TASK Task number
+11 ;
+12 ; [FROM] Where to start/continue the rendering process
+13 ; (see the $$XMLREP^RORTSK10 function for details).
+14 ; By default (if $G(FROM)'>0), the rendering starts
+15 ; from the beginning of the report.
+16 ;
+17 ; [MAXSIZE] Either the maximum number of lines to retrieve or
+18 ; the maximum size of the output in bytes (append the
+19 ; "B" to the number). By default (if $G(MAXSIZE)'>0,)
+20 ; the whole report (starting from the point indicated
+21 ; by the FROM parameter if it is defined) is retrieved.
+22 ;
+23 ; [.SORT] Sort modes for the report
+24 ;
+25 ; See the description of the ROR REPORT RETRIEVE remote procedure
+26 ; for more details.
+27 ;
+28 ; Return Values:
+29 ;
+30 ; A negative value of the first "^"-piece of the RESULTS(0) node
+31 ; indicates an error (see the RPCSTK^RORERR procedure for details).
+32 ;
GETXML(RORESULT,TASK,FROM,MAXSIZE,SORT) ;
+1 NEW DST,RC,RORERRDL,TMP
KILL RORESULT
+2 DO CLEAR^RORERR("GETXML^RORRP039",1)
+3 ;--- Change the type of the result from the ARRAY to
+4 ;--- the GLOBAL ARRAY if a long report is suspected.
+5 SET DST="RORESULT"
SET MAXSIZE=$GET(MAXSIZE)
+6 SET TMP=$SELECT(MAXSIZE["B":+MAXSIZE,1:MAXSIZE*80)
+7 IF 'TMP!(TMP>16384)
IF $$RTRNFMT^XWBLIB(4,1)
Begin DoDot:1
+8 SET (DST,RORESULT)=$$ALLOC^RORTMP()
End DoDot:1
+9 ;--- Render the report into XML
+10 SET RC=$$XMLREP^RORTSK10(DST,TASK,.SORT,.FROM,MAXSIZE)
+11 IF RC<0
KILL @DST
DO RPCSTK^RORERR(.RORESULT,RC)
QUIT
+12 ;--- Return the starting point for the next call
+13 if MAXSIZE>0
SET @DST@(0)=$GET(FROM)
+14 QUIT
+15 ;
+16 ;***** RETURNS THE REPORT STYLESHEET
+17 ; RPC: [ROR REPORT STYLESHEET]
+18 ;
+19 ; .RESULTS Reference to a local variable where the XSL
+20 ; stylesheet lines are returned to.
+21 ;
+22 ; RPTCODE Code of the report
+23 ;
+24 ; [TYPE] Type of the stylesheet
+25 ; 1 Report preview (default)
+26 ; 2 Comma-separated output
+27 ; 3 Printer output
+28 ;
+29 ; Return Values:
+30 ;
+31 ; A negative value of the first "^"-piece of the @RESULTS@(0) node
+32 ; indicates an error (see the RPCSTK^RORERR procedure for details).
+33 ;
GETXSL(RESULTS,RPTCODE,TYPE) ;
+1 NEW DLG,RC,RORERRDL
+2 DO CLEAR^RORERR("GETXSL^RORRP039",1)
+3 KILL RESULTS
SET RESULTS=$$ALLOC^RORTMP()
+4 ;--- Check the parameters
+5 SET DLG=7981000
SET TYPE=$SELECT($GET(TYPE)>0:TYPE/1000,1:.001)
+6 IF $GET(RPTCODE)>0
if RPTCODE'>999
SET DLG=DLG+RPTCODE+TYPE
+7 ;--- Load the stylesheet into the buffer
+8 DO BLD^DIALOG(DLG,,,RESULTS)
+9 if $DATA(@RESULTS)<10
Begin DoDot:1
+10 DO BLD^DIALOG(7981000+TYPE,,,RESULTS)
+11 if $DATA(@RESULTS)<10
DO BLD^DIALOG(7981000,,,RESULTS)
End DoDot:1
+12 QUIT
+13 ;
+14 ;***** RETURNS A LIST OF AVAILABLE REPORTS AND THEIR PARAMETERS
+15 ; ROR: [ROR REPORTS AVAILABLE]
+16 ;
+17 ; .RESULTS Reference to a local variable where the results
+18 ; are returned to.
+19 ;
+20 ; REGIEN Registry IEN
+21 ;
+22 ; Return Values:
+23 ;
+24 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
+25 ; an error (see the RPCSTK^RORERR procedure for more details).
+26 ;
+27 ; Otherwise, the report descriptors are returned in the RESULTS array
+28 ; (see the $$RPINFO^RORUTL08 entry point for details).
+29 ;
+30 ; RESULTS(0) Number of available reports
+31 ;
+32 ; RESULTS(i) XML document that describes the reports
+33 ;
RPAVAIL(RESULTS,REGIEN) ;
+1 NEW BUF,CODE,INFO,NAME,NREP,RC,RPLST
+2 DO CLEAR^RORERR("RPAVAIL^RORRP039",1)
+3 ;--- The the list of available reports
+4 SET RC=$$RPLIST^RORUTL08(.RPLST,REGIEN)
+5 IF RC<0
DO RPCSTK^RORERR(.RESULTS,RC)
QUIT
+6 ;--- Sort the reports alphabetically
+7 SET CODE=0
+8 FOR
SET CODE=$ORDER(RPLST(CODE))
if CODE'>0
QUIT
Begin DoDot:1
+9 SET NAME=$PIECE(RPLST(CODE),U,2)
+10 if NAME'=""
SET RPLST("B",NAME,CODE)=""
End DoDot:1
+11 ;---
+12 KILL RESULTS
+13 DO ADD($$XMLHDR^MXMLUTL())
+14 DO ADD("<REPORTS>")
+15 ;--- Get the parameters of the reports
+16 SET NAME=""
SET (NREP,RC)=0
+17 FOR
SET NAME=$ORDER(RPLST("B",NAME))
if NAME=""
QUIT
Begin DoDot:1
+18 SET CODE=0
+19 FOR
SET CODE=$ORDER(RPLST("B",NAME,CODE))
if CODE'>0
QUIT
Begin DoDot:2
+20 SET RC=$$RPINFO^RORUTL08(CODE,.INFO,"E")
if RC<0
QUIT
+21 SET NREP=NREP+1
+22 SET BUF="REPORT CODE="""_CODE_""" NAME="""_INFO(1)_""""
+23 SET BUF=BUF_" IEN="""_INFO(5)_""""
+24 if 'INFO(2)
SET BUF=BUF_" FGP=""1"""
+25 if 'INFO(7)
SET BUF=BUF_" LOCAL=""1"""
+26 if INFO(12)
SET BUF=BUF_" SHARED_TEMPLATES=""1"""
+27 DO ADD("<"_BUF_">")
+28 if INFO(6)>0
DO ADD("<INADT>"_(+INFO(6))_"</INADT>")
+29 DO ADD("<PANELS>"_INFO(8)_"</PANELS>")
+30 if INFO(10)?." "1"<PARAMS>"1.E
DO ADD(INFO(10))
+31 if INFO(11)?." "1"<SORT_MODES>"1.E
DO ADD(INFO(11))
+32 DO ADD("</REPORT>")
End DoDot:2
if RC<0
QUIT
End DoDot:1
if RC<0
QUIT
+33 ;---
+34 IF RC'<0
DO ADD("</REPORTS>")
SET RESULTS(0)=NREP
+35 IF '$TEST
DO RPCSTK^RORERR(.RESULTS,RC)
+36 QUIT