ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/get-delivery-report.php

<?php 
include("inc/config.php");
  
    $from = $_POST['from'];
    $to = $_POST['to'];
    $client_id = $_POST['client_id'];
    
            if($client_id!='all'){
                $statement = $pdo->prepare("SELECT pickup_entry.*,tbl_user.full_name as client_name,pickup_entry.created_at as added,tbl_customer.cust_code as cust_code,
    	       material_desc.full_desc as content,tbl_customer.cust_name as cust_name FROM pickup_entry INNER JOIN tbl_user INNER JOIN tbl_customer INNER JOIN material_desc 
    	       on pickup_entry.client_id=tbl_user.id AND pickup_entry.content_desc=material_desc.id AND pickup_entry.customer_id=tbl_customer.cust_id 
    	       where pickup_entry.client_id='$client_id' and pickup_entry.status='delivered' order by pickup_entry.id DESC");   
  
            	$statement->execute();
            	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
            	$total_count = $statement->rowCount();
                $i=1;
            }
            else{
                 $statement = $pdo->prepare("SELECT pickup_entry.*,tbl_user.full_name as client_name,pickup_entry.created_at as added,tbl_customer.cust_code as cust_code,
    	       material_desc.full_desc as content,tbl_customer.cust_name as cust_name FROM pickup_entry INNER JOIN tbl_user INNER JOIN tbl_customer INNER JOIN material_desc 
    	       on pickup_entry.client_id=tbl_user.id AND pickup_entry.content_desc=material_desc.id AND pickup_entry.customer_id=tbl_customer.cust_id 
    	       where pickup_entry.status='delivered' order by pickup_entry.id DESC");   
  
            	$statement->execute();
            	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
            	$total_count = $statement->rowCount();
                $i=1;
                
            }
                
                if($total_count>0)
                {
                
                if($from!='' && $to!=''){
                foreach ($result as $row) {
                     $created=date_create($row['added']);
                     $da=date_format($created,'Y-m-d');
                     if ($from <= $da && $to >= $da)
                    {
                        echo'<tr>';
                       echo '<td>'. $i.'</td>';
                       echo '<td>'. $row['ref_no'] .'</td>';
                       echo '<td>'. $row['cust_code'] .'</td>';
	                   echo '<td>'. $row['client_name'] .'</td>';
	                   echo '<td>'. $row['address'].'</td>';
	                   echo '<td>'. $row['pincode'] .'</td>';
	                   echo '<td>'. $row['phone'] .'</td>';
	                   echo '<td>'. $row['a_weight'] .'</td>';
	                   echo '<td>'. $row['c_weight'].'</td>';
	                   echo '<td>'. $row['pics'] .'</td>';
	                   echo '<td>'. date_format($created,'d/m/Y') .'</td>';
	                   echo '<td>'. $row['cust_name'] .'</td>';
	                   echo '</tr>';
	  	                              $i++;
                    }
        } 
    }
        else{
            
             foreach ($result as $row) {
                     $created=date_create($row['added']);
                     $da=date_format($created,'Y-m-d');
                        echo'<tr>';
                       echo '<td>'. $i.'</td>';
                       echo '<td>'. $row['ref_no'] .'</td>';
                       echo '<td>'. $row['cust_code'] .'</td>';
	                   echo '<td>'. $row['client_name'] .'</td>';
	                   echo '<td>'. $row['address'].'</td>';
	                   echo '<td>'. $row['pincode'] .'</td>';
	                   echo '<td>'. $row['phone'] .'</td>';
	                   echo '<td>'. $row['a_weight'] .'</td>';
	                   echo '<td>'. $row['c_weight'].'</td>';
	                   echo '<td>'. $row['pics'] .'</td>';
	                   echo '<td>'. date_format($created,'d/m/Y') .'</td>';
	                   echo '<td>'. $row['cust_name'] .'</td>';
	                   echo '</tr>';
	  	                              $i++;
                    
        } 
        }
                }
                else{
                    echo 'No Data Available';
                }
                
    ?>

Zerion Mini Shell 1.0