<?php  include "layouts/menu.php"; ?>
 <style>
  .tfoot {
      font-weight:bold;
      text-transform:uppercase;
      color:@color-footer;
      text-shadow:1px 1px 1px #fff;
    }
	</style>
        <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>
              
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  
                  <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);
									
									header("location:billrep2.php?fdate=$fdate&&tdate=$tdate");
								} ?>
								<?php $bal = 0; $a22 = 0; 
											$fdate = date("Y-m-d");
$tdate = date("Y-m-d");   ?>
						
  <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">                            <thead>
                             <tr class="alert alert-info">
					<th style="width:7%">Rcpt No</th>	<th style="width:10%">HP A/C No</th>
						
						<th style="width:15%">Name</th>
							<th style="width:10%">Status</th>
						
						
						<th> Date</th>
						
						
					<th>Intst</th>
					<th>Addless</th>
						
						<th>Def Amt</th>
						<th>Mode</th>
			<?php  if($postt == 'MD') { ?> 	<th>#Options</th> <?php } ?>
				<th>Created By </th>
							<th>Altered By</th>
					
					</tr>
                            </thead>
                           <tbody>			
					<?php $damt = 0; $pass = 0; $rno = 0; $fine = 0; $urname = 0; $hll = 0; $addl = 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' && paydate2 between '$fdate' and '$tdate'");
}
elseif($typp==1){ echo 2;
	$qry=mysqli_query($conn, "select * from user where mfin='$mfin' && mode='$cass' && paydate2 between '$fdate' and '$tdate'");
} 
else{ echo 3;
	$qry=mysqli_query($conn, "select * from user where mfin='$mfin' && mode!='$cass' && paydate2 between '$fdate' and '$tdate'");
}
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$sts = $row['status'];
$sts2 = "Reloan";
						if($n==0)
						{
							$x++;
						}
						else
					{ $aaa  = $row['urname'];
?>				<tr>
					<td><b><?php 
					$rtrqq = $row['roll'];
					$ff = NULL;
					if($rtrqq == $ff){
						echo "1";
					}
					else{
					echo $row['roll'];
					} ?></b></td>
						<td><b><?php echo $row['hpl'];?></b></td>
						
						<td><b><?php echo $row['name']; ?></br>
						<?php echo $row['vno'];?>
						</b></td>
					<?php
 $damt = $damt + $row['dueamount']; $pass = $pass + $row['pass']; $rno = $rno + $row['rno']; $addl = $addl + $row['addless']; 
						$fine = $fine + $row['fine']; $hll = $hll + $row['hloan']; $bal = $bal + $row['bal'];$a22 = $a22 + $a2; $urname = $urname + $aaa;  
	
						 ?>
			<td><b><a href="editrcpt.php?fid=<?php echo $row['fid'];?>"><button class="btn btn-info">Mon-Due</button></a></b></td>
<td><b><?php echo $row['paydate'];?></b></td>
						
						
							<td><b><?php echo $row['rno'];?></b></td>
							<td><b><?php echo $row['addless'];?></b></td>
						<td><b><?php echo $row['fine'];?></b></td>
			
					
						<td><b><?php echo $row['mode'];?></b></td>
					
					<?php  if($postt == 'MD') { ?>     
				<td><b>
<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>	

</br><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></b></td>	
					<?php } ?>
						<td><b><font size="1"><?php echo $row['createdate'];?></br>
						<?php echo $row['scode'];?></font>
						</b></td>
						<td><b><font size="1"><?php echo $row['altdate'];?></br><?php echo $row['altby'];?></b></font></td>
		</tr>  
					<?php
						$x++;} }
