source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCRPBK0.m@ 1270

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

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1SCRPBK0 ;MJK/ALB - RPC Broker Utilities ; 27 FEB 96
2 ;;5.3;Scheduling;**41**;AUG 13, 1993
3 ;
4GETREC(SCDATA,SCQRY) ; -- get QUERY record
5 ; input : SCQRY := ien of query definition
6 ; output : SCDATA is the return array
7 ; SCDATA(0) := 0th node of qry def
8 ; (1) := externals for 0th
9 ; (2..n) := sections for
10 ; [Description], [Fields], [Selections]
11 ;
12 ; -- SEE BOTTOM OF SCRPBK FOR MORE VARIABLE DEFINITIONS
13 ;
14 ; Related RPC: SCRP QUERY GETRECORD
15 ;
16 N SC,X,SCINC
17 S SCINC=-1,SCQRY=+SCQRY
18 ; -- get 0th node of team
19 D QRYDEF(.X,SCQRY)
20 ; -- add 0TH to return array
21 D SET(X(0),.SCINC,.SCDATA)
22 ; -- add external values for 0th to ret array
23 D SET(X(1),.SCINC,.SCDATA)
24 ; -- get description
25 D DESC(.SCINC,SCQRY,.SCDATA)
26 ; -- get fields
27 D FIELDS(.SCINC,SCQRY,.SCDATA)
28 ; -- get files
29 D SELECT(.SCINC,SCQRY,.SCDATA)
30 Q
31 ;
32SET(X,INC,SCDATA) ; -- set value in return array
33 S INC=$G(INC)+1,SCDATA(INC)=X
34 Q
35 ;
36QRYDEF(X,SCQRY) ; -- retrieve rpt def demographics
37 N Y,Z
38 S Y=$G(^SD(404.95,SCQRY,0))
39 S X(0)=Y ; 0th node
40 S X(1)=SCQRY ; query name
41 S $P(X(1),U,2)=$P($G(^VA(200,+$P(Y,U,2),0)),U) ; creator
42 S $P(X(1),U,3)=$S($P(Y,U,3)=1:"PRIVATE",1:"PUBLIC") ; access level
43 S $P(X(1),U,4)=$P($G(^SD(404.92,+$P(Y,U,4),0)),U) ; report name
44 S $P(X(1),U,5)=$$FMTE^XLFDT($P(Y,U,5),"2FP")
45 Q
46 ;
47DESC(SCINC,SCQRY,SCDATA) ; -- get query description
48 N I,X
49 D SET("[Description]",.SCINC,.SCDATA)
50 S I=0 F S I=$O(^SD(404.95,SCQRY,1,I)) Q:'I S X=$G(^(I,0)) D
51 . D SET(X,.SCINC,.SCDATA)
52 D SET("$$END",.SCINC,.SCDATA)
53 Q
54 ;
55FIELDS(SCINC,SCQRY,SCDATA) ; -- get fields to ask
56 N I,X,Y
57 D SET("[Fields]",.SCINC,.SCDATA)
58 S I=0 F S I=$O(^SD(404.95,SCQRY,"FIELDS",I)) Q:'I S X=$G(^(I,0)) D
59 . S Y=""
60 . S Y=Y_$P($G(^SD(404.93,+X,0)),U,2)_U ; component name
61 . S Y=Y_$P(X,U,2)_U ; value
62 . D SET(Y,.SCINC,.SCDATA)
63 D SET("$$END",.SCINC,.SCDATA)
64 Q
65 ;
66SELECT(SCINC,SCQRY,SCDATA) ; -- get files to select
67 N I,X,Y
68 D SET("[Selections]",.SCINC,.SCDATA)
69 S I=0 F S I=$O(^SD(404.95,SCQRY,"FILES",I)) Q:'I S X=$G(^(I,0)) D
70 . IF X["DIC(4" S SCGLB="^DIC(4)",SCTYPE="DIVISION"
71 . IF X["SCTM(404.51" S SCGLB="^SCTM(404.51)",SCTYPE="TEAM"
72 . IF X["VA(200" S SCGLB="^VA(200)",SCTYPE="PRACTITIONER"
73 . IF X["SD(403.46" S SCGLB="^SD(403.46)",SCTYPE="ROLE"
74 . IF X["USR(8930" S SCGLB="^USR(8930)",SCTYPE="USERCLASS"
75 . IF X["SC(" S SCGLB="^SC",SCTYPE="CLINIC"
76 . IF $D(@SCGLB@(+X,0)) D SET($P(^(0),U)_U_SCTYPE_U_+X,.SCINC,.SCDATA)
77 D SET("$$END",.SCINC,.SCDATA)
78 Q
79 ;
Note: See TracBrowser for help on using the repository browser.