<?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 -->
</script>
</head>

<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1">
  <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> <a href="all_cost.php"> Cost View </a></strong></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><?php include("cost_top.php");?></td>
  </tr>
  <tr>
    <td valign="top" class="center_page_white"><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#999999">
      <tr>
        <td width="33%" align="left" bgcolor="#999999"><strong>All Cost        </strong></td>
        <td width="33%" align="left" bgcolor="#999999">&nbsp;</td>
        <td width="33%" align="left" bgcolor="#999999">&nbsp;</td>
      </tr>
	   <tr>
        <td align="left" valign="top"  class="link">Month</td>
        <td align="left"  class="link">Total Cost </td>
        <td  class="link">View Details </td>
      </tr>
      <?php 
		  $m=date("m");
			$y=date("Y");
			  
		  $dt=$y.$m;
		  $dresult=mysql_query("select * from cost where dt>'0' group by dt");
		  $drow=mysql_fetch_array($dresult);
		  do{
			?>
     

       <tr>
        <td width="33%" align="left" valign="top" bgcolor="#FFFFFF" class="link"><strong>
          <?php
		
		 
			  $mon=substr("$drow[dt]",4,2);
			  $year=substr("$drow[dt]",0,4);
			  
			  if($mon == '01'){echo "January (".$year.")";}
			  if($mon == '02'){echo "February (".$year.")";}
			  if($mon == '03'){echo "March (".$year.")";}
			  if($mon == '04'){echo "April (".$year.")";}
			  if($mon == '05'){echo "May (".$year.")";}
			  if($mon == '06'){echo "Jun (".$year.")";}
			  if($mon == '07'){echo "July (".$year.")";}
			  if($mon == '08'){echo "August (".$year.")";}
			  if($mon == '09'){echo "September (".$year.")";}
			  if($mon == '10'){echo "October (".$year.")";}
			  if($mon == '11'){echo "November (".$year.")";}
			  if($mon == '12'){echo "December (".$year.")";}
			  
			   ?>
        </strong></td>
        <td width="33%" align="left" bgcolor="#FFFFFF" class="link">
		<?php 
			$dt=$drow[dt];
			 $bresult=mysql_query("select SUM(amount) as amount from cost WHERE  dt='$dt'");
		 	 $brow=mysql_fetch_array($bresult);
			 echo $brow[amount];
			?>		</td>
        <td width="33%" bgcolor="#FFFFFF" class="link"><a href="cost_month_view.php?dt=<?php echo $dt; ?>"><img src="images/mag.jpg" width="20" height="20" border="0" /></a></td>
      </tr>
      <?php 
		
		  }while($drow=mysql_fetch_array($dresult));
		  ?>
    </table></td>
  </tr>
  <tr>
    <td><?php include("bot.php")?></td>
  </tr>
</table>
</body>
</html>
<?php }?>