<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{


include 'dbc.php';
$id=$_REQUEST["id"];
$userid=$_SESSION["userid"];
$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;
		 
		
?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
</head>

<body>


    <!-- Left Panel -->

    <?php include("includes/menu.php") ?><!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

             <?php include("includes/headermenu.php") ?>

        </header><!-- /header -->
        <!-- Header-->

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="content mt-3">

           


          <div class="col-lg-12">
                        <div class="card">
                            <div class="card-header"><strong>Staff/Teacher Salary</strong><small> Form</small></div>
                            <div class="card-body card-block">
							
							 <?php
include 'dbc.php';

$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];
$mdays=$_POST["mdays"];
$marital=$_POST["marital"];
$userid=$_SESSION["userid"];
$today=date("Y-m-d");


$sqlrec = "SELECT * FROM teacher where  marital='$marital' and user_id='$userid' and status='Active' ORDER BY tech_name";
$resultrec=$conn->query($sqlrec);
  
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
echo "<tr>";
echo "<th colspan=5><center> Genral Information</center> </th>";
echo "<th colspan=2><center> Attendance Info </center></th>";
echo "<th colspan=3><center> Deduction Information</center> </th>";
echo "<th colspan=4><center> Allownces Information </center></th>";
echo "</tr>";
echo "<tr>";
echo "<th > Staff Name </th>";
echo "<th > Father Name </th>";
echo "<th > Id </th>";
echo "<th > Department </th>";
echo "<th > Desg </th>";
echo "<th > J.Date </th>";
echo "<th > I.Date </th>";
echo "<th > Nic # </th>";
echo "<th > B-code # </th>";
echo "<th > Acc # </th>";
echo "<th > Bank </th>";
echo "<th > Basic Salary</th>";
echo "<th > T.Days</th>";
echo "<th > Absent</th>";
echo "<th > Late</th>";
echo "<th > Advance</th>";
echo "<th > Adv Ded</th>";
echo "<th > M.Sec Ded</th>";
echo "<th > Sec Ded</th>";
echo "<th > Other Ded</th>";
echo "<th > Leave Allow</th>";
echo "<th > Increament</th>";
echo "<th > Other Allow</th>";
echo "<th > Fuel Allow</th>";
echo "<th > Cond Allow</th>";
echo "<th > P.Dues</th>";
echo "<th > Sec Ret</th>";
echo "<th > T.Sec Ret</th>";
echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
echo "<form name='form_update' method='post' action='Genrate_Salary_Save.php'>\n";
while($students = $resultrec->fetch_assoc()) {
$p=0;
$a=0;
$rollno=$students["id"];
$sql3p = "select * from attendence_tech where rollno='$rollno'  and month_name = '$month_name' and status = 'A' and user_id='$userid'";
  $result3p=$conn->query($sql3p);

while($row3p = $result3p->fetch_assoc())
  {
 $p=$p +1;
   
  } 
  $sql3a = "select * from attendence_tech where rollno='$rollno'  and month_name = '$month_name' and portal_id = 'Late' and user_id='$userid'";
  $result3a=$conn->query($sql3a);

while($row3a = $result3a->fetch_assoc())
  {
 $a=$a +1;
   
  } 

	echo '<tr>';
	
	
	echo "<td>{$students['tech_name']}<input type='hidden' name='tech_name[$i]' value='{$students['tech_name']}' /></td>";
	echo "<td>{$students['father_name']}<input type='hidden' name='father_name[$i]' value='{$students['father_name']}' /></td>";
	echo "<td>{$students['id']}<input type='hidden' name='id[$i]' value='{$students['id']}' /></td>";
	echo "<td>{$students['marital']}<input type='hidden' name='marital[$i]' value='{$students['marital']}' /></td>";
	echo "<td>{$students['class_name']}<input type='hidden' name='class_name[$i]' value='{$students['class_name']}' /></td>";
	echo "<td>{$students['adm_date']}<input type='hidden' name='adm_date[$i]' value='{$students['adm_date']}' /></td>";
	echo "<td>{$students['idate']}<input type='hidden' name='idate[$i]' value='{$students['idate']}' /></td>";
	echo "<td>{$students['nic_no']}<input type='hidden' name='nic_no[$i]' value='{$students['nic_no']}' /></td>";
	echo "<td>{$students['bcode']}<input type='hidden' name='bcode[$i]' value='{$students['bcode']}' /></td>";
	echo "<td>{$students['ap']}<input type='hidden' name='ap[$i]' value='{$students['ap']}' /></td>";
	echo "<td>{$students['fp']}<input type='hidden' name='fp[$i]' value='{$students['fp']}' /></td>";
	echo "<td>{$students['monthly_salary']}<input type='hidden' name='monthly_salary[$i]' value='{$students['monthly_salary']}' /></td>";
	echo "<td>T.Days<input type='text' size='3' name='tdays[$i]' value='$mdays' /></td>";
	echo "<td>A.Days<input type='text' size='3' name='adays[$i]' value='$p' /></td>";
	echo "<td>Late<input type='text' size='3' name='latedays[$i]' value='$a' /></td>";
	echo "<td>{$students['loan']}<input type='hidden' name='advded1[$i]' value='{$students['loan']}' /></td>";
	
	echo "<td>Adv Ded<input type='text' size='3' name='advded[$i]' /></td>";
	echo "<td>{$students['securityded']}<input type='hidden' name='securityded1[$i]' value='{$students['securityded']}' /></td>";
	echo "<td>Sec Ded<input type='text' size='3' name='secded[$i]' /></td>";
	echo "<td>Other Ded<input type='text' size='3' name='oded[$i]' /></td>";
	echo "<td>Leave Allow<input type='text' size='3' name='leaveallow[$i]' /></td>";
	echo "<td>Increament<input type='text' size='3' name='dailyallow[$i]' /></td>";
	echo "<td>Other Allow<input type='text' size='3' name='oallow[$i]' /></td>";
	echo "<td>Fuel Allow<input type='text' size='3' name='fallow[$i]' /></td>";
	echo "<td>Cond Allow<input type='text' size='3' name='callow[$i]' /></td>";
	echo "<td>P.Dues<input type='text' size='3' name='pallow[$i]' /></td>";
	echo "<td>Sec Ret<input type='text' size='3' name='secret[$i]' /></td>";
	echo "<td>{$students['security']}<input type='hidden' name='secret[$i]' value='{$students['security']}' /></td>";
	
	 
	echo '</tr>';
	++$i;
}
?>
												
																
												<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">Date</label><input type="text" id="saldate" name="saldate" placeholder="Date" class="form-control" value="<? echo $today ?>"></div>
								</div>
												
									
	
								
								<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">Salary Month</label><input type="text" id="month_name" name="month_name" placeholder="Attendance Month" class="form-control" value="<? echo $month_name ?>" ></div>
								</div>
								
								
								
								<div class="col-3">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">Session </label><input type="text" id="sess1" name="sess1" placeholder="Session" class="form-control" value="<? echo $sess1 ?>" ></div>
								</div>
								
		
                                                    </div>
													<div class="card-footer">
                                                       <?php
echo '<tr>';
echo "<td><input type='submit' value='Genrate' /></td>";

echo '</tr>';
echo "</form>";
echo '</table>';
?>
                                                       
                                                    </div>
													
													
                                                </div>
                                            </div>

            


        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}

?>