 <style type="text/css">
<!--
.style20 {
	font-family: Verdana;
	font-size: 12px;
}
.style5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
.style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.style10{ border-top:solid 1px; border-top-color:#999;}
.style11{ border-bottom:dashed 1px; border-bottom-color:#333333;}
.style4 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.style23 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style29 {font-size: 12px}
.style28 {	font-size: 16px;
	font-weight: bold;
}
.stylebottom
{
	border-right:1px solid #999;

	
	border-bottom:1px solid #999;
}	
-->
</style>
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<div class="CSSTableGenerator">
<?php 
include ("../../include/db.php");
error_reporting(0);
ob_start();
session_start();
$session_branch=$_SESSION['branch'];
$session_user_type=$_SESSION['user_type'];
$branch_name11=$_GET['branch_name'];

$branch_name=$_GET['book_branch'];
function get_categ_branch_id($branch_name)
{
$sql_query11="select * from branch_creation where branch_id='$branch_name' and delete_status!='1'";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $id=$rsdata11->branch_name;
 } 
	return $id;
 }
   function get_categ_branch_id12($branch_name11)
{
$sql_query11="select * from branch_creation where branch_id='$branch_name11' and delete_status!='1'";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $id=$rsdata11->branch_name;
 } 
	return $id;
 }

 $bran_name=get_categ_branch_id($branch_name);
 $branc_name=get_categ_branch_id12($branch_name11);

if($session_user_type!=1)
{
$query="select * from branch_creation  WHERE branch_id='$session_branch'";
}
$rs=mysql_query($query);						 
                                                $i=0;
                                                while($list=mysql_fetch_array($rs))
                                                {
                                                $i=$i+1;
												$branch_address=$list['branch_address'];
												$head_off=$list['head_off'];
												$branch_off=$list['branch_off'];
												$branch_ph=$list['branch_ph'];
												$delivery_ph=$list['delivery_ph'];
												$delivery_off=$list['delivery_off'];
											    }


												?>									  
<table border="0" width="100%"  cellpadding="0" cellspacing="0">
<tr><td colspan="4"  align="center" style="font-size:14px; padding-center:5px; font-family:Verdana" ><span style="font-size:18px; padding-center:5px; font-family:Verdana"><span class="style28">RAJA TRANSPORT LORRY BOOKING SERVICE</span></span></td>
</tr>
<tr>
  <td colspan="4"  align="center" style="font-size:13px; padding-center:5px; font-family:Verdana" ><span class="style20">(GOODS CONSIGNMENT RECEIPT)</span></td>
</tr>
 <?php if($session_user_type!=1)
{
?>
     <tr> 
    <td height="24" colspan="4" align="center" class="style20" ><?php echo $branch_address;?></td>
  </tr><tr> 
    <td height="47" colspan="4" align="center" valign="top" class="style20" ><span class="style20 style55">H.O.Ph : <?php echo $head_off; ?> B. Off : Cell : <?php echo $branch_off; ?> ,Ph : <?php echo $branch_ph; ?> <br/>
      Delivery Off Ph : <?php echo $delivery_ph; ?> , Cell : <?php echo $delivery_off; ?>.</span></td>
  </tr>
  <?php } ?><tr><td colspan="4"  align="center" class="style20" style=" padding-center:5px; font-family:Verdana" ></td></tr>
<tr><td colspan="4"  align="center" class="style20" style=" padding-center:5px; font-family:Verdana" ></td></tr>
<tr><td height="26" colspan="4" align="center" class="style5 style23"><strong>Local Delivery Confirmation Print</strong></td>
</tr>
<tr><td width="35%" height="29"  align="left" class="style20" style="padding-left:50px;">&nbsp;&nbsp;<strong>From Date :</strong>  <?php if($_GET['from_date']==''){ echo $curdate=date('d-m-Y');} else { echo date("d-m-Y",strtotime($_GET['from_date']));}?></td>
<td width="38%"  align="center" class="style20"><strong>Branch Name :</strong> 
  <?php if($_GET['get_user_type']=='1'){ if($_GET['branch_name']=='') { echo "ALL";} else {echo $branc_name;}} else { echo ucfirst($bran_name);}?></td>
<td width="27%" colspan="2" align="left" class="style20" scope="col"><strong>To Date :</strong>  <?php if($_GET['to_date']==''){ echo $curdate=date('d-m-Y');} else { echo date("d-m-Y",strtotime($_GET['to_date'])); }?></td>
</tr></table>
<table width="100%" height="79" border="0" align="center"  cellpadding="0" cellspacing="0"  >
<tr>
      <td height="24" align="center" class="style10 stylebottom style3" style="border-left:1px solid #999;"><strong>S.No</strong></td>
    <td scope="col" align="left" class="style10 stylebottom style3"><strong>&nbsp;Loading Date</strong></td>
      <td scope="col" align="left" class="style10 stylebottom style3"><strong>&nbsp;Delivery No</strong></td>
      <td scope="col" align="left" class="style10 stylebottom style3"><strong>&nbsp;Loading No</strong></td>
      <td scope="col" align="left" class="style10 stylebottom style3"><strong>&nbsp;Branch Name</strong></td>
      <td scope="col" align="center" class="style10 stylebottom style3"><strong>Count</strong></td>
      <td scope="col" align="right" class="style10 stylebottom style3"><strong>Amount&nbsp;</strong></td>
      </tr>
  <?php
