<?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">
  <tr>
    <td><?php include("top.php")?></td>
  </tr>
  <tr>
    <td valign="top" class="center_page_white"><table width="100%" border="0" cellspacing="1" cellpadding="0">

      <tr>
        <td><table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#999999">
            <tr>
              <td colspan="5" align="left" bgcolor="#999999"><strong>All Cost  of This Month
                <?php 
			 $y=substr("$_GET[d]",0,4);
			$m=substr("$_GET[d]",4,2);
			  
			  //echo $row[month];
			
			  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>
            </tr>
            <tr>
              <td width="16%" align="left" >Cost Type </td>
              <td width="17%" align="left" >Paid To </td>
              <td width="33%" align="left" >Total Cost</td>
              <td width="33%" >View Details </td>
              <td width="33%" >&nbsp;</td>
            </tr>
            <?php 
		   $a=substr("$_GET[d]",0,4);
			$b=substr("$_GET[d]",4,2);
			  
		 $dt=$a.$b;
		  $dresult=mysql_query("select * from cost WHERE dt='$dt' group by cost_type  order by id asc");
		  $drow=mysql_fetch_array($dresult);
		  do{
		  ?>
            <tr>
              <td width="16%" align="left" bgcolor="#FFFFFF" class="link"><?php 
		  $aresult=mysql_query("select * from cost_type WHERE id='$drow[cost_type]' limit 1");
		  $arow=mysql_fetch_array($aresult);
			
			echo $arow[cost]; ?></td>
              <td width="17%" align="left" bgcolor="#FFFFFF" class="link"><?php echo $drow[pt]; ?></td>
              <td width="33%" align="left" bgcolor="#FFFFFF" class="link"><?php 
			 $bresult=mysql_query("select SUM(amount) as amount from cost WHERE cost_type='$drow[cost_type]' and dt='$dt'");
		 	 $brow=mysql_fetch_array($bresult);
			 echo $brow[amount];
			?>
              </td>
              <td width="33%" bgcolor="#FFFFFF" class="link">&nbsp;</td>
              <td width="33%" bgcolor="#FFFFFF" class="link">&nbsp;</td>
            </tr>
            <?php 
		  }while($drow=mysql_fetch_array($dresult));
		  ?>
          </table></td>
        </tr>
      </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><?php include("bot.php")?></td>
  </tr>
</table>
</body>
</html>
<?php }?>