if($typp==0){					
$qry=mysqli_query($conn, "select * from net where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
}
elseif($typp==1){
	$qry=mysqli_query($conn, "select * from net where mfin='$mfin' && mode='$cass' && paydate2 between '$fdate' and '$tdate'");
}
else{
	$qry=mysqli_query($conn, "select * from net where mfin='$mfin' && mode!='$cass' && paydate2 between '$fdate' and '$tdate'");
}						

				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{
?>				<tr>
						<td><b><?php 
					$rtrqq = $row['rrno'];
					$ff = NULL;
					if($rtrqq == $ff){
						echo "1";
					}
					else{
					echo $row['rrno'];
					} ?></b></td>
						<td><b><?php echo $row['hpl'];?></b></td>
					
						<td><b><?php echo $row['name']; ?></b></td>
						<td><b><a href="editsettle.php?fid=<?php echo $row['id'];?>"><button class="btn btn-info">Mon-Close</button></a></b></td>
						
						
						<td><b><?php echo $row['paydate'];?></b></td>
					
					
							<td><b><?php echo $row['amt'];?></b></td>
							<td><b><?php echo $row['addless'];?></b></td>
							
						<td><b><?php echo $row['fine'];?></b></td>
							<td><b><?php echo $row['mode'];?></b></td>
				<?php	 $pass = $pass + $row['dueamt']; $rno = $rno + $row['amt'];  $addl = $addl + $row['addless']; 
						$fine = $fine + $row['fine']; $urname = $urname + $row['tot']; 
						 $hll = $hll + $row['hloan'];
						?>
						
				
<?php  if(($postt == 'MD') || ($postt == 'Office All')) { ?> 
<td><b>
<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>	
</br><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></b></td>					
<?php } ?>
						<td><font size="1"><b><?php echo $row['createdate'];?></br><?php echo $row['scode'];?></b></font></td>
					
						<td><font size="1"><b><?php echo $row['altdate'];?></br><?php echo $row['altby'];?></b></font></td>		
					</tr>
					<?php
						$x++;}}
						if($typp==0){ 				
$qry=mysqli_query($conn, "select * from userw where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
}
elseif($typp==1){ echo 2;
	$qry=mysqli_query($conn, "select * from userw where mfin='$mfin' && mode='$cass' && paydate2 between '$fdate' and '$tdate'");
} 
else{ echo 3;
	$qry=mysqli_query($conn, "select * from userw where mfin='$mfin' && mode!='$cass' && paydate2 between '$fdate' and '$tdate'");
}
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$sts = $row['status'];
$sts2 = "Reloan";
						if($n==0)
						{
							$x++;
						}
						else
					{ $aaa  = $row['urname'];
?>				<tr>
					<td><b><?php echo $row['roll'];?></b></td>
						<td><b><?php echo $row['hpl'];?></b></td>
						
						<td><b><?php echo $row['name']; ?></br>
						<?php echo $row['vno'];?>
						</b></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;  
	
						 ?>
			<td><b><a href="editrcpt.php?fid=<?php echo $row['fid'];?>"><button class="btn btn-warning">Week-Due</button></a></b></td>
<td><b><?php echo $row['paydate'];?></b></td>
							<td><b><?php echo $aaa;?></b></td>
						<td><b><?php echo $row['fine'];?></b></td>
			
					
						<td><b><?php echo $row['mode'];?></b></td>
					
					<?php  if($postt == 'MD') { ?>     
				<td><b>

</br><a href="cancelw.php?fid=<?php echo $row['fid'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></b></td>	
					<?php } ?>
						<td><b><font size="1"><?php echo $row['createdate'];?></br>
						<?php echo $row['scode'];?></font>
						</b></td>
						<td><b><font size="1"><?php echo $row['altdate'];?></br><?php echo $row['altby'];?></b></font></td>
		</tr>  
					<?php
						$x++;} }
						
						if($typp==0){ 				
$qry=mysqli_query($conn, "select * from userm where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
}
elseif($typp==1){ echo 2;
	$qry=mysqli_query($conn, "select * from userm where mfin='$mfin' && mode='$cass' && paydate2 between '$fdate' and '$tdate'");
} 
else{ echo 3;
	$qry=mysqli_query($conn, "select * from userm where mfin='$mfin' && mode!='$cass' && paydate2 between '$fdate' and '$tdate'");
}
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$sts = $row['status'];
$sts2 = "Reloan";
						if($n==0)
						{
							$x++;
						}
						else
					{ $aaa  = $row['urname'];
?>				<tr>
					<td><b><?php echo $row['roll'];?></b></td>
						<td><b><?php echo $row['hpl'];?></b></td>
						
						<td><b><?php echo $row['name']; ?></br>
						<?php echo $row['vno'];?>
						</b></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;  
	
						 ?>
			<td><b><a href="editrcpt.php?fid=<?php echo $row['fid'];?>"><button class="btn btn-success">Daily-Due</button></a></b></td>
<td><b><?php echo $row['paydate'];?></b></td>
							<td><b><?php echo $aaa;?></b></td>
						<td><b><?php echo $row['fine'];?></b></td>
			
					
						<td><b><?php echo $row['mode'];?></b></td>
					
					<?php  if($postt == 'MD') { ?>     
				<td><b>

</br><a href="cancelm.php?fid=<?php echo $row['fid'];?>" class="btn btn-primary btn-xs" onclick="return confirm('Are you sure WANT TO CANCEL?');">Cancel</a></b></td>	
					<?php } ?>
						<td><b><font size="1"><?php echo $row['createdate'];?></br>
						<?php echo $row['scode'];?></font>
						</b></td>
						<td><b><font size="1"><?php echo $row['altdate'];?></br><?php echo $row['altby'];?></b></font></td>
		</tr>  
					<?php
						$x++;} }
						
						
