<?php include "header.php"; 
$btnSave=$_POST['btnSave'];
$payment_type=$_POST['payment_type'];
$vtype=$_POST['vtype'];
$id=$_POST['id'];
$partyname=$_POST['party_id'];
$paydate=$_POST['date'];
$vno=$_POST['vno'];
$camount=$_POST['camount'];
$chequeamount=$_POST['chequeamount'];
$bank_name=$_POST['bank_name'];
$chequeno=$_POST['chequeno'];
$chequedate=$_POST['chequedate'];
$branch_name=$_POST['branch_name'];
$payment_type=$_POST['payment_type'];
$vtype=$_POST['vtype'];
$remarks=$_POST['remarks'];
$create_date=$_POST['create_date'];
$create_time=$_POST['create_time'];
$create_by=$_POST['create_by'];
if($login_type=='admin'){

if($btnSave=='Add Record'){
$query = "INSERT INTO `voucher` (`id`, `partyname`, `paydate`, `vno`, `camount`, `chequeamount`, `bank_name`, `chequeno`, `chequedate`, `branch_name`, `payment_type`, `vtype`, `remarks`, `create_date`, `create_time`, `create_by`,`code`,`session`) VALUES ('$id', '$partyname', '$paydate', '$vno', '$camount', '$chequeamount', '$bank_name', '$chequeno', '$chequedate', '$branch_name', '$payment_type', '$vtype', '$remarks', '$create_date', '$create_time', '$create_by','$code','$session');";
  mysql_query( $query )
 or die ( "Couldn't add data to \"application\" table: " 
 .mysql_error() );
print "<div>Data Save [ ". mysql_affected_rows() .
" row(s) ] Successfully </div>";
?>
<script type="text/javascript">
         <!--
            function Redirect() {
               window.location="create_voucher.php";
            }
            
            document.write("<h1>You will be redirected to main page in 10 sec.</h1>");
            setTimeout('Redirect()', 1000);
         //-->
      </script>
<?PHP
}






?>



<script language='JavaScript'>

function validate()
{
	conf = confirm("Are you sure you want to delete?");
	if (conf)
		return true
	else
		return false;
}

</script>
 <div id="page-wrapper">

            <div class="row">
                <!-- Page Header -->
                <div class="col-lg-12">
                    <h1 class="page-header">Create Voucher</h1>
	
    
    <br>
    <br>
<table width="100%" border="0" cellspacing="2" cellpadding="2" background="images/co-surgeons.jpg">
  <tr>
    <td><div align="center"><a href="welcome-home.php?title=Dashboard"><img src="images/back.gif" alt="" boarder="0" /> Back</a></div></td>
  </tr>
  
  <tr>
    <td><?php

$result88 = mysql_query("SELECT * FROM voucher where session='$session' and code='$code' ORDER BY id DESC LIMIT 1");
$id77=mysql_result($result88,$i,"id");
$partyname77=mysql_result($result88,$i,"partyname");
$paydate77=mysql_result($result88,$i,"paydate");
$vno77=mysql_result($result88,$i,"vno");
$camount77=mysql_result($result88,$i,"camount");
$chequeamount77=mysql_result($result88,$i,"chequeamount");
$bank_name77=mysql_result($result88,$i,"bank_name");
$chequeno77=mysql_result($result88,$i,"chequeno");
$chequedate77=mysql_result($result88,$i,"chequedate");
$branch_name77=mysql_result($result88,$i,"branch_name");
$payment_type77=mysql_result($result88,$i,"payment_type");
$vtype77=mysql_result($result88,$i,"vtype");
$remarks77=mysql_result($result88,$i,"remarks");
$create_date77=mysql_result($result88,$i,"create_date");
$create_time77=mysql_result($result88,$i,"create_time");
$create_by77=mysql_result($result88,$i,"create_by");

?> <script language="javascript" type="text/javascript">
<!--
function popitup(url) {
	newwindow=window.open(url,'name4','height=600,width=1200');
	if (window.focus) {newwindow.focus()}
	return false;
}

// -->
</script><a href="print_v.php?id=<?php echo $vno77; ?>" onclick="return popitup('print_v.php?id=<?php echo $vno77; ?>')">
<table width="100%" border="1" cellspacing="1" cellpadding="1" class="table table-bordered table-striped">
  <tr>
    <td><div align="center" class="style4">ID</div></td>
    <td><div align="center" class="style4">Vendor Code</div></td>
    <td><div align="center" class="style4">Pay Date</div></td>
    <td><div align="center" class="style4">Voucher No</div></td>
    <td><div align="center" class="style4">Amt-Cash</div></td>
    <td><div align="center" class="style4">Amt-Cheque</div></td>
    <td><div align="center" class="style4">Bank Name</div></td>
    <td><div align="center" class="style4">Cheque No</div></td>
    <td><div align="center" class="style4">Cheque Date</div></td>
    <td><div align="center" class="style4">Branch Name</div></td>
    <td><div align="center" class="style4">Payment Type </div></td>
    <td><div align="center" class="style4">Voucher Type</div></td>
    <td><div align="center" class="style4">Remarks</div></td>
    <td><div align="center" class="style4">Created </div></td>
    <td><div align="center" class="style4">Feed By</div></td>
    </tr>
  <tr>
    <td><div align="center" class="style4"><?php echo $id77; ?></div></td>
    <td><div align="center" class="style4"><?php echo $partyname77; ?></div></td>
    <td><div align="center" class="style4"><?php echo $paydate77; ?></div></td>
    <td>
   
   
   <div align="right" class="style5"><span class="color2"><?php echo $vno77; ?></span> </div>    </td>
    <td><div align="center" class="style5"><strong><?php echo $camount77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $chequeamount77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $bank_name77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $chequeno77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $chequedate77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $branch_name77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $payment_type77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $vtype77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $remarks77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $create_date77; ?>/<?php echo $create_time77; ?></strong></div></td>
    <td><div align="center" class="style5"><strong><?php echo $create_by77; ?></strong></div></td>
    </tr>
</table>
</a></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="2" cellpadding="2" class="table table-bordered table-striped">
  <tr>
    <td valign="top" bgcolor="#00CCCC" align="center">
    <form action="print_v.php" enctype="multipart/form-data" method="get" target="_blank">
    Print Voucher<input name="id" type="text" value="" placeholder='Voucher No'/><input type="submit" name="submit" value="submit" />
    </form>
    </td>

   
  </tr><tr>
    <td valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="2" >
  <tr>
    
    <td width="50%" valign="top" align="center"><div align="center">
    
      <form name="form1" action="create_voucher.php" method="post"  class="form-horizontal" role="form">
      <input class="Input" name="create_date" type="hidden"   value="<?php echo date('Y-m-d');	?>"  />
      <input class="Input" name="create_time" type="hidden"    value="<?php echo date('h-i-s A');  ?>" />
      <input class="Input" name="create_by" type="hidden"  value="<?php echo $login_session;  ?>"  />
	  <table cellpadding=2 cellspacing=0 border=1 bordercolor=#FFFFCC <?php if($vtype=='Credit'){
				  ?>style="background-color:#00FF33"<?php } ?><?php if($vtype=='Debit'){
				  ?>style="background-color:#FF3300"<?php } ?> align=center width="80%" class="table table-bordered table-striped">
				
		<tr>
		  <td colspan="2" bgcolor="#990000" class=color3 style="color:#">Create Voucher</td>
		  </tr>
		<tr>
		  <td colspan="2" class=color3><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><div align="center"></div></td>
            </tr>
            <tr>
              <td><table width="100%" border="0" cellspacing="0" cellpadding="0" >
                <tr>
                  <td width="22%"><div align="left">Date : 
                    
                    <input type="text" name="date" id="date" value="<?php echo date('Y-m-d');	?>"  style="width:100px;" />
                  </div></td>
                  <td width="30%"><div align="center"> Voucher Type- 
                    <select name="vtype" required="required" onchange='this.form.submit()'>
                    <option value="">Select</option>
                              <option <?php 
				
				 if($vtype=='Credit'){
				  ?>selected<?php } ?> value="Credit">Credit</option>
                              <option <?php 
				
				 if($vtype=='Debit'){
				  ?>selected<?php } ?> value="Debit">Debit</option>
                              </select>
                  </div></td>
                  <td width="22%"><div align="right">Payment Type- 
                    <select name="payment_type" required="required" onchange='this.form.submit()'>
                    <option value="">Select</option>
                      <option <?php 
				
				 if($payment_type=='Cash'){
				  ?>selected<?php } ?> value="Cash">Cash</option>
                      <option <?php 
				
				 if($payment_type=='Cheque'){
				  ?>selected<?php } ?> value="Cheque">Cheque</option>
                    </select>
                  </div></td>
                  <td width="26%"><div align="right">No.
                    <?php	
