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

SCAPMC24.m

Go to the documentation of this file.
  1. SCAPMC24 ;ALB/REW - Team API's:TPTM ; 27 Jun 99 3:05 PM
  1. ;;5.3;Scheduling;**41,148,177**;AUG 13, 1993
  1. ;;1.0
  1. TPTM(SCTM,SCDATES,SCUSRA,SCROLEA,SCLIST,SCERR) ; -- positions for a pract
  1. ; input:
  1. ; SCTM = ien of TEAM File (#404.51) [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. ; SCUSRA -array of pointers to user file - 8930
  1. ; if none are defined - returns all usr classes
  1. ; if @SCPURPA@('exclude') is defined - exclude listed usr class
  1. ; SCROLEA - array of pointers to std position file 403.46 (per scusra)
  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.59 ien ^actdt^inacdt
  1. ;
  1. ;
  1. ST N SCPTTP,SCPTTP0,SCTP,SCR,SCACTHIS,SCND,SCTPTM,SCTPA
  1. N SCLSEQ,SCN,SCESEQ,SCPARM,SCBEGIN,SCEND,SCINCL,SCDTS
  1. ; -- initialize control variables
  1. G:'$$OKDATA PRACQ
  1. ; -- loop through team positionS
  1. S (SCTP,SCTPA)=0
  1. F S SCTP=$O(^SCTM(404.57,"C",SCTM,SCTP)) Q:'SCTP Q:'$$TPVALBLD(SCTP,.SCDATES,.SCPOSA,.SCUSA,.SCPURPA,.SCROLEA,.SCLIST,.SCERR)
  1. PRACQ Q $G(@SCERR@(0))<1
  1. ;
  1. TPVALBLD(SCTP,SCDATES,SCPOSA,SCUSA,SCPURPA,SCROLEA,SCLIST,SCERR) ;
  1. ; this validates a team position & builds sclist array
  1. ; returns 1 if ok, 0 if error
  1. N SCTPDT,SCDDDD,SCTP0,SCU,SCR,SCTM
  1. M SCDDDD=@SCDATES
  1. S SCTP0=$G(^SCTM(404.57,SCTP,0))
  1. S SCTPDT=-9999999 F S SCTPDT=$O(^SCTM(404.59,"AIDT",SCTP,1,SCTPDT)) Q:'SCTPDT D
  1. .S SCACTHIS=$$ACTHIST^SCAPMCU2(404.59,SCTP,"SCDDDD",.SCERR,"SCTPTM")
  1. .Q:'SCACTHIS
  1. .S SCND=$G(^SCTM(404.57,SCTP,0))
  1. .S SCU=$P(SCND,U,13)
  1. .Q:'$$OKUSRCL^SCAPU1(.SCUSRA,.SCU)
  1. .S SCR=+$P(SCND,U,3)
  1. .Q:'$$OKARRAY^SCAPU1(.SCROLEA,.SCR)
  1. .D BLD(.SCLIST,$P(SCTP0,U,2),SCTP,SCACTHIS,SCR)
  1. .S SCDDDD("END")=$P(SCACTHIS,U,3)-.00001
  1. QTVALBLD Q $G(@SCERR@(0))<1
  1. ;
  1. BLD(SCLIST,SCTM,SCTP,SCACTHIS,SCR) ; -- build list of positions
  1. ;
  1. ; SCLIST - output array
  1. ; SCTM - pointer to 404.51
  1. ; SCTP - pointer to 404.57
  1. ; SCACTHIS- per $$acthis^scapmcu2(file,ien)
  1. ; SCPTA - ien of pt team assignment
  1. ; SCR - role
  1. ;
  1. ; this builds the array:
  1. ; sclist(1->n)=SCTP^positionname^sctm^histien^effdt^inactdt^scr^rolename^scusr^usrname
  1. ;
  1. ; for each scpta zero node passed to it
  1. ; AND a xref sclist('SCTP',SCTM,scpt,histien,scn)=""
  1. N SCEFFDT,SCCNT,SCN,SCUSR
  1. S:'$G(SCTM) SCTM=$P($G(^SCTM(404.57,+$G(SCTP),0)),U,2)
  1. Q:$D(@SCLIST@("SCTP",SCTM,SCTP,$P(SCACTHIS,U,2)))
  1. S SCN=$G(@SCLIST@(0),0)+1
  1. S @SCLIST@(0)=SCN
  1. S SCUSR=+$P(^SCTM(404.57,SCTP,0),U,13)
  1. ; 1 ^ 2 ^ 3 ^ 4
  1. ;
  1. ;;bp/djb/11-2-98/Added STATUS field to the output array (SRS 3.2.3).
  1. ;;old code begin
  1. ;S @SCLIST@(SCN)=SCTP_U_$P($G(^SCTM(404.57,SCTP,0)),U,1)_U_SCTM_U_$P(SCACTHIS,U,2,4)_U_SCR_U_$P($G(^SD(403.46,SCR,0)),U,1)_U_SCUSR_U_$P($G(^USR(8930,SCUSR,0)),U,1)_U_$P($G(SCPTTP0),U,1)
  1. ;;old code end
  1. ;;new code begin
  1. S @SCLIST@(SCN)=SCTP_U_$P($G(^SCTM(404.57,SCTP,0)),U,1)_U_SCTM_U_$P(SCACTHIS,U,2,4)_U_SCR_U_$P($G(^SD(403.46,SCR,0)),U,1)_U_SCUSR_U_$P($G(^USR(8930,SCUSR,0)),U,1)_U_$P($G(SCPTTP0),U,1)
  1. ;;new code end
  1. ;
  1. ;THE 11TH $P WAS ADDED BY JLU
  1. S @SCLIST@("SCTP",SCTM,SCTP,$P(SCACTHIS,U,2),SCN)=""
  1. Q
  1. OKDATA() ;setup/check variables
  1. N SCOK
  1. S SCOK=1
  1. D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
  1. IF '$D(^SCTM(404.51,+$G(SCTM),0)) D S SCOK=0
  1. . S SCPARM("Team")=$G(SCTM,"Undefined")
  1. . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
  1. Q SCOK
  1. ;