function populate()
 {
     parent::populate();
     $ic = new InsuranceCompany($this->insurance_company_id);
     $this->insurance_company_name = $ic->get_name();
     $ic = null;
 }
 function edit_action($id = "", $provider_id = "", $p_obj = null)
 {
     //case where a direct id is provided, doesn't matter if a provider id is available get it from the insurance_numbers record
     if (get_class($this->insurance_numbers[0]) != "insurancenumbers" && is_numeric($id)) {
         $this->insurance_numbers[0] = new InsuranceNumbers($id);
         $this->providers[0] = new Provider($this->insurance_numbers[0]->get_provider_id());
     } elseif (is_numeric($provider_id)) {
         $this->providers[0] = new Provider($provider_id);
         if (get_class($this->insurance_numbers[0]) != "insurancenumbers") {
             if ($id == "default") {
                 $this->insurance_numbers[0] = $this->providers[0]->get_insurance_numbers_default();
                 if (!is_object($this->insurance_numbers[0])) {
                     $this->insurance_numbers[0] = new InsuranceNumbers();
                     $this->insurance_numbers[0]->set_provider_id($provider_id);
                 }
             } else {
                 $this->insurance_numbers[0] = new InsuranceNumbers();
                 $this->insurance_numbers[0]->set_provider_id($provider_id);
             }
         }
     } elseif (get_class($this->insurance_numbers[0]) == "insurancenumbers") {
         //this is the case that occurs after an update
         $this->providers[0] = new Provider($this->insurance_numbers[0]->get_provider_id());
     } else {
         $this->insurance_numbers[0] = new InsuranceNumbers();
         $this->providers[0] = new Provider();
         $this->assign("ERROR", "A provider must be specified. Check the link you you came from or the URL and try again.");
     }
     $ic = new InsuranceCompany();
     $icompanies = $ic->insurance_companies_factory();
     //It is possible to set a group and provider number to be used in the event that there is not direct hit on the insurance-provider lookup
     //Those numbers are entered uder default
     $ic_array = array("Default");
     foreach ($icompanies as $ic_tmp) {
         $ic_array[$ic_tmp->get_id()] = $ic_tmp->get_name();
     }
     $ic_type_options_array = array();
     foreach ($this->insurance_numbers[0]->provider_number_type_array as $type => $type_title) {
         $ic_type_options_array[$type] = "{$type}  {$type_title}";
     }
     $ic_rendering_type_options_array = array();
     foreach ($this->insurance_numbers[0]->rendering_provider_number_type_array as $type => $type_title) {
         $ic_rendering_type_options_array[$type] = "{$type}  {$type_title}";
     }
     $this->assign("ic_array", $ic_array);
     $this->assign("ic_type_options_array", $ic_type_options_array);
     $this->assign("ic_rendering_type_options_array", $ic_rendering_type_options_array);
     $this->assign("provider", $this->providers[0]);
     $this->assign("ins", $this->insurance_numbers[0]);
     return $this->fetch($GLOBALS['template_dir'] . "insurance_numbers/" . $this->template_mod . "_edit.html");
 }
 function list_action($sort = "")
 {
     if (!empty($sort)) {
         $this->assign("icompanies", InsuranceCompany::insurance_companies_factory("", $sort));
     } else {
         $this->assign("icompanies", InsuranceCompany::insurance_companies_factory());
     }
     return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
 }