$query = "SELECT * FROM voucher where code='$code' ORDER BY ID asc";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");
?> 
                    
                        <?php
		  $counter = 1;
while ( $a_roww = mysql_fetch_row( $result ) )
 {?>
                             <?php $time=$a_roww[3];?>
                           <?php
		  $counter++; 
		  }
		  $time=++$time;
		  
		  ?>
                      <input type="text" name="vno" id="vno" value="<?php echo $time; ?>"  style="width:100px;"/>                    
                  </div></td>
                </tr>
                <tr>
                  <td colspan="4">&nbsp;</td>
                  </tr>
              </table></td>
            </tr>
          </table></td>
		  </tr>
		<tr>
          <td width="116" class=color3>Party Name</td>
		  <td width="190" class=color2> <?php
							//echo $code;
$queryy = "SELECT * FROM party where code='$code' order by id";
$numresultsy=mysql_query($queryy);
$resulty= mysql_query($queryy) or die("Couldn't execute query");
?>
              <select name="party_id" id="party_id"  required>
                <option value="">Select</option>
                <?php
while ( $a_roww = mysql_fetch_row( $resulty ) )
 {?>
                <option value="<?php echo $a_roww[0];?>" >( <?php echo $a_roww[0];?> ) <?php echo $a_roww[1];?>/<?php echo $a_roww[2];?>/<?php echo $a_roww[3];?>/<?php echo $a_roww[4];?>/<?php echo $a_roww[5];?>/<?php echo $a_roww[6];?></option>
                <?php } ?>
            </select>        </td>
		  </tr>
          <?php 
				
				 if($payment_type=='Cash'){
				  ?>
          <td class="color3">Cash Amount</td>
		  <td class="color2"><input type="text" name="camount" id="camount" /></td>
		  </tr>
         <?php } ?>
         <?php 
				
				 if($payment_type=='Cheque'){
				  ?>
		<tr>
		<tr>
          <td class=color3> Cheque Amount</td>
		  <td class=color2><input type="text" name="chequeamount" id="chequeamount" required /></td>
		  </tr>
		<tr>
		  <td class=color3>Bank Name</td>
		  <td class=color2><input type="text" name="bank_name" id="bank_name" required/></td>
		</tr>
        <tr>
          <td class=color3>Cheque No</td>
          <td class=color2><input type="text" name="chequeno" id="chequeno" required/></td>
        </tr>
        <tr>
          <td class=color3>Cheque Date</td>
          <td class=color2><input type="text" name="chequedate" id="chequedate" required/></td>
        </tr>
        <tr>
          <td class=color3>Branch Name</td>
          <td class=color2><input type="text" name="branch_name" id="branch_name" required/></td>
        </tr><?php } ?>
        <tr>
          <td class=color3>Remarks</td>
          <td class=color2><textarea name="remarks" id="remarks" cols="45" rows="5"></textarea></td>
        </tr>
        <tr> 
			<td class=color3></td>
			<td class=color2><input type="submit" name="btnSave" value="Add Record"  class="btn btn-info" ></td>
		</tr>
	</table>