if($typp==0){					
$qry=mysqli_query($conn, "select * from cancel where mfin='$mfin' && paydate2 between '$fdate' and '$tdate'");
}
elseif($typp==1){
	$qry=mysqli_query($conn, "select * from cancel where mfin='$mfin' && mode='$cass' && paydate2 between '$fdate' and '$tdate'");
}
else{
	$qry=mysqli_query($conn, "select * from cancel where mfin='$mfin' && mode!='$cass' && paydate2 between '$fdate' and '$tdate'");
}					
				$n=mysqli_num_rows($qry);
				while($row=mysqli_fetch_array($qry))
  { 
$x = $row['hpl'];
						if($n==0)
						{
							$x++;
						}
						else
					{ $aaa  = $row['urname'];
?>				<tr>
					<td><b><font color="red"><?php echo $row['roll'];?></font></b></td>
						<td><b><font color="red"><?php echo $row['hpl'];?></font></b></td>
						
						<td><b><font color="black"><?php echo $row['name']; ?></br>
						<?php echo $row['vno'];?>
						</font></b></td>
						<td><b><button class="btn btn-Danger">Due-Can</button></b></td>
						
						
						<td><b><font color="black"><?php echo $row['paydate'];?></font></b></td>
							<td><b><font color="black"><?php echo $aaa;?></font></b></td>
			<td><b></b></td>	
						<td><b></b></td>
						<td><b></b></td>
						
						<td><b><font color="black"><?php echo $row['fine'];?></font></b></td>
							<td><b><?php echo $row['mode'];?></b></td>
					    <?php  if($postt == 'MD') { ?> 
				<td><b>

</br><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></b></td>	
						<?php } ?>

						<td><font size="1"><b><?php echo $row['createdate'];?></br><?php echo $row['scode'];?></b></font></td>
			
						<td><font size="1"><b><?php echo $row['altdate'];?></br><?php echo $row['altby'];?></b></font></td>
			</tr>  
					<?php
						$x++; } } ?>

					
					</tbody>
			<tfoot class="tfoot">		<tr class="alert alert-success">
					    <td><b></b></td>
						<td><b></b></td>
					<td><font size="4" color="red"><b>Total</b></font></b></td>
						<td><b>-</b></td>
					    <td><b></b></td>
				
				
<td><b><font color="red"><?php echo $rno;?></b></font></td>
<td><b><font color="red"><?php echo $addl;?></b></font></td>						
					
					<td><b><font color="red"><?php echo $fine;?></b></font></td>
<td><b></b></td> 
					<?php  if($postt == 'MD') { ?> 	<td><b></b></td> <?php } ?>
						<td><b></b></td>	
						<td><b></b></td>
					    </tr> </tfoot>
							
                          </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>