<?php 
if($_REQUEST['action']=='Delete')
{
  $condition="hr_monthly_bonus_cal_id='".$_REQUEST['id']."'";
  $s->DeleteRecord('hr_monthly_bonus_cal_details', $condition);
  
  
  $condition1="id='".$_REQUEST['id']."'";
  $s->DeleteRecord('hr_monthly_bonus_cal', $condition1);
  
  
  $_SESSION['success_msg']="Delete Successfully";  
  $s->pageLocation("index.php?route=HRModule/bonus_cal_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']);
}
?>
<link rel="stylesheet" type="text/css" href="css/table_frize_1.css">
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain" style="width:100%;">
<div class="tab_div" style="width:100%;">
<h1><?php echo $s->GetFieldValue("modules_form","id='".$_REQUEST['frmid']."' and moduleid='".$_REQUEST['modid']."'","frm_name");?></h1>
<?php if($_SESSION['frmAdd']=='1'){?>
<p align="left"><a href="index.php?route=HRModule/bonus_calculation&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>"><input type="button" name="Add" value="Add New" class="search" /></a>
<?php } ?>
    <?php 
//unset($_SESSION['employee_code']);
//error_reporting(0);
include('./includes/fun-php.php');
include('./includes/fun-HRClass.php');
$modid=$_REQUEST['modid'];
$frmid=$_REQUEST['frmid'];
$monthdata=array("1"=>"January","2"=>"February","3"=>"March","4"=>"April","5"=>"May"
  ,"6"=>"June","7"=>"July","8"=>"August","9"=>"September","10"=>"October"
  ,"11"=>"November","12"=>"December");
?>


<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain" style="width:100%;">
<div class="tab_div" style="width:100%;">
  <?php
	$filter="1=1";
	
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="row1">
    <td class="tabledata1"><strong>SR No</strong></td>
    <td class="tabledata1"><strong>Bonus Sheet No</strong></td>
    <td class="tabledata1"><strong>Bonus Sheet Date</strong></td>
    <td class="tabledata1"><strong>Total Amt</strong></td>
	  <td class="tabledata1"><strong>Lock Status</strong></td>
    <td class="tabledata1"><strong>Print</strong></td>
    <td class="tabledata1"><strong>Excel</strong></td>
    <td class="tabledata1"><strong>Delete</strong></td>
  </tr>
  <?php 
  $i=1;
  $sql=DB_query("SELECT * FROM hr_monthly_bonus_cal where $filter ",$db);
  if(DB_num_rows($sql)>0){
  while($row=DB_fetch_array($sql))
  {
  $netsal=DB_fetch_array(DB_query("SELECT sum(bonus) AS bonus FROM hr_monthly_bonus_cal_details WHERE hr_monthly_bonus_cal_id='".$row['id']."'",$db));
  ?>
 <tr class="row1">
    <td class="tabledata1"><?php echo $i; ?></td>
    <td class="tabledata1"><?php echo $row['bs_cal_no']; ?></td>
    <td class="tabledata1"><?php echo $row['bs_cal_date'];?></td>
    <td class="tabledata1"><?php echo $netsal['bonus']; ?></td>
	  <td class="tabledata1"><?php echo 'Y'?></td>
     <td class="tabledata1"><a href="print_bonuscal_sheet.php?id=<?php echo $row['id']; ?>" target="_blank"><img src="images/print.png"  height="18" width="18" ></a></td>
    <td class="tabledata1"><a href="export_bonuscal_sheet.php?id=<?php echo $row['id']; ?>" target="_blank"><img src="images/excel.png"  height="18" width="18" ></a></td>
    <td class="tabledata1"><?php if($_SESSION['frmDelete']==1){?>
    <a href="index.php?route=HRModule/bonus_cal_index&modid=<?php echo $_REQUEST['modid']?>&frmid=<?php echo $_REQUEST['frmid']?>&id=<?php echo $row['id']?>&action=Delete" onclick="return confirm('Are You Sure to Delete?')" target="_blank"><img src="images/Icon_Delete3.gif"  height="18" width="18" ></a>
    <?php }else { echo "<img src='images/Icon_Delete3.gif' style='opacity: 0.3;' />"; }?>
    </td>
  </tr>
 <?php $i++; }}else{?>
 <tr><td colspan="8" style="text-align:center; height:40px; "> Sorry !! No Data Found.</td></tr>
 <?php } ?>
</table>
  </div></div>
<script language="javascript">
function FProfileMaster(str)
{

   myCheckboxArray = document.frm.elements["frmnamerole[]"];
	var t=myCheckboxArray.length;

	if(document.getElementById('assigned_site').checked==true)
	{	
	
	if(t==undefined)	
	document.getElementById('frmname_'+1).checked=true;
	for (var i = 1; i <=t; i++)
	{
	document.getElementById('frmname_'+i).checked=true;	
	}	
	}
	else
	{
	if(t==undefined)	
	document.getElementById('frmname_'+1).checked=false;
	for (var i = 1; i <= t; i++)
	{
	document.getElementById('frmname_'+i).checked=false;	
	}
	}
}
</script>
<?php 
 if(isset($_SESSION['success_msg']))
{ ?>
  <script> alert("<?php echo ($_SESSION['success_msg']);?>");</script>
<?php 
} unset($_SESSION['success_msg']);
?>
</div>
</div>