</form></div></td>

  </tr>
  <tr>
    <td valign="top" align="center" bgcolor="#00FF00">
    <table width="100%" border="2" cellspacing="0" cellpadding="0" class="table table-bordered table-striped">
  <tr>
    <td width="50%" bgcolor="#006600"><span class="style3">Cash Credit Details</span></td>
  </tr>
  <tr>
    <td valign="top"><?php
	 $rf=date('Y-m-d');
$query = "SELECT * FROM voucher where camount!='' and create_date LIKE '%$rf%' and vtype='Credit'  and code='$code' ORDER BY vtype";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");


?>
<div style="overflow:auto; text-align:center">

<?php if($numrows!=""){?>
<table  cellpadding="1" border="1" cellspacing="1" bgcolor="#" align="center" width="100%" class="table table-bordered table-striped">
  <tr>
    <td width="5%" align="center" valign="top" bgcolor="#0000FF" class="border"><div align="center" style="font-size:12px; color:#"  >
      <div align="right"><em><strong>S.</strong></em></div>
    </div></td>
    <td width="6%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">V.NO</div></td>
    <td width="18%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Cash Amount</div></td>
    <td width="35%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Payment Type</div></td>
    <td width="19%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Voucher Type</div></td>
    <td width="17%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Create Date</div></td>
  </tr>
  <?php 
$counter = 1;?>
  <?php
while ( $a_row = mysql_fetch_row( $result ) )
 {?>
  <tr>
    <td height="20" align="center" valign="top" ><div align="center" style="font-size:12px;">
      <div align="right"><?php echo $counter;?></div>
    </div></td>
    <td align="center" valign="top" ><script language="javascript" type="text/javascript">
<!--
function popitup(url) {
	newwindow=window.open(url,'name4','height=600,width=1200');
	if (window.focus) {newwindow.focus()}
	return false;
}

// -->
</script><a href="print_v.php?id=<?php echo $a_row[3]; ?>" onclick="return popitup('print_v.php?id=<?php echo $a_row[3]; ?>')">
   
   <div align="right"><span class="color2"><?php echo $a_row[3]; ?></span> </div></a></td>
    <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[4]; ?></span> </div></td>
    <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[10]; ?></span> </div></td>
    <td bordercolor="#FFFFCC" ><div align="right"><?php echo $a_row[11]; ?></div></td>
    <td bordercolor="#FFFFCC" ><div align="right"><?php echo $a_row[13]; ?>-<?php echo $a_row[14]; ?> </div></td>
  </tr>
  <?php $counter++;
  $camount+=$a_row[4];
  
  }?>
  <tr>
    <td height="20" colspan="2" align="center" valign="top" bgcolor="#CCCCCC" ><div align="right">G.Total</div>      <div align="right"></div></td>
    <td align="center" valign="top" bgcolor="#CCCCCC" ><div align="right"><?php echo $camount; ?></div></td>
    <td align="center" valign="top" bgcolor="#CCCCCC" ><div align="right"></div></td>
    <td bordercolor="#FFFFCC" bgcolor="#CCCCCC" class=color2><div align="right"></div></td>
    <td bordercolor="#FFFFCC" bgcolor="#CCCCCC" class=color2><div align="right"></div></td>
  </tr>
</table>
</div>
   <?php }?>