Example #4
0
 }
 $html .= "</td>\n<td valign='top' class='fshead'>";
 $html .= xl('Reason', 'r');
 $html .= ":<br />";
 if (!empty($encdata)) {
     $html .= $encdata['reason'];
 }
 $html .= "</td>\n</tr>\n<tr>\n<td colspan='4' valign='top' class='fshead' style='height:{$lheight}pt'>";
 if (empty($GLOBALS['ippf_specific'])) {
     $html .= xl('Insurance', 'r') . ":";
     if ($form_fill) {
         foreach (array('primary', 'secondary', 'tertiary') as $instype) {
             $query = "SELECT * FROM insurance_data WHERE " . "pid = '{$pid}' AND type = '{$instype}' " . "ORDER BY date DESC LIMIT 1";
             $row = sqlQuery($query);
             if ($row['provider']) {
                 $icobj = new InsuranceCompany($row['provider']);
                 $adobj = $icobj->get_address();
                 $insco_name = trim($icobj->get_name());
                 if ($instype != 'primary') {
                     $html .= ",";
                 }
                 if ($insco_name) {
                     $html .= "&nbsp;{$insco_name}";
                 } else {
                     $html .= "&nbsp;<font color='red'><b>Missing Name</b></font>";
                 }
             }
         }
     }
 } else {
     // IPPF wants a visit date box with the current date in it.
Example #5
0
function generate_order_summary($orderid)
{
    // If requested, save checkbox selections as to which procedures are not sendable.
    if ($_POST['bn_save']) {
        sqlStatement("UPDATE procedure_order_code " . "SET do_not_send = 0 WHERE " . "procedure_order_id = ? AND " . "do_not_send != 0", array($orderid));
        if (!empty($_POST['form_omit'])) {
            foreach ($_POST['form_omit'] as $key) {
                sqlStatement("UPDATE procedure_order_code " . "SET do_not_send = 1 WHERE " . "procedure_order_id = ? AND " . "do_not_send = 0 AND " . "procedure_order_seq = ?", array($orderid, intval($key)));
            }
        }
    }
    $orow = sqlQuery("SELECT " . "po.procedure_order_id, po.patient_id, po.date_ordered, po.order_status, " . "po.date_collected, po.specimen_type, po.specimen_location, po.lab_id, po.clinical_hx, " . "pd.pubpid, pd.lname, pd.fname, pd.mname, pd.DOB, pd.sex, " . "pd.street, pd.city, pd.state, pd.postal_code, " . "fe.date, " . "pp.name AS labname, " . "u.lname AS ulname, u.fname AS ufname, u.mname AS umname, " . "ru.lname AS ref_lname, ru.fname AS ref_fname, ru.mname AS ref_mname, " . "ru.street AS ref_street, ru.city AS ref_city, ru.state AS ref_state, ru.zip AS ref_zip " . "FROM procedure_order AS po " . "LEFT JOIN patient_data AS pd ON pd.pid = po.patient_id " . "LEFT JOIN procedure_providers AS pp ON pp.ppid = po.lab_id " . "LEFT JOIN users AS u ON u.id = po.provider_id " . "LEFT JOIN users AS ru ON ru.id = pd.ref_providerID " . "LEFT JOIN form_encounter AS fe ON fe.pid = po.patient_id AND fe.encounter = po.encounter_id " . "WHERE po.procedure_order_id = ?", array($orderid));
    $lab_id = intval($orow['lab_id']);
    $patient_id = intval($orow['patient_id']);
    $encdate = substr($orow['date'], 0, 10);
    // Get insurance info.
    $ins_policy = '';
    $ins_group = '';
    $ins_name = '';
    $ins_addr = '';
    $ins_city = '';
    $ins_state = '';
    $ins_zip = '';
    $irow = getInsuranceDataByDate($patient_id, $encdate, 'primary', "insd.provider, insd.policy_number, insd.group_number");
    if (!empty($irow['provider'])) {
        $ins_policy = $irow['policy_number'];
        $ins_group = $irow['group_number'];
        $insco = new InsuranceCompany($irow['provider']);
        if (!empty($insco)) {
            $ins_name = $insco->get_name();
            $tmp = $insco->get_address();
            $ins_addr = $tmp->get_line1();
            $ins_city = $tmp->get_city();
            $ins_state = $tmp->get_state();
            $ins_zip = $tmp->get_zip();
        }
    }
    ?>

<style>

.ordsum tr.head   { font-size:10pt; background-color:#cccccc; text-align:center; }
.ordsum tr.detail { font-size:10pt; }
.ordsum a, .ordsum a:visited, .ordsum a:hover { color:#0000cc; }

.ordsum table {
 border-style: solid;
 border-width: 1px 0px 0px 1px;
 border-color: black;
}

.ordsum td, .ordsum th {
 border-style: solid;
 border-width: 0px 1px 1px 0px;
 border-color: black;
}

/* specifically exclude from printing */
@media print {
 .unprintable {
  visibility: hidden;
  display: none;
 }
}

</style>

<form method='post' action='order_manifest.php?orderid=<?php 
    echo $orderid;
    ?>
'>

<div class='ordsum'>

<table width='100%' cellpadding='2' cellspacing='0'>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Patient Name');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['lname'] . ', ' . $orow['fname'] . ' ' . $orow['mname']);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Ordered By');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['ulname'] . ', ' . $orow['ufname'] . ' ' . $orow['umname']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td width='5%' nowrap><?php 
    echo xlt('MRN (pid)');
    ?>
</td>
  <td width='45%'><?php 
    echo myCellText($patient_id);
    ?>
</td>
  <td width='5%' nowrap><?php 
    echo xlt('Order ID');
    ?>
</td>
  <td width='45%'><?php 
    echo myCellText($orow['procedure_order_id']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Encounter Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($encdate));
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Order Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($orow['date_ordered']));
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Birth Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($orow['DOB']));
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Lab');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['labname']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Sex');
    ?>
