<?php

error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
include $root_path . 'language/en/lang_en_reporting.php';
//require($root_path.'include/inc_environment_global.php');
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_obj = new Insurance_tz();
?>
<head>
<style type="text/css">
.report{
font-size: 10px;
border-collapse:collapse;
}
</style>
</head>
<BODY bgcolor="#ffffff" link="#000066" alink="#cc0000" vlink="#000066">
<form>
<table width=100% border=0 cellspacing=0 height=100%>
<tbody class="main">





	<tr>

	  <td  valign="top" align="middle" height="35">
		   <table width="770" border=0 align="center" cellspacing="0"  class="titlebar">
    function ShowNewQuotations($in_outpatient, $sid)
    {
        global $db;
        $counter = 0;
        $color_change = FALSE;
        $this->debug = FALSE;
        $this->debug ? $db->debug = true : ($db->debug = FALSE);
        if ($this->debug) {
            echo "<br><b>Method class_tz_billing::ShowNewQuotations()</b><br>";
        }
        if ($this->CreateTmpTableOfElementsToQuote(0, $in_outpatient)) {
            $result = $this->GetNewQuotationOverview();
        }
        $ins_obj = new Insurance_tz();
        //		$result=$this->getNewQuotation_Prescriptions(0,$in_outpatient,$id_array);
        //		$this->getNewQuotation_Laboratory(0,$in_outpatient,$id_array);
        //		$this->getNewQuotation_Radiology(0,$in_outpatient,&$id_array);
        if ($result) {
            while ($row = $result->FetchRow()) {
                $counter++;
                if ($color_change) {
                    $BGCOLOR = 'bgcolor="#ffffdd"';
                    $color_change = FALSE;
                } else {
                    $BGCOLOR = 'bgcolor="#ffffaa"';
                    $color_change = TRUE;
                }
                if ($row['purchasing_class'] == 'xray') {
                    $createmode = 'radiology';
                }
                if ($row['purchasing_class'] == 'labtest') {
                    $createmode = 'laboratory';
                }
                $total_count = 0;
                $row['anzahl'] += $row['anzahl'];
                if (empty($row['anzahl'])) {
                    $row['anzahl'] = 0;
                }
                //$labinfo = $this->GetLaboratoryCount($row['encounter_nr']);
                $row['anzahl_lab'] += $row['anzahl_lab'];
                if (empty($row['anzahl_lab'])) {
                    $row['anzahl_lab'] = 0;
                }
                //$radinfo = $this->GetRadiologyCount($row['encounter_nr']);
                $row['anzahl_rad'] += $row['anzahl_rad'];
                if (empty($row['anzahl_rad'])) {
                    $row['anzahl_rad'] = 0;
                }
                $total_count = $row['anzahl'] / 2;
                //echo $row['anzahl']." + ".$row['anzahl_lab']." = ".$total_count;
                if ($in_outpatient == 'outpatient' || $in_outpatient == 'artndental') {
                    $sql = 'SELECT name_formal from care_department where nr=' . $row['current_dept_nr'];
                    $deptresult = $db->Execute($sql);
                    if ($row['current_dept_nr'] == 0) {
                        $deptname = 'Admissions';
                    } else {
                        $deptrow = $deptresult->FetchRow();
                        $deptname = $deptrow[0];
                    }
                } else {
                    $sql = 'SELECT name from care_ward where nr=' . $row['current_ward_nr'];
                    $deptresult = $db->Execute($sql);
                    if ($row['current_ward_nr'] == 0) {
                        $deptname = 'Admissions';
                    } else {
                        $deptrow = $deptresult->FetchRow();
                        $deptname = $deptrow[0];
                    }
                }
                if ($row['insurance_ID'] > 0) {
                    if ($ins_obj->CheckCurrentContractValidity($row['insurance_ID'])) {
                        $ins_name = $ins_obj->GetName_insurance_from_id($row['insurance_ID']);
                    } else {
                        $ins_name = 'Cash';
                    }
                } else {
                    $ins_name = 'Cash';
                }
                if ($ins_name == 'CASH-PATIENT') {
                    $row['insurance_ID'] = -1;
                }
                echo '


          <tr>
          			<form method="GET" action="billing_tz_quotation_select_pricelist.php">
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $row['encounter_date'] . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $row['encounter_nr'] . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $this->ShowPID($row['pid']) . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $row['selian_pid'] . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $row['name_last'] . ', ' . $row['name_first'] . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $row['date_birth'] . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $ins_name . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $total_count . '</div></td>
					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . $deptname . '</div></td>

					  <td ' . $BGCOLOR . ' class="td_content"><div align="center">' . '<a href="../../modules/ambulatory/amb_clinic_discharge_info.php' . URL_APPEND . '&ntid=false&lang=en&target=search&pn=' . $row['encounter_nr'] . '" target="_blank" title="Admission data : Click to show data"><img src="../../gui/img/common/default/pdata.gif" alt="Admission data : Click to show data" width="20" border="0" height="20"></a>' . '</div></td>

					  <td ' . $BGCOLOR . ' class="td_content"><div align="center"><input type="hidden" name="namelast" value="' . $row['name_last'] . '"><input type="hidden" name="patient" value="' . $_REQUEST['patient'] . '"><input type="hidden" name="namefirst" value="' . $row['name_first'] . '"><input type="hidden" name="createmode" value="' . $createmode . '"><input type="hidden" name="countpres" value="' . $row['anzahl'] . '"><input type="hidden" name="countrad" value="' . $row['anzahl_rad'] . '"><input type="hidden" name="countlab" value="' . $row['anzahl_lab'] . '"><input type="hidden" value="' . $row['encounter_nr'] . '" name="encounter_nr"><input type="hidden" value="' . $row['pid'] . '" name="pid"><input type="hidden" name="insurance_id" value="' . $row['insurance_ID'] . '"><input type="submit" value=">>"></div></td>
					  </form>
					</tr>';
                $alreadyshown[$row['encounter_nr']] = $row['encounter_nr'];
            }
        } else {
            echo '<tr><td colspan="8" align="center">Houston we have a problem. Database error :(</td></tr>';
        }
        if (!$counter) {
            echo '<tr><td colspan="8" align="center">Nothing to do :)</td></tr>';
        }
    }