<?php if($numrows==""){
  echo "<div  style='border:none; text-align:center'><h3 class='logo2'>No Record Found</h3></div>";
}?></td>
  </tr>
  <tr>
    <td bgcolor="#006600"><span class="style3">Cheque Credit Details - Credit</span></td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top"><?php
	 
$query = "SELECT * FROM voucher where chequeamount!='' and create_date LIKE '%$rf%' and vtype='Credit' and code='$code' ORDER BY vtype";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");


?>
<div style="overflow:auto; text-align:center">

<?php if($numrows!=""){?>
   <table  cellpadding="1" border="1" cellspacing="1" bgcolor="#" align="center" style="width:100%" class="table table-bordered table-striped">
 <tr>
	
 <td width="57" align="center" valign="top" bgcolor="#0000FF" class="border"><div align="center" style="font-size:12px; color:#"  >
   <div align="right"><em><strong>S.</strong></em></div>
 </div></td>
  <td width="78" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">V.No</div></td>
 
  <td width="227" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Cheque Amount</div></td>
  <td width="300" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Bank Details</div></td>
  <td width="119" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Payment Type</div></td>
  <td width="246" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Voucher Type</div></td>
  <td width="205" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Create Date</div></td>
  </tr>
<?php 
$counter = 1;?>
 <?php
while ( $a_row = mysql_fetch_row( $result ) )
 {?>
 
 

 <tr>
 <td height="20" align="center" valign="top" ><div align="center" style="font-size:12px;">
   <div align="right"><?php echo $counter;?></div>
 </div></td>
 <td align="center" valign="top" ><script language="javascript" type="text/javascript">
<!--
function popitup(url) {
	newwindow=window.open(url,'name4','height=600,width=1200');
	if (window.focus) {newwindow.focus()}
	return false;
}

// -->
</script><a href="print_v.php?id=<?php echo $a_row[3]; ?>" onclick="return popitup('print_v.php?id=<?php echo $a_row[3]; ?>')">
   
   <div align="right"><span class="color2"><?php echo $a_row[3]; ?></span> </div></a></td>
 
 <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[5]; ?></span></div></td>
 <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[6]; ?></span>
   / 
   <span class="color2"><?php echo $a_row[7]; ?></span>
   / 
   <span class="color2"><?php echo $a_row[8]; ?></span>
   /
   <span class="color2"><?php echo $a_row[9]; ?></span>
 </div></td>
 <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[10]; ?></span> </div></td>
 <td bordercolor="#FFFFCC" class="color2"><div align="right"><?php echo $a_row[11]; ?></div></td>
 <td bordercolor="#FFFFCC" class="color2"><div align="right"><?php echo $a_row[13]; ?>
     <?php echo $a_row[14]; ?> </div></td>
 </tr>



   
  <?php $counter++;
  $camountt+=$a_row[5];
  }?> <tr>
   <td height="20" colspan="2" align="center" valign="top" bgcolor="#999999" ><div align="right">G.Total</div>     <div align="right"></div></td>
   <td align="center" valign="top" bgcolor="#999999" ><div align="right"><?php echo $camountt; ?></div></td>
   <td align="center" valign="top" bgcolor="#999999" ><div align="right"></div></td>
   <td align="center" valign="top" bgcolor="#999999" ><div align="right"></div></td>
   <td bordercolor="#FFFFCC" bgcolor="#999999" class="color2"><div align="right"></div></td>
   <td bordercolor="#FFFFCC" bgcolor="#999999" class="color2"><div align="right"></div></td>
 </tr>
  </table>
</div>
   <?php }?>

