<?php

session_start();
if($_SESSION['dbName']==""){
header("location:../index.php");
}


include("config.inc.php");
include("Functions_Purchase.php");
include("Forms_DataGrid_Items.php");

$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");


$querylog="SELECT ifnull(FI_ItemAuction,0) as loginaccess, ifNull(Login_FastPrint,0) As Login_FastPrint from ".$_SESSION['dbLabel'].".login where user_account='".$_SESSION['useraccount']."' 	and Upper(Login_Schema) = Upper('".$_SESSION['dbName']."')	";
$resultlog=mysql_query($querylog,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultlog)){
	extract($rows);
}

if ($loginaccess=='' or $loginaccess==0)
	header("location:menu.php");

	
	
//Read From Setup Table							
$querysetup= " select DecimalBase, DecimalBase1, DecimalBase2, base1, base2, grid_color1, grid_color2 from setup ";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
while($rowsetup=mysql_fetch_array($resultsetup)){
	extract($rowsetup);
}


$actionmode = $_POST["actionmode"]; if ($actionmode == ""){$actionmode = $_GET["actionmode"];}   
$mainaction = $_POST["mainaction"]; if ($mainaction == ""){$mainaction = $_GET["mainaction"];}   


if (empty($mainaction))	$mainaction = 'insert';

$message = ereg_replace("'"," ",$message);

print <<<HERE
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 

<link rel="stylesheet" type="text/css" media="all" href="css-v2/style.css">
<link rel="stylesheet" type="text/css" media="all" href="js/grid/UI_DataGrid_V1.css">
<script type="text/javascript" src="js/grid/UI_DataGrid.js"></script>
<script type="text/javascript" src="js/grid/jquery-1.9.1.js"></script>

<script type="text/javascript" src="js/grid/jquery-1.9.1.js"></script>
<link type="text/css" href="js/calendar/jquery.datepick.css" rel="stylesheet">



<link type="text/css" href="js/grid/scripts/jquery-ui.css" rel="stylesheet">
<script type="text/javascript" src="js/grid/scripts/jquery-ui.min.js"></script>

<script type="text/javascript" language="javascript">
function printPrev(){
	var x = document.rep;
	var fromdate = x.fromdate.value;
	var todate = x.todate.value;
	
	var showmin = 0;
	if(document.getElementById('showmin').checked)
		showmin = 1;
	
	var str = 'Rep_itemAuction.php?fromdate='+fromdate+'&todate='+todate+'&showmin='+showmin; 
	window.open(str);
}
function printExcel(){
	var x = document.rep;
	var fromdate = x.fromdate.value;
	var todate = x.todate.value;
	
	var showmin = 0;
	if(document.getElementById('showmin').checked)
		showmin = 1;
	
	var str = 'Exp_itemAuction.php?fromdate='+fromdate+'&todate='+todate+'&showmin='+showmin; 
	window.open(str);
}
</script>
<title>Item Auction Reports</title>


<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
<SCRIPT type="text/javascript" src="dhtmlgoodies_calendar.js?random=20060118"></script>
<style>
.styled {
	font-size: 11px;
    color: #999999;
    font-weight: bold;
}
</style>
</head>
<body>
<form name='rep' method='post'>
<input type='hidden' name='message' value='$message' size='200'>

HERE;


if (empty($fromdate))	$fromdate 	= displayToday();
if (empty($todate))		$todate 	= displayToday();

	

echo"<table cellpadding='0' cellspacing='0' border='0'  align='center' class='layout-width'>";
include_once("header.php");
echo" <tr><td  valign='top'>";

include_once("sidemenu.php");
echo"  </td></tr>";


echo" <tr style='height:26px;'>
		<td  valign='top' id='content-top'>
			<table border='0' cellpadding='0' cellspacing='0' style='table-layout:fixed; height:26px;' class='layout-width'>
			<tr style='height:26px;'>
				<td style='width:38px; height:26px;'>&nbsp;</td>
				<td valign='middle' style='width:300px; height:26px;'><span class='title'>ITEM AUCTION REPORTS</span></td>
				<td class='message' valign='middle' style='height:26px;'>".htmlspecialchars($message, ENT_QUOTES)."</td>
			</tr></table>
		</td>
	  </tr>";

echo"<tr>
		<td  height='34'  valign='top' id='content-top2'>
			<table border='0' cellpadding='0' cellspacing='0' class='layout-width'>
			<tr>
				<td width='30'  height='34'>&nbsp;</td>
				<td valign='middle' height='34' width='720px' align='left'>";


echo" <button type='button' id='btnClear' name='btnClear' onclick=\"ClearPage('0');return false;\" title='Clear Page'><span><span>Clear Page</span></span></button>";				
echo" <button type='button' id='btnPrint' name='btnPrint' onclick='printPrev();return false;' title='Cancel Page'><span><span>Print</span></span></button>";				
echo" <button type='button' id='btnPrintEx' name='btnPrintEx' onclick='printExcel();return false;' title='Cancel Page'><span><span>Excel</span></span></button>";				
				
echo"	</td></tr></table>";
echo"</td></tr>";				

		
echo"<tr><td id='content-body'>
<table border='0'  align='center' valign='top' width=100% class='tablecontent'>
   <tr bgcolor='#F7F7F7'><td valign='top' align='left' colspan='10'>";	


print <<<HERE
	
		<table border="0" style='table-layout:fixed'>
		  <col width=90>
		  <col width=300>
		  <col width=40>	
		  <col width=90>
		  <col width=300>
		  <col width=20>		
		
		
HERE;

echo "<tr bgcolor='#F7F7F7' height='30px'>
		  <td align='left'><span class='style1'>From Date<span class='style16'>*</span></span></td>
		  <td><input type='text' name='fromdate' value='$fromdate' maxlength='10'  style='width:80px;' >
		   <A HREF='#' onClick=\"displayCalendar(document.rep.fromdate,'dd/mm/yyyy',this); return false;\" NAME='anchor1' ID='anchor1'>
		   <img src='./img/cal.gif' border=0 align=center></A>
		  </td>";
echo "<td align='left' colspan='3'><span class='style1'><input type='checkbox' name='showmin' id='showmin' value='0'> <span class='styled'>Show Minimum Values Only</span></span></td>";
echo"   </tr>";


echo "<tr bgcolor='#F7F7F7' height='30px'>
		  <td align='left'><span class='style1'>To Date<span class='style16'>*</span></span></td>
		  <td><input type='text' name='todate' value='$todate' maxlength='10'  style='width:80px;' >
		   <A HREF='#' onClick=\"displayCalendar(document.rep.todate,'dd/mm/yyyy',this); return false;\" NAME='anchor1' ID='anchor1'>
		   <img src='./img/cal.gif' border=0 align=center></A>
		  </td>";
echo "<td></td>";  
echo "<td align='left'><span class='style1'></span></td>
		  <td></td>";
echo"   </tr>";




echo"   </table></td></tr>"; 
 echo"   </table></td></tr><tr height='30'><td align='center' id='content-bottom' ></td></tr>";  


echo" </table>  ";//end of last table menu
	
	
print <<<HERE
</form>
</body>

HERE;

?>