<?php

error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
if ($mode == "new") {
    $start_timestamp = mktime(0, 0, 0, substr($start, 3, 2), substr($start, 0, 2), substr($start, 6, 4));
    $end_timestamp = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4));
    if ($insurance_tz->CheckContractValidity($company_id, $start_timestamp, $end_timestamp)) {
        $insurance_tz->CreateInsuranceContract($company_id, $plan, $start_timestamp, $end_timestamp);
        header("location: insurance_company_tz_contracts.php?id=" . $company_id);
    } else {
        $error = $LDERRORTimeFrame;
    }
}
require "gui/gui_insurance_company_tz_contracts_new.php";
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
*
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
define('LANG_FILE', 'lang_en_billing.php');
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
require_once $root_path . 'include/care_api_classes/class_tz_billing.php';
$bill_obj = new Bill();
require_once $root_path . 'include/care_api_classes/class_tz_insurance_reports.php';
$insurance_tz_report = new Insurance_Reports_tz();
$debug = FALSE;
$debug == TRUE ? $db->debug = true : ($db->debug = false);
?>

<table border=0>
	<tr valign="top">
	<td>
		<!-- Here begins the form  -->

			<?php 
//define array of the GET-variables
<?php

error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
require_once $root_path . 'include/care_api_classes/class_person.php';
$person_obj = new Person();
$id = $_GET['id'];
$this_insurance = $insurance_tz->GetInsuranceAsArray($id);
require "gui/gui_insurance_reports_company_contracts.php";
        case 'quick':
            $breakfile = 'nursing-schnellsicht.php' . URL_APPEND;
            break;
        case 'ward_mng':
            $breakfile = 'nursing-station-info.php' . URL_APPEND . '&ward_nr=' . $ward_nr . '&mode=show';
            break;
        case 'search_patient':
            $breakfile = 'nursing-patient-such-start.php' . URL_APPEND;
    }
}
# Create ward object
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward();
# Create insurance object
include_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$ins_obj = new Insurance_tz();
# create multi functional object
include_once $root_path . 'include/care_api_classes/class_multi.php';
$multi_obj = new multi();
$vct = $multi_obj->__genNumbers();
# Create insurance object
include_once $root_path . 'include/care_api_classes/class_mini_dental.php';
$mini_obj = new dental();
# Load date formatter
require_once $root_path . 'include/inc_date_format_functions.php';
require_once $root_path . 'global_conf/inc_remoteservers_conf.php';
if ($mode == '' || $mode == 'fresh') {
    if ($ward_info =& $ward_obj->getWardInfo($ward_nr)) {
        $room_obj =& $ward_obj->getRoomInfo($ward_nr, $ward_info['room_nr_start'], $ward_info['room_nr_end']);
        $all_info = $ward_obj->getAll_WardInfo($doclist);
        if (is_object($room_obj)) {
$lang_tables[] = 'aufnahme.php';
//include($root_path.'include/inc_load_lang_tables.php');
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_encounter.php';
require_once $root_path . 'include/care_api_classes/class_person.php';
require_once $root_path . 'include/care_api_classes/class_tz_billing.php';
//$billing_tz = new Bill();
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
//$insurance_tz = new Insurance_tz();
require_once $root_path . 'include/care_api_classes/class_tz_drugsandservices.php';
//require_once($root_path.'include/care_api_classes/class_tz_insurance_reports.php');
//$insurance_tz_report = new Insurance_Reports_tz();
$per_obj = new Person();
$enc_obj = new Encounter();
$bill_obj = new Bill();
$insurance_obj = new Insurance_tz();
$drg_obj = new DrugsAndServices();
global $company_id;
$user_origin = 'quotation';
$clear_bill = $_POST['clear_bill'];
$balance = $_POST['balance'];
$debug = FALSE;
$debug ? $db->debug = TRUE : ($db->debug = FALSE);
if ($debug) {
    echo "task:" . $task . "<br>";
}
$IS_PATIENT_INSURED = $insurance_obj->is_patient_insured($pid);
//$enc_obj->LoadEncounterData();
//$IS_PATIENT_INSURED=$insurance_obj->is_patient_insured($enc_obj->ShowPID($bat_nr));
if ($debug) {
    echo "<b>billing_tz_quotation_create.php</b>";
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
if ($mode == 'insert') {
    //Error checking
    if (strlen(trim($name)) < 1) {
        $error['name'] = true;
    }
    if (strlen(trim($contact)) < 1) {
        $error['contact'] = true;
    }
    if (!$insurance && $invoice_flag != 'on') {
        $error['insurance'] = true;
    }
    if (!$error) {
        $newid = $insurance_tz->InsertNewInsuranceCompany($_POST);
        if ($newid) {
            if ($sitetarget == 'contract') {
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
if ($mode == 'insert') {
    //Error checking
    if (strlen(trim($name)) < 3) {
        $error['name'] = true;
    }
    if (!is_numeric($ceiling)) {
        $error['ceiling'] = true;
    }
    if (!$error) {
        if ($insurance_tz->InsertInsuranceType($_POST)) {
            header("location: insurance_types_tz.php");
        }
    }
    $this_insurance = $_POST;
}
 function StoreLaboratoryItemToBill($pid, $batch_nr, $bill_number, $insurance)
 {
     global $db, $root_path;
     $this->debug = FALSE;
     if ($this->debug) {
         echo "<b>class_tz_billing::LaboratoryItemToBill(pid: {$pid}, batch_nr: {$batch_nr}, bill_number: {$bill_number}, insurance: {$insurance})</b><br>";
     }
     $this->debug ? $db->debug = TRUE : ($db->debug = FALSE);
     // do we have pending issues of prescriptions?
     // read all items out of the prescription table
     // old code
     //    $this->sql = "select
     //                          encounter_nr,
     //                          parameters
     //                  FROM $this->tbl_lab_requests
     //                  WHERE batch_nr=".$batch_nr;
     $this->sql = "select *\n\n                  FROM care_test_request_chemlabor_sub c_sub, care_tz_laboratory_param c_param\n                  WHERE c_sub.sub_id=" . $batch_nr . " AND c_sub.paramater_name=c_param.id";
     $result = $db->Execute($this->sql);
     while ($row = $result->FetchRow()) {
         //echo $this->records['paramater_name'];
         //$this->chemlab_testname = $this->GetNameOfLAboratoryFromID($this->records['id']);
         //$this->price = $this->GetPriceOfLAboratoryItemFromID($this->records['id']);
         if ($this->debug) {
             echo 'id      : ' . $row['id'] . '<br>';
         }
         if ($this->debug) {
             echo 'Testname: ' . $row['name'] . '<br>';
         }
         if ($this->debug) {
             echo 'Price:    ' . $row['price'] . '<br>';
         }
         $insurance_tz = new Insurance_tz();
         $contract = $insurance_tz->CheckForValidContract($pid);
         if ($this->debug) {
             echo 'contract id :    ' . $contract['id'] . '<br>';
         }
         //$contract['id'] = 12;
         $this->chemlab_amount = 1;
         $this->sql = "INSERT INTO {$this->tbl_bill_elements} (nr, date_change, is_labtest, is_medicine, amount, price, balanced_insurance, insurance_id, description)\n\t\t\tVALUES (" . $bill_number . "," . time() . ",1,0," . $this->chemlab_amount . ",'" . $row['price'] . "','" . $insurance . "','" . $contract['id'] . "','" . $row['name'] . "')";
         if ($this->debug) {
             echo $this->sql;
         }
         $db->Execute($this->sql);
     }
     // Mark these lines in the table prescription as "still billed". We can do this
     // in that way: Insert the billing number where we can find this article again...
     //herausfinden, was geändert wird, damit Rechnung als billed gekennzeichnet wird
     $this->sql = "UPDATE {$this->tbl_lab_requests} SET bill_number='" . $bill_number . "' , bill_status='pending' WHERE sub_id=" . $batch_nr;
     if ($this->debug) {
         echo $this->sql;
     }
     $db->Execute($this->sql);
     //    $this->parameters = $db->Execute($this->sql);
     //    while ($this->records=$this->parameters->FetchRow()) {
     //      if ($this->debug) echo $this->records['parameters']."<br>";
     //      parse_str($this->records['parameters'],$this->parameter_array);
     //      while(list($this->index,$this->chemlab_amount) = each($this->parameter_array)) {
     //  				//Strip the string baggage off to get the task id
     //  				$this->chemlab_testindex = substr($this->index,5,strlen($this->index)-6);
     //
     //          $this->chemlab_testname = $this->GetNameOfLAboratoryFromID($this->chemlab_testindex);
     //
     //          $this->price = $this->GetPriceOfLAboratoryItemFromID($this->chemlab_testindex);
     //          if ($this->debug) echo "the name of chemlab is:".$this->chemlab_testname." with a amount of ".$this->chemlab_amount." and a price of ".$this->price."<br>";
     //          require_once($root_path.'include/care_api_classes/class_tz_insurance.php');
     //		  $insurance_tz = New Insurance_tz();
     //		  $contract = $insurance_tz->CheckForValidContract($pid);
     //          // we have it all... now we store it into the billing-elements-table
     //          $this->sql ="INSERT INTO $this->tbl_bill_elements (nr, date_change, is_labtest, is_medicine, amount, price, balanced_insurance, insurance_id, description)
     //								 			VALUES (".$bill_number.",".time().",1,0,".$this->chemlab_amount.",'".$this->price."','".$insurance."','".$contract['id']."','".$this->chemlab_testname."')";
     //				  if ($this->debug) echo $this->sql;
     //				  $db->Execute($this->sql);
     //				  $insurance=0;
     //			  }
     //    }
     //    // Mark these lines in the table prescription as "still billed". We can do this
     //    // in that way: Insert the billing number where we can find this article again...
     //    $this->sql="UPDATE $this->tbl_lab_requests SET bill_number='".$bill_number."' , bill_status='pending' WHERE batch_nr=".$batch_nr;
     //    $db->Execute($this->sql);
 }
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
$this_insurance = $insurance_tz->GetInsuranceAsArray($id);
if ($mode == 'update') {
    //Error checking
    if (strlen(trim($name)) < 3) {
        $error['name'] = true;
    }
    if (strlen(trim($contact)) < 3) {
        $error['contact'] = true;
    }
    if (!$insurance) {
        $error['insurance'] = true;
    }
    if (!$error) {
        if ($insurance_tz->UpdateInsuranceCompany($_POST)) {
            header("location: insurance_company_tz.php");
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$thisfile = basename($_SERVER['PHP_SELF']);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require_once $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_person.php';
$person_obj = new Person();
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
//echo "todo is $todo <br>"; //if dodo==finish, let the user go out of that screen!
//echo "mode is set to $mode <br>"; //if mode==update, make the updates to the datasets and let the user see what he has done/changed
if ($mode == 'update') {
    if ($insurance) {
        $insurance_tz->UpdateContractsArray($_POST);
        header("location: insurance_members_tz.php?company_id=" . $insurance);
    }
}
if (is_array($item_no)) {
    $counter = 0;
    while (list($x, $v) = each($item_no)) {
        echo $counter;
        $contract = $insurance_tz->CheckForValidContract($v, 0, $company_id);
        $contract_array[$counter]['PID'] = $v;
        $contract_array[$counter]['Contract'] = $contract;
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
$this_insurance = $insurance_tz->GetInsuranceAsArray($id);
if (is_array($insurance_tz->GetContractsForCompanyAsArray($id))) {
    $SHOW_ADDMEMBER_BUTTON = TRUE;
} else {
    $SHOW_ADDMEMBER_BUTTON = FALSE;
}
/*
 *  NOTE: For this script is $id = company ID
 */
if ($mode == "updateflags") {
    //Error checking
    if (strlen(trim($name)) < 3) {
        $error['name'] = true;
    }
    if (strlen(trim($contact)) < 3) {
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
$lang_tables[] = 'billing.php';
$lang_tables[] = 'aufnahme.php';
require $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$insurance_tz = new Insurance_tz();
$this_insurance = $insurance_tz->GetInsuranceTypeAsArray($id);
if ($mode == 'update') {
    //Error checking
    if (strlen(trim($name)) < 3) {
        $error['name'] = true;
    }
    if (!is_numeric($ceiling)) {
        $error['ceiling'] = true;
    }
    if (!$error) {
        if ($insurance_tz->UpdateInsuranceType($_POST)) {
            header("location: insurance_types_tz.php");
        }
    }
    $this_insurance = $_POST;