<?php if($numrows==""){
  echo "<div  style='border:none; text-align:center'><h3 class='logo2'>No Record Found</h3></div>";
}?></td>
  </tr>
</table>

    
    </td>
  </tr>
  
    <tr>
    <td valign="top" align="center" bgcolor="#FF6633">
    <table width="100%" border="2" cellspacing="0" cellpadding="0" class="table table-bordered table-striped">
  <tr>
    <td width="50%" bgcolor="#FF0000"><span class="style3">Cash Payment Details - Debit</span></td>
  </tr>
  <tr>
    <td valign="top"><?php
	 $rf=date('Y-m-d');
$query = "SELECT * FROM voucher where camount!='' and create_date LIKE '%$rf%' and vtype='Debit' and code='$code' ORDER BY vtype";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");


?>
<div style="overflow:auto; text-align:center">

<?php if($numrows!=""){?>
<table  cellpadding="1" border="1" cellspacing="1" bgcolor="#" align="center" width="100%" class="table table-bordered table-striped">
  <tr>
    <td width="5%" align="center" valign="top" bgcolor="#0000FF" class="border"><div align="center" style="font-size:12px; color:#"  >
      <div align="right"><em><strong>S.</strong></em></div>
    </div></td>
    <td width="6%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">V.NO</div></td>
    <td width="18%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Cash Amount</div></td>
    <td width="35%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Payment Type</div></td>
    <td width="19%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Voucher Type</div></td>
    <td width="17%" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Create Date</div></td>
  </tr>
  <?php 
$counter = 1;?>
  <?php
while ( $a_row = mysql_fetch_row( $result ) )
 {?>
  <tr>
    <td height="20" align="center" valign="top" ><div align="center" style="font-size:12px;">
      <div align="right"><?php echo $counter;?></div>
    </div></td>
    <td align="center" valign="top" ><script language="javascript" type="text/javascript">
<!--
function popitup(url) {
	newwindow=window.open(url,'name4','height=600,width=1200');
	if (window.focus) {newwindow.focus()}
	return false;
}

// -->
</script><a href="print_v.php?id=<?php echo $a_row[3]; ?>" onclick="return popitup('print_v.php?id=<?php echo $a_row[3]; ?>')">
   
   <div align="right"><span class="color2"><?php echo $a_row[3]; ?></span> </div></a></td>
    <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[4]; ?></span> </div></td>
    <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[10]; ?></span> </div></td>
    <td bordercolor="#FFFFCC" ><div align="right"><?php echo $a_row[11]; ?></div></td>
    <td bordercolor="#FFFFCC" ><div align="right"><?php echo $a_row[13]; ?>-<?php echo $a_row[14]; ?> </div></td>
  </tr>
  <?php $counter++;
  $camount+=$a_row[4];
  
  }?>
  <tr>
    <td height="20" colspan="2" align="center" valign="top" bgcolor="#CCCCCC" ><div align="right">G.Total</div>      <div align="right"></div></td>
    <td align="center" valign="top" bgcolor="#CCCCCC" ><div align="right"><?php echo $camount; ?></div></td>
    <td align="center" valign="top" bgcolor="#CCCCCC" ><div align="right"></div></td>
    <td bordercolor="#FFFFCC" bgcolor="#CCCCCC" class=color2><div align="right"></div></td>
    <td bordercolor="#FFFFCC" bgcolor="#CCCCCC" class=color2><div align="right"></div></td>
  </tr>
</table>
</div>
   <?php }?>

