 


 <?php
session_start();
if(isset($_SESSION['SESS_ADMINLOGGEDIN']) == FALSE) {
    header("Location: " . $config_basedir."access");
}
date_default_timezone_set('Africa/Lagos');
require_once("achieved/config.php");
require_once("achieved/db.php");
require_once("achieved/db2.php");
require_once("achieved/functions.php");






	$query=$conn->query("select  id,email,email2,buy_rate,sell_rate,tr_rate, wid_rate,welc_head, welc_msg,url,news_head,news_msg, title, ceo, phone, address,city,state,country, domain, domain_name, about_head, about_msg, service1, service2, service3,GHS,NGN,EUR,GBP,CAD,ZAR,USD, reg_clients,btc_sold, btc_bought, copyright,contact_email, developa from settings  ORDER BY id DESC LIMIT 1");
			while($row=$query->fetch()){
			
				$title=$row['title'];
				$id=$row['id'];
				$welc_head=$row['welc_head'];
			    $welc_msg=$row['welc_msg'];
				$url=$row['url'];
				$ceo=$row['ceo'];
				$domain=$row['domain'];
				$domain_name=$row['domain_name'];
				$phone=$row['phone'];
				$country=$row['country'];
				$state=$row['state'];
				$city=$row['city'];
				$email=$row['email'];
				$email2=$row['email2'];
				$copyright=$row['copyright'];
				$contact_email=$row['contact_email'];
					$developa=$row['developa'];
				
				
				$sell_rate=$row['sell_rate'];
				$buy_rate=$row['buy_rate'];
					$tr_rate=$row['tr_rate'];
						$wid_rate=$row['wid_rate'];
				
				
				$GHS=$row['GHS'];
				$USD=$row['USD'];
				$EUR=$row['EUR'];
				$NGN=$row['NGN'];
				$CAD=$row['CAD'];
				$GBP=$row['GBP'];
				$ZAR=$row['ZAR'];
				
				
					$reg_clients=$row['reg_clients'];
			$btc_sold=$row['btc_sold'];
			$btc_bought=$row['btc_bought'];
			
			
			 $news_head=$row['news_head'];
		   	$news_msg=$row['news_msg'];
				
				
				$about_head=$row['about_head'];
				$about_msg=$row['about_msg'];
				
					$service1=$row['service1'];
						$service2=$row['service2'];
							$service3=$row['service3'];	
							








// if(isset($_GET['ref'])==TRUE){
//     $ref=mysql_real_escape_string($_GET['ref']);
//     $refcheck=mysql_query("SELECT * FROM logins WHERE email='$ref'");
//     $refnumr=mysql_num_rows($refcheck);
    
//     if($refnumr<1){
//         $ref='admin';
//     }
    
//     else{
//         $_SESSION['ref']=$ref;
//     }
// }
?>
<?php }?>



        
        
 
 <?php
 
 

 

if (isset($_POST['calaction'])) {
    $IR = mysql_real_escape_string($_POST['IR']);
    $PC = mysql_real_escape_string($_POST['PC']);
     $SP = mysql_real_escape_string($_POST['SP']);
      $PL = mysql_real_escape_string($_POST['PL']);
    $addresssql = mysql_query("UPDATE loan SET IR='$IR', PC='$PC', SP='$SP', PL='$PL'  WHERE id='$id'");
    echo mysql_error();
    $success="<div class='alert alert-success' style='margin-bottom:20px;'>Calculator Set Successfully<meta http-equiv='refresh' content='5; url=' /></div>";
}



