ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/excel/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/excel/excel-bulk-track.php

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

$track_id=$_POST['t_ids'];
$type=$_POST['types'];

// $type=preg_replace('/\s+/', '', $type);
    // echo "<script>alert('5');</script>";
// $list_track_ids=preg_replace('/\s+/', '', $track_id);
$list_track_ids=preg_split('/\r\n|[\r\n]/', $track_id);

	$now = gmdate("YmdHis");
		header('Content-Type: text/csv; charset=utf-8');  
		header('Content-Disposition: attachment; filename=Bulk_Track'.$now.'.csv');  
		$output = fopen("php://output", "w");  
		fputcsv($output, array('SL', 'AWB Number', 'Status','Location','Description', 'Last Updated','Shipping Mode', 'Customer Name', 'Address', 'Phone', 'Charged Weight', 'No.Of Pics', 'Destination', 'Booking Date'));  
        $i=1;
        foreach($list_track_ids as $track_id){
           
							if($type=="awb")
							{
							    $statement = $pdo->prepare("SELECT pickup_entry.*,tbl_customer.cust_name as cname FROM `pickup_entry` INNER join tbl_customer on  pickup_entry.ref_no=? and tbl_customer.cust_id=pickup_entry.customer_id");
							}
							else
							{
							      $statement = $pdo->prepare("SELECT pickup_entry.*,tbl_customer.cust_name as cname FROM `pickup_entry` INNER join tbl_customer on  pickup_entry.awb_no=? and tbl_customer.cust_id=pickup_entry.customer_id");
							}
							
							
							$statement->execute(array($track_id));
							$total_id = $statement->rowCount();
							$result = $statement->fetchAll(PDO::FETCH_ASSOC);
							if(!$result)
							{
							 continue;
							}
	                    	foreach ($result as $row) {
                            $mani_fest=$row['manifest_id'];
                            $pick_id=$row['id'];
                            
			                $statement1 = $pdo->prepare("SELECT * FROM tbl_tracking where pickup_entry_id=? ORDER BY t_id DESC LIMIT 1");
							$statement1->execute(array($pick_id));
							$result1 = $statement1->fetchAll(PDO::FETCH_ASSOC); 
							foreach ($result1 as $row1) {
                            {
                			fputcsv($output, array($i,$row['ref_no'],ucwords($row1['status']),$row1['location'],$row1['description'],$row1['created_at'],strtoupper($row['shipping_mode']),$row['cname'],$row['address'],$row['phone'],$row['c_weight'],$row['pics'],$row['destination'],$row['created_at']));
                		    $i++;
                            }
		}
		}
		} 
		fclose($output);




?>

Zerion Mini Shell 1.0