159 lines
5.9 KiB
PHP
159 lines
5.9 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
include ('log_entry.php');
|
|
error_log ( "Start Printing Request Attributes" );
|
|
$requestStr="";
|
|
foreach ( $_REQUEST as $key => $value ) {
|
|
$requestStr.=$key . " : " . $value . "\n";
|
|
error_log ( $key . " : " . $value . "<br />\r\n" );
|
|
}
|
|
error_log ( "End Printing Request Attributes" );
|
|
save_log($requestStr,'Sickness','SAVE','save_sickness_form.php');
|
|
error_reporting(0);
|
|
// error_log("Request sickness_id id :".$_REQUEST['id']);
|
|
// error_log("Request sickness_id sickness_id p:".$_POST['sickness_id']);
|
|
// $id = ($_REQUEST['id']!=''?$_REQUEST['id']:$_REQUEST['sickness_id']);
|
|
|
|
if(isset($_REQUEST['sickness_id'])){
|
|
$id = $_REQUEST['sickness_id'];
|
|
}else{
|
|
$id = $_REQUEST['flex_sickness_id'];
|
|
}
|
|
error_log("Request sickness_id:".$id);
|
|
|
|
|
|
if(isset($_REQUEST['sickness_id'])){
|
|
$emp_id = $_REQUEST['emp_id'];
|
|
}else{
|
|
$emp_id = $_REQUEST['flex_opd_id'];
|
|
}
|
|
|
|
if(!isset($id)){
|
|
$query = "SELECT sickness_id FROM sickness where emp_id='" . addslashes($_REQUEST['emp_id']) . "' and DATE(NOW()) = DATE(sickness_date) ";
|
|
error_log($query);
|
|
$result = @mysqli_query($conn,$query);
|
|
while( $row = mysqli_fetch_assoc($result)){
|
|
$id=$row['sickness_id'];
|
|
}
|
|
}
|
|
error_log("sickness_id:".$id);
|
|
//echo $emp_id;
|
|
$sickness_date=$_POST['sickness_date'];
|
|
$token_no=$_POST['token_no'];
|
|
|
|
$from_date=$_POST['from_date'];
|
|
$to_date=$_POST['to_date'];
|
|
$date_absent=$_POST['date_absent'];
|
|
$date_absent_to=$_POST['date_absent_to'];
|
|
$date_return=$_POST['date_return'];
|
|
$agency=$_POST['agency'];
|
|
$ailment=$_POST['ailment'];
|
|
$des=$_POST['des'];
|
|
$attended_status=$_POST['attendedStatus'];
|
|
$fitness_status=$_POST['approval_status'];
|
|
$ticket_no=$_POST['ticket_no'];
|
|
$comments=$_POST['remarks'];
|
|
$ref_no = $_POST['doc_ref_no'];
|
|
$des_dis = $_POST['des_dis'];
|
|
$des_sick = $_POST['des_sick'];
|
|
$des_future = $_POST['des_future'];
|
|
|
|
$followup_to_opd=$_POST['followup_to_opd'];
|
|
$justifiable_from=$_POST['justifiable_from'];
|
|
$justifiable_to=$_POST['justifiable_to'];
|
|
$date_just_from=$_POST['date_absents'];
|
|
$date_justifiable_to=$_POST['date_returns'];
|
|
$date_not_just=$_POST['date_not_just'];
|
|
$date_not_just_to=$_POST['date_not_just_to'];
|
|
$approval_date=$_POST['approval_date'];
|
|
// error_reporting(E_ERROR | E_PARSE);
|
|
$height = $_POST['height'];
|
|
$weight = $_POST['weight'];
|
|
$pulse = $_POST['pulse'];
|
|
$blood_group = $_POST['blood_group'];
|
|
$nose = $_POST['nose'];
|
|
$throat = $_POST['throat'];
|
|
$rs = $_POST['rs'];
|
|
$cvs = $_POST['cvs'];
|
|
$ch_uex = $_POST['ch_uex'];
|
|
$ch_ex = $_POST['ch_ex'];
|
|
$bp = $_POST['bp'];
|
|
$cns = $_POST['cns'];
|
|
$purpose = $_POST['purpose'];
|
|
$certificate_type = $_POST['certificate_type'];
|
|
error_log($nose . " NOSE ");
|
|
$ailment_ids_new = strtoupper($_POST['ailment_new']);
|
|
|
|
$ailment_ids_new = handleDynamicMasterInsert("ailment","ailment_name","ailment_id",$ailment_ids_new,true);
|
|
$ailment_ids_new = getMultiValuedSelectData($ailment_ids_new);
|
|
|
|
$ailment_system = strtoupper($_POST['ailment_system_new']);
|
|
//$ailment_name = implode(',',$_POST['ailmentD']);
|
|
|
|
|
|
$attended_doctor =null;
|
|
if($_SESSION['RoleCode'] =="DOC"){
|
|
$attended_doctor=$_SESSION['logged_user_empid'];
|
|
|
|
}
|
|
|
|
$query_initial ="";
|
|
$query_end=" ";
|
|
|
|
$query=" set ailment_system='". addslashes($ailment_system) ."',ailment_name='". addslashes($ailment_ids_new) ."',sickness_date = STR_TO_DATE('".$sickness_date."', '%d/%m/%Y %h:%i %p'), from_date = STR_TO_DATE('".$from_date."', '%d/%m/%Y'),
|
|
to_date = STR_TO_DATE('".$to_date."', '%d/%m/%Y'), date_absent = STR_TO_DATE('".$date_absent."', '%d/%m/%Y'),date_absent_to = STR_TO_DATE('".$date_absent_to."', '%d/%m/%Y'),
|
|
date_return = STR_TO_DATE('".$date_return."', '%d/%m/%Y'), justifiable_from = STR_TO_DATE('".$justifiable_from."', '%d/%m/%Y'),justifiable_to = STR_TO_DATE('".$justifiable_to."', '%d/%m/%Y'),
|
|
not_justifiable_from = STR_TO_DATE('".$date_not_just."', '%d/%m/%Y'),not_justifiable_to = STR_TO_DATE('".$date_not_just_to."', '%d/%m/%Y'),agency = '$agency',sickness_name='$ailment_system',des='$des' , emp_id='".$emp_id."',doctor_reference_no = '$ref_no',des_dis='$des_dis',des_sick='$des_sick',des_future='$des_future',
|
|
ohc_type_id='".$_SESSION['current_ohcttype']."',doctor_last_attended='$attended_doctor',attended_status='$attended_status',approval_date= STR_TO_DATE('".$approval_date."', '%d/%m/%Y'),followup_to_opd='$followup_to_opd',
|
|
fitness_status='$fitness_status',comments='".addslashes($comments)."',token_no='$token_no',ticket_no='$ticket_no', modified_by='" . $_SESSION['user_id'] . "' , height = '$height' , weight = '$weight' , pulse = '$pulse' , chest_ex = '$ch_ex',chest_uex='$ch_uex', rs = '$rs' , cvs = '$cvs', bp ='$bp' , throat = '$throat' , blood = '$blood_group' , nose = '$nose' , cns = '$cns' , purpose = '$purpose' , certificate_type='$certificate_type' ";
|
|
|
|
error_log("dskgsnhg".$query);
|
|
|
|
|
|
|
|
if(!empty($id)){
|
|
$query_initial = " update sickness ";
|
|
$query_end=" where sickness_id =$id";
|
|
} else{
|
|
$query_initial = "insert into sickness ";
|
|
|
|
}
|
|
$query =$query_initial." ".$query." ".$query_end;
|
|
|
|
error_log("query: ".$query);
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(error_log(mysqli_error($conn)));
|
|
}
|
|
|
|
$data = array();
|
|
if(isset($id)){
|
|
$data=$id;
|
|
}else {
|
|
$result = @mysqli_query($conn,"select max(sickness_id) from sickness");
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
$data = $row['sickness_id'];
|
|
}
|
|
}
|
|
if (empty($id)) {
|
|
$query = "select max(sickness_id) sickness_id from sickness where emp_id = '" . addslashes($_REQUEST['emp_id']) . "' ";
|
|
// echo $query;
|
|
error_log("query: ".$query);
|
|
if (! $result = @mysqli_query($conn,$query)) {
|
|
exit(error_log(mysqli_error($conn)));
|
|
}
|
|
if (mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
$data[0] = $row;
|
|
// $sickness_id = $row['sickness_id'];
|
|
}
|
|
}
|
|
} else {
|
|
|
|
$data['sickness_id'] =$_REQUEST['sickness_id'];
|
|
}
|
|
|
|
//echo $query;
|
|
// error_log("data: ".print_r($data, true));
|
|
echo json_encode($data);
|
|
?>
|