<?php include "layouts/menu.php"; ?> <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
                    <h1 class="page-header  alert alert-info">Bussines Report</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                             Details
                        </div>
                        <div class="panel-body">
                            <div class="row">
  
   <div class="alert alert-info">Bussines Report</div>
  
                    <?php
		
						$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin'");
						$n=mysqli_num_rows($qry);
						if($n==0)
						{
							echo "Nothing To Display";
						}
						else
					{ 
						?> </p>
					<table class="table table-striped" table class="table" border="1" align="center" cellspacing="0" cellpadding="10" >
					<col width="100px">
						<tr class="danger" style="color:purple;">
						<th>Month</th>
						<th colspan="4"><center>Hp Reciept</center></th>
						
						<th colspan="3"><center>HP Ledger</center></th>
						
					</tr>
						<tr class="danger" style="color:purple;">
						<th>&nbsp;&nbsp;&nbsp;</th>
						<th>Principle</th>
						
						<th>Interest</th>
						<th>default</th>
						<th>Total</th>
						<th>HP</th>
						<th>Loan Amt</th>
						<th>Doc Charge</th>
						<th>Commission Charge</th>
						<th>J K DC</th>
					</tr>
					<tr class="warning">
					<col width="100px">
						<td>2019 January</td>
		<?php		
	$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-01-2019';
								$tdate = '31-01-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>
					<tr class="warning">
					<col width="100px">
						<td>2019 Febraury </td>
						<?php		
	$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-02-2019';
								$tdate = '31-02-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
						
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>
					<tr class="warning">
					<col width="100px">
						<td>2019 March</td>
						<?php		
	$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-03-2019';
								$tdate = '31-03-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>
										<tr class="warning">
					<col width="100px">
						<td>2019 April</td>
						<?php		
				$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-04-2019';
								$tdate = '31-04-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>
										<tr class="warning">
					<col width="100px">
						<td>2019 May</td>
						<?php		
					$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-05-2019';
								$tdate = '31-05-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
										
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>					<tr class="warning">
					<col width="100px">
						<td>2019 June</td>
						<?php		
					$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-06-2019';
								$tdate = '31-06-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
									$sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						            $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fine) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>					<tr class="warning">
					<col width="100px">
						<td>2019 July</td>
						<?php		
					$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-07-2019';
								$tdate = '31-07-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>					<tr class="warning">
					<col width="100px">
						<td>2019 August</td>
						<?php		
					$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-08-2019';
								$tdate = '31-08-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>					
										<tr class="warning">
					<col width="100px">
						<td>2019 September</td>
						<?php		
	$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-09-2019';
								$tdate = '31-09-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>
					<tr class="warning">
					<col width="100px">
						<td>2019 October</td>
						<?php		
	$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-10-2019';
								$tdate = '31-10-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr><tr class="warning">
					<col width="100px">
						<td>2019 November</td>
						<?php		
	$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-11-2019';
								$tdate = '31-11-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr><tr class="warning">
					<col width="100px">
						<td>2019 December</td>
						<?php		
	$rrow2 =0 ;$rrow3 =0 ;$rrow3 =0 ;$rrow4 =0 ;$rrow5 =0 ;$rrow6 =0 ;$rrow7 =0 ;$rrow8 =0 ;$rrow9 =0 ;$rrow10 =0 ;$rrow21 =0 ;$rrow71 =0 ;
