<?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=780,height=500,left = 100,top = 100');");
}
// End -->
</script>
</head>

<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
      <tr>
        <td bgcolor="#BBBBBB">All Cost   of Month <strong>
        <?php 
					
			  $mon=$_GET[m];
			  $year=$_GET[y];
			  //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="50%" align="left" valign="top" bgcolor="#F4F4F4"><table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#C0C0C0">
            <tr bgcolor="#CCCCCC">
              <td width="36%" bgcolor="#E4E4E4"><strong>Purpose</strong></td>
              <td width="18%" bgcolor="#E4E4E4">Via</td>
              <td width="23%" align="right" bgcolor="#E4E4E4"><strong>Amount</strong></td>
              <td width="23%" align="right" bgcolor="#E4E4E4"><strong>Date</strong></td>
            </tr>
            <?php 
			
			
			$result=mysql_query("select * from cost WHERE  MONTH(cdate)='$_GET[m]' and YEAR(cdate)='$_GET[y]'");
	        $row=mysql_fetch_array($result);
			$to=0;
			do{
			?>
            <tr bgcolor="#CCCCCC">
              <td valign="top" bgcolor="#FFFFFF" class="link"><?php 
				//$company=mysql_fetch_array(mysql_query("select * from client WHERE id='$row[client]'"));
				echo $row[purpose];
				?></td>
              <td valign="top" bgcolor="#FFFFFF" class="link"><?php echo $row[via];?></td>
              <td align="right" valign="top" bgcolor="#FFFFFF" class="link"><?php 
		
			
			echo $row[camount];
			$to=$to+$row[camount];
			
				?>              </td>
              <td align="right" valign="top" bgcolor="#FFFFFF" class="link"><?php 
		
			echo dtformat($row[cdate]);
				?>              </td>
            </tr>
            <?php }while($row=mysql_fetch_array($result));?>
            <?php 
			$d2=$year."-".$mon."-01";
			$ti2=strtotime($d2);
			$sf=date('Y-m-d', $ti2);
			
			//--next month
			$ses= mktime(0,0,0,$mon+1,01,$year);
			$se=date("Y-m-d", $ses);
					
?>
            <tr bgcolor="#CCCCCC">
              <td colspan="2" align="right" valign="top" bgcolor="#FFFFFF" class="link">Total : </td>
              <td align="right" valign="top" bgcolor="#FFFFFF" class="link"><?php echo round($to,2);?></td>
              <td align="right" valign="top" bgcolor="#FFFFFF" class="link">&nbsp;</td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><?php include("bot.php")?></td>
  </tr>
</table>
</body>
</html>
<?php }?>