<?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">
       
				        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post"  enctype="multipart/form-data">
  <div class="col-md-3">  <input type="date" class="form-control thicker" id="datepicker" name="fdate" value="<?php echo date("Y-m-d"); ?>" placeholder="From Date" onfocus="insertDate(this,'DD-MM-YYYY')">
    </div>
    <div class="col-md-3">   <input type="date" class="form-control thicker" id="datepicker" name="tdate" value="<?php echo date("Y-m-d"); ?>" placeholder="To Date" onfocus="insertDate(this,'DD-MM-YYYY')">
   </div>
   <div class="col-md-3">    <select type="text" class="form-control thicker" id="typp" name="typp" value="">
	<option value="0">All</option>
	<option value="1">Cash A/C</option>
	<option value="2">Bank A/C</option></select>
    </div>
   <div class="col-md-3">      <button type="submit" class="btn btn-info" name="s15">Show It</button></div>
    
 <?php if(isset($_POST['s15']))
								{
									extract($_POST);
									header("location:getuser2.php?fdate=$fdate&&tdate=$tdate");
								}
									
									?>
  </form>
            
              </div>
              
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title" >
                    <h2>Bill Report <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
		
							$fdate = date("d-m-Y");
$tdate = date("d-m-Y");							
								$bal = 0; $a22 = 0; ?>
						
  <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">                            <thead>
                             <tr>
					<th>Rcpt No</th>	<th>Hp No</th>
						
						<th>Name</th>
							<th>Status</th>
						<th>Regn No</th>
						
						<th> Date</th>
							<th>Total</th>
						<th>Due Amt</th>
						<th>Prin Amt</th>
						<th>Int Amt</th>
						<th>Def Amt</th>
						<th>HL Amt</th>
				<?php  if(($postt == 'MD') || ($postt == 'Office All')) { ?> 	<th>#Edit</th> <?php } ?>
					</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; $cass = "Cash A/C";
if($typp==0){ 					
$qry=mysqli_query($conn, "select * from user where mfin='$mfin' && paydate='$paydate'");
}
elseif($typp==1){ echo 2;
	$qry=mysqli_query($conn, "select * from user where mfin='$mfin' && mode='$cass' && paydate='$paydate'");
} 
else{ echo 3;
	$qry=mysqli_query($conn, "select * from user where mfin='$mfin' && mode!='$cass' && paydate='$paydate'");
}
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
$sts = $row['status'];
$sts2 = "Reloan";
						if($n==0)
						{
							$x++;
						}
						else
					{ $aaa  = $row['urname'];
?>				<tr>
					<td><?php echo $row['roll'];?></td>
						<td><?php echo $row['hpl'];?></td>
						
						<td><?php echo $row['name']; ?></td>
						 <?php if($sts == $sts2){ ?>
<td><a href="editrcpt.php?fid=<?php echo $row['fid'];?>"><button class="btn btn-warning">Reloan</button></a></td>
						 <?php } else { ?>
			<td><a href="editrcpt.php?fid=<?php echo $row['fid'];?>"><button class="btn btn-success">Due</button></a></td>			 
						 <?php } ?>
						<td><?php echo $row['vno'];?></td>
						
						<td><?php echo $row['paydate'];?></td>
							<td><?php echo $aaa;?></td>
						<td><?php echo $row['dueamount'];?></td>
						<td><?php echo $row['pass'];?></td>
						<td><?php echo $row['rno'];?></td>
						<td><?php echo $row['fine'];?></td>
						<td><?php echo $row['hloan'];?></td>
					
					
						<?php $damt = $damt + $row['dueamount']; $pass = $pass + $row['pass']; $rno = $rno + $row['rno']; 
						$fine = $fine + $row['fine']; $hll = $hll + $row['hloan']; $bal = $bal + $row['bal'];$a22 = $a22 + $a2; $urname = $urname + $aaa; ?>
			<?php  if(($postt == 'MD') || ($postt == 'Office All')) { ?> 			    
				<td>
<a href="editrcpt.php?fid=<?php echo $row['fid'];?>" class="btn btn-info btn-xs" onclick="return confirm('Are you sure WANT TO Edit?');">Edit</a>				

<a href="cancel.php?fid=<?php echo $row['fid'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></td>		<?php } ?>			
			</tr>  
					<?php
						$x++;} }
if($typp==0){					
$qry=mysqli_query($conn, "select * from cancel where mfin='$mfin' && paydate='$paydate'");
}
elseif($typp==1){
	$qry=mysqli_query($conn, "select * from cancel where mfin='$mfin' && mode='$cass' && paydate='$paydate'");
}
else{
	$qry=mysqli_query($conn, "select * from cancel where mfin='$mfin' && mode!='$cass' && paydate='$paydate'");
}					
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{ $aaa  = $row['urname'];
?>				<tr>
					<td><font color="red"><?php echo $row['roll'];?></font></td>
						<td><font color="red"><?php echo $row['hpl'];?></font></td>
						
						<td><font color="black"><?php echo $row['name']; ?></font></td>
						<td><button class="btn btn-Danger">Due-Cancel</button></td>
						<td><font color="black"><?php echo $row['vno'];?></font></td>
						
						<td><font color="black"><?php echo $row['paydate'];?></font></td>
							<td><font color="black"><?php echo $aaa;?></font></td>
						<td><font color="black"><?php echo $row['dueamount'];?></font></td>
						<td><font color="black"><?php echo $row['pass'];?></font></td>
						<td><font color="black"><?php echo $row['rno'];?></font></td>
						<td><font color="black"><?php echo $row['fine'];?></font></td>
						<td><font color="black"><?php echo $row['hloan'];?></font></td>
					
					
						<?php  if(($postt == 'MD') || ($postt == 'Office All')) { ?> 
					    
				<td>
<a href="editrcpt.php?fid=<?php echo $row['fid'];?>" class="btn btn-info btn-xs" onclick="return confirm('Are you sure WANT TO Edit?');">Edit</a>				

<a href="cancel.php?fid=<?php echo $row['fid'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></td>		<?php } ?>			
			</tr>  
					<?php
						$x++; } }
if($typp==0){					
$qry=mysqli_query($conn, "select * from net where mfin='$mfin' && bmnt='$paydate'");
}
elseif($typp==1){
	$qry=mysqli_query($conn, "select * from net where mfin='$mfin' && mode='$cass' && bmnt='$paydate'");
}
else{
	$qry=mysqli_query($conn, "select * from net where mfin='$mfin' && mode!='$cass' && bmnt='$paydate'");
}						

				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{
?>				<tr>
						<td><?php echo $row['rrno'];?></td>
						<td><?php echo $row['hpl'];?></td>
					
						<td><?php echo $row['name']; ?></td>
						<td><a href="editsettle.php?fid=<?php echo $row['id'];?>"><button class="btn btn-info">Close</button></a></td>
						<td>-</td>
						
						<td><?php echo $row['paydate'];?></td>
						<td><?php echo $row['tot'];?></td>
						<td>-</td>
						<td><?php echo $ss=$row['tot'] - $row['amt'];?></td>
						<td><?php echo $row['amt'];?></td>
						<td><?php echo $row['fine'];?></td>
						<td><?php echo $row['hloan'];?></td>
						
				<?php	 $pass = $pass + $ss; $rno = $rno + $row['amt']; 
						$fine = $fine + $row['fine']; $urname = $urname + $row['tot']; 
						 $hll = $hll + $row['hloan'];
						?>
						
	<?php  if(($postt == 'MD') || ($postt == 'Office All')) { ?> 
<td>
<a href="editsettle.php?fid=<?php echo $row['id'];?>" class="btn btn-info btn-xs" onclick="return confirm('Are you sure WANT TO Edit?');">Edit</a>	
<a href="cancel2.php?fid=<?php echo $row['id'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></td>	 <?php } ?>				
			
					</tr>
					<?php
						$x++;}}
if($typp==0){					
$qry=mysqli_query($conn, "select * from cancels where mfin='$mfin' && bmnt='$paydate'");
}
elseif($typp==1){
	$qry=mysqli_query($conn, "select * from cancels where mfin='$mfin' && mode='$cass' && bmnt='$paydate'");
}
else{
	$qry=mysqli_query($conn, "select * from cancels where mfin='$mfin' && mode!='$cass' && bmnt='$paydate'");
}						
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{
?>				<tr>
						<td><font color="red"><?php echo $row['rrno'];?></font></td>
						<td><font color="red"><?php echo $row['hpl'];?></font></td>
					
						<td><font color="black"><?php echo $row['name']; ?></font></td>
						<td><button class="btn btn-danger">Cls-Cancel</button></td>
						<td>-</td>
						
						<td><font color="black"><?php echo $row['paydate'];?></font></td>
						<td><font color="black"><?php echo $row['tot'];?></font></td>
						<td>-</td>
						<td><font color="black"><?php echo $ss=$row['tot'] - $row['amt'];?></font></td>
						<td><font color="black"><?php echo $row['amt'];?></font></td>
						<td><font color="black"><?php echo $row['fine'];?></font></td>
						<td><font color="black"><?php echo $row['hloan'];?></font></td>
				<?php  if(($postt == 'MD') || ($postt == 'Office All')) { ?> 			<td>
<a href="editsettle.php?fid=<?php echo $row['fid'];?>" class="btn btn-info btn-xs" onclick="return confirm('Are you sure WANT TO Edit?');">Edit</a>	
<a href="cancel2.php?fid=<?php echo $row['id'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></td>	 <?php } ?>				
			
					</tr>
					<?php
						$x++;}}
						
					 $fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate))); }
						$ssa = $fine - $a22;	?>  </tbody>
					<tr>
					
						<td></td>
						<td></td>
						<td><b>Total</b></td>
						<td>-</td>
					
						<td></td>	<td></td>
						<td><font size="4" color="red"><b><?php echo $urname;?></b></font></td>
						<td><?php echo $damt; ?></td>
						<td><?php echo $pass;?></td>
						<td><?php echo round($rno,0);?></td>
						<td><?php echo $fine;?></td>
					<td><?php echo $hll; ?></td>
						
						
					<?php  if(($postt == 'MD') || ($postt == 'Office All')) { ?> 
						<td></td> <?php } ?>
					    
					</tr> 
				 
							
                          </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>