ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/excel/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/excel/awb-number.php

<?php
ini_set('memory_limit', '333000MB');
include("../inc/config.php");
include("../db.php");

if(!isset($_GET['client_id'])){
   $_GET['client_id']=0; 
}
if(!isset($_GET['status'])){
   $_GET['status']=0; 
}
if(!isset($_GET['type'])){
   $_GET['type']=0; 
}


    $report_name="AWB Report ";
	
	$statement = $pdo->prepare("SELECT * FROM tbl_user WHERE id=".$_GET['client_id']);
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);	
	if($result){
	   $report_name.= "-".$result[0]['full_name']." ";
	}
	if($_GET['type']==2){$report_name.='-Forward -';}else{$report_name.='-Reverse -';}
	if($_GET['status']==1){$report_name.='-Available';}else if($_GET['status']==2){$report_name.='-Waiting For Orders';}else{$report_name.='-Used';}
	
    header('Content-Type: text/csv; charset=utf-8');
    header('Content-Disposition: attachment; filename='.$report_name.'-'.date("Y-m-d").'.csv');  
	$output = fopen("php://output", "w");
	
$statement="SELECT awb_code,status FROM `tbl_awb` where client_id=".$_GET['client_id']." and status=".$_GET['status']." and is_return_awb=".$_GET['type'];
$result=mysqli_query($conn,$statement);
$datas=array();
fputcsv($output, array('AWB Number','Status')); 
$i=1;
foreach($result as $row) {
    if($row['status']==1){$status='Available';}else if($row['status']==2){$status='Waiting For Orders';}else{$status='Used';}
    
     fputcsv($output, array($i,$row['awb_code'],$status));
     $i++;
}
fclose($output);

?>

Zerion Mini Shell 1.0