3 * edih_277_html.php.php
5 * Copyright 2016 Kevin McCormick <kevin@kt61p>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 // require_once("$srcdir/edihistory/codes/edih_271_code_class.php");
30 * Produce an html display of information in
31 * the x12 edi 271 eligibility report for a particular patient
33 * @uses edih_271_codes()
34 * @uses edih_format_money()
35 * @uses edih_format_date()
36 * @uses edih_format_percent()
38 * @param object edih_x12_file type 271
39 * @param string bht03 or clm01 reference for transaction
42 function edih_277_transaction_html($obj277, $bht03, $accordion = false)
44 // get the transaction segments
45 $trans = $obj277->edih_x12_transaction($bht03);
47 // get other necessary items
48 $de = $obj277->edih_delimiters()['e'];
49 $ds = $obj277->edih_delimiters()['s'];
50 $dr = $obj277->edih_delimiters()['r'];
51 $fn = $obj277->edih_filename();
53 if (!is_array($trans) ||
!count($trans)) {
54 $str_html = "<p>Did not find transaction $bht03 in $fn</p>".PHP_EOL
;
59 $cd27x = new edih_271_codes($ds, $dr);
65 $hdr_html = "<table id=$bht03 class='h277' columns=4>";
66 $hdr_html .= "<caption>Claim Status</caption>".PHP_EOL
;
67 $hdr_html .= "<thead>".PHP_EOL
;
68 $hdr_html .= "<tr><th>Reference</th><th>Information</th><th colspan=2>$fn</th></tr>".PHP_EOL
; //
69 $hdr_html .= "</thead>".PHP_EOL
."<tbody>".PHP_EOL
;
79 $trns_ct = count($trans);
80 for ($i=0; $i<$trns_ct; $i++
) {
81 foreach ($trans[$i] as $seg) {
91 // echo "$i loop: $loopid Segment: $seg".PHP_EOL;
93 if (strncmp('BHT'.$de, $seg, 4) === 0) {
95 $sar = explode($de, $seg);
97 if ($sar[1] == '0010') {
98 $elem01 = "Src, Rcv, Prv, Sbr, Dep";
99 } elseif ($sar[1] == '0085') {
100 $elem01 = "Src, Rcv, Prv, Pt";
102 $elem01 = "Not determined ({$sar[1]})";
109 $elem02 = ( isset($sar[2]) && $sar[2] !== false) ?
$cd27x->get_271_code('BHT02', $sar[2]) : "";
110 $elem03 = ( isset($sar[3]) && $sar[3]) ?
$sar[3] : "";
111 $elem04 = ( isset($sar[4]) && $sar[4]) ?
edih_format_date($sar[4]) : "";
112 $elem06 = ( isset($sar[6]) && $sar[6]) ?
$cd27x->get_271_code('BHT06', $sar[6]) : "";
114 $hdr_html .= "<tr><td colspan=2><em>Reference:</em> $elem03</td><td colspan=2><em>Sequence:</em> $elem01</td></tr>".PHP_EOL
;
115 $hdr_html .= "<tr><td colspan=2><em>Date:</em> $elem04</td><td colspan=2><em>Type:</em> $elem02</td>".PHP_EOL
;
116 $hdr_html .= ($elem06) ?
"<tr><td>></td><td colspan=3><em>Type:</em> $elem06</td></tr>".PHP_EOL
: "";
123 if (strncmp('HL'.$de, $seg, 3) === 0) {
124 $sar = explode($de, $seg);
125 $elem03 = ( isset($sar[3]) ) ?
$sar[3] : "";
126 if ($elem03 == '20') { // level code
127 $loopid = '2000A'; // info source (payer)
129 $src_html .= "<tr class='$cls'><td colspan=4><b>Information Source</b></td></tr>".PHP_EOL
;
130 } elseif ($elem03 == '21') {
131 $loopid = '2000B'; // info receiver (clinic)
133 $rcv_html .= "<tr class='$cls'><td colspan=4><b>Information Receiver</b></td></tr>".PHP_EOL
;
134 } elseif ($elem03 == '19') {
135 $loopid = '2000C'; // provider
138 $prv_html .= "<tr class='$cls'><td colspan=4><b>Provider</b></td></tr>".PHP_EOL
;
139 } elseif ($elem03 == '22') {
140 $loopid = '2000D'; // subscriber
142 $sbr_nm1_html .= "<tr class='$cls'><td colspan=4><b>Subscriber</b></td></tr>".PHP_EOL
;
143 } elseif ($elem03 == 'PT') {
144 $loopid = '2000D'; // patient in 277CA
146 $sbr_nm1_html .= "<tr class='$cls'><td colspan=4><b>Patient</b></td></tr>".PHP_EOL
;
147 } elseif ($elem03 == '23') {
148 $loopid = '2000E'; // dependent
150 $dep_nm1_html .= "<tr class='$cls'><td colspan=4><b>Dependent</b></td></tr>".PHP_EOL
;
152 csv_edihist_log("edih_277_transaction_html: HL segment error $fn");
156 $qtystr = ''; // reset for QTY and AMT segments in 277CA
161 if (strncmp('NM1'.$de, $seg, 4) === 0) {
162 $sar = explode($de, $seg);
164 $nm101 = ( isset($sar[1]) ) ?
$sar[1] : '';
165 $descr = ($nm101) ?
$cd27x->get_271_code('NM101', $nm101) : "";
167 $name = (isset($sar[3]) && $sar[3] ) ?
$sar[3] : "";
168 $name .= (isset($sar[7]) && $sar[7]) ?
" {$sar[7]}" : "";
169 $name .= (isset($sar[4]) && $sar[4]) ?
", {$sar[4]}" : "";
170 $name .= (isset($sar[5]) && $sar[5]) ?
" {$sar[5]}" : "";
171 $nm109 = (isset($sar[9]) && $sar[9]) ?
$sar[9] : "";
173 $nm108 = (isset($sar[8]) && $sar[8] ) ?
$cd27x->get_271_code('NM108', $sar[8]) : "";
175 if ($loopid == '2000A') {
176 $src_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'>$name</td></tr>" .PHP_EOL
;
177 $src_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'><em>$nm108</em> $nm109</td></tr>" .PHP_EOL
;
179 } elseif ($loopid == '2000B') {
180 $rcv_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'>$name</td></tr>" .PHP_EOL
;
181 $rcv_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'><em>$nm108</em> $nm109</td></tr>" .PHP_EOL
;
183 } elseif ($loopid == '2000C') {
184 $prv_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'>$name</td></tr>" .PHP_EOL
;
185 $prv_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'><em>$nm108</em> $nm109</td></tr>" .PHP_EOL
;
187 } elseif ($loopid == '2000D') {
188 $sbr_nm1_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'>$name</td></tr>" .PHP_EOL
;
189 $sbr_nm1_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'><em>$nm108</em> $nm109</td></tr>" .PHP_EOL
;
192 } elseif ($loopid == '2000E') {
193 $dep_nm1_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'>$name</td></tr>" .PHP_EOL
;
194 $dep_nm1_html .= "<tr class='$cls'><td>></td><td colspan=3 title='$descr'><em>$nm108</em> $nm109</td></tr>" .PHP_EOL
;
204 if (strncmp('PER'.$de, $seg, 4) === 0) {
205 $sar = explode($de, $seg);
207 $elem01 = (isset($sar[1])) ?
$sar[1] : '';
208 $elem02 = (isset($sar[2])) ?
$sar[2] : '';
209 $elem03 = (isset($sar[3])) ?
$cd27x->get_271_code('PER03', $sar[3]) : "";
210 $elem04 = (isset($sar[4])) ?
$sar[4] : '';
211 $elem05 = (isset($sar[5])) ?
$cd27x->get_271_code('PER03', $sar[5]) : "";
212 $elem06 = (isset($sar[6])) ?
$sar[6] : '';
213 $elem07 = (isset($sar[7])) ?
$cd27x->get_271_code('PER03', $sar[7]) : "";
214 $elem08 = (isset($sar[8])) ?
$sar[8] : '';
215 $elem09 = (isset($sar[9])) ?
$sar[9] : '';
217 if ($loopid == '2100A') {
218 $src_html .= "<tr class='$cls'><td colspan=2>$elem02</td><td colspan=2 title='$elem03 $elem05 $elem07'>$elem04 $elem06 $elem08</td></tr>" .PHP_EOL
;
220 csv_edihist_log('edih_277_html: PER segment not in 2100A loop '.$fn);
228 if (strncmp('TRN'.$de, $seg, 4) === 0) {
229 $sar = explode($de, $seg);
231 $elem01 = ( isset($sar[1]) && $sar[1] == "1" ) ?
"Transaction Ref" : "Trace";
232 $elem02 = ( isset($sar[2]) ) ?
$sar[2] : '';
233 $elem03 = ( isset($sar[3]) ) ?
$sar[3] : '';
234 $elem04 = ( isset($sar[4]) ) ?
$sar[4] : '';
236 if ($loopid == '2100B') {
237 $rcv_html .= "<tr class='$cls'><td>></td><td colspan=3><em>$elem01</em> $elem02</td></tr>".PHP_EOL
;
239 } elseif ($loopid == '2100C') {
240 $prv_html .= "<tr class='$cls'><td>></td><td colspan=3><em>$elem01</em> $elem02</td></tr>".PHP_EOL
;
242 } elseif ($loopid == '2100D') {
243 $sbr_stc_html .= "<tr class='$cls'><td>></td><td colspan=3><em>$elem01</em> $elem02</td></tr>".PHP_EOL
;
244 $h3_lbl = ($h3_lbl) ?
$h3_lbl.' '.$elem02 : $h3_lbl;
246 } elseif ($loopid == '2100E') {
247 $dep_stc_html .= "<tr class='$cls'><td>></td><td colspan=3><em>$elem01</em> $elem02</td></tr>".PHP_EOL
;
248 $h3_lbl = ($h3_lbl) ?
$h3_lbl.' '.$elem02 : $h3_lbl;
257 if (strncmp('STC'.$de, $seg, 4) === 0) {
258 $sar = explode($de, $seg);
260 if (isset($sar[1])) {
261 if (strpos($sar[1], $ds)) { // claim status category : claim status : entity identifier
262 $scda = explode($ds, $sar[1]);
263 $sc101 = ( isset($scda[0]) && $scda[0]) ?
$cd27x->get_271_code('HCCSCC', $scda[0]) : "";
264 $sc102 = ( isset($scda[1]) && $scda[1]) ?
$cd27x->get_271_code('HCCSC', $scda[1]) : "";
265 $sc103 = ( isset($scda[2]) && $scda[2]) ?
$cd27x->get_271_code('NM101', $scda[2]) : "";
271 $stc02 = (isset($sar[2]) && $sar[2]) ?
edih_format_date($sar[2]) : ""; // status information date
272 $stc03 = ""; // action code
273 if (isset($sar[3])) {
274 if ($sar[3] == 'WQ') {
276 } elseif ($sar[3] == 'F') {
278 } elseif ($sar[3] == '15') {
279 $stc03 = "Correct/Resubmit";
280 } elseif ($sar[3] == 'U') {
287 $stc04 = (isset($sar[4]) && $sar[4]) ?
edih_format_money($sar[4]) : ""; // billed amount
288 $stc05 = (isset($sar[5]) && $sar[5]) ?
edih_format_money($sar[5]) : ""; // paid amount
289 $stc06 = (isset($sar[6]) && $sar[6]) ?
edih_format_date($sar[6]) : ""; // payment date
291 $stc08 = (isset($sar[8]) && $sar[8]) ?
edih_format_date($sar[8]) : ""; // check issue date
292 $stc09 = (isset($sar[9]) && $sar[9]) ?
$sar[9] : ""; // check or eft number
295 if (isset($sar[10]) && $sar[10]) { // claim status category : claim status : entity identifier
296 if (strpos($sar[10], $ds)) {
297 $scda = explode($ds, $sar[1]);
298 $sc201 = ( isset($scda[0]) && $scda[0]) ?
$cd27x->get_271_code('HCCSCC', $scda[0]) : "";
299 $sc202 = ( isset($scda[1]) && $scda[1]) ?
$cd27x->get_271_code('HCCSC', $scda[1]) : "";
300 $sc203 = ( isset($scda[2]) && $scda[2]) ?
$cd27x->get_271_code('NM101', $scda[2]) : "";
301 $sc204 = ( isset($scda[3]) && $scda[3] = 'RA') ?
"Rx Reject/Payment Codes" : "";
309 if (isset($sar[11]) && $sar[11]) { // claim status category : claim status : entity identifier
310 if (strpos($sar[10], $ds)) {
311 $scda = explode($ds, $sar[1]);
312 $sc301 = ( isset($scda[0]) && $scda[0]) ?
$cd27x->get_271_code('HCCSCC', $scda[0]) : "";
313 $sc302 = ( isset($scda[1]) && $scda[1]) ?
$cd27x->get_271_code('HCCSC', $scda[1]) : "";
314 $sc303 = ( isset($scda[2]) && $scda[2]) ?
$cd27x->get_271_code('NM101', $scda[2]) : "";
315 $sc304 = ( isset($scda[3]) && $scda[3] = 'RA') ?
"Rx Reject/Payment Codes" : "";
322 $stc12 = ( isset($sar[12]) && $sar[12]) ?
$sar[12] : ""; // message
324 $stc_html = (isset($sc101)) ?
"<tr class='$cls'><td>$stc03</td><td colspan=2>$sc101</td><td>$stc02 $stc04</td></tr>".PHP_EOL
: "";
325 $stc_html .= (isset($sc102)) ?
"<tr class='$cls'><td>></td><td colspan=3>$sc102</td></tr>".PHP_EOL
: "";
326 $stc_html .= (isset($sc103) && $sc103) ?
"<tr class='$cls'><td>></td><td colspan=3><em>Entity</em> $sc103</td></tr>".PHP_EOL
: "";
327 $stc_html .= ($stc05 ||
$stc06 ||
$stc08 ||
$stc09) ?
"<tr class='$cls'><td><em>Payment</em></td><td colspan=3>$stc05 $stc06 $stc08 $stc09</td></tr>".PHP_EOL
: "";
328 $stc_html .= (isset($sc201)) ?
"<tr class='$cls'><td>></td><td colspan=3>$sc201 $sc204</td></tr>".PHP_EOL
: "";
329 $stc_html .= (isset($sc202)) ?
"<tr class='$cls'><td>></td><td colspan=3>$sc202</td></tr>".PHP_EOL
: "";
330 $stc_html .= (isset($sc203) && $sc203) ?
"<tr class='$cls'><td>></td><td colspan=3><em>Entity</em> $sc203</td></tr>".PHP_EOL
: "";
331 $stc_html .= (isset($sc301)) ?
"<tr class='$cls'><td>></td><td colspan=3>$sc301 $sc304</td></tr>".PHP_EOL
: "";
332 $stc_html .= (isset($sc302)) ?
"<tr class='$cls'><td>></td><td colspan=3>$sc302</td></tr>".PHP_EOL
: "";
333 $stc_html .= (isset($sc303) && $sc303) ?
"<tr class='$cls'><td>></td><td colspan=3><em>Entity</em> $sc303</td></tr>".PHP_EOL
: "";
334 $stc_html .= ($stc12) ?
"<tr class='$cls'><td><em>Message</em></td><td colspan=3>$stc12</td></tr>".PHP_EOL
: "";
336 if ($loopid == '2200B') {
337 $rcv_html .= $stc_html;
338 } elseif ($loopid == '2200C') {
339 $prv_html .= $stc_html;
340 } elseif ($loopid == '2200D') {
341 $sbr_stc_html .= $stc_html;
342 } elseif ($loopid == '2200E') {
343 $dep_stc_html .= $stc_html;
350 // in 277CA, expect QTY followed by AMT
351 // do not expect QTY or AMT in regular 277
352 if (strncmp('QTY'.$de, $seg, 4) === 0) {
353 $sar = explode($de, $seg);
354 if (isset($sar[1])) {
355 if ($sar[1] == '90') {
356 $qtystr = "Acknowledged Quantity ";
357 } elseif ($sar[1] == 'AA') {
358 $qtystr = "Unacknowledged Quantity ";
359 } elseif ($sar[1] == 'QA') {
360 $qtystr = "Quantity Approved ";
361 } elseif ($sar[1] == 'QC') {
362 $qtystr = "Quantity Disapproved ";
364 $qtystr = "Quantity ";
370 $qtystr .= (isset($sar[2]) && $sar[2]) ?
$sar[2] : "";
374 if (strncmp('AMT'.$de, $seg, 4) === 0) {
375 $sar = explode($de, $seg);
377 $amtstr = (isset($sar[1]) && $sar[1] == 'YU') ?
"Amt " :"Amt Rej ";
378 $amtstr .= (isset($sar[2]) && $sar[2]) ?
edih_format_money($sar[2]) : "";
380 if ($loopid == '2200B') {
381 $rcv_html .= "<tr class='$cls'><td>></td><td colspan=3>$qtystr $amtstr</td></tr>".PHP_EOL
;
382 } elseif ($loopid == '2200C') {
383 $prv_html .= "<tr class='$cls'><td>></td><td colspan=3>$qtystr $amtstr</td></tr>".PHP_EOL
;
384 } elseif ($loopid == '2200D') {
385 $sbr_stc_html .= "<tr class='$cls'><td>></td><td colspan=3>$qtystr $amtstr</td></tr>".PHP_EOL
;
386 } elseif ($loopid == '2200E') {
387 $dep_stc_html .= "<tr class='$cls'><td>></td><td colspan=3>$qtystr $amtstr</td></tr>".PHP_EOL
;
397 if (strncmp('REF'.$de, $seg, 4) === 0) {
398 $sar = explode($de, $seg);
401 $elem01 = (isset($sar[1])) ?
$cd27x->get_271_code('REF', $sar[1]) : '';
402 $elem02 = (isset($sar[2])) ?
$sar[2] : '';
403 $elem03 = (isset($sar[3])) ?
$sar[2] : '';
405 if ($loopid == '2200B') {
406 $rcv_html .= "<tr class='$cls'><td>></td><td colspan=2><em>$elem01</em> $elem02</td><td>$elem03</td></tr>".PHP_EOL
;
407 } elseif ($loopid == '2200C') {
408 $prv_html .= "<tr class='$cls'><td>></td><td colspan=2><em>$elem01</em> $elem02</td><td>$elem03</td></tr>".PHP_EOL
;
409 } elseif ($loopid == '2200D' ||
$loopid == '2220D') {
410 $sbr_stc_html .= "<tr class='$cls'><td>></td><td colspan=2><em>$elem01</em> $elem02</td><td>$elem03</td></tr>".PHP_EOL
;
411 } elseif ($loopid == '2200E' ||
$loopid == '2220E') {
412 $dep_stc_html .= "<tr class='$cls'><td>></td><td colspan=2><em>$elem01</em> $elem02</td><td>$elem03</td></tr>".PHP_EOL
;
420 if (strncmp('DTP'.$de, $seg, 4) === 0) {
422 $sar = explode($de, $seg);
425 $elem01 = (isset($sar[1]) && $sar[1]) ?
$cd27x->get_271_code('DTP', $sar[1]) : "";
426 $elem02 = (isset($sar[2])) ?
$sar[2] : '';
427 $elem03 = (isset($sar[3])) ?
$sar[3] : '';
429 $idtype = ($elem01) ?
$cd27x->get_271_code('DTP', $elem01) : "";
430 if ($elem02 == 'D8' && $elem03) {
431 $var = edih_format_date($elem03);
432 } elseif ($elem02 == 'RD8' && $elem03) {
433 $var = edih_format_date(substr($elem03, 0, 8));
434 $var .= ' - '.edih_format_date(substr($elem03, -8));
438 if ($loopid == '2200D' ||
$loopid == '2220D') {
439 $sbr_stc_html .= "<tr class='$cls'><td>></td><td>$elem01</td><td colspan=2>$var</td></tr>" .PHP_EOL
;
440 } elseif ($loopid == '2200E' ||
$loopid == '2220E') {
441 $dep_stc_html .= "<tr class='$cls'><td>></td><td>$elem01</td><td colspan=2>$var</td></tr>" .PHP_EOL
;
449 if (strncmp('SVC'.$de, $seg, 4) === 0) {
451 $sar = explode($de, $seg);
453 $elem01 = ''; // composite procedure code source:code:modifier:modifier
454 if (isset($sar[1]) && $sar[1]) {
455 // construct a code source code modifier string
456 if (strpos($sar[1], $ds)) {
457 $scda = explode($ds, $sar[1]);
459 while (list($key, $val) = each($scda)) {
460 if ($key == 0 && $val) {
461 $elem01 = $cd27x->get_271_code('EB13', $val);
472 $elem02 = (isset($sar[2]) && $sar[2]) ?
edih_format_money($sar[2]) : ""; // billed amount
473 $elem03 = (isset($sar[3]) && $sar[3]) ?
edih_format_money($sar[3]) : ""; // paid amount
474 $elem04 = (isset($sar[4]) && $sar[4]) ?
$sar[4] : ""; // revenue code
475 $elem05 = (isset($sar[5]) && $sar[5]) ?
$sar[5] : ""; // quantity
477 $elem07 = (isset($sar[7]) && $sar[7]) ?
$sar[7] : ""; // original unis of service
479 if ($loopid == '2200B') {
480 $rcv_html .= "<tr class='$cls'><td><em>Service</em></td><td>$elem01</td><td>$elem02</td><td>$elem04</td></tr>".PHP_EOL
;
481 $rcv_html .= ($elem03 ||
$elem04) ?
"<tr class='$cls'><td>></td><td colspan=3>$elem03 $elem04</td></tr>".PHP_EOL
: "";
482 } elseif ($loopid == '2200D' ||
$loopid == '2220D') {
483 $sbr_stc_html .= "<tr class='$cls'><td><em>Service</em></td><td>$elem01</td><td colspan=2>$elem02 $elem04</td></tr>".PHP_EOL
;
484 $sbr_stc_html .= ($elem03 ||
$elem04) ?
"<tr class='$cls'><td>></td><td colspan=3>$elem03 $elem04</td></tr>".PHP_EOL
: "";
485 } elseif ($loopid == '2200E' ||
$loopid == '2220E') {
486 $dep_stc_html .= "<tr class='$cls'><td><em>Service</em></td><td>$elem01</td><td colspan=2>$elem02 $elem04</td></tr>".PHP_EOL
;
487 $dep_stc_html .= ($elem03 ||
$elem04) ?
"<tr class='$cls'><td>></td><td colspan=3>$elem03 $elem04</td></tr>".PHP_EOL
: "";
499 $str_html .= "<h3>$bht $h3_lbl</h3>".PHP_EOL
;
500 $str_html .= "<div id='ac_$bht'>".PHP_EOL
;
503 $str_html .= ($hdr_html) ?
$hdr_html : "";
504 $str_html .= ($src_html) ?
$src_html : "";
505 $str_html .= ($rcv_html) ?
$rcv_html : "";
506 $str_html .= ($prv_html) ?
$prv_html : "";
507 $str_html .= ($sbr_nm1_html) ?
$sbr_nm1_html : "";
508 $str_html .= ($sbr_stc_html) ?
$sbr_stc_html : "";
509 $str_html .= ($dep_nm1_html) ?
$dep_nm1_html : "";
510 $str_html .= ($dep_stc_html) ?
$dep_stc_html : "";
511 $str_html .= "<tr><td colspan=4> </td></tr>".PHP_EOL
;
512 $str_html .= "</tbody>".PHP_EOL
."</table>".PHP_EOL
;
515 $str_html .= "</div>".PHP_EOL
;
523 * create a display for an individual claim status response
525 * @uses csv_check_x12_obj()
526 * @uses edih_277_transaction_html()
528 * @param string $filename the filename
529 * @param string $clm01 identifier from 837 CLM of BHT segment
531 * @return string either an error message or a table with the information from the response
533 function edih_277_html($filename, $bht03 = '')
535 // create a display for an individual 277 response
541 csv_edihist_log("edih_277_html: called with no file arguments");
542 $html_str .= "Error, no file given<br />".PHP_EOL
;
547 $obj277 = csv_check_x12_obj($fn, 'f277');
548 if ($obj277 && 'edih_x12_file' == get_class($obj277)) {
550 // particular transaction
551 $html_str .= edih_277_transaction_html($obj277, $bht03);
554 $env_ar = $obj277->edih_envelopes();
555 if (!isset($env_ar['ST'])) {
556 $html_str .= "<p>edih_277_html: file parse error, envelope error</p>".PHP_EOL
;
557 $html_str .= $obj277->edih_message();
560 $html_str .= "<div id='accordion'>".PHP_EOL
;
563 foreach ($env_ar['ST'] as $st) {
564 foreach ($env_ar['GS'] as $gs) {
565 if ($gs['icn'] != $st['icn']) {
568 $gs_date = edih_format_date($gs['date']);
569 $gs_sender = $gs['sender'];
575 // get each transaction
576 foreach ($st['bht03'] as $bht) {
577 //$html_str .= "<h3>$bht Claim Status <em>Date</em> $gs_date <em>Source</em> $gs_sender</h3>".PHP_EOL;
578 //$html_str .= "<div id='ac_$bht'>".PHP_EOL;
580 $html_str .= edih_277_transaction_html($obj277, $bht, true);
582 //$html_str .= "</div>".PHP_EOL;
586 $html_str .= "</div>".PHP_EOL
;
589 $html_str .= "<p>$filename : file parse error</p>".PHP_EOL
;
592 $html_str .= "Error with file name or file parsing <br />".PHP_EOL
;
593 csv_edihist_log("edih_277_html: error in retreiving file object");