ESH/save_inventory_parameters_status.php
2024-10-23 18:28:06 +05:30

58 lines
2.4 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,'inventory parameters','SAVE','save_inventory_parameters.php');
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
begin();
$param_year= $_POST['param_year'];
$param_month= $_POST['param_month'];
$issue_type=$_POST['issue_type'];
$amb_id=$_POST['amb_id'];
$shift=$_POST['shift'];
$item_cat=$_POST['item_cat'];
$status=$_POST['status'];
$end_query='';
if($_SESSION ['RoleCode']=='DOC'){
$select_query= "select checker_user_id from inventory_checklist_status where param_year='$param_year' and param_month='$param_month' and issue_type='$issue_type' and amb_id='$amb_id' and shift='$shift' and ohc_type_id = '".$_SESSION['current_ohcttype']."' ";
$result_select = @mysqli_query($conn, $select_query);
$row_select= mysqli_fetch_array($result_select);
$checker_id=$row_select["checker_user_id"];
$end_query.=",checker_user_id='$checker_id',approver_user_id='".$_SESSION['user_id']."'";
}else{
$end_query.=",checker_user_id='".$_SESSION['user_id']."'";
}
if(!empty($status)){
$sql_del = "delete from inventory_checklist_status where param_year='$param_year' and param_month='$param_month' and issue_type='$issue_type' and amb_id='$amb_id' and ohc_type_id = '".$_SESSION['current_ohcttype']."' and shift='$shift'";
// error_log("inventory_checklist_status_delet ".$sql_del);
mysqli_query($conn,$sql_del);
}
$query="insert into inventory_checklist_status set approve_date=now(),status='$status', param_year='$param_year' , param_month='$param_month' ,issue_type='$issue_type' , amb_id='$amb_id' , item_cat='$item_cat' , ohc_type_id = '".$_SESSION['current_ohcttype']."',modified_by = '".$_SESSION['user_id']."',shift='$shift' $end_query";
error_log("inventory_checklist_status insert:-".$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();
?>