if (isset($_POST['bname'])) {
   
    $status = mysql_real_escape_string($_POST['status']);
     $bemail = mysql_real_escape_string($_POST['bemail']);
      $bphone = mysql_real_escape_string($_POST['bphone']);
       $bname = mysql_real_escape_string($_POST['bname']);
        $wallet_id = mysql_real_escape_string($_POST['wallet_id']);
       $loan_bal = mysql_real_escape_string($_POST['loan_bal']);
        $total_payment = mysql_real_escape_string($_POST['total_payment']);
    $nex_pay = mysql_real_escape_string($_POST['nex_pay']);
       $amount = mysql_real_escape_string($_POST['amount']);
        $return_pay = mysql_real_escape_string($_POST['return_pay']);
        
         $return_date = mysql_real_escape_string($_POST['return_date']);
          $closed_date = mysql_real_escape_string($_POST['closed_date']);
      
      
      
      $cname = mysql_real_escape_string($_POST['cname']);
       $cemail = mysql_real_escape_string($_POST['cemail']);
        $caddress = mysql_real_escape_string($_POST['caddress']);
      $copyright = mysql_real_escape_string($_POST['copyright']);
      $cphone = mysql_real_escape_string($_POST['cphone']);
   
     
    // $addresssql = mysql_query("UPDATE loan SET status='$status',loan_bal='$loan_bal', nex_pay='$nex_pay', return_pay=0, pay_amount='$pay_amount', total_payment='$total_payment',nex_date='$nex_date',closed_date='$closed_date'    WHERE id=$id ");
    // echo mysql_error();
    $success="<div class='alert alert-success' style='margin-bottom:20px;'>Payment made Successfully<meta http-equiv='refresh' content='5; url=' /></div>";
}



         





         {
         
   
  //   =============TO==USER=================  
       
       

   $cmail = $row['cemail'];
     
        
       if (isset($bname))
       {
            $to = $bemail;
            $subject = 'PAYMENT RECEIPT!!!';
       
        $body ='
    
 <table cellpadding="0" cellspacing="0" color="" style="color: rgb(116, 120, 126); font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
    <tbody>
        <tr>
            <td cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
                <table align="center" cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="570">
                    <tbody>
                        <tr>
                            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                <table cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
                                    <tbody>
                                        <tr>
                                            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                                <table cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
                                                    <tbody>
                                                        <tr>
                                                            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="font-size: 20px;"><strong>&nbsp;PAYMENT RECEIPT!!!</strong></span></p>
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                
                                
                                <p>Welcome to '.$cname.'</p>
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">Your Payment has been approved.</p>
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">Below are your Payment informations.</p>
                                BORROWER NAME : '.$bname.'<br>
                                ACCOUNT NUMBER : '.$wallet_id.' <br>
                                RETURN AMOUNT : NGN'.number_format($return_pay,2).'<br>
                                 PAYMENT DATE : '.$return_date.'<br>
                               
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;"> Thank you for your patronage..</p>
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">'.$cname.' Services</p>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                <table align="center" cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="570">
                    <tbody>
                        <tr>
                            <td align="center" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">&copy;'.$copyright.'</p>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
    
    
    <hr style="border-top: 1px solid #00B9CD;" >
    
    FOR MORE INFORMATION : <br> CONTACT THE CUSTOMER CARE SERVICE ('.$cemail.') or DIAL THE NUMBER TO SPEAK WITH ONE OF OUR AGENTS : ('.$cphone.'), or Visit '.$url.', Thank You.
       
       
      
      
       
     
      
      
       ';
      
        $header = "From:". $cemail."\r\n";
       
        $header .= "MIME-Version: 1.0\r\n";
       
        $header .= "Content-Type: text/html; charset=UTF-8\r\n";
       
        if(@mail($to, $subject, $body, $header)){
            
            $sender = "$cname";
                        $mobile = validate_phone_number($bphone);
                        $msg = 'Welcome to '.$cname.', Your Loan Payment of NGN'.number_format($amount,2).' has been Received and your current Loan Balance is NGN'.number_format($loan_bal,2).'. Contact Us for any further Enquries @ '.$cphone.'.. Thank You.
                                ';
                        sendBulkSMS($sender,$mobile, $msg);
                        
                      if(isset($success)){
    
    
    echo $success;
    $sender = "$cname";
    //die($phone);
    $mobile1 = validate_phone_number($phone);
    $msg =  'Make payment';
    $date2 =   mysql_real_escape_string($_POST['date2']);
    $do= sendBulkSMS_sch($sender, $mobile1, $message, $date2);
 

}  
                         


}
}


}
?>     
   
 
 
 
 



<!doctype html>
<html>

<!-- Mirrored from www.sparksuite.com/open-source/invoice.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 16 Jan 2021 14:29:32 GMT -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $title?></title>

<link rel="icon" href="img/favicon.png" type="image/x-icon">

<style>
	body{
		font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
		text-align:center;
		color:#777;
	}
	
	body h1{
		font-weight:300;
		margin-bottom:0px;
		padding-bottom:0px;
		color:#000;
	}
	
	body h3{
		font-weight:300;
		margin-top:10px;
		margin-bottom:20px;
		font-style:italic;
		color:#555;
	}
	
	body a{
		color:#06F;
	}
	
	.invoice-box{
		max-width:800px;
		margin:auto;
		padding:30px;
		border:1px solid #eee;
		box-shadow:0 0 10px rgba(0, 0, 0, .15);
		font-size:16px;
		line-height:24px;
		font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
		color:#555;
	}
	
	.invoice-box table{
		width:100%;
		line-height:inherit;
		text-align:left;
	}
	
	.invoice-box table td{
		padding:5px;
		vertical-align:top;
	}
	
	.invoice-box table tr td:nth-child(2){
		text-align:right;
	}
	
	.invoice-box table tr.top table td{
		padding-bottom:20px;
	}
	
	.invoice-box table tr.top table td.title{
		font-size:45px;
		line-height:45px;
		color:#333;
	}
	
	.invoice-box table tr.information table td{
		padding-bottom:40px;
	}
	
	.invoice-box table tr.heading td{
		background:#eee;
		border-bottom:1px solid #ddd;
		font-weight:bold;
	}
	
	.invoice-box table tr.details td{
		padding-bottom:20px;
	}
	
	.invoice-box table tr.item td{
		border-bottom:1px solid #eee;
	}
	
	.invoice-box table tr.item.last td{
		border-bottom:none;
	}
	
	.invoice-box table tr.total td:nth-child(2){
		border-top:2px solid #eee;
		font-weight:bold;
	}
	
	@media only screen and (max-width: 600px) {
		.invoice-box table tr.top table td{
			width:100%;
			display:block;
			text-align:center;
		}
		
		.invoice-box table tr.information table td{
			width:100%;
			display:block;
			text-align:center;
		}
	}
	</style>
