ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/data-tables/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/data-tables/manifest_dt.php

<?php
include("../inc/config.php");
// $clientType=$_REQUEST['client_type'];
// $clientId=$_REQUEST['client_id'];
// $from=$_REQUEST['from'];
// $status=$_REQUEST['status'];
// $to=$_REQUEST['to'];

/*$clientType="Admin";
$clientId=28;*/
     
     
$requestData= $_REQUEST;


/*Fetch Database column Details*/
        $columns = array( 
            0 =>'manifest_id', 
            1 =>'awb_no', 
            2 =>'origin',
            3 =>'destination',
            4 =>'entry_date',
            5 =>'transport_name',
            6 =>'sending_through',
            7 =>'no_of_entry',
            8 =>'id'
        );
        
/*Fetch All Data Start*/        
        
    	$statement = $pdo->prepare("SELECT * FROM manifest ORDER BY id DESC");
		$statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalData = $statement->rowCount();
        $totalFiltered = $totalData;
/*Fetch All Data End*/       
        
/*Fetch Filter Data Start*/    
         $sql="SELECT * FROM manifest";
         
        if( !empty($requestData['search']['value']) ) 
        {   
        	$sql.=" AND ( manifest_id LIKE '%".$requestData['search']['value']."%' ";    
        	$sql.=" OR origin LIKE '%".$requestData['search']['value']."%' ";    
        	$sql.=" OR destination LIKE '%".$requestData['search']['value']."%' ";
        	$sql.=" OR entry_date LIKE '%".$requestData['search']['value']."%' ";
        	$sql.=" OR sending_through LIKE '%".$requestData['search']['value']."%' ) ";
        	}
        	 
       $statement = $pdo->prepare($sql);
        $statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);
        $totalFiltered = $statement->rowCount();
        
/*Fetch Filter Data End*/       
        


         $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]."   ".$requestData['order'][0]['dir']."  LIMIT ".$requestData['start']." ,".$requestData['length']."   ";
        //  $requestData['order'][0]['column'] contains colmun index, $requestData['order'][0]['dir'] contains order such as asc/desc  */	
        $statement = $pdo->prepare($sql);
        $statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);

$data = array();
$i=$requestData['start']+1;
foreach( $query as $row ) {  // preparing an array
	$nestedData=array(); 
 	$nestedData[] = $i;
	$nestedData[] = $row["manifest_id"];
	 if($row['ref_no']!=''){ $manifest= $row['manifest_id'];}else{ $manifest= 'N/A';} 
	$nestedData[] =$manifest;
	$nestedData[] = $row["origin"];
	$nestedData[] = $row["destination"];
	$day=date_create($row['entry_date']);
	$created=date_format($day,'d-m-Y');
	$nestedData[] =$created;
	$nestedData[] = $row["transport_name"];
	if($row['sending_through']=='air'){ $send= 'AIR';}if($row['sending_through']=='road'){ $send='ROAD';}
	$nestedData[] = $send;
	$nestedData[] = $row["no_of_entry"];
	$nestedData[] = "<a href='manifest-pickup-entry.php?id=".$row['id']."' class='btn btn-primary btn-xs'>View</a>&emsp;<a href='manifest-update-status.php?id=".$row['id']."&manifest_id=".$row['manifest_id']."' class='btn btn-success btn-xs'>Update Status</a>";
	$data[] = $nestedData;
	$i++;
}

$json_data = array(
			"draw"            => intval( $requestData['draw'] ),   // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. 
			"recordsTotal"    => intval( $totalData ),  // total number of records
			"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
			"data"            => $data   // total data array
			);

echo json_encode($json_data);  // send data as json format

?>

Zerion Mini Shell 1.0