| 1 | SCRPBK ;MJK/ALB - RPC Broker Utilities ; 27 FEB 96
 | 
|---|
| 2 |  ;;5.3;Scheduling;**41**;AUG 13, 1993
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | GETREC(SCDATA,SCRPT) ; -- get REPORT record
 | 
|---|
| 5 |  ; input  :     SCRPT := ien of report definition
 | 
|---|
| 6 |  ; output : SCDATA is the return array
 | 
|---|
| 7 |  ;          SCDATA(0) := 0th node of rpt def
 | 
|---|
| 8 |  ;             (1..n) := sections for
 | 
|---|
| 9 |  ;                       [Description], [Sorts], [Fields], [Files]
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  ; Related RPC: SCRP DEFINITION GETRECORD
 | 
|---|
| 12 |  ;
 | 
|---|
| 13 |  N SC,X,SCINC
 | 
|---|
| 14 |  S SCINC=-1,SCRPT=+SCRPT
 | 
|---|
| 15 |  ; -- get 0th node of team
 | 
|---|
| 16 |  S X=$$RPTDEF(SCRPT)
 | 
|---|
| 17 |  ; -- add to return array
 | 
|---|
| 18 |  D SET(X,.SCINC,.SCDATA)
 | 
|---|
| 19 |  ; -- get description
 | 
|---|
| 20 |  D DESC(.SCINC,SCRPT,.SCDATA)
 | 
|---|
| 21 |  ; -- get sorts
 | 
|---|
| 22 |  D SORTS(.SCINC,SCRPT,.SCDATA)
 | 
|---|
| 23 |  ; -- get fields
 | 
|---|
| 24 |  D FIELDS(.SCINC,SCRPT,.SCDATA)
 | 
|---|
| 25 |  ; -- get files
 | 
|---|
| 26 |  D FILES(.SCINC,SCRPT,.SCDATA)
 | 
|---|
| 27 |  Q
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 | SET(X,INC,SCDATA) ; -- set value in return array
 | 
|---|
| 30 |  S INC=$G(INC)+1,SCDATA(INC)=X
 | 
|---|
| 31 |  Q
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 | RPTDEF(SCRPT) ; -- retrieve rpt def demographics
 | 
|---|
| 34 |  N X,Y
 | 
|---|
| 35 |  S X=$G(^SD(404.92,SCRPT,0))
 | 
|---|
| 36 |  S Y=$P(X,U)_U_$P($G(^SD(404.94,+$P(X,U,2),0)),U)
 | 
|---|
| 37 |  Q Y
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 | DESC(SCINC,SCRPT,SCDATA) ; -- get rpt description
 | 
|---|
| 40 |  N I,X
 | 
|---|
| 41 |  D SET("[Description]",.SCINC,.SCDATA)
 | 
|---|
| 42 |  S I=0 F  S I=$O(^SD(404.92,SCRPT,1,I)) Q:'I  S X=$G(^(I,0)) D
 | 
|---|
| 43 |  . D SET(X,.SCINC,.SCDATA)
 | 
|---|
| 44 |  D SET("$$END",.SCINC,.SCDATA)
 | 
|---|
| 45 |  Q
 | 
|---|
| 46 |  ;
 | 
|---|
| 47 | SORTS(SCINC,SCRPT,SCDATA) ; -- get possible sorts
 | 
|---|
| 48 |  N I,X
 | 
|---|
| 49 |  D SET("[Sorts]",.SCINC,.SCDATA)
 | 
|---|
| 50 |  S I=0 F  S I=$O(^SD(404.92,SCRPT,"SORTS",I)) Q:'I  S X=$G(^(I,0)) D
 | 
|---|
| 51 |  . D SET(X,.SCINC,.SCDATA)
 | 
|---|
| 52 |  D SET("$$END",.SCINC,.SCDATA)
 | 
|---|
| 53 |  Q
 | 
|---|
| 54 |  ;
 | 
