$_POST['modify_id'] = $encoder;
 //$_POST['modify_time']='NULL';
 $_POST['create_id'] = $encoder;
 $_POST['create_time'] = date('YmdHis');
 $_POST['history'] = 'Create: ' . date('Y-m-d H:i:s') . ' = ' . $encoder;
 if (isset($_POST['encounter_nr'])) {
     unset($_POST['encounter_nr']);
 }
 //print_r($_POST);
 $encounter_obj->setDataArray($_POST);
 if ($encounter_obj->insertDataFromInternalArray()) {
     /* Get last insert id */
     if ($dbtype == 'mysql' || $dbtype == 'mysqli') {
         $encounter_nr = $db->Insert_ID();
     } else {
         $encounter_nr = $encounter_obj->postgre_Insert_ID($dbtable, 'encounter_nr', $db->Insert_ID());
     }
     // end of if($dbtype=='mysql')
     if ($is_transmit_to_weberp_enable == 1) {
         //											$weberp_obj = new weberp($webERPServerURL,$weberpuser,$weberppassword,$weberpDebugLevel);
         //											$weberp_obj->make_patient_workorder_in_webERP($encounter_nr);
     }
     $encounter_obj->assignInDept($encounter_nr, $current_dept_nr, $current_dept_nr);
     # If appointment number available, mark appointment as "done"
     if (isset($appt_nr) && $appt_nr) {
         $encounter_obj->markAppointmentDone($appt_nr, $_POST['encounter_class_nr'], $encounter_nr);
     }
     //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);