<?php
session_start();
include 'dbc.php';
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;

$userid=$_SESSION["userid"];
$month=$_POST["month"];
if($_POST['delete']) // from button name="delete"
	{
	$netinc= 0;
	  $netbsal = 0;
		$checkbox = $_POST['checkbox']; //from name="checkbox[]"
		$countCheck = count($_POST['checkbox']);
		
		for($i=0;$i<$countCheck;$i++)
		{
		
			$del_id  = $checkbox[$i];
			$incamount=$_POST["incamount"];
			$userid=$_SESSION["userid"];
			$today=date("Y-m-d");
			
			$sqlp14 = "select * from teacher where id='$del_id'";
 							$result4=$conn->query($sqlp14);
$test = $result4->fetch_assoc();
   							$tech_name=$test['tech_name'] ;
								
				$father_name=$test['father_name'] ;
				$class_name=$test['class_name'] ;
				$monthly_salary=$test['monthly_salary'] ;
			$netinc= $monthly_salary * $incamount / 100;
	  $netbsal = $monthly_salary + $netinc;
			
	$sql1 = "update teacher set 
monthly_salary='$netbsal' where id='$del_id'";
$conn->query($sql1);
$sql = "Insert into inc_sal (id,date,month_name,sess1,teacher_id,tech_name,father_name,class_name,monthly_salary,idate,iamount,netamount,user_id,remarks) values (null,'$today','$month','$year','$del_id','$tech_name','$father_name','$class_name','$monthly_salary','$today','$netinc','$netbsal','$userid','Yearly Increament Staff')";
$conn->query($sql);

			
			
		}
			if($result)
		{	
				header('Location: Open_Active_Students.php');
			}
			else
			{
				header('Location: Edit_Del_Teacher.php');
			}
	}
  
	
	

// do the update and print out some info just to provide some visual feedback





?>
