SCAPMC30 ;ALB/REW - TEAM APIs:TPCL ; 30 Jun 95
;;5.3;Scheduling;**41,520**;AUG 13, 1993;Build 26
;;1.0
TPCL(SC44,SCDATES,SCPOSA,SCUSRA,SCPURPA,SCROLEA,SCLIST,SCERR) ; -- list of positions for a clinic
; input:
; SC44 = ien of HOSPITAL LOCATION <FILE#44> [required]
; SCDATES("BEGIN") = begin date to search (inclusive)
; [default: TODAY]
; ("END") = end date to search (inclusive)
; [default: TODAY]
; ("INCL") = 1: only use patients who were assigned to
; team for entire date range
; 0: anytime in date range
; [default: 1]
; SCPOSA -array of pointers to team position - 404.57 (per SCPURPA)
; SCUSRA -array of pointers to user file - 8930 (per SCPURPA array)
; SCPURPA -array of pointers to team purpose file 403.47
; if none are defined - returns all teams
; if @SCPURPA@('exclude') is defined - exclude listed teams
; SCROLEA - array of pointers to std position file 403.46 (per SCPURPA)
; SCLIST -array name to store list
; [ex. ^TMP("SCPT",$J)]
;
; SCERR = array NAME to store error messages.
; [ex. ^TMP("ORXX",$J)]
;
; Output:
; SCLIST() = array of positions (includes SCTP xref)
; Format:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 IEN of TEAM POSITION File (#404.57)
; 2 Name of Position
; 3 IEN of Team #404.51
; 4 IEN of file #404.59 (Tm Pos History)
; 5 current effective date
; 6 current inactivate date (if any)
; 7 pointer to 403.46 (role)
; 8 Name of Standard Role
; 9 pointer to User Class (#8930)
; 10 Name of User Class
; Subscript: "SCTP",SCTM,IEN =""
;
; SCERR() = Array of DIALOG file messages(errors) .
; @SCERR@(0) = number of errors, undefined if none
; Format:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 IEN of DIALOG file
; Returned: 1 if ok, 0 if error
; Other:
; SCACTHIS = status (-1:err|0:inact|1:act)^404.52 ien ^actdt^inacdt
;
;
ST N SCPTTP,SCPTTP0,SCTP,SCR,SCACTHIS,SCTM,SCND,SCU,SCOK,SCP,SCTPCL
N SCLSEQ,SCN,SCESEQ,SCPARM,SCBEGIN,SCEND,SCINCL,SCDTS
; -- initialize control variables
S SCOK=1
G:'$$OKDATA CLTPQ
S SCTP=0 F S SCTP=$O(^SCTM(404.57,"E",SC44,SCTP)) Q:'SCTP D Q:'SCOK
.S SCTP0=$G(^SCTM(404.57,SCTP,0))
.IF '$L(SCTP0) D
..S SCPARM("POSITION")=$G(SCTP,"Undefined")
..S SCPARM("CLINIC")=$G(SC44,"Undefined")
..D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
.S SCTM=$P($G(^SCTM(404.57,SCTP,0)),U,2)
.S SCP=$P(^SCTM(404.51,+SCTM,0),U,3)
.Q:'$$OKARRAY^SCAPU1(.SCPURPA,.SCP)
.S SCR=+$P(^SCTM(404.57,SCTP,0),U,3)
.Q:'$$OKARRAY^SCAPU1(.SCROLEA,.SCR)
.S SCACTHIS=$$ACTHIST^SCAPMCU2(404.59,SCTP,SCDATES,SCERR,"SCTPCL")
.Q:'SCACTHIS
.D BLD^SCAPMC24(.SCLIST,SCTM,SCTP,SCACTHIS,SCR)
CLTPQ Q $G(@SCERR@(0))<1
;
OKDATA() ;check/setup variables - return 1 if ok; 0 if error
N SCOK
S SCOK=1
D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
IF '$D(^SC(+$G(SC44),0)) D S SCOK=0
. S SCPARM("CLINIC")=$G(SC44,"Undefined")
. D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
Q SCOK
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCAPMC30 3560 printed Oct 16, 2024@18:38:42 Page 2
SCAPMC30 ;ALB/REW - TEAM APIs:TPCL ; 30 Jun 95
+1 ;;5.3;Scheduling;**41,520**;AUG 13, 1993;Build 26
+2 ;;1.0
TPCL(SC44,SCDATES,SCPOSA,SCUSRA,SCPURPA,SCROLEA,SCLIST,SCERR) ; -- list of positions for a clinic
+1 ; input:
+2 ; SC44 = ien of HOSPITAL LOCATION <FILE#44> [required]
+3 ; SCDATES("BEGIN") = begin date to search (inclusive)
+4 ; [default: TODAY]
+5 ; ("END") = end date to search (inclusive)
+6 ; [default: TODAY]
+7 ; ("INCL") = 1: only use patients who were assigned to
+8 ; team for entire date range
+9 ; 0: anytime in date range
+10 ; [default: 1]
+11 ; SCPOSA -array of pointers to team position - 404.57 (per SCPURPA)
+12 ; SCUSRA -array of pointers to user file - 8930 (per SCPURPA array)
+13 ; SCPURPA -array of pointers to team purpose file 403.47
+14 ; if none are defined - returns all teams
+15 ; if @SCPURPA@('exclude') is defined - exclude listed teams
+16 ; SCROLEA - array of pointers to std position file 403.46 (per SCPURPA)
+17 ; SCLIST -array name to store list
+18 ; [ex. ^TMP("SCPT",$J)]
+19 ;
+20 ; SCERR = array NAME to store error messages.
+21 ; [ex. ^TMP("ORXX",$J)]
+22 ;
+23 ; Output:
+24 ; SCLIST() = array of positions (includes SCTP xref)
+25 ; Format:
+26 ; Subscript: Sequential # from 1 to n
+27 ; Piece Description
+28 ; 1 IEN of TEAM POSITION File (#404.57)
+29 ; 2 Name of Position
+30 ; 3 IEN of Team #404.51
+31 ; 4 IEN of file #404.59 (Tm Pos History)
+32 ; 5 current effective date
+33 ; 6 current inactivate date (if any)
+34 ; 7 pointer to 403.46 (role)
+35 ; 8 Name of Standard Role
+36 ; 9 pointer to User Class (#8930)
+37 ; 10 Name of User Class
+38 ; Subscript: "SCTP",SCTM,IEN =""
+39 ;
+40 ; SCERR() = Array of DIALOG file messages(errors) .
+41 ; @SCERR@(0) = number of errors, undefined if none
+42 ; Format:
+43 ; Subscript: Sequential # from 1 to n
+44 ; Piece Description
+45 ; 1 IEN of DIALOG file
+46 ; Returned: 1 if ok, 0 if error
+47 ; Other:
+48 ; SCACTHIS = status (-1:err|0:inact|1:act)^404.52 ien ^actdt^inacdt
+49 ;
+50 ;
ST NEW SCPTTP,SCPTTP0,SCTP,SCR,SCACTHIS,SCTM,SCND,SCU,SCOK,SCP,SCTPCL
+1 NEW SCLSEQ,SCN,SCESEQ,SCPARM,SCBEGIN,SCEND,SCINCL,SCDTS
+2 ; -- initialize control variables
+3 SET SCOK=1
+4 if '$$OKDATA
GOTO CLTPQ
+5 SET SCTP=0
FOR
SET SCTP=$ORDER(^SCTM(404.57,"E",SC44,SCTP))
if 'SCTP
QUIT
Begin DoDot:1
+6 SET SCTP0=$GET(^SCTM(404.57,SCTP,0))
+7 IF '$LENGTH(SCTP0)
Begin DoDot:2
+8 SET SCPARM("POSITION")=$GET(SCTP,"Undefined")
+9 SET SCPARM("CLINIC")=$GET(SC44,"Undefined")
+10 DO ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
End DoDot:2
+11 SET SCTM=$PIECE($GET(^SCTM(404.57,SCTP,0)),U,2)
+12 SET SCP=$PIECE(^SCTM(404.51,+SCTM,0),U,3)
+13 if '$$OKARRAY^SCAPU1(.SCPURPA,.SCP)
QUIT
+14 SET SCR=+$PIECE(^SCTM(404.57,SCTP,0),U,3)
+15 if '$$OKARRAY^SCAPU1(.SCROLEA,.SCR)
QUIT
+16 SET SCACTHIS=$$ACTHIST^SCAPMCU2(404.59,SCTP,SCDATES,SCERR,"SCTPCL")
+17 if 'SCACTHIS
QUIT
+18 DO BLD^SCAPMC24(.SCLIST,SCTM,SCTP,SCACTHIS,SCR)
End DoDot:1
if 'SCOK
QUIT
CLTPQ QUIT $GET(@SCERR@(0))<1
+1 ;
OKDATA() ;check/setup variables - return 1 if ok; 0 if error
+1 NEW SCOK
+2 SET SCOK=1
+3 ; set default dates & error array (if undefined)
DO INIT^SCAPMCU1(.SCOK)
+4 IF '$DATA(^SC(+$GET(SC44),0))
Begin DoDot:1
+5 SET SCPARM("CLINIC")=$GET(SC44,"Undefined")
+6 DO ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
End DoDot:1
SET SCOK=0
+7 QUIT SCOK