65 lines
1.8 KiB
PHP
65 lines
1.8 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,'Shift Details','SAVE','save_shift_details.php');
|
|
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
|
|
begin();
|
|
$noOfRows=$_POST['count_items'];
|
|
$last_day=$_POST['last_day'];
|
|
|
|
|
|
|
|
for($i=1;$i<=$noOfRows;$i++){
|
|
$shift_id=$_POST['shift_id'.$i];
|
|
|
|
$emp_id_ctr=$_POST['emp_id'.$i];
|
|
|
|
error_log("employee idi :".$emp_id_ctr);
|
|
error_log(" value of i:".$i);
|
|
|
|
for($k=1;$k<=$last_day; $k++){
|
|
error_log(" value of k:".$k);
|
|
$shift_status= implode(',',$_POST['shift_status_'.$i."_".$k]);
|
|
error_log("last_day:".$last_day);
|
|
error_log("shift_status:".$shift_status);
|
|
|
|
|
|
$query_initial="";
|
|
$endquery="";
|
|
if(!empty($shift_id)){
|
|
$sql_del = "delete from shift_details where shift_id='$shift_id'";
|
|
mysqli_query($conn,$sql_del);
|
|
}
|
|
|
|
//$query_initial="insert into ";
|
|
// $endquery="";
|
|
|
|
if( $_POST['shift_status_'.$i."_".$k]!=''){
|
|
|
|
$query="insert into shift_details set shift_date=STR_TO_DATE('".${"shift_date_".$i."_".$k}."','%d-%m-%Y'), emp_id='".$emp_id_ctr."',
|
|
shift_status='".$shift_status."',ohc_type_id = '".$_SESSION['current_ohcttype']."' ,modified_by = '".$_SESSION['user_id']."' ".$endquery;
|
|
error_log("shifting query details".$query);
|
|
//echo $query;
|
|
|
|
if (!$result = mysqli_query($conn,$query)) {
|
|
error_log ( "Exception:" . mysqli_error($conn) );
|
|
error_log ( "Failed to Execute the Personal info Query::: " . $query );
|
|
rollback();
|
|
exit(mysqli_error($conn));
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
commit();
|
|
?>
|
|
|