<?php




			session_start();


if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
	header ("Location: ../login.php");
}
		


?>


<?php
require 'config.php';

			 $db_handle = mysqli_connect(DB_SERVER, DB_USER, DB_PASS);
			 $database = $_SESSION['database'];
			$db_found = mysqli_select_db($db_handle, $database);
			
//script to select per selling price from product table
 
	
if(isset($_POST['A'])){
	

	echo $product_id = $_POST['product_id'];
	 
    echo $amount = $_POST['amount'];
	echo $balance = $_POST['balance'];
	echo $customers = $_POST['customer'];
	
	
	
	
	
	//exit();
	
	
		
	$date = date("Y-m-d");
	
	
	//this script is used to get unit cost of commodity
	if ($amount !="")
	{
			

	//$db_fod = new mysqli(DB_SERVER, DB_USER, DB_PASS, $database );
	$db_found = new mysqli(DB_SERVER, DB_USER, DB_PASS, $database );
		
	$SQl_update = "UPDATE txn_table SET amount = ' $amount', balance ='$balance' WHERE product_id = '$product_id' ";
	
	mysqli_query($db_found,$SQl_update);

	
	$notification = "Debt Settlement by $customers";
	
header ("Location: debtors.php?txnfailed=$notification");
	

		
	}
	

	
	else{
		
		$notification = "OPERATION FAILED||Payment Fields cant be empty";
		
		
		header ("Location: debtors.php?txnfailed=$notification");
		
	}
	
		
	
	
	
	
	

}


else
	{
		
		//echo "Operation failed";
		$notification = "OPERATION FAILED||  $customers, Payment Fields cant be Null";
		
		
		header ("Location: debtors.php?txnfailed=$notification");
		
	}
		

?>






	<html>
		
			<title>Delete_script</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->	
		 <link href="css/bootstrap-4.4.1.css" rel="stylesheet">
		
		
		
	<head>



	</head>
		
		
		
		
		<style>
		
		
				.loader {
  border: 16px solid #f3f3f3;
  border-radius: 50%;
  border-top: 16px solid blue;
  border-right: 16px solid green;
  border-bottom: 16px solid red;
  border-left: 16px solid pink;
  width: 120px;
  height: 120px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 1s linear infinite;
}

@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
		
		</style>
		
		
		
		
		
	<body >

			
	<div class="jumbotron" style="text-align: center">
		
		
		<h3><b><span style="color: #EC0408">Are you sure you want to DELETE this transaction?</b></h3>
		</span> <br> Transaction ID
		
		
		
			<table style="margin: auto;width: 100%" >
					<form action="record_delete.php" method="post">
		
	<tr>
				<td>
				
		 				<input type="submit" value="NO" class="btn btn-danger" style= "width:100%; height: 70px" name = "NO" >
					
				</td>
					
				<td>
					
		 			<a href="delet.php">	<input type="button"  value="YES" class="btn btn-danger" style= "width:100%; height: 70px"  > </a>
				</td>
	
	</tr>
	</form>
			
			</table>
	
		
			</div>
			
	

	</body>
	</html>