</td>
  <td><?php 
    echo myCellText(getListItem('sex', $orow['sex']));
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Specimen Type');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['specimen_type']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Address');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['street'] . ', ' . $orow['city'] . ', ' . $orow['state'] . ' ' . $orow['postal_code']);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Collection Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($orow['date_collected']));
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Name');
    ?>
</td>
  <td><?php 
    echo myCellText($ins_name);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Clinical History');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['clinical_hx']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Address');
    ?>
</td>
  <td><?php 
    echo myCellText("{$ins_addr}, {$ins_city}, {$ins_state} {$ins_zip}");
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Order Status');
    ?>
</td>
  <td><?php 
    echo myCellText(getListItem('ord_status', $orow['order_status']));
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Policy');
    ?>
</td>
  <td><?php 
    echo myCellText($ins_policy);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Referrer');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['ref_lname'] . ', ' . $orow['ref_fname'] . ' ' . $orow['ref_mname']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Group');
    ?>
</td>
  <td><?php 
    echo myCellText($ins_group);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Referrer Address');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['ref_street'] . ', ' . $orow['ref_city'] . ', ' . $orow['ref_state'] . ' ' . $orow['ref_zip']);
    ?>
</td>
 </tr>
</table>

&nbsp;<br />

<table width='100%' cellpadding='2' cellspacing='0'>

 <tr class='head'>
  <td><?php 
    echo xlt('Omit');
    ?>
</td>
  <td><?php 
    echo xlt('Code');
    ?>
</td>
  <td><?php 
    echo xlt('Description');
    ?>
</td>
  <td><?php 
    echo xlt('Diagnoses');
    ?>
</td>
  <td><?php 
    echo xlt('Notes');
    ?>
</td>
 </tr>