include("../../include/db.php");  
          function get_branchname($branch_name)
		{
		 	$sql="select branch_name from branch_creation where branch_id='$branch_name' and delete_status!='1' ";
			$rs=mysql_query($sql);
			$rscount=mysql_num_rows($rs);
			while($rsdata=mysql_fetch_object($rs))
		    {
		   	$branch_name=$rsdata->branch_name;
		    }
		  	return $branch_name;
		} 
		 function get_unloading_amount($delivery_no)
		{
		 	$sql="select sum(amount) as amount from delivery_conform_sublist where delivery_no='$delivery_no'";
			$rs=mysql_query($sql);
			$rscount=mysql_num_rows($rs);
			while($rsdata=mysql_fetch_object($rs))
		    {
		   	$amount=$rsdata->amount;
		    }
		  	return $amount;
		} 
		
		
		 function get_booking_no($delivery_no)
		{
		 	$sql="select booking_no from delivery_conform_sublist where delivery_no='$delivery_no' ";
			$rs=mysql_query($sql);
			$rscount=mysql_num_rows($rs);
			while($rsdata=mysql_fetch_object($rs))
		    {
		   	$booking_no=$rsdata->booking_no;
		    }
		  	return $booking_no;
		} 
		 
		 
        function get_items_count($get_booking_no)
		{
		 	$sql="select * from booking_sub_list where book_no='$get_booking_no' and unloading_status='1' ";
			$rs=mysql_query($sql);
			$rscount=mysql_num_rows($rs);
		  	return $rscount;
		} 
			
$branch_name=$_GET['branch_name'];
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];

$get_user_type=$_GET['get_user_type'];
$book_branch=$_GET['book_branch'];

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


if($branch_name!=""){ $branch_name1= "branch='$branch_name'"; }else{$branch_name1=''; }
if($from_date!=""){ $from_date1= "loading_date>='$from_date'"; }else{$from_date1="loading_date='$cur_dates'"; }
if($to_date!=""){ $to_date1 = "loading_date<='$to_date'";}else{$to_date1="loading_date='$cur_dates'";}

$all_value10 = $branch_name1.",".$from_date1.",".$to_date1;
$all_array10 = explode(',',$all_value10);
foreach($all_array10 as $value10)
{ 
if($value10!='')
{
$get_query103 .= $value10." AND ";
}
}	  

	
if($get_user_type=='1')
{
	if(($from_date=='')&&($to_date==''))
  {
  $sql="select * from  delivery_conform where  loading_date='$current_date' order by loading_no ASC";
  } 
  else
  {
    $sql="select * from  delivery_conform where $get_query103 id!='' order by loading_no ASC ";
  }
}
else
{
	if(($from_date=='')&&($to_date==''))
  {
   $sql="select * from  delivery_conform where  loading_date='$current_date' and branch='$book_branch' order by loading_no ASC";
  } 
  else
  {
   $sql="select * from  delivery_conform where $get_query103 id!='' and branch='$book_branch' order by loading_no ASC";
  }
}	
	
    $rs=mysql_query($sql);
	$s_no=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
   				 $s_no=$s_no+1;
                 $id=$rsdata['id'];
                 $loading_no=$rsdata['loading_no'];
				 $delivery_no=$rsdata['delivery_no'];
				 $loading_date=$rsdata['loading_date'];
				 $hidden_checkbox=$rsdata['hidden_checkbox'];
				 $hidden_checkboxs=explode("@",$hidden_checkbox);
                 $branch_name=$rsdata['branch'];
				 $branch=get_branchname($branch_name);
				 $tot_amt=get_unloading_amount($delivery_no);
				  $get_booking_no=get_booking_no($delivery_no);
				 $count=get_items_count($get_booking_no);

 ?>
  <tr>
    <td width="77" height="22"  align="center" class="style3 stylebottom" style="border-left:1px solid #999;" ><?php echo $s_no; ?></td>
    <td width="181" align="left" class="style3 stylebottom" >&nbsp;<?php echo date('d-m-Y',strtotime($loading_date));?></td>
    <td width="199" align="left" class="style3 stylebottom" >&nbsp;<?php echo $delivery_no;?></td>
    <td width="211" align="left" class="style3 stylebottom" >&nbsp;<?php echo $loading_no;?></td>
    <td width="221" align="left" class="style3 stylebottom" >&nbsp;<?php echo $branch;?></td>
    <td width="112" align="center" class="style3 stylebottom" >&nbsp;<?php echo $count;?></td>
    <td width="140" align="right" class="style3 stylebottom" ><?php echo number_format($tot_amt,2);?>&nbsp;</td>
  </tr>
  <?php } ?>
    <td height="28" colspan="15"align="right" valign="bottom" class=" style4 " >Printed Date : <?php echo $curdate=date('d-m-Y');?>&nbsp;</p> </td>
</table>
