ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/data-tables/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/data-tables/pod-dt.php

<?php
session_start();
include("../inc/config.php");
ini_set('memory_limit', '1024M');
    $from = $_REQUEST['from'];
    $to = $_REQUEST['to'];
    $pod_type = $_REQUEST['pod_type'];
    $client_id= $_REQUEST['client_id'];


	$tbl_branch="";
    
    
    
$requestData= $_REQUEST;
/*Fetch Database column Details*/
        $columns = array( 
            0 =>'tp.id', 
            1 =>'awb_no',
            2 =>'pod_type',
            3 =>'created_at',
            4 =>'url_1',
            5 =>'url_2',
            6 =>'url_3',
            7 =>'url_4',
            8 =>'url_5'
          
        );
        
/*Fetch All Data Start*/        
          $condition='where 1=1 ';
          
    if($_SESSION['lily_express_software_live']['id']!=1 && $_SESSION['lily_express_software_live']['role_branches']!='0'){
        $condition.=" and tb.id in (".$_SESSION['lily_express_software_live']['role_branches'].")";
    }
    
    
          
        if($pod_type!='all')
        {
           $condition.=' and tp.pod_type="'.$pod_type.'"';
        }
        if($client_id!='all'&& $client_id!='0' && $client_id!='')
        {
           $condition.=' and pk.client_id="'.$client_id.'"';
        }
        
        
        if($from!='' && $to!='')
        {
            if($from==$to){
                $condition.=" and DATE(tp.created_at)='$from'";
            }else{
                $condition.=" and DATE(tp.created_at) BETWEEN '$from' AND '$to' ";
            }
            
        }
        
    
    
/*Fetch All Data Start*/        
          
        $statement = $pdo->prepare("SELECT * FROM `tbl_pod` tp INNER JOIN pickup_entry pk ON tp.awb_id=pk.id INNER JOIN tbl_user tu on pk.client_id=tu.id  INNER JOIN tbl_branch tb on tu.branch_id=tb.id $condition");   

		$statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalData = $statement->rowCount();
        $totalFiltered = $totalData;
/*Fetch All Data End*/       
        
/*Fetch Filter Data Start*/    
    	 
    	
        $sql="SELECT *,tp.id as ids FROM `tbl_pod` tp INNER JOIN pickup_entry pk ON tp.awb_id=pk.id INNER JOIN tbl_user tu on pk.client_id=tu.id  INNER JOIN tbl_branch tb on tu.branch_id=tb.id $condition ";   
           error_log($sql);  	 
    	
         if( !empty($requestData['search']['value']) ) 
        {   
        	$sql.=" AND ( pk.ref_no LIKE '%".$requestData['search']['value']."%' ";    
        	$sql.=" OR pk.phone 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[] = "<input type='checkbox' class='checkbox' name='checkboxlist' value='".$row['ids']."'/>";
                     	//$nestedData[] = "<a href='#' class='btn btn-warning btn-xs'><i class='fa fa-edit'></i> Edit</a><a href='#' class='btn btn-danger btn-xs'><i class='fa fa-trash'></i> Delete</a>";
                    	$nestedData[] = $row["ref_no"];
                    	
                    	if($row['pod_type']=='1'){ $nestedData[]= 'PICKUP';}elseif($row['pod_type']=='2'){ $nestedData[]='DELIVERY';} 
                    	    $created=date_create($row['created_at']);
                            $da=date_format($created,'Y-m-d');
                       $cr_at=date_format($created,'d/m/Y');
                        $nestedData[] = $cr_at;
                      if($row['url_1']!=''){  
                        $nestedData[] = "<input type='checkbox' class='checkboxs' name='checkboxlists' value='https://speedlinkservices.com/dashboard/admin/img/POD/".$row['url_1']."'/>";
                      }else{ $nestedData[] = "-";}
                       if($row['url_1']!=''){
	                       $nestedData[] = "<center><a class='btn btn-success btn-sm' style='padding: 1px;padding: 1px;padding-left: 5px;padding-right: 5px;margin: 3px;' target='_blank' href='img/POD/".$row['url_1']."' title='ImageName'><i class='fa fa-eye'></i> View</a><a download='".$row['url_1']."' href='img/POD/".$row['url_1']."' title='ImageName'><img alt='ImageName' style='width: 80px;border: 2px solid red;' class='img-thumbnail' src='img/POD/".$row['url_1']."'</a></center>";
                       }else{
                            $nestedData[] ='No Image';
                       } 
                       if($row['url_2']!=''){
	                       $nestedData[] = "<a download='".$row['url_2']."' href='img/POD/".$row['url_2']."' title='ImageName'><img alt='ImageName' style='width: 80px;border: 2px solid red;' class='img-thumbnail' src='img/POD/".$row['url_2']."'</a>";
                       }else{
                            $nestedData[] ='No Image';
                       } 
                       if($row['url_3']!=''){
	                       $nestedData[] = "<a download='".$row['url_3']."' href='img/POD/".$row['url_3']."' title='ImageName'><img alt='ImageName' style='width: 80px;border: 2px solid red;' class='img-thumbnail' src='img/POD/".$row['url_3']."'</a>";
                       }else{
                            $nestedData[] ='No Image';
                       } 
                       if($row['url_4']!=''){
	                       $nestedData[] = "<a download='".$row['url_4']."' href='img/POD/".$row['url_4']."' title='ImageName'><img alt='ImageName' style='width: 80px;border: 2px solid red;' class='img-thumbnail' src='img/POD/".$row['url_4']."'</a>";
                       }else{
                            $nestedData[] ='No Image';
                       } 
                       if($row['url_5']!=''){
	                       $nestedData[] = "<a download='".$row['url_5']."' href='img/POD/".$row['url_5']."' title='ImageName'><img alt='ImageName' style='width: 80px;border: 2px solid red;' class='img-thumbnail' src='img/POD/".$row['url_5']."'</a>";
                       }else{
                            $nestedData[] ='No Image';
                       } 
                        
                    	$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