
<?php //error_reporting(0);
$PageSecurity = 3;
 include('includes/Class_Branch.php');
	include('includes/AccountGroupMaster_Class.php');
 
 	$modid=$_REQUEST['modid'];
	 $frmid=$_REQUEST['frmid'];
	 $rurl="&modid=".$modid."&frmid=".$frmid;
	 
	
 include ('includes/session.inc');
  include ('includes/function_lib.php');
 global $db;
 ?>
   <h2><center >Group Summary
			   <?php echo $fromtitle=  $s->getField('voucher_master','VoucherType',$_REQUEST['VPrefix'],'GroupName');?></center></h2>
			   
			   
	 <table width="100%" border="0" cellspacing="1" cellpadding="2">
  	  <tr>
	  <th scope="col"><strong> Branch</strong></th>
	  <th scope="col"><strong> Voucher No</strong></th>
 <th scope="col"><strong> Voucher Type</strong></th>
  	    <th scope="col"><strong> Ledger Name</strong></th>
  	    <th scope="col"><strong>Amount</strong></th>
  	    <th scope="col"><strong>Credit</strong></th>
  	    <th scope="col"><strong>Debit</strong></th>
   	    <th scope="col"><strong>Currency</strong></th>
		<th scope="col"><strong>View</strong></th>
   	    </tr>
 <?php 
   echo '<link href="'.$rootpath. '/css/'. $_SESSION['Theme'] .'/default.css" rel="stylesheet" type="text/css" />';
   $BillBookType=  $s->getField('voucher_master','VoucherType',$_REQUEST['VPrefix'],'VPrefix');

      $query="select A.id as Pid,A.Voucher_NO,A.Branch,A.VPrefix ,B.amount, B.amount_type ,B.ledgerid ,B.currency from account_book A,account_book_details B  where A.id=B.account_bookid  and B.ledgerid    ='".$_REQUEST['id']."' ";
   	$result=DB_query($query,$db);
		$i=1;
		if(DB_num_rows($result)>0)
		{
			while($myrow=DB_fetch_array($result))
			{
				$voucher_no=$myrow['Voucher_NO'];
				$Dates=$myrow['Dates'];
				$Ref_no=$myrow['Ref_no'];
				$voucher_no=$myrow['Voucher_NO'];			
				$narration=trim($myrow['narration']);
				$document_type=trim($myrow['document_type']);
				
	 			 
				$Branch=$myrow['Branch'];
				$banks_checkno=$myrow['banks_checkno'];
				$banks_checkdate=ConvertSQLDate($myrow['banks_checkdate']);
				$banks_receivedfrom=ConvertSQLDate($myrow['banks_receivedfrom']);
				$favouring_name=$myrow['favouring_name'];
				$cross_inst=$myrow['cross_inst'];
	 ?>
			 
 

 
  	  <tr bgcolor="#ffffff" >
	   <td> <?php  echo  $myrow['Branch'];?></td>
	    <td> <?php  echo  $myrow['Voucher_NO'];?></td>
		<td><?php 
	echo 	   $BillBookType=  $s->getField('voucher_master','VoucherType',$myrow['VPrefix'],'VPrefix');?>
	</td>
  	    <td><?php  //echo $i;?> <?php  echo $s->getField('accountledger','AccountsID',$myrow['ledgerid'],'AccountName');;?></td>
  	    <td> <?php  echo  $myrow['amount'];?></td>
  	    <td> <?php
		echo ($myrow['amount_type']=='CR'? $myrow['amount']:"0");
		$total_cr[]=($myrow['amount_type']=='CR'? $myrow['amount']:"0");
		
		?></td>
  	     <td> <?php  echo  ( $myrow['amount_type']=='DR'? $myrow['amount']:"0");
		 $total_dr[]=($myrow['amount_type']=='DR'? $myrow['amount']:"0");
		 ?></td>
  	   <td> <?php  echo $myrow['currency'];?></td>
	     <td><a href="address_book.php?id=<?php  echo $myrow['Pid'].$rurl?>&VPrefix=<?php echo $myrow['VPrefix'];?>" >View</a></td>
  	    </tr>
  	 
		<?php 
}		
		?>
  	   
	 <tr bgcolor="#999999" >
  	    <td>&nbsp;</td>
  	    <td>&nbsp;</td>
  	    <td>&nbsp;</td> <td>&nbsp;</td>
  	    <td>Total</td>
  	    <td><?php echo array_sum($total_cr)?>&nbsp;</td>
  	    <td><?php echo array_sum($total_dr)?>&nbsp;</td>
  	    <td>&nbsp;</td>
  	    <td>&nbsp;</td>
       </tr>
			   
			   
			   <?php 
		 
			}
?>
  </table> 
