<?php
require_once "config.php";
$quotation_no=$_POST['quotation_no'];
$sql="select * from quotation_details where quotation_no='".$quotation_no."'";
$query=mysqli_query($con,$sql);
$data=array();
if($result=mysqli_fetch_array($query,MYSQLI_ASSOC)){
	if(is_null($result['freight'])){
		$result['freight']=0;
	}
	if(!is_numeric($result['freight'])){
		$result['freight']=0;
	}

$result['freight']=$result['freight']+($result['freight']*(18/100));

   array_push($data,$result) ;
    
}

$sql="select * from quotation_details_all where quotation_no='".$quotation_no."'";
$query=mysqli_query($con,$sql);
$data1=array();
while($result=mysqli_fetch_array($query,MYSQLI_ASSOC)){
   array_push($data1,$result) ;
    
}
$dir = 'downloads/';
chown($dir,0777);

foreach(glob($dir.'*.*') as $v){
    unlink($v);
}


echo json_encode(
        array(
            "data"=>$data,
             "production"=>$data1,
        )
        );

//require_once "config.php";
//$con->autocommit(FALSE);
//$sql="select * from quotation_no_table";
//$query=mysqli_query($con,$sql);
//if($result=mysqli_fetch_array($query)){
//    $sql1="update quotation_no_table set quotation_no=quotation_no+1";
//    $query1=mysqli_query($con,$sql1);
//    echo "AMUL-".$result['quotation_no'];
//}
//$con->commit();
//$con->close();