| 1 | SCAPMC12 ;ALB/REW - Team API's: TPPR ; 2/10/00 8:14am
 | 
|---|
| 2 |  ;;5.3;Scheduling;**41,204**;AUG 13, 1993
 | 
|---|
| 3 |  ;;1.0
 | 
|---|
| 4 | TPPR(SC200,SCDATES,SCPURPA,SCROLEA,SCLIST,SCERR) ; -- positions for a pract
 | 
|---|
| 5 |  ; input:
 | 
|---|
| 6 |  ; SC200 = ien of NEW PERSON file(#200) [required]
 | 
|---|
| 7 |  ; SCDATES("BEGIN") = begin date to search (inclusive)
 | 
|---|
| 8 |  ;                      [default: TODAY]
 | 
|---|
| 9 |  ;        ("END")   = end date to search (inclusive)
 | 
|---|
| 10 |  ;                      [default: TODAY]
 | 
|---|
| 11 |  ;        ("INCL")  = 1: only use patients who were assigned to
 | 
|---|
| 12 |  ;                       team for entire date range
 | 
|---|
| 13 |  ;                    0: anytime in date range
 | 
|---|
| 14 |  ;                      [default: 1] 
 | 
|---|
| 15 |  ;  SCPURPA -array of pointers to team purpose file 403.47
 | 
|---|
| 16 |  ;          if none are defined - returns all teams
 | 
|---|
| 17 |  ;          if @SCPURPA@('exclude') is defined - exclude listed teams
 | 
|---|
| 18 |  ;  SCROLEA - array of pointers to standard position file 403.46
 | 
|---|
| 19 |  ;          if none are defined - returns all positions
 | 
|---|
| 20 |  ;          if @SCROLEA@('exclude') is defined - exclude listed roles
 | 
|---|
| 21 |  ;  SCLIST -array name to store list
 | 
|---|
| 22 |  ;          [ex. ^TMP("SCPT",$J)]
 | 
|---|
| 23 |  ;        
 | 
|---|
| 24 |  ;  SCERR = array NAME to store error messages.
 | 
|---|
| 25 |  ;          [ex. ^TMP("ORXX",$J)]
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 |  ; Output:
 | 
|---|
| 28 |  ;  SCLIST() = array of positions (includes SCTP xref)
 | 
|---|
| 29 |  ;             Format:
 | 
|---|
| 30 |  ;               Subscript: Sequential # from 1 to n
 | 
|---|
| 31 |  ;               Piece     Description
 | 
|---|
| 32 |  ;                 1       IEN of TEAM POSITION File (#404.57)
 | 
|---|
| 33 |  ;                 2       Name of Position
 | 
|---|
| 34 |  ;                 3       IEN of Team #404.51
 | 
|---|
| 35 |  ;                 4       IEN of file #404.59 (Tm Pos History)
 | 
|---|
| 36 |  ;                 5       current effective date
 | 
|---|
| 37 |  ;                 6       current inactivate date (if any)
 | 
|---|
| 38 |  ;                 7       pointer to 403.46 (role)
 | 
|---|
| 39 |  ;                 8       Name of Standard Role
 | 
|---|
| 40 |  ;                 9       pointer to User Class (#8930)
 | 
|---|
| 41 |  ;                10       Name of User Class
 | 
|---|
| 42 |  ;                Subscript: "SCTP",SCTM,IEN =""
 | 
|---|
| 43 |  ;
 | 
|---|
| 44 |  ;  SCERR() = Array of DIALOG file messages(errors) .
 | 
|---|
| 45 |  ;  @SCERR@(0) = number of errors, undefined if none
 | 
|---|
| 46 |  ;             Format:
 | 
|---|
| 47 |  ;               Subscript: Sequential # from 1 to n
 | 
|---|
| 48 |  ;               Piece     Description
 | 
|---|
| 49 |  ;                 1       IEN of DIALOG file
 | 
|---|
| 50 |  ;  Returned: 1 if ok, 0 if error
 | 
|---|
| 51 |  ;
 | 
|---|
| 52 |  ;
 | 
|---|
| 53 | ST N SCTPA,SCTPA,SCTPA0,SCTP,SCR,SCACTHIS,SCTM,SCTPPR,SCPTA
 | 
|---|
| 54 |  N SCLSEQ,SCN,SCESEQ,SCPARM,SCBEGIN,SCEND,SCINCL,SCDTS
 | 
|---|
| 55 |  ; -- initialize control variables
 | 
|---|
| 56 |  G:'$$OKDATA PRACQ
 | 
|---|
| 57 |  ; -- loop through position assignment history
 | 
|---|
| 58 |  S SCTPA=0
 | 
|---|
| 59 |  F  S SCTPA=$O(^SCTM(404.52,"C",SC200,SCTPA)) Q:'SCTPA  D
 | 
|---|
| 60 |  .S SCTPA0=$G(^SCTM(404.52,SCTPA,0))
 | 
|---|
| 61 |  .S SCTP=+$P(SCTPA0,U,1)
 | 
|---|
| 62 |  .Q:'SCTP
 | 
|---|
| 63 |  .S SCTM=+$P($G(^SCTM(404.57,SCTP,0)),U,2)
 | 
|---|
| 64 |  .Q:'SCTM
 | 
|---|
| 65 |  .S SCACTHIS=$$ACTHIST^SCAPMCU2(404.52,SCTP,SCDATES,SCERR,"SCTPPR")
 | 
|---|
| 66 |  .Q:'SCACTHIS
 | 
|---|
| 67 |  .;
 | 
|---|
| 68 |  .;djb/bp Next line fixes NOIS NOP-0499-11252 & ISA-0899-12551
 | 
|---|
| 69 |  .Q:$P(SCACTHIS,"^",2)'=SCTPA
 | 
|---|
| 70 |  .;
 | 
|---|
| 71 |  .S SCP=+$P($G(^SCTM(404.51,+SCTM,0)),U,3)
 | 
|---|
| 72 |  .Q:'$$OKARRAY^SCAPU1(.SCPURPA,.SCP)
 | 
|---|
| 73 |  .S SCPTA=0
 | 
|---|
| 74 |  .S SCR=+$P($G(^SCTM(404.57,SCTP,0)),U,3)
 | 
|---|
| 75 |  .Q:'$$OKARRAY^SCAPU1(.SCROLEA,.SCR)
 | 
|---|
| 76 |  .D BLD^SCAPMC24(.SCLIST,SCTM,SCTP,SCACTHIS,SCR)
 | 
|---|
| 77 | PRACQ Q $G(@SCERR@(0))<1
 | 
|---|
| 78 |  ;
 | 
|---|
| 79 | OKDATA() ;setup/check variables
 | 
|---|
| 80 |  N SCOK
 | 
|---|
| 81 |  S SCOK=1
 | 
|---|
| 82 |  D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
 | 
|---|
| 83 |  IF '$D(^VA(200,+$G(SC200),0)) D  S SCOK=0
 | 
|---|
| 84 |  . S SCPARM("Practitioner")=$G(SC200,"Undefined")
 | 
|---|
| 85 |  . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
 | 
|---|
| 86 |  ;
 | 
|---|
| 87 |  Q SCOK
 | 
|---|
| 88 |  ;
 | 
|---|