<?php  include "layouts/menu.php"; ?>
 
        <div class="right_col" role="main">
          <div class="">


            <div class="clearfix"></div>

            <div class="clearfix"></div>

            <div class="row">
       <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2> Other Entry Details . . . </h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                        <ul class="dropdown-menu" role="menu">
                          <li><a href="#">Settings 1</a>
                          </li>
                          <li><a href="#">Settings 2</a>
                          </li>
                        </ul>
                      </li>
                      <li><a class="close-link"><i class="fa fa-close"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
				        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post"  enctype="multipart/form-data">
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label thicker" >Enter From Date</label>
    <div class="col-sm-4">
    <input type="date" class="form-control thicker" id="datepicker" name="fdate" value="<?php echo date("Y-m-d"); ?>" placeholder="DD/MM/YYYY" onfocus="insertDate(this,'DD-MM-YYYY')">
    </div>
  </div>
  <div class="form-group">
     <label for="inputPassword3" class="col-sm-2 control-label thicker" >Enter To Date</label>
    <div class="col-sm-4">
    <input type="date" class="form-control thicker" id="datepicker" name="tdate" value="<?php echo date("Y-m-d"); ?>" placeholder="DD/MM/YYYY" onfocus="insertDate(this,'DD-MM-YYYY')">
    </div>
  </div>
   <div class="form-group">
     <label for="inputPassword3" class="col-sm-2 control-label thicker" >Agent</label>
    <div class="col-sm-4">
    <select type="text" class="form-control thicker" id="fg" name="agent" value="" >
	<option>All</option>
	<?php $sql = mysqli_query($conn, "select * from customer");
	while($row33 = mysqli_fetch_array($sql)) { ?>
	<option><?php echo $row33['name']; ?></option>
	<?php } ?> </select>
    </div>
  </div>
	<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary" name="s15">Show Now</button>
    </div>
  </div>
                  </div>
                </div>
              </div>
              
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title" >
                    <h2>Customer Details <small></small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                        <ul class="dropdown-menu" role="menu">
                          <li><a href="#">Settings 1</a>
                          </li>
                          <li><a href="#">Settings 2</a>
                          </li>
                        </ul>
                      </li>
                      <li><a class="close-link"><i class="fa fa-close"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <div class="row">
                      <div class="col-sm-12">
                        <div class="card-box table-responsive">
                          
                                        <?php
		
								if(isset($_POST['s15']))
								{
									extract($_POST);
								$bal = 0; $a22 = 0; ?>
						
  <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">                            <thead>
                             <tr>
						<th>S.No</th>
						<th>Post Date</th>
						<th>Post Type</th>
						<th>Agent</th>
						
						
						<th>Post Amt</th>
						<th>HPL</th>
						<th>Regn No.</th>
						<th>Party Name</th>
						<th>Result</th>
						<th>Remark</th>
						<th>-</th>
					</tr>
                            </thead>
                           <tbody>			
					<?php $damt = 0; $pass = 0; $rno = 0; $fine = 0; $urname = 0; $hll = 0;
				///	while (strtotime($fdate) <= strtotime($tdate)) 
						//		{  
					$paydate = $fdate;
					$i =0;
if($agent=='All') {					
$qry=mysqli_query($conn, "select * from otherentry where mfin='$mfin' && postdate2 between '$fdate' AND '$tdate'");
$qry22=mysqli_query($conn, "select sum(postamt2) from otherentry where mfin='$mfin' && postdate2 between '$fdate' AND '$tdate'");
}
else {
	$qry=mysqli_query($conn, "select * from otherentry where mfin='$mfin' && agentname='$agent' && postdate2 between '$fdate' AND '$tdate'");
$qry22=mysqli_query($conn, "select sum(postamt2) from otherentry where mfin='$mfin' && agentname='$agent' && postdate2 between '$fdate' AND '$tdate'");
}
$row22=mysqli_fetch_array($qry22);
$tott = $row22[0];

				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{ $i++;
?>				<tr>
					
						<td><?php echo $i;?></td>
						<td><?php echo $row['postdate2'];?></td>
						<td>-</td>
						<td><?php echo $row['agentname'];?></td>
						
						<td><?php echo $row['postamt2'];?></td>
						<td><?php echo $row['hpl'];?></td>
						<td>-</td>		<td><?php echo $row['name'];?></td>
						<td><?php echo $row['result'];?></td>
					
						<td><?php echo $row['remark'];?></td>
					<td>
<a href="canoe.php?idd=<?php echo $row['id'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></td>
					</tr>
					<?php
						$x++;}}
				//	 $fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate))); }
						?> 
	<tr>
					
						<td></td>
						<td></td>
						<td>-</td>
						<td><b>Total</b></td>
						
						<td><b><?php echo $tott;?></b></td>
						<td></td>
						<td>-</td>		<td></td>
						<td></td>
					
					<td></td>
					<td>
</td>
					</tr>
						</tbody>
					 <?PHP 	}
					?>
				 
							
                          </table>
                      
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              
        <!-- /page content -->

        <!-- footer content -->
        <footer>
          <div class="pull-right">
             <a href="https://infossel.com">Infossel Soft Solution</a>
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="vendors/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="vendors/iCheck/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
    <script src="vendors/jszip/dist/jszip.min.js"></script>
    <script src="vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="vendors/pdfmake/build/vfs_fonts.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>

  </body>
</html>