<?php  

  session_start();
  // error_reporting(0);
		include("../db.php");
		include("../all_query.php");
		

 if(isset($_SESSION['loan_crm_username']) && isset($_SESSION['loan_crm_password']))
{
	
	
	$payment_account_id = $_REQUEST['payment_account_id'];
	$payment_amount = $_REQUEST['payment_amount'];
	$account_holder_id = $_REQUEST['account_holder_id'];
	
	
	  $customerQ = mysqli_query($conn,"select *from `customer` where account_holder_id = '$account_holder_id' ");
	   $customerData = mysqli_fetch_assoc($customerQ);
				  
		 $advisor = $customerData['advisor'];
				  
				  
				  
	
	
	  $INSERT_DATA  = array();
	  
	  $INSERT_DATA['account_holder_id'] = trim($account_holder_id);
	  $INSERT_DATA['accountid'] =  trim($payment_account_id);
	  $INSERT_DATA['advisor'] = $advisor;
	  $INSERT_DATA['payment'] = trim($payment_amount);
	  $INSERT_DATA['commitment_date'] = date('Y-m-d');
	  //$INSERT_DATA['update_by'] = $_SESSION['login_name'];
	  //$INSERT_DATA['added_type'] = 'manual';
	  
	  
	 // print_r($INSERT_DATA);
	  
	 insertTable($conn,'commitment',$INSERT_DATA,'add_submit');
	
	
	 
	 
	 echo "Commitment Added Successfully!";
	 
	
	
}


?>