<?php 	

require_once '../../Server/connection.php';


$valid['success'] = array('success' => false, 'messages' => array());

$invId = $_POST['categoriesId'];

if($invId){ 


 $sql = "DELETE FROM invoices WHERE inv_id = {$invId}";
 
 $sql2 = "DELETE FROM invoices_items WHERE inv_id = {$invId}";
 
 //$sql3 = "DELETE FROM client_docs WHERE file_id = {$file_id}";

 if($conn->query($sql) === TRUE && $conn->query($sql2) === TRUE) {
 	$valid['success'] = true;
	$valid['messages'] = "Invoice is Successfully Deleted";		
 } else {
 	$valid['success'] = false;
 	$valid['messages'] = "Error while Deleting Invoice";
 }
 
 $conn->close();

 echo json_encode($valid);
 
} // /if $_POST