<?php if($numrows==""){
  echo "<div  style='border:none; text-align:center'><h3 class='logo2'>No Record Found</h3></div>";
}?></td>
  </tr>
  <tr>
    <td bgcolor="#FF0000"><span class="style3">Cheque Payment Details - Debit</span></td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top"><?php
	 
$query = "SELECT * FROM voucher where chequeamount!='' and create_date LIKE '%$rf%'  and vtype='Debit' and code='$code' ORDER BY vtype";
$numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);
$result = mysql_query($query) or die("Couldn't execute query");


?>
<div style="overflow:auto; text-align:center">

<?php if($numrows!=""){?>
   <table  cellpadding="1" border="1" cellspacing="1" bgcolor="#" align="center" style="width:100%" class="table table-bordered table-striped">
 <tr>
	
 <td width="57" align="center" valign="top" bgcolor="#0000FF" class="border"><div align="center" style="font-size:12px; color:#"  >
   <div align="right"><em><strong>S.</strong></em></div>
 </div></td>
  <td width="78" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">V.No</div></td>
 
  <td width="227" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Cheque Amount</div></td>
  <td width="300" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Bank Details</div></td>
  <td width="119" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Payment Type</div></td>
  <td width="246" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Voucher Type</div></td>
  <td width="205" align="center" valign="top" bgcolor="#0000FF" class="style1" style="font-size:12px; color:#"><div align="right">Create Date</div></td>
  </tr>
<?php 
$counter = 1;?>
 <?php
while ( $a_row = mysql_fetch_row( $result ) )
 {?>
 
 

 <tr>
 <td height="20" align="center" valign="top" ><div align="center" style="font-size:12px;">
   <div align="right"><?php echo $counter;?></div>
 </div></td>
 <td align="center" valign="top" ><script language="javascript" type="text/javascript">
<!--
function popitup(url) {
	newwindow=window.open(url,'name4','height=600,width=1200');
	if (window.focus) {newwindow.focus()}
	return false;
}

// -->
</script><a href="print_v.php?id=<?php echo $a_row[3]; ?>" onclick="return popitup('print_v.php?id=<?php echo $a_row[3]; ?>')">
   
   <div align="right"><span class="color2"><?php echo $a_row[3]; ?></span> </div></a></td>
 
 <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[5]; ?></span></div></td>
 <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[6]; ?></span>
   / 
   <span class="color2"><?php echo $a_row[7]; ?></span>
   / 
   <span class="color2"><?php echo $a_row[8]; ?></span>
   /
   <span class="color2"><?php echo $a_row[9]; ?></span>
 </div></td>
 <td align="center" valign="top" ><div align="right"><span class="color2"><?php echo $a_row[10]; ?></span> </div></td>
 <td bordercolor="#FFFFCC" class="color2"><div align="right"><?php echo $a_row[11]; ?></div></td>
 <td bordercolor="#FFFFCC" class="color2"><div align="right"><?php echo $a_row[13]; ?>
     <?php echo $a_row[14]; ?> </div></td>
 </tr>



   
  <?php $counter++;
  $camountt+=$a_row[5];
  }?> <tr>
   <td height="20" colspan="2" align="center" valign="top" bgcolor="#999999" ><div align="right">G.Total</div>     <div align="right"></div></td>
   <td align="center" valign="top" bgcolor="#999999" ><div align="right"><?php echo $camountt; ?></div></td>
   <td align="center" valign="top" bgcolor="#999999" ><div align="right"></div></td>
   <td align="center" valign="top" bgcolor="#999999" ><div align="right"></div></td>
   <td bordercolor="#FFFFCC" bgcolor="#999999" class="color2"><div align="right"></div></td>
   <td bordercolor="#FFFFCC" bgcolor="#999999" class="color2"><div align="right"></div></td>
 </tr>
  </table>
</div>
   <?php }?>

<?php if($numrows==""){
  echo "<div  style='border:none; text-align:center'><h3 class='logo2'>No Record Found</h3></div>";
}?></td>
  </tr>
</table>

    
    </td>
  </tr>
</table></td>

   
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td align="center">
</td>
  </tr>
  <tr>
    <td></td>
  </tr>
</table>
</div></div></div>
<?php }
include "footer.php"; ?>