- RORRP010 ;HCIOFO/SG - RPC: TASK MANAGER ; 10/5/05 11:12am
- ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
- ;
- Q
- ;
- ;***** DELETES THE TASK
- ; RPC: [ROR TASK DELETE]
- ;
- ; .RESULTS Reference to a local variable where the results
- ; are returned to.
- ;
- ; TASK Task number
- ;
- ; 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, zero is returned.
- ;
- DELTASK(RESULTS,TASK) ;
- N RORERRDL K RESULTS
- D CLEAR^RORERR("DELTASK^RORRP010",1)
- S RESULTS=$$DEQUEUE^RORTSK(TASK,1)
- D:RESULTS<0 RPCSTK^RORERR(.RESULTS,RESULTS)
- Q
- ;
- ;***** SCHEDULES THE REPORT
- ; RPC: [ROR REPORT SCHEDULE]
- ;
- ; .RESULTS Reference to a local variable where the results
- ; are returned to.
- ;
- ; RPTCODE Code of the report
- ;
- ; [REGIEN] Registry IEN (if $G(REGIEN)'>0 the task will not
- ; be associated with any particular registry).
- ;
- ; [ZTDTH] Date/time to start the task (FileMan). By default
- ; (if $G(ZDTH)'>0) the task will be scheduled to run
- ; immediately (see the $$CREATE^RORTSK for details).
- ;
- ; [SCHCODE] Rescheduling code for the task. By default (if
- ; $G(SCHCODE)=""), the task is executed once. See
- ; description of the $$SCH^XLFDT function for
- ; possible values of the parameter).
- ;
- ; [.PARAMS] Reference to a local variable that contains report
- ; parameters in XML format.
- ;
- ; 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 task descriptor is returned in the RESULTS array
- ; (see the TASKINFO^RORRP010 entry point for details).
- ;
- SCHEDREP(RESULTS,RPTCODE,REGIEN,ZTDTH,SCHCODE,PARAMS) ;
- N RORERRDL,RPINFO,TASK,TMP,TSKPRM
- N ZTCPU,ZTDESC,ZTIO,ZTKIL,ZTPRI,ZTSAVE,ZTSYNC,ZTUCI
- D CLEAR^RORERR("SCHEDREP^RORRP010",1)
- S REGIEN=+$G(REGIEN),SCHCODE=$G(SCHCODE)
- ;--- Get the report descriptor
- S RC=$$RPINFO^RORUTL08(RPTCODE,.RPINFO)
- I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
- ;--- Parse the report parameters
- S RC=$$PARSEPRM^RORTSK13(.PARAMS,.TSKPRM)
- ;--- Create the task
- S TASK=$$CREATE^RORTSK(2,RPINFO(9),,REGIEN,RPTCODE,SCHCODE,.TSKPRM)
- I TASK<0 D RPCSTK^RORERR(.RESULTS,TASK) Q
- ;--- Get the status
- D TASKINFO(.RESULTS,TASK)
- Q
- ;
- ;***** RETURNS THE TASK INFORMATION
- ; RPC: [ROR TASK INFO]
- ;
- ; .RESULTS Reference to a local variable where the results
- ; are returned to.
- ;
- ; TASK Task number
- ;
- ; 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 task descriptor is returned in the RESULTS array
- ; (see the $$TASKINFO^RORTSK02 function for more details).
- ;
- ; RESULTS(0) Result Descriptor
- ; ^1: 1
- ; ^2: Number of nodes that make a single
- ; task descriptor (TIN)
- ;
- ; RESULTS(1) Task Number
- ; RESULTS(2) Task Type (internal^external)
- ; RESULTS(3) Registry (IEN^Name)
- ; RESULTS(4) Report (Code^Name)
- ; RESULTS(5) Description
- ; RESULTS(6) Task Status (internal^external)
- ; RESULTS(7) Creation Time (internal)
- ; RESULTS(8) User (DUZ^Name)
- ; RESULTS(9) Completion Time (internal)
- ; RESULTS(10) Progress Percentage
- ; RESULTS(11) Scheduled to Run at (internal)
- ; RESULTS(12) Task Log IEN
- ; RESULTS(13) Job Number
- ;
- TASKINFO(RESULTS,TASK) ;
- N RC,RORERRDL
- D CLEAR^RORERR("TASKINFO^RORRP010",1)
- S RC=$$TASKINFO^RORTSK02(TASK,.RESULTS,"EI")
- I RC'<0 S RESULTS(0)="1^"_$$TIN^RORTSK02
- E D RPCSTK^RORERR(.RESULTS,RC)
- Q
- ;
- ;***** RETURNS A LIST OF USER'S TASKS
- ; RPC: [ROR TASK LIST]
- ;
- ; .RESULTS Reference to a local variable where the results
- ; are returned to.
- ;
- ; [REGIEN] Registry IEN (all registries by default)
- ; [TYPE] Task Type (all types by default)
- ; [USER] User IEN (DUZ by default)
- ;
- ; 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 task descriptors are returned in the RESULTS array
- ; (see the TASKINFO^RORRP010 entry point for details).
- ;
- ; @RESULTS@(0) Result Descriptor
- ; ^01: Number of task descriptors returned
- ; in the RESULTS array (NTSK)
- ; ^02: Number of nodes that make a single
- ; task descriptor (TIN)
- ;
- ; @RESULTS@(i) Value returned by the $$TASKINFO^RORTSK02
- ; function. You can calculate the subscript
- ; of the item TI (from 1 to TIN) of the task
- ; TN (from 1 to NTSK) using the following
- ; formula: i = (TN-1)*TIN+TI.
- ;
- ; For example, if number of nodes returned by the $$TASKINFO^RORTSK02
- ; function for each task is 13 and the RESULTS array contains
- ; information about 3 tasks, the following nodes will be defined:
- ;
- ; @RESULTS@(0) = "3^13"
- ;
- ; @RESULTS@(1) = Task Number 1
- ; @RESULTS@(2) = Task Type 1 (internal^external)
- ; ...
- ; @RESULTS@(13) = Job Number 1
- ;
- ; @RESULTS@(14) = Task Number 2
- ; @RESULTS@(15) = Task Type 2 (internal^external)
- ; ...
- ; @RESULTS@(26) = Job Number 2
- ;
- ; @RESULTS@(27) = Task Number 3
- ; @RESULTS@(28) = Task Type 3 (internal^external)
- ; ...
- ; @RESULTS@(39) = Job Number 3
- ;
- TASKLIST(RESULTS,REGIEN,TYPE,USER) ;
- N INFO,NTSK,RC,RORERRDL,TASK,TASKLIST,TIN
- D CLEAR^RORERR("TASKLIST^RORRP010",1)
- ;--- Initialize the variables
- K RESULTS S RESULTS=$$ALLOC^RORTMP()
- S TIN=$$TIN^RORTSK02
- ;--- Get the list of task numbers
- S RC=$$LIST^RORTSK02(.TASKLIST,$G(REGIEN),$G(TYPE),,,$G(USER))
- I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
- ;--- Generate the output list
- S TASK="",NTSK=0
- F S TASK=$O(TASKLIST(TASK)) Q:TASK="" D
- . K INFO
- . S RC=$$TASKINFO^RORTSK02(TASK,.INFO,"EI",NTSK*TIN) Q:RC<0
- . M @RESULTS=INFO S NTSK=NTSK+1
- S @RESULTS@(0)=NTSK_U_TIN
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRORRP010 6642 printed Feb 18, 2025@23:09:16 Page 2
- RORRP010 ;HCIOFO/SG - RPC: TASK MANAGER ; 10/5/05 11:12am
- +1 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
- +2 ;
- +3 QUIT
- +4 ;
- +5 ;***** DELETES THE TASK
- +6 ; RPC: [ROR TASK DELETE]
- +7 ;
- +8 ; .RESULTS Reference to a local variable where the results
- +9 ; are returned to.
- +10 ;
- +11 ; TASK Task number
- +12 ;
- +13 ; Return Values:
- +14 ;
- +15 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
- +16 ; an error (see the RPCSTK^RORERR procedure for more details).
- +17 ;
- +18 ; Otherwise, zero is returned.
- +19 ;
- DELTASK(RESULTS,TASK) ;
- +1 NEW RORERRDL
- KILL RESULTS
- +2 DO CLEAR^RORERR("DELTASK^RORRP010",1)
- +3 SET RESULTS=$$DEQUEUE^RORTSK(TASK,1)
- +4 if RESULTS<0
- DO RPCSTK^RORERR(.RESULTS,RESULTS)
- +5 QUIT
- +6 ;
- +7 ;***** SCHEDULES THE REPORT
- +8 ; RPC: [ROR REPORT SCHEDULE]
- +9 ;
- +10 ; .RESULTS Reference to a local variable where the results
- +11 ; are returned to.
- +12 ;
- +13 ; RPTCODE Code of the report
- +14 ;
- +15 ; [REGIEN] Registry IEN (if $G(REGIEN)'>0 the task will not
- +16 ; be associated with any particular registry).
- +17 ;
- +18 ; [ZTDTH] Date/time to start the task (FileMan). By default
- +19 ; (if $G(ZDTH)'>0) the task will be scheduled to run
- +20 ; immediately (see the $$CREATE^RORTSK for details).
- +21 ;
- +22 ; [SCHCODE] Rescheduling code for the task. By default (if
- +23 ; $G(SCHCODE)=""), the task is executed once. See
- +24 ; description of the $$SCH^XLFDT function for
- +25 ; possible values of the parameter).
- +26 ;
- +27 ; [.PARAMS] Reference to a local variable that contains report
- +28 ; parameters in XML format.
- +29 ;
- +30 ; Return Values:
- +31 ;
- +32 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
- +33 ; an error (see the RPCSTK^RORERR procedure for more details).
- +34 ;
- +35 ; Otherwise, the task descriptor is returned in the RESULTS array
- +36 ; (see the TASKINFO^RORRP010 entry point for details).
- +37 ;
- SCHEDREP(RESULTS,RPTCODE,REGIEN,ZTDTH,SCHCODE,PARAMS) ;
- +1 NEW RORERRDL,RPINFO,TASK,TMP,TSKPRM
- +2 NEW ZTCPU,ZTDESC,ZTIO,ZTKIL,ZTPRI,ZTSAVE,ZTSYNC,ZTUCI
- +3 DO CLEAR^RORERR("SCHEDREP^RORRP010",1)
- +4 SET REGIEN=+$GET(REGIEN)
- SET SCHCODE=$GET(SCHCODE)
- +5 ;--- Get the report descriptor
- +6 SET RC=$$RPINFO^RORUTL08(RPTCODE,.RPINFO)
- +7 IF RC<0
- DO RPCSTK^RORERR(.RESULTS,RC)
- QUIT
- +8 ;--- Parse the report parameters
- +9 SET RC=$$PARSEPRM^RORTSK13(.PARAMS,.TSKPRM)
- +10 ;--- Create the task
- +11 SET TASK=$$CREATE^RORTSK(2,RPINFO(9),,REGIEN,RPTCODE,SCHCODE,.TSKPRM)
- +12 IF TASK<0
- DO RPCSTK^RORERR(.RESULTS,TASK)
- QUIT
- +13 ;--- Get the status
- +14 DO TASKINFO(.RESULTS,TASK)
- +15 QUIT
- +16 ;
- +17 ;***** RETURNS THE TASK INFORMATION
- +18 ; RPC: [ROR TASK INFO]
- +19 ;
- +20 ; .RESULTS Reference to a local variable where the results
- +21 ; are returned to.
- +22 ;
- +23 ; TASK Task number
- +24 ;
- +25 ; Return Values:
- +26 ;
- +27 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
- +28 ; an error (see the RPCSTK^RORERR procedure for more details).
- +29 ;
- +30 ; Otherwise, the task descriptor is returned in the RESULTS array
- +31 ; (see the $$TASKINFO^RORTSK02 function for more details).
- +32 ;
- +33 ; RESULTS(0) Result Descriptor
- +34 ; ^1: 1
- +35 ; ^2: Number of nodes that make a single
- +36 ; task descriptor (TIN)
- +37 ;
- +38 ; RESULTS(1) Task Number
- +39 ; RESULTS(2) Task Type (internal^external)
- +40 ; RESULTS(3) Registry (IEN^Name)
- +41 ; RESULTS(4) Report (Code^Name)
- +42 ; RESULTS(5) Description
- +43 ; RESULTS(6) Task Status (internal^external)
- +44 ; RESULTS(7) Creation Time (internal)
- +45 ; RESULTS(8) User (DUZ^Name)
- +46 ; RESULTS(9) Completion Time (internal)
- +47 ; RESULTS(10) Progress Percentage
- +48 ; RESULTS(11) Scheduled to Run at (internal)
- +49 ; RESULTS(12) Task Log IEN
- +50 ; RESULTS(13) Job Number
- +51 ;
- TASKINFO(RESULTS,TASK) ;
- +1 NEW RC,RORERRDL
- +2 DO CLEAR^RORERR("TASKINFO^RORRP010",1)
- +3 SET RC=$$TASKINFO^RORTSK02(TASK,.RESULTS,"EI")
- +4 IF RC'<0
- SET RESULTS(0)="1^"_$$TIN^RORTSK02
- +5 IF '$TEST
- DO RPCSTK^RORERR(.RESULTS,RC)
- +6 QUIT
- +7 ;
- +8 ;***** RETURNS A LIST OF USER'S TASKS
- +9 ; RPC: [ROR TASK LIST]
- +10 ;
- +11 ; .RESULTS Reference to a local variable where the results
- +12 ; are returned to.
- +13 ;
- +14 ; [REGIEN] Registry IEN (all registries by default)
- +15 ; [TYPE] Task Type (all types by default)
- +16 ; [USER] User IEN (DUZ by default)
- +17 ;
- +18 ; Return Values:
- +19 ;
- +20 ; A negative value of the first "^"-piece of the RESULTS(0) indicates
- +21 ; an error (see the RPCSTK^RORERR procedure for more details).
- +22 ;
- +23 ; Otherwise, the task descriptors are returned in the RESULTS array
- +24 ; (see the TASKINFO^RORRP010 entry point for details).
- +25 ;
- +26 ; @RESULTS@(0) Result Descriptor
- +27 ; ^01: Number of task descriptors returned
- +28 ; in the RESULTS array (NTSK)
- +29 ; ^02: Number of nodes that make a single
- +30 ; task descriptor (TIN)
- +31 ;
- +32 ; @RESULTS@(i) Value returned by the $$TASKINFO^RORTSK02
- +33 ; function. You can calculate the subscript
- +34 ; of the item TI (from 1 to TIN) of the task
- +35 ; TN (from 1 to NTSK) using the following
- +36 ; formula: i = (TN-1)*TIN+TI.
- +37 ;
- +38 ; For example, if number of nodes returned by the $$TASKINFO^RORTSK02
- +39 ; function for each task is 13 and the RESULTS array contains
- +40 ; information about 3 tasks, the following nodes will be defined:
- +41 ;
- +42 ; @RESULTS@(0) = "3^13"
- +43 ;
- +44 ; @RESULTS@(1) = Task Number 1
- +45 ; @RESULTS@(2) = Task Type 1 (internal^external)
- +46 ; ...
- +47 ; @RESULTS@(13) = Job Number 1
- +48 ;
- +49 ; @RESULTS@(14) = Task Number 2
- +50 ; @RESULTS@(15) = Task Type 2 (internal^external)
- +51 ; ...
- +52 ; @RESULTS@(26) = Job Number 2
- +53 ;
- +54 ; @RESULTS@(27) = Task Number 3
- +55 ; @RESULTS@(28) = Task Type 3 (internal^external)
- +56 ; ...
- +57 ; @RESULTS@(39) = Job Number 3
- +58 ;
- TASKLIST(RESULTS,REGIEN,TYPE,USER) ;
- +1 NEW INFO,NTSK,RC,RORERRDL,TASK,TASKLIST,TIN
- +2 DO CLEAR^RORERR("TASKLIST^RORRP010",1)
- +3 ;--- Initialize the variables
- +4 KILL RESULTS
- SET RESULTS=$$ALLOC^RORTMP()
- +5 SET TIN=$$TIN^RORTSK02
- +6 ;--- Get the list of task numbers
- +7 SET RC=$$LIST^RORTSK02(.TASKLIST,$GET(REGIEN),$GET(TYPE),,,$GET(USER))
- +8 IF RC<0
- DO RPCSTK^RORERR(.RESULTS,RC)
- QUIT
- +9 ;--- Generate the output list
- +10 SET TASK=""
- SET NTSK=0
- +11 FOR
- SET TASK=$ORDER(TASKLIST(TASK))
- if TASK=""
- QUIT
- Begin DoDot:1
- +12 KILL INFO
- +13 SET RC=$$TASKINFO^RORTSK02(TASK,.INFO,"EI",NTSK*TIN)
- if RC<0
- QUIT
- +14 MERGE @RESULTS=INFO
- SET NTSK=NTSK+1
- End DoDot:1
- +15 SET @RESULTS@(0)=NTSK_U_TIN
- +16 QUIT