<?php 
    $query = "SELECT " . "procedure_order_seq, procedure_code, procedure_name, diagnoses, do_not_send " . "FROM procedure_order_code WHERE " . "procedure_order_id =  ? ";
    if (!empty($_POST['bn_show_sendable'])) {
        $query .= "AND do_not_send = 0 ";
    }
    $query .= "ORDER BY procedure_order_seq";
    $res = sqlStatement($query, array($orderid));
    $encount = 0;
    while ($row = sqlFetchArray($res)) {
        $order_seq = empty($row['procedure_order_seq']) ? 0 : $row['procedure_order_seq'] + 0;
        $procedure_code = empty($row['procedure_code']) ? '' : $row['procedure_code'];
        $procedure_name = empty($row['procedure_name']) ? '' : $row['procedure_name'];
        $diagnoses = empty($row['diagnoses']) ? '' : $row['diagnoses'];
        // Create a string of HTML representing the procedure answers.
        // This code cloned from gen_hl7_order.inc.php.
        // Should maybe refactor it into something like a ProcedureAnswer class.
        $qres = sqlStatement("SELECT " . "a.question_code, a.answer, q.fldtype, q.question_text " . "FROM procedure_answers AS a " . "LEFT JOIN procedure_questions AS q ON " . "q.lab_id = ? " . "AND q.procedure_code = ? AND " . "q.question_code = a.question_code " . "WHERE " . "a.procedure_order_id = ? AND " . "a.procedure_order_seq = ? " . "ORDER BY q.seq, a.answer_seq", array($lab_id, $procedure_code, $orderid, $order_seq));
        $notes = '';
        while ($qrow = sqlFetchArray($qres)) {
            // Formatting of these answer values may be lab-specific and we'll figure
            // out how to deal with that as more labs are supported.
            $answer = trim($qrow['answer']);
            $fldtype = $qrow['fldtype'];
            if ($fldtype == 'G') {
                $weeks = intval($answer / 7);
                $days = $answer % 7;
                $answer = $weeks . 'wks ' . $days . 'days';
            }
            if ($notes) {
                $notes .= '<br />';
            }
            $notes .= text($qrow['question_text'] . ': ' . $answer);
        }
        if ($notes === '') {
            $notes = '&nbsp;';
        }
        ++$encount;
        $bgcolor = "#" . ($encount & 1 ? "ddddff" : "ffdddd");
        echo " <tr class='detail' bgcolor='{$bgcolor}'>\n";
        echo "  <td><input type='checkbox' name='form_omit[{$order_seq}]' value='1'";
        if (!empty($row['do_not_send'])) {
            echo " checked";
        }
        echo " /></td>\n";
        echo "  <td>" . myCellText("{$procedure_code}") . "</td>\n";
        echo "  <td>" . myCellText("{$procedure_name}") . "</td>\n";
        echo "  <td>" . myCellText("{$diagnoses}") . "</td>\n";
        echo "  <td>{$notes}</td>\n";
        echo " </tr>\n";
    }
    ?>

</table>
</div>

<center>
<p class='unprintable'>
<input type='submit' name='bn_save' value='<?php 
    echo xla('Save omission selections');
    ?>
' />
&nbsp;
<input type='submit' name='bn_show_all' value='<?php 
    echo xla('Show all procedures');
    ?>
' />
&nbsp;
<input type='submit' name='bn_show_sendable' value='<?php 
    echo xla('Show only procedures not omitted');
    ?>
' />
</p>
</center>

</form>

<?php 
}
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
 *
 * @package OpenEMR
 * @author  Karl Englund <*****@*****.**>
 * @link    http://www.open-emr.org
 */
