<?php


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

include("config.inc.php");

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


$querylog="SELECT RI_TopClientsSuppliers as loginaccess, Print, ExporttoExcel from ".$_SESSION['dbLabel'].".login where user_account='".$_SESSION['useraccount']."' 	and Upper(Login_Schema) = Upper('".$HTTP_SESSION_VARS['dbName']."')	";
$resultlog=mysql_query($querylog,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultlog)){
	extract($rows);
}


	
if ($ExporttoExcel==1)
	$ExporttoExcelStatus= 'button';
else
	$ExporttoExcelStatus= 'hidden';	
	

$printaccess=$Print;

// Setting Initial Values For Parameters
/*$querydate=" Select Date_Format(Min(Journal_date),'%d/%m/%Y') As DefaultFromDate, ".
           " Date_Format(Max(Journal_date),'%d/%m/%Y') As DefaultToDate ".
		   " From JournalDt ";
$resultdate=mysql_query($querydate,$connection) or die(mysql_error());
$rowdate=mysql_fetch_row($resultdate);

if (!isset($fromdate))  $fromdate = $rowdate[0];
if (!isset($todate))    $todate = $rowdate[1];*/

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

if(!isset($toplimit)) $toplimit = 10;

print <<< HERE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

HERE;


$querysetup ="select base1, base2, if(DefaultBase=1, base1, base2) as defaultcurr from setup ";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
$rowsetup=mysql_fetch_row($resultsetup);
$defaultcurr = $rowsetup[2];



print <<< HERE

<html xmlns="http://www.w3.org/1999/xhtml">
<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">

