<?php extract($_POST);
$PageSecurity = 1;
$tabindex=0;
include('includes/DefinePaymentClass.php');
$title = _('Local Freight Payment');
include('includes/SQL_CommonFunctions.inc');
?>


<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
<td align="center" height="30" colspan="6" style="font-family:Arial, Helvetica, sans-serif; font-size:14px;"><div align="center"><strong><?php echo $title;?></strong></div></td>
    </tr><tr><td><div align="center">
			<form  action="" method="post">
			<table width="85%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#FFFFFF" style="border:1px solid #ccc;">
			  <tr>
				<th width="19%" align="left"><strong>Branch</strong></th>
				<td width="28%"><select name="branch" id="branch" style="width:98%">
				   <option value="0">---Select---</option>
				  <?php 			$site_sql=DB_query("Select loccode,locationname from locations",$db);
		                            while($site_row=DB_fetch_array($site_sql)){
				     ?>
				  <option value="<?php echo $site_row['loccode'];?><?php echo ($_REQUEST['site']==$site_row['loccode']?'selected':'')?>"><?php echo $site_row['locationname'];?></option>
				  <?php } ?></select></td>
				<th align="left"><strong>Party Name Wise</strong></th>
			    <td><select name="client" id="client" style="width:98%" onchange="getCreditDays(this.value)">
			      <option value="000">---Select---</option>
			      <?php $c_sql=DB_query("select id,vendor_code, vendor_name from suppliers",$db);
				        while($c_row=DB_fetch_array($c_sql)){
				    ?>
			      <option value="<?php echo $c_row['vendor_code'];?>"><?php echo $c_row['vendor_name'];?></option>
			      <?php } ?> </select></td>			    
			  </tr> </table><p align="center"><input type="Submit" name="Proceed" value="Proceed" /></p>
					  </form></div></td></tr>    
			     <tr><td>&nbsp;</td> </tr>
			    <tr><td>&nbsp;</td></tr></table>
		        <br>
	<table width="98%" border="0" cellspacing="1" cellpadding="2" align="center">
    	  <tr>
    	    <th width="5%"><strong>S. No.</strong></th>
    	    <th width="13%"><strong>Branch</strong></th>
    	    <th width="7%"><strong>Vouchar No</strong></th>
    	    <th width="12%"><strong>Bill No.</strong></th>
    	    <th width="17%"><strong>Party Name</strong></th>
    	    <th width="8%"><strong>Freight Amount</strong></th>
    	     <th width="13%"><strong>Narrations</strong></th>
    	       	      </tr>
    	  <?php 
    	 if(isset($_POST['Proceed']))
		 {		  	
    	$filter=array();		
		
						if($_REQUEST['branch']!='0')
						$filter[]="local_fright.branch_code='".$_REQUEST['branch']."'";
						if($_REQUEST['client']!='000')
						$filter[]="local_fright.party='".$_REQUEST['client']."'";		
						if($filter!='')
						{
						  if($_REQUEST['branch']!='0'){$filter2=implode(" and ",$filter)." ";} 	else	$filter2=implode(" and ",$filter);
						}			
						if($_REQUEST['branch']!='0' or $_REQUEST['client']!='000') {  $sql="Select * from local_fright where  $filter2 ";	}
						else { $sql="Select * from local_fright  "; }
						$result=DB_query($sql,$db);
						$i=1;
						$mmm=DB_num_rows($result);
						if(DB_num_rows($result)>0)
						{while($myrow=DB_fetch_array($result)){   ?>
		    	      <tr bgcolor="#FFFFFF">
		    	      <td><strong><?php echo $i;?></strong></td>
		    	      <td><?php 	$sitename=$s->getField('locations','loccode',$myrow['branch_code'],'locationname');	echo $sitename;?></td>
		    	      <td><?php echo $myrow['vouchar_no']; ?></td>
		    	      <td><?php echo $myrow['bill_no'];?></td>
		    	      <td><?php $sitename1=$s->getField('suppliers','vendor_code',$myrow['party'],'vendor_name'); 	echo $sitename1;?></td>   	    
		    	      <td> <?php  echo $myrow['fright_amount']; ?>  </td>
		    	      <td><?php echo $myrow['narration'];	?></td>    	   
		   	         </tr> <?php $i++; }  }else		{?>
				  <tr><td colspan="7"><font color="#FF0000"><strong>No Record Found</strong></font></td></tr>
		<?php 	}	}	?></table>
	
<?php
include('includes/footer.inc');
?>