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"); }
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"); }
* 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>"; }