<?
ob_start();
session_start();
function startsWith($haystack, $needle) {
    // search backwards starting from haystack length characters from the end
    return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
}
if(isset($_SESSION['ses_name']))
{
$user=$_SESSION['ses_name'];
}else{
header("location:index.php");
}
$parent_name='';
$ledger_name='';
$veh_num='';
$sdate_12 ='';
$page='1';
include("include/config.php");
require_once "include/Database_functions.php";
$sqlObj=new sqlclass();
$msg = '';
$cumulative=0;

if(isset($_REQUEST['from_date']) && $_REQUEST['from_date']!=''){
$from_date=date('d-m-Y',strtotime($_REQUEST['from_date']));
}
else
{
$from_date=date('d-m-Y');
}
if(isset($_REQUEST['to_date']) && $_REQUEST['to_date']!=''){
$to_date=date('d-m-Y',strtotime($_REQUEST['to_date']));
}
else
{
$to_date=date('d-m-Y');
}

function print1($selectype,$fromdate,$todate)
			{
			
				//$userids = $_SESSION['admin_id'];
				
					$dates = date('Y-m-d');
					$names = $selectype.$dates;
					$outstr = NULL;
					header("Content-type: application/vnd.ms-word");
					header("Content-Disposition: attachment;Filename=".$names.".xls");
			
					//set the directory to get image			
					// Query database to get data
					$i = 1;
					'<div id="header" >';
					$outstr.='<table style="font-family:Arial, Helvetica, sans-serif; font-size:12px;width:500px;border:1px solid #000000; " cellspacing=0 cellpadding=0 ">
						 <tr>
					     	<td colspan="6" style="font-size:14px; min-width:100px; text-align:center; padding:5px; min-width:200px;border-right:1px solid #000000;"><strong>Day Book</strong></td>
    					</tr>
						<tr>
					     	<td style="font-size:14px; min-width:100px; text-align:left; padding:5px; min-width:200px;border-right:1px solid #000000;"><strong>No</strong></td>
							<td style="font-size:14px; min-width:100px; text-align:left;padding:5px; min-width:200px;border-right:1px solid #000000;"><strong>Date</strong></td>
    						<td style="font-size:14px; min-width:100px; text-align:left; padding:5px; min-width:200px;border-right:1px solid #000000;"><strong>Ledger Name</strong></td>
    						<td style="font-size:14px; min-width:100px; text-align:left;padding:5px; min-width:200px;border-right:1px solid #000000;"><strong>Debit</strong></td>
							
							
    						<td style="font-size:14px; min-width:100px; text-align:left;padding:5px; min-width:200px;border-right:1px solid #000000;"><strong>Credit</strong></td>
														
  					</tr>';
					
					//print_r($fromdate);
					//print_r($todate);
				
				/*$sq_arr_print="SELECT a.*,b.ledgername as ledgername
					FROM cf_voucher a
						LEFT JOIN cf_ledger b
							ON b.ledgerid = a.to where 1";*/
							
				$cond='';
				//$query=$sq_arr;
				
				if(isset($fromdate) && ($fromdate!=''))
				{
					$from_date=date('Y-m-d',strtotime($fromdate));
					$cond.=" and   a.pay_date >= '$from_date'";
				}
				else
				{
					$from_date=date('Y-m-d');
					$cond.=" and   a.pay_date >= '$from_date'";
				}
				
				if(isset($todate) && ($todate!=''))
				{
					$to_date=date('Y-m-d',strtotime($todate));
					$cond.=" and   a.pay_date <= '$to_date'";
				}
				else
				{
					$to_date=date('Y-m-d');
					$cond.=" and   a.pay_date <= '$to_date'";
				}
				
				
				
			
							
							$sq_arr_print="select * from (SELECT  a.reciept_id as sid, a.pay_date as pay_date ,a.cashed as cashed,a.amount as amount,b.ledgername as ledgername, 1 as type,a.neft_reference_no as reference, 0 as acc_type ,0 as prdt_type ,a.purpose as purpose,bk.bankname as bankname
        FROM cf_reciept a
        LEFT JOIN cf_ledger b ON b.ledgerid = a.from LEFT JOIN cf_bank as bk ON bk.bank_id = a.transaction_bank where 1 ".$cond." 
		
			UNION SELECT a.voucher_id as sid, a.pay_date as pay_date ,a.cashed as cashed,a.amount as amount,b.ledgername as ledgername, 2 as type,a.neft_reference_no as reference , 0 as acc_type ,0 as prdt_type ,a.purpose as purpose,bk.bankname as bankname
			FROM cf_voucher a
			LEFT JOIN cf_ledger b ON b.ledgerid = a.to LEFT JOIN cf_bank as bk ON bk.bank_id = a.transaction_bank where 1 ".$cond."
		
			UNION SELECT  a.journal_id as sid,a.pay_date as pay_date ,a.signed_by as cashed, a.amount as amount,b.ledgername as ledgername, 3 as type,a.journal_reference as reference , a.account_type as acc_type ,0 as prdt_type ,a.purpose as purpose,0 as bankname
			FROM cf_journal a 
			LEFT JOIN cf_ledger b ON b.ledgerid = a.credit or b.ledgerid = a.debit where b.ledgername!= 'NULL' ".$cond. "
			
			UNION SELECT  a.contra_id as sid,a.pay_date as pay_date ,a.signed_by as cashed, a.amount as amount,b.ledgername as ledgername, 4 as type,a.contra_reference as reference , a.account_type as acc_type ,0 as prdt_type ,a.purpose as purpose,0 as bankname FROM cf_contra a 
			LEFT JOIN cf_ledger b ON b.ledgerid = a.credit or b.ledgerid = a.debit where b.ledgername!= 'NULL' ".$cond. "
			
			UNION SELECT  a.pur_acc_id as sid,a.pay_date as pay_date ,a.signed_by as cashed, a.acc_amount as amount,b.ledgername as ledgername, 5 as type,a.account_reference as reference , a.account_type as acc_type , a.prdt_type as prdt_type ,a.purpose as purpose,0 as bankname FROM cf_purchase_account a 
			LEFT JOIN cf_ledger b ON b.ledgerid = a.ven_client_id where b.ledgername!= 'NULL' ".$cond. 
			
			
			
			"
			
			) k
