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


$userid=$_SESSION["userid"];
$today=date("d-m-Y");
$month_name=$_POST["month_name"];
$teacher_id=$_POST["teacher_id"];
$tech_name=$_POST["tech_name"];
$camp=$_POST["camp"];
$accno=$_POST["accno"];
$monthly_salary=$_POST["monthly_salary"];
$total_month_days=$_POST["total_month_days"];
$absent_days=$_POST["absent_days"];
$any_deduction=$_POST["any_deduction"];
$adv_deduction=$_POST["adv_deduction"];
$sec_deduction=$_POST["sec_deduction"];
$dedname1=$_POST["dedname1"];
$dedamount1=$_POST["dedamount1"];
$dedname2=$_POST["dedname2"];
$dedamount2=$_POST["dedamount2"];

$cta=$_POST["cta"];
$pa=$_POST["pa"];
$cood=$_POST["cood"];
$ssta=$_POST["ssta"];
$other=$_POST["other"];
$leave1=$_POST["leave1"];
$allname1=$_POST["allname1"];
$allamount1=$_POST["allamount1"];
$allname2=$_POST["allname2"];
$allamount2=$_POST["allamount2"];

$workingdays=$total_month_days - $absent_days;
$perday=$monthly_salary / $total_month_days;
$gross=$perday * $workingdays;
$allded=$any_deduction + $adv_deduction + $sec_deduction + $dedamount1 + $dedamount2;
$allow=$cta + $pa + $ssta + $other + $leave1 + $allamount1 + $allamount2 + $gross;
$netsalary=$allow - $allded;


	$sql3 = "Insert into paidsalary (id,date,month_name,teacher_id,tech_name,monthly_salary,perday_salary,total_days,absent_days,working_days,gross_salary,any_deduction,net_salary,user_id,camp,adv_deduction,sec_deduction,dedname1,dedamount1,dedname2,dedamount2,cta,pa,cood,ssta,other,leave1,allname1,allamount1,allname2,allamount2) values (null,'$today','$month_name','$teacher_id','$tech_name','$monthly_salary','$perday','$total_month_days','$absent_days','$workingdays','$allow','$any_deduction','$netsalary','$userid','$camp','$adv_deduction','$sec_deduction','$dedname1','$dedamount1','$dedname2','$dedamount2','$cta','$pa','$cood','$ssta','$other','$leave1','$allname1','$allamount1','$allname2','$allamount2')";
mysql_query($sql3) or die("Error : " . mysql_error());
	header("location:make_salary_entry.php");
	
?>