Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RORRP012

RORRP012.m

Go to the documentation of this file.
  1. RORRP012 ;HCIOFO/SG - RPC: MISCELLANEOUS ; 12/15/05 4:03pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. Q
  1. ;
  1. ;***** RETURNS THE CURRENT DATE/TIME ON THE SERVER
  1. ; RPC: [ROR GET SERVER TIME]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; Return Values:
  1. ;
  1. ; The current dat/time (in internal FileMan format) is returned
  1. ; in the RESULTS(1). RESULTS(0) alwais contains 0.
  1. ;
  1. GETSRVDT(RESULTS) ;
  1. S RESULTS(0)=0
  1. S RESULTS(1)=$$NOW^XLFDT
  1. Q
  1. ;
  1. ;***** RETURNS A LIST OF ITEMS FROM THE 'ROR LIST ITEM' FILE
  1. ; RPC: [ROR LIST ITEMS]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; TYPE Type of the items:
  1. ; 3 Lab Group
  1. ; 4 Drug Group
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0)
  1. ; indicates an error (see the RPCSTK^RORERR procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, number of items is returned in the RESULTS(0)
  1. ; and the subsequent nodes of the array contain the items.
  1. ;
  1. ; RESULTS(0) Number of item
  1. ;
  1. ; RESULTS(i) List Item
  1. ; ^01: IEN
  1. ; ^02: Text
  1. ; ^03: Code
  1. ;
  1. LSTITEMS(RESULTS,REGIEN,TYPE) ;
  1. N CNT,CODE,ITEMS,RC,RORERRDL
  1. D CLEAR^RORERR("LSTITEMS^RORRP012",1)
  1. K RESULTS S RESULTS(0)=0
  1. ;--- Check the parameters
  1. S RC=0 D I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . ;--- Registry IEN
  1. . I $G(REGIEN)'>0 D Q
  1. . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
  1. . S REGIEN=+REGIEN
  1. . ;--- Type
  1. . I $G(TYPE)'>0 D Q
  1. . . S RC=$$ERROR^RORERR(-88,,,,"TYPE",$G(TYPE))
  1. . S TYPE=+TYPE
  1. ;--- Load the list items
  1. S RC=$$ITEMLIST^RORUTL09(TYPE,REGIEN,.ITEMS)
  1. ;--- Populate the output array
  1. S CODE="",CNT=0
  1. F S CODE=$O(ITEMS(CODE)) Q:CODE="" D
  1. . S CNT=CNT+1,RESULTS(CNT)=$P(ITEMS(CODE),U,1,2)
  1. . S $P(RESULTS(CNT),U,3)=CODE
  1. S RESULTS(0)=CNT
  1. Q
  1. ;
  1. ;***** CHECKS FOR PRODUCTION ACCOUNT
  1. ; RPC: [ROR PRODUCTION ACCOUNT]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; Return Values:
  1. ;
  1. ; 1 is returned in RESULTS(0) in case of a production account.
  1. ; Otherwise, zero is returned.
  1. ;
  1. PROD(RESULTS) ;
  1. S RESULTS(0)=+$$PROD^XUPROD()
  1. Q
  1. ;
  1. ;***** CHECKS IF THE RESCHEDULING CODE IS VALID
  1. ; ROR: [ROR TASK VALIDATE RESCHEDULING]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; SCHCODE Rescheduling code
  1. ;
  1. ; [SCHDT] Date when a task is scheduled to run for the
  1. ; first time (FileMan). By default (if $G(SCHDT)'>0),
  1. ; the current date/time is used.
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, either 1 (the rescheduling code is valid) or 0 (the
  1. ; code is not valid) is returned in the RESULTS(0). If the code is
  1. ; valid then the next date/time to run the task (FileMan format)
  1. ; is returned in the RESULTS(1).
  1. ;
  1. VALIDSCH(RESULTS,SCHCODE,SCHDT) ;
  1. N NEXT,RORMSG,TMP K RESULTS
  1. I $G(SCHCODE)="" S RESULTS(0)=1 Q
  1. S RESULTS(0)=0
  1. ;--- Check if the rescheduling code is correct
  1. S:$G(SCHDT)'>0 SCHDT=$$NOW^XLFDT
  1. S NEXT=$$SCH^XLFDT(SCHCODE,SCHDT,1)
  1. Q:NEXT'>0
  1. ;--- Make sure that a task will not be rescheduled in less
  1. ;--- than 60 seconds (to be able to delete it if necessary)
  1. S TMP=$$SCH^XLFDT(SCHCODE,NEXT,1)
  1. S:$$FMDIFF^XLFDT(TMP,NEXT,2)'<60 RESULTS(0)=1,RESULTS(1)=NEXT
  1. Q