source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCAPMC30.m@ 1259

Last change on this file since 1259 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 3.4 KB
RevLine 
[623]1SCAPMC30 ;ALB/REW - TEAM APIs:TPCL ; 30 Jun 95
2 ;;5.3;Scheduling;**41**;AUG 13, 1993
3 ;;1.0
4TPCL(SC44,SCDATES,SCPOSA,SCUSRA,SCPURPA,SCROLEA,SCLIST,SCERR) ; -- list of positions for a clinic
5 ; input:
6 ; SC44 = ien of HOSPITAL LOCATION <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 patients who were assigned to
12 ; team for entire date range
13 ; 0: anytime in date range
14 ; [default: 1]
15 ; SCPOSA -array of pointers to team position - 404.57 (per SCPURPA)
16 ; SCUSRA -array of pointers to user file - 8930 (per SCPURPA array)
17 ; SCPURPA -array of pointers to team purpose file 403.47
18 ; if none are defined - returns all teams
19 ; if @SCPURPA@('exclude') is defined - exclude listed teams
20 ; SCROLEA - array of pointers to std position file 403.46 (per SCPURPA)
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 ; Other:
52 ; SCACTHIS = status (-1:err|0:inact|1:act)^404.52 ien ^actdt^inacdt
53 ;
54 ;
55ST N SCPTTP,SCPTTP0,SCTP,SCR,SCACTHIS,SCTM,SCND,SCU,SCOK,SCP,SCTPCL
56 N SCLSEQ,SCN,SCESEQ,SCPARM,SCBEGIN,SCEND,SCINCL,SCDTS
57 ; -- initialize control variables
58 S SCOK=1
59 G:'$$OKDATA CLTPQ
60 S SCTP=0 F S SCTP=$O(^SCTM(404.57,"D",SC44,SCTP)) Q:'SCTP D Q:'SCOK
61 .S SCTP0=$G(^SCTM(404.57,SCTP,0))
62 .IF '$L(SCTP0) D
63 ..S SCPARM("POSITION")=$G(SCTP,"Undefined")
64 ..S SCPARM("CLINIC")=$G(SC44,"Undefined")
65 ..D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
66 .S SCTM=$P($G(^SCTM(404.57,SCTP,0)),U,2)
67 .S SCP=$P(^SCTM(404.51,+SCTM,0),U,3)
68 .Q:'$$OKARRAY^SCAPU1(.SCPURPA,.SCP)
69 .S SCR=+$P(^SCTM(404.57,SCTP,0),U,3)
70 .Q:'$$OKARRAY^SCAPU1(.SCROLEA,.SCR)
71 .S SCACTHIS=$$ACTHIST^SCAPMCU2(404.59,SCTP,SCDATES,SCERR,"SCTPCL")
72 .Q:'SCACTHIS
73 .D BLD^SCAPMC24(.SCLIST,SCTM,SCTP,SCACTHIS,SCR)
74CLTPQ Q $G(@SCERR@(0))<1
75 ;
76OKDATA() ;check/setup variables - return 1 if ok; 0 if error
77 N SCOK
78 S SCOK=1
79 D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
80 IF '$D(^SC(+$G(SC44),0)) D S SCOK=0
81 . S SCPARM("CLINIC")=$G(SC44,"Undefined")
82 . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
83 Q SCOK
Note: See TracBrowser for help on using the repository browser.