<?php

if(stripos($_SERVER['SCRIPT_NAME'],"/admin/")===false?false:true){
	include_once("../connect.php");
	include_once("../session.php");
}else{
	include_once("connect.php");
	include_once("session.php");
}

$function = $_REQUEST['f'];
if($function == "saveInvoiceAdjust"){
    saveInvoiceAdjust($_POST);
}elseif($function == "flagLoadedReceipt"){
    $paymentID = $_REQUEST['pid'];
    flagLoadedReceipt($paymentID);
}

function saveInvoiceAdjust($data){
    global $con;
	$query = "INSERT INTO INVOICE_ADJUST (InvoiceNumber, `User`, Reason, OverAmount) VALUES ('" . $data['InvoiceNumber'] . "', '" . $_SESSION['Username'] . "', '" . $data['Reason'] . "' , " . $data['Amount'] . ");";
	$result = mysqli_query($con, $query);
	if($result){
		echo "true";
	}else{
		echo "false";
		
	}
    
}
?>