$sql_buf = ''; /* prepare the rose_x part sql query */ for ($i = 1; $i < 25; $i++) { $buf = 'rose_' . $i; $sql_buf .= $buf . " ='" . ${$buf} . "', "; } /* prepare the green_x part */ for ($i = 1; $i < 8; $i++) { $buf = 'green_' . $i; $sql_buf .= $buf . "='" . ${$buf} . "', "; } /* append the additional color event signallers */ $sql_buf .= "yellow='{$yellow}', black='{$black}', blue_pale='{$blue_pale}', brown='{$brown}',\n\t\t\t\t\t\t pink='{$pink}', yellow_pale='{$yellow_pale}', red='{$red}', green_pale='{$green_pale}',\n\t\t\t\t\t\t\t\t\t\t violet='{$violet}', blue='{$blue}', biege='{$biege}', orange='{$orange}'"; $sql = "UPDATE {$event_table} SET {$sql_buf} WHERE encounter_nr='{$pn}'"; // echo $sql; if ($event_result = $enc_obj->Transact($sql)) { if (!$db->Affected_Rows()) { /* If entry not yet existing, insert data */ /* prepare the rose_x part sql query */ $set_str = ''; $sql_buf = ''; for ($i = 1; $i < 25; $i++) { $buf = 'rose_' . $i; $set_str .= $buf . ', '; $sql_buf .= "'" . ${$buf} . "', "; } /* prepare the green_x part */ for ($i = 1; $i < 8; $i++) { $buf = 'green_' . $i; $set_str .= $buf . ', '; $sql_buf .= "'" . ${$buf} . "', ";
//echo $encounter_obj->getLastQuery(); // Add to table presciptions the registration fee's comming from admission seciton... if ($registration_fee != '') { $bill_obj->new_reg($encounter_nr, $registration_fee, $user); } if ($consultation_fee != '') { $bill_obj->new_reg($encounter_nr, $consultation_fee, $user); } if (isset($transFromOutp)) { global $pn; $enc_new = $_POST['encounter_nr']; $encounter_obj->sql_ = "UPDATE care_encounter SET encounter_nr_prev='{$pn}' where encounter_nr='{$enc_new}'"; //$encounter_obj->sql_old="UPDATE care_encounter SET is_discharged='1', discharge_date='$date', discharge_time='$time' where encounter_nr='$pn'"; //echo $encounter_obj->sql_; //if ($encounter_obj->Transact($encounter_obj->sql_)&&$encounter_obj->Transact($encounter_obj->sql_old)) if ($encounter_obj->Transact($encounter_obj->sql_)) { //echo 'transact erfolgreich'; echo '<script language="javascript">'; echo 'function closeWindow(){'; echo 'window.close();'; echo '}'; echo 'closeWindow();'; echo '</script>'; } else { echo 'problem occured at aufnahme_start.php: ' . $encounter_obj->sql_ . ' and/or ' . $encounter_obj->sql_old; } } // Show the admission data: header("location: aufnahme_daten_zeigen.php" . URL_REDIRECT_APPEND . "&encounter_nr={$encounter_nr}&origin=admit&target=entry&newdata={$newdata}"); exit; } else {
if ($enc_obj->is_loaded) { $result =& $enc_obj->encounter; } } else { $edit = 0; $mode = ''; $pn = ''; } } if (!isset($mode)) { $mode = ''; } switch ($mode) { case 'save': $sql = "INSERT INTO care_test_request_" . $db_request_table . " \n\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t batch_nr, encounter_nr, dept_nr, quick_cut, \n\t\t\t\t\t\t\t\t\t\t qc_phone, quick_diagnosis, qd_phone, material_type, \n\t\t\t\t\t\t\t\t\t\t material_desc, localization, clinical_note, extra_note, \n\t\t\t\t\t\t\t\t\t\t repeat_note, gyn_last_period, gyn_period_type, \n\t\t\t\t\t\t\t\t\t\t gyn_gravida, gyn_menopause_since, \n\t\t\t\t\t\t\t\t\t\t gyn_hysterectomy, gyn_contraceptive, \n\t\t\t\t\t\t\t\t\t\t gyn_iud, gyn_hormone_therapy, \n\t\t\t\t\t\t\t\t\t\t doctor_sign, op_date, send_date,\n\t\t\t\t\t\t\t\t\t\t status, history, create_id, create_time)\n\t\t\t\t\t\t\t\t\t\t VALUES \n\t\t\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t '" . $batch_nr . "','" . $pn . "','" . $dept_nr . "', '" . $quick_cut . "', \n\t\t\t\t\t\t\t\t\t\t '" . $qc_phone . "', '" . $quick_diagnosis . "', '" . $qd_phone . "', '" . $material_type . "', \n\t\t\t\t\t\t\t\t\t\t '" . addslashes(htmlspecialchars($material_desc)) . "', '" . addslashes(htmlspecialchars($localization)) . "', '" . addslashes(htmlspecialchars($clinical_note)) . "', '" . addslashes(htmlspecialchars($extra_note)) . "', \n\t\t\t\t\t\t\t\t\t\t '" . addslashes(htmlspecialchars($repeat_note)) . "', '" . addslashes($gyn_last_period) . "', '" . addslashes($gyn_period_type) . "', \n\t\t\t\t\t\t\t\t\t\t '" . addslashes($gyn_gravida) . "', '" . addslashes($gyn_menopause_since) . "', \n\t\t\t\t\t\t\t\t\t\t '" . addslashes($gyn_hysterectomy) . "', '" . addslashes($gyn_contraceptive) . "', \n\t\t\t\t\t\t\t\t\t\t '" . addslashes($gyn_iud) . "', '" . addslashes($gyn_hormone_therapy) . "', \n\t\t\t\t\t\t\t\t\t\t '" . addslashes($doctor_sign) . "', '" . formatDate2Std($op_date, $date_format) . "', '" . date('Y-m-d H:i:s') . "',\n\t\t\t\t\t\t\t\t\t\t '" . $status . "',\n\t\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\t '" . $_SESSION['sess_user_name'] . "', '" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\t\t )"; 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=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':
if ($editable_rows = $ergebnis->RecordCount()) { $stored_request = $ergebnis->FetchRow(); $edit_form = 1; } } else { echo "<p>{$sql}<p>{$LDDbNoRead}"; } } } if (!isset($mode) && $batch_nr && $pn) { $mode = "edit"; } switch ($mode) { case 'save': $sql = "INSERT INTO care_test_findings_" . $db_request_table . "\n\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t batch_nr, encounter_nr, dept_nr,\n\t\t\t\t\t\t\t\t\t\t material, macro,\n\t\t\t\t\t\t\t\t\t\t micro, findings, diagnosis,\n\t\t\t\t\t\t\t\t\t\t doctor_id, findings_date, findings_time,\n\t\t\t\t\t\t\t\t\t\t status, history, \n\t\t\t\t\t\t\t\t\t\t create_id, create_time)\n\t\t\t\t\t\t\t\t\t\t VALUES\n\t\t\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t '" . $batch_nr . "','" . $pn . "','" . $dept_nr . "',\n\t\t\t\t\t\t\t\t\t\t '" . addslashes(htmlspecialchars($material)) . "','" . addslashes(htmlspecialchars($macro)) . "',\n\t\t\t\t\t\t\t\t\t\t '" . addslashes(htmlspecialchars($micro)) . "','" . addslashes(htmlspecialchars($findings)) . "','" . addslashes(htmlspecialchars($diagnosis)) . "',\n\t\t\t\t\t\t\t\t\t\t '" . addslashes($doctor_id) . "', '" . formatDate2Std($findings_date, $date_format) . "', '" . date('H:i:s') . "',\n\t\t\t\t\t\t\t\t\t\t 'initial', 'Create: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['sess_user_name'] . "', \n\t\t\t\t\t\t\t\t\t\t\t'" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\t\t )"; if ($ergebnis = $enc_obj->Transact($sql)) { signalNewDiagnosticsReportEvent($findings_date); //echo $sql; header("location:{$thisfile}" . URL_REDIRECT_APPEND . "&edit={$edit}&saved=insert&mode=edit&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&subtarget={$subtarget}&noresize={$noresize}&batch_nr={$batch_nr}&entry_date={$entry_date}"); exit; } else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = ""; } break; // end of case 'save' case 'update': $sql = "UPDATE care_test_findings_" . $db_request_table . " SET\n\t\t\t\t\t\t\t\t\t\t material='" . addslashes(htmlspecialchars($material)) . "', macro='" . addslashes(htmlspecialchars($macro)) . "',\n\t\t\t\t\t\t\t\t\t\t micro='" . addslashes(htmlspecialchars($micro)) . "', findings='" . addslashes(htmlspecialchars($findings)) . "',\n\t\t\t\t\t\t\t\t\t\t diagnosis='" . addslashes(htmlspecialchars($diagnosis)) . "',\n\t\t\t\t\t\t\t\t\t\t doctor_id='" . addslashes($doctor_id) . "', findings_date='" . formatDate2Std($findings_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\t\t findings_time='" . date('H:i:s') . "',\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)) { signalNewDiagnosticsReportEvent($findings_date); //echo $sql;