$rrow519 =0 ;$rrow59 =0 ;$rrow144 =0 ;$rrow14 =0 ;$rrow1 = 0;$rrow212 = 0; $nh = 0; $rrow98 = 0;$rrow983 = 0;$rrow101=0;$rrow100=0;$rrow619=0;
$rrow6669=0;
				$fdate = '01-12-2019';
								$tdate = '31-12-2019';
								
								while (strtotime($fdate) < strtotime($tdate)) 
								{
                                   $paydate = $fdate;
								   
 $sql = "SELECT SUM(invest) FROM invest where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row1 = mysqli_fetch_array($q);
									$rrow1 = $row1[0] + $rrow1;								   
						           $sql = "SELECT SUM(rno) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $qy = mysqli_query($conn, $sql);
                                    $row2 = mysqli_fetch_array($qy);
									$rrow2 = $row2[0] + $rrow2;
									
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row21 = mysqli_fetch_array($q);
									$rrow21 = $row21[0] + $rrow21;
										
									$sql = "SELECT SUM(fin) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row212 = mysqli_fetch_array($q);

                                    $rrow212 = $row212[0] + $rrow212;									
									$sql = "SELECT SUM(bal) FROM dc where mfin='$mfin' &&  date='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row3 = mysqli_fetch_array($q);
									$rrow3 = $row3[0] + $rrow3;
									$sql = "SELECT SUM(fine) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row4 = mysqli_fetch_array($q);	
                                    $rrow4 = $row4[0] + $rrow4;									
									$sql = "SELECT SUM(urname) FROM user where mfin='$mfin' &&  paydate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row666 = mysqli_fetch_array($q);
                                    $row6[0] = $row666[0] -  $row2[0] - $row4[0];
									$rrow6 = $row6[0] + $rrow6;
									$sql = "SELECT SUM(tot) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row519 = mysqli_fetch_array($q);
									$rrow519 = $row519[0] + $rrow519;
									$sql = "SELECT SUM(dueamt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row619 = mysqli_fetch_array($q);
									$rrow619 = $row619[0] + $rrow619;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row669 = mysqli_fetch_array($q);
									$rrow6669 = $row669[0] + $rrow6669;
									$sql = "SELECT SUM(amt) FROM net where mfin='$mfin' &&  bmnt='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row419 = mysqli_fetch_array($q);
									$row59 = $row519[0]-$row419[0];
									$rrow59 = $row59[0] + $rrow59;
									$sql5 = "SELECT * FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q5 = mysqli_query($conn, $sql5);
									$nh2 = mysqli_num_rows($q5);
									$nh = $nh2 + $nh;
									$sql = "SELECT SUM(hpamount) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
									
                                    $row9 = mysqli_fetch_array($q);
									$rrow9 = $row9[0] + $rrow9;
									$sql = "SELECT SUM(hpamount) FROM customer where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q = mysqli_query($conn, $sql);
                                    $row14 = mysqli_fetch_array($q);			
								$rrow14 = $row14[0] + $rrow14;
								$sql = "SELECT SUM(document) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q12 = mysqli_query($conn, $sql);
									
                                    $row98 = mysqli_fetch_array($q12);
									$rrow98 = $row98[0] + $rrow98;
									$sql = "SELECT SUM(bcommission) FROM customerdetails where mfin='$mfin' &&  hpdate='$paydate'";
                                    $q123 = mysqli_query($conn, $sql);
									
                                    $row983 = mysqli_fetch_array($q123);
									$rrow983 = $row983[0] + $rrow983;
									
									
								$fdate = date ("d-m-Y", strtotime("+1 day", strtotime($fdate)));
								}

$tot45 = $rrow98- $rrow983;
$rrow100 = $rrow6+ $rrow619;
$rrow101 = $rrow2+ $rrow6669;
$tot4 = $rrow100 + $rrow101 + $rrow4;


								?>
						<td><?php echo $rrow100; ?></td>
			
						<td><?php echo $rrow101; ?></td>
						<td><?php echo $rrow4; ?></td>
						<td><?php echo $tot4; ?></td>
						<td><?php echo $nh; ?></td>
						<td><?php echo $rrow9; ?></td>
					
					
						<td><?php echo $rrow98; ?></td>
						<td><?php echo $rrow983; ?></td>
						<td><?php echo $tot45; ?></td>
					</tr>
					<?PHP } ?>
					</table>
					
</div>
</div></div>
</div></div></div> <?php include "layouts/footer.php"; ?></body></html>
