<?php
if($_REQUEST['Delete'])
{
   //echo count($_REQUEST['leadid']);
   //exit;
  for($i=0;$i<count($_REQUEST['leadid']);$i++)
  {
    $condition="id='".$_REQUEST['leadid'][$i]."'";
    $s->DeleteRecord('awd_question', $condition);
    //$condition="id='".$_REQUEST['leadid'][$i]."'";
    //$s->DeleteRecord('spare_part_kits', $condition);
  }
  //$s->pageLocation("index.php?route=HRModule/holidays");
}
?>

<form method="post" action="" name="myform">

<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; border-collapse:collapse;">
   <tr style="border:none;"><td style="border:none;"></td><td style="border:none;">
<?php if($_SESSION['frmDelete']=='1'){?>&nbsp;<input type="submit" name="Delete" value="Delete" class="search" onClick="return confirm('Are you sure you want to delete this Item record?');" /><?php } ?>
</td></tr>
   <tr>
      <td width="2%"><input type="checkbox" id="selecctall"/></td>
     	<td width="4%">S. No.</td>
      <!--<th>Category</th>-->
      <td width="10%">Area</td>
      <td>Topic</td>
      <td width="10%">Company Type</td>
  	  <td width="10%">Created By</td>
      <td width="7%">Created Date</td>
  	  <td width="5%" style="text-align:center;">Edit</td>
      <!--<td width="5%" style="text-align:center;">Delete</td>-->
   </tr>
   <?php 
   $i=1;
   
   //$GetRecord = "Select * from $table  order by id limit ".$start." ,".$page."  ";
   //$GetRecord = "Select * from $table where fin_year_id=".$_SESSION['financialYrId']." and assmnt_ctgries_id in (".$_SESSION['AssmntCategoryIds'].") order by id";

   $GetRecord = "Select * from $table  order by id";
   $ResultData = DB_query($GetRecord,$db);
   if(DB_num_rows($ResultData)==0)
   echo "<td colspan='8'>--No Record--</td>";
   
   while($RowData = DB_fetch_array($ResultData))
   {?>
 <tr bgcolor="#FFFFFF"> 
 <td><input name="leadid[]" type="checkbox" class="checkbox1" id="leadid_<?php echo $i+1; ?>" value="<?php echo $RowData['id']?>" /></td>
  <td><?php echo $i;?></td>
 <!-- <td ><?php echo $s->GetFieldValue("awd_member_assmnt_ctgries","id='".$RowData['assmnt_ctgries_id']."'","name");?></td>-->
  <td><?php echo $s->GetFieldValue("awd_member_assmnt_area_dtls","id='".$RowData['assmnt_area_dtls_id']."'","area_name");?></td>
  <td><?php echo $s->GetFieldValue("awd_member_assmnt_topic_dtls","id='".$RowData['assmnt_topic_dtls_id']."'","topic_name");?></td>
  <td><?php echo $RowData['emp_typ'];?></td>
  <td><?php echo $s->GetFieldValue("www_users","id='".$RowData['Created_by']."'","realname");?> </td>	 
  <td><?php echo ConvertSQLDate($RowData['Created_date']);?></td>	   
  <td style="text-align:center;"><?php //if($_SESSION['frmEdit']=='1'){?><a href="index.php?route=HRModule/Master/question&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid']?>&action=Edit&id=<?php echo $RowData['id']; ?>"><img src="images/icon-edit.png" height="15" width="15" title="Edit Document" /></a><?php //}else{echo "No Permission";}?></td>
<!--	<td style="text-align:center;"><?php //if($_SESSION['frmDelete']=='1'){?><a href="index.php?route=HRModule/Master/question&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid']?>&action=del&id=<?php echo $RowData['id']; ?>" onclick="return confirm('Do You Want To Delete This Record')"><img src='images/Icon_Delete.png' width="15" height="15" title="Delete Document" /></a><?php //}else{echo "No Permission";}?></td>	
  --></tr>
	<?php $i++;}?>  
  
   </table>
 </form>

 <script type="text/javascript">
  function LeadData()
{ 
  myCheckboxArray = document.myform.elements["leadid[]"];
  var t=myCheckboxArray.length;
  //alert(myCheckboxArray);
  if(document.getElementById('leadid').checked==true)
  { 
  if(t==undefined)
  document.getElementById('leadid_'+1).checked=true;    
  for (var i = 1; i <= t; i++)
  {
  document.getElementById('leadid_'+i).checked=true;  
  } 
  }
  else
  {
  if(t==undefined)    
  document.getElementById('leadid_'+1).checked=false;   
  for (var i = 1; i <= t; i++)
  {
  document.getElementById('leadid_'+i).checked=false; 
  }
  }
}
$(document).ready(function() {
    $('#selecctall').click(function(event) {  //on click
        if(this.checked) { // check select status
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = true;  //select all checkboxes with class "checkbox1"              
            });
        }else{
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = false; //deselect all checkboxes with class "checkbox1"                      
            });        
        }
    });
   
});
</script>