<?php 
ob_start();
session_start();
include("../inc/config.php");


if(isset($_POST['type']) && $_POST['type']=='pickup_entry_info'){
    
    $id=$_POST['pickup_entry_id'];
    if(isset($_POST['pickup_status']) && $_POST['pickup_status']=="delivery_run_sheet"){
        $drs_pickup_status = $_POST['pickup_status'];
    }
    
    $statement = $pdo->prepare("SELECT * FROM pickup_entry where id='".$id."' limit 1");
    $statement->execute();
    $_data = $statement->fetchAll(PDO::FETCH_ASSOC);
    $totalData = $statement->rowCount();
    $conditions="1=1";
    
    
    if($totalData){
        
        $data='';
     $destin='';   
        foreach($_data as $d){
            $data="<tr id='pic_".$d['id']."'>
				    <td class='delete' style='text-align:center;' onclick='remove(".$d['id'].")' ><i class='fa fa-trash'></i></td>
				    <td><i class='fa fa-barcode' style='font-size:12px;color:blue'></i><b style='font-weight:800;'> ".$d['cscs_awb']."</b></td>
				    <td><i class='fa fa-dropbox'></i> <span class='no_of_box'>".$d['boxes']."</span></td>
				    <td><i class='fa fa-inr'></i> <span class='no_of_box'>".$d['order_type']."</span></td>
				    <td>".date("d-m-Y", strtotime($d['created_at']))."</td>
				    <td>".strtoupper($d['status'])."</td>
				    <td><span class='a_wt'>".$d['a_weight']."</a></td>
				    <td>".$d['client_id']."</td>
				    <td>".$d['shipper_name']."</td>
				    <td><b style='font-weight:800;'>".$d['consignee_name']."</b></td>
				    <td>".$d['shipper_state']." => ".$d['shipper_city']." - ".$d['shipper_pincode'].".</td>
				    <td>".$d['consignee_state']." => ".$d['consignee_city']." - ".$d['consignee_pincode'].".</td>
				</tr>";
					$destin = $d['consignee_city'];
        }

        $response['destination']=$destin;
        $response['error']=false;
        $response['data']=$data;
        $response['message']="shipment details fetched";
    }else{
        $response['error']=true;
        $response['message']="no data found";
    }
    print_r(json_encode($response));
}


?>