| 1 | SCAPMC9 ;ALB/REW - Team API's:PRCL ; JUN 26, 1995 | 
|---|
| 2 | ;;5.3;Scheduling;**41,112,520**;AUG 13, 1993;Build 26 | 
|---|
| 3 | ;;1.0 | 
|---|
| 4 | PRCL(SC44,SCDATES,SCPOSA,SCUSRA,SCROLEA,SCLIST,SCERR) ;-- list of practitioners for clinic | 
|---|
| 5 | ; input: | 
|---|
| 6 | ;  SC44 = ien of CLINIC <FILE#44> [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 pracitioners who were on | 
|---|
| 12 | ;                       team for entire date range | 
|---|
| 13 | ;                     0: anytime in date range | 
|---|
| 14 | ;                      [default: 1] | 
|---|
| 15 | ;  SCPOSA= array of positions to include reverse with scposa('exclude') | 
|---|
| 16 | ;  SCUSRA= array of usr classes included reverse with scusra('exclude') | 
|---|
| 17 | ;  SCROLEA= array of roles included reverse with SCROLEA('exclude') | 
|---|
| 18 | ;  SCERR = array NAME to store error messages. | 
|---|
| 19 | ;          [ex. ^TMP("ORXX",$J)] | 
|---|
| 20 | ; | 
|---|
| 21 | ; Output: | 
|---|
| 22 | ;  SCLIST() = array of practitioners | 
|---|
| 23 | ;             Format: | 
|---|
| 24 | ;               Subscript: Sequential # from 1 to n | 
|---|
| 25 | ;               Piece     Description | 
|---|
| 26 | ;                 1       IEN of NEW PERSON file entry (#200) | 
|---|
| 27 | ;                 2       Name of person | 
|---|
| 28 | ;                 3       IEN of TEAM POSITION file (#404.57) | 
|---|
| 29 | ;                 4       Name of Position | 
|---|
| 30 | ;                 5       IEN OF USR CLASS(#8930) of POSITION (#404.57) | 
|---|
| 31 | ;                 6       USR Class Name | 
|---|
| 32 | ;                 7       IEN of STANDARD POSITION (#403.46) | 
|---|
| 33 | ;                 8       Standard Role (Position) Name | 
|---|
| 34 | ;                 9       Activation Date for 404.52 (not 404.59!) | 
|---|
| 35 | ;                 10      Inactivation Date for 404.52 | 
|---|
| 36 | ;                 11      IEN of Position Ass History (404.52) | 
|---|
| 37 | ;                 12      IEN of Preceptor Position | 
|---|
| 38 | ;                 13      Name of Preceptor Position | 
|---|
| 39 | ;  @sclist@('scpr',sc200,sctp,scact,scn)="" | 
|---|
| 40 | ; | 
|---|
| 41 | ;  SCERR() = Array of DIALOG file messages(errors) . | 
|---|
| 42 | ;             Foramt: | 
|---|
| 43 | ;  @SCERR@(0) = Number of errors, undefined if none | 
|---|
| 44 | ;               Subscript: Sequential # from 1 to n | 
|---|
| 45 | ;               Piece     Description | 
|---|
| 46 | ;                 1       IEN of DIALOG file | 
|---|
| 47 | ;   Returned: 1 if ok, 0 if error | 
|---|
| 48 | ; | 
|---|
| 49 | ; | 
|---|
| 50 | ST N SCPOSNM,SCTP,SCPOS0,SCOK,SCND,SCU,SCR,SCPRCL | 
|---|
| 51 | N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS | 
|---|
| 52 | ; -- initialize control variables | 
|---|
| 53 | G:'$$OKDATA PRACQ ; check/setup variables | 
|---|
| 54 | ; -- loop through team positions | 
|---|
| 55 | S SCTP=0 | 
|---|
| 56 | F  S SCTP=$O(^SCTM(404.57,"E",SC44,SCTP)) Q:SCTP=""  D | 
|---|
| 57 | .Q:'$$OKARRAY^SCAPU1(.SCPOSA,SCTP) | 
|---|
| 58 | .S SCND=$G(^SCTM(404.57,SCTP,0)) | 
|---|
| 59 | .S SCU=$P(SCND,U,13) | 
|---|
| 60 | .Q:'$$OKUSRCL^SCAPU1(.SCUSRA,SCU) | 
|---|
| 61 | .S SCR=$P(SCND,U,3) | 
|---|
| 62 | .Q:'$$OKARRAY^SCAPU1(.SCROLEA,.SCR) | 
|---|
| 63 | .IF 'SCTP D  Q | 
|---|
| 64 | ..S SCPARM("Position")=$G(SCTP,"Undefined") | 
|---|
| 65 | ..D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",SCERR) | 
|---|
| 66 | .ELSE  D | 
|---|
| 67 | ..S SCX=$$ACTHIST^SCAPMCU2(404.52,SCTP,SCDATES,.SCERR,"SCPRCL") | 
|---|
| 68 | ..S:SCX X=$$PRTP^SCAPMC8(SCTP,SCDATES,.SCLIST,.SCERR) | 
|---|
| 69 | PRACQ Q $G(@SCERR@(0))<1 | 
|---|
| 70 | OKDATA() ;check/setup variables - return 1 if ok/ 0 if error | 
|---|
| 71 | N SCOK | 
|---|
| 72 | S SCOK=1 | 
|---|
| 73 | D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined) | 
|---|
| 74 | ; | 
|---|
| 75 | IF '$D(^SC(+$G(SC44),0)) D  S SCOK=0 | 
|---|
| 76 | . S SCPARM("CLINIC")=$G(SC44,"Undefined") | 
|---|
| 77 | . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR) | 
|---|
| 78 | Q SCOK | 
|---|