</head>
<body>
<br>
<div class="invoice-box">
<table cellpadding="0" cellspacing="0">
<tr class="top">
<td colspan="2">
<table>
    
<tr>
<td class="title">
<img src="img/LOGO.png" style="width:100%; max-width:300px;">
</td>


    
            <?php
            
            $date=date_create($ordrow['appl_date']);
date_add($date,date_interval_create_from_date_string('30 days'));


            $log_id = $_GET['loan_id'];
 $ordsql = "SELECT * from payment WHERE id = " . $log_id; 
$ordres = mysql_query($ordsql);
$ordrow = mysql_fetch_assoc($ordres);
  echo"<td>
Invoice #: 123<br>
Created: " . $ordrow['return_date'] . "]<br>


    



Due: " . date_format($date,'jS F Y g.iA') . "]
</td>





</tr>



</table>
</td>
</tr>



  <tr class='information'>
<td colspan='2'>
<table>
    
    
<tr>
<td>
" . $ordrow['bname'] . "<br>
" . $ordrow['bphone'] . "<br>
" . $ordrow['bemail'] . "<br>

</td>






<td>
" . $domain_name . "<br>
" .$url . "<br>
" .$phone . "<br>
" .$email2 . "<br>
</td>
</tr>



</table>
</td>
</tr>

<tr><td>

   
</td></tr>


<tr class='bname'>
<td>
Payment Method
</td>
<td>
" . $ordrow['pay_type'] . " #
</td>
</tr>
";


  if($ordrow['status'] == 1)
          {
echo"<tr class='details'>
<td>
" . $ordrow['pay_type'] . "
</td>



<td>
NGN". number_format($ordrow['return_pay'],2)."  
</td>



</tr>


<tr class='heading'>
<td>
Total Amount
</td>
<td>
NGN". number_format($ordrow['return_pay'],2)."  
</td>
</tr>";
}


  elseif($ordrow['status'] == 4)
          {
echo"<tr class='details'>
<td>
" . $ordrow['pay_type'] . "
</td>



<td>
NGN". number_format($ordrow['miss_pay'],2)."  
</td>



</tr>


<tr class='heading'>
<td>
Total Amount
</td>
<td>
NGN". number_format($ordrow['miss_pay'],2)."  
</td>
</tr>";
}


echo"<tr>
     
   
</tr>
</table>
</div>
 <hr>


  <form class='form-horizontal' method='post' enctype='multipart/form-data' action=''>

<input name='bname' type='hidden' class='form-control' value='" . $ordrow['bname'] . "' readonly>

<input name='bemail' type='hidden' class='form-control' value='" . $ordrow['bemail'] . "' readonly>

<input name='wallet_id' type='hidden' class='form-control' value='" . $ordrow['wallet_id'] . "' readonly>

 <input name='bphone' type='hidden' class='form-control' value='" . $ordrow['bphone'] . "' readonly>

 
 
 <input name='return_pay' type='hidden' class='form-control' value='".($ordrow['return_pay'])."' readonly>
	
	<input name='return_date' type='hidden' class='form-control' value='" . $ordrow['return_date'] . "' readonly>
	

	
 <input name='agent' type='hidden' class='form-control' value='ADMIN' readonly>";
?>

        <?php 
if(isset($success)){
    echo $success;
}
?>
         
         
               <?php
  $orderssql = "SELECT * from settings  ORDER BY id DESC";
    $ordersres = mysql_query($orderssql);
    $numrows = mysql_num_rows($ordersres);
   

 while($row = mysql_fetch_assoc($ordersres))
     {


echo"<input type='hidden' class='form-control' name='cname' id='details'  value='".$row['domain_name']."'>

<input type='hidden' class='form-control' name='cemail' id='details'  value='".$row['email2']."'>

<input type='hidden' class='form-control' name='cphone' id='details'  value='".$row['phone']."'>

<input type='hidden' class='form-control' name='caddress' id='details'  value='".$row['address']."'>

<input type='hidden' class='form-control' name='copyright' id='details'  value='".$row['copyright']."'>
      
      
       
";

}
?> 

 <div class="toolbar hidden-print">
        <div class="text-right">
           
           
            <button type="submit" name="action" class="btn btn-info"><i class="fa fa-reply"></i> CONFIRM PAYMENT</button>
            
            </form>
            
            <a href="list_loan.php" class="btn btn-info"><i class="fa fa-reply"></i> Back</a>
           
           
            
            <button onclick='myFunction()' class='btn btn-info'>
<i class='fa fa-print'>&nbsp;Print</i></button>
            
            <!--<button class="btn btn-info"><i class="fa fa-file-pdf-o"></i> Export as PDF</button>-->
        </div>
       
    </div>

<script data-cfasync="false" src="cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script></body>

<!-- Mirrored from www.sparksuite.com/open-source/invoice.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 16 Jan 2021 14:29:34 GMT -->
</html>



<script>
function myFunction() {
  window.print(); }
</script>