|---|
| 55 | FIELDS(SCINC,SCRPT,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.92,SCRPT,"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 ; required
 | 
|---|
| 62 |  . S Y=Y_$P(X,U,3)_U ; always ask
 | 
|---|
| 63 |  . S Y=Y_$P(X,U,4)_U ; default value
 | 
|---|
| 64 |  . D SET(Y,.SCINC,.SCDATA)
 | 
|---|
| 65 |  D SET("$$END",.SCINC,.SCDATA)
 | 
|---|
| 66 |  Q
 | 
|---|
| 67 |  ;
 | 
|---|
| 68 | FILES(SCINC,SCRPT,SCDATA) ; -- get files to select
 | 
|---|
| 69 |  N I,X,Y,SCTYPE
 | 
|---|
| 70 |  D SET("[Files]",.SCINC,.SCDATA)
 | 
|---|
| 71 |  S I=0 F  S I=$O(^SD(404.92,SCRPT,"FILES",I)) Q:'I  S X=$G(^(I,0)) D
 | 
|---|
| 72 |  . S SCTYPE=$$TYPE(+X)
 | 
|---|
| 73 |  . S Y=""
 | 
|---|
| 74 |  . S Y=Y_SCTYPE_U ; file type
 | 
|---|
| 75 |  . S Y=Y_+X_U ; file #
 | 
|---|
| 76 |  . S Y=Y_+$P(X,U,2)_U ; selections allowed
 | 
|---|
| 77 |  . IF $$CHKTYPE^SCRPBK2(SCTYPE) D SET(Y,.SCINC,.SCDATA)
 | 
|---|
| 78 |  D SET("$$END",.SCINC,.SCDATA)
 | 
|---|
| 79 |  Q
 | 
|---|
| 80 |  ;
 | 
|---|
| 81 | TYPE(FILENUM) ; -- determine file type for file
 | 
|---|
| 82 |  N X
 | 
|---|
| 83 |  S X=""
 | 
|---|
| 84 |  IF FILENUM=4 S X="DIVISION" G TYPEQ
 | 
|---|
| 85 |  IF FILENUM=404.51 S X="TEAM" G TYPEQ
 | 
|---|
| 86 |  IF FILENUM=200 S X="PRACTITIONER" G TYPEQ
 | 
|---|
| 87 |  IF FILENUM=403.46 S X="ROLE" G TYPEQ
 | 
|---|
| 88 |  IF FILENUM=8930 S X="USERCLASS" G TYPEQ
 | 
|---|
| 89 |  IF FILENUM=44 S X="CLINIC" G TYPEQ
 | 
|---|
| 90 | TYPEQ Q X
 | 
|---|
| 91 |  ;
 | 
|---|
| 92 |  ;
 | 
|---|
| 93 |  ; -- variable descriptions for SCRPBK* routines 
 | 
|---|
| 94 |  ; SCDATA  -> result return array
 | 
|---|
| 95 |  ; SCINC   -> incrmental variable used when build SCDATA
 | 
|---|
| 96 |  ; SCQRY   -> ien of 404.95
 | 
|---|
| 97 |  ; SCQDEF  -> raw query defintion received from client
 | 
|---|
| 98 |  ; SCQREC  -> query definition
 | 
|---|
| 99 |  ; SCRPT   -> ien of 404.92 - query definition
 | 
|---|
| 100 |  ; SCRPTID -> ien of 404.92 - report definifion
 | 
|---|
| 101 |  ; SCRPT   -> report name
 | 
|---|
| 102 |  ; SCTYPE  -> selection file type (DIVISION, TEAM, etc.)
 | 
|---|
| 103 |  ; SCGLB   -> closed global root of a file [i.e. ^SC]
 | 
|---|
| 104 |  ; SCAN    -> array where the name of used/required report
 | 
|---|
| 105 |  ;            fields or file selections are stored
 | 
|---|
| 106 |  ; SCPROC  -> process being performed when error occured
 | 
|---|
| 107 |  ; SCPARM()-> error parameters to be used by BLD^DIALOG call
 | 
|---|
| 108 |  ; SCLOG   -> contains the array name where application generated
 | 
|---|
| 109 |  ;            error messages are stored(usually SCDATA)
 | 
|---|
| 110 |  ; SCERR() -> array where FM DBS generated errors are stored
 | 
|---|
| 111 |  ; SCTEXT  -> text used to search files
 | 
|---|
| 112 |  ; SCSELS()-> array of file entry selections
 | 
|---|
| 113 |  ; VAUTD() -> array of divisions subscripted by iens
 | 
|---|
| 114 |  ; VAUTT() -> array of teams subscripted by iens
 | 
|---|
| 115 |  ; VAUTP() -> array of practitioners subscripted by iens
 | 
|---|
| 116 |  ; VAUTR() -> array of roles subscripted by iens
 | 
|---|
| 117 |  ; VAUTC() -> array of clinics subscripted by iens
 | 
|---|
| 118 |  ; VAUTUC()-> array of user classes subscripted by iens
 | 
|---|
| 119 |  ; 
 | 
|---|