<?php include "layouts/menu.php"; ?> 
    <?php $hpl=$_REQUEST['hpl'];?>
  <?php $mfin2=$_REQUEST['mfin2'];?>
  <!--  page-wrapper -->
  <style> 
input[type=text] {
    width: 100%;
   
    box-sizing: border-box;
    border: 1px solid #555;
    outline: Gray;
	
}

input[type=text]:focus {
    background-color: #d1e0e3;
}

.div1 {
    width: 100%;
    height: 100%;
       border: 4px solid #ff3d39;
    background-color: #69f7db;
	float:left;
}

.div2 {
    width: 380px;
    height: 240px;    
background-color:#f4f6df;
    border: 4px solid #376ca1;
	float:right;
}
label {
  
  color: black;
  font-weight: bold;
  
}
td,th{
  
  color: black;
  font-weight: bold;
  
}

</style>

         <div class="right_col" role="main">
            
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Customer Details
                        </div>
                        <div class="panel-body">
                            <div class="row">
     <input type="button" value="Print" onclick="PrintElem('#mydiv')"  style="margin:20px;"><div id="mydiv">
     <!--    <form name="form1" method="post" action="" enctype="multipart/form-data"> -->
<?php
						$qry=mysqli_query($conn, "select * from customerdetailsw where hpl='$hpl'");
						$row=mysqli_fetch_array($qry);
						$mfin2 = $row['mfin'];  $hpl = $row['hpl'];
						$qry1=mysqli_query($conn, "select * from userw where mfin='$mfin2' &&  hpl='$hpl'");
					$n1=mysqli_num_rows($qry1);
					$row1=mysqli_fetch_array($qry1);
				$remarks = $row['remarks'];
		if($remarks!=NULL){
echo '<script language="javascript">';
echo 'alert("'.$remarks.'")';
echo '</script>'; } 	?>
<div class="col-md-12 div1">
<div class="col-md-4">
<font color="brown" size="3.5"><b>A/C No : <?php echo $row['hpl'];?></b></font></br>
<b><font size="3.5" color="blue"><?php echo $row['name']; ?></font></br>
	<b><font size="2.5" color="blue">S/O <?php echo $row['fname']; ?></font></br>
	<b><font size="2.5" color="blue"><?php echo $row['address']; ?></font></br>
		<b><font size="2.5" color="blue"><?php echo $row['address1']; ?></font></br>
			<b><font size="2.5" color="blue"><?php echo $row['address2']; ?></font></br>
	<b><font size="2.5" color="blue"><?php echo $row['lmark']; ?></font></br>
 
 <font color="brown" size="3"><b>Office Address</b></font></br>
<?php
$sql22 = mysqli_query($conn, "select * from addr where hpl='$hpl' && mfin='$mfin2' order by id asc");
$row3 = mysqli_fetch_array($sql22);
$nn = mysqli_num_rows($sql22);
$iddf = $row3['id'];

if($nn>0) {

$iddf = $row3['id'];
for($i=1;$i<=7;$i++){
	
$sql223 = mysqli_query($conn, "select * from addr where id='$iddf' && hpl='$hpl' && mfin='$mfin2'");
$row33 = mysqli_fetch_array($sql223); $iddf++;
?>
<b><font size="2" color="blue"><?php echo $row33['oadd']; ?></font></b></br>
<?php } }
else { ?>
	<b><font size="2" color="blue">S/O <?php echo $row1['fname']; ?></font></br>
	<b><font size="2.5" color="blue"><?php echo $row1['address']; ?></font></br>
	<b><font size="2.5" color="blue"><?php echo $row1['lmark']; ?></font></br>
	
<?php } ?> 
<?php $imgg = $row['uimg']; 
if($imgg != NULL) { 
?>
<img src="user/<?php echo $row['uimg']; ?>" width="120px" height="120px" style=" border-radius: 60%;" >
<?php } ?>  
 </font>

</div>

