/* 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;
         }
                    //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) {
     include_once $root_path . 'include/inc_date_format_functions.php';
     $_POST['date'] = @formatDate2STD($_POST['date'], $date_format);
     $sBufDate = (int) str_replace('-', '', $_POST['date']);
     $sBufToday = (int) date('Ymd');
     $sBufDate = $sBufDate - $sBufToday;
     #
     # If date in the past, force mode to "select" and erase date data
     #
     if ($sBufDate < 0) {
         $bPastDateError = TRUE;
         $mode = 'select';
         $date = '';
     }
 }
 if ($mode == 'create' || $mode == 'update') {
     $_POST['time'] = @convertTimeToStandard($_POST['time']);
     if ($mode == 'update') {
         if (!isset($_POST['remind_mail'])) {
             $_POST['remind_mail'] = '0';
         }
         if (!isset($_POST['remind_email'])) {
             $_POST['remind_email'] = '0';
         }
         if (!isset($_POST['remind_phone'])) {
             $_POST['remind_phone'] = '0';
         }
         $_POST['modify_id'] = $_SESSION['sess_user_name'];
         $_POST['modify_time'] = date('YmdHis');
         $_POST['history'] = $obj->ConcatHistory("Update: " . date('Y-m-d H:i:s') . " : " . $_SESSION['sess_user_name'] . "\n");
     } else {
         $_POST['appt_status'] = 'pending';
Exemple #4
0
} elseif ($mode == 'newdata') {
    include_once $root_path . 'include/inc_date_format_functions.php';
    $saved = FALSE;
    # Prepare additional info saving
    $_POST['modify_id'] = $_SESSION['sess_user_name'];
    $_POST['modify_time'] = date('YmdHis');
    # Create own timestamp for cross db compatibility
    if (empty($_POST['delivery_date'])) {
        $_POST['delivery_date'] = date('Y-m-d');
    } else {
        $_POST['delivery_date'] = @formatDate2STD($_POST['delivery_date'], $date_format);
    }
    if (empty($_POST['delivery_time'])) {
        $_POST['delivery_time'] = date('H:i:s');
    } else {
        $_POST['delivery_time'] = @convertTimeToStandard($_POST['delivery_time']);
    }
    //if(empty($_POST['blood_loss'])) $_POST['blood_loss_unit']=0;
    if ($allow_update) {
        $obj->setWhereCondition('nr=' . $_POST['rec_nr']);
        $obj->setDataArray($_POST);
        if ($obj->updateDataFromInternalArray($_POST['rec_nr'])) {
            $saved = true;
        } else {
            echo $obj->getLastQuery() . "<br>{$LDDbNoUpdate}";
        }
    } else {
        # Deactivate the old record first if exists
        if (isset($rec_nr) && $rec_nr) {
            $obj->deactivatePregnancy($_POST['rec_nr']);
        }