<?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=0,resizable=yes,width=500,height=350,left = 390,top = 312');");
}
// End -->
</script>
</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>&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" class="center_page_white"><table width="100%" border="0" cellspacing="1" cellpadding="0">
      <tr>
        <td><form action="insert_cost_type.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
            <br />
            <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
              <tr>
                <td colspan="3" bgcolor="#CCCCCC"><strong>Add Cost Type </strong></td>
              </tr>
              <tr>
                <td width="18%" height="30" bgcolor="#FFFFFF">&nbsp;Cost Type : </td>
                <td width="50%" height="30" bgcolor="#FFFFFF"><label>
                  <input name="cost" type="text" id="cost" size="50" />
                </label></td>
                <td width="32%" height="30" bgcolor="#FFFFFF"><label>
                  <input type="submit" name="Submit" value="Submit" />
                </label></td>
              </tr>
            </table>
        </form></td>
      </tr>
      <tr>
        <td><br />
            <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
              <tr>
                <td colspan="2" bgcolor="#CCCCCC"><strong>Cost Type </strong></td>
                <td width="18%" align="center" bgcolor="#CCCCCC"><strong>Edit</strong></td>
                <td width="15%" align="center" bgcolor="#CCCCCC"><strong>Delete</strong></td>
              </tr>
              <?php 
			$result=mysql_query("select * from cost_type order by id ASC");
			$row=mysql_fetch_array($result);
			$sr=0;
			do{
			$sr=$sr+1;
			 if($_GET[id]!=$row[id]){?>
              <tr>
                <td width="4%" bgcolor="#FFFFFF"><?php echo $sr;?></td>
                <td width="46%" valign="top" bgcolor="#FFFFFF"><?php echo $row[cost];?></td>
                <td align="center" bgcolor="#FFFFFF" class="link"><a href="add_cost_type.php?id=<?php echo $row[id];?>&amp;action=edit">Edit</a></td>
                <td align="center" bgcolor="#FFFFFF" class="link"><a href="delete_cost_type.php?id=<?php echo $row[id];?>">Delete</a></td>
              </tr>
              <?php } if(($_GET[action] == 'edit')&&($_GET[id] == $row[id])){?>
              <tr>
                <td colspan="4" bgcolor="#FFFFFF"><form action="update_cost_type.php" method="post" enctype="multipart/form-data" name="form2" id="form2">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="65%"><input name="cost" type="text" id="pname" value="<?php echo $row[cost];?>" size="50" />
                            <input name="id" type="hidden" id="id" value="<?php echo $row[id];?>" />
                        </td>
                        <td><input type="submit" name="Submit2" value="Update" />
                        </td>
                      </tr>
                    </table>
                </form></td>
              </tr>
              <?php }}while($row=mysql_fetch_array($result));?>
            </table>
          <br /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><?php include("bot.php")?></td>
  </tr>
</table>
</body>
</html>
<?php }?>