source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP010.m@ 1203

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

initial load of FOIAVistA 6/30/08 version

File size: 6.3 KB
Line 
1RORRP010 ;HCIOFO/SG - RPC: TASK MANAGER ; 10/5/05 11:12am
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 Q
5 ;
6 ;***** DELETES THE TASK
7 ; RPC: [ROR TASK DELETE]
8 ;
9 ; .RESULTS Reference to a local variable where the results
10 ; are returned to.
11 ;
12 ; TASK Task number
13 ;
14 ; Return Values:
15 ;
16 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
17 ; an error (see the RPCSTK^RORERR procedure for more details).
18 ;
19 ; Otherwise, zero is returned.
20 ;
21DELTASK(RESULTS,TASK) ;
22 N RORERRDL K RESULTS
23 D CLEAR^RORERR("DELTASK^RORRP010",1)
24 S RESULTS=$$DEQUEUE^RORTSK(TASK,1)
25 D:RESULTS<0 RPCSTK^RORERR(.RESULTS,RESULTS)
26 Q
27 ;
28 ;***** SCHEDULES THE REPORT
29 ; RPC: [ROR REPORT SCHEDULE]
30 ;
31 ; .RESULTS Reference to a local variable where the results
32 ; are returned to.
33 ;
34 ; RPTCODE Code of the report
35 ;
36 ; [REGIEN] Registry IEN (if $G(REGIEN)'>0 the task will not
37 ; be associated with any particular registry).
38 ;
39 ; [ZTDTH] Date/time to start the task (FileMan). By default
40 ; (if $G(ZDTH)'>0) the task will be scheduled to run
41 ; immediately (see the $$CREATE^RORTSK for details).
42 ;
43 ; [SCHCODE] Rescheduling code for the task. By default (if
44 ; $G(SCHCODE)=""), the task is executed once. See
45 ; description of the $$SCH^XLFDT function for
46 ; possible values of the parameter).
47 ;
48 ; [.PARAMS] Reference to a local variable that contains report
49 ; parameters in XML format.
50 ;
51 ; Return Values:
52 ;
53 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
54 ; an error (see the RPCSTK^RORERR procedure for more details).
55 ;
56 ; Otherwise, the task descriptor is returned in the RESULTS array
57 ; (see the TASKINFO^RORRP010 entry point for details).
58 ;
59SCHEDREP(RESULTS,RPTCODE,REGIEN,ZTDTH,SCHCODE,PARAMS) ;
60 N RORERRDL,RPINFO,TASK,TMP,TSKPRM
61 N ZTCPU,ZTDESC,ZTIO,ZTKIL,ZTPRI,ZTSAVE,ZTSYNC,ZTUCI
62 D CLEAR^RORERR("SCHEDREP^RORRP010",1)
63 S REGIEN=+$G(REGIEN),SCHCODE=$G(SCHCODE)
64 ;--- Get the report descriptor
65 S RC=$$RPINFO^RORUTL08(RPTCODE,.RPINFO)
66 I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
67 ;--- Parse the report parameters
68 S RC=$$PARSEPRM^RORTSK13(.PARAMS,.TSKPRM)
69 ;--- Create the task
70 S TASK=$$CREATE^RORTSK(2,RPINFO(9),,REGIEN,RPTCODE,SCHCODE,.TSKPRM)
71 I TASK<0 D RPCSTK^RORERR(.RESULTS,TASK) Q
72 ;--- Get the status
73 D TASKINFO(.RESULTS,TASK)
74 Q
75 ;
76 ;***** RETURNS THE TASK INFORMATION
77 ; RPC: [ROR TASK INFO]
78 ;
79 ; .RESULTS Reference to a local variable where the results
80 ; are returned to.
81 ;
82 ; TASK Task number
83 ;
84 ; Return Values:
85 ;
86 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
87 ; an error (see the RPCSTK^RORERR procedure for more details).
88 ;
89 ; Otherwise, the task descriptor is returned in the RESULTS array
90 ; (see the $$TASKINFO^RORTSK02 function for more details).
91 ;
92 ; RESULTS(0) Result Descriptor
93 ; ^1: 1
94 ; ^2: Number of nodes that make a single
95 ; task descriptor (TIN)
96 ;
97 ; RESULTS(1) Task Number
98 ; RESULTS(2) Task Type (internal^external)
99 ; RESULTS(3) Registry (IEN^Name)
100 ; RESULTS(4) Report (Code^Name)
101 ; RESULTS(5) Description
102 ; RESULTS(6) Task Status (internal^external)
103 ; RESULTS(7) Creation Time (internal)
104 ; RESULTS(8) User (DUZ^Name)
105 ; RESULTS(9) Completion Time (internal)
106 ; RESULTS(10) Progress Percentage
107 ; RESULTS(11) Scheduled to Run at (internal)
108 ; RESULTS(12) Task Log IEN
109 ; RESULTS(13) Job Number
110 ;
111TASKINFO(RESULTS,TASK) ;
112 N RC,RORERRDL
113 D CLEAR^RORERR("TASKINFO^RORRP010",1)
114 S RC=$$TASKINFO^RORTSK02(TASK,.RESULTS,"EI")
115 I RC'<0 S RESULTS(0)="1^"_$$TIN^RORTSK02
116 E D RPCSTK^RORERR(.RESULTS,RC)
117 Q
118 ;
119 ;***** RETURNS A LIST OF USER'S TASKS
120 ; RPC: [ROR TASK LIST]
121 ;
122 ; .RESULTS Reference to a local variable where the results
123 ; are returned to.
124 ;
125 ; [REGIEN] Registry IEN (all registries by default)
126 ; [TYPE] Task Type (all types by default)
127 ; [USER] User IEN (DUZ by default)
128 ;
129 ; Return Values:
130 ;
131 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
132 ; an error (see the RPCSTK^RORERR procedure for more details).
133 ;
134 ; Otherwise, the task descriptors are returned in the RESULTS array
135 ; (see the TASKINFO^RORRP010 entry point for details).
136 ;
137 ; @RESULTS@(0) Result Descriptor
138 ; ^01: Number of task descriptors returned
139 ; in the RESULTS array (NTSK)
140 ; ^02: Number of nodes that make a single
141 ; task descriptor (TIN)
142 ;
143 ; @RESULTS@(i) Value returned by the $$TASKINFO^RORTSK02
144 ; function. You can calculate the subscript
145 ; of the item TI (from 1 to TIN) of the task
146 ; TN (from 1 to NTSK) using the following
147 ; formula: i = (TN-1)*TIN+TI.
148 ;
149 ; For example, if number of nodes returned by the $$TASKINFO^RORTSK02
150 ; function for each task is 13 and the RESULTS array contains
151 ; information about 3 tasks, the following nodes will be defined:
152 ;
153 ; @RESULTS@(0) = "3^13"
154 ;
155 ; @RESULTS@(1) = Task Number 1
156 ; @RESULTS@(2) = Task Type 1 (internal^external)
157 ; ...
158 ; @RESULTS@(13) = Job Number 1
159 ;
160 ; @RESULTS@(14) = Task Number 2
161 ; @RESULTS@(15) = Task Type 2 (internal^external)
162 ; ...
163 ; @RESULTS@(26) = Job Number 2
164 ;
165 ; @RESULTS@(27) = Task Number 3
166 ; @RESULTS@(28) = Task Type 3 (internal^external)
167 ; ...
168 ; @RESULTS@(39) = Job Number 3
169 ;
170TASKLIST(RESULTS,REGIEN,TYPE,USER) ;
171 N INFO,NTSK,RC,RORERRDL,TASK,TASKLIST,TIN
172 D CLEAR^RORERR("TASKLIST^RORRP010",1)
173 ;--- Initialize the variables
174 K RESULTS S RESULTS=$$ALLOC^RORTMP()
175 S TIN=$$TIN^RORTSK02
176 ;--- Get the list of task numbers
177 S RC=$$LIST^RORTSK02(.TASKLIST,$G(REGIEN),$G(TYPE),,,$G(USER))
178 I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
179 ;--- Generate the output list
180 S TASK="",NTSK=0
181 F S TASK=$O(TASKLIST(TASK)) Q:TASK="" D
182 . K INFO
183 . S RC=$$TASKINFO^RORTSK02(TASK,.INFO,"EI",NTSK*TIN) Q:RC<0
184 . M @RESULTS=INFO S NTSK=NTSK+1
185 S @RESULTS@(0)=NTSK_U_TIN
186 Q
Note: See TracBrowser for help on using the repository browser.