<?php 
session_start();
include 'dbc.php';
$userid=$_SESSION["userid"];
date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		 $my=$month_name . " " . $year;
$adm_no=$_POST["adm_no"];
$std_name=$_POST["std_name"];
$fname=$_POST["fname"];
$std_rollno=$_POST["std_rollno"];
$mfee=$_POST["mfee"];
$feedisc1=$_POST["feedisc1"];
$feebal1=$_POST["feebal1"];
$feedisc2=$_POST["feedisc2"];
$feebal2=$_POST["feebal2"];
$feedisc3=$_POST["feedisc3"];
$feebal3=$_POST["feebal3"];
$feedisc4=$_POST["feedisc4"];
$feebal4=$_POST["feebal4"];
$feedisc5=$_POST["feedisc5"];
$feebal5=$_POST["feebal5"];
$feedisc6=$_POST["feedisc6"];
$feebal6=$_POST["feebal6"];
$feestatus=$_POST["feestatus"];
$sql3="Select * from adddept where dname='$feestatus' and user_id='$userid'";
$result1 = $conn->query($sql3);
$rows3=$result1 ->fetch_assoc();
$conc =$rows3['conc'];
$cfee=$mfee * $conc / 100;
$netfee=$mfee - $cfee;

$sql = "update admission set 
mfee='$netfee',feedisc1='$feedisc1', feebal1='$feebal1' ,feedisc2='$feedisc2', feebal2='$feebal2' ,feedisc3='$feedisc3', feebal3='$feebal3' ,feedisc4='$feedisc4', feebal4='$feebal4' ,feedisc5='$feedisc5', feebal5='$feebal5' ,feedisc6='$feedisc6', feebal6='$feebal6', consfee='$cfee', feestatus='$feestatus', vfee='$mfee' where adm_no='$adm_no' and user_id='$userid'";
$conn->query($sql);

$sql1 = "Insert into feecon (id,date,adm_no,sess1,month,std_rollno,class_name,std_name,fname,mfee,bal,confee,remarks,user_id) values (null,'$today','$adm_no','$year','$my','$std_rollno','$class_name','$std_name','$fname','$netfee','$cfee','$feestatus','$userid')";
$conn->query($sql1);


header("location:Edit_Student_Registration.php");

?>