<script language="JavaScript" src="CalendarPopup.js" ></script><!-- Date only with year scrolling -->
<script type="text/javascript" language="javascript">
<!--
function ExcelPrev()
{	
	var x = document.form1;
	var from_date = x.fromdate.value;
	var to_date = x.todate.value;
	
	var reportoption = x.reportoption.value;
	
	var rmastatus = x.rmastatus.value;
	var physicaldamage = x.physicaldamage.value;
	var complete = x.complete.value;
	var groupby = x.groupby.value;
	var orderby = x.orderby.value;
	var charge = x.charge.value;
	var warranty = x.warranty.value;
	var statusfilter = document.getElementById('statusfilter').value;
	var combo = x.combo.value;
	var serialnumber = document.getElementById('serialnumber').value;
	var group = document.getElementById('group').value;
	var groupname = document.getElementById('groupname').value;
	var problemcategory = document.getElementById('problemcategory').value;
	var fromclient = document.getElementById('fromclient').value;
	var fromclient1 = document.getElementById('fromclient1').value;
	var toclient = document.getElementById('toclient').value;
	var toclient1 = document.getElementById('toclient1').value;
	var costcenterchoose = document.getElementById('costcenterchoose').value;
	
	 
	
	if(document.getElementById('statuscharge').checked)
		var statuschargechecked = 1;
	else
		var statuschargechecked = 0;
	
	if(statuschargechecked == 1)
	{
	var str = "Rep_RMA_Preview2.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+
	"&statusfilter="+statusfilter+"&combo="+combo+"&statuschargechecked="+statuschargechecked+"&exp=1";
	}
	else
	{
	var str = "Rep_RMA_Preview.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo+"&exp=1";
	}
	
	if(reportoption == "PERCENT")
	{
		
		var str = "Rep_RMA_Preview_ByItem.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo+"&exp=1";
	}
	
	if(serialnumber != '' && reportoption == "List of RMA By Serial No")
	{
		
		var str = "Rep_RMA_Preview_BySerial.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo+"&exp=1";
	}
	
	if(reportoption == "List of RMA By Client" || reportoption == "List of RMA By Group")
	{
		
		var str = "Rep_RMA_Preview_ByClient or Group.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo+
	"&groupname="+groupname+"&fromclient1="+fromclient1+"&toclien1="+toclient1+"&exp=1";
	}
	
	
	window.open(str);
	
	
	
}
function PrintPrev(printaccess)
{	
	var x = document.form1;
	var from_date = x.fromdate.value;
	var to_date = x.todate.value;
	
	var reportoption = x.reportoption.value;
	
	var rmastatus = x.rmastatus.value;
	var physicaldamage = x.physicaldamage.value;
	var complete = x.complete.value;
	var groupby = x.groupby.value;
	var orderby = x.orderby.value;
	var charge = x.charge.value;
	var warranty = x.warranty.value;
	var statusfilter = document.getElementById('statusfilter').value;
	var combo = x.combo.value;
	var serialnumber = document.getElementById('serialnumber').value;
	var group = document.getElementById('group').value;
	var groupname = document.getElementById('groupname').value;
	var problemcategory = document.getElementById('problemcategory').value;
	var fromclient = document.getElementById('fromclient').value;
	var fromclient1 = document.getElementById('fromclient1').value;
	var toclient = document.getElementById('toclient').value;
	var toclient1 = document.getElementById('toclient1').value;
	var costcenterchoose = document.getElementById('costcenterchoose').value;
	
	 
	
	if(document.getElementById('statuscharge').checked)
		var statuschargechecked = 1;
	else
		var statuschargechecked = 0;
	
	if(statuschargechecked == 1)
	{
	var str = "Rep_RMA_Preview2.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+
	"&statusfilter="+statusfilter+"&combo="+combo+"&statuschargechecked="+statuschargechecked;
	}
	else
	{
	var str = "Rep_RMA_Preview.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo;
	}
	
	if(reportoption == "RMA Percent By Item")
	{
		
		var str = "Rep_RMA_Preview_ByItem.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo;
	}
	
if(serialnumber != ''  && reportoption == "List of RMA By Serial No")
	{
		
		var str = "Rep_RMA_Preview_BySerial.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo;
	}
	
	if(serialnumber == ''  && reportoption == "List of RMA By Serial No")
	{
		
		var str = "Rep_RMA_Preview_BySerial.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo;
	}
	
	if(reportoption == "List of RMA By Client" || reportoption == "List of RMA By Group")
	{
		
		var str = "Rep_RMA_Preview_ByClient or Group.php?from_date="+from_date+"&to_date="+to_date+"&reportoption="+reportoption+
    "&rmastatus="+rmastatus+"&physicaldamage="+physicaldamage+"&complete="+complete+"&groupby="+groupby+"&orderby="
	+orderby+"&charge="+charge+"&warranty="+warranty+"&serialnumber="+serialnumber+"&group="+group+"&problemcategory"+problemcategory+"&fromclient="+fromclient+"&toclient="+toclient+"&statuscharge="+statuscharge+"&combo="+combo+
	"&groupname="+groupname+"&fromclient1="+fromclient1+"&toclien1="+toclient1;
	}
	
	
	window.open(str);
	
	
	
}
 	
	
function openListCustomers(){
	var str = "List_SorClient.php?frm=11";
	window.open(str, 'mywindow', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=990,height=600,top=60,left=100');
}
function openListCustomers2(){
	var str = "List_SorClient.php?frm=12";
	window.open(str, 'mywindow', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=990,height=600,top=60,left=100');
}

function choosecostcenter(){
	var str = "List_Costcenter.php?item=7";
	window.open(str, 'mywindow', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=990,height=600,top=60,left=100');
}
function chooseproject(){
	var str = "List_Project.php?item=6";
	window.open(str, 'mywindow', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=990,height=600,top=60,left=100');
}

function OpenListGrouping(){
	var str = "List_Grouping.php?str=13";
	window.open(str, 'mywindow', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=990,height=600,top=60,left=100');
}

function ExportExcel()
{
	width = screen.width - 10;
	height = screen.height - 66;
	var str='';
  	
	for (var i=0; i < document.form1.options.length; i++)
	{
		if (document.form1.options[i].checked)
		{
			var varoption = document.form1.options[i].value;
		}
	}
	 
	for (var i=0; i < document.form1.currency.length; i++)
	{
		if (document.form1.currency[i].checked)
		{
			var varcurrency = document.form1.currency[i].value;
		}
	}
	

  
		
	
	varfromdate   = document.form1.fromdate.value;
	vartodate     = document.form1.todate.value;
	vartoplimit   = document.form1.toplimit.value;
	vardocument  = 0;
	if (document.form1.document.checked==true)
		vardocument  = 1;
	
	var clients_type = document.form1.clients_type.value;
	var vReportName = 'Exp_TopClientsSuppliers.php';
	//str = vReportName+'?fromdate='+varfromdate+'&todate='+vartodate+'&toplimit='+vartoplimit+'&options='+varoption+'&curr='+varcurrency+'&clients_type='+clients_type;
	
	str = vReportName+'?fromdate='+varfromdate+'&todate='+vartodate+'&toplimit='+vartoplimit+'&options='+varoption+'&curr='+varcurrency+'&document='+vardocument+'&clients_type='+clients_type;
			   
  
	window.open(str);
  
}


function ClearPage() {
	x = document.form1;
	
	//x.templateid.value = '';
	//x.action='Form_TopClientsSuppliers.php';
	//x.submit();
	
	window.location ='Form_TopClientsSuppliers.php';
	
}



-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>RMA Report</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.style1 {
	color: #FF0000;
	font-family: "Times New Roman", Times, serif;
	font-size: 20px;
}
.style8 {font-size: 11px; color: #999999; font-weight: bold; }
.style11 {font-size: 11px}
body {
	margin-top: 0px;
}
-->
</style>

<style>

#header
{
  
    position:relative;
	width:800px;
	height:165px;
	//border: 0.5px solid blue;
}

	
#insideheader1
{
	position:absolute;
	width:200px;
	height:300px;
	
}

#insideheader2

{
position:absolute;
width:380px;
height:30px;
border: 0.5px solid black;
margin-left:250px;
margin-top:20px;
}

#fieldset1
{
	height:130px;
	width:800px;
}

#fieldset2
{
	height:100px;
	width:180px;
}

#fieldset3
{
	height:350px;
	width:1030px;
}

#fieldset4
{
	height:60px;
	width:1000px;
}

#fieldset5
{
	height:80px;
	width:130px;
}
#fieldset6
{
	height:80px;
	width:130px;
}
#fieldset7
{
	height:80px;
	width:130px;
}
#fieldset8
{
	height:70px;
	width:130px;
}
#fieldset9
{
	height:80px;
	width:130px;
}
#fieldset10
{
	height:73px;
	width:130px;
	margin-top:8px;
}
#fieldset11
{
	height:100px;
	width:220px;
}

#date
{
	position:absolute;
	width:250px;
	height:300px;
	//border: 0.5px solid red;
	margin-left:850px;
	
}
#secondmainheader
{
    position:relative;
	width:800px;
	height:200px;
	//border: 0.5px solid pink;
	margin-top:0px;
}

#insidesecondheader1
{
    position:absolute;
	width:100px;
	height:100px;
	margin-top:10px;
	//border: 0.5px solid pink;
}
#insidesecondheader2
{
    position:absolute;
	width:150px;
	height:100px;
	margin-top:110px;
	//border: 0.5px solid green;
}
#insidesecondheader3
{
    position:absolute;
	width:150px;
	height:100px;
	margin-top:110px;
	margin-left:380px;
	//border: 0.5px solid yellow;
}
#insidesecondheader4
{
    position:absolute;
	width:150px;
	height:80px;
	margin-top:220px;
	margin-left:200px;
	//border: 0.5px solid pink;
}
#insidesecondheader5
{
    position:absolute;
	width:150px;
	height:80px;
	margin-top:117px;
	margin-left:200px;
	//border: 0.5px solid green;
}
#insidesecondheader6
{
    position:absolute;
	width:150px;
	height:100px;
	margin-top:220px;
	margin-left:0px;
	//border: 0.5px solid yellow;
}
#insidesecondheader7
{
    position:absolute;
	width:150px;
	height:100px;
	margin-top:220px;
	margin-left:380px;
	//border: 0.5px solid pink;
}

#insidesecondheader8
{
    position:absolute;
	width:250px;
	height:100px;
	margin-left:600px;
	margin-top:110px;
	//border: 0.5px solid green;
}

#insidesecondheader9
{
    position:absolute;
	width:310px;
	height:100px;
	margin-top:250px;
	margin-left:600px;
	//border: 0.5px solid pink;
}

</style>

<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>
	
</head>
<body>
HERE;

echo "<form id='form1' name='form1' method='post' action=''>
		<input type='hidden' name='templateid' value='$templateid'>";
		
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;'margin-top=20px><span class='title'>RMA Report</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();return false;' title='Clear'><span><span>Clear</span></span></button>";
	echo" <button type='button' id='btnPreview' name='btnPreview'  onClick=\"PrintPrev('".$printaccess."')\"; title='Preview'><span><span>Preview</span></span></button>";
	echo" <button type='button' id='btnPreview' name='btnPreview'  onClick=\"ExcelPrev()\"; title='Preview'><span><span>Excel</span></span></button>";
	/*
	if ($ExporttoExcel==1){
		echo" <button type='button' id='btnExcel' name='btnExcel' onClick=\"ExportExcel()\"; title='Export Excel'><span><span>Export Excel</span></span></button>";

	}
*/	
	  
  
echo"	</td></tr></table>";
echo"</td></tr>";				

	$date = date("d/m/Y");	
echo"<tr><td id='content-body'>
<table border='0'  align='center' valign='top' width=100% class='tablecontent' height='550px'>
   <tr bgcolor='#F7F7F7'><td valign='top' align='left' colspan='10'>";		
   
 echo"
 <div id='header'>


<!--BESIDE MAIN HEADER-->
 <div id='date'>
 <fieldset id='fieldset2'>
<legend> Date </legend>
<br>
<table>
<tr>
<td>From </td>
<td>
<input type='text' name='fromdate' id='fromdate' value='$fromdate' size='8px' /> <A HREF=\"#\" onClick=\"displayCalendar(document.form1.fromdate,'dd/mm/yyyy',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\"><image src='./img/cal.gif' border=0 align=center></image></A>
</td>
</tr>
<tr>
<td>To</td>
<td> 
<input type='text' name='todate' id='todate' value='$todate' size='8px' /> <A HREF=\"#\" onClick=\"displayCalendar(document.form1.todate,'dd/mm/yyyy',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\"><image src='./img/cal.gif' border=0 align=center></image></A>
</td>
</tr>
</table>
 </fieldset>
  </div>

  
<!--STARTING FIELD SET-->
<fieldset id='fieldset1'>
<legend> Report Option </legend>

<!--FIRST DIV INSIDER HEADER-->
<div id='insideheader1'>
 <input type='radio' name='reportoption' value='RMA TRANSACTION' id='TRANSACTION' checked>RMA Transaction<br>
 <input type='radio' name='reportoption' value='RMA PERCENT By Item' id='PERCENT'>RMA Percent by Item<br>
 <input type='radio' name='reportoption' value='List of RMA By Serial No' id='SERIAL'>List of RMA by Serial no<br>
 <input type='radio' name='reportoption' value='List of RMA By Client' id='CLIENT'>List of RMA by Client<br>
 <input type='radio' name='reportoption' value='List of RMA By Group' id='GROUP'>List of RMA by Group<br>
 </div>
 
 <!--SECOND DIV INSIDER HEADER-->
 <div id='insideheader2'>
 <table>
 <tr>
 <td><input type='radio' name='physicaldamage' value='PHYSICAL DAMAGE'>Physical Damage</td>
 <td><input type='radio' name='physicaldamage' value='DOA'>DOA</td>
 <td><input type='radio' name='physicaldamage' value='WARRANTY'> Warranty</td>
 </td>
 <td><input type='radio' name='physicaldamage' value='ALL' checked>ALL</td>
 </tr>
 </table>
 <table style='margin-top:20px; margin-left:5px; width:465px;'>
 <tr>
 <td>Serial No: <input type='text' size='10px' id='serialnumber' value=''</td>
 <td>Group: <input type='text' size='10px' id='group'</td>
 <td><input type='text' size='10px' id='groupname'</td>
 <img src='img/btnopen.jpg' width=20 style='cursor: pointer; vertical-align: top' onclick=\"OpenListGrouping()\" />
 </tr>
 <tr height=30px;>
 <td><input type='checkbox' id='problemcategory'</td>Problem Category
 </tr>
 
 </table>
 </div>
<!--END OF SECOND DIV-->

  </fieldset>
 </div>
 
 <!-- SECOND MAIN HEADER -->
 
 <div id='secondmainheader'>
 <fieldset id='fieldset3'>
 <legend>RMA Transaction </legend>
 
 <div id='insidesecondheader1'>
 <fieldset id='fieldset4'>
 <legend> Client    Code/Description</legend>
 <table>
 
<tr>
<td>From </td>
<td>
<input type ='text' name='fromclient' id='fromclient'>
</td>
<td>
<input style='width:200px' type='text' name='fromclient1' id='fromclient1'> 
<img src='img/btnopen.jpg' width=20 style='cursor: pointer; vertical-align: top' onclick=\"openListCustomers()\" />
</td>
<td>CostCenterCode</td>
<td><input type='checkbox' name='costcentercheck' id='costcentercheck' value=''/></td>
<td>
<input type='text' name='costcenterchoose' id='costcenterchoose'> 
<img src='img/btnopen.jpg' width=20 style='cursor: pointer; vertical-align: top' onclick=\"choosecostcenter()\" />
</td>
</tr>
<tr>
<td>To</td>
<td>
<input type ='text' name='toclient' id='toclient'>
</td>
<td>
<input style='width:200px' type='text' name='toclient1' id='toclient1'> 
<img src='img/btnopen.jpg' width=20 style='cursor: pointer; vertical-align: top' onclick=\"openListCustomers2()\" />
</td>
<td>Project</td>
<td><input type='checkbox' name='projectcheck' id='projectcheck'/></td>
<td>
<input type='text' name='projectchoose' id='projectchoose'> 
<img src='img/btnopen.jpg' width=20 style='cursor: pointer; vertical-align: top' onclick=\"chooseproject()\" />
</td>
</tr>
</table>
 </fieldset>
 </div>
 <div id='insidesecondheader2'>
 <fieldset id='fieldset5'>
 <legend> RMA(status) </legend>
 <input type='radio' name='rmastatus' value='Pending' checked>Pending<br>
 <input type='radio' name='rmastatus' value='Handover'>HandOver<br>
 <input type='radio' name='rmastatus' value='All'>ALL<br>
 </fieldset>
 </div>
 <div id='insidesecondheader3'>
<fieldset id='fieldset6'>
 <legend> GroupBy </legend>
 <input type='radio' name='groupby' value='NONE' checked>None<br>
 <input type='radio' name='groupby' value='CLIENT'>Client<br>
 </fieldset>
 </div>
 <div id='insidesecondheader4'>
 <fieldset id='fieldset7'>
 <legend> Charge </legend>
 <input type='radio' name='charge' value='LL'>LL<br>
 <input type='radio' name='charge' value='USD' checked>USD<br>
 </fieldset>
 </div>
 <div id='insidesecondheader5'>
<fieldset id='fieldset8'>
<input type='radio' name='complete' value='COMPLETED'>Completed<br>
 <input type='radio' name='complete' value='NOTCOMPLETED'>Not Completed<br>
 <input type='radio' name='complete' value='BOTH' checked>Both<br>
 </fieldset>
 </div>
 <div id='insidesecondheader6'>
<fieldset id='fieldset9'>
 <legend> OrderBy </legend>
 <input type='radio' name='orderby' value='DATE' checked>Date<br>
 <input type='radio' name='orderby' value='PROMISEDDATE'>Promised Date<br>
 </fieldset>
 </div>
 <div id='insidesecondheader7'>
 <fieldset id='fieldset10'>
 <input type='radio' name='warranty' value='Warranty'>Warranty<br>
 <input type='radio' name='warranty' value='No Warranty'>No Warranty<br>
 <input type='radio' name='warranty' value='Both' checked>Both<br>
 </fieldset>
 </div>
 <div id='insidesecondheader8'>
 <fieldset id='fieldset11'>
 <legend> RMA(result) </legend>
 <input type='radio' name='rmaresult' value='Unrepaired'><label for='HTML'> Unrepaired</label><br>
 <input type='radio' name='rmaresult' value='REPAIRED'><label for='CSS'> Repaired</label><br>
 <input type='radio' name='rmaresult' value='RETURNED'><label for='JS'> Returned</label><br>
 <input type='radio' name='rmaresult' value='ALL' checked><label for='JS'> ALL</label><br>
 </fieldset>
 </div>
 <div id='insidesecondheader9'>
 <table>
 <tr>
 <td>
 <input type='checkbox' name='statusfilter' id='statusfilter' value=''> Status Filter By</label><br>
 <input type='checkbox' name='statuscharge' id='statuscharge' value=''> Charge Report<br>

 </td>
 <td>
 <select style='margin-left:10px; width:150px' name='combo'>
  <option value='combostatus' >ComboBoxStatus</option>
  <option value='credit'  value='C'>C:Credit Note</option>
  <option value='replace' value='P'>P:Replacement</option>
  <option value='reject'  value='R'>X:Rejected</option>
</select>
 </div>
 </div>
  </fieldset>
</table>";
echo"</td></tr>"; 
echo"   </table></td></tr><tr height='30'><td align='center' id='content-bottom' ></td></tr>"; 
echo"</table>
 
</form>
</body>
</html>";

//Return Date in DD/MM/YYYY format
function displayFromDate($data){
	return "01/01/".substr($data, 6, 4);		
}
//Return Today's Date in DD/MM/YYYY format
function displayToday(){
	return strftime("%d")."/".strftime("%m")."/".strftime("%Y");
}
	  
?>