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

SCAPMC30.m

Go to the documentation of this file.
  1. SCAPMC30 ;ALB/REW - TEAM APIs:TPCL ; 30 Jun 95
  1. ;;5.3;Scheduling;**41,520,1015**;AUG 13, 1993;Build 21
  1. ;;1.0
  1. TPCL(SC44,SCDATES,SCPOSA,SCUSRA,SCPURPA,SCROLEA,SCLIST,SCERR) ; -- list of positions for a clinic
  1. ; input:
  1. ; SC44 = ien of HOSPITAL LOCATION <FILE#44> [required]
  1. ; SCDATES("BEGIN") = begin date to search (inclusive)
  1. ; [default: TODAY]
  1. ; ("END") = end date to search (inclusive)
  1. ; [default: TODAY]
  1. ; ("INCL") = 1: only use patients who were assigned to
  1. ; team for entire date range
  1. ; 0: anytime in date range
  1. ; [default: 1]
  1. ; SCPOSA -array of pointers to team position - 404.57 (per SCPURPA)
  1. ; SCUSRA -array of pointers to user file - 8930 (per SCPURPA array)
  1. ; SCPURPA -array of pointers to team purpose file 403.47
  1. ; if none are defined - returns all teams
  1. ; if @SCPURPA@('exclude') is defined - exclude listed teams
  1. ; SCROLEA - array of pointers to std position file 403.46 (per SCPURPA)
  1. ; SCLIST -array name to store list
  1. ; [ex. ^TMP("SCPT",$J)]
  1. ;
  1. ; SCERR = array NAME to store error messages.
  1. ; [ex. ^TMP("ORXX",$J)]
  1. ;
  1. ; Output:
  1. ; SCLIST() = array of positions (includes SCTP xref)
  1. ; Format:
  1. ; Subscript: Sequential # from 1 to n
  1. ; Piece Description
  1. ; 1 IEN of TEAM POSITION File (#404.57)
  1. ; 2 Name of Position
  1. ; 3 IEN of Team #404.51
  1. ; 4 IEN of file #404.59 (Tm Pos History)
  1. ; 5 current effective date
  1. ; 6 current inactivate date (if any)
  1. ; 7 pointer to 403.46 (role)
  1. ; 8 Name of Standard Role
  1. ; 9 pointer to User Class (#8930)
  1. ; 10 Name of User Class
  1. ; Subscript: "SCTP",SCTM,IEN =""
  1. ;
  1. ; SCERR() = Array of DIALOG file messages(errors) .
  1. ; @SCERR@(0) = number of errors, undefined if none
  1. ; Format:
  1. ; Subscript: Sequential # from 1 to n
  1. ; Piece Description
  1. ; 1 IEN of DIALOG file
  1. ; Returned: 1 if ok, 0 if error
  1. ; Other:
  1. ; SCACTHIS = status (-1:err|0:inact|1:act)^404.52 ien ^actdt^inacdt
  1. ;
  1. ;
  1. ST N SCPTTP,SCPTTP0,SCTP,SCR,SCACTHIS,SCTM,SCND,SCU,SCOK,SCP,SCTPCL
  1. N SCLSEQ,SCN,SCESEQ,SCPARM,SCBEGIN,SCEND,SCINCL,SCDTS
  1. ; -- initialize control variables
  1. S SCOK=1
  1. G:'$$OKDATA CLTPQ
  1. S SCTP=0 F S SCTP=$O(^SCTM(404.57,"E",SC44,SCTP)) Q:'SCTP D Q:'SCOK
  1. .S SCTP0=$G(^SCTM(404.57,SCTP,0))
  1. .IF '$L(SCTP0) D
  1. ..S SCPARM("POSITION")=$G(SCTP,"Undefined")
  1. ..S SCPARM("CLINIC")=$G(SC44,"Undefined")
  1. ..D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
  1. .S SCTM=$P($G(^SCTM(404.57,SCTP,0)),U,2)
  1. .S SCP=$P(^SCTM(404.51,+SCTM,0),U,3)
  1. .Q:'$$OKARRAY^SCAPU1(.SCPURPA,.SCP)
  1. .S SCR=+$P(^SCTM(404.57,SCTP,0),U,3)
  1. .Q:'$$OKARRAY^SCAPU1(.SCROLEA,.SCR)
  1. .S SCACTHIS=$$ACTHIST^SCAPMCU2(404.59,SCTP,SCDATES,SCERR,"SCTPCL")
  1. .Q:'SCACTHIS
  1. .D BLD^SCAPMC24(.SCLIST,SCTM,SCTP,SCACTHIS,SCR)
  1. CLTPQ Q $G(@SCERR@(0))<1
  1. ;
  1. OKDATA() ;check/setup variables - return 1 if ok; 0 if error
  1. N SCOK
  1. S SCOK=1
  1. D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
  1. IF '$D(^SC(+$G(SC44),0)) D S SCOK=0
  1. . S SCPARM("CLINIC")=$G(SC44,"Undefined")
  1. . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
  1. Q SCOK