98 lines
2.6 KiB
PHP
98 lines
2.6 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
$hyg_check_id = $_REQUEST['hyg_check_id'.$i];
|
|
$emp_id = $_POST['empName'];
|
|
// echo $hyg_check_id;
|
|
$checkup_date = $_POST['CheckupDate'];
|
|
//$checkup_date = date("Y-m-d h:mm A");
|
|
if(!empty($hyg_check_id)){
|
|
$query = "update emp_hyg_check_master set emp_id='$emp_id',checkup_date=STR_TO_DATE('".$_POST['CheckupDate']."','%d/%m/%Y %h:%i %p'),modified_by = '".$_SESSION['user_id']."' where hyg_check_id =
|
|
'".$hyg_check_id."'";
|
|
}
|
|
else {
|
|
$query = "insert into emp_hyg_check_master set emp_id='$emp_id',checkup_date=STR_TO_DATE('".$_POST['CheckupDate']."','%d/%m/%Y %h:%i %p') ,modified_by = '".$_SESSION['user_id']."' ";
|
|
|
|
|
|
|
|
}
|
|
//echo $query;
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
else{
|
|
|
|
|
|
$id=mysqli_insert_id();
|
|
if($id==0 or $id=='' or $id==null)
|
|
$id=$hyg_check_id;
|
|
|
|
|
|
}
|
|
|
|
$parameterRow=$_REQUEST['parameterRow'];
|
|
|
|
for($i=0;$i<$parameterRow;$i++){
|
|
$hyg_param=$_REQUEST['hygieneParameter'.$i];
|
|
$query_hygiene="select* from hygiene where hygiene_id=$hyg_param";
|
|
// echo $query_hygiene;
|
|
$result1=mysqli_query($conn,$query_hygiene);
|
|
$rowHygiene=mysqli_fetch_array($result1);
|
|
$currentValue=$_REQUEST['currentValue'.$i];
|
|
$human_min_range=$rowHygiene['human_min_range'];
|
|
$human_max_range=$rowHygiene['human_max_range'];
|
|
// echo $human_min_range;
|
|
// echo $human_max_range;
|
|
// echo $currentValue;
|
|
if($currentValue >= $human_min_range AND $currentValue <= $human_max_range )
|
|
{
|
|
|
|
$is_abnormal='N';
|
|
}
|
|
else{
|
|
|
|
$is_abnormal='Y';
|
|
}
|
|
|
|
|
|
// echo $_REQUEST['outOfRange'.$i];
|
|
$intial_hyg_parameter="";
|
|
$end_hyg_parameter="";
|
|
if(isset($_REQUEST['hygieneParameter'.$i])){
|
|
$query_for_hyg_parameter=" set hyg_para_id='".$_REQUEST['hygieneParameter'.$i]."',hyg_param_val='".$_REQUEST['currentValue'.$i]."',is_abnormal= '$is_abnormal',hyg_check_id='$id' ,modified_by = '".$_SESSION['user_id']."' ";
|
|
|
|
|
|
|
|
// echo $query_for_range;
|
|
|
|
if(isset($_REQUEST['parameter_record_id'.$i])){
|
|
$intial_hyg_parameter="update emp_hyg_check_items";
|
|
|
|
|
|
$end_hyg_parameter=" where id='".$_REQUEST['parameter_record_id'.$i]."'";
|
|
}else{
|
|
$intial_hyg_parameter="insert into emp_hyg_check_items";
|
|
|
|
|
|
$end_hyg_parameter="";
|
|
}
|
|
$final_hyg_parameter=$intial_hyg_parameter.$query_for_hyg_parameter.$end_hyg_parameter;
|
|
|
|
// echo $final_hyg_parameter;
|
|
// echo $final_hyg_parameter;
|
|
|
|
@mysqli_query($conn,$final_hyg_parameter);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
if($data==null)
|
|
{
|
|
$data['status'] = 200;
|
|
$data['message'] = "Data not found!";
|
|
}
|
|
echo json_encode($data);
|
|
?>
|