Location: PHPKode > projects > EasyFest > new/associate_viewExpenseItem.php
<?php
include_once("include/db_connection.php");
	header("Expires: Thu, 17 May 2001 10:17:17 GMT");    // Date in the past
	header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
	header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
	header ("Pragma: no-cache");                          // HTTP/1.0              
	session_start();
		if($_SESSION["loggedIn"] == FALSE){
		header("Location:admin_login.php");
		exit;
			
	}include_once("config.php");
	$UserName=$_SESSION['UserName'];

	include('header1.php');
	$query1=mysql_fetch_array(mysql_query("select UserName FROM users WHERE Type='1' AND  UserName='$UserName'" ));
if($UserName==$query1['UserName'] ){
	// echo $UserName;
	 include('left_user.php');}
	 else{
	
	 include('left_coord.php');
	}?>
    
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>view expenses</title>
<meta name="keywords" content="" />
<meta name="Premium Series" content="" />
<link href="default.css" rel="stylesheet" type="text/css" media="screen" />

<script language="JavaScript" src="gen_validatorv31.js" type="text/javascript"></script>

<title>Untitled Document</title>
</head>

<body>
<div id="wrapper">
	<!-- start page -->
	<div id="page">
    	  <!-- start content -->
        <div id="prtCnt" align="center">
		<div id="content" align="center">
		  <div class="post">
	    <h2 class="title">&nbsp;</h2>
	    <div class="entry">
<?php
//$tbl_name2="forum_answer"; // Switch to table "forum_answer"
$UserName1 = $_SESSION['UserName'];

if(isset($_POST['EventName']))
	{
		$EventName = $_POST['EventName'];
		
		
//$result = mysql_query($query) or die("Invalid query: " . mysql_error() . "<br><br>". $query);
		//echo "Event successfully added!!";
	

/*$sql2=mysql_query("SELECT * FROM events WHERE EventHead='$UserName'  ");
$sql3=mysql_query("SELECT * FROM events WHERE  EventAssociate='eve'");
$sql4=mysql_query("SELECT * FROM events WHERE EventCoord1='$UserName'");
//$result2=mysql_query($sql2);
$numberOfRows = MYSQL_NUM_ROWS($sql2);
$numberOfRows += MYSQL_NUM_ROWS($sql3);
$numberOfRows += MYSQL_NUM_ROWS($sql4);
if(MYSQL_NUM_ROWS($sql2)>0 && MYSQL_NUM_ROWS($sql3)<=0 && MYSQL_NUM_ROWS($sql4)<=0){}
else if(MYSQL_NUM_ROWS($sql2)<=0 && MYSQL_NUM_ROWS($sql3)>0 && MYSQL_NUM_ROWS($sql4)<=0) {$sql2=$sql3;}
else if(MYSQL_NUM_ROWS($sql2)<=0 && MYSQL_NUM_ROWS($sql3)<=0 && MYSQL_NUM_ROWS($sql4)>0) {$sql2=$sql4;}
while($numberOfRows>0){
$result3=mysql_fetch_row($sql2);
$EventName=$result3['EventName'];*/?>
<a href="download1.php?EventName=<?php echo $EventName;?>&Table=expenses">save as csv</a>
<?php
$sql1="SELECT * FROM expenses WHERE EventName='$EventName'";
$result1=mysql_query($sql1);
$numberOfRows = MYSQL_NUM_ROWS($result1);
echo $numberOfRows;
if($numberOfRows>0){
?>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="3%" align="center" bgcolor="#E6E6E6"><strong>ID</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Added by</strong></td>

<td width="27%" align="center" bgcolor="#E6E6E6"><strong>Description</strong></td>

<td width="14%" align="center" bgcolor="#E6E6E6"><strong>Item Type</strong></td>
<td width="10%" align="center" bgcolor="#E6E6E6"><strong>Amount Spent per income item </strong></td>


<td width="7%" align="center" bgcolor="#E6E6E6"><strong>Quantity</strong></td>

<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Action</strong></td>
</tr>
<?php
$datetime=date("d/m/y h:i:s");
$j=1;
$numberOfRows = MYSQL_NUM_ROWS($result1);

while($numberOfRows>0){

$row=mysql_fetch_array($result1);
?>

<tr>
<td bgcolor="#FFFFFF"><?php echo $j; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row['UserName']; ?></td>

<td align="center" bgcolor="#FFFFFF"><?php echo $row['Description']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $row['ItemType']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $row['AmountSPI']; ?></td>

<td align="center" bgcolor="#FFFFFF"><?php echo $row['Quantity']; ?></td>

<td align="center" bgcolor="#FFFFFF"><?php echo $row['Date']; ?></td>
<td align="center" bgcolor="#FFFFFF"><a href="associate_deleteExpenseItem.php?ExpenseId=<?php echo $row['ExpenseId'];?>	"> Delete</a></td>
</tr>




<?php 
$j++;
$numberOfRows--;
}
}
else
echo "No items found!!";
?>
</table>
<BR><a href="associate_addExpenseItem.php">Add Expense Item</a>
<?php	}
?>

<form id="form2"   name="AddExpense" method="post" action="<?php print $_SERVER["PHP_SELF"]; ?>">
<select name="EventName">
		  <?php  $sqlQuery = "SELECT * FROM rights WHERE UserName='$UserName1'";
		  $result = MYSQL_QUERY($sqlQuery);
$numberOfRows = MYSQL_NUM_ROWS($result);
	$i = 0;
	while ($i<$numberOfRows)
	{
$EventName = MYSQL_RESULT($result,$i,"EventName");?>
<option value="<?php echo $EventName; ?>"><?php echo $EventName; ?></option>
<?php $i++;}?>
</select>

<INPUT TYPE=SUBMIT VALUE="Go">
</FORM>


                    </p>
				</div>
		  </div>
		</div>
        </div>
        <!-- end content -->
		<!-- start sidebars -->
		<!-- end sidebars -->
	  <div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end page -->
</div>
</html>
<?php
	include('footer.php');
?>
Return current item: EasyFest