Mini Shell

Direktori : /home/mhcadmin/www/
Upload File :
Current File : //home/mhcadmin/www/Balances.php

<!DOCTYPE html>
<html class="wide wow-animation" lang="en">
  
<?php


include_once('includes/Header.php');

$TotalBalanceRemaining = "";
												 
?>

<a class="d-block" href="" target="blank"><img class="d-block w-100" src="images/MHCB1.jpg" height="200"></a>


<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{

//session_start();
require_once 'config/config.php';
//require_once 'include/auth_validate.php';

$TotalPaidAmount = $PaidAmount = $ChargedBalance =  $TotalBalance = $TotalBalanceRemaining = 
$SearchedDebtorNo = $PaidAmounts = $resultx = $SearchedDebtorNo = $TotalPaid = $CPaidAmounts = 
$CChargedBalance = $Period = $PaidAmountx = $CPaidAmountsx = ""; 



$SearchedDebtorNo = $_POST['s'];

$resultc = mysqli_query( $connection,"SELECT * FROM debtorslist WHERE DebtorNo = '$SearchedDebtorNo' ");
									$numc = mysqli_num_rows($resultc);

										
									
									
									if ($numc > 0) {
										
										$rowsc = mysqli_fetch_array($resultc);
											$DLID = $rowsc['DLID'];
											$DebtorNo = $rowsc['DebtorNo'];
											$Name = $rowsc['Name'];
											$PropertyNo = $rowsc['PropertyNo'];
											$DebtorType = $rowsc['DebtorType'];
											$ChargedBalance = $rowsc['Balance'];
											
											If ($DebtorType == 'Ground Rent') {$Period = 'Year';} 
											If ($DebtorType == 'House Rent') {$Period = 'Month';}
											If ($DebtorType == 'Plot Sale') {$Period = 'Plot Sale';}
											
											 
											$bad_symbols = array(",");
											$CChargedBalance = str_replace($bad_symbols, "", $ChargedBalance);
									
									$resultx = mysqli_query( $connection,"SELECT * FROM receipts WHERE DEBTORID = '$SearchedDebtorNo' ");
									$numx = mysqli_num_rows($resultx);
									 
									 }
																		?>




<section class="section-md bg-gray-100">
        <div class="container">
		
		 
          <div class="row justify-content-center">
            <div class="col-lg-9 col-xl-8">	
		<?php 
						if ($numc >0){
						
						?>

		<div class="tabs-custom tabs-horizontal tabs-modern" id="tabs-modern">
                    <ul class="nav nav-tabs">
                      <li class="nav-item" role="presentation"><a class="nav-link active" href="#tabs-modern-1" data-bs-toggle="tab">BALANCE</a></li>
                      <li class="nav-item" role="presentation"><a class="nav-link" href="#tabs-modern-2" data-bs-toggle="tab">MINI STATEMENT</a></li>
                      
                    </ul>
                    <div class="tab-content">
                      <div class="tab-pane fade show active" id="tabs-modern-1">
                         
                        						 
						
						 <table class="table table-striped table-bordered table-condensed">
												<thead>
													<tr><td colspan ="5">Total Bill for this  <?php echo"$Period "." is "."$CChargedBalance"; ?></td></tr>		
													<tr style= "background-color:#BAC4CC;">
														
														<th>DebtorNo</th>
														<th>Name</th>		
														<th>PropertyNo</th>
														<th>DebtorType</th>
														<th>BALANCE</th>
														
													</tr>
												</thead>

												<tr>
												
												<?php  

												while($rowX = mysqli_fetch_array($resultx)) {
											
												
												 $PaidAmounts = $rowX['AMOUNT'];
												 
												 $CPaidAmounts = number_format($PaidAmounts, 2);
												
												 
												 $bad_symbols = array(",");
											     $CPaidAmounts = str_replace($bad_symbols, "", $PaidAmounts);
									
												 
												 $TotalPaidAmount = $TotalPaidAmount + $PaidAmounts; 
												 
												}
												
												
												$TotalBalanceRemaining = $CChargedBalance - $TotalPaidAmount;
												?>
												
													<td><?php echo $DebtorNo; ?></td>
													<td><?php echo $Name; ?></td>
													<td><?php echo $PropertyNo; ?></td>
													<td><?php echo $DebtorType; ?></td>
													<td><?php echo $TotalBalanceRemaining; ?></td>
													
													
											   </tr>
									  
						 </table>
						
										  
                      </div>
                      <div class="tab-pane fade" id="tabs-modern-2">
                                          <!-- Post Classic-->
										  
						<?php 
						if ($numx >0){
						
						?>
                        <table class="table table-striped table-bordered table-condensed">
												<thead>
													<tr><td colspan ="8">Total Bill for this  <?php echo"$Period "." is "."$CChargedBalance"; ?></td></tr>
													
													<tr style= "background-color:#BAC4CC;">
														
														<th>TRANSACTION DATE</th>
														<th>DEBTORID </th>		
														<th>AMOUNT</th>
														<th>PAIDBY</th>
														<th>PAYMENT DETAILS</th>
														<th>BANK REFERENCE</th>
														<th>CHANNEL</th>
														<th>BALANCE</th>
														
													</tr>
												</thead>

										<?php		
									$resultx = mysqli_query( $connection,"SELECT * FROM receipts WHERE DEBTORID = '$SearchedDebtorNo' ORDER BY RID DESC");
											
									while($rowX = mysqli_fetch_array($resultx)) {
										
										        $PaidAmountx = $rowX['AMOUNT'];
												 
												
												 $bad_symbols = array(",");
											     $CPaidAmountsx = str_replace($bad_symbols, "", $PaidAmountx);
									
												 $TotalPaid = $TotalPaid + $CPaidAmountsx;
												 $TotalBalanceRemain = $CChargedBalance - $TotalPaid;
										
										
										?>
											<tr>
												
												<td><?php echo htmlspecialchars($rowX['TRANSACTIONDATE']); ?></td>
												<td><?php echo htmlspecialchars($rowX['DEBTORID']) ?></td>
												<td><?php echo htmlspecialchars($rowX['AMOUNT']) ?> </td>
												<td><?php echo htmlspecialchars($rowX['PAIDBY']) ?> </td>
												<td><?php echo htmlspecialchars($rowX['PAYMENT_DETAILS']) ?> </td>
												<td><?php echo htmlspecialchars($rowX['BANK_REFERENCE']) ?> </td>
												<td><?php echo htmlspecialchars($rowX['CHANNEL']) ?> </td>
												<td><?php echo $TotalBalanceRemain ?></td>
									<?php } ?>	
												
											
											   </tr>
									  
											</table>
						<?php } else{echo "No Payment Record was found";}?>

						
                      </div>
                      
					 
                    </div>
                  </div>
		
	  
		<?php } else{echo "No Record found, check the debtor number or visit our Offices";}?>

		 </div>
          </div>
        </div>

	    </section>
		



<?php }?>
   
	   <section class="section-md bg-gray-100">
        <div class="container">
		
		 
		 
          <div class="row justify-content-center">
            <div class="col-lg-9 col-xl-8">
			   <!-- RD Search-->
              <div class="rd-search-modern">
                <form class="rd-form rd-search" action="" method="POST">
                  <div class="form-wrap">
                    <label class="form-label" for="rd-search-form-input">Enter Your Debtor Number Here </label>
                    <input class="form-input" id="rd-search-form-input" type="text" name="s" autocomplete="off">
                  </div>
                  <button class="rd-search-form-submit fl-budicons-launch-search81" type="submit"></button>
                </form>
              </div>
              <div class="rd-search-results"></div>
           
   
 </div>
          </div>
        </div>

	    </section>
		
		
	  
  
	  <?php

include_once('includes/Footer.php');
?>
  </body>
  
</html>