| [613] | 1 | SCAPMC5 ;ALB/REW - Team API's:TMAU ; JUL 3, 1995
 | 
|---|
 | 2 |  ;;5.3;Scheduling;**41**;AUG 13, 1993
 | 
|---|
 | 3 |  ;;1.0
 | 
|---|
 | 4 | TMAU(SCAU,SCDATES,SCPURPA,SCLIST,SCERR) ; -- list of teams for autolink
 | 
|---|
 | 5 |  ; input:
 | 
|---|
 | 6 |  ;  SCAU = variable pointer to TEAM AUTOLINK file (#404.56)
 | 
|---|
 | 7 |  ;         e.g. 10866;VA(200 for the practitioner with duz=10866
 | 
|---|
 | 8 |  ;  SCDATES("BEGIN") = begin date to search (inclusive)
 | 
|---|
 | 9 |  ;                      [default: TODAY]
 | 
|---|
 | 10 |  ;        ("END")   = end date to search (inclusive)
 | 
|---|
 | 11 |  ;                      [default: TODAY]
 | 
|---|
 | 12 |  ;        ("INCL")  = 1: only use teams who were active
 | 
|---|
 | 13 |  ;                       for entire date range
 | 
|---|
 | 14 |  ;                    0: anytime in date range
 | 
|---|
 | 15 |  ;                      [default: 1] 
 | 
|---|
 | 16 |  ;  SCPURPA -array of pointers to team purpose file 403.47
 | 
|---|
 | 17 |  ;          if none are defined - returns all teams
 | 
|---|
 | 18 |  ;          if @SCPURPA@('exclude') is defined - exclude listed teams
 | 
|---|
 | 19 |  ;  SCLIST -array name to store list
 | 
|---|
 | 20 |  ;          [ex. ^TMP("SCTM",$J)]
 | 
|---|
 | 21 |  ;        
 | 
|---|
 | 22 |  ;  SCERR = array NAME to store error messages.
 | 
|---|
 | 23 |  ;          [ex. ^TMP("ORXX",$J)]
 | 
|---|
 | 24 |  ;
 | 
|---|
 | 25 |  ; Output:
 | 
|---|
 | 26 |  ;  SCLIST() = array of teams
 | 
|---|
 | 27 |  ;             Format:
 | 
|---|
 | 28 |  ;               Subscript: Sequential # from 1 to n
 | 
|---|
 | 29 |  ;               Piece     Description
 | 
|---|
 | 30 |  ;                 1       IEN of TEAM file entry
 | 
|---|
 | 31 |  ;                 2       Name of team
 | 
|---|
 | 32 |  ;                 3       current effective date
 | 
|---|
 | 33 |  ;                 4       current inactivate date (if any)
 | 
|---|
 | 34 |  ;
 | 
|---|
 | 35 |  ;  SCERR() = Array of DIALOG file messages(errors) .
 | 
|---|
 | 36 |  ;             Foramt:
 | 
|---|
 | 37 |  ;  @SCERR@(0)= Number of errors, undefined if none
 | 
|---|
 | 38 |  ;               Subscript: Sequential # from 1 to n
 | 
|---|
 | 39 |  ;               Piece     Description
 | 
|---|
 | 40 |  ;                 1       IEN of DIALOG file
 | 
|---|
 | 41 |  ;  Returned: 1 if ok, 0 if error
 | 
|---|
 | 42 |  ;
 | 
|---|
 | 43 | ST N SCTM,SCTM0,SCPRP,SCTMAU
 | 
|---|
 | 44 |  N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
 | 
|---|
 | 45 |  G:'$$OKDATA PRACQ ;check/setup variables
 | 
|---|
 | 46 |  ;
 | 
|---|
 | 47 |  ; -- loop through autolink assignments
 | 
|---|
 | 48 |  S SCTM=0
 | 
|---|
 | 49 |  F  S SCTM=$O(^SCTM(404.56,"AC",SCAU,SCTM)) Q:'SCTM  D
 | 
|---|
 | 50 |  .S SCTM0=$G(^SCTM(404.51,SCTM,0))
 | 
|---|
 | 51 |  .Q:SCTM0=""
 | 
|---|
 | 52 |  .S SCPRP=$P(SCTM0,U,3)
 | 
|---|
 | 53 |  .Q:'$$OKARRAY^SCAPU1(.SCPURPA,SCPRP)
 | 
|---|
 | 54 |  .S ACTHIST=$$ACTHIST^SCAPMCU2(404.58,SCTM,SCDATES,.SCERR,"SCTMAU")
 | 
|---|
 | 55 |  .IF ACTHIST>0 D
 | 
|---|
 | 56 |  ..Q:$D(@SCLIST@("SCTM",SCTM,$P(ACTHIST,U,3)))
 | 
|---|
 | 57 |  ..S SCN=$G(@SCLIST@(0),0)+1
 | 
|---|
 | 58 |  ..S @SCLIST@(0)=SCN
 | 
|---|
 | 59 |  ..S @SCLIST@(SCN)=SCTM_U_$P(^SCTM(404.51,SCTM,0),U,1)_U_$P(ACTHIST,U,3,4)
 | 
|---|
 | 60 |  ..S @SCLIST@("SCTM",SCTM,$P(ACTHIST,U,3),SCN)=""
 | 
|---|
 | 61 | PRACQ Q $G(@SCERR@(0))<1
 | 
|---|
 | 62 | OKDATA() ;check/setup variables
 | 
|---|
 | 63 |  N SCOK
 | 
|---|
 | 64 |  S SCOK=1
 | 
|---|
 | 65 |  D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
 | 
|---|
 | 66 |  IF '$D(^SCTM(404.56,"AC",SCAU)) D  S SCOK=0
 | 
|---|
 | 67 |  . S SCPARM("AUTOLINK")=SCAU
 | 
|---|
 | 68 |  . D ERR^SCAPMCU1(SCESEQ,4045601,.SCPARM,"",.SCERR)
 | 
|---|
 | 69 |  ; -- is it a valid SCAU passed (Error # 4045601 in DIALOG file)
 | 
|---|
 | 70 |  Q SCOK
 | 
|---|