<?php

require_once __DIR__ . '/db_config.php';

$r = array();

if (isset($_POST["report_id"]) ) {
 
$report_id=$_POST["report_id"];
$cname=$_POST["cname"];
$user_id=$_POST["user_id"];
date_default_timezone_set("Asia/Calcutta");   //India time (GMT+5:30)
$datetime=date('Y-m-d H:i:s');
$bearer=$_POST["bearer"];

$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());

$query="UPDATE defect_report 
    SET bearer='$bearer',bearer_DT='$datetime',bearer_user_id='$user_id',bearer_DT='$datetime',
    bill_approval=1,bill_approval_user_id='$user_id',bill_approval_DT='$datetime'
    WHERE report_id='$report_id' AND companyname='$cname'";


    $result=mysqli_query($con,$query);
    if($result){
        $r["s"] = 1;
    }else{
        $r["s"] = 0;
    }

mysqli_close($con);

}

echo json_encode($r,JSON_UNESCAPED_SLASHES);


?>