<?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 colspan="9" align="left" bgcolor="#999999"><strong>All Cost  of the day
                <?php 
			  echo dtformat($_GET[d]);
			  
			  //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="8%" align="left" >Cost Type </td>
            <td width="11%" align="left" >Paid To </td>
            <td width="11%" align="left" >Total Cost</td>
            <td >Date</td>
            <td >Comments</td>
            <td >Pay Method </td>
            <td >Pay From Account </td>
            <td align="center" >View   </td>
            <td align="center" >Print</td>
        </tr>
		  <?php 
		   $m=date("m");
			$y=date("Y");
			  
		  $dt=$y.$m;
		  $date=date("Y-m-d");
		  $dresult=mysql_query("select * from cost WHERE cdate='$_GET[d]'  order by id asc");
		  $drow=mysql_fetch_array($dresult);
		  $total=0;
		  do{
		  ?>
          <tr>
          <td width="8%" 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="11%" align="left" bgcolor="#FFFFFF" class="link"><?php echo $drow[pt]; ?></td>
            <td width="11%" 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 $drow[amount];
			 $total=$total+$drow[amount];
			?>			</td>
            <td width="11%" bgcolor="#FFFFFF" class="link"><?php 
			 echo dtformat($drow[cdate]);
			?></td>
            <td width="19%" bgcolor="#FFFFFF" class="link"><?php 
			 echo $drow[comments];
			?></td>
            <td width="13%" bgcolor="#FFFFFF" class="link"><?php  echo $drow[pay_methode];?></td>
            <td width="16%" bgcolor="#FFFFFF" class="link"><?php  
			$wresult=mysql_query("select * from bank_widrow WHERE id='$drow[chid]'");
		    $wrow=mysql_fetch_array($wresult);
			
			$gresult=mysql_query("select * from bank_acc WHERE id='$wrow[acc_no]'");
		    $grow=mysql_fetch_array($gresult);
		    echo $grow[accname]." ($grow[accno])";?></td>
            <td width="5%" align="center" bgcolor="#FFFFFF" class="link">
			<a href="javascript:popUp('pop_view_cost.php?id=<?php echo $drow[id];?>')">
			<img src="images/mag.jpg" width="20" height="20" border="0" /></a>			</td>
            <td width="6%" align="center" bgcolor="#FFFFFF" class="link"><a href="javascript:popUp('pop_print_cost.php?id=<?php echo $drow[id];?>')"> <img src="images/print.gif" width="20" height="20" border="0" /></a></td>
        </tr>
         
          <?php 
		  }while($drow=mysql_fetch_array($dresult));
		  ?> <tr>
            <td colspan="2" align="right"  class="link"><strong>Total : </strong></td>
            <td align="left"  class="link"><strong><?php echo $total; ?></strong></td>
            <td  class="link">&nbsp;</td>
            <td  class="link">&nbsp;</td>
            <td  class="link">&nbsp;</td>
            <td  class="link">&nbsp;</td>
            <td colspan="2"  class="link">&nbsp;</td>
          </tr>
    </table></td>
  </tr>
  <tr>
    <td><?php include("bot.php")?></td>
  </tr>
</table>
</body>
</html>
<?php }?>