<?php 
$pgMod = "account_details";

	 if(isset($_POST['save_details'])){

 	     $allstaff = $_POST[idno];
 	     $i = 0;
	     foreach($allstaff as $idno){

	         $saveAry=array(
	                        "email"     =>  $_POST['email'][$i],
	                        "salery"    =>  $_POST['basic_salary'][$i],
                            "accountno" =>  $_POST['accountno'][$i],
                            "ifsc"      =>  $_POST['ifsc'][$i],
                            "pancard"   =>  $_POST['pancard'][$i],
                            "aadhar"    =>  $_POST['aadhar'][$i],
                            "uan"       =>  $_POST['uan'][$i],
                            "cl_count"  =>  $_POST['cl'][$i]
        					);

                $flg  = $db->updateAry("staff",   $saveAry,   "where school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$idno."'");
            $i++;
	     }
	     
	      if(!is_null($flg))
 		{
 			$_SESSION['msg']='update Successfully';
 			redirect(URL_ADMIN_HOME.getQueryString(array("src"=>"Payroll", "page_id"=>$pgMod)));
 		}
	     
	 }
?>
  
	<form method="post" action="">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Staff List</h3>
                    <div>
						<button type="submit" name="save_details" class="btn btn-primary"> Save Details</button>
					</div>
				</div>
		<div class="well no-padding">
        	<div class="controls controls-row">
		<!--<center><input class="form-control" id="myInput" type="text" placeholder="Search.."></center>-->
		<?php
		$whereC=array();
// 		if(isset($_GET["class"]) && $_GET["class"]!="")
// 			$whereC[]=" class='".$_GET["class"]."' ";

// 		if(isset($_GET["section"]) && $_GET["section"]!="")
// 			$whereC[]=" section='".$_GET["section"]."' ";
// 		$whereM="";
// 		if(is_array($whereC) && count($whereC)>0)
// 			$whereM=" where ".implode(" and ",$whereC);
		
		$allstaff = $db->getRows("select * from staff where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 order by name ");

		if(is_array($allstaff) && count($allstaff)>0){
			?><table class="table">
		    <thead>
    			<tr>
                    <th>S. No.</th>
                    <th>Name</th>
                    <th>Father Name</th>
                    <th>Email</th>
                    <th>CL</th>
                    <th>Basic Salary</th>
                    <th>Account No.</th>
                    <th>IFSC Code</th>
                    <th>Pan No.</th>
                    <th>Aadhar No.</th>
                    <th>UAN No.</th>
                </tr>
            </thead>
            <tbody id="myTable">
			<?php $i=0;
			foreach($allstaff as $staff){ $i++;
				?>
				<tr>
                	<td><?php echo $i; ?></td>
                	<td><?php echo $staff["name"]; ?></td>
					<td><?php echo $staff["fname"]; ?></td>
					<td><input type="text" name="email[]" class="input-block-level" value="<?php echo $staff["email"]; ?>" ></td>
					<td><input type="text" name="cl[]" class="input-block-level" value="<?php echo $staff["cl_count"]; ?>" ></td>
					<td><input type="text" name="basic_salary[]" class="input-block-level" value="<?php echo $staff["salery"]; ?>" ></td>
					<td><input type="text" name="accountno[]" class="input-block-level" value="<?php echo $staff["accountno"]; ?>" ></td>
					<td><input type="text" name="ifsc[]" class="input-block-level" value="<?php echo $staff["ifsc"]; ?>" ></td>
					<td><input type="text" name="pancard[]" class="input-block-level" value="<?php echo $staff["pancard"]; ?>" ></td>
					<td><input type="text" name="aadhar[]" class="input-block-level" value="<?php echo $staff["aadhar"]; ?>" ></td>
					<td><input type="text" name="uan[]" class="input-block-level" value="<?php echo $staff["uan"]; ?>" ></td>
					<input type="hidden" name="idno[]" required  value="<?php echo $staff["idno"] ?>" readonly="readonly" />

                </tr>
				<?php
			}
			?></tbody></table><?php
		}
		?></div></div></div></div></form>