$and_sql .= ' AND o.dept_nr=' . $dept_nr; } $sql2 = "{$from_sql} WHERE o.encounter_nr {$sql_LIKE} '{$matchcode}%' {$and_sql}"; $sql = $select_sql . $sql2 . "\tORDER BY {$prefx}.{$oitem} {$odir}"; //if(!isset($all_depts)||$all_depts=='false') $sql.=' AND o.dept_nr='.$dept_nr; if ($ergebnis = $db->SelectLimit($sql, $pagen->MaxCount(), $pgx)) { if (!($rows = $ergebnis->RecordCount())) { // if not found find similar $sql2 = " {$from_sql} WHERE ( "; # Try if numeric if (is_numeric($matchcode)) { $sql2 .= " o.nr {$sql_LIKE} '" . trim($matchcode) . "%'\n\t\t\t\t\t\t\t\t\t\t\tOR o.encounter_nr {$sql_LIKE} '" . trim($matchcode) . "%'\n\t\t\t\t\t\t\t\t\t\t\tOR "; } $sql2 .= "p.name_last {$sql_LIKE} '" . trim($matchcode) . "%'\n\t\t\t\t\t\t\t\t\t\t\tOR p.name_first {$sql_LIKE} '" . trim($matchcode) . "%'"; # Try DOB $DOB = formatDate2STD($matchcode, $date_format); if (!empty($DOB)) { $sql2 .= " OR p.date_birth = '{$DOB}'"; } $sql2 .= ") {$and_sql}"; //if(!isset($all_depts)||$all_depts=='false') $sql.=' AND o.dept_nr='.$dept_nr; //echo $all_depts; $sql2 .= "\tORDER BY {$prefx}.{$oitem} {$odir}"; $sql = $select_sql . $sql2; //echo $sql; if ($ergebnis = $db->SelectLimit($sql, $pagen->MaxCount(), $pgx)) { $rows = $ergebnis->RecordCount(); } } } else { echo "{$LDDbNoRead}<p> {$sql} <p>";
/** * Displays the GUI input form */ function display() { global $db, $sid, $lang, $root_path, $pid, $insurance_show, $user_id, $mode, $dbtype, $no_tribe, $no_region, $update, $photo_filename; #, $_FILES $_POST, $_SESSION; extract($_POST); require_once $root_path . 'include/care_api_classes/class_advanced_search.php'; # Load the language tables $lang_tables = $this->langfiles; include $root_path . 'include/inc_load_lang_tables.php'; include_once $root_path . 'include/inc_date_format_functions.php'; include_once $root_path . 'include/care_api_classes/class_insurance.php'; include_once $root_path . 'include/care_api_classes/class_person.php'; $db->debug = FALSE; # Create the new person object $person_obj =& new Person($pid); # Create a new person insurance object $pinsure_obj =& new PersonInsurance($pid); if (!isset($insurance_show)) { $insurance_show = TRUE; } $newdata = 1; $error = 0; $dbtable = 'care_person'; if (!isset($photo_filename) || empty($photo_filename)) { $photo_filename = 'nopic'; } # Assume first that image is not uploaded $valid_image = FALSE; //* Get the global config for person's registration form*/ include_once $root_path . 'include/care_api_classes/class_globalconfig.php'; $glob_obj = new GlobalConfig($GLOBAL_CONFIG); $glob_obj->getConfig('person_%'); extract($GLOBAL_CONFIG); # Check whether config foto path exists, else use default path $photo_path = is_dir($root_path . $GLOBAL_CONFIG['person_foto_path']) ? $GLOBAL_CONFIG['person_foto_path'] : $this->default_photo_path; if ($mode == 'save' || $mode == 'forcesave') { $search_obj =& new advanced_search(); if (is_array($result_array = $search_obj->get_equal_words("tribe_name", "care_tz_tribes", false, 65, 'tribe_id')) && $name_maiden && !$no_tribe) { $tribe_array = $result_array; } else { $tribe_array = $result_array; } if (is_array($result_array = $search_obj->get_equal_words("name", "care_tz_religion", false, 65, 'nr')) && $religion && !$person_religion_hide) { $religion_array = $result_array; } else { $religion_array = $result_array; } /* if (is_array($result_array=$search_obj->get_equal_words("region_name", "care_tz_region", false, 65, 'region_id')) && $email && !$person_email_hide ) { $region_array=$result_array; } else { $region_array=$result_array; } if (is_array($result_array=$search_obj->get_equal_words1("district_name", "care_tz_district", false, 65, 'district_id',$email)) && $sss_nr ) { $district_array=$result_array; } else { $district_array=$result_array; } if (is_array($result_array=$search_obj->get_equal_words1("ward_name", "care_tz_ward", false, 65, 'ward_id',$sss_nr)) && $nat_id_nr ) { $ward_array=$result_array; } else { $ward_array=$result_array; } */ # If saving is not forced, validate important elements if ($mode != 'forcesave') { # clean and check input data variables if (trim($encoder) == '') { $encoder = $aufnahme_user; } if (trim($name_last) == '') { $errornamelast = 1; $error++; } //if (trim($selian_pid)=='' || !is_numeric($selian_pid) || (!$update && $person_obj->SelianFileExists($selian_pid))) { $errorfilenr=1; $error++;} if ($person_obj->IsHospitalFileNrMandatory()) { if (trim($selian_pid) == '' || !$update && $person_obj->SelianFileExists($selian_pid)) { $errorfilenr = 1; $error++; } } if (trim($name_first) == '') { $errornamefirst = 1; $error++; } if (trim($date_birth) == '') { $errordatebirth = 1; $error++; } if (mktime(0, 0, 0, substr($date_birth, 3, 2), substr($date_birth, 0, 2), substr($date_birth, 6, 4)) > time()) { $errordatebirth = 1; $error++; } //if (is_array($tribe_array) && !$no_tribe) {$errormaiden=1; $error++;} //if (is_array($town_array)) {$errortown=1; $error++;} //if (!$citizenship) { $errortown=1; $error++;} if ($sex == '') { $errorsex = 1; $error++; } } # If the validation produced no error, save the data if (!$error) { # Save the old filename for testing $old_fn = $photo_filename; # Create image object include_once $root_path . 'include/care_api_classes/class_image.php'; $img_obj =& new Image(); # Check the uploaded image file if exists and valid if ($img_obj->isValidUploadedImage($_FILES['photo_filename'])) { $valid_image = TRUE; # Get the file extension $picext = $img_obj->UploadedImageMimeType(); } //addr_citytown_nr='$addr_citytown_nr', if ($update) { //echo formatDate2STD($geburtsdatum,$date_format); $sql = "UPDATE {$dbtable} SET\n\t\t\t\t\t\t\t title='{$title}',\n\t\t\t\t\t\t\t selian_pid='{$selian_pid}',\n\t\t\t\t\t\t\t name_last='{$name_last}',\n\t\t\t\t\t\t\t name_first='{$name_first}',\n\t\t\t\t\t\t\t name_2='{$name_2}',\n\t\t\t\t\t\t\t name_3='{$name_3}',\n\t\t\t\t\t\t\t name_middle='{$name_middle}',\n\t\t\t\t\t\t\t name_maiden='{$name_maiden}',\n\t\t\t\t\t\t\t name_others='{$name_others}',\n\t\t\t\t\t\t\t date_birth='" . formatDate2STD($date_birth, $date_format) . "',\n\t\t\t\t\t\t\t blood_group='" . trim($blood_group) . "',\n\t\t\t\t\t\t\t rh='" . trim($rh) . "',\n\t\t\t\t\t\t\t sex='{$sex}',\n\t\t\t\t\t\t\t addr_str='{$addr_str}',\n\t\t\t\t\t\t\t addr_str_nr='{$addr_str_nr}',\n\t\t\t\t\t\t\t addr_zip='{$addr_zip}',\n\t\t\t\t\t\t\t addr_citytown_nr='{$addr_citytown_nr}',\n\t\t\t\t\t\t\t addr_citytown_name='{$addr_citytown_name}',\n\t\t\t\t\t\t\t phone_1_nr='{$phone_1_nr}',\n\t\t\t\t\t\t\t phone_2_nr='{$phone_2_nr}',\n\t\t\t\t\t\t\t cellphone_1_nr='{$cellphone_1_nr}',\n\t\t\t\t\t\t\t cellphone_2_nr='{$cellphone_2_nr}',\n\t\t\t\t\t\t\t fax='{$fax}',\n\t\t\t\t\t\t\t email='',\n\t\t\t\t\t\t\t citizenship ='{$citizenship}',\n\t\t\t\t\t\t\t civil_status='{$civil_status}',\n\t\t\t\t\t\t\t sss_nr='',\n\t\t\t\t\t\t\t nat_id_nr='',\n\t\t\t\t\t\t\t religion='{$religion}', insurance_ID='{$insurance_ID}',\n\t\t\t\t\t\t\t ethnic_orig='{$ethnic_orig}',\n\t\t\t\t\t\t\t date_update='" . date('Y-m-d H:i:s') . "',"; if ($region != "-1" && $district != "-1" && $ward != "-1") { $sql .= "region='{$region}',\n\t\t\t\t\t\t\t district='{$district}',\n\t\t\t\t\t\t\t ward='{$ward}',"; } //if ($old_fn!=$photo_filename){ if ($valid_image) { # Compose the new filename $photo_filename = $pid . '.' . $picext; # Save the file $img_obj->saveUploadedImage($_FILES['photo_filename'], $root_path . $photo_path . '/', $photo_filename); # add to the sql query $sql .= " photo_filename='{$photo_filename}',"; } # complete the sql query $sql .= " history=" . $person_obj->ConcatHistory("Update " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . " \n") . ", modify_id='" . $_SESSION['sess_user_name'] . "' WHERE pid={$pid}"; //$db->debug=true; $db->BeginTrans(); $ok = $db->Execute($sql); if ($ok) { $db->CommitTrans(); # Update the insurance data # Lets detect if the data is already existing if ($insurance_show) { if ($insurance_item_nr) { if (!empty($insurance_nr) && !empty($insurance_firm_name) && $insurance_firm_id) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'class_nr' => $insurance_class_nr, 'history' => "Update " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . " \n", 'modify_id' => $_SESSION['sess_user_name'], 'modify_time' => date('YmdHis')); $pinsure_obj->updateDataFromArray($insure_data, $insurance_item_nr); } } elseif ($insurance_nr && $insurance_firm_name && $insurance_class_nr) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'pid' => $pid, 'class_nr' => $insurance_class_nr, 'history' => "Update " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . " \n", 'create_id' => $_SESSION['sess_user_name'], 'create_time' => date('YmdHis')); $pinsure_obj->insertDataFromArray($insure_data); } } $newdata = 1; if (file_exists($this->displayfile)) { header("location: {$this->displayfile}" . URL_REDIRECT_APPEND . "&pid={$pid}&from={$from}&newdata=1&target=entry"); exit; } else { echo "Error! Target display file not defined!!"; } } else { $db->RollbackTrans(); } } else { $from = 'entry'; $_POST['date_birth'] = @formatDate2Std($date_birth, $date_format); $_POST['date_reg'] = date('Y-m-d H:i:s'); $_POST['blood_group'] = trim($_POST['blood_group']); $_POST['status'] = 'normal'; $_POST['history'] = "Init.reg. " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n"; //$_POST['modify_id']=$_SESSION['sess_user_name']; $_POST['create_id'] = $_SESSION['sess_user_name']; $_POST['create_time'] = date('YmdHis'); # Prepare internal data to be stored together with the user input data if (!$person_obj->InitPIDExists($GLOBAL_CONFIG['person_id_nr_init'])) { # If db is mysql, insert the initial pid value from global config # else let the dbms make an initial value via the sequence generator e.g. postgres # However, the sequence generator must be configured during db creation to start at # the initial value set in the global config if ($dbtype == 'mysql') { $_POST['pid'] = $GLOBAL_CONFIG['person_id_nr_init']; } } else { # Persons are existing. Check if duplicate might exist if (is_object($duperson = $person_obj->PIDbyData($_POST))) { $error_person_exists = TRUE; } } //echo $person_obj->getLastQuery(); if (!$error_person_exists || $mode == 'forcesave') { if ($person_obj->insertDataFromInternalArray()) { # If data was newly inserted, get the insert id if mysq, else get the pid number) if (!$update) { $oid = $db->Insert_ID(); $pid = $person_obj->LastInsertPK('pid', $oid); /* if($dbtype=='mysql'){ $pid=$db->Insert_ID(); }else{ $pid=$person_obj->postgre_Insert_ID($dbtable,'pid',$db->Insert_ID()); }*/ } //if(!$update) $pid=$db->Insert_ID(); # Save the valid uploaded photo if ($valid_image) { # Compose the new filename by joining the pid number and the file extension with "." $photo_filename = $pid . '.' . $picext; # Save the file if ($img_obj->saveUploadedImage($_FILES['photo_filename'], $root_path . $photo_path . '/', $photo_filename)) { # Update the filename to the databank $person_obj->setPhotoFilename($pid, $photo_filename); } } //echo $pid; //echo $citizenship; # Update the insurance data # Lets detect if the data is already existing if ($insurance_show) { if ($insurance_item_nr) { if (!empty($insurance_nr) && !empty($insurance_firm_name) && $insurance_firm_id) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'class_nr' => $insurance_class_nr); $pinsure_obj->updateDataFromArray($insure_data, $insurance_item_nr); } } elseif ($insurance_nr && $insurance_firm_name && $insurance_class_nr) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'pid' => $pid, 'class_nr' => $insurance_class_nr); $pinsure_obj->insertDataFromArray($insure_data); } } $newdata = 1; if (file_exists($this->displayfile)) { header("location: {$this->displayfile}" . URL_REDIRECT_APPEND . "&pid={$pid}&from={$from}&newdata=1&target=entry"); exit; } else { echo "Error! Target display file not defined!!"; } } else { echo "<p>{$db->ErrorMsg}()<p>{$LDDbNoSave}"; } } } } // end of if(!$error) } elseif (!empty($this->pid)) { # Get the person�s data if ($data_obj =& $person_obj->getAllInfoObject()) { $zeile = $data_obj->FetchRow(); extract($zeile); //print_r($zeile); # Get the related insurance data $p_insurance =& $pinsure_obj->getPersonInsuranceObject($pid); if ($p_insurance == FALSE) { $insurance_show = TRUE; } else { if (!$p_insurance->RecordCount()) { $insurance_show = TRUE; } elseif ($p_insurance->RecordCount() == 1) { $buffer = $p_insurance->FetchRow(); extract($buffer); $insurance_show = TRUE; $insurance_firm_name = $pinsure_obj->getFirmName($insurance_firm_id); } else { $insurance_show = FALSE; } } } } else { $date_reg = date('Y-m-d H:i:s'); } # Get the insurance classes $insurance_classes =& $pinsure_obj->getInsuranceClassInfoObject('class_nr,name,LD_var AS "LD_var"'); include_once $root_path . 'include/inc_photo_filename_resolve.php'; $search_obj =& new advanced_search(); if (!$update) { $tribe = $name_maiden; $town = $citizenship; } if (is_array($result_array = $search_obj->get_equal_words("tribe_name", "care_tz_tribes", false, 65, 'tribe_id')) && $name_maiden && !$no_tribe) { $tribe_array = $result_array; } else { $tribe_array = $result_array; } /* if (is_array($result_array=$search_obj->get_equal_words("village_name", "care_tz_village", false, 65, 'village_id',$ward)) && $addr_citytown_nr) { $town_array=$result_array; } else { $town_array=$result_array; }*/ if (is_array($result_array = $search_obj->get_equal_words("name", "care_tz_religion", false, 65, 'nr')) && $religion) { $religion_array = $result_array; } else { $religion_array = $result_array; } /* if (is_array($result_array=$search_obj->get_equal_words("region_name", "care_tz_region", false, 65, 'region_id')) && $email && !$person_email_hide ) { $region_array=$result_array; } else { $region_array=$result_array; } if (is_array($result_array=$search_obj->get_equal_words1("district_name", "care_tz_district", false, 65, 'district_id',$email)) && $sss_nr ) { $district_array=$result_array; } else { $district_array=$result_array; } if (is_array($result_array=$search_obj->get_equal_words1("ward_name", "care_tz_ward", false, 65, 'ward_id',$sss_nr)) && $nat_id_nr ) { $ward_array=$result_array; } else { $ward_array=$result_array; } */ ######## Here starts the GUI output ####################################################### $img_male = createComIcon($root_path, 'spm.gif', '0'); $img_female = createComIcon($root_path, 'spf.gif', '0'); $tbg = 'background="' . $root_path . 'gui/img/common/' . $theme_com_icon . '/tableHeader_gr.gif"'; if (!empty($this->pretext)) { echo $this->pretext; } ?> <script language="javascript"> <!-- function test(){ document.aufnahmeform.action="<?php $_SERVER['PHP_SELF']; ?> "; document.aufnahmeform.submit(); } function forceSave(){ document.aufnahmeform.mode.value="forcesave"; document.aufnahmeform.submit(); } function showpic(d){ if(d.value) document.images.headpic.src=d.value; } function popSearchWin(target,obj_val,obj_name){ urlholder="./data_search.php<?php echo URL_REDIRECT_APPEND; ?> &target="+target+"&obj_val="+obj_val+"&obj_name="+obj_name; DSWIN<?php echo $sid; ?> =window.open(urlholder,"wblabel<?php echo $sid; ?> ","menubar=no,width=400,height=550,resizable=yes,scrollbars=yes"); } function list_popup(d,chosentype) { if(d.value=="notinlist") { urlholder="<?php echo $root_path; ?> modules/registration_admission/notinlist.php<?php echo URL_APPEND . '&chosentype=" + chosentype + "'; ?> "; notinlist=window.open(urlholder,"notinlist","width=500,height=450,menubar=no,resizable=yes,scrollbars=yes"); } } function chkform(d) { <?php if ($person_obj->IsHospitalFileNrMandatory()) { echo 'if(d.selian_pid.value==""){ alert("Please enter Hospital File Number"); d.selian_pid.focus(); return false; }else'; } ?> if(d.name_last.value==""){ alert("<?php echo $LDPlsEnterLastName; ?> "); d.name_last.focus(); return false; }else if(d.name_first.value==""){ alert("<?php echo $LDPlsEnterFirstName; ?> "); d.name_first.focus(); return false; }else if(d.name_2.value==""){ alert("<?php echo 'Please Enter Father Name'; ?> "); d.name_2.focus(); return false; }else if(d.date_birth.value==""){ alert("<?php echo $LDPlsEnterDateBirth; ?> "); d.date_birth.focus(); return false; }else if(d.sex[0]&&d.sex[1]&&!d.sex[0].checked&&!d.sex[1].checked){ alert("<?php echo $LDPlsSelectSex; ?> "); return false; <?php if ($update) { $sql = "SELECT * FROM care_person where pid=" . $pid; $ergebnis = $db->Execute($sql); while ($person = $ergebnis->FetchRow()) { $region = $person['region']; } } if (!$update or $region == '') { echo '}else if(d.region.value=="-1"){'; echo 'alert("Please select region");'; echo 'd.region.focus();'; echo 'return false;'; echo '}else if(d.district.value=="-1"){'; echo 'alert("Please select district");'; echo 'd.district.focus();'; echo 'return false;'; echo '}else if(d.ward.value=="-1"){'; echo ' alert("Please select Ward");'; echo ' d.ward.focus();'; echo ' return false;'; } else { echo '}else if(d.region.value!="-1"){'; echo 'if(d.district.value=="-1")'; echo '{'; echo 'alert("Please select district");'; echo 'd.district.focus();'; echo 'return false;'; echo '}'; echo 'if(d.ward.value=="-1")'; echo '{'; echo ' alert("Please select ward");'; echo ' d.ward.focus();'; echo ' return false;'; echo '}'; } ?> }else if(d.user_id.value==""){ alert("<?php echo $LDPlsEnterFullName; ?> "); d.user_id.focus(); return false; }else if(d.name_maiden.value=="-1"){ alert ("Select tribe!"); return false; }else if(d.religion.value=="-1"){ alert ("Select religion!"); return false; }else{ return true; } } <?php require $root_path . 'include/inc_checkdate_lang.php'; ?> --> </script> <script language="javascript" src="<?php echo $root_path; ?> js/setdatetime.js"></script> <script language="javascript" src="<?php echo $root_path; ?> js/checkdate.js"></script> <script language="javascript" src="<?php echo $root_path; ?> js/dtpick_care2x.js"></script> <FONT SIZE=-1 FACE="Arial"> <form method="post" action="<?php echo $thisfile; ?> " name="aufnahmeform" ENCTYPE="multipart/form-data" onSubmit="return chkform(this)"> <table border=0 cellspacing=0 cellpadding=0> <?php if ($error) { echo "<script language=\"Javascript\" type=\"text/javascript\"> </script>"; //alert('Information is missing in the input field marked red!') ; ?> <tr bgcolor=#ffffee> <td colspan=3> <center> <font face=arial color=#7700ff size=4> <img <?php echo createMascot($root_path, 'mascot1_r.gif', '0', 'bottom'); ?> align="absmiddle"> <?php if ($error > 1) { echo "<script language=\"Javascript\" type=\"text/javascript\"> </script>"; //alert('$LDErrorS') echo $LDErrorS; } else { /* echo "<script language=\"Javascript\" type=\"text/javascript\"> alert('Information is missing in the input field marked red!') </script>"; */ echo $LDError; } ?> </center> </td> </tr> <?php } elseif ($error_person_exists) { ?> <tr bgcolor=#ffffee> <td colspan=3> <center> <table border=0> <tr> <td><img <?php echo createMascot($root_path, 'mascot1_r.gif', '0', 'bottom'); ?> align="absmiddle"></td> <td><font face=arial color=#7700ff size=4> <?php echo $LDPersonDuplicate; if ($duperson->RecordCount() > 1) { echo " {$LDSimilarData2} {$LDPlsCheckFirst2}"; } else { echo "{$LDSimilarData} {$LDPlsCheckFirst}"; } echo "<script language=\"Javascript\" type=\"text/javascript\"> </script>"; // alert('$LDSimilarData $LDPlsCheckFirst') echo ' </td> </tr> </table> </center> </td> </tr> <tr> <td colspan=3> <table border=0 cellspacing=0 cellpadding=1 bgcolor="#000000" width=100%> <tr> <td> <table border=0 cellspacing=0 width=100% bgcolor="#ffffff">'; echo ' <tr bgcolor="#66ee66" background="' . $root_path . 'gui/img/common/default/tableHeaderbg.gif">'; echo "\n\t\t\t\t\t<td {$tbg}><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDRegistryNr}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDLastName}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDFirstName}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDBday}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDSex}</b></td>\n\t\t\t\t\t<td {$tbg}><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\n\t\t\t\t\t\t{$LDOptions}</b></td>\n\t\t\t\t\t</tr>"; # Show the probable same person while ($dup = $duperson->FetchRow()) { echo ' <tr> <td><font face=arial color=#000000 size=2>' . $dup['pid'] . '</td> <td><font face=arial color=#000000 size=2>' . $dup['name_last'] . '</td> <td><font face=arial color=#000000 size=2>' . $dup['name_first'] . '</td> <td><font face=arial color=#000000 size=2>' . formatDate2Local($dup['date_birth'], $date_format) . '</td> <td>'; switch ($dup['sex']) { case 'f': echo '<img ' . $img_female . '>'; break; case 'm': echo '<img ' . $img_male . '>'; break; default: echo ' '; break; } echo ' </td> <td><font face=arial color=#000000 size=2>:: <a href="person_reg_showdetail.php' . URL_APPEND . '&pid=' . $dup['pid'] . '&from=$from&newdata=1&target=entry" target="_blank">' . $LDShowDetails . '</a> :: <a href="patient_register.php' . URL_APPEND . '&pid=' . $dup['pid'] . '&update=1">' . $LDUpdate . '</a> </td> </tr>'; } echo ' </table> </td> </tr> </table>'; } ?> </td> </tr> <tr> <td> <FONT SIZE=-1 FACE="Arial"><?php if ($pid) { echo $LDRegistryNr; } ?> </td> <td > <FONT SIZE=-1 FACE="Arial" color="#800000"> <?php if ($pid) { if (IS_TANZANIAN) { echo $this->showPID($pid); } else { echo $pid; } } ?> </td> <td rowspan=6 class="photo_id" > <FONT SIZE=-1 FACE="Arial"> <a href="#" onClick="showpic(document.aufnahmeform.photo_filename)"><img <?php echo $img_source; ?> id="headpic" name="headpic"></a> <br> <?php echo $LDPhoto; ?> <br><input name="photo_filename" type="file" size="15" onChange="showpic(this)" value="<?php if (isset($photo_filename)) { echo $photo_filename; } ?> "> </td> </tr> <tr> <td class="reg_item"> <?php echo $LDRegDate; ?> : </td> <td class="reg_input"> <FONT SIZE=-1 FACE="Arial" color="#800000"> <?php echo formatDate2Local($date_reg, $date_format); ?> <input name="date_reg" type="hidden" value="<?php echo $date_reg; ?> "> </td> </tr> <tr> <td class="reg_item"> <?php echo $LDRegTime; ?> : </td> <td class="reg_input"> <FONT SIZE=-1 FACE="Arial" color="#800000"><?php echo convertTimeToLocal(formatDate2Local($date_reg, $date_format, 0, 1)); ?> </td> </tr> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php if ($person_obj->IsHospitalFileNrMandatory()) { $asterik = '*'; } else { $asterik = ' '; } if ($errorfilenr) { echo '<font color="#ff0000">*' . $LDFileNr . '</font><br> Try this one: ' . $person_obj->GetNewSelianFileNumber(); } else { echo $asterik . $LDFileNr; } ?> </td> <td class="reg_input"> <input type="text" name="selian_pid" size=14 maxlength=6 value="<?php echo $selian_pid; ?> " onFocus="this.select();"> </td> </tr> <?php $this->createTR($errornamefirst, 'name_first', ' *' . $LDFirstName, $name_first, '', '', FALSE); $this->createTR($errorname2, 'name_2', ' *' . $LDName2, $name_2, '', '', FALSE); $this->createTR($errornamelast, 'name_last', ' *' . $LDLastName, $name_last, '', '', FALSE); $this->createTR($errornamemid, 'name_middle', $LDNameMid, $name_middle, '', '', FALSE); // This is for balozi if (!$no_tribe) { ?> <tr> <td class="reg_item"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"> <?php if ($errormaiden) { echo '<font color="FF0000">'; } echo '* ' . $LDNameMaiden; ?> </td> <td class="reg_input" colspan=1> <?php echo '<SELECT name="name_maiden" onChange="list_popup(this, \'tribe\');">'; echo '<OPTION value="-1" >' . $LDPleaseSelectTribe . '</OPTION>'; foreach ($tribe_array as $unit) { //if($update && (strtoupper($name_maiden) == strtoupper($unit[1]))) if (strtoupper($name_maiden) == strtoupper($unit[1])) { $check = 'selected'; } else { $check = ''; } echo '<OPTION value="' . $unit[1] . '" ' . $check . '>' . $unit[0] . '</OPTION>'; } // echo '<OPTION value="notinlist">NOT IN LIST</OPTION>'; echo '</SELECT>'; ?> </td> </tr> <?php } ?> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php if ($errordatebirth) { echo "<font color=red>"; } ?> * <?php echo $LDBday; ?> </font>: </td> <td class="reg_input"> <FONT SIZE=-1 FACE="Arial"> <input name="date_birth" type="text" size="15" maxlength=10 value="<?php if ($date_birth) { if ($mode == 'save' || $error || $error_person_exists) { echo $date_birth; } else { echo formatDate2Local($date_birth, $date_format); } } # Uncomment the following when the current date must be inserted # automatically at the start of each document /*else{ echo formatDate2Local(date('Y-m-d'),$date_format); }*/ ?> " onFocus="this.select();" onBlur="IsValidDate(this,'<?php echo $date_format; ?> ')" onKeyUp="setDate(this,'<?php echo $date_format; ?> ','<?php echo $lang; ?> ');"> <a href="javascript:show_calendar('aufnahmeform.date_birth','<?php echo $date_format; ?> ')"> <img <?php echo createComIcon($root_path, 'show-calendar.gif', '0', 'absmiddle'); ?> ></a> <font size=1>[ <?php $dfbuffer = "LD_" . strtr($date_format, ".-/", "phs"); echo ${$dfbuffer}; ?> ] </font><br> <input name="date_age" type="text" size="15" maxlength=10 value="" onKeyUp="setDatebyAge(this,this.form.date_birth,'<?php echo $date_format; ?> ','<?php echo $lang; ?> ')"> <font size=1> <?php echo $LDAge; ?> </font> </td> <td> </td> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"> <?php if ($errorsex) { echo "<font color=#ff0000>"; } echo '* ' . $LDSex . '</font>'; ?> :<td> <input name="sex" type="radio" value="m" <?php if ($sex == "m") { echo "checked"; } ?> ><?php echo $LDMale; ?> <input name="sex" type="radio" value="f" <?php if ($sex == "f") { echo "checked"; } ?> > <?php echo $LDFemale; if ($errorsex) { echo "</font>"; } # But patch 2004-03-10 # Clean blood group $blood_group = trim($blood_group); ?> </td> </tr> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php if ($errorreligion) { echo "<font color=red>"; } ?> * <?php echo $LDReligion; ?> : </td> <td class="reg_input"> <?php echo '<SELECT name="religion" onChange="list_popup(this,\'religion\');">'; echo '<OPTION value="-1" >' . $LDSelectReligion . '</OPTION>'; foreach ($religion_array as $unit) { if (strtoupper($religion) == strtoupper($unit[1])) { $check = 'selected'; } else { $check = ''; } echo '<OPTION value="' . $unit[1] . '" ' . $check . '>' . $unit[0] . '</OPTION>'; } // echo '<OPTION value="notinlist">NOT IN LIST</OPTION>'; echo '</SELECT>'; ?> </td> </tr> <?php if (!$person_name_others_hide) { $this->createTR($errornameothers, 'name_others', $LDNameOthers, $name_others); } ?> <!-- TODO: Kompletly not shown, or dependig on who is editing: Doctor, Lab? --> <tr> <td class="reg_item"> <?php echo $LDBloodGroup; ?> : </td> <td class="reg_input"> <FONT SIZE=-1 FACE="Arial"> <input name="blood_group" type="radio" value="A" <?php if ($blood_group == 'A') { echo 'checked'; } ?> ><?php echo $LDA; ?> <input name="blood_group" type="radio" value="B" <?php if ($blood_group == 'B') { echo 'checked'; } ?> ><?php echo $LDB; ?> <input name="blood_group" type="radio" value="AB" <?php if ($blood_group == 'AB') { echo 'checked'; } ?> ><?php echo $LDAB; ?> <input name="blood_group" type="radio" value="O" <?php if ($blood_group == 'O') { echo 'checked'; } ?> ><?php echo $LDO; ?> </td> <td> <?php echo $LDRHfactor; ?> <input name="rh" type="radio" value="pos" <?php if ($rh == 'pos') { echo 'checked'; } ?> ><?php echo $LDRHpos; ?> <input name="rh" type="radio" value="neg" <?php if ($rh == 'neg') { echo 'checked'; } ?> ><?php echo $LDRHneg; ?> </td> </tr> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php if ($errorcivil) { echo "<font color=red>"; } ?> <?php echo $LDCivilStatus; ?> </font>: </td> <td colspan=2 class="reg_input"> <FONT SIZE=-1 FACE="Arial"> <input name="civil_status" type="radio" value="single" <?php if ($civil_status == "single") { echo "checked"; } ?> ><?php echo $LDSingle; ?> <input name="civil_status" type="radio" value="married" <?php if ($civil_status == "married") { echo "checked"; } ?> ><?php echo $LDMarried; ?> <FONT SIZE=-1 FACE="Arial"> <input name="civil_status" type="radio" value="divorced" <?php if ($civil_status == "divorced") { echo "checked"; } ?> ><?php echo $LDDivorced; ?> <input name="civil_status" type="radio" value="widowed" <?php if ($civil_status == "widowed") { echo "checked"; } ?> ><?php echo $LDWidowed; ?> <FONT SIZE=-1 FACE="Arial"> <input name="civil_status" type="radio" value="separated" <?php if ($civil_status == "separated") { echo "checked"; } ?> ><?php echo $LDSeparated; ?> </td> </tr> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"> <?php echo $LDInsurance; ?> : </td> <td class="reg_input"> <?php // Create array of all insurances for GUI $coreObj->sql = "SELECT DISTINCT parent FROM care_tz_insurance WHERE cancel_flag='0' order by name asc"; $result = $db->Execute($coreObj->sql); $name_insurer_array = array(); while ($row = $result->FetchRow()) { $nr = $row['insurance_ID']; if ($nr != -1) { $coreObj->sql = "SELECT name FROM care_tz_company WHERE insurance_ID={$nr}"; $ergebnis = $db->Execute($coreObj->sql); $row = $ergebnis->FetchRow(); $arrayTemp = array("name" => $row['name'], "id" => $nr); array_push($name_insurer_array, $arrayTemp); } } echo '<SELECT name="insurance_ID">'; echo '<OPTION value="-1" >--select insurance--</OPTION>'; foreach ($name_insurer_array as $row) { if ($insurance_ID == $row[id]) { $check = 'selected'; } else { $check = ''; } echo '<OPTION value="' . $row[id] . '" ' . $check . '>' . $row[name] . '</OPTION>'; } echo '</SELECT>'; ?> </td> </tr> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php echo $LDOccupation; ?> : </td> <td class="reg_input"> <input type="text" name="title" size=14 maxlength=25 value="<?php echo $title; ?> " onFocus="this.select();"> </td> </tr> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php echo $LDEducation; ?> : </td> <td class="reg_input"> <input type="text" name="name_others" size=14 maxlength=25 value="<?php echo $name_others; ?> " onFocus="this.select();"> </td> </tr> <!-- <tr> <td colspan=2> <FONT SIZE=-1 FACE="Arial"><?php if ($erroraddress) { echo "<font color=red>"; } echo $LDAddress; ?> </font>: </td> </tr> --> <?php if (!$person_email_hide) { //{ ?> <tr> <td class="reg_item"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"> <?php if ($errormaiden) { echo '<font color="FF0000">'; } echo '* ' . 'Region'; $sql = "SELECT DISTINCT region_id, region_name FROM care_tz_region region INNER JOIN care_tz_district distrcit ON distrcit.is_additional=region.region_id INNER JOIN care_tz_ward ward ON distrcit.district_id=ward.is_additional ORDER BY region_name, district_name, ward_name"; //$sql="SELECT region_id,region_name FROM view_care_region_district_ward GROUP BY region_id order by region_name "; $catchment_area_obj = $db->Execute($sql); ?> </td> <td class="reg_input" colspan=1> <select name="region" size="1" onChange="redirect(this.options.selectedIndex)"> <option value="-1" id="-1">---select region--------</option> <?php while ($catchment_area_row = $catchment_area_obj->FetchRow()) { echo '<option value="' . $catchment_area_row['region_name'] . '" id=' . $catchment_area_row['region_id'] . '>' . $catchment_area_row['region_name'] . '</option>'; } ?> </select> <?php } ?> </td> <?php if ($update) { ?> <td class="reg_input"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"> <?php if ($errormaiden) { echo '<font color="FF0000">'; } $sql = "Select * from care_person where pid=" . $pid; $result = $db->Execute($sql); $region = $result->FetchRow(); echo '' . 'Region:<FONT SIZE=-1 FACE="Arial" color="#800000"> ' . $region['region'] . '</FONT>'; ?> </td><?php } ?> </tr> <tr></tr> <tr> <td class="reg_item"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"> <?php if ($errormaiden) { echo '<font color="FF0000">'; } echo '* ' . 'District'; ?> </td> <td class="reg_input" colspan=1> <select name="district" size="1" onChange="redirect1(this.options.selectedIndex)"> <option value="-1" >---select district--------</option> </select> </td> <?php if ($update) { ?> <td class="reg_input"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"> <?php if ($errormaiden) { echo '<font color="FF0000">'; } $sql = "Select * from care_person where pid=" . $pid; $result = $db->Execute($sql); $region = $result->FetchRow(); echo '' . 'District: <FONT SIZE=-1 FACE="Arial" color="#800000">' . $region['district'] . '</FONT>'; ?> </td><?php } ?> </tr> <tr></tr> <tr> <td class="reg_item"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"> <?php if ($errormaiden) { echo '<font color="FF0000">'; } echo '* ' . 'Ward'; ?> </td> <td class="reg_input" colspan=1> <select name="ward" size="1"> <option value="-1" >-select Ward-</option> </select> <?php ?> <script language="javascript"> <?php // fill up all regions, districts and wards: $sql = "SELECT region_id, region_name, district_id, district_name, ward_id, ward_name FROM care_tz_region region INNER JOIN care_tz_district distrcit ON distrcit.is_additional=region.region_id INNER JOIN care_tz_ward ward ON distrcit.district_id=ward.is_additional ORDER BY region_name, district_name, ward_name"; $catchment_area_obj = $db->Execute($sql); $number_of_rows = $catchment_area_obj->RecordCount(); echo "var group=new Array(" . $number_of_rows . ")\n"; echo "for (i=0; i<" . $number_of_rows . "; i++)\n"; echo "group[i]=new Array()\n"; echo "group[0]= new Option(\"---select Region -----\");\n"; echo "group[0][0]=new Option(\"---select district--------\");\n"; echo "group[1][0]=new Option(\"now select this one\");\n"; echo "group[1][0][0]=new Option(\"-select Ward-\");\n"; // define some variables that eclipse will get no trouble by syntax error check... $previous_region_id = -1; $previous_district_id = -1; $region_id = 1; $district_id = 0; $ward_id = 0; // remember if it's the first row... $FIRST_ROW = TRUE; while ($catchment_area_row = $catchment_area_obj->FetchRow()) { // reading out all information of this row and store each to a variable $this_region_name = $catchment_area_row['region_name']; $this_district_name = $catchment_area_row['district_name']; $this_district_id = $catchment_area_row['district_id']; $this_ward_name = $catchment_area_row['ward_name']; $this_ward_id = $catchment_area_row['ward_id']; if ($FIRST_ROW == TRUE) { // it's the first row, the "this" is the same as the "previous" status $previous_region_id = $region_id; $previous_ward_id = $ward_id; $previous_district_id = $district_id; // if its the first row, so we can attach this line directly to the jscript-array: echo "group[" . $region_id . "][" . $district_id . "]=new Option(\"" . $this_district_name . "\");\n"; // "this" is no longer the first row, set it to FALSE $FIRST_ROW = FALSE; } else { // reading out all information of this row and store each to a variable $this_region_id = $catchment_area_row['region_id']; $this_region_name = $catchment_area_row['region_name']; $this_district_name = $catchment_area_row['district_name']; $this_district_id = $catchment_area_row['district_id']; // it is not the first row, so we have to be a bit more carefully if ($this_region_id == $previous_region_id) { // if its the same region ID like the previous one, so check if it's a new district as well: if ($this_district_id == $previous_district_id) { // if its the same district ID like the previous one, then we have a new ward echo "group[" . $region_id . "][" . $district_id . "][" . $ward_id . "]=new Option(\"" . $this_ward_name . "\"); // Ward_id=" . $this_ward_id . "\n"; $ward_id = $ward_id + 1; } else { $district_id = $district_id + 1; $previous_district_id = $this_district_id; $ward_id = 0; echo "group[" . $region_id . "][" . $district_id . "]=new Option(\"" . $this_district_name . "\"); //Region_id=" . $this_region_id . "\n"; } } else { // it's a new region, so reset the value of "this region" $district_id = 0; $region_id = $region_id + 1; echo "group[" . $region_id . "][" . $district_id . "]=new Option(\"" . $this_district_name . "\"); //Region_id=" . $this_region_id . "\n"; $previous_region_id = $this_region_id; } // end of if ($this_region_id==$previous_region_id) } // end of if ($FIRST_ROW==TRUE) } ?> var temp_district=document.aufnahmeform.district var temp_ward=document.aufnahmeform.ward function redirect(x){ // delete all previous entries for (m=temp_district.options.length-1;m>0;m--) temp_district.options[m]=null; // set the new ones to this option list for (i=1;i<group[x].length;i++){ temp_district.options[i]=new Option(group[x][i].text) } temp_district.options[0].selected=true; temp_district.options[0].value=-1; redirect1(0) } function redirect1(y){ for (m=temp_ward.options.length-1;m>=0;m--) temp_ward.options[m]=null; var region_index = document.aufnahmeform.region.options.selectedIndex; var district_index = document.aufnahmeform.district.options.selectedIndex; var i = 0; for (i=0;i<100;i++){ temp_ward.options[i]=new Option(group[region_index][district_index][i].text) } temp_ward.options[0].selected=true temp_ward.options[0].value=-1; } </script> </td> <?php if ($update) { ?> <td class="reg_input"><FONT SIZE=-1 FACE="Arial,verdana,sans serif"> <?php if ($errormaiden) { echo '<font color="FF0000">'; } $sql = "Select * from care_person where pid=" . $pid; $result = $db->Execute($sql); $region = $result->FetchRow(); echo '' . 'Ward: <FONT SIZE=-1 FACE="Arial" color="#800000">' . $region['ward'] . '</FONT>'; ?> </td><?php } ?> <tr> <td colspan=2> <FONT SIZE=-1 FACE="Arial"><?php if ($erroraddress) { echo "<font color=red>"; } echo $LDAddress; ?> </font>: </td> </tr> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php echo $LDTownCity; ?> : </td> <td class="reg_input"><input name="citizenship" type="text" value="<?php echo $citizenship; ?> " ></td> <!--<td class="reg_input"> <?php echo '<SELECT name="addr_citytown_nr" onChange="list_popup(this,\'city\');">'; echo '<OPTION value="-1" >-- select location --</OPTION>'; foreach ($town_array as $unit) { if (strtoupper($addr_citytown_nr) == strtoupper($unit[1])) { $check = 'selected'; } else { $check = ''; } echo '<OPTION value="' . $unit[1] . '" ' . $check . '>' . $unit[0] . '</OPTION>'; } // echo '<OPTION value="notinlist">NOT IN LIST</OPTION>'; echo '</SELECT>'; ?> </td>--> <td class="reg_input"> <FONT SIZE=-1 FACE="Arial"><?php if ($errorzip) { echo "<font color=red>"; } echo $LDPOBOX . " "; ?> <input name="addr_zip" type="text" size="10" value="<?php echo $addr_zip; ?> " > </td> </tr> <?php if ($insurance_show) { if (!$person_insurance_1_nr_hide) { ?> <!--<tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial"><?php if ($errorinsurancecoid) { echo '<font color="' . $error_fontcolor . '">'; } echo $LDInsuranceCo; ?> : </td> <td colspan=2 class="reg_input"><FONT SIZE=-1 FACE="Arial"><?php if ($errorinsuranceclass) { echo '<font color="' . $error_fontcolor . '">'; } ?> <input name="insurance_category" type="radio" value="silver" <?php if ($insurance_category == "silver") { echo 'checked'; } ?> > <?php echo $LDInsuranceSilver; ?> <input name="insurance_category" type="radio" value="gold" <?php if ($insurance_category == "gold") { echo 'checked'; } ?> > <?php echo $LDInsuranceGold; ?> <input name="insurance_category" type="radio" value="friedkin" <?php if ($insurance_category == "friedkin") { echo 'checked'; } ?> > <?php echo $LDInsuranceFriedkin; ?> <input name="insurance_category" type="radio" value="selian" <?php if ($insurance_category == "selian") { echo 'checked'; } ?> > <?php echo $LDInsuranceSelianstuff; ?> </td> </tr>--> <?php } } else { ?> <tr> <td colspan=2 class="reg_item"> <a><?php echo $LDSeveralInsurances; ?> <img <?php echo createComIcon($root_path, 'frage.gif', '0'); ?> ></a> </td> </tr> <?php } if (!$person_phone_1_nr_hide) { $this->createTR($errorphone1, 'phone_1_nr', $LDPhone, $phone_1_nr, 2); } if (!$person_cellphone_1_nr_hide) { $this->createTR($errorcell1, 'cellphone_1_nr', $LDCellPhone, $cellphone_1_nr, 2); } if (!$person_cellphone_2_nr_hide) { $this->createTR($errorcell2, 'cellphone_2_nr', $LDCellPhone . ' 2', $cellphone_2_nr, 2); } if (!$person_religion_hide) { ?> <?php } ?> <!--<tr> <td class="reg_item" valign=top class="reg_input"> <?php echo $LDOtherHospitalNr; ?> </td> <td colspan=2 class="reg_input"> <?php /* $other_hosp_list = $person_obj->OtherHospNrList(); $sOtherNrBuffer=''; foreach( $other_hosp_list as $k=>$v ){ echo "<b>".$kb_other_his_array[$k].":</b> ".$v."<br />\n"; } echo '<SELECT name="other_his_org"> <OPTION value="">--</OPTION>'; foreach( $kb_other_his_array as $k=>$v ){ echo '<OPTION value="$k" $check>$v</OPTION>'; } echo '</SELECT> '.$LDNr.':<INPUT name="other_his_no" size=20><br>'; echo '('.$LDSelectOtherHospital.' - '.$LDNoNrNoDelete.')<br></TD></TR>'; */ ?> </td> </tr>--> <tr> <td class="reg_item"> <FONT SIZE=-1 FACE="Arial" ><FONT SIZE=2 FACE="Arial"><font color=#ff0000><?php echo $LDRegBy; ?> </font> </td> <td colspan=2 class="reg_input"> <FONT SIZE=-1 FACE="Arial"><nobr> <input name="user_id" type="text" value="<?php if (isset($user_id) && $user_id) { echo $user_id; } else { echo $_SESSION['sess_user_name']; } ?> " size="35" readonly> </nobr> </td> </tr> </table> <p> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000"> <input type="hidden" name="itemname" value="<?php echo $itemname; ?> "> <input type="hidden" name="sid" value="<?php echo $sid; ?> "> <input type="hidden" name="lang" value="<?php echo $lang; ?> "> <input type="hidden" name="linecount" value="<?php echo $linecount; ?> "> <input type="hidden" name="mode" value="save"> <input type="hidden" name="insurance_item_nr" value="<?php echo $insurance_item_nr; ?> "> <input type="hidden" name="insurance_firm_id" value="<?php echo $insurance_firm_id; ?> "> <input type="hidden" name="insurance_show" value="<?php echo $insurance_show; ?> "> <input type="hidden" name="ethnic_orig" value="<?php echo $ethnic_orig; ?> "> <?php if ($update) { echo '<input type="hidden" name="update" value=1>'; echo '<input type="hidden" name="pid" value="' . $pid . '">'; } ?> <input type="image" <?php echo createLDImgSrc($root_path, 'savedisc.gif', '0'); ?> alt="<?php echo $LDSaveData; ?> " align="absmiddle"> <a href="javascript:document.aufnahmeform.reset()"><img <?php echo createLDImgSrc($root_path, 'reset.gif', '0'); ?> alt="<?php echo $LDResetData; ?> " align="absmiddle"></a> <?php //if($error||$error_person_exists) echo '<input type="button" value="'.$LDForceSave.'" onClick="forceSave()">'; ?> </form> <?php if (!$newdata) { ?> <form action=<?php echo $thisfile; ?> method=post> <input type=hidden name=sid value=<?php echo $sid; ?> > <input type=hidden name=patnum value=""> <input type=hidden name="lang" value="<?php echo $lang; ?> "> <input type=hidden name="date_format" value="<?php echo $date_format; ?> "> <input type=submit value="<?php echo $LDNewForm; ?> " > </form> <?php } }
require_once $root_path . 'include/inc_date_format_functions.php'; $breakfile = $root_path . 'modules/system_admin/edv-system-admi-welcome.php' . URL_APPEND; if (!isset($mode)) { $mode = ''; } # Create department object $dept_obj =& new Department(); # Create the OR object $OR_obj =& new OPRoom(); # Create the ward object $ward_obj =& new Ward(); //$db->debug=1; # Validate 3 most important inputs if (isset($mode) && !empty($mode) && $mode != 'select') { # format date to standard $datebuffer = formatDate2STD($_POST['date_create'], $date_format); if (empty($_POST['room_nr']) || empty($datebuffer) || $mode == 'update' && empty($_POST['nr'])) { $inputerror = TRUE; # Set error flag $error_msg = $LDInputError; } } if (!empty($mode) && !$inputerror) { # Compose the data for storing into history field $udata = 'name=' . $_POST['info'] . ': bed=' . $_POST['nr_of_beds'] . ': ward=' . $_POST['ward_nr'] . ': dept=' . $_POST['dept_nr'] . ': closed=' . $_POST['is_temp_closed']; switch ($mode) { case 'create': if ($OR_obj->ORNrExists($_POST['room_nr'])) { $error_msg = $LDORNrExists; $inputerror = TRUE; } else {
} else { $newdata = 1; if (!$personell_obj->InitPersonellNrExists($GLOBAL_CONFIG['personell_nr_init'])) { $_POST['nr'] = $GLOBAL_CONFIG['personell_nr_init']; } if ($_POST['date_join']) { $_POST['date_join'] = @formatDate2STD($_POST['date_join'], $date_format); } if ($_POST['date_exit']) { $_POST['date_exit'] = @formatDate2STD($_POST['date_exit'], $date_format); } if ($_POST['contract_start']) { $_POST['contract_start'] = @formatDate2STD($_POST['contract_start'], $date_format); } if ($_POST['contract_end']) { $_POST['contract_end'] = @formatDate2STD($_POST['contract_end'], $date_format); } $_POST['create_id'] = $encoder; $_POST['create_time'] = date('YmdHis'); $_POST['history'] = "Create: " . date('Y-m-d H:i:s') . " = " . $encoder . "\n"; $personell_obj->setDataArray($_POST); if ($personell_obj->insertDataFromInternalArray()) { # Get the PID $oid = $db->Insert_ID(); $personell_nr = $personell_obj->LastInsertPK('nr', $oid); header("location: personell_register_show.php" . URL_REDIRECT_APPEND . "&personell_nr={$personell_nr}&origin=admit&target=personell_reg&newdata={$newdata}"); exit; } else { $error = TRUE; } }
//echo '$prescrServ = '.$_GET['prescrServ']; if (!$prescription_date) { $prescription_date = date("Y-m-d"); } define('NO_2LEVEL_CHK', 1); $thisfile = basename($_SERVER['PHP_SELF']); if (!isset($mode)) { $mode = 'show'; } elseif ($mode == 'create' || $mode == 'update' || $mode == 'delete') { include_once $root_path . 'include/care_api_classes/class_prescription.php'; if (!isset($obj)) { $obj = new Prescription(); } include_once $root_path . 'include/inc_date_format_functions.php'; if ($_POST['prescribe_date']) { $_POST['prescribe_date'] = @formatDate2STD($_POST['prescribe_date'], $date_format); } else { $_POST['prescribe_date'] = date('Y-m-d'); } $_POST['create_id'] = $_SESSION['sess_user_name']; //$db->debug=true; // Insert the prescription without other checks into the database. This should be dony be the doctor and // there was the requirement that there should be no restrictions given... //include('./include/save_admission_data.inc.php'); include './include/save_prescription_data.inc.php'; } /* For external call, there is no encounter number given. This can be determined if we have the encounter no in the $pn variable */ if (isset($pn)) { require_once $root_path . 'include/care_api_classes/class_encounter.php'; $encounter_obj = new Encounter($pn); $pid = $encounter_obj->EncounterExists($pn);
} /* Check whether config path exists, else use default path */ $photo_path = is_dir($root_path . $GLOBAL_CONFIG['person_foto_path']) ? $GLOBAL_CONFIG['person_foto_path'] : $default_photo_path; if ($pid) { if (isset($transFromOutp)) { //echo 'transFrom Outpatient'; if ($encoder == '') { $encoder = $_SESSION['sess_user_name']; } # Load date formatter require_once $root_path . 'include/care_api_classes/class_encounter.php'; $enc_obj = new Encounter(); $pn = $_GET['pn']; if ($encounter_obj->loadEncounterData($pn)) { //$db->debug=1; $date = empty($x_date) ? date('Y-m-d') : formatDate2STD($x_date, $date_format); $time = empty($x_time) ? date('H:i:s') : convertTimeToStandard($x_time); # Check the discharge type if ($enc_obj->DischargeFromDeptForAdmission($pn, 8, $date, $time)) { //echo 'discharge has been successfull'; } else { echo 'couldn\'t discharge outpatient'; } } else { echo 'could not load encounter data'; } } else { /* Check whether the person is currently admitted. If yes jump to display admission data */ if (!$update && ($encounter_nr = $encounter_obj->isPIDCurrentlyAdmitted($pid))) { header('Location:aufnahme_daten_zeigen.php' . URL_REDIRECT_APPEND . '&encounter_nr=' . $encounter_nr . '&origin=admit&sem=isadmitted&target=entry'); exit;
case 1: $op_end .= ':00'; break; case '': $op_end .= ':00:00'; } if ($update) { $sql = "UPDATE {$dbtable} SET\n\t\t\t\t\t\t\t\t\top_date='" . formatDate2STD($op_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\toperator='{$operator}',\n\t\t\t\t\t\t\t\t\tdiagnosis='{$diagnosis}',\n\t\t\t\t\t\t\t\t\tlocalize='{$localize}',\n\t\t\t\t\t\t\t\t\ttherapy='{$therapy}',\n\t\t\t\t\t\t\t\t\tspecial='" . $_POST['notes'] . "',\n\t\t\t\t\t\t\t\t\tclass_s='{$class_s}',\n\t\t\t\t\t\t\t\t\tclass_m='{$class_m}',\n\t\t\t\t\t\t\t\t\tclass_l='{$class_l}',\n\t\t\t\t\t\t\t\t\top_start='{$op_start}',\n\t\t\t\t\t\t\t\t\top_end='{$op_end}',\n\t\t\t\t\t\t\t\t\tscrub_nurse='{$scrub_nurse}',\n assistant='{$assistant}',\n\t\t\t\t\t\t\t\t\top_room='{$op_room}',\n\t\t\t\t\t\t\t\t\thistory=" . $enc_obj->ConcatHistory("Update: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\t\t\t\tmodify_id='" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\tmodify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\tWHERE nr='{$nr}'"; if ($ergebnis = $enc_obj->Transact($sql)) { header("location:op-doku-start.php?sid={$sid}&lang={$lang}&target={$target}&mode=saveok&pn={$pn}&nr={$nr}&dept_nr={$dept_nr}"); exit; } else { echo "{$sql}<br>{$LDDbNoUpdate}"; } } else { $sql = "INSERT INTO {$dbtable}\n\t\t\t\t\t\t\t\t(\tdept_nr,\n\t\t\t\t\t\t\t\t\top_date,\n\t\t\t\t\t\t\t\t\toperator,\n\t\t\t\t\t\t\t\t\tencounter_nr,\n\t\t\t\t\t\t\t\t\tdiagnosis,\n\t\t\t\t\t\t\t\t\tlocalize,\n\t\t\t\t\t\t\t\t\ttherapy,\n\t\t\t\t\t\t\t\t\tspecial,\n\t\t\t\t\t\t\t\t\tclass_s,\n\t\t\t\t\t\t\t\t\tclass_m,\n\t\t\t\t\t\t\t\t\tclass_l,\n\t\t\t\t\t\t\t\t\top_start,\n\t\t\t\t\t\t\t\t\top_end,\n\t\t\t\t\t\t\t\t\tscrub_nurse,\n assistant, \n\t\t\t\t\t\t\t\t\top_room,\n\t\t\t\t\t\t\t\t\thistory,\n\t\t\t\t\t\t\t\t\tcreate_id,\n\t\t\t\t\t\t\t\t\tcreate_time\n\t\t\t\t\t\t\t\t\t ) \n\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t'{$dept_nr}',\n\t\t\t\t\t\t\t\t\t'" . formatDate2STD($op_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\t'{$operator}', \n\t\t\t\t\t\t\t\t\t'{$pn}',\n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($diagnosis) . "', \n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($localize) . "', \n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($therapy) . "', \n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($_POST['notes']) . "', \n\t\t\t\t\t\t\t\t\t'{$class_s}', \n\t\t\t\t\t\t\t\t\t'{$class_m}', \n\t\t\t\t\t\t\t\t\t'{$class_l}', \n\t\t\t\t\t\t\t\t\t'{$op_start}',\n\t\t\t\t\t\t\t\t\t'{$op_end}',\n\t\t\t\t\t\t\t\t\t'{$scrub_nurse}',\n '{$assistant}', \n\t\t\t\t\t\t\t\t\t'{$op_room}',\n\t\t\t\t\t\t\t\t\t'Create: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\t'" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t)"; //echo $sql; if ($ergebnis = $enc_obj->Transact($sql)) { $oid = $db->Insert_ID(); $enc_obj->coretable = $dbtable; $nr = $enc_obj->LastInsertPK('nr', $oid); header("location:op-doku-start.php?sid={$sid}&lang={$lang}&target={$target}&mode=saveok&pn={$pn}&nr={$nr}&dept_nr={$dept_nr}"); exit; } else { echo "{$sql}<br>{$LDDbNoSave}"; } } // end of if(update) else //$sdate=date(YmdHis); // time stamp break; case 'saveok':
/* Here begins the real work */ /* Load date formatter */ include_once $root_path . 'include/inc_date_format_functions.php'; /* Load editor functions */ //include_once('../include/inc_editor_fx.php'); if (!isset($mode)) { $mode = ''; } switch ($mode) { case 'update': $sql = "UPDATE care_test_request_blood SET \n status = 'received', blood_pb = '" . htmlspecialchars($blood_pb) . "', blood_rb = '" . htmlspecialchars($blood_rb) . "', blood_llrb = '" . htmlspecialchars($blood_llrb) . "', \n\t\t\t\t\t\t\t\t blood_wrb = '" . htmlspecialchars($blood_wrb) . "',blood_prp = '" . htmlspecialchars($blood_prp) . "', blood_tc = '" . htmlspecialchars($blood_tc) . "', \n\t\t\t\t\t\t\t\t blood_ffp = '" . htmlspecialchars($blood_ffp) . "', b_group_count = '" . $b_group_count . "', \n\t\t\t\t\t\t\t\t b_group_price = '" . $b_group_price . "', a_subgroup_count = '" . $a_subgroup_count . "', a_subgroup_price = '" . $a_subgroup_price . "', \n\t\t\t\t\t\t\t\t extra_factors_count = '" . $extra_factors_count . "', extra_factors_price = '" . $extra_factors_price . "', coombs_count = '" . $coombs_count . "', \n\t\t\t\t\t\t\t\t coombs_price = '" . $coombs_price . "', ab_test_count = '" . $ab_test_count . "', ab_test_price = '" . $ab_test_price . "', \n\t\t\t\t\t\t\t\t crosstest_count = '" . $crosstest_count . "', crosstest_price = '" . $crosstest_price . "', ab_diff_count = '" . $ab_diff_count . "', \n\t\t\t\t\t\t\t\t ab_diff_price = '" . $ab_diff_price . "', x_test_1_code = '" . $x_test_1_code . "', x_test_1_name = '" . htmlspecialchars($x_test_1_name) . "', \n\t\t\t\t\t\t\t\t x_test_1_count = '" . $x_test_1_count . "', x_test_1_price = '" . $x_test_1_price . "', x_test_2_code = '" . $x_test_2_code . "', \n\t\t\t\t\t\t\t\t x_test_2_name = '" . htmlspecialchars($x_test_2_name) . "', x_test_2_count = '" . $x_test_2_count . "', x_test_2_price = '" . $x_test_2_price . "', \n\t\t\t\t\t\t\t\t x_test_3_code = '" . $x_test_3_code . "', x_test_3_name = '" . htmlspecialchars($x_test_3_name) . "', x_test_3_count = '" . $x_test_3_count . "', \n\t\t\t\t\t\t\t\t x_test_3_price = '" . $x_test_3_price . "', lab_stamp = '" . $lab_stamp . "', release_via = '" . htmlspecialchars($release_via) . "', \n\t\t\t\t\t\t\t\t receipt_ack = '" . htmlspecialchars($receipt_ack) . "', mainlog_nr = '" . htmlspecialchars($mainlog_nr) . "', lab_nr = '" . htmlspecialchars($lab_nr) . "'"; $lab_date = formatDate2STD($lab_date, $date_format); if (!empty($lab_date)) { $sql .= ", lab_date = '" . $lab_date . "'"; } $mainlog_date = formatDate2STD($mainlog_date, $date_format); if (!empty($mainlog_date)) { $sql .= ", mainlog_date = '" . $mainlog_date . "'"; } $sql .= ", mainlog_sign = '" . htmlspecialchars($mainlog_sign) . "', lab_sign = '" . htmlspecialchars($lab_sign) . "',\n\t\t\t\t\t\t\t\t history = " . $enc_obj->ConcatHistory("Ack: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\t\t\t modify_id = '" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\tmodify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t WHERE batch_nr = '" . $batch_nr . "'"; if ($ergebnis = $enc_obj->Transact($sql)) { //echo $sql; signalNewDiagnosticsReportEvent('', 'labor_test_request_printpop.php'); header("location:" . $thisfile . "?sid={$sid}&lang={$lang}&edit={$edit}&saved=update&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&subtarget={$subtarget}&batch_nr={$batch_nr}&noresize={$noresize}"); exit; } else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = ""; } break; // end of case 'save'
if (!($single_obj =& $enc_obj->getSicknessConfirm($get_nr))) { $get_nr = 0; } } else { $get_nr = 0; } } else { $mode = ''; } } elseif ($mode == 'create' || $mode == 'update') { //$db->debug=true; include_once $root_path . 'include/inc_date_format_functions.php'; # Convert date to standard format $_POST['date_end'] = formatDate2STD($_POST['date_end'], $date_format); $_POST['date_start'] = formatDate2STD($_POST['date_start'], $date_format); $_POST['date_confirm'] = formatDate2STD($_POST['date_confirm'], $date_format); $_POST['encounter_nr'] = $_SESSION['sess_en']; $_POST['history'] = "Create " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n"; $_POST['modify_id'] = $_SESSION['sess_user_name']; $_POST['create_id'] = $_SESSION['sess_user_name']; $_POST['create_time'] = date('YmdHis'); if ($enc_obj->saveSicknessConfirm($_POST)) { $get_nr = $db->Insert_ID(); header("location:" . $thisfile . URL_REDIRECT_APPEND . "&get_nr={$get_nr}&dept_nr={$dept_nr}&target={$target}&type_nr={$type_nr}&pid=" . $_SESSION['sess_pid']); exit; } else { echo "{$obj->sql}<br>{$LDDbNoSave}"; } } if ($mode == 'new') { # Load the department class
/** * Displays the GUI input form */ function display() { global $db, $sid, $lang, $root_path, $pid, $insurance_show, $user_id, $mode, $dbtype, $breakfile, $cfg, $update, $photo_filename, $HTTP_POST_VARS, $HTTP_POST_FILES, $HTTP_SESSION_VARS; extract($HTTP_POST_VARS); # Load the language tables $lang_tables = $this->langfiles; include $root_path . 'include/inc_load_lang_tables.php'; # Load the other hospitals array include_once $root_path . 'global_conf/other_hospitals.php'; include_once $root_path . 'include/inc_date_format_functions.php'; include_once $root_path . 'include/care_api_classes/class_insurance.php'; include_once $root_path . 'include/care_api_classes/class_person.php'; //$db->debug=true; # Create the new person object $person_obj =& new Person($pid); # Create a new person insurance object $pinsure_obj =& new PersonInsurance($pid); if (!isset($insurance_show)) { $insurance_show = TRUE; } $newdata = 1; $error = 0; $dbtable = 'care_person'; if (!isset($photo_filename) || empty($photo_filename)) { $photo_filename = 'nopic'; } # Assume first that image is not uploaded $valid_image = FALSE; //* Get the global config for person's registration form*/ include_once $root_path . 'include/care_api_classes/class_globalconfig.php'; $glob_obj = new GlobalConfig($GLOBAL_CONFIG); $glob_obj->getConfig('person_%'); //extract($GLOBAL_CONFIG); # Check whether config foto path exists, else use default path $photo_path = is_dir($root_path . $GLOBAL_CONFIG['person_foto_path']) ? $GLOBAL_CONFIG['person_foto_path'] : $this->default_photo_path; if ($mode == 'save' || $mode == 'forcesave') { # If saving is not forced, validate important elements if ($mode != 'forcesave') { # clean and check input data variables if (trim($encoder) == '') { $encoder = $aufnahme_user; } if (trim($name_last) == '') { $errornamelast = 1; $error++; } if (trim($name_first) == '') { $errornamefirst = 1; $error++; } if (trim($date_birth) == '') { $errordatebirth = 1; $error++; } if (trim($addr_str) == '') { $errorstreet = 1; $error++; } if (trim($addr_str_nr) == '') { $errorstreetnr = 1; $error++; } if ($addr_citytown_nr && trim($addr_citytown_name) == '') { $errortown = 1; $error++; } if ($sex == '') { $errorsex = 1; $error++; } if ($insurance_show) { if (trim($insurance_nr) && trim($insurance_firm_name) == '') { $errorinsurancecoid = 1; $error++; } } } # If the validation produced no error, save the data if (!$error) { # Save the old filename for testing $old_fn = $photo_filename; # Create image object include_once $root_path . 'include/care_api_classes/class_image.php'; $img_obj =& new Image(); # Check the uploaded image file if exists and valid if ($img_obj->isValidUploadedImage($HTTP_POST_FILES['photo_filename'])) { $valid_image = TRUE; # Get the file extension $picext = $img_obj->UploadedImageMimeType(); } if ($update) { //echo formatDate2STD($geburtsdatum,$date_format); $sql .= "UPDATE {$dbtable} SET\r\r\n\t\t\t\t\t\t\t title='{$title}',\r\r\n\t\t\t\t\t\t\t name_last='{$name_last}',\r\r\n\t\t\t\t\t\t\t name_first='{$name_first}',\r\r\n\t\t\t\t\t\t\t name_2='{$name_2}',\r\r\n\t\t\t\t\t\t\t name_3='{$name_3}',\r\r\n\t\t\t\t\t\t\t name_middle='{$name_middle}',\r\r\n\t\t\t\t\t\t\t name_maiden='{$name_maiden}',\r\r\n\t\t\t\t\t\t\t name_others='{$name_others}',\r\r\n\t\t\t\t\t\t\t date_birth='" . formatDate2STD($date_birth, $date_format) . "',\r\r\n\t\t\t\t\t\t\t blood_group='" . trim($blood_group) . "',\r\r\n\t\t\t\t\t\t\t sex='{$sex}',\r\r\n\t\t\t\t\t\t\t addr_str='{$addr_str}',\r\r\n\t\t\t\t\t\t\t addr_str_nr='{$addr_str_nr}',\r\r\n\t\t\t\t\t\t\t addr_zip='{$addr_zip}',\r\r\n\t\t\t\t\t\t\t addr_citytown_nr='{$addr_citytown_nr}',\r\r\n\t\t\t\t\t\t\t phone_1_nr='{$phone_1_nr}',\r\r\n\t\t\t\t\t\t\t phone_2_nr='{$phone_2_nr}',\r\r\n\t\t\t\t\t\t\t cellphone_1_nr='{$cellphone_1_nr}',\r\r\n\t\t\t\t\t\t\t cellphone_2_nr='{$cellphone_2_nr}',\r\r\n\t\t\t\t\t\t\t fax='{$fax}',\r\r\n\t\t\t\t\t\t\t email='{$email}',\r\r\n\t\t\t\t\t\t\t citizenship='{$citizenship}',\r\r\n\t\t\t\t\t\t\t civil_status='{$civil_status}',\r\r\n\t\t\t\t\t\t\t sss_nr='{$sss_nr}',\r\r\n\t\t\t\t\t\t\t nat_id_nr='{$nat_id_nr}',\r\r\n\t\t\t\t\t\t\t religion='{$religion}',\r\r\n\t\t\t\t\t\t\t ethnic_orig='{$ethnic_orig}',\r\r\n\t\t\t\t\t\t\t date_update='" . date('Y-m-d H:i:s') . "',"; //if ($old_fn!=$photo_filename){ if ($valid_image) { # Compose the new filename $photo_filename = $pid . '.' . $picext; # Save the file $img_obj->saveUploadedImage($HTTP_POST_FILES['photo_filename'], $root_path . $photo_path . '/', $photo_filename); # add to the sql query $sql .= " photo_filename='{$photo_filename}',"; } # complete the sql query $sql .= " history=" . $person_obj->ConcatHistory("Update " . date('Y-m-d H:i:s') . " " . $HTTP_SESSION_VARS['sess_user_name'] . " \n") . ", modify_id='" . $HTTP_SESSION_VARS['sess_user_name'] . "' WHERE pid={$pid}"; //$db->debug=true; $db->BeginTrans(); $ok = $db->Execute($sql); if ($ok) { $db->CommitTrans(); # Update the insurance data # Lets detect if the data is already existing if ($insurance_show) { if ($insurance_item_nr) { if (!empty($insurance_nr) && !empty($insurance_firm_name) && $insurance_firm_id) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'class_nr' => $insurance_class_nr, 'history' => "Update " . date('Y-m-d H:i:s') . " " . $HTTP_SESSION_VARS['sess_user_name'] . " \n", 'modify_id' => $HTTP_SESSION_VARS['sess_user_name'], 'modify_time' => date('YmdHis')); $pinsure_obj->updateDataFromArray($insure_data, $insurance_item_nr); } } elseif ($insurance_nr && $insurance_firm_name && $insurance_class_nr) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'pid' => $pid, 'class_nr' => $insurance_class_nr, 'history' => "Update " . date('Y-m-d H:i:s') . " " . $HTTP_SESSION_VARS['sess_user_name'] . " \n", 'create_id' => $HTTP_SESSION_VARS['sess_user_name'], 'create_time' => date('YmdHis')); $pinsure_obj->insertDataFromArray($insure_data); } } $newdata = 1; //$db->debug=1; // KB: save other_his_no if (isset($_POST['other_his_org']) && !empty($_POST['other_his_org'])) { $person_obj->OtherHospNrSet($_POST['other_his_org'], $_POST['other_his_no'], $_SESSION['sess_user_name']); } if (file_exists($this->displayfile)) { header("Location: {$this->displayfile}" . URL_REDIRECT_APPEND . "&pid={$pid}&from={$from}&newdata=1&target=entry"); exit; } else { echo "Error! Target display file not defined!!"; } } else { $db->RollbackTrans(); } } else { $from = 'entry'; $HTTP_POST_VARS['date_birth'] = @formatDate2Std($date_birth, $date_format); $HTTP_POST_VARS['date_reg'] = date('Y-m-d H:i:s'); $HTTP_POST_VARS['blood_group'] = trim($HTTP_POST_VARS['blood_group']); $HTTP_POST_VARS['status'] = 'normal'; $HTTP_POST_VARS['history'] = "Init.reg. " . date('Y-m-d H:i:s') . " " . $HTTP_SESSION_VARS['sess_user_name'] . "\n"; //$HTTP_POST_VARS['modify_id']=$HTTP_SESSION_VARS['sess_user_name']; $HTTP_POST_VARS['create_id'] = $HTTP_SESSION_VARS['sess_user_name']; $HTTP_POST_VARS['create_time'] = date('YmdHis'); # Prepare internal data to be stored together with the user input data if (!$person_obj->InitPIDExists($GLOBAL_CONFIG['person_id_nr_init'])) { # If db is mysql, insert the initial pid value from global config # else let the dbms make an initial value via the sequence generator e.g. postgres # However, the sequence generator must be configured during db creation to start at # the initial value set in the global config if ($dbtype == 'mysql') { $HTTP_POST_VARS['pid'] = $GLOBAL_CONFIG['person_id_nr_init']; } } else { # Persons are existing. Check if duplicate might exist if (is_object($duperson = $person_obj->PIDbyData($HTTP_POST_VARS))) { $error_person_exists = TRUE; } } //echo $person_obj->getLastQuery(); if (!$error_person_exists || $mode == 'forcesave') { if ($person_obj->insertDataFromInternalArray()) { # If data was newly inserted, get the insert id if mysql, # else get the pid number from the latest primary key if (!$update) { $oid = $db->Insert_ID(); $pid = $person_obj->LastInsertPK('pid', $oid); //EL: set the new pid $person_obj->setPID($pid); } // KB: save other_his_no if (isset($_POST['other_his_org']) && !empty($_POST['other_his_org'])) { $person_obj->OtherHospNrSet($_POST['other_his_org'], $_POST['other_his_no'], $_SESSION['sess_user_name']); } # Save the valid uploaded photo if ($valid_image) { # Compose the new filename by joining the pid number and the file extension with "." $photo_filename = $pid . '.' . $picext; # Save the file if ($img_obj->saveUploadedImage($HTTP_POST_FILES['photo_filename'], $root_path . $photo_path . '/', $photo_filename)) { # Update the filename to the databank $person_obj->setPhotoFilename($pid, $photo_filename); } } //echo $pid; # Update the insurance data # Lets detect if the data is already existing if ($insurance_show) { if ($insurance_item_nr) { if (!empty($insurance_nr) && !empty($insurance_firm_name) && $insurance_firm_id) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'class_nr' => $insurance_class_nr); $pinsure_obj->updateDataFromArray($insure_data, $insurance_item_nr); } } elseif ($insurance_nr && $insurance_firm_name && $insurance_class_nr) { $insure_data = array('insurance_nr' => $insurance_nr, 'firm_id' => $insurance_firm_id, 'pid' => $pid, 'class_nr' => $insurance_class_nr); $pinsure_obj->insertDataFromArray($insure_data); } } $newdata = 1; if (file_exists($this->displayfile)) { header("Location: {$this->displayfile}" . URL_REDIRECT_APPEND . "&pid={$pid}&from={$from}&newdata=1&target=entry"); exit; } else { echo "Error! Target display file not defined!!"; } } else { echo "<p>{$db->ErrorMsg}()<p>{$LDDbNoSave}"; } } } } // end of if(!$error) } elseif (!empty($this->pid)) { # Get the person´s data if ($data_obj =& $person_obj->getAllInfoObject()) { $zeile = $data_obj->FetchRow(); extract($zeile); # Get the related insurance data $p_insurance =& $pinsure_obj->getPersonInsuranceObject($pid); if ($p_insurance == FALSE) { $insurance_show = TRUE; } else { if (!$p_insurance->RecordCount()) { $insurance_show = TRUE; } elseif ($p_insurance->RecordCount() == 1) { $buffer = $p_insurance->FetchRow(); extract($buffer); $insurance_show = TRUE; $insurance_firm_name = $pinsure_obj->getFirmName($insurance_firm_id); } else { $insurance_show = FALSE; } } } } else { $date_reg = date('Y-m-d H:i:s'); } # Get the insurance classes $insurance_classes =& $pinsure_obj->getInsuranceClassInfoObject('class_nr,name,LD_var AS "LD_var"'); include_once $root_path . 'include/inc_photo_filename_resolve.php'; # # ######## Here starts the GUI output ####################################################### # # # Start Smarty templating here # Create smarty object without initiliazing the GUI (2nd param = FALSE) include_once $root_path . 'gui/smarty_template/smarty_care.class.php'; $this->smarty = new smarty_care('common', FALSE); $img_male = createComIcon($root_path, 'spm.gif', '0'); $img_female = createComIcon($root_path, 'spf.gif', '0'); if (!empty($this->pretext)) { $this->smarty->assign('pretext', $this->pretext); } # Collect extay javascript code $sTemp = ''; ob_start(); ?> <script language="javascript"> <!-- function forceSave(){ document.aufnahmeform.mode.value="forcesave"; document.aufnahmeform.submit(); } function showpic(d){ if(d.value) document.images.headpic.src=d.value; if(d.value) document.images.headpic.src=d.value; } function popSearchWin(target,obj_val,obj_name){ urlholder="./data_search.php<?php echo URL_REDIRECT_APPEND; ?> &target="+target+"&obj_val="+obj_val+"&obj_name="+obj_name; DSWIN<?php echo $sid; ?> =window.open(urlholder,"wblabel<?php echo $sid; ?> ","menubar=no,width=400,height=550,resizable=yes,scrollbars=yes"); } function chkform(d) { if(d.name_last.value==""){ alert("<?php echo $LDPlsEnterLastName; ?> "); d.name_last.focus(); return false; }else if(d.name_first.value==""){ alert("<?php echo $LDPlsEnterFirstName; ?> "); d.name_first.focus(); return false; }else if(d.date_birth.value==""){ alert("<?php echo $LDPlsEnterDateBirth; ?> "); d.date_birth.focus(); return false; }else if(d.sex[0]&&d.sex[1]&&!d.sex[0].checked&&!d.sex[1].checked){ alert("<?php echo $LDPlsSelectSex; ?> "); return false; }else if(d.addr_str.value==""){ alert("<?php echo $LDPlsEnterStreetName; ?> "); d.addr_str.focus(); return false; }else if(d.addr_str_nr.value==""){ alert("<?php echo $LDPlsEnterBldgNr; ?> "); d.addr_str_nr.focus(); return false; }else if(d.addr_citytown_name.value==""){ alert("<?php echo $LDPlsEnterCityTown; ?> "); d.addr_citytown_name.focus(); return false; }else if(d.addr_zip.value==""){ alert("<?php echo $LDPlsEnterZip; ?> "); d.addr_zip.focus(); return false; }else if(d.user_id.value==""){ alert("<?php echo $LDPlsEnterFullName; ?> "); d.user_id.focus(); return false; }else if(d.sss_nr.value==""){ alert("<?php echo $LDPlsEnterSss_nr; ?> "); d.sss_nr.focus(); return false; }else{ return true; } } <?php require $root_path . 'include/inc_checkdate_lang.php'; ?> --> </script> <?php //gjergji : new calendar require_once '../../js/jscalendar/calendar.php'; $calendar = new DHTML_Calendar('../../js/jscalendar/', $lang, 'calendar-system', true); $calendar->load_files(); //end : gjergji $sTemp = ob_get_contents(); ob_end_clean(); $this->smarty->assign('sRegFormJavaScript', $sTemp); $this->smarty->assign('thisfile', $thisfile); if ($error) { $this->smarty->assign('error', TRUE); $this->smarty->assign('sErrorImg', '<img ' . createMascot($root_path, 'mascot1_r.gif', '0', 'bottom') . ' align="absmiddle">'); if ($error > 1) { $this->smarty->assign('sErrorText', $LDErrorS); } else { $this->smarty->assign('sErrorText', $LDError); } } elseif ($error_person_exists) { $this->smarty->assign('errorDupPerson', TRUE); $this->smarty->assign('sErrorImg', '<img ' . createMascot($root_path, 'mascot1_r.gif', '0', 'bottom') . ' align="absmiddle">'); $this->smarty->assign('LDPersonDuplicate', $LDPersonDuplicate); if ($duperson->RecordCount() > 1) { $this->smarty->assign('sErrorText', "{$LDSimilarData2} {$LDPlsCheckFirst2}"); } else { $this->smarty->assign('sErrorText', "{$LDSimilarData} {$LDPlsCheckFirst}"); } $this->smarty->assign('sDupDataColNameRow', "<tr class=\"reg_div\">\r\r\n\t\t\t\t\t<td><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\r\r\n\t\t\t\t\t\t{$LDRegistryNr}</b></td>\r\r\n\t\t\t\t\t<td><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\r\r\n\t\t\t\t\t\t{$LDLastName}</b></td>\r\r\n\t\t\t\t\t<td><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\r\r\n\t\t\t\t\t\t{$LDFirstName}</b></td>\r\r\n\t\t\t\t\t<td><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\r\r\n\t\t\t\t\t\t{$LDBday}</b></td>\r\r\n\t\t\t\t\t<td><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\r\r\n\t\t\t\t\t\t{$LDSex}</b></td>\r\r\n\t\t\t\t\t<td><FONT SIZE=-1 FACE=\"Arial\" color=\"#000066\"><b>\r\r\n\t\t\t\t\t\t{$LDOptions}</b></td>\r\r\n\t\t\t\t\t</tr>"); # List and show the probable same person(s) $toggler = FALSE; $sTemp = ''; while ($dup = $duperson->FetchRow()) { if ($toggler) { $sRowClass = 'wardlistrow2'; } else { $sRowClass = 'wardlistrow1'; } $toggler = !$toggler; $sTemp = $sTemp . "\n" . ' <tr class="' . $sRowClass . '"> <td>' . $dup['pid'] . '</td> <td>' . $dup['name_last'] . '</td> <td>' . $dup['name_first'] . '</td> <td>' . formatDate2Local($dup['date_birth'], $date_format) . '</td> <td>'; switch ($dup['sex']) { case 'f': $sTemp = $sTemp . '<img ' . $img_female . '>'; break; case 'm': $sTemp = $sTemp . '<img ' . $img_male . '>'; break; default: $sTemp = $sTemp . ' '; } $sTemp = $sTemp . ' </td> <td>:: <a href="person_reg_showdetail.php' . URL_APPEND . '&pid=' . $dup['pid'] . '&from=$from&newdata=1&target=entry" target="_blank">' . $LDShowDetails . '</a> :: <a href="patient_register.php' . URL_APPEND . '&pid=' . $dup['pid'] . '&update=1">' . $LDUpdate . '</a> </td> </tr>'; } $this->smarty->assign('sDupDataRows', $sTemp); } if ($pid) { $this->smarty->assign('LDRegistryNr', $LDRegistryNr); } $this->smarty->assign('pid', $pid); $this->smarty->assign('img_source', $img_source); $this->smarty->assign('LDPhoto', $LDPhoto); if (isset($photo_filename)) { $pfile = $photo_filename; } else { $pfile = ''; } $this->smarty->assign('sFileBrowserInput', '<input name="photo_filename" type="file" size="15" onChange="showpic(this)" value="' . $pfile . '">'); # iRowSpanCount counts the rows on the left of the photo image. Begin with 5 because there are 5 static rows. $iRowSpanCount = 5; $this->smarty->assign('LDRegDate', $LDRegDate); $this->smarty->assign('sRegDate', formatDate2Local($date_reg, $date_format) . '<input name="date_reg" type="hidden" value="' . $date_reg . '">'); //$iRowSpanCount++; $this->smarty->assign('LDRegTime', $LDRegTime); $this->smarty->assign('sRegTime', convertTimeToLocal(formatDate2Local($date_reg, $date_format, 0, 1))); // Made hideable as suggested by Kurt brauchli if (!$GLOBAL_CONFIG['person_title_hide']) { $this->smarty->assign('sPersonTitle', $this->createTR($errortitle, 'title', $LDTitle, $title, '', 14)); $iRowSpanCount++; } $this->smarty->assign('sNameLast', $this->createTR($errornamelast, 'name_last', $LDLastName, $name_last, '', 35, TRUE)); //$iRowSpanCount++; $this->smarty->assign('sNameFirst', $this->createTR($errornamefirst, 'name_first', $LDFirstName, $name_first, '', 35, TRUE)); //$iRowSpanCount++; /* Begin SalvoRossitto 26/11/2007 */ if ($errorrelative) { $this->smarty->assign('LDRelative', "<font color=red>{$LDRelative}</font>"); } else { $this->smarty->assign('LDRelative', "{$LDRelative}"); } $this->smarty->assign('sRelativeNameLast', $this->createTR($errorrelativenamelast, 'relative_name_last', $LDLastName, $relative_name_last, 2, 35, FALSE)); $this->smarty->assign('sRelativeNameFirst', $this->createTR($errorrelativenamefirst, 'relative_name_first', $LDFirstName, $relative_name_first, 2, 35, FALSE)); $this->smarty->assign('sRelativePhone', $this->createTR($errorrelativephone, 'relative_phone', $LDPhone, $relative_phone, 2, 35, FALSE)); /* Begin SalvoRossitto 26/11/2007 */ if (!$GLOBAL_CONFIG['person_name_2_hide']) { $this->smarty->assign('sName2', $this->createTR($errorname2, 'name_2', $LDName2, $name_2)); $iRowSpanCount++; } if (!$GLOBAL_CONFIG['person_name_3_hide']) { $this->smarty->assign('sName3', $this->createTR($errorname3, 'name_3', $LDName3, $name_3)); $iRowSpanCount++; } if (!$GLOBAL_CONFIG['person_name_middle_hide']) { $this->smarty->assign('sNameMiddle', $this->createTR($errornamemid, 'name_middle', $LDNameMid, $name_middle)); $iRowSpanCount++; } if (!$GLOBAL_CONFIG['person_name_maiden_hide']) { $this->smarty->assign('sNameMaiden', $this->createTR($errornamemaiden, 'name_maiden', $LDNameMaiden, $name_maiden)); $iRowSpanCount++; } if (!$GLOBAL_CONFIG['person_name_others_hide']) { $this->smarty->assign('sNameOthers', $this->createTR($errornameothers, 'name_others', $LDNameOthers, $name_others)); $iRowSpanCount++; } # Set the rowspan value for the photo image <td> $this->smarty->assign('sPicTdRowSpan', "rowspan={$iRowSpanCount}"); if ($errordatebirth) { $this->smarty->assign('LDBday', "<font color=red>{$LDBday}</font>"); } else { $this->smarty->assign('LDBday', "<font color=red></font> {$LDBday}"); } //gjergji : new calendar /* if($date_birth){ if($mode=='save'||$error||$error_person_exists) $sBdayBuffer = $date_birth; else $sBdayBuffer = formatDate2Local($date_birth,$date_format); }*/ # Uncomment the following when the current date must be inserted # automatically at the start of each document /*else{ $sBdayBuffer = formatDate2Local(date('Y-m-d'),$date_format); }*/ //gjergji : new calendar $this->smarty->assign('sBdayInput', $calendar->show_calendar($calendar, $date_format, 'date_birth', $date_birth)); //end gjergji if ($errorsex) { $this->smarty->assign('LDSex', "<font color=#ff0000>{$LDSex}</font>:"); } else { $this->smarty->assign('LDSex', "<font color=#ff0000></font> {$LDSex}"); } $sSexMBuffer = '<input name="sex" type="radio" value="m" '; if ($sex == "m") { $sSexMBuffer .= ' checked>'; } else { $sSexMBuffer .= '>'; } $this->smarty->assign('sSexM', $sSexMBuffer); $this->smarty->assign('LDMale', $LDMale); $sSexFBuffer = '<input name="sex" type="radio" value="f" '; if ($sex == "f") { $sSexFBuffer .= 'checked>'; } else { $sSexFBuffer .= '>'; } $this->smarty->assign('sSexF', $sSexFBuffer); $this->smarty->assign('LDFemale', $LDFemale); # But patch 2004-03-10 # Clean blood group $blood_group = trim($blood_group); // Made hideable as suggested by Kurt Brauchli if (!$GLOBAL_CONFIG['person_bloodgroup_hide']) { $this->smarty->assign('LDBloodGroup', $LDBloodGroup); $sBGBuffer = ' <input name="blood_group" type="radio" value="A" '; if ($blood_group == 'A') { $sBGBuffer .= 'checked'; } $sBGBuffer .= '>'; $this->smarty->assign('sBGAInput', $sBGBuffer); $this->smarty->assign('LDA', $LDA); $sBGBuffer = ' <input name="blood_group" type="radio" value="B" '; if ($blood_group == 'B') { $sBGBuffer .= 'checked'; } $sBGBuffer .= '>'; $this->smarty->assign('sBGBInput', $sBGBuffer); $this->smarty->assign('LDB', $LDB); $sBGBuffer = ' <input name="blood_group" type="radio" value="AB" '; if ($blood_group == 'AB') { $sBGBuffer .= 'checked'; } $sBGBuffer .= '>'; $this->smarty->assign('sBGABInput', $sBGBuffer); $this->smarty->assign('LDAB', $LDAB); $sBGBuffer = ' <input name="blood_group" type="radio" value="O" '; if ($blood_group == 'O') { $sBGBuffer .= 'checked'; } $sBGBuffer .= '>'; $this->smarty->assign('sBGOInput', $sBGBuffer); $this->smarty->assign('LDO', $LDO); } // KB: make civil status hideable if (!$GLOBAL_CONFIG['person_civilstatus_hide']) { $this->smarty->assign('LDCivilStatus', $LDCivilStatus); $sCSInput = '<input name="civil_status" type="radio" '; $sCSBuffer = $sCSInput . 'value="single" '; if ($civil_status == "single") { $sCSBuffer .= 'checked'; } $this->smarty->assign('sCSSingleInput', $sCSBuffer . '>'); $sCSBuffer = $sCSInput . 'value="married" '; if ($civil_status == "married") { $sCSBuffer .= 'checked'; } $this->smarty->assign('sCSMarriedInput', $sCSBuffer . '>'); $sCSBuffer = $sCSInput . 'value="divorced" '; if ($civil_status == "divorced") { $sCSBuffer .= 'checked'; } $this->smarty->assign('sCSDivorcedInput', $sCSBuffer . '>'); $sCSBuffer = $sCSInput . 'value="widowed" '; if ($civil_status == "widowed") { $sCSBuffer .= 'checked'; } $this->smarty->assign('sCSWidowedInput', $sCSBuffer . '>'); $sCSBuffer = $sCSInput . 'value="separated" '; if ($civil_status == "separated") { $sCSBuffer .= 'checked'; } $this->smarty->assign('sCSSeparatedInput', $sCSBuffer . '>'); $this->smarty->assign('LDSingle', $LDSingle); $this->smarty->assign('LDMarried', $LDMarried); $this->smarty->assign('LDDivorced', $LDDivorced); $this->smarty->assign('LDWidowed', $LDWidowed); $this->smarty->assign('LDSeparated', $LDSeparated); } if ($erroraddress) { $this->smarty->assign('LDAddress', "<font color=red>{$LDAddress}</font>"); } else { $this->smarty->assign('LDAddress', "{$LDAddress}"); } if ($errorstreet) { $this->smarty->assign('LDStreet', "<font color=red><font color=#ff0000></font> {$LDStreet}</font>"); } else { $this->smarty->assign('LDStreet', "<font color=#ff0000></font> {$LDStreet}"); } $this->smarty->assign('sStreetInput', '<input name="addr_str" type="text" size="35" value="' . $addr_str . '">'); if ($errorstreetnr) { $this->smarty->assign('LDStreetNr', "<font color=red><font color=#ff0000></font> {$LDStreetNr}</font>"); } else { $this->smarty->assign('LDStreetNr', "<font color=#ff0000></font> {$LDStreetNr}"); } $this->smarty->assign('sStreetNrInput', '<input name="addr_str_nr" type="text" size="10" value="' . $addr_str_nr . '">'); if ($errortown) { $this->smarty->assign('LDStreet', "<font color=red>{$LDTownCity}</font>"); } else { $this->smarty->assign('LDTownCity', "{$LDTownCity}"); } $this->smarty->assign('sTownCityInput', '<input name="addr_citytown_name" type="text" size="35" value="' . $addr_citytown_name . '">'); $this->smarty->assign('sTownCityMiniCalendar', "<a href=\"javascript:popSearchWin('citytown','aufnahmeform.addr_citytown_nr','aufnahmeform.addr_citytown_name')\"><img " . createComIcon($root_path, 'b-write_addr.gif', '0') . "></a>"); if ($errorzip) { $this->smarty->assign('LDZipCode', "<font color=red><font color=#ff0000></font> {$LDZipCode}</font> "); } else { $this->smarty->assign('LDZipCode', "<font color=#ff0000></font> {$LDZipCode} "); } $this->smarty->assign('sZipCodeInput', '<input name="addr_zip" type="text" size="10" value="' . $addr_zip . '">'); // KB: make insurance completely hideable if (!$GLOBAL_CONFIG['person_insurance_hide']) { if ($insurance_show) { if (!$person_insurance_1_nr_hide) { $this->smarty->assign('bShowInsurance', TRUE); $this->smarty->assign('sInsuranceNr', $this->createTR($errorinsurancenr, 'insurance_nr', $LDInsuranceNr . ' 1', $insurance_nr, 2)); if ($errorinsuranceclass) { $this->smarty->assign('sErrorInsClass', "<font color=\"{$error_fontcolor}\">"); } if ($insurance_classes != false) { $sInsClassBuffer = ''; while ($result = $insurance_classes->FetchRow()) { $sInsClassBuffer .= '<input name="insurance_class_nr" type="radio" value="' . $result['class_nr'] . '" '; if ($insurance_class_nr == $result['class_nr']) { $sInsClassBuffer .= 'checked'; } $sInsClassBuffer .= '>'; $LD = $result['LD_var']; if (isset(${$LD}) && !empty(${$LD})) { $sInsClassBuffer .= ${$LD}; } else { $sInsClassBuffer .= $result['name']; } $sInsClassBuffer .= ' '; } $this->smarty->append('sInsClasses', $sInsClassBuffer); } else { $this->smarty->assign('sInsClasses', 'no insurance class'); } if ($errorinsurancecoid) { $this->smarty->assign('LDInsuranceCo', "<font color=red>{$LDInsuranceCo}</font> :"); } else { $this->smarty->assign('LDInsuranceCo', "{$LDInsuranceCo} :"); } $this->smarty->assign('sInsCoNameInput', '<input name="insurance_firm_name" type="text" size="35" value="' . $insurance_firm_name . '">'); $this->smarty->assign('sInsCoMiniCalendar', "<a href=\"javascript:popSearchWin('insurance','aufnahmeform.insurance_firm_id','aufnahmeform.insurance_firm_name')\"><img " . createComIcon($root_path, 'b-write_addr.gif', '0') . "></a>"); } } else { $this->smarty->assign('bNoInsurance', TRUE); $this->smarty->assign('LDSeveralInsurances', '<a href="#">$LDSeveralInsurances <img ' . createComIcon($root_path, 'frage.gif', '0') . '></a>'); } } if (!$GLOBAL_CONFIG['person_phone_1_nr_hide']) { $this->smarty->assign('sPhone1', $this->createTR($errorphone1, 'phone_1_nr', $LDPhone . ' 1', $phone_1_nr, 2)); } if (!$GLOBAL_CONFIG['person_phone_2_nr_hide']) { $this->smarty->assign('sPhone2', $this->createTR($errorphone2, 'phone_2_nr', $LDPhone . ' 2', $phone_2_nr, 2)); } if (!$GLOBAL_CONFIG['person_cellphone_1_nr_hide']) { $this->smarty->assign('sCellPhone1', $this->createTR($errorcell1, 'cellphone_1_nr', $LDCellPhone . ' 1', $cellphone_1_nr, 2)); } if (!$GLOBAL_CONFIG['person_cellphone_2_nr_hide']) { $this->smarty->assign('sCellPhone2', $this->createTR($errorcell2, 'cellphone_2_nr', $LDCellPhone . ' 2', $cellphone_2_nr, 2)); } if (!$GLOBAL_CONFIG['person_fax_hide']) { $this->smarty->assign('sFax', $this->createTR($errorfax, 'fax', $LDFax, $fax, 2)); } if (!$GLOBAL_CONFIG['person_email_hide']) { $this->smarty->assign('sEmail', $this->createTR($erroremail, 'email', $LDEmail, $email, 2)); } if (!$GLOBAL_CONFIG['person_citizenship_hide']) { $this->smarty->assign('sCitizenship', $this->createTR($errorcitizen, 'citizenship', $LDCitizenship, $citizenship, 2)); } if (!$GLOBAL_CONFIG['person_sss_nr_hide']) { $this->smarty->assign('sSSSNr', $this->createTR($errorsss, 'sss_nr', $LDSSSNr, $sss_nr, 2)); } if (!$GLOBAL_CONFIG['person_nat_id_nr_hide']) { $this->smarty->assign('sNatIdNr', $this->createTR($errornatid, 'nat_id_nr', $LDNatIdNr, $nat_id_nr, 2)); } if (!$GLOBAL_CONFIG['person_religion_hide']) { $this->smarty->assign('sReligion', $this->createTR($errorreligion, 'religion', $LDReligion, $religion, 2)); } if (!$GLOBAL_CONFIG['person_ethnic_orig_hide']) { /** Add by Jean-Philippe LIOT 13/05/2004 **/ $this->smarty->assign('LDEthnicOrig', $LDEthnicOrigin); $this->smarty->assign('sEthnicOrigInput', '<input name="ethnic_orig_txt" type="text" size="35" value="' . $ethnic_orig_txt . '" >'); $this->smarty->assign('sEthnicOrigMiniCalendar', "<a href=\"javascript:popSearchWin('ethnic_orig')\"><img " . createComIcon($root_path, 'b-write_addr.gif', '0') . "></a>"); } // KB: add a field for other HIS nr if (!$GLOBAL_CONFIG['person_other_his_nr_hide']) { $this->smarty->assign('bShowOtherHospNr', TRUE); $this->smarty->assign('LDOtherHospitalNr', $LDOtherHospitalNr); $other_hosp_list = $person_obj->OtherHospNrList(); $sOtherNrBuffer = ''; foreach ($other_hosp_list as $k => $v) { $sOtherNrBuffer .= "<b>" . $kb_other_his_array[$k] . ":</b> " . $v . "<br />\n"; } $this->smarty->assign('sOtherNr', $sOtherNrBuffer); $sOtherNrBuffer = ''; $sOtherNrBuffer .= "<SELECT name=\"other_his_org\">" . "<OPTION value=\"\">--</OPTION>"; foreach ($kb_other_his_array as $k => $v) { $sOtherNrBuffer .= "<OPTION value=\"{$k}\" {$check}>{$v}</OPTION>"; } $sOtherNrBuffer .= "</SELECT>\n" . " " . "{$LDNr}:<INPUT name=\"other_his_no\" size=20><br />\n"; $sOtherNrBuffer .= "({$LDSelectOtherHospital} - {$LDNoNrNoDelete})" . "<br />\n"; $sOtherNrBuffer .= "</TD></TR>\n\n"; $this->smarty->assign('sOtherNrSelect', $sOtherNrBuffer); } $this->smarty->assign('LDRegBy', $LDRegBy); if (isset($user_id) && $user_id) { $buffer = $user_id; } else { $buffer = $HTTP_SESSION_VARS['sess_user_name']; } $this->smarty->assign('sRegByInput', '<input name="user_id" type="text" value="' . $buffer . '" size="35" readonly>'); # Collect the hidden inputs ob_start(); ?> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000"> <input type="hidden" name="itemname" value="<?php echo $itemname; ?> "> <input type="hidden" name="sid" value="<?php echo $sid; ?> "> <input type="hidden" name="lang" value="<?php echo $lang; ?> "> <input type="hidden" name="linecount" value="<?php echo $linecount; ?> "> <input type="hidden" name="mode" value="save"> <input type="hidden" name="addr_citytown_nr" value="<?php echo $addr_citytown_nr; ?> "> <input type="hidden" name="insurance_item_nr" value="<?php echo $insurance_item_nr; ?> "> <input type="hidden" name="insurance_firm_id" value="<?php echo $insurance_firm_id; ?> "> <input type="hidden" name="insurance_show" value="<?php echo $insurance_show; ?> "> <input type="hidden" name="ethnic_orig" value="<?php echo $ethnic_orig; ?> "> <?php if ($update) { $this->smarty->assign('sUpdateHiddenInputs', '<input type="hidden" name="update" value=1><input type="hidden" name="pid" value="' . $pid . '">'); } $sTemp = ob_get_contents(); ob_end_clean(); $this->smarty->assign('sHiddenInputs', $sTemp); $this->smarty->assign('pbSubmit', '<input type="image" ' . createLDImgSrc($root_path, 'savedisc.gif', '0') . ' alt="' . $LDSaveData . '" align="absmiddle">'); $this->smarty->assign('pbReset', '<a href="javascript:document.aufnahmeform.reset()"><img ' . createLDImgSrc($root_path, 'reset.gif', '0') . ' alt="' . $LDResetData . '" align="absmiddle"></a>'); if ($error || $error_person_exists) { $this->smarty->assign('pbForceSave', '<input type="button" value="' . $LDForceSave . '" onClick="forceSave()">'); } if (!$newdata) { ob_start(); ?> <form action=<?php echo $thisfile; ?> method=post> <input type=hidden name=sid value=<?php echo $sid; ?> > <input type=hidden name=patnum value=""> <input type=hidden name="lang" value="<?php echo $lang; ?> "> <input type=hidden name="date_format" value="<?php echo $date_format; ?> "> <input type=submit value="<?php echo $LDNewForm; ?> " > </form> <?php $sTemp = ob_get_contents(); ob_end_clean(); $this->smarty->assign('sNewDataForm', $sTemp); } # Set the form template as form $this->smarty->assign('bSetAsForm', TRUE); if ($this->bReturnOnly) { ob_start(); $this->smarty->display('registration_admission/reg_form.tpl'); $sTemp = ob_get_contents(); ob_end_clean(); return $sTemp; } else { # show Template $this->smarty->display('registration_admission/reg_form.tpl'); } }
function prepDataforDB($array) { global $date_format; $debug = false; foreach ($this->defaultData as $x => $v) { if (!empty($array[$x])) { if (is_array($array[$x])) { foreach ($array[$x] as $x2 => $v2) { $temp = explode('|', $v2, 3); if ($temp[1] != "") { $data[$x][$temp[0]] = "'" . $temp[1] . "'"; } else { $data[$x][$temp[0]] = 'null'; } } } else { if (strpos($array[$x], "|")) { $temp = explode('|', $array[$x], 3); if ($x == "functional_status" or $x == "tb_status" or $x == "status_txt" or $x == "adher_code" or $x == "status") { $data[$x] = $temp[0]; } else { if ($temp[1] != "") { $data[$x]['id'] = $temp[0]; $data[$x]['other'] = "'" . $temp[1] . "'"; } else { $data[$x]['id'] = $temp[0]; $data[$x]['other'] = 'null'; } // if($temp[0]==''||$temp[0]=='n'){ // $data[$x]['id'] = 'null'; // } } } else { if ($x == "visit_date" or $x == "date_of_delivery" or $x == "next_visit_date") { $data[$x] = "'" . formatDate2STD($array[$x], $date_format) . "'"; } else { $data[$x] = "'" . $array[$x] . "'"; } } } } else { $data[$x] = 'null'; } } if ($debug) { echo "<pre>"; echo "*******InsertArray**************</br>"; print_r($data); echo "</pre>"; } return $data; }
//header("location:$thisfile?sid=$sid&saved=1&dept=$dept&pmonth=$pmonth&pyear=$pyear"); } else { echo "{$sql} <p>"; exit; } //end of else } else { if (${$dt} && (${$an} || ${$rn}) && ${$op} && ${$dg}) { list($id, $im, $iy) = explode(".", ${$dt}); if (strlen($id) < 2) { $id = "0" . $id; } if (strlen($im) < 2) { $im = "0" . $im; } $sql = "INSERT INTO {$dbtable} \n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\tdept,\n\t\t\t\t\t\t\t\t\t\tdate,\n\t\t\t\t\t\t\t\t\t\tstandby_name,\n\t\t\t\t\t\t\t\t\t\tstandby_start,\n\t\t\t\t\t\t\t\t\t\tstandby_end,\n\t\t\t\t\t\t\t\t\t\toncall_name,\n\t\t\t\t\t\t\t\t\t\toncall_start,\n\t\t\t\t\t\t\t\t\t\toncall_end,\n\t\t\t\t\t\t\t\t\t\top_room,\n\t\t\t\t\t\t\t\t\t\tdiagnosis_therapy,\n\t\t\t\t\t\t\t\t\t\tencoding,\n\t\t\t\t\t\t\t\t\t\tstatus,\n\t\t\t\t\t\t\t\t\t\thistory,\n\t\t\t\t\t\t\t\t\t\tmodify_id,\n\t\t\t\t\t\t\t\t\t\tcreate_id,\n\t\t\t\t\t\t\t\t\t\tcreate_time\n\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\tVALUES \n\t\t\t\t\t\t\t\t\t( \n\t\t\t\t\t\t\t\t\t\t'" . $dept . "',\n\t\t\t\t\t\t\t\t\t\t'" . formatDate2STD(${$dt}, $date_format) . "',\n\t\t\t\t\t\t\t\t\t\t'" . ${$an} . "',\n\t\t\t\t\t\t\t\t\t\t'" . convertTimeToStandard(${$av}) . "',\n\t\t\t\t\t\t\t\t\t\t'" . convertTimeToStandard(${$ab}) . "',\n\t\t\t\t\t\t\t\t\t\t'" . ${$rn} . "',\n\t\t\t\t\t\t\t\t\t\t'" . convertTimeToStandard(${$rv}) . "',\n\t\t\t\t\t\t\t\t\t\t'" . convertTimeToStandard(${$rb}) . "',\n\t\t\t\t\t\t\t\t\t\t'" . ${$op} . "',\n\t\t\t\t\t\t\t\t\t\t'" . htmlspecialchars(${$dg}) . "',\n\t\t\t\t\t\t\t\t\t\t'e={$encoder}&a={$a_enc}&r={$r_enc}&d=" . date('Y-m-d') . "&t=" . date('H:i:s') . "',\n\t\t\t\t\t\t\t\t\t\t'pending',\n\t\t\t\t\t\t\t\t\t\t'Created: " . $history_txt . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_COOKIE[$local_user . $sid] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_COOKIE[$local_user . $sid] . "',\n\t\t\t\t\t\t\t\t\t\tNULL\n\t\t\t\t\t\t\t\t\t)"; if (!($ergebnis = $db->Execute($sql))) { echo "<p>" . $sql . "<p>{$LDDbNoSave}"; } } // end of if } // end of else } // end of if $$tg } // end of for header("location:{$thisfile}?sid={$sid}&lang={$lang}&saved=1&dept={$dept}&pmonth={$pmonth}&pyear={$pyear}&pday={$pday}&retpath={$retpath}"); } else { $sql = "SELECT * FROM {$dbtable} WHERE date='{$pyear}-{$pmonth}-{$pday}'"; if (date('Hi') < 830) {
$mode = ''; } if (!isset($ofset)) { $ofset = ''; } # Load the date formatter require_once $root_path . 'include/inc_date_format_functions.php'; if (isset($mode) && $mode == 'search') { if (isset($dept) && empty($dept) && isset($tech) && empty($tech) && isset($sdate) && empty($sdate) && isset($edate) && empty($edate)) { $mode = ''; } if (isset($edate) && $edate) { $edate = @formatDate2STD($edate, $date_format); } if (isset($sdate) && $sdate) { $sdate = @formatDate2STD($sdate, $date_format); } if (!isset($ofset) || !$ofset) { $ofset = 0; } if (!isset($nrows) || !$nrows) { $nrows = 20; } } # init db parameters $linecount = 0; $dbtable = 'care_tech_repair_done'; if ($mode == 'search') { $sql = 'SELECT * FROM ' . $dbtable . ' WHERE '; if ($tech) { $sql .= " reporter LIKE '{$tech}%' ";
if (preg_match('/save_immunization.inc.php/i', $_SERVER['PHP_SELF'])) { die('<meta http-equiv="refresh" content="0; url=../">'); } require_once $root_path . 'include/care_api_classes/class_immunization.php'; if (!isset($imm_obj)) { $imm_obj = new Immunization(); } require_once $root_path . 'include/inc_date_format_functions.php'; # Check date, default is today if ($_POST['date']) { $_POST['date'] = @formatDate2STD($_POST['date'], $date_format); } else { $_POST['date'] = date('Y-m-d'); } if ($_POST['refresh_date']) { $_POST['refresh_date'] = @formatDate2STD($_POST['refresh_date'], $date_format); } $imm_obj->setDataArray($_POST); if ($type && $medicine && $dosage && $application_type_nr && $application_by) { switch ($mode) { case 'create': //if($_POST['date') $_POST['date']=@formatDate2STD($_POST['date'],$date_format); //if($_POST['refresh_date') $_POST['date']=@formatDate2STD($_POST['refresh_date'],$date_format); if ($imm_obj->insertDataFromInternalArray()) { header("location:" . $thisfile . URL_REDIRECT_APPEND . "&mode=show&target={$target}&pid=" . $_SESSION['sess_pid']); exit; } else { echo "<br>{$LDDbNoSave}"; } break; case 'update':
function insertComment($data, $group_id) { global $db, $date_format; $debug = false; $debug ? $db->debug = TRUE : ($db->debug = FALSE); $date_comment = formatDate2STD($data['comment_date'], $date_format); $this->sql = "INSERT INTO care_tz_arv_education SET \n care_tz_arv_registration_id=" . $this->registrationID . ",\n \tcare_tz_arv_education_topic_id=" . $data['comment_id'] . ",\n \tcomment_date='{$date_comment}',\n\t\t\t\t\t\tcare_tz_arv_education_group_id={$group_id},\n\t\t\t\t\t\tcomment='" . $data['comment'] . "',\n\t\t\t\t\t\tcreate_id='" . $data['signature'] . "',\n\t\t\t\t\t\tmodify_id=null,\n\t\t\t\t\t\tmodify_time=" . time() . ",\n\t\t\t\t history='Created " . date('Y-m-d H:i:s') . " " . $data['signature'] . ";\n'"; if (!$this->Transact($this->sql)) { $this->errors++; $this->error_message['db'] = "Insert failed"; return false; } }
} else { echo "<p>" . $lab_obj->getLastQuery() . "{$LDDbNoSave}"; } } } # If save successful, jump to display values if ($saved) { include_once $root_path . 'include/inc_visual_signalling_fx.php'; # Set the visual signal setEventSignalColor($encounter_nr, SIGNAL_COLOR_DIAGNOSTICS_REPORT); //header("location:$thisfile?sid=$sid&lang=$lang&saved=1&batch_nr=$batch_nr&encounter_nr=$encounter_nr&job_id=$job_id¶meterselect=$parameterselect&allow_update=1&user_origin=$user_origin&tickerror=$tickerror"); header("location:labor_test_request_admin_chemlabor.php?sid={$sid}"); exit; } } else { $dbuf['test_date'] = formatDate2STD($_POST['test_date'], $date_format); $dbuf['test_time'] = date('H:i:s'); $dbuf['history'] = "Create " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n"; $dbuf['create_id'] = $_SESSION['sess_user_name']; $dbuf['create_time'] = date('YmdHis'); # Insert new job record $lab_obj->setDataArray($dbuf); if ($lab_obj->insertDataFromInternalArray()) { $pk_nr = $db->Insert_ID(); $batch_nr = $lab_obj->LastInsertPK('batch_nr', $pk_nr); foreach ($nbuf as $key => $value) { if (isset($value) && !empty($value)) { $parsedParamList['batch_nr'] = $batch_nr; $parsedParamList['encounter_nr'] = $encounter_nr; $parsedParamList['job_id'] = $job_id; $parsedParamList['paramater_name'] = $key;
* See the file "copy_notice.txt" for the licence notice */ $lang_tables = array('departments.php'); define('LANG_FILE', 'or.php'); define('NO_2LEVEL_CHK', 1); require_once $root_path . 'include/inc_front_chain_lang.php'; if (!$internok && !$_COOKIE['ck_op_pflegelogbuch_user' . $sid]) { header("location:" . $root_path . "language/" . $lang . "/lang_" . $lang . "_invalid-access-warning.php"); exit; } //$db->debug=1; /* Load the date formatter */ require_once $root_path . 'include/inc_date_format_functions.php'; # Check the calendar date if (isset($sdate) && !empty($sdate)) { $thisday = formatDate2STD($sdate, $date_format); } elseif (!isset($thisday) || empty($thisday)) { # Set default date to today $thisday = date('Y-m-d'); } # Load date shifter class require_once $root_path . 'classes/datetimemanager/class.dateTimeManager.php'; # Create new dateTimeManager object */ $tshifter = new dateTimeManager(); # Shift time back 1 day $yesday = $tshifter->shift_dates($thisday, '1', 'd'); # Shift time forward 1 day $tomorow = $tshifter->shift_dates($thisday, '-1', 'd'); # Todays date $today = date('Y-m-d'); $opabt = get_meta_tags($root_path . 'global_conf/' . $lang . '/op_tag_dept.pid');
echo $DOB; if ($DOB == '') { $sql2 .= ' AND date_birth LIKE "' . $bd . '%" '; } else { $sql2 .= ' AND date_birth = "' . $DOB . '" '; } } //if(empty($oitem)) $oitem='name_last'; //if(empty($odir)) $odir='ASC'; # default, ascending alphabetic } else { # Check if * or % if ($suchwort == '%' || $suchwort == '%%') { $sql2 = ' WHERE 1'; } else { # Check if it is a complete DOB $DOB = formatDate2STD($suchwort, $date_format); echo $DOB; if ($DOB == '') { if (defined('SHOW_FIRSTNAME_CONTROLLER') && SHOW_FIRSTNAME_CONTROLLER) { if (isset($HTTP_POST_VARS['firstname_too']) && $HTTP_POST_VARS['firstname_too']) { $sql2 = ' WHERE name_last LIKE "' . strtr($suchwort, '+', ' ') . '%" OR name_first LIKE "' . strtr($suchwort, '+', ' ') . '%"'; $firstname_too = 1; } else { $sql2 = ' WHERE name_last LIKE "' . strtr($suchwort, '+', ' ') . '%" '; $firstname_too = 0; } } else { $sql2 = ' WHERE name_last LIKE "' . strtr($suchwort, '+', ' ') . '%" OR name_first LIKE "' . strtr($suchwort, '+', ' ') . '%"'; $firstname_too = 1; } } else {
$tab = 'p'; array_walk($parray, 'Cond'); $earray = array('encounter_nr', 'encounter_class_nr', 'current_ward_nr', 'referrer_diagnosis', 'referrer_dr', 'referrer_recom_therapy', 'referrer_notes', 'insurance_class_nr'); $tab = 'e'; array_walk($earray, 'Cond'); $farray = array('sc_care_class_nr', 'sc_room_class_nr', 'sc_att_dr_class_nr'); array_walk($farray, 'fCond'); # Process the dates if (isset($date_start) && !empty($date_start)) { $date_start = @formatDate2STD($date_start, $date_format); } if (isset($date_end) && !empty($date_end)) { $date_end = @formatDate2STD($date_end, $date_format); } if (isset($date_birth) && !empty($date_birth)) { $date_birth = @formatDate2STD($date_birth, $date_format); } if ($date_start) { if ($date_end) { $datecond = "(e.encounter_date {$sql_LIKE} '{$date_start}%' OR e.encounter_date>'{$date_start}') AND (e.encounter_date<'{$date_end}' OR e.encounter_date {$sql_LIKE} '{$date_end}%')"; } else { $datecond = "e.encounter_date {$sql_LIKE} '{$date_start}%'"; } } elseif ($date_end) { $datecond = "(e.encounter_date< '{$date_end}' OR e.encounter_date {$sql_LIKE} '{$date_end}%')"; } if ($date_birth) { $datecond = "(p.date_birth {$sql_LIKE} '{$date_birth}%')"; } if (!empty($datecond)) { if (empty($where)) {
*/ $rep_obj = new selianreport(); $lang_tables[] = 'date_time.php'; $lang_tables[] = 'reporting.php'; require $root_path . 'include/inc_front_chain_lang.php'; require_once 'include/inc_timeframe.php'; $month = array_search(1, $ARR_SELECT_MONTH); $year = array_search(1, $ARR_SELECT_YEAR); if ($printout) { $startdate = $_GET['start']; $enddate = $_GET['end']; // $start_timeframe = $start; // $end_timeframe = $end; // $startdate = date("y.m.d ", $start_timeframe); // $enddate = date("y.m.d", $end_timeframe); $amount_per_person = $_GET['amount_per_person']; } else { $startdate = @formatDate2STD($_POST['date_from'], "dd/mm/yyyy"); !isset($_POST['date_to']) || $_POST['date_to'] == '' ? $enddate = @formatDate2STD(date('Y-m-d'), "yyyy-mm-dd") : ($enddate = @formatDate2STD($_POST['date_to'], "dd/mm/yyyy")); } if (!isset($_POST['amount_per_person']) || $_POST['amount_per_person'] == '') { $amount_per_person = 0; } else { $amount_per_person = $_POST['amount_per_person']; } $debug = FALSE; $debug ? $db->debug = TRUE : ($db->debug = FALSE); //Get the doctors list and the number of patients they have attended. $docs_patients = "SELECT name, doctor, sum(attend) AS no_of_patients \r\n FROM care_tz_hospital_doctor_history, care_users\r\n WHERE care_tz_hospital_doctor_history.doctor = care_users.login_id\r\n AND date >= '{$startdate}' AND date <= '{$enddate}' \r\n GROUP BY doctor ORDER BY name asc"; $db_docs_patients = $db->Execute($docs_patients); require_once 'gui/gui_docs_util.php';
function insertARVdata($values) { global $db, $date_format; $this->debug = false; $this->debug ? $db->debug = TRUE : ($db->debug = FALSE); $this->setARVdata($values); $this->arv_patient_data['create_id'] = $_SESSION['sess_login_userid']; $this->sql = "INSERT INTO care_tz_arv_case (\n\t care_tz_arv_case_id,\n\t pid,\n\t datetime_first_hivtest,\n\t datetime_start_arv,\n\t arv_pid,\n\t\t\t\t\t\tdistrict,\n\t\t\t\t\t\tvillage,\n\t\t\t\t\t\tstreet,\n\t balozi,\n\t chairman_of_village,\n\t head_of_family,\n\t name_of_secretary,\n\t secretary_phone,\n\t secretary_adress,\n\t history,\n\t\t\t\t\t\tcreate_id,\n\t create_time,\n\t modify_id,\n\t modify_time)\n VALUES(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t" . $this->pid . ",\n\t\t\t\t\t\t'" . formatDate2STD($this->arv_patient_data['datetime_first_hivtest'], $date_format) . "',\n '" . formatDate2STD($this->arv_patient_data['datetime_start_arv'], $date_format) . "',\n\t\t\t\t\t\t" . $this->arv_patient_data['arv_pid'] . ",\n\t\t\t\t\t\t'" . $this->arv_patient_data['district'] . "',\n\t\t\t\t\t\t'" . $this->arv_patient_data['village'] . "',\n\t\t\t\t\t\t'" . $this->arv_patient_data['street'] . "',\n '" . $this->arv_patient_data['balozi'] . "',\n\t\t\t\t\t\t'" . $this->arv_patient_data['chairman_of_village'] . "',\n\t\t\t\t\t\t'" . $this->arv_patient_data['head_of_family'] . "',\n\t\t\t\t\t\t'" . $this->arv_patient_data['name_of_secretary'] . "',\n\t\t\t\t\t\t'" . $this->arv_patient_data['secretary_phone'] . "',\n\t\t\t\t\t\t'" . $this->arv_patient_data['secretary_adress'] . "',\n\t\t\t\t\t\t'Created " . date('Y-m-d H:i:s') . " " . $this->arv_patient_data['create_id'] . ";\n',\n\t\t\t\t\t\t'" . $this->arv_patient_data['create_id'] . "',\n\t\t\t\t\t\t" . time() . ",\n\t\t\t\t\t\tnull,\n\t\t\t\t\t null)"; if (!Core::Transact($this->sql)) { if ($db->ErrorNo() == 1062) { $this->error_message['db'] = sprintf($this->msg_tpl_big, "A patient with this ID is already registered"); } else { $this->error_message['db'] = sprintf($this->msg_tpl_big, "Insert failed"); } return false; } return true; }
# Check the size of the comp if (sizeof($comp) > 1) { $sql2 = " WHERE ( reg.name_2 {$sql_LIKE} '" . strtr($ln, '+', ' ') . "%'\n\t\t\t \t\tAND reg.name_first {$sql_LIKE} '" . strtr($fn, '+', ' ') . "%')"; if ($bd) { $stddate = formatDate2STD($bd, $date_format); if (!empty($stddate)) { $sql2 .= " AND (reg.date_birth = '{$stddate}' OR reg.date_birth {$sql_LIKE} '%{$bd}%')"; } } if (empty($odir)) { $odir = 'DESC'; } # default, latest birth at top } else { $sql2 = " WHERE (reg.name_2 {$sql_LIKE} '" . strtr($suchwort, '+', ' ') . "%'\n\t\t\t \t\tOR reg.name_first {$sql_LIKE} '" . strtr($suchwort, '+', ' ') . "%'\n\t\t\t \t\tOR reg.name_last {$sql_LIKE} '" . strtr($suchwort, '+', ' ') . "%'"; $bufdate = formatDate2STD($suchwort, $date_format); if (!empty($bufdate)) { $sql2 .= " OR reg.date_birth {$sql_LIKE} '{$bufdate}'"; } $sql2 .= ")"; if (empty($odir)) { $odir = 'ASC'; } # default, ascending alphabetic } } $sql2 .= " AND enc.pid=reg.pid\n\t\t\t\t\t AND enc.encounter_status <> 'cancelled'\n\t\t\t\t\t AND (enc.is_discharged = '' OR enc.is_discharged=0)\n\t\t\t\t\t AND enc.status NOT IN ('void','hidden','inactive','deleted') ORDER BY "; # Filter if it is personnel nr if ($oitem == 'encounter_nr') { $sql2 .= 'enc.' . $oitem . ' ' . $odir; } else {
//echo $sql; // Load the visual signalling functions include_once $root_path . 'include/inc_visual_signalling_fx.php'; // Set the visual signal setEventSignalColor($pn, SIGNAL_COLOR_DIAGNOSTICS_REQUEST); header("location:" . $root_path . "modules/laboratory/labor_test_request_aftersave.php" . URL_REDIRECT_APPEND . "&edit={$edit}&saved=insert&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&noresize={$noresize}&batch_nr={$batch_nr}"); exit; } else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = ""; } break; // end of case 'save' // end of case 'save' case 'update': $sql = "UPDATE care_test_request_" . $db_request_table . " SET \n\t\t\t\t\t\t\t\t dept_nr = '" . $dept_nr . "', \n\t\t\t\t\t\t\t\t\t\t quick_cut = '" . $quick_cut . "', \n\t\t\t\t\t\t\t\t\t\t qc_phone = '" . $qc_phone . "', \n\t\t\t\t\t\t\t\t\t\t quick_diagnosis = '" . $quick_diagnosis . "',\n\t\t\t\t\t\t\t\t\t\t qd_phone = '" . $qd_phone . "', \n\t\t\t\t\t\t\t\t\t\t material_type = '" . $material_type . "',\n\t\t\t\t\t\t\t\t\t\t material_desc = '" . htmlspecialchars($material_desc) . "', \n\t\t\t\t\t\t\t\t\t\t localization = '" . htmlspecialchars($localization) . "',\n\t\t\t\t\t\t\t\t\t\t clinical_note = '" . htmlspecialchars($clinical_note) . "', \n\t\t\t\t\t\t\t\t\t\t extra_note = '" . htmlspecialchars($extra_note) . "', \n\t\t\t\t\t\t\t\t\t\t repeat_note = '" . htmlspecialchars($repeat_note) . "',\n\t\t\t\t\t\t\t\t\t\t gyn_last_period = '" . htmlspecialchars($gyn_last_period) . "', \n\t\t\t\t\t\t\t\t\t\t gyn_period_type = '" . htmlspecialchars($gyn_period_type) . "', \n\t\t\t\t\t\t\t\t\t\t gyn_gravida = '" . htmlspecialchars($gyn_gravida) . "',\n\t\t\t\t\t\t\t\t\t\t gyn_menopause_since = '" . htmlspecialchars($gyn_menopause_since) . "', \n\t\t\t\t\t\t\t\t\t\t gyn_hysterectomy = '" . htmlspecialchars($gyn_hysterectomy) . "',\n\t\t\t\t\t\t\t\t\t\t gyn_contraceptive = '" . htmlspecialchars($gyn_contraceptive) . "', \n\t\t\t\t\t\t\t\t\t\t gyn_iud = '" . htmlspecialchars($gyn_iud) . "', \n\t\t\t\t\t\t\t\t\t\t gyn_hormone_therapy = '" . htmlspecialchars($gyn_hormone_therapy) . "',\n\t\t\t\t\t\t\t\t\t\t doctor_sign = '" . htmlspecialchars($doctor_sign) . "', \n\t\t\t\t\t\t\t\t\t\t op_date = '" . formatDate2STD($op_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\t\t status = '" . $status . "', \n\t\t\t\t\t\t\t\t\t\t history = " . $enc_obj->ConcatHistory("Update: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\t\t\t\t\t modify_id = '" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\t\t modify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\t\t WHERE batch_nr = '" . $batch_nr . "'"; if ($ergebnis = $enc_obj->Transact($sql)) { //echo $sql; // Load the visual signalling functions include_once $root_path . 'include/inc_visual_signalling_fx.php'; // Set the visual signal setEventSignalColor($pn, SIGNAL_COLOR_DIAGNOSTICS_REQUEST); header("location:" . $root_path . "modules/laboratory/labor_test_request_aftersave.php" . URL_REDIRECT_APPEND . "&edit={$edit}&saved=update&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&batch_nr={$batch_nr}&noresize={$noresize}"); exit; } else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = ""; } break; // end of case 'save' /* If mode is edit, get the stored test request when its status is either "pending" or "draft"
// Get the last insert id $_POST['ref_notes_nr'] = $db->Insert_ID(); // Set the visual signal setEventSignalColor($pn, SIGNAL_COLOR_NURSE_REPORT, SIGNAL_COLOR_LEVEL_FULL); $saved = true; } else { $saved = false; echo "<p>{$report_obj->sql}{$LDDbNoSave}"; } } if ($dateput2 && $berichtput2 && $author2) { if (!$_POST['ref_notes_nr']) { $_POST['timeput'] = date('H:i:s'); } if ($dateput2) { $_POST['dateput2'] = formatDate2STD($dateput2, $date_format); } $_POST['berichtput2'] = deactivateHotHtml($berichtput2); if ($report_obj->saveEffectivityReport($_POST)) { // Set the visual signal setEventSignalColor($pn, SIGNAL_COLOR_NURSE_REPORT, SIGNAL_COLOR_LEVEL_FULL); $saved = true; } else { $saved = false; echo "<p>{$report_obj->sql}{$LDDbNoSave}"; } } if ($saved) { header("location:{$thisfile}?sid={$sid}&lang={$lang}&saved=1&pn={$pn}&station={$station}&edit={$edit}"); } } else {
require_once 'include/inc_timeframe.php'; /** * Getting the timeframe... */ $debug = FALSE; $PRINTOUT = FALSE; if (empty($_GET['printout'])) { if ($debug) { echo "no time value is set, we´re using now the current month<br>"; } $day = date("d", time()); $month = date("n", time()); $year = date("Y", time()); $start_timeframe = mktime(0, 0, 0, $month, $day, $year); $end_timeframe = mktime(23, 59, 59, $month, $day, $year); $admission = ""; if (isset($selected_date) && !empty($selected_date)) { $selected_date = @formatDate2STD($selected_date, $date_format); $f_date = strtotime($selected_date); $day = date("d", $f_date); $month = date("n", $f_date); $year = date("Y", $f_date); } $start_timeframe = mktime(0, 0, 0, $month, $day, $year); $end_timeframe = mktime(23, 59, 59, $month, $day, $year); $admission = $_POST['admission_id']; } else { $PRINTOUT = TRUE; } // end of if (empty($_GET['printout'])) require_once 'gui/gui_laboratory_revenue.php';
} else { $item = $core->postgre_Insert_ID($dbtable, 'item', $db->Insert_ID()); } } //echo $item; header("location: cafenews-edit-menu.php?sid={$sid}&lang={$lang}&mode=saveok&item={$item}&week={$week}&mday={$mday}&mmonth={$mmonth}&myear={$myear}"); exit; } else { echo "<p>" . $sql . "<p>{$LDDbNoSave}"; } break; default: if ($item) { $sql = "SELECT item, menu FROM {$dbtable} WHERE item='" . $item . "'"; } else { $sql = "SELECT item, menu FROM {$dbtable} WHERE cdate='" . formatDate2STD($myear . "-" . $mmonth . "-" . $mday, "yyyy-mm-dd") . "'"; if (defined('LANG_DEPENDENT') && LANG_DEPENDENT) { $sql .= "' AND lang='" . $lang . "'"; } } //echo $sql; if ($ergebnis = $db->Execute($sql)) { if ($rows = $ergebnis->RecordCount()) { $content = $ergebnis->FetchRow(); } } else { echo "<p>" . $sql . "<p>" . $LDDbNoRead; } } //end of switch } else {
} $TP_SELECT_BLOCK .= '</option>'; } $TP_SELECT_BLOCK .= '</select>'; $insurance_obj = new Insurance_tz(); #Load and create paginator object require_once $root_path . 'include/care_api_classes/class_tz_reporting.php'; /** * getting summary of OPD... */ $rep_obj = new selianreport(); //require_once('include/inc_timeframe.php'); /** * Getting the timeframe... */ $debug = FALSE; $PRINTOUT = FALSE; $EXPORT = FALSE; if (empty($_GET['printout']) && empty($_GET['export'])) { if (isset($_POST['date_from']) && !empty($_POST['date_from']) && isset($_POST['date_to']) && !empty($_POST['date_to'])) { $selected_date_from = @formatDate2STD($_POST['date_from'], $date_format); $selected_date_to = @formatDate2STD($_POST['date_to'], $date_format); } } if ($_GET['printout'] || isset($_GET['printout'])) { $PRINTOUT = TRUE; } if ($_GET['export'] || isset($_GET['export'])) { $EXPORT = TRUE; } require_once 'gui/gui_DetailedRevenue.php';
if (!isset($db) || !$db) { include_once $root_path . 'include/inc_db_makelink.php'; } if ($dblink_ok) { switch ($mode) { case 'create': $_POST['prescribe_date'] = @formatDate2STD($_POST['prescribe_date'], $date_format); $obj->setDataArray($_POST); if ($obj->insertDataFromInternalArray()) { header("location:" . $thisfile . URL_REDIRECT_APPEND . "&target={$target}&pid=" . $_SESSION['sess_pid']); exit; } else { echo "<br>{$LDDbNoSave}"; } break; case 'update': $_POST['date'] = @formatDate2STD($_POST['date'], $date_format); $obj->setDataArray($_POST); $obj->where = ' nr=' . $imm_nr; if ($obj->updateDataFromInternalArray($dept_nr)) { header("location:" . $thisfile . URL_REDIRECT_APPEND . "&target={$target}&pid=" . $_SESSION['sess_pid']); exit; } else { echo "{$sql}<br>{$LDDbNoUpdate}"; } break; } // end of switch } else { echo "{$LDDbNoLink}<br>"; }
if ($mode == 'paginate') { $sql2 = $_SESSION['sess_searchkey']; } else { # Reset paginator variables $pgx = 0; $totalcount = 0; $odir = 'ASC'; $oitem = 'name_last'; if (is_numeric($srcword)) { $srcword = (int) $srcword; } else { # Convert other wildcards $srcword = strtr($srcword, '*&', '%_'); } # Try converting keyword to DOB $DOB = formatDate2STD($srcword, $date_format); $select = "SELECT o.*,\n\t\t\t\t\t\t\t\te.encounter_class_nr,\n\t\t\t\t\t\t\t\tp.pid,\n\t\t\t\t\t\t\t\t p.name_last,\n\t\t\t\t\t\t\t\t p.name_first,\n\t\t\t\t\t\t\t\t p.date_birth,\n\t\t\t\t\t\t\t\t p.addr_str,\n\t\t\t\t\t\t\t\t p.addr_str_nr,\n\t\t\t\t\t\t\t\t p.sex,\n\t\t\t\t\t\t\t\t p.addr_zip,\n\t\t\t\t\t\t\t\t t.name AS citytown_name,\n\t\t\t\t\t\t\t\t d.name_formal,\n\t\t\t\t\t\t\t\t d.LD_var AS \"LD_var\" "; // Old mysql query /* $selectfrom.=" FROM ( care_encounter_op AS o, care_encounter AS e, care_person AS p ) LEFT JOIN care_address_citytown AS t ON t.nr=p.addr_citytown_nr LEFT JOIN care_department AS d ON d.nr= o.dept_nr"; */ $selectfrom = " FROM care_encounter_op AS o LEFT JOIN care_department AS d ON d.nr= o.dept_nr\n\t\t\t\t\t\t\t\t LEFT JOIN care_encounter AS e ON e.encounter_nr = o.encounter_nr\n\t\t\t\t\t\t\t\tLEFT JOIN care_person AS p ON p.pid = e.pid\n\t\t\t\t\t\t\t\tLEFT JOIN care_address_citytown AS t ON t.nr=p.addr_citytown_nr"; # If the search is directed to a single patient if ($mode == 'get' || $mode == 'getbypid' || $mode == 'getbyenc') { if ($mode == 'get') { $sql2 = $selectfrom . "\tWHERE o.nr='{$nr}'\n\t\t\t\t\t\t\t\tAND o.encounter_nr=e.encounter_nr\n\t\t\t\t\t\t\t\tAND e.pid=p.pid "; } elseif ($mode == 'getbypid') {
break; case 1: //credit $bill_type = 'billelem.insurance_id>0'; $bill_type_drugs = 'b.insurance_id>0'; $payment = 'CREDIT'; break; case 2: //all $bill_type = 'billelem.insurance_id>=0'; $bill_type_drugs = 'b.insurance_id>=0'; $payment = 'CASH and CREDIT'; break; } $selected_date_start = @formatDate2STD($dfrom, $date_format); $selected_date_end = @formatDate2STD($dto, $date_format); $f_date_start = strtotime($selected_date_start); $f_date_end = strtotime($selected_date_end); $day_start = date("d", $f_date_start); $month_start = date("n", $f_date_start); $year_start = date("Y", $f_date_start); $day_end = date("d", $f_date_end); $month_end = date("n", $f_date_end); $year_end = date("Y", $f_date_end); $start_timeframe = mktime(0, 0, 0, $month_start, $day_start, $year_start); $end_timeframe = mktime(23, 59, 59, $month_end, $day_end, $year_end); $sql_tmp_insurance_billing = "CREATE TEMPORARY TABLE money_collection_temp SELECT distinct billelem.amount,billelem.description,billelem.price,billelem.date_change,(billelem.amount * billelem.price) AS total_price,ctzpricelist.item_description,ctzpricelist.item_number,ctzpricelist.item_id,ctzpricelist.purchasing_class,ctzpricelist.item_full_description,billelem.insurance_id,ce.encounter_class_nr,billarchive.encounter_nr FROM care_person AS cp INNER JOIN care_encounter AS ce ON ce.pid=cp.pid INNER JOIN care_tz_billing_archive AS billarchive ON billarchive.encounter_nr=ce.encounter_nr INNER JOIN care_tz_billing_archive_elem AS billelem ON billarchive.nr=billelem.nr INNER JOIN care_tz_drugsandservices AS ctzpricelist ON ctzpricelist.item_description=billelem.description WHERE {$bill_type} AND billelem.date_change BETWEEN {$start_timeframe} AND {$end_timeframe}"; $sql_tmp_result = $db->Execute($sql_tmp_insurance_billing); if (!$sql_tmp_result) { echo 'ENTER DATE CLICK SHOW'; exit;