<div class="col-md-4">
<table border="0">
<tr><td>Spouse Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><font color="red" size="2"><?php echo $row['hname'];?></td></tr>
<tr><td>Spouse Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pnoresi'];?></td></tr>
<tr><td>Father Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><font color="red" size="2"><?php echo $row['fname'];?></td></tr>
<tr><td>Father Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pnof'];?></td></tr>
<tr><td>Mother Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><font color="red" size="2"><?php echo $row['mname'];?></td></tr>
<tr><td>Mother Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pnom'];?></td></tr>
<tr><td>Sibblings Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><font color="red" size="2"><?php echo $row['sbname'];?></td></tr>
<tr><td>Sibblings Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pnos'];?></td></tr>

<tr><td>Office Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pnooffice'];?></td></tr>

<tr><td>Children Details</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['sonn'];?></td></tr>

<tr><td>Hypothecation</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['hch'];?></td></tr>
<tr><td>Verification Person</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pwd'];?></td></tr>
<tr><td>Document Person</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['doo'];?></td></tr>
<tr><td>Reference Person</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['idate'];?></td></tr>
<tr><td>Telecaller Person</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['uname'];?></td></tr>
</table>
</div>


<div class="col-md-4">
<table border="0">
<tr><td>Loan_Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['hpdate'];?></td></tr>
<tr><td>Loan Amt</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['totalhpamt'];?>(<?php echo $row['hpamount'];?>)</td></tr>
<tr><td>Hire_Charges</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><font color="red" size="2"><?php $q5 = $row['interest'];
$q6 = $row['duemnt'];
$qt = $q5 * $q6;
$ffft = $row['inter']; $drd = $ffft * 12; 
echo $qt; ?> ( <?php echo round($drd,2); ?> ) </td></tr>
<tr><td>Tot Dues</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['duemnt'];?></td></tr>

<tr><td>Closing Date</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php 
$ggt = $row['duemnt'];
$hpdate5555 = $row['hpdate5'];
$duedat4444 = date("d-m-Y", strtotime("$hpdate5555 + " . $ggt . " day"));
echo $duedat4444; ?></td></tr>
<tr><td>Due_Amt(Prin+Int)</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['total'];?> (<?php echo $row['dueamt'];?> + <?php echo $row['interest'];?>)</td></tr>
<tr><td>Def %</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php	$defamt2 = $row['defamt'];	
			if($defamt2<1) {
		 	$defamt2 = 	$defamt2 * 12;   
		}
	echo $defamt = (($damt*$defamt2)/100)/30; ?></td></tr>

<tr><td>Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pno'];?> </td></tr>
<tr><td>House Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pnoresi'];?></td></tr>
<tr><td>Office Phone</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['pnoofic'];?></td></tr>


<tr><td>Reg No</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['vno'];?> </td></tr>
<tr><td>Bank</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['eno'];?></td></tr>
<tr><td>Nativity</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="2"><?php echo $row['cno'];?></td></tr>

<tr><td>Remark</td><td>&nbsp;&nbsp;&nbsp;</td><td><font color="red" size="1.5"><?php echo $row['remarks'];?> <?php echo $row['dd'];?></td></tr>

<b>

</b></font> <?php $pno = $row['pno']; ?>
</table>
</div>


</div>



	<?php
$damt = $row['total'];			
	$defamt2 = $row['defamt'];	
	$defamt = (($damt*$defamt2)/100)/30;	
?>			
<!--<center><h3><b>Default Per Day : Rs. <?php //echo round($defamt,0); ?>/=</b></h3></center>-->
 <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered"  border="1px" color="solid black">
					<thead>
						<tr>
						<th>Due</th>
						<th>Due Date</th>
						<th>Rcpt No</th>
						<th>Rcpt Date</th>
						<th>Due Amt</th>
						<th>Due Rcvd</th>
						<th>Due Bal</th>
				        <th>Def Days</th>
						<th>Penalty</th>
						<th>Payed Fine</th>
	
					
					
						
					</tr></thead>
					<tbody>
		<?php $noo = 0; $less = 0; $spdue= 0 ; $spfine = 0; $spdd = 0;
			$ttp = 0;	$tti = 0; $ttdue = 0;	$ttdd = 0;	$ttfine = 0;	$ttpf = 0;	$tthl = 0;	
				$tttot = 0;	$zz = 1;
				$qdue = 0; $qdue25 = 0;
			$ttp = 0;	$tti  = 0; $ttdue = 0;	$ttdd = 0;	$ttfine = 0;	$ttpf = 0;	$tthl = 0;	
				$tttot = 0;	$dmm = 0; $sts = 0;
						$qry=mysqli_query($conn, "select * from customerdetailsw where mfin='$mfin2' &&  hpl='$hpl'");			
