ok

Mini Shell

Direktori : /home2/selectio/www/y1jobportal.in/admin/excel/
Upload File :
Current File : //home2/selectio/www/y1jobportal.in/admin/excel/all_orders_export.php

<?php
ini_set('memory_limit', '-1');
include("../api/config/config.php");
$date = date("Y-m-d");
    
if(isset($_REQUEST['orders']) && $_REQUEST['orders']=="All")
{
    
    $status=$_REQUEST['orders'];
    
    $statement = $pdo->prepare("SELECT * FROM `shipment` order by id DESC"); 
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	$total_count = $statement->rowCount();
	
	
	$now = gmdate("YmdHis");
	
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename='.$status.'-Orders--'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('S.No','Order ID', 'Order Date', 'Customer Name','Pincode', 'Customer Mobile','Payment'));  
        $i=1;
		foreach ($result as $row) {
		    $date=date_create($row['created_at']);
			 $day=date_format($date,'d-m-Y');
			 
			  
			   $created=date_create($row['created_at']);
                     $da=date_format($created,'Y-m-d');
                     
                     if($from!='' && $to!=''){
                     if ($from <= $da && $to >= $da)
                    {
        			fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
                     }
                    else
                    {
                    fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
		} 
		fclose($output);
    
    
    
    
    
    
}

else if(isset($_REQUEST['orders']) && $_REQUEST['orders']=="Delivered")
{
    
    $status = $_REQUEST['orders'];
    
    $statement = $pdo->prepare("SELECT * FROM `shipment` WHERE shipment_status=2 order by id DESC"); 
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	$total_count = $statement->rowCount();
	
	
	$now = gmdate("YmdHis");
	
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename='.$status.'-Orders--'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('S.No','Order ID', 'Order Date', 'Customer Name','Pincode', 'Customer Mobile','Payment'));  
        $i=1;
		foreach ($result as $row) {
		    $date=date_create($row['created_at']);
			 $day=date_format($date,'d-m-Y');
			 
			  
			   $created=date_create($row['created_at']);
                     $da=date_format($created,'Y-m-d');
                     
                     if($from!='' && $to!=''){
                     if ($from <= $da && $to >= $da)
                    {
        			fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
                     }
                    else
                    {
                    fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
		} 
		fclose($output);
    
    
    
    
    
    
}

else if(isset($_REQUEST['orders']) && $_REQUEST['orders']=="In-Transit")
{
    
    $status = $_REQUEST['orders'];
    
    $statement = $pdo->prepare("SELECT * FROM `shipment` WHERE shipment_status=3 order by id DESC"); 
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	$total_count = $statement->rowCount();
	
	
	$now = gmdate("YmdHis");
	
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename='.$status.'-Orders--'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('S.No','Order ID', 'Order Date', 'Customer Name','Pincode', 'Customer Mobile','Payment'));  
        $i=1;
		foreach ($result as $row) {
		    $date=date_create($row['created_at']);
			 $day=date_format($date,'d-m-Y');
			 
			  
			   $created=date_create($row['created_at']);
                     $da=date_format($created,'Y-m-d');
                     
                     if($from!='' && $to!=''){
                     if ($from <= $da && $to >= $da)
                    {
        			fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
                     }
                    else
                    {
                    fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
		} 
		fclose($output);
    
    
    
    
    
    
}


else if(isset($_REQUEST['orders']) && $_REQUEST['orders']=="New-Orders")
{
    
    $status = $_REQUEST['orders'];
    
    $statement = $pdo->prepare("SELECT * FROM `shipment` WHERE shipment_date='".$date."' order by id DESC"); 
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	$total_count = $statement->rowCount();
	
	
	$now = gmdate("YmdHis");
	
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename='.$status.'-Orders--'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('S.No','Order ID', 'Order Date', 'Customer Name','Pincode', 'Customer Mobile','Payment'));  
        $i=1;
		foreach ($result as $row) {
		    $date=date_create($row['created_at']);
			 $day=date_format($date,'d-m-Y');
			 
			  
			   $created=date_create($row['created_at']);
                     $da=date_format($created,'Y-m-d');
                     
                     if($from!='' && $to!=''){
                             if ($from <= $da && $to >= $da)
                            {
                			fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
                		    $i++;
                            }
                     }
                    else
                    {
                    fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
		} 
		fclose($output);
    
    
    
    
    
    
}

else if(isset($_REQUEST['orders']) && $_REQUEST['orders']=="Pickup-Orders")
{
    
    $status = $_REQUEST['orders'];
    
    $statement = $pdo->prepare("SELECT * FROM `shipment` WHERE shipment_date='".$date."' order by id DESC"); 
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	$total_count = $statement->rowCount();
	
	
	$now = gmdate("YmdHis");
	
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename='.$status.'-Orders--'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('S.No','Order ID', 'Order Date', 'Customer Name','Pincode', 'Customer Mobile','Payment'));  
        $i=1;
		foreach ($result as $row) {
		    $date=date_create($row['created_at']);
			 $day=date_format($date,'d-m-Y');
			 
			  
			   $created=date_create($row['created_at']);
                     $da=date_format($created,'Y-m-d');
                     
                     if($from!='' && $to!=''){
                             if ($from <= $da && $to >= $da)
                            {
                			fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
                		    $i++;
                            }
                     }
                    else
                    {
                    fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
		} 
		fclose($output);
    
}

else if(isset($_REQUEST['orders']) && $_REQUEST['orders']=="Ready-to-Delivery-Orders")
{
    
    $status = $_REQUEST['orders'];
    
    $statement = $pdo->prepare("SELECT * FROM `shipment` WHERE shipment_date='4' order by id DESC"); 
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	$total_count = $statement->rowCount();
	
	
	$now = gmdate("YmdHis");
	
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename='.$status.'-Orders--'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('S.No','Order ID', 'Order Date', 'Customer Name','Pincode', 'Customer Mobile','Payment'));  
        $i=1;
		foreach ($result as $row) {
		    $date=date_create($row['created_at']);
			 $day=date_format($date,'d-m-Y');
			 
			  
			   $created=date_create($row['created_at']);
                     $da=date_format($created,'Y-m-d');
                     
                     if($from!='' && $to!=''){
                             if ($from <= $da && $to >= $da)
                            {
                			fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
                		    $i++;
                            }
                     }
                    else
                    {
                    fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
		} 
		fclose($output);
    
}

else if(isset($_REQUEST['orders']) && $_REQUEST['orders']=="RTO-Orders")
{
    
    $status = $_REQUEST['orders'];
    
    $statement = $pdo->prepare("SELECT * FROM `shipment` WHERE shipment_date='2' order by id DESC"); 
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	$total_count = $statement->rowCount();
	
	
	$now = gmdate("YmdHis");
	
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename='.$status.'-Orders--'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('S.No','Order ID', 'Order Date', 'Customer Name','Pincode', 'Customer Mobile','Payment'));  
        $i=1;
		foreach ($result as $row) {
		    $date=date_create($row['created_at']);
			 $day=date_format($date,'d-m-Y');
			 
			  
			   $created=date_create($row['created_at']);
                     $da=date_format($created,'Y-m-d');
                     
                     if($from!='' && $to!=''){
                             if ($from <= $da && $to >= $da)
                            {
                			fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
                		    $i++;
                            }
                     }
                    else
                    {
                    fputcsv($output, array($i,$row['order_id'],$row['order_date'],$row['cust_firstname'],$row['pickup_pincode'],$row['cust_mobile'],$row['payment_method']));
        		    $i++;
                    }
		} 
		fclose($output);
    
}
?>

Zerion Mini Shell 1.0