<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Deposited Cheque</title>
<link rel="stylesheet" href="css/table_min.css" type="text/css"/>	
</head>

<body>
<div class="CSSTableGenerator" id="chq_table1" >
    <?php
    $dateFilterOff = $_GET['dateFilterOff'];
    if ($_GET['dateFilterOff'] != 'true') {
        $txthead = "from ".$_GET['from'] . " to " . $_GET['to'];
    }
    $txthead .= " for ".$_GET["company"];
    echo "<center><span class=\"style1\">Deposited Cheques " . $txthead . "</span></center><br>";
    ?>
<table width="1000" border="0">
  <tr>
    <td>Cheque No</td>
    <td>Ref No</td>
    <td>Cheque Date</td>
    <td>Cheque Amount</td>
    <td>Bank</td>
    <td>Customer</td>
  </tr>
  <?php
  include('connectioni.php');
    
    $phrase = "";
    if ($_GET['dateFilterOff'] != 'true') {
        $phrase .= " and che_date between '" . $_GET['from'] . "' and '" . $_GET['to'] . "' ";
    }
    if ($_GET['company'] != 'All') {
        $phrase .= " and ret_refno like 'PT" .$_GET["company"] ."%'";
    }
    
    $sql="select cheque_no, che_amount, che_date, bank, refno, CUS_NAME, cus_code, ID, ret_refno  from s_invcheq where ret_refno!='0' and ret_refno!='1' $phrase ORDER BY che_date desc ";
    //echo $sql;
    $stname = $_GET["stname"];
    $result=mysqli_query($GLOBALS['dbinv'],$sql);
    
    $che_amount = 0;
    
    while($row = mysqli_fetch_array($result)){
            $cuscode = $row["ID"];
								
								
							echo "<tr>               
                              <td>".$row['cheque_no']."</a></td>
							  <td>".$row['ret_refno']."</a></td>
                              <td>".$row['che_date']."</a></td>
                         	  <td>".$row['che_amount']."</a></td>
							  <td>".$row['bank']."</a></td>
							  <td>".$row['cus_code']." ".$row['CUS_NAME']."</a></td>";
							                               
                            echo "</tr>";
							
                            $che_amount = $che_amount + $row['che_amount'];
    }
    echo "<tr><td colspan=3></td><td><b>" . number_format($che_amount, 2, ".", ",") . "</b></td><td colspan=2></td></tr>";
  ?>
</table>
</div>
</body>
</html>
