<?php 
if($_REQUEST['action']=='Delete')
{
  $condition="arrear_sheet_id='".$_REQUEST['id']."'";
  $s->DeleteRecord('hr_arrear_sheet_details', $condition);
  
  
  $condition1="id='".$_REQUEST['id']."'";
  $s->DeleteRecord('hr_arrear_sheet', $condition1);
  
  
  $_SESSION['success_msg']="Delete Successfully";  
  $s->pageLocation("index.php?route=HRModule/ArrearSheet_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">
<div class="tab_div">
<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/ArrearSheet&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>"><input type="button" name="Add" value="Add New" class="search" /></a></p>
<?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");
?>
  <?php
	$filter="1=1";
	
?>
<table width="100%" border="1" cellspacing="0" cellpadding="3" style="border:#808080 1px solid; border-collapse:collapse;">
  <tr class="row1">
    <td width="5%"><strong>S. No.</strong></td>
    <td><strong>Arrear Sheet No.</strong></td>
    <td width="10%"><strong>Arrear Sheet Date</strong></td>
    <td width="10%"><strong>Total Amt.</strong></td>
    <td width="10%"><strong>Pay Month</strong></td>
	  <td width="10%"><strong>Paid Status</strong></td>
    <td width="5%"><strong>Print</strong></td>
    <td width="5%"><strong>Excel</strong></td>
    <td width="5%"><strong>Delete</strong></td>
  </tr>
  <?php 
  $i=1;
  $sql=DB_query("SELECT * FROM hr_arrear_sheet where $filter ",$db);
  if(DB_num_rows($sql)>0){
  while($row=DB_fetch_array($sql))
  {
  $netsal=DB_fetch_array(DB_query("SELECT sum(arrear_amount) AS arrear_amount FROM hr_arrear_sheet_details WHERE arrear_sheet_id='".$row['id']."'",$db));
  ?>
 <tr bgcolor="#fff">
    <td><?php echo $i; ?></td>
    <td><?php echo $row['arrear_sheet_no']; ?></td>
    <td><?php echo ConvertSQLDate($row['arrear_sheet_date']);?></td>
    <td><?php echo $netsal['arrear_amount']; ?></td>
    <td><?php echo $monthdata[$row['paymonth']]; ?></td>
	  <td><?php echo 'Y'?></td>
    <td style="text-align:center;"><a href="print_arrear_sheet.php?id=<?php echo $row['id']; ?>" target="_blank"><img src="images/print.png"  height="14" width="14" ></a></td>
    <td style="text-align:center;"><a href="export_ArrearSheet.php?id=<?php echo $row['id']; ?>" target="_blank"><img src="images/excel_img.jpg"  height="12" width="12" ></a></td>
    <td style="text-align:center;"><?php if($_SESSION['frmDelete']==1){?>
    <a href="index.php?route=HRModule/ArrearSheet_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="12" width="12" ></a>
    <?php }else { echo "<img src='images/Icon_Delete3.gif' style='opacity: 0.3;' />"; }?>
    </td>
  </tr>
 <?php $i++; }}else{?>
 <tr bgcolor="#fff"><td colspan="8" style="text-align:center;"> Sorry !! No Data Found.</td></tr>
 <?php } ?>
</table>
<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>