<?php 
include "config.php";
include "financial_year_calculation.php";
session_start();
$user=$_SESSION['log'];
$code = $_POST['code'];
$date = $_POST['date'];
$givento = $_POST['givento'];
$givenby = $_POST['givenby'];
$given_amount=$_POST['given_amount'];

$remark = $_POST['remark'];
$accountyear    = $financialYearStart."-".$financialYearEnd;
$year_code = substr($financialYearEnd,2);
$code_validate = mysqli_query($connect,"select count(code) as code from cash_handling where code='$code' && status!='deleted'");
$code_count=mysqli_fetch_assoc($code_validate);
$code_val = $code_count['code'];
if($code_val==0)
{
$sql = "INSERT INTO cash_handling(date, givento, givenby, given_amount, remark,  code, user, time,financialyear, editdate, edittime, status) VALUES ('$date','$givento','$givenby','$given_amount','$remark','$code','$user',CURRENT_TIME(),'$accountyear','','','')";
echo $sql;
 $go = mysqli_query($connect,$sql);
}
  header('Location:cash_handling.php');

?>