<?PHP


session_start();


include 'connect.php';


if(isset($_SESSION['adminemail']))


{


$user=$_SESSION['adminemail'];





$gtp=mysql_query("select * from admin where username='$user'");


$gtp1=mysql_fetch_array($gtp);











echo"<br /><center><table style='width:90%;'><tr>


<td style='width:25%;'></td>


<td style='width:50%; text-align:center;'><b>Today Order Confirmed - ".date('d-m-Y')."</b></td>


<td style='width:25%;'></td></tr></table></center><br />";





$date=date('Y-m-d');





echo"<table style='width:90%; margin:auto;'>


<tr><td><table border='1' style='width:100%; border-collapse:collapse; font-size:12px;'>


<thead><tr><th>Customer</th><th>Mobile</th><th>Village</th><th>Taluk</th><th>District</th>


<th>Product</th><th>Qty</th><th>Executive</th><th>Rate</th><th>Order Value</th></tr></thead>";





$sel=mysql_query("select * from admin where username='$user'");


$nmrw=mysql_num_rows($sel);


$sel1=mysql_fetch_array($sel);





if($nmrw>0)


{


$getr=mysql_query("select * from followup where date='$date' and status='Confirmed'");


}


else


{





$empd=mysql_query("select * from employee where username='$user'");


$empd1=mysql_fetch_array($empd);





$usr=$empd1['ID'];





$getr=mysql_query("select * from followup where date='$date' and executive='$usr' and status='Confirmed'");


}





while($getr1=mysql_fetch_array($getr))


{


	


	$cust=mysql_query("select * from crm_customer where ID='$getr1[customer]'");


	$cust1=mysql_fetch_array($cust);


	


	$exec=mysql_query("select * from employee where ID='$getr1[executive]'");


	$exec1=mysql_fetch_array($exec);


	


	$sl=mysql_query("select *,sum(total) as total from sales_order where orderno='$getr1[salesorderno]'");


	$sl1=mysql_fetch_array($sl);


	


	$prd=mysql_query("select * from product where ID='$sl1[product]'");


	$prd1=mysql_fetch_array($prd);


	


	$vil=mysql_query("select * from villages where ID='$cust1[village]'");


	$vil1=mysql_fetch_array($vil);


	


	$tal=mysql_query("select * from taluk where ID='$cust1[taluk]'");


	$tal1=mysql_fetch_array($tal);
	
	
	
	$dis=mysql_query("select * from districts where ID='$cust1[district]'");

	$dis1=mysql_fetch_array($dis);


	


	echo"<tr><td>".$cust1['name']."</td>


	


	<td>".$cust1['mobile']."</td>


	


	<td>".$vil1['village']."</td>


	


	<td>".$tal1['taluk']."</td>


	


	<td>".$dis1['district']."</td>


	


	<td>".$prd1['product']."</td>


	


	<td>".$sl1['qty']."</td>





	<td>".$exec1['name']."</td>
	


	
	<td style='text-align:right;'>".$sl1['rate']."</td>
	

	
	
	<td style='text-align:right;'>".$sl1['total']."</td></tr>";



	


}





echo"</table></td></tr></table>";






}


else


{





 header("location:login.php");


 


}










?>