<?php
include "../inc/config.php";
    $client_id = $_GET['client_id'];
    $client_type = $_GET['client_type'];
                $statement = $pdo->prepare("SELECT * FROM tbl_user where id=$client_id");
            	$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=Sample_Pickup_Entry_list.csv');  
		$output = fopen("php://output", "w");
		
		
if($client_type=='Admin'){
    fputcsv($output, array('SL','CSCS AWB',	'3PL AWB','Ref No (Required)','Order Type(Required)','Collectable Amount(Required)','Business Mode (Required)',	'B2B/B2C(Required)','Shipper Name','Shipper Address','Shipper City','Shipper State','Shipper Pincode','Shipper Phone','Consignee Name(Required)','Consignee Address(Required)','Consignee City(Required)','Consignee State(Required)','Consignee Pincode(Required)','Consignee Phone(Required)','Product Description','Quantity(Required)','Actual Weight(Required)','Volumetric Weight(Optional if you having length,breadth,height)','Vol.Length(Optional if you having Volumetric Weight)','Vol.Breadth(Optional if you having Volumetric Weight)','Vol.Height(Optional if you having Volumetric Weight)','Charged Weight','Invoice Value(it will autogenerated)','Taxable Value(Required)','HSN Code(Required)','Discount','Gst Type(Required)','Gst Amount(it will autogenerated)','MRP','Ewaybill','Buyer Gst','Seller Gst','RTO Name','RTO Address','RTO City','RTO State','RTO Pincode','RTO Phone','No of Boxes(Required)','PickupEntry Date(Format should be 23-02-2055 OR 23-02-55)'));  
}else
{
       fputcsv($output, array('SL','CSCS AWB',	'Reserved Column(Do Not Remove)','Ref No (Required)','Order Type(Required)','Collectable Amount(Required)','Business Mode (Required)',	'B2B/B2C(Required)','Shipper Name','Shipper Address','Shipper City','Shipper State','Shipper Pincode','Shipper Phone','Consignee Name(Required)','Consignee Address(Required)','Consignee City(Required)','Consignee State(Required)','Consignee Pincode(Required)','Consignee Phone(Required)','Product Description','Quantity(Required)','Actual Weight(Required)','Volumetric Weight(Optional if you having length,breadth,height)','Vol.Length(Optional if you having Volumetric Weight)','Vol.Breadth(Optional if you having Volumetric Weight)','Vol.Height(Optional if you having Volumetric Weight)','Charged Weight','Invoice Value(it will autogenerated)','Taxable Value(Required)','HSN Code(Required)','Discount','Gst Type(Required)','Gst Amount(it will autogenerated)','MRP','Ewaybill','Buyer Gst','Seller Gst','RTO Name','RTO Address','RTO City','RTO State','RTO Pincode','RTO Phone','No of Boxes(Required)','PickupEntry Date(Format should be 23-02-2055 OR 23-02-55)'));  
}
        $i=1;
		foreach ($result as $row) {
                    fputcsv($output, array($i,'','','','','','','',$row['full_name'],$row['address'],$row['city'],$row['state'],$row['pincode'],$row['phone'],'','','','','','','','','','','','','','','','','','','','','','','','',$row['full_name'],$row['address'],$row['city'],$row['state'],$row['pincode'],$row['phone'],'','21-02-2021'));
        		    $i++;
		} 
		fclose($output);




?>