<?php session_start();

if($_SESSION[invcox] == ""){

header("location:login.php?action=need");

}else{



include("config.php");?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Arnim Holidays Accounting Software</title>

<link href="style.css" rel="stylesheet" type="text/css" />

<SCRIPT LANGUAGE="JavaScript">



<!-- Begin

function popUp(URL) {

day = new Date();

id = day.getTime();

eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=yes,width=700,height=500,left = 100,top = 100');");

}

// End -->



function cash(i){

document.getElementById('Paid By').style.display = 'none';

document.getElementById(i).style.display = 'block';

}

</script>

<style type="text/css">
<!--
.style2 {color: #DC147B;
	font-weight: bold;
}
.style3 {color: #000000}
-->
</style>
	<?php include("calendar.php"); ?>
</head>



<body>

<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="box-wrap">

  <tr>

    <td><?php include("top.php")?></td>

  </tr>

  <tr>

    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

      <tr>

        <td height="30" background="images/place_bg.jpg" class="link2"><strong>&nbsp;&nbsp;<a href="index.php">Home</a> &gt; <a href="accounts.php">Accounts &gt; </a>  Hr <a href="all_cost.php">Salary</a></strong></td>

      </tr>

    </table></td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>
  <tr>
    <td align="center" valign="top" class="round_box"><form action="salary_insert.php" method="post" enctype="multipart/form-data" name="form1" id="form3">
      <span class="red"><strong>
        <?php if($_GET[info] == 'y'){echo 'Added Successfully';}?>
        </strong></span>
      <table width="100%" border="0" cellpadding="3" cellspacing="2" bordercolor="#999999">
        <tr>
          <td colspan="4" ><strong> Cost / Cash Out</strong></td>
        </tr>
        <tr>
          <td width="111" >Date</td>
          <td colspan="3" ><table width="180" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="70%"><input name="cdate" type="text" id="cdate" size="15"  value="<?php echo date("d-m-Y");?>" required="required"/></td>
              <td width="30%" align="center"><a title="Calendar" onclick="displayDatePicker('cdate', this);" href="javascript:;"><img src="images/calendar.gif" width="20" height="20" border="0" /></a></td>
            </tr>
          </table></td>
        </tr>   
        <tr>
          <td height="30" >&nbsp;</td>
          <td height="30" colspan="3"  class="input200"><table width="100%" border="0" cellspacing="1" cellpadding="0" class="list_table">
            <tbody>
              <tr bordercolor="#999999">
                <th height="30" >Sr</th>
                <th height="30"  class="input200">Employee</th>
                <th  class="input200">Salary</th>
                <th  class="input200">Comments</th>
              </tr>
              <?php 
$today=date("Y-m-d");
			  
$result=mysql_query("select * from hr_employee where date1<='$today' and date2='0000-00-00' or date1<='$today' and date2>='$today'  order by id asc ");
$row=mysql_fetch_array($result);
do{	
	$sr++;
		  ?>
     
        <tr>
          <td height="30" ><?php echo $sr; ?></td>
          <td height="30"  class="input200"><?php echo $row[customer_name];?></td>
          <td width="270"  class="input200"><input name="salary_<?php echo $row[id];?>" type="number" value="<?php echo $row[contact_person];?>" required="required" id="salary_<?php echo $row[id];?>" size="10" /></td>
          <td  class="input200"><input name="comments_<?php echo $row[id];?>" type="text" id="comments_<?php echo $row[id];?>" /></td>
          </tr>
<?php 
}while($row=mysql_fetch_array($result));
		  ?>
            </tbody>
          </table></td>
          </tr>
       

        <tr>
          <td height="30" >&nbsp;</td>
          <td height="30" colspan="3"  class="input200">&nbsp;</td>
        </tr>
        <tr>
          <td height="30" align="center" >&nbsp;</td>
          <td height="30" colspan="3" align="left" ><input type="submit" name="submit" id="submit" value="Submit"  style=" padding:
          10px"/></td>
        </tr>
      </table>
    </form></td>
  </tr>

  <tr>

    <td align="center" valign="top">&nbsp;</td>

  </tr>

  <tr>

    <td  class="round_box"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="0" class="list_table">
      <tr>
        <th height="30">SL</th>
        <th>&nbsp;</th>
        <th height="30">Date</th>
        <th height="30" align="center">Employee</th>
        <th height="30" align="left">Salary</th>
        <th height="30" align="left">Comments</th>
        <th >User</th>
        <th width="109" height="30" align="center"><span class="style23">Edit</th>
      </tr>
      <?php $page_name="hr_salary.php?id=$_GET[id]";
 	$limit=$_GET['limit'];
	$start=$_GET['start'];
if(!($start > 0)) {	$start = 0;
	}	$eu = ($start - 0);
 	$limit = '50';
   	$this1 = $eu + $limit;
 	$back = $eu - $limit;
 	$next = $eu + $limit;
$ant=mysql_query("select * from hr_salary order by id desc ");
$nume=mysql_num_rows($ant);
$result=mysql_query("select * from hr_salary order by id desc limit $eu, $limit");
$row=mysql_fetch_array($result);
$sr=0;
do{

$aresult=mysql_query("select * from hr_employee  where id='$row[employee]' limit 1");
$arow=mysql_fetch_array($aresult);
	
							
							$sr++;?>
      <tr>
        <td width="21" align="center" valign="top" class="link"><a href="customer_profile.php?refr_id=<?php    echo $row[id];?>">
          <?php    echo $row[id];?>
        </a></td>
        <td width="21" align="center" valign="top" class="link">&nbsp;</td>
        <td width="282" align="center" valign="top" class="link"><?php    echo dtformat($row[cdate]);
            ?></td>
        <td width="219" align="center" valign="top" class="link "><?php echo $arow[customer_name];
   ?></td>
        <td width="184" align="left" valign="top" class="link "><?php echo $row[salary];
?></td>
        <td width="87" align="left" valign="top" class="link "><?php echo $row[commentx];
 ?></td>
        <td width="91" align="center" class="link"><?php  
			  
$eresult=mysql_query("SELECT  userid FROM user WHERE id = '$row[suser]'  limit 1");
$erow=mysql_fetch_array($eresult);
				
			  echo $erow[userid];
				?>
            <span class="info-icon" onclick="openPopup('show_ip_info.php?ip=<?php echo $row[user_ip]; ?>&amp;time=<?php $date = "$row[datetime1]";
echo date("d-m-Y H:i:s", strtotime($date));?>')">i</span></td>
        <td width="109" align="center" class="link"><a href="edit_salary.php?id=<?php echo $row[id]; ?>">Edit</a>          </td>
      </tr>
      <?php }while($row=mysql_fetch_array($result));
?>
    </table></td>

  </tr>

  <tr>
    <td><table border="0" align = "center" cellpadding="0" cellspacing="2">
      <tr>
        <?php if($back >=0) { echo  "<td  align='left' class='paiging' width='60px'><a href='$page_name&start=$back&limit=$limit'><< PREV</a></td>";
 } //// Let us display the page links at  center. We will not display the current page as a link //?>
        <?php $i=0;
$l=1;
for($i=0;
$i < $nume;
$i=$i+$limit){if($i <> $eu){if($srx == "50"){$srx=0;
 echo '</tr><tr>';
}?>
        <td width="25px" align="center" class="paiging"><?php echo " <a href='$page_name&start=$i&limit=$limit'>$l</a>";
?></td>
        <?php }else{echo "<td align='center' width='25px'><span class='paiging_red'>$l</td>";
}/// Current page is not displayed as link and given font color red$l=$l+1;
$srx=$srx+1;
}?>
        <?php 
 ///////////// If we are not in the last page then Next link will be displayed. Here we check that 
																					  
/////if($this1 < $nume) { echo "<td  align='right' class='paiging' width='60px'><a href='$page_name&start=$next&limit=$limit'>NEXT >></a></td>";} 
					  
					  ?>
      </tr>
    </table></td>
  </tr>
  <tr>

    <td><?php include("bot.php")?></td>

  </tr>

</table>

</body>

</html>

<?php }?>