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

date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");

$userid=$_SESSION["userid"];
$id=$_REQUEST["id"];


  
 $sqlgfine = "SELECT * FROM rec_fee where id='$id' and user_id='$userid'";
$resultgfine=$conn->query($sqlgfine);
while($rowgfine = $resultgfine->fetch_assoc())
 
  {
  $adm_no=$rowgfine['adm_no'];
$std_name=$rowgfine['std_name'];
$portal_id=$rowgfine['portal_id'];
$class_name=$rowgfine['class_name'];
$month_name=$rowgfine['month_period'];
$feerec=$rowgfine['feerec'];
$disfee=$rowgfine['disfee'];
$fee1rec=$rowgfine['fee1rec'];
$fee2rec=$rowgfine['fee2rec'];
$fee3rec=$rowgfine['fee3rec'];
$fee4rec=$rowgfine['fee4rec'];
$fee5rec=$rowgfine['fee5rec'];
$fee6rec=$rowgfine['fee6rec'];
$totalfeerec=$rowgfine['totalfeerec'];
   if($feerec > 0)
{

   $sql1u = "update issueslip set 
 status='unpaid'  where adm_no='$adm_no' and month_name='$month_name' and class_name='$class_name' and user_id='$userid'";
$conn->query($sql1u);
}
if($fee1rec > 0)
{
	$sql11 = "UPDATE issueslip SET status1='unpaid' WHERE adm_no='$adm_no' and month_name='$month_name' and class_name='$class_name' and user_id='$userid'";
$conn->query($sql11);
}
 if($fee2rec > 0)
{
	$sql12 = "UPDATE issueslip SET status2='unpaid' WHERE adm_no='$adm_no' and month_name='$month_name' and class_name='$class_name' and user_id='$userid'";
$conn->query($sql12);
}
 if($fee3rec > 0)
{
	$sql13 = "UPDATE issueslip SET status3='unpaid' WHERE adm_no='$adm_no' and month_name='$month_name' and class_name='$class_name' and user_id='$userid'";
$conn->query($sql13);
}
 if($fee4rec > 0)
{
	$sql14 = "UPDATE issueslip SET status4='unpaid' WHERE adm_no='$adm_no' and month_name='$month_name' and class_name='$class_name' and user_id='$userid'";
$conn->query($sql14);
}
 if($fee5rec > 0)
{
	$sql15 = "UPDATE issueslip SET status5='unpaid' WHERE adm_no='$adm_no' and month_name='$month_name' and class_name='$class_name' and user_id='$userid'";
$conn->query($sql15);
}
 if($fee6rec > 0)
{
	$sql16 = "UPDATE issueslip SET status6='unpaid' WHERE adm_no='$adm_no' and month_name='$month_name' and class_name='$class_name' and user_id='$userid'";
$conn->query($sql16);
}


	$sql = "delete from rec_fee where id='$id' and user_id='$userid'";
$conn->query($sql);
	
	 }
echo "Fee Receipt Del Sucessfully";

?>
<a href="Fee_Receipt_Del.php">Back</a>