3 * The purpose of this module is to show a list of insurance
4 * companies that match the passed-in search strings, and to allow
5 * one of them to be selected.
8 * @link http://www.open-emr.org
9 * @author Rod Roark <rod@sunsetsystems.com>
10 * @author Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2005 Rod Roark <rod@sunsetsystems.com>
12 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 require_once("../globals.php");
19 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
24 // Putting a message here will cause a popup window to display it.
27 function addwhere($where, $colname, $value)
31 $where .= "$colname LIKE '%" . add_escape_custom($value) . "%'";
37 // The following code builds the appropriate SQL query from the
38 // search parameters passed by our opener (ins_search.php).
41 $where = addwhere($where, 'i.name', $_GET['form_name']);
42 $where = addwhere($where, 'i.attn', $_GET['form_attn']);
43 $where = addwhere($where, 'i.cms_id', $_GET['form_cms_id']);
44 $where = addwhere($where, 'a.line1', $_GET['form_addr1']);
45 $where = addwhere($where, 'a.line2', $_GET['form_addr2']);
46 $where = addwhere($where, 'a.city', $_GET['form_city']);
47 $where = addwhere($where, 'a.state', $_GET['form_state']);
48 $where = addwhere($where, 'a.zip', $_GET['form_zip']);
50 $phone_parts = array();
52 // Search by area code if there is one.
58 $where = addwhere($where, 'p.area_code', $phone_parts[1]);
61 // If there is also an exchange, search for that too.
63 "/\d\d\d\D*(\d\d\d)/",
67 $where = addwhere($where, 'p.prefix', $phone_parts[1]);
70 // If the last 4 phone number digits are given, search for that too.
72 "/\d\d\d\D*\d\d\d\D*(\d\d\d\d)/",
76 $where = addwhere($where, 'p.number', $phone_parts[1]);
80 "i.id, i.name, i.attn, " .
81 "a.line1, a.line2, a.city, a.state, a.zip, " .
82 "p.area_code, p.prefix, p.number " .
83 "FROM insurance_companies AS i, addresses AS a, phone_numbers AS p " .
84 "WHERE a.foreign_id = i.id AND p.foreign_id = i.id$where " .
85 "ORDER BY i.name, a.zip";
86 $res = sqlStatement($query);
90 <title
><?php
echo xlt('List Insurance Companies');?
></title
>
91 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
94 td
{ font
-size
:10pt
; }
97 <script language
="JavaScript">
99 // This is invoked when an insurance company name is clicked.
100 function setins(ins_id
, ins_name
) {
101 opener
.set_insurance(ins_id
, ins_name
);
110 <body
class="body_top">
111 <form method
='post' name
='theform'>
114 <table
class="table table-condensed" border
='0' width
='100%'>
116 <td
><b
><?php
echo xlt('Name');?
></b
> 
;</td
>
117 <td
><b
><?php
echo xlt('Attn');?
></b
> 
;</td
>
118 <td
><b
><?php
echo xlt('Address');?
></b
> 
;</td
>
119 <td
><b
> 
;</b
> 
;</td
>
120 <td
><b
><?php
echo xlt('City');?
></b
> 
;</td
>
121 <td
><b
><?php
echo xlt('State');?
></b
> 
;</td
>
122 <td
><b
><?php
echo xlt('Zip');?
></b
> 
;</td
>
123 <td
><b
><?php
echo xlt('Phone');?
></b
></td
>
127 while ($row = sqlFetchArray($res)) {
128 $anchor = "<a href=\"\" onclick=\"return setins(" .
129 attr_js($row['id']) . "," . attr_js($row['name']) . ")\">";
131 if ($row['number']) {
132 $phone = text($row['area_code']) . '-' . text($row['prefix']) . '-' . text($row['number']);
136 echo " <td valign='top'>$anchor" . text($row['name']) . "</a> </td>\n";
137 echo " <td valign='top'>" . text($row['attn']) . " </td>\n";
138 echo " <td valign='top'>" . text($row['line1']) . " </td>\n";
139 echo " <td valign='top'>" . text($row['line2']) . " </td>\n";
140 echo " <td valign='top'>" . text($row['city']) . " </td>\n";
141 echo " <td valign='top'>" . text($row['state']) . " </td>\n";
142 echo " <td valign='top'>" . text($row['zip']) . " </td>\n";
143 echo " <td valign='top'>" . $phone . "</td>\n";