<?php 
session_start();
include 'dbc.php';

date_default_timezone_set("Asia/Karachi");

$userid=$_SESSION["userid"];

$ven_name=$_POST["ven_name"];
$date=$_POST["date"];
$acc_name_dr=$_POST["acc_name_dr"];
$month_name=$_POST["month_name"];
$username=$_POST["username"];
$amount=$_POST["amount"];
$wh_tax=$_POST["wh_tax"];
$chequeno=$_POST["chequeno"];
$bankname=$_POST["bankname"];
$remarks=$_POST["remarks"];
 $whamount=$amount * $wh_tax / 100;
	 $netrecamount=$amount - $whamount;


$sql = "Insert into cashpaid (id,date,month_name,ven_name,username,user_id,netamount,venid,wh_tax,whamount,chequeno,bankname,remarks) values (null,'$date','$month_name','$ven_name','$username','$userid','$netrecamount','$acc_name_dr','$wh_tax','$whamount','$chequeno','$bankname','$remarks')";
$conn->query($sql);

/*$sqlc = "SELECT * FROM chartofaccounts where acc_name = '$acc_name_dr' and  user_id='$userid'";
$resultc=$conn->query($sqlc);
$rowc = $resultc->fetch_assoc();
$acc_symb=$rowc['acc_symb'] ;
$acc_type=$rowc['acc_type'] ;
$sql101 = "Insert into acc_ledger (id,date,month_name,tr_no,acc_name,discription,acc_type,dr_amount,cr_amount,balance,user_id,acc_symb) values (null,'$date','$month_name','$last_id','$acc_name_dr','Vednor Payment','$acc_type','0','$amount','0','$userid','$acc_symb')";
$conn->query($sql101);*/
header("location:Payment_Dashboard.php");

?>