order by k.pay_date,type,sid ASC
";
				
							
//echo $sq_arr_print;


$firstref='';
$Endref='';
$subtot_credit=0; 
$subtot_debit=0; 
$pagecnt=0;
$array=mysql_query($sq_arr_print);
if($array && mysql_num_rows($array)>0){

while($res=mysql_fetch_array($array))
{
	$pagecnt++;
		if($res['cashed'] !=0 )
		{
		
	  $outstr.= '<tr>
		<td>'.$pagecnt.'</td>
		<td>'.date('d-m-Y',strtotime($res['pay_date'])).'</td>
		<td>'.$res['ledgername'].'<span style="color:#990033">------:('.$res['purpose'].')</span></td>';
		if($res['type'] ==2 )
		{
			$cumulative_vouch = $res['amount'];
			$subtot_debit +=$cumulative_vouch;
		
		$outstr.= '<td>'.$cumulative_vouch.'</td>
		<td>0</td>';
		}
		if($res['type'] ==1 )
		{
			$cumulative_recp= $res['amount'];
			$subtot_credit +=$cumulative_recp;
		
		$outstr.= '<td>0</td>
		<td>'.$cumulative_recp.'</td>';
		 
		}
			
	  $outstr.= '</tr>
	  <tr>
		<td></td>
		<td></td>
		<td>'; 
		if($res['cashed'] ==1 )
		{
		$outstr.= 'Cash';
		}
		else
		{
		$outstr.= 'Bank--'.$res['bankname'];
		}
		$outstr.= '</td>';
		
		if($res['type'] ==2 )
		{
		$cumulative_vouch = $res['amount'];
		$subtot_credit +=$cumulative_vouch;
		
		$outstr.= '<td>0</td>
		<td>'.$cumulative_vouch.'</td>';
		}
		
		if($res['type'] ==1 )
		{
		$cumulative_recp= $res['amount'];
		$subtot_debit +=$cumulative_recp;
		
		$outstr.= '<td>'.$cumulative_recp.'</td>
		<td>0</td>'; 
		
		}
			
	  $outstr.= '</tr>';
	  }
	  else
	  {
		$firstref = $res['reference'];	
	 
		$outstr.= '<tr>
		<td>';
		if($firstref != $Endref){ $outstr.=$pagecnt;$pagecnt--;  } $outstr.= '</td>
		<td>';
		if($firstref != $Endref)
		{ 
			date('d-m-Y',strtotime($res['pay_date']));  
			$outstr.= $res['pay_date'];
		}
		$outstr.= '</td>
		<td>'.$res['ledgername'].''; if($res['purpose'] != ''){ $outstr.= '<span style="color:#990033">------:('.$res['purpose'].')</span>'; } $outstr.= '</td>
		<td>';
		$noval = 0;
		if($res['acc_type'] == 2){ $outstr.=$res['amount']; $subtot_debit +=$res['amount']; } else {  $outstr.=$noval;  
		} 
		$outstr.= '</td>
		<td>';
		if($res['acc_type'] == 1){ $outstr.=$res['amount']; $subtot_credit +=$res['amount'];} else {  $outstr.=$noval;
		} 
		$outstr.= '</td>';
		
			
		//$pagecnt-1;
		}
		$Endref = $res['reference'];

			
$i++;}
			
}
	 $outstr.= '<tr class="heading">
	 <td align="right"></td>
	 <td align="right"></td>
	 <td align="right">Total</td>
	 <td>'.$subtot_debit.'</td>
	 <td>'.$subtot_credit.'</td>
  	</tr>';
			
			$outstr.= ' </table>
		</div>'; 
			//echo $outstr;
				//exit;
				
			if ($handle = opendir('.')) {

    while (false !== ($entry = readdir($handle))) {

        if ($entry != "." && $entry != "..") {

             $ext = end(explode(".",$entry));
			if($ext=="xls" && startsWith($entry, "Export") === true)	
				
				unlink($entry);
        }
    }

    closedir($handle);
			}

				$fname = "Export".time().".xls";
				  $file = fopen($fname,"w+");
				  fwrite($file,$outstr);
				  fclose($file);
				  header('Location:'.$fname);
				  exit;
		}	
				
			if(isset($_POST['download']))
			{
				$selectype = "Day_book";
				$fromdate = $_POST['from_date'];
				$todate = $_POST['to_date'];
				
				
				print1($selectype,$fromdate,$todate);
			}	