header("Content-Type:text/xml");
$ignoreAuth = true;
require_once 'classes.php';
require_once "{$srcdir}/classes/InsuranceCompany.class.php";
$xml_string = "";
$xml_string = "<insurancecompanies>";
$token = $_POST['token'];
$insuranceCom = new InsuranceCompany();
$insurance = $insuranceCom->insurance_companies_factory();
if ($userId = validateToken($token)) {
    $user = getUsername($userId);
    $acl_allow = acl_check('admin', 'super', $user);
    if ($acl_allow) {
        if (!empty($insurance)) {
            $xml_string .= "<status>0</status>\n";
            $xml_string .= "<reason>The Insurance Companies Record has been fetched</reason>\n";
            foreach ($insurance as $row) {
                $xml_string .= "<insurancecompany>";
                $xml_string .= "<id>" . $row->id . "</id>";
                $xml_string .= "<name>" . $row->name . "</name>";
                $xml_string .= "<city>" . $row->address->city . "</city>";
                $xml_string .= "<state>" . $row->address->state . "</state>";
                $xml_string .= "</insurancecompany>";
Example #7
0
 function x12claimtype($m)
 {
     $err = "";
     //type of payer determined by HIPAA, supposed to be superceded by PlanID at some point, I don't think yet 06/03/2004
     $obj = $m->getparam(0);
     $ikey = $obj->getval();
     $ic = new InsuranceCompany($ikey);
     $pkey = $ic->get_freeb_claim_type();
     // if we generated an error, create an error return response
     if ($err) {
         return $this->_handleError($err);
     } else {
         // otherwise, we create the right response
         // with the state name
         return new xmlrpcresp(new xmlrpcval($pkey));
     }
 }
$address_line1 = $_POST['address_line1'];
$address_line2 = $_POST['address_line1'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$cms_id = $_POST['cms_id'];
$freeb_type = $_POST['freeb_type'];
$x12_receiver_id = $_POST['x12_receiver_id'];
if ($userId = validateToken($token)) {
    $user = getUsername($userId);
    $acl_allow = acl_check('admin', 'super', $user);
    $_SESSION['authUser'] = $user;
    $_SESSION['authGroup'] = $site;
    if ($acl_allow) {
        $insuranceCom = new InsuranceCompany();
        $insuranceCom->set_name($name);
        $insuranceCom->set_attn($attn);
        $insuranceCom->set_address_line1($address_line1);
        $insuranceCom->set_address_line2($address_line1);
        $insuranceCom->set_phone($phone);
        $insuranceCom->set_city($city);
        $insuranceCom->set_state($state);
        $insuranceCom->set_zip($zip);
        $insuranceCom->set_cms_id($cms_id);
        $insuranceCom->set_freeb_type($freeb_type);
        $insuranceCom->set_x12_receiver_id($x12_receiver_id);
        $insuranceCom->persist();
        $xml_string .= "<status>0</status>\n";
        $xml_string .= "<reason>The Insurance has been added</reason>\n";
    } else {
Example #9
0
function generate_order_summary($orderid)
{
    $orow = sqlQuery("SELECT " . "po.procedure_order_id, po.patient_id, po.date_ordered, po.order_status, " . "po.date_collected, po.specimen_type, po.specimen_location, " . "pd.pubpid, pd.lname, pd.fname, pd.mname, pd.DOB, " . "fe.date, " . "pp.name AS labname, " . "u.lname AS ulname, u.fname AS ufname, u.mname AS umname " . "FROM procedure_order AS po " . "LEFT JOIN patient_data AS pd ON pd.pid = po.patient_id " . "LEFT JOIN procedure_providers AS pp ON pp.ppid = po.lab_id " . "LEFT JOIN users AS u ON u.id = po.provider_id " . "LEFT JOIN form_encounter AS fe ON fe.pid = po.patient_id AND fe.encounter = po.encounter_id " . "WHERE po.procedure_order_id = ?", array($orderid));
    $patient_id = intval($orow['patient_id']);
    $encdate = substr($orow['date'], 0, 10);
    // Get insurance info.
    $ins_policy = '';
    $ins_group = '';
    $ins_name = '';
    $ins_addr = '';
    $ins_city = '';
    $ins_state = '';
    $ins_zip = '';
    $irow = getInsuranceDataByDate($patient_id, $encdate, 'primary', "insd.provider, insd.policy_number, insd.group_number");
    if (!empty($irow['provider'])) {
        $ins_policy = $irow['policy_number'];
        $ins_group = $irow['group_number'];
        $insco = new InsuranceCompany($irow['provider']);
        if (!empty($insco)) {
            $ins_name = $insco->get_name();
            $tmp = $insco->get_address();
            $ins_addr = $tmp->get_line1();
            $ins_city = $tmp->get_city();
            $ins_state = $tmp->get_state();
            $ins_zip = $tmp->get_zip();
        }
    }
    ?>

<style>

.ordsum tr.head   { font-size:10pt; background-color:#cccccc; text-align:center; }
.ordsum tr.detail { font-size:10pt; }
.ordsum a, .ordsum a:visited, .ordsum a:hover { color:#0000cc; }

.ordsum table {
 border-style: solid;
 border-width: 1px 0px 0px 1px;
 border-color: black;
}

.ordsum td, .ordsum th {
 border-style: solid;
 border-width: 0px 1px 1px 0px;
 border-color: black;
}

</style>

<div class='ordsum'>

<table width='100%' cellpadding='2' cellspacing='0'>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Patient Name');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['lname'] . ', ' . $orow['fname'] . ' ' . $orow['mname']);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Ordered By');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['ulname'] . ', ' . $orow['ufname'] . ' ' . $orow['umname']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td width='5%' nowrap><?php 
    echo xlt('MRN (pid)');
    ?>
</td>
  <td width='45%'><?php 
    echo myCellText($patient_id);
    ?>
</td>
  <td width='5%' nowrap><?php 
    echo xlt('Order ID');
    ?>
</td>
  <td width='45%'><?php 
    echo myCellText($orow['procedure_order_id']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Encounter Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($encdate));
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Order Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($orow['date_ordered']));
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Birth Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($orow['DOB']));
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Lab');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['labname']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Name');
    ?>
</td>
  <td><?php 
    echo myCellText($ins_name);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Specimen Type');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['specimen_type']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Address');
    ?>
</td>
  <td><?php 
    echo myCellText("{$ins_addr}, {$ins_city}, {$ins_state} {$ins_zip}");
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Collection Date');
    ?>
</td>
  <td><?php 
    echo myCellText(oeFormatShortDate($orow['date_collected']));
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Policy');
    ?>
</td>
  <td><?php 
    echo myCellText($ins_policy);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Specimen Location');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['specimen_location']);
    ?>
</td>
 </tr>
 <tr bgcolor='#cccccc'>
  <td nowrap><?php 
    echo xlt('Ins Group');
    ?>
</td>
  <td><?php 
    echo myCellText($ins_group);
    ?>
</td>
  <td nowrap><?php 
    echo xlt('Order Status');
    ?>
</td>
  <td><?php 
    echo myCellText($orow['order_status']);
    ?>
</td>
 </tr>
</table>

&nbsp;<br />

<table width='100%' cellpadding='2' cellspacing='0'>

 <tr class='head'>
  <td><?php 
    echo xlt('Code');
    ?>
</td>
  <td><?php 
    echo xlt('Description');
    ?>
</td>
  <td><?php 
    echo xlt('Diagnoses');
    ?>
</td>
 </tr>

<?php 
    $query = "SELECT " . "procedure_order_seq, procedure_code, procedure_name, diagnoses " . "FROM procedure_order_code WHERE " . "procedure_order_id =  ? ORDER BY procedure_order_seq";
    $res = sqlStatement($query, array($orderid));
    $encount = 0;
    while ($row = sqlFetchArray($res)) {
        $order_seq = empty($row['procedure_order_seq']) ? 0 : $row['procedure_order_seq'] + 0;
        $procedure_code = empty($row['procedure_code']) ? '' : $row['procedure_code'];
        $procedure_name = empty($row['procedure_name']) ? '' : $row['procedure_name'];
        $diagnoses = empty($row['diagnoses']) ? '' : $row['diagnoses'];
        ++$encount;
        $bgcolor = "#" . ($encount & 1 ? "ddddff" : "ffdddd");
        echo " <tr class='detail' bgcolor='{$bgcolor}'>\n";
        echo "  <td>" . text("{$procedure_code}") . "</td>\n";
        echo "  <td>" . text("{$procedure_name}") . "</td>\n";
        echo "  <td>" . text("{$diagnoses}") . "</td>\n";
        echo " </tr>\n";
    }
    ?>

</table>
</div>

<?php 
}
 /**
  * Devuelve al configuración del buscador de planes de una obra social
  * @param InsuranceCompany $company
  * @return AsyncRecordFinder
  */
 public function plans($company)
 {
     $recordFinder = new AsyncRecordFinder('Search plans', $company->insurancePlans());
     $recordFinder->addSearchFieldFree('code', 'Code');
     $recordFinder->addSearchFieldFree('name', 'Name');
     $recordFinder->addTitleField('code', 'Code');
     $recordFinder->addTitleField('name', 'Name');
     $recordFinder->addDescriptionField('description', 'Description');
     return $recordFinder->generateXmlConfiguration();
 }