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


if($_POST['type']=="pickup_entry_delete"){
    
    $delete_id = $_POST['delete_id'];
    $category = "Pickup Entry - Delete";
    

    for($i=0; $i<count($delete_id); $i++){
        $id = $_POST['delete_id'][$i];
        
        $message = "Pickup Entry ID: $id - Deleted";
        
      
        

        
      $statement_1 = $pdo->prepare("DELETE FROM tbl_pickup_entry WHERE id=?");   
        $result_1 = $statement_1->execute(array($id));
        
        $statement_2 = $pdo->prepare("DELETE FROM tbl_tracking WHERE pickup_entry_id=?");   
        $result_2 = $statement_2->execute(array($id));
        
        $statement_3 = $pdo->prepare("DELETE FROM tbl_volumetrix_weight WHERE pickup_id=?");   
        $result_3 = $statement_3->execute(array($id));
        
        
}
    
    
  
    
    if($result_1 && $result_2 && $result_3){
	    $message='Success..';
	    $error='1';
	}else{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}
?>