<?php
if($p_status!=="2" && $p_status!=="3" && $status=="Cancel"){

$u6_user_id = $user_id;
//
$sql25="SELECT * from j_users WHERE 
j_deleted < 1 AND j_id='".$u6_user_id."'
"; //  
$result25 = runSQL($sql25);
$data25 = mysqli_fetch_array($result25);
$u6_id = $data25['j_id'];
//$u6_bal = $data25['j_wallet'];
$u6_email = $data25['j_email'];
$u6_phone = $data25['j_phone'];
$u6_firstname = $data25['j_firstname'];
$u6_lastname = $data25['j_lastname'];
$u6_name = "$u6_firstname $u6_lastname"; $u6_name = trim($u6_name);
if($u6_id > 0){
	$u6_r_bonus = $u6_amount;
	//
	//j_next_pay_date ='".$next_pay_date."',j_profit ='".$u6_bal."'
	$timex = time();
	$ip = getIPAddress();
	//state the next pay
	$sql = "UPDATE j_pays SET
	j_paid='0', j_disburse='0', j_status='2' 
	WHERE j_id='".$deposit_id."'";
	$result = runSQL($sql);
	if(!$result){
		die("Error. Code 1003.");
	}
	//send a message to u6
	$u_email = $u6_email;
	$u_subject ="Deposit Status";
	$u_subject_m ="Deposit Status";
	$u_message ="<p>Dear $u6_name;</p> 
	<p>Your deposit of (<b>".amount_w_c($u6_r_bonus,$wallet_type)."</b>) has been rejected. 
	<br/><br/>
	Payment Ref: <b>$r_ref</b>
	<br/><br/>
	Thank you for choosing <b>$company</b>.
	</p>";
	
	$u_message_sm ="Your deposit of (<b>".amount_w_c($u6_r_bonus,$wallet_type)."</b>) has been rejected. Payment Ref: <b>$r_ref</b>";
	
	//send notify
	//send_notify("",$u6_id,$u_subject_m,$u_message);
	send_notify2("",$u6_id,$u_subject,$u_message,$u_message_sm,"notification","deposit_cancel","");


	require("../j_incs/mail.php");
	
	
	echo $u_message;
}
}
?>