$row = mysqli_fetch_array($qry);
	   $duedat = str_replace('/', '-', $row['hpdate']);
	    $hpdate = str_replace('/', '-', $row['hpdate']);
						$pp = $row['duemnt'];
						$addr = $row['addrwess'];
			$damt = $row['total'];		
$intt = $row['inter'];
$intt2 = $row['interest'];
$prin = $row['dueamt'];			
	$defamt2 = $row['defamt'];	
	$defamt = (($damt*$defamt2)/100)/30;	
  $d1 = strtotime($duedat);
$d2 = strtotime("today");
$min_date = min($d1, $d2);
$max_date = max($d1, $d2);

if($iii>$pp)
{ $iii=$pp; }
$rc = $iii - $sql5 ;
$sql9 = $sql5 + $rc ; $vv = 1; $ii = 0;
 
$qry5=mysqli_query($conn, "select * from userw where mfin='$mfin2' && hpl='$hpl' order by paydate2 asc");			
while($row5 = mysqli_fetch_array($qry5)) { $rr = 0;
$duemnt = $row5['paymnt'];
$rcptno = $row5['roll'];
$fidd = $row5['fid'];
$gi = 0;
$rno1 = $row5['rno'];
$rno = $rno1/$duemnt;
$pass1 = $row5['pass'];
$pday = $row5['paydate'];
$pass = $pass1/$duemnt;
$urname1 = $row5['urname'];
$hloan = $row5['hloan'];
$fine1 = $row5['fine'];
$urname = ($urname1 - $hloan - $fine1) /$duemnt;
$dmm = $urname1 - $hloan - $fine1;
$ff55 = 0;
while($dmm>0) { $gi++; $rr++;
if($ff55 == 0){
	$fine18 = $fine1;
	$hloan8 = $hloan;
}
else {
	$fine18 = 0;
	$hloan8 = 0;
}
$ff55++;
if($sts==0) {
if($dmm>$damt){
	$sts = 1; $less = 0;
	$pamt = $damt;
	$noo++;
}
elseif($dmm==$damt){
	$sts = 0; $less = 0;
	$pamt = $damt;
	$noo++;
}
else{
	$sts = 2;
	$pamt = $dmm;
	$less = $damt - $dmm;
}
$ii++; $zzzz++;
$selected_date=$duedat;
		  	$selected_date=strtotime( $selected_date );
			$mysqldate = date( 'd-m-Y', $selected_date );
			$month = date( 'm', $selected_date );
			$day = date( 'd', $selected_date );
			$yyyy = date( 'Y', $selected_date );
			$zzz = $zz * 1;
$duedat = date("d-m-Y", strtotime("$hpdate + " . $zzz . " week"));
$pday = $row5['paydate'];


  $d11 = strtotime($duedat);
$d22 = strtotime($pday);
$min_date1 = min($d11, $d22);
$max_date1 = max($d11, $d22);
$i6 = 0;
if($d11<=$d22) {
while (($min_date1 = strtotime("+1 DAY", $min_date1)) <= $max_date1) {
    $i6++;
}
}
if($i6 <= 3){
    
$fine2 = 0;
} else {
$fine2 = (($defamt/$damt)*($i6 * $pamt)); }
if($fine2 < 0) {
	$fine2 = 0;
}

	?>
<tr>
					<td><?php echo $ii; ?></td>
					<td> 
					<?php $tdue = $urname - $hloan - $fine1; ?>
						<a href="editrcpt.php?fid=<?php echo $fidd; ?>"<button class="btn btn-default text-center">
                        <i class="fa  fa-pencil fa-1x"></i><b><?php echo $duedat; $zz++; ?></b>
                    </button></a></td><td><?php echo $rcptno; ?></td>
					<td><?php echo $pday; ?></td>
					<td><?php echo $damt; ?></td>
				<!--	<td><?php //echo $pass; ?></td>
					<td><?php //echo $rno; ?></td> -->
					<td><?php echo $pamt; ?></td><td></td>
				<td><?php echo $i6;?></td>	<td><?php echo round($fine2,0);?></td>	
				 <td><?php echo $fine18;?></td> 
				
			
</tr>
<?php $dmm = $dmm - $pamt;
$spfine = $spfine + $fine2;
$spdd = $spdd + $i6; $spdue = $spdue + $pamt;
$spff = $spff + $fine18;
$sphl = $sphl + $hloan8;
 } 

elseif($sts == 1) {
	if($dmm>$damt){
	$sts = 1; $less = 0;
	$pamt = $damt;
	$noo++;
}
elseif($dmm==$damt){
	$sts = 0; $less = 0;
	$pamt = $damt;
	$noo++;
}
else{
	$sts = 2;
	$pamt = $dmm;
	$less = $damt - $dmm;
} $ii++; $zzzz++;
$selected_date=$duedat;
		  	$selected_date=strtotime( $selected_date );
			$mysqldate = date( 'd-m-Y', $selected_date );
			$month = date( 'm', $selected_date );
			$day = date( 'd', $selected_date );
			$yyyy = date( 'Y', $selected_date );
			$zzz = $zz * 1;
$duedat = date("d-m-Y", strtotime("$hpdate + " . $zzz . " week"));



  $d11 = strtotime($duedat);
$d22 = strtotime($pday);
$min_date1 = min($d11, $d22);
$max_date1 = max($d11, $d22);
$i6 = 0;
if($d11<=$d22) {
while (($min_date1 = strtotime("+1 DAY", $min_date1)) <= $max_date1) {
    $i6++;
}
}
if($i6 <= 3){
    
$fine2 = 0;
} else {
$fine2 = (($defamt/$damt)*($i6 * $pamt)); }
if($fine2 < 0) {
	$fine2 = 0;
} 
	?>
<tr>
					<td><?php echo $ii; ?></td>
					<td> 
					<?php $tdue = $urname - $hloan - $fine1; ?>
						<a href="editrcpt.php?fid=<?php echo $fidd; ?>"<button class="btn btn-default text-center">
                        <i class="fa  fa-pencil fa-1x"></i><b><?php echo $duedat; $zz++;?></b>
                    </button></a></td><td><?php echo $rcptno; ?></td>
					<td><?php echo $pday; ?></td>
					<td><?php echo $damt; ?></td>
				<!--	<td><?php //echo $pass; ?></td>
					<td><?php //echo $rno; ?></td> -->
					<td><?php echo $pamt; ?></td><td></td>
				<td><?php echo $i6;?></td>	<td><?php echo round($fine2,0);?></td>	
			<td><?php echo $fine18;?></td> 
					
			
</tr>

<?php $dmm = $dmm - $pamt;
$spfine = $spfine + $fine2;
$spdd = $spdd + $i6; $spdue = $spdue + $pamt;
$spff = $spff + $fine18;
$sphl = $sphl + $hloan8;
 } 
else { 
  $d11 = strtotime($duedat);
$d22 = strtotime($pday);
$min_date1 = min($d11, $d22);
$max_date1 = max($d11, $d22);
$i6 = 0;
if($d11<=$d22) {
while (($min_date1 = strtotime("+1 DAY", $min_date1)) <= $max_date1) {
    $i6++;
}
}
if($i6 < 3){
    
$fine2 = 0;
} else {
$fine2 = (($defamt/$damt)*($i6 * $less));
 }
if($fine2 < 0) {
	$fine2 = 0;
}
if($less>$dmm){
$dmm2 = $less - $dmm; $noo++;
$less2 = $less  - $dmm2; 
$spdue = $spdue + $less;
$dmm = 0;
	?><tr>
					<td></td>
					<td></td>	
					<td></td>
					<td><?php echo $pday; ?></td>
					<td></td>
				<!--	<td><?php //echo $pass; ?></td>
					<td><?php //echo $rno; ?></td> -->
					<td><?php echo $less2; ?></td><td></td>
				<td><?php echo $i6; ?></td>	
				<td><?php echo round($fine2,0); ?></td>	
				<?php if($gi==1) { ?> <td></td> <?php } else { ?>
<td></td>
				<?php } ?>
				
				
</tr> <?php
if($dmm>$damt){
	$sts = 1;
	$less = 0;
	$pamt = $damt;
	$noo++;
}
elseif($dmm==$damt){
	$sts = 0; $less = 0;
	$pamt = $damt;
	$noo++;
}
else{
	
	$sts = 2;
	$pamt = $less2;
	$less = $dmm2;
}
$pamt = $less2;	
}
else{
$dmm = $dmm - $less; $noo++;
$spdue = $spdue + $less;
	?><tr>
					<td></td>
					<td></td>	
					<td></td>
					<td><?php echo $pday; ?></td>
					<td></td>
				<!--	<td><?php //echo $pass; ?></td>
					<td><?php //echo $rno; ?></td> -->
					<td><?php echo $less; ?></td><td></td>
				<td><?php echo $i6; ?></td>	
				<td><?php echo round($fine2,0); ?></td>	
				<?php if($gi==1) { ?> <td></td> <?php } else { ?>
<td></td>
				<?php } ?>
				
				
</tr> <?php
if($dmm>$damt){
	$sts = 1;
	$less = 0;
	$pamt = $damt;
	$noo++;
}
elseif($dmm==$damt){
	$sts = 0; $less = 0;
	$pamt = $damt;
	$noo++;
}
else{
	
	$sts = 0;
	$pamt = $dmm;
	$less = 0;
}
$pamt = $dmm; }
?>

<?php $dmm = $dmm;
$spfine = $spfine + $fine2;
$spdd = $spdd + $i6; $spff = $spff + $fine18;  
$sphl = $sphl + $hloan8;
 }  
$ttp = $ttp + $pass; $tti = $tti + $rno; $ttdue = $ttdue + $urname;	$ttdd = $ttdd + $i6;	
$ttfine = $ttfine + $fine2;	
$ttpf = $fine1 + $ttpf;	$tthl = $tthl + $hloan;	$tttot = $tttot + $urname1;
				
} } 





