<?php 
if($_REQUEST['action']=='del')
{
	$condition="voucherId='".$_REQUEST['id']."'";
	$s->DeleteRecord('journal_voucher_master',  $condition);
	$condition1="TransId='".$_REQUEST['id']."'";
	$s->DeleteRecord('journalvoucher',  $condition1);
 }
?>
<form action="" method="post">
<h1>Journal Vocuher</h1><br />


 <table width="100%" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <th scope="col"><strong>  VoucherId</strong></th>
	  <th scope="col"><strong>Branch</strong></th>
	     
		   <th scope="col"><strong>Ledger</strong></th>
		   <th scope="col"><strong>Created Date</strong></th>
		   <th scope="col"><strong>Credit</strong></th>
		   		   <th scope="col"><strong>Debit</strong></th>
 	   <th scope="col"><strong>View</strong></th>
    </tr>
 
  
   <?php 
         $GetRecord = "Select * from journal_voucher_master A,journalvoucher B where B.TransId=A.voucherId and ledger_id='".$_REQUEST['Lid']."' group by A.voucherId";
   $ResultData = DB_query($GetRecord,$db);
   $j=0;
   if(DB_num_rows($ResultData)==0)
   echo "<td colspan='3'>--No Record--</td>";
   while($RowData = DB_fetch_array($ResultData))
   {  if($j++%2==0)
     $bgcolor="#CCCCCC";
	 else{
	 $bgcolor="#FFFFFF";
	 }
	 
	 
   ?><tr bgcolor="<?php echo $bgcolor;?>" >
   <td><div align="center"><?php 
   
    echo $RowData['voucherId']; ?></div></td>
    <td><?php  
	  
	  echo $s->getField('locations','loccode', $RowData['branch'] ,'locationname');
	 
	 ?>	  </td>
	    
		
	
	 <td><div align="center"><?php    
     
	  echo $s->getField('accountledger','AccountsID', $RowData['ledger_id'] ,'AccountName');
	?></div></td>
		  
	     <td><div align="center"><?php 
   
    echo $RowData['created_date']; ?></div></td>
	  <td><div align="center"><?php 
   
    echo $RowData['credit']; ?></div></td>
	  <td><div align="center"><?php 
   
    echo $RowData['debit']; ?></div></td>
	
   <td><div align="center"><a href="main.php?route=TrialJournalVoucher&Lid=<?php echo  $_REQUEST['Lid']?>&SubId=<?php echo  $_REQUEST['SubId'];?>&id=<?php echo $RowData['JournalVoucherId']  ?>"> <img src="images/search.gif"  width="10" height="10"/></a></div></td>
	</tr>
	<?php }   
   ?> 
</table>
</form>

 