source: FOIAVistA/trunk/r/FEE_BASIS-FB/FBUTL1.m@ 949

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

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1FBUTL1 ;WOIFO/SAB-FEE BASIS UTILITY ;6/17/2003
2 ;;3.5;FEE BASIS;**61**;JAN 30, 1995
3 Q
4 ;Extrinsic functions AR, AG, and RR have similar inputs and outputs
5 ; input
6 ; FBCI - Internal entry number of code.
7 ; Not required if external value is passed.
8 ; FBCE - External value of code.
9 ; Not required if internal value is passed.
10 ; If both the internal and external values are passed
11 ; then the external value will be ignored.
12 ; FBDT - Effective date.
13 ; Optional - DT (Today) will be used if a value is not passed.
14 ; An input date prior to 6/1/03 will be changed to be 6/1/03.
15 ; FBAR - Root of local or global array in which the description
16 ; word processing field will be returned.
17 ; Optional - description will not be returned if an array root
18 ; is not passed. The root should be in closed format
19 ; such as FBAR or FBAR(2) or ^TMP($J,"DESC").
20 ; The root should not be a variable name already used in FBUTL1
21 ; Returns a string value
22 ; Internal code ^ External code ^ HIPAA status ^ FEE status ^ name
23 ; OR if there is an error
24 ; -1^-1^^^error message text
25 ; where
26 ; internal code = internal entry number of code in file
27 ; external code = external value of code
28 ; HIPAA status = 1 (active) or 0 (inactive) as of effective date
29 ; FEE status = 1 (applicable) or 0 (not applicable) for fee claim
30 ; adjudication as of the effective date
31 ; name = a short descriptive name for the code as of the eff. date
32 ; name is only returned by AG (not returned by AR and RR)
33 ; error message text = an error message
34 ; Output
35 ; fbarr( - Array containing the description as of the effective date.
36 ; For example, if "FBTXT" was passed in parameter FBAR then
37 ; the output might be
38 ; FBTXT(1)=1st line of description
39 ; FBTXT(2)=2nd line of description
40 ; The array will be undefined if there is not a description
41 ;
42AR(FBCI,FBCE,FBDT,FBAR) ; ADJUSTMENT REASON extrinsic function
43 ; Provides status and description for an adjustment reason code
44 ; stored in the ADJUSTMENT REASON (#161.91) file.
45 ; see top of routine for additional documentation
46 N FBC,FBDT1,FBERR,FBRET
47 S FBRET="",FBERR=""
48 I $G(FBAR)]"" K @FBAR
49 ;
50 ; find code in file
51 D FNDCDE(161.91)
52 ;
53 ; set effective date for search
54 D SETDT
55 ;
56 ; determine status of code
57 I FBCI,FBERR="" D GETSTAT(161.91)
58 ;
59 ; if array root passed then determine description of code
60 I $G(FBAR)]"",FBCI,FBERR="" D GETDESC(161.91)
61 ;
62 I FBERR]"" S FBRET="-1^-1^^^"_FBERR
63 Q FBRET
64 ;
65AG(FBCI,FBCE,FBDT,FBAR) ; ADJUSTMENT GROUP extrinsic function
66 ; Provides status and description for an adjustment group code
67 ; stored in the ADJUSTMENT GROUP (#161.92) file.
68 ; see top of routine for additional documentation
69 N FBC,FBDT1,FBERR,FBRET
70 S FBRET="",FBERR=""
71 I $G(FBAR)]"" K @FBAR
72 ;
73 ; find code in file
74 D FNDCDE(161.92)
75 ;
76 ; set effective date for search
77 D SETDT
78 ;
79 ; determine status of code
80 I FBCI,FBERR="" D GETSTAT(161.92)
81 ;
82 ; determine name, description of code
83 I FBCI,FBERR="" D GETDESC(161.92)
84 ;
85 I FBERR]"" S FBRET="-1^-1^^^"_FBERR
86 Q FBRET
87 ;
88RR(FBCI,FBCE,FBDT,FBAR) ; REMITTANCE REMARK extrinsic function
89 ; Provides status and description for an adjustment reason code
90 ; stored in the REMITTANCE REMARK (#161.93) file.
91 ; see top of routine for additional documentation
92 N FBC,FBDT1,FBERR,FBRET
93 S FBRET="",FBERR=""
94 I $G(FBAR)]"" K @FBAR
95 ;
96 ; find code in file
97 D FNDCDE(161.93)
98 ;
99 ; set effective date for search
100 D SETDT
101 ;
102 ; determine status of code
103 I FBCI,FBERR="" D GETSTAT(161.93)
104 ;
105 ; if array root passed then determine description of code
106 I $G(FBAR)]"",FBCI,FBERR="" D GETDESC(161.93)
107 ;
108 I FBERR]"" S FBRET="-1^-1^^^"_FBERR
109 Q FBRET
110 ;
111FNDCDE(FBFILE) ; find code
112 ; determine ien if not passed
113 I $G(FBCI)="",$G(FBCE)]"" S FBCI=$O(^FB(FBFILE,"B",FBCE,0))
114 ; get data
115 I $G(FBCI) S FBC=$P($G(^FB(FBFILE,FBCI,0)),U)
116 I $G(FBC)="" S FBERR="CODE NOT FOUND IN FILE"
117 E S FBRET=FBCI_U_FBC
118 Q
119 ;
120SETDT ; set date
121 I $G(FBDT)'?7N S FBDT=DT ; if date not passed then set as Today
122 I FBDT<3030601 S FBDT=3030601 ; if date prior to 6/1/03 then set
123 S FBDT1=$$FMADD^XLFDT(FBDT,1) ; use date + 1 in reverse $Orders
124 Q
125 ;
126GETSTAT(FBFILE) ; get status
127 N FBFEEU,FBSEDT,FBSI,FBSTAT,FBSY
128 ; find most recent status effective date prior to the input date
129 S FBSEDT=$O(^FB(FBFILE,FBCI,1,"B",FBDT1),-1)
130 S:FBSEDT]"" FBSI=$O(^FB(FBFILE,FBCI,1,"B",FBSEDT,0))
131 S:$G(FBSI) FBSY=$G(^FB(FBFILE,FBCI,1,FBSI,0))
132 S:$G(FBSY)]"" FBSTAT=$P(FBSY,U,2),FBFEEU=$S('FBSTAT:0,1:+$P(FBSY,U,3))
133 I $G(FBSTAT)="" S FBERR="STATUS NOT AVAILABLE FOR SPECIFIED DATE" Q
134 S FBRET=FBRET_U_FBSTAT_U_FBFEEU
135 Q
136 ;
137GETDESC(FBFILE) ; get description
138 N FBDEDT,FBDI,FBDN,FBX
139 ; find most recent description effective date prior to input date
140 S FBDEDT=$O(^FB(FBFILE,FBCI,2,"B",FBDT1),-1)
141 S:FBDEDT]"" FBDI=$O(^FB(FBFILE,FBCI,2,"B",FBDEDT,0))
142 ; if file 161.92 then get short descriptive name
143 I FBFILE=161.92 D
144 . S:$G(FBDI) FBDN=$P($G(^FB(FBFILE,FBCI,2,FBDI,0)),U,2)
145 . S FBRET=FBRET_U_$G(FBDN)
146 ; if array root passed then get full description
147 I $G(FBAR)]"",$G(FBDI) S FBX=$$GET1^DIQ(FBFILE_"2",FBDI_","_FBCI_",",1,,FBAR)
148 Q
149 ;
150 ;FBUTL1
Note: See TracBrowser for help on using the repository browser.