$qry51=mysqli_query($conn, "select * from netm where mfin='$mfin2' &&  hpl='$hpl'");
					$n51=mysqli_num_rows($qry51);
					$row51 = mysqli_fetch_array($qry51);
					if($n51>0){ ?>
			<tr>
					<td></td>
					<td> 
					<?php $tdue = $urname - $hloan - $fine1; ?>
						<a href="editrcpt.php?fid=<?php echo $fidd; ?>"<button class="btn btn-success text-center">
                        A/C Closed
                    </button></a></td><td><?php echo $row51['roll']; ?></td>
					<td><?php echo $row51['paydate']; ?></td>
					<td></td>
				<!--	<td><?php //echo $pass; ?></td>
					<td><?php //echo $rno; ?></td> -->
					<td><?php echo $row51['tot']; ?></td><td></td>
				<td></td>	<td></td>	
				 <td><?php echo $row51['fine']; ?></td> 
					
			
</tr>			
				<?php $ttt = $row51['tot'];  $spdue = $spdue + $ttt;	}
else { 
if($less > 0){
	$tday = date('d-m-Y');
  $d11 = strtotime($duedat);
$d22 = strtotime($tday);
$min_date1 = min($d11, $d22);
$max_date1 = max($d11, $d22);
$i6 = 0;
if($d11<=$d22) {
while (($min_date1 = strtotime("+1 DAY", $min_date1)) <= $max_date1) {
    $i6++;
}
}
if($i6 < 3){
    
$fine2 = 0;
} else {
$fine2 = (($defamt/$damt)*($i6 * $less));
 }
if($fine2 < 0) {
	$fine2 = 0;
}

$dmm = 0;
	?><tr>
					<td></td>
					<td></td>	
					<td></td>
					<td></td>
					<td></td>
				<!--	<td><?php //echo $pass; ?></td>
					<td><?php //echo $rno; ?></td> -->
					<td></td><td><?php echo $less; ?></td>
				<td><?php echo $i6; ?></td>	
				<td><?php echo round($fine2,0); ?></td>	
				<?php if($gi==1) { ?> <td></td> <?php } else { ?>
<td></td>
				<?php } ?>
				
				
</tr>  <?php	
$spfine = $spfine + $fine2;
$spdd = $spdd + $i6;
$sppp = $sppp + $less;
}
$ii++;
while($ii<=$pp) {
	$zzzz++;
	$selected_date=$duedat;
		  	$selected_date=strtotime( $selected_date );
			$mysqldate = date( 'd-m-Y', $selected_date );
			$month = date( 'm', $selected_date );
			$day = date( 'd', $selected_date );
			$yyyy = date( 'Y', $selected_date );
			$zzz = $zz * 1;
$duedat = date("d-m-Y", strtotime("$hpdate + " . $zzz . " week"));
  $d11 = strtotime($duedat);
$d22 = strtotime("today");
$min_date1 = min($d11, $d22);
$max_date1 = max($d11, $d22);
$i6 = 0;
if($d11<=$d22) {
while (($min_date1 = strtotime("+1 DAY", $min_date1)) <= $max_date1) {
    $i6++;
} }

if($i6 <= 3){
    
$fine2 = 0;
} else {
$fine2 = $defamt * $i6; }
if($fine2 < 0) {
	$fine2 = 0;
}
	?>
<tr>
					<td><?php echo $ii; ?></td>
						<?php if($i6 > 0){ ?>
					<td><button class="btn btn-danger text-center"><i class="fa  fa-pencil fa-1x"></i><b><?php echo $duedat; $zz++;?></b>
                    </button></td>
					<?php } else { ?>
					<td><button class="btn btn-success text-center"><i class="fa  fa-pencil fa-1x"></i><b><?php echo $duedat; $zz++;?></b>
                    </button></td> <?php } ?><td></td><td></td>
					<td><?php echo $damt; ?></td>
					<!--<td><?php //echo $prin; ?></td>
					<td><?php //echo $intt2; ?></td> -->
					<td></td><td><?php echo $damt; ?></td>
						<td><?php echo $i6;?></td><td><?php echo round($fine2,0);?></td><td>-</td>
					
				
</tr> 

<?php  $ii++; 
$ttdd = $ttdd + $i6;	
$ttfine = $ttfine + $fine2;	
$spfine = $spfine + $fine2;
$spdd = $spdd + $i6;
$sppp = $sppp + $damt;
} } ?>	
<tr>
						<td></td>
						<td></td>
						<td></td>
						<td></td>
						<td><b><?php $ccc = $spdue + $sppp; echo $ccc; ?></b></td>
					<!--	<td><?php //echo $ttp; ?></td>
					<td><?php //echo $tti; ?></td> -->
						<td><b><?php echo $spdue; ?></b></td>
						<td><b><font color="red"><?php echo $sppp; ?></font></b></td>
						<td><b><?php echo $spdd; ?></b></td>
						<td><b><?php echo round($spfine,0); ?></b></td>
						<td><b><?php echo $spff; ?></b></td>
						
		</tr>		
					</tbody></table>
  
 

	</div>			
</div>
</div></div>
		  
		  
		  </div>     </div>
                <!-- end of weather widget -->
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->
   
	   <?php include "layouts/footer.php"; ?>
  </body>
</html>