?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OIL FILL</title>
<link href="css/styles.css" rel="stylesheet"  />

<link href="css/menu.css" rel="stylesheet" type="text/css" />
<style>
.newcategoryProfile{ background:#FFFFFF; position:absolute; width:400px; height:250px; z-index:5;
					-webkit-box-shadow: 0px 0px 35px 1px rgba(0,0,0,0.75);
					-moz-box-shadow: 0px 0px 35px 1px rgba(0,0,0,0.75);
					box-shadow: 0px 0px 35px 1px rgba(0,0,0,0.75);}


</style>
<link type="text/css" href="css_date/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="js/trippopup.js" type="text/javascript"></script>
<!----------------------------css for auto complete-------------------------------->
<link rel="stylesheet" href="css/chosen.css">

<!--end-->

<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />

<script type="text/javascript" src="scripts_date/jquery-calendar-1.7.2.js"></script>
<script language="javascript">

$(document).ready(function(){
$('#pay_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#add_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#cheque_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#from_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#to_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});


</script>
</head>

<body>
<!------------------popup area (view, edit)--------------->



<!---------------popup area ends------------------>
<div class="viewEmployeePopup login-popup"  id="login-box" style="height: 220px;width:500px;
overflow-x: scroll;">
    <a href="#" class="close">
    <img src="" class="btn_close" title="Close Window" alt="Close" />
    </a>
    <div id="view_emp"></div>
</div>
<div class="wrapper">
  <div>
<?php 
	include("header.php");
?>
 
</div>
 
 <div class="tabbedArea">
   
  <div class="tabBody">
   <h1>Day Book</h1>
   <form name="cashbook_frm" id="cashbook_frm" method="post"  >
   <div class="searchBox" style="width:93%; margin-right:0px;  padding:0px; ">
   <div align="left">
   <div style="padding:20px;">
    
    
    <div class="searchField">
     <p class="input1">From Date</p>
    		<input type="text" name="from_date" id="from_date"  class="slabinput input1" style="width:70px;" value="<?=$from_date?>" required="required"/></td>

    </div>
   
    <div class="searchField">
     <p class="input1">To Date</p>
    		<input type="text" name="to_date" id="to_date"  class="slabinput input1" style="width:70px;" value="<?=$to_date?>" required="required"/></td>

    </div>

    <div class="searchField">
    <input name="searchcashbook" type="submit" class="input1" value="search" />
    </div>
	
	<div class="searchField" style="padding-left:60px;margin-right: 20px;">
    <input name="download" type="submit" class="input1"  value="download" />
    </div>
  </div>
   </div>
   </div>
   </form>
      <div id="popup" align="center"  style="margin-left: 400px;"></div>
   <div id="list">
   
   
   <table  border="0" cellspacing="0" cellpadding="0" class="tableList">
   
     <?php
$i=1;

	
	  $sq_arr="SELECT a.*,b.ledgername as ledgername, 1 as type 
    FROM cf_reciept a
        LEFT JOIN cf_ledger b
            ON b.ledgerid = a.from where cashed=1 
UNION SELECT a.*,b.ledgername as ledgername, 2 as type 
    FROM cf_voucher a
        LEFT JOIN cf_ledger b
            ON b.ledgerid = a.to where cashed=1";





$cond='';
 $query=$sq_arr;
if(isset($_REQUEST['searchcashbook']) && $_REQUEST['searchcashbook']!='')
{
if(isset($_REQUEST['ledger_name']) && $_REQUEST['ledger_name']!=''){
$ledger_name=$_REQUEST['ledger_name'];
$cond.=" and   b.ledgername like '%".$ledger_name."%'";
}
if(isset($_REQUEST['from_date']) && $_REQUEST['from_date']!=''){
$from_date=date('Y-m-d',strtotime($_REQUEST['from_date']));
$cond.=" and   a.pay_date >= '$from_date'";
}
else
{
$from_date=date('Y-m-d');
$cond.=" and   a.pay_date >= '$from_date'";
}
if(isset($_REQUEST['to_date']) && $_REQUEST['to_date']!=''){
$to_date=date('Y-m-d',strtotime($_REQUEST['to_date']));
$cond.=" and   a.pay_date <= '$to_date'";
}
else
{
$to_date=date('Y-m-d');
$cond.=" and   a.pay_date <= '$to_date'";
}

}
else
{
if(isset($_REQUEST['from_date']) && $_REQUEST['from_date']!=''){
$from_date=date('Y-m-d',strtotime($_REQUEST['from_date']));
$cond.=" and   a.pay_date >= '$from_date'";
}
else
{
$from_date=date('Y-m-d');
$cond.=" and   a.pay_date >= '$from_date'";
}
if(isset($_REQUEST['to_date']) && $_REQUEST['to_date']!=''){
$to_date=date('Y-m-d',strtotime($_REQUEST['to_date']));
$cond.=" and   a.pay_date <= '$to_date'";
}
else
{
$to_date=date('Y-m-d');
$cond.=" and   a.pay_date <= '$to_date'";
}
}

$open_date='';$presentdate=date('Y-m-d',strtotime($from_date));

$sql="select * from tbl_openingbal where open_date<='".$presentdate."' and cashorbank = '1'";
$row=mysql_query($sql);
if($row && mysql_num_rows($row)>0){

while($rows=mysql_fetch_array($row))
{
$open_date=$rows['open_date'];
$open_amt=$rows['open_amt'];
}

}

/*if($open_date!='')
{
$balancesum="select sum(amount) as totalreciept from cf_reciept where cashed=1 and pay_date<'".$presentdate."' and pay_date >'".$open_date."' ";
}
else
{
$balancesum="select sum(amount) as totalreciept from cf_reciept where cashed=1 and pay_date<'".$presentdate."' ";
}
 $balancesum;
$balancesum_row=mysql_query($balancesum);
if($balancesum_row && mysql_num_rows($balancesum_row)>0){

while($balancesum_rows=mysql_fetch_array($balancesum_row))
{
$totalreciept=$balancesum_rows['totalreciept'];
}

}

if($open_date!='')
{
$balancesumvoucher="select sum(amount) as totalpayment from cf_voucher where cashed=1 and pay_date<'".$presentdate."' and pay_date >'".$open_date."' ";
}
else
{
$balancesumvoucher="select sum(amount) as totalpayment from cf_voucher where cashed=1 and pay_date<'".$presentdate."' ";
}

$balancesumvoucher_row=mysql_query($balancesumvoucher);
if($balancesumvoucher_row && mysql_num_rows($balancesumvoucher_row)>0){

while($balancesumvoucher_rows=mysql_fetch_array($balancesumvoucher_row))
{
$totalpayment=$balancesumvoucher_rows['totalpayment'];
}

}


$cumulative=$opening_balance=(($open_amt)+($totalreciept-$totalpayment));*/

?>
   
  <tr class="heading">
   <td>No</td>
    <td>Date</td>
	<td>Ledger Name</td>
	<td>Debit</td>
	<td>Credit</td>
  </tr>

<?php

 $sq_arr="select * from (SELECT  a.reciept_id as sid, a.pay_date as pay_date ,a.cashed as cashed,a.amount as amount,b.ledgername as ledgername, 1 as type,a.neft_reference_no as reference, 0 as acc_type ,0 as prdt_type ,a.purpose as purpose,bk.bankname as bankname
        FROM cf_reciept a
        LEFT JOIN cf_ledger b ON b.ledgerid = a.from LEFT JOIN cf_bank as bk ON bk.bank_id = a.transaction_bank where 1 ".$cond." 
		
			UNION SELECT a.voucher_id as sid, a.pay_date as pay_date ,a.cashed as cashed,a.amount as amount,b.ledgername as ledgername, 2 as type,a.neft_reference_no as reference , 0 as acc_type ,0 as prdt_type ,a.purpose as purpose,bk.bankname as bankname
			FROM cf_voucher a
			LEFT JOIN cf_ledger b ON b.ledgerid = a.to LEFT JOIN cf_bank as bk ON bk.bank_id = a.transaction_bank where 1 ".$cond."
		
			UNION SELECT  a.journal_id as sid,a.pay_date as pay_date ,a.signed_by as cashed, a.amount as amount,b.ledgername as ledgername, 3 as type,a.journal_reference as reference , a.account_type as acc_type ,0 as prdt_type ,a.purpose as purpose,0 as bankname
			FROM cf_journal a 
			LEFT JOIN cf_ledger b ON b.ledgerid = a.credit or b.ledgerid = a.debit where b.ledgername!= 'NULL' ".$cond. "
			
			UNION SELECT  a.contra_id as sid,a.pay_date as pay_date ,a.signed_by as cashed, a.amount as amount,b.ledgername as ledgername, 4 as type,a.contra_reference as reference , a.account_type as acc_type ,0 as prdt_type ,a.purpose as purpose,0 as bankname FROM cf_contra a 
			LEFT JOIN cf_ledger b ON b.ledgerid = a.credit or b.ledgerid = a.debit where b.ledgername!= 'NULL' ".$cond. "
			
			UNION SELECT  a.pur_acc_id as sid,a.pay_date as pay_date ,a.signed_by as cashed, a.acc_amount as amount,b.ledgername as ledgername, 5 as type,a.account_reference as reference , a.account_type as acc_type , a.prdt_type as prdt_type ,a.purpose as purpose,0 as bankname FROM cf_purchase_account a 
			LEFT JOIN cf_ledger b ON b.ledgerid = a.ven_client_id where b.ledgername!= 'NULL' ".$cond. 
			
			
			
			"
			
			) k
order by k.pay_date,type,sid ASC
";
			
//echo $sq_arr;
$function="Searchdate";
include("pagingserch.php");

if(isset($_REQUEST['page'])){
$page=$_REQUEST['page'];
}else{
$page=10;
}


/*$cumulative_vouch=0;
$cumulative_recp=0;*/
$firstref='';
$Endref='';
$subtot_credit=0; 
$subtot_debit=0; 
$array=mysql_query($sq_arr);
if($array && mysql_num_rows($array)>0){
$pagecnt=$start;
while($res=mysql_fetch_array($array))
{

$pagecnt++;

 
  	if($res['cashed'] !=0 )
	{
     ?> 
  <tr>
    <td><?php echo $pagecnt;?></td>
    <td><?php echo date('d-m-Y',strtotime($res['pay_date']));?></td>
	<td><?php echo $res['ledgername']?><span style="color:#990033">------:(<?php echo $res['purpose']?> )</span></td>
	<?php if($res['type'] ==2 )
	{
		$cumulative_vouch = $res['amount'];
		$subtot_debit +=$cumulative_vouch;
	?>
    <td><?php echo $cumulative_vouch; ?></td>
	<td>0</td>
	<?php
	
	}
	 ?>
	<?php if($res['type'] ==1 )
	{
		$cumulative_recp= $res['amount'];
		$subtot_credit +=$cumulative_recp;
	?>
	<td>0</td>
    <td><?php echo $cumulative_recp;?></td>
	 
	<?php
	}
	?>	
  </tr>
  

  
   <tr>
    <td></td>
    <td></td>
	<td><?php 
	if($res['cashed'] ==1 )
	{
	echo "Cash";}else{echo "Bank"; echo "--"; echo $res['bankname'];  }?></td>
	<?php if($res['type'] ==2 )
	{
	$cumulative_vouch = $res['amount'];
	$subtot_credit +=$cumulative_vouch;
	?>
	<td>0</td>
    <td><?php echo $cumulative_vouch;?></td>
	
	<?php	
	}
	
	?>
	<?php if($res['type'] ==1 )
	{
	$cumulative_recp= $res['amount'];
	$subtot_debit +=$cumulative_recp;
	?>
	
    <td><?php echo $cumulative_recp;?></td>
	<td>0</td> 
	<?php
	}
	 ?>
		
  </tr>
  
  
  <?php
  }
  else
  {
  	$firstref = $res['reference'];
	
  ?>  
  	<tr>
    <td><?php if($firstref != $Endref){ echo $pagecnt;$pagecnt--;  } ?></td>
    <td><?php if($firstref != $Endref){ echo date('d-m-Y',strtotime($res['pay_date']));;  }?></td>
	<td><?php echo $res['ledgername'] ; if($res['purpose'] != ''){?><span style="color:#990033">------:(<?php echo $res['purpose']?> )</span><?php } ?></td>
	<td><?php if($res['acc_type'] == 2){ echo $res['amount']; $subtot_debit +=$res['amount']; } else { echo "0";  } ?></td>
    <td><?php if($res['acc_type'] == 1){ echo $res['amount']; $subtot_credit +=$res['amount'];} else { echo "0"; } ?></td>
	
	<?php	
	//$pagecnt-1;
	}
	$Endref = $res['reference'];
	?>
	
		
  </tr>
  <?php 
  //if($firstref != $Endref){ $pagecnt++;  } 
	

    }
	
	} 
  ?>
    <tr class="heading">
	 <td align="right"></td>
	 <td align="right"></td>
	 <td align="right">Total</td>
	 <td><?=$subtot_debit?></td>
	 <td><?=$subtot_credit?></td>
  	</tr>

</table>

  <div align="right" style="padding-top:10px;"><?=$pagination?></div> 
  </div>
  </div>
 </div>
 <div class="footer"><p>Powered by <a href="http://www.aadhocc.com/" target="_blank">Aadhocc</a></p></div>
 
</div>
<?php /*?><div class="quicLInksCover">
 <?php 
	include("leftlink.php");
?>

</div><?php */?>
</body>
<!----------------------- script for autocomplete------------------------------>
		<script src="js/chosen.jquery.min.js" type="text/javascript">
		</script>
		<script type="text/javascript"> 
			$(".chzn-select").chosen({search_contains: true}); 
		</script>

<!----------------end of script -------------------------------->

</html>
