
<?php
// delete invoice , reciepts
include 'includes/database.php';
$db=new MySQLDatabase();
$db->open_connection();
if(isset($_REQUEST['d'])){
 $repono = $_REQUEST['d'];
 $sql = mysqli_query($db->connection, "SELECT * FROM reporders WHERE repono = '$repono';") or die (mysqli_error($db->connection) );
 if ($row = mysqli_fetch_array($sql, MYSQLI_ASSOC)){
	$invno = $row['invno'];
	$dsql = mysqli_query($db->connection, "SELECT * FROM repoinvoices WHERE repono = '$repono';") or die (mysqli_error($db->connection) );
	if ($rowr = mysqli_fetch_array($dsql, MYSQLI_ASSOC)){ $recpno = $rowr['invno'];  }
	$dsql = mysqli_query($db->connection, "DELETE FROM reporders WHERE repono = '$repono';") or die (mysqli_error($db->connection) );
	$dsql = mysqli_query($db->connection, "DELETE FROM repoinvoices WHERE invno = '$invno';") or die (mysqli_error($db->connection) );
	$dsql = mysqli_query($db->connection, "DELETE FROM paytrans WHERE repono = '$repono';") or die (mysqli_error($db->connection) );
    }
 
 $db->close_connection(); 	
 echo "Reposession Order Deleted!";
}
?>
