<?php
header("Content-type: text/html; charset=windows-1256");

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


include("config.inc.php");
include("Functions_Purchase.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");


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

//Read From Setup Table							
$querysetup= " select DecimalBase, DecimalBase1, DecimalBase2, base1, base2, grid_color1, grid_color2, ".
             " Date_Format(Setup_VatStartDate,'%Y%m%d') As Setup_VatStartDate, ifNull(Setup_VatPercentage,0) As Setup_VatPercentage from setup ";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
while($rowsetup=mysql_fetch_array($resultsetup)){
	extract($rowsetup);
}

$querylog="SELECT print as printaccess, ifNull(FI_Grn,0) As FI_Grn, ifNull(FI_Purchases,0) As FI_Purchases, 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);
}


$querydflwh="select default_warehouse_code as defaultwarehouse from ".$_SESSION['dbLabel'].".loginstk where user_account='".$_SESSION['useraccount']."' and default_warehouse_code != '' ";
$resultdflwh=mysql_query($querydflwh,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultdflwh)){
  extract($rows);
}

//Projects List
$queryproject=" select distinct project.project_code, project_name ".
              " from project left join ".$_SESSION['dbLabel'].".loginstk on project.project_code like concat(ifnull(loginstk.project_code,project.project_code),'%') ".
			  " where user_account='".$_SESSION['useraccount']."' ".
			  " order by project.project_code";
$projectresult = mysql_query($queryproject,$connection) or die(mysql_error());
$projectrows   = mysql_num_rows($projectresult);
if ($projectrows == 0)
    $queryproject=" select distinct project_code, project_name from project order by project_code ";
			  
//$resultfromproject=mysql_query($queryproject,$connection) or die(mysql_error());

//Costcenter List
$querycostcent=" select distinct costcent.costcent_code, costcent_name ".
               " from costcent left join ".$_SESSION['dbLabel'].".loginstk on costcent.costcent_code like concat(loginstk.costcent_code,'%') ".
 			   " where user_account='".$_SESSION['useraccount']."' ".
 			   " order by costcent.costcent_code";
			  
$costcentresult = mysql_query($querycostcent,$connection) or die(mysql_error());
$costcentrows   = mysql_num_rows($costcentresult);
if ($costcentrows == 0)
    $querycostcent=" select distinct costcent_code, costcent_name from costcent order by costcent_code ";			  
//$resultcostcent=mysql_query($querycostcent,$connection) or die(mysql_error());



//Warehouse List
$querywarehouse=" select distinct warehouse.warehouse_code, warehouse_name ".
				" from warehouse where warehouse_code in (select warehouse_code from ".$_SESSION['dbLabel'].".loginstk where user_account='".$_SESSION['useraccount']."') ".
				" order by warehouse.warehouse_code";
$resultwh = mysql_query($querywarehouse,$connection) or die(mysql_error());
$whexist   = mysql_num_rows($resultwh);
if ($whexist == 0)
	$querywarehouse="select warehouse_code,warehouse_name from warehouse order by warehouse_code";
	
$resultwarehouse=mysql_query($querywarehouse,$connection) or die(mysql_error());


$querycurrency="select Currency_code from currency order by currency_code";
$resultcurrency=mysql_query($querycurrency,$connection) or die(mysql_error());


$strt = $_SESSION['StartFinancial_Date'];
$end = $_SESSION['EndFinancial_Date'];

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


$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>


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

<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(module,printaccess){
    var x = document.form1;
	var report = x.report.value;
	var fromdate = x.fromdate.value;
	var todate   = x.todate.value;
	var groupby = x.groupby.value;
	var exportlocal = x.exportlocal.value;
	var vat = x.vat.value;
	var active = x.active.value;
	var salesman_code = x.salesman_code.value;
	var salesman_name = x.salesman_name.value;
	var showBalance   = x.showBalance.value;
	//var group_type    = x.group_type.value;
	var str = '';
	//alert(report);
	if(report == "1")
	{
		str = 'Rep_Archive_Clients.php?fromdate='+fromdate+'&todate='+todate+'&groupby='+groupby+'&exportlocal='+exportlocal+'&vat='+vat+'&active='+active+'&salesman_code='+salesman_code+'&salesman_name='+salesman_name+'&showBalance='+showBalance;
		//alert(str);
	}
	else
			if(report == "2")
			{
				str = "Rep_suppliers.php";
			}
	else
		if(report == "3")
		{
			str = 'Rep_Archeive_Salesmen.php?fromdate='+fromdate+'&todate='+todate+'&groupby='+groupby+'&exportlocal='+exportlocal+'&vat='+vat+'&active='+active+'&salesman_code='+salesman_code+'&salesman_name='+salesman_name+'&showBalance='+showBalance;
		}
		else
			if(report == "4")
			{
				str = "Rep_Grouping.php";
			}
			else
			  if(report == "5")
			  {
				str = "Rep_Currency.php";
			  }
			else
			   if(report == "6")
			   {
				str = "Rep_Project.php";
			   }
			else
			  if(report == "7")
			   {
				str = "Rep_CostCenter.php";
			   }
			else
			   if(report == "8")
			    {
				str = "Rep_Area.php";
			    }
			else
			    if(report == "9")
			    {
				str = "Rep_SubGroup.php";
			    }
			else
			   if(report == "10")
			   {
				str = "Rep_Warehouse.php";
			   }
			else
			   if(report == "11")
			   {
				str = "Rep_Category.php";
			   }
			else
			  if(report == "12")
			   {
				str = "Rep_Items.php";
			   }
			
	window.open(str);
}
function ExportExcel()
{
	var x = document.form1;
	var report = x.report.value;
	var fromdate = x.fromdate.value;
	var todate   = x.todate.value;
	var groupby = x.groupby.value;
	var exportlocal = x.exportlocal.value;
	var vat = x.vat.value;
	var active = x.active.value;
	var salesman_code = x.salesman_code.value;
	var salesman_name = x.salesman_name.value;
	var showBalance   = x.showBalance.value;
	//var group_type    = x.group_type.value;
	var str = '';
	//alert(report);
	if(report == "1")
	{
		str = 'Rep_Archive_Clients.php?fromdate='+fromdate+'&todate='+todate+'&groupby='+groupby+'&exportlocal='+exportlocal+'&vat='+vat+'&active='+active+'&salesman_code='+salesman_code+'&salesman_name='+salesman_name+'&showBalance='+showBalance+'&export=1';
		//alert(str);
	}
	else
			if(report == "2")
			{
				str = 'Rep_suppliers.php?export=1';
			}
			
	else
			if(report == "3")
			{
				str = 'Rep_Archeive_Salesmen.php?fromdate='+fromdate+'&todate='+todate+'&groupby='+groupby+'&exportlocal='+exportlocal+'&vat='+vat+'&active='+active+'&salesman_code='+salesman_code+'&salesman_name='+salesman_name+'&showBalance='+showBalance+'&export=1';
			}		
   			
	else
			if(report == "4")
			{
				//alert("Hello");
				str = 'Rep_Grouping.php?export=1'; 
                //alert(str);				
			}
	else
		
			  if(report == "5")
			  {
				str = 'Rep_Currency.php?export=1';
			  }
	else
		
			   if(report == "6")
			   {
				str = 'Rep_Project.php?export=1';
			   }
	else
		
			  if(report == "7")
			   {
				str = 'Rep_CostCenter.php?export=1';
			   }
	else
		
			   if(report == "8")
			    {
				str = 'Rep_Area.php?export=1';
			    }
	else
			    if(report == "9")
			    {
				str = 'Rep_SubGroup.php?export=1';
			    }
	else
			   if(report == "10")
			   {
				str = 'Rep_Warehouse.php?export=1';
			   }
	else
			   if(report == "11")
			   {
				str = 'Rep_Category.php?export=1';
			   }
	else
			  if(report == "12")
			   {
				str = 'Rep_Items.php?export=1';
			   }
	window.open(str);
}
function funcDisable () {
	var x = document.form1
	if (x.report.value==1){
		document.getElementById('groupby1').disabled = false;
		document.getElementById('groupby2').disabled = false;
		document.getElementById('groupby3').disabled = false;
		document.getElementById('groupby4').disabled = false;
		document.getElementById('groupby5').disabled = false;
		document.getElementById('groupby6').disabled = false;
		document.getElementById('groupby7').disabled = false;
		document.getElementById('groupby8').disabled = false;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;

	}
	
	else if (x.report.value==2){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = false;
		document.getElementById('groupby3').disabled = false;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = false;
		document.getElementById('groupby6').disabled = false;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
	}
	
	else if (x.report.value==3){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
}
/*
	else if (x.report.value==4){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = false;
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;

}
*/
	else if (x.report.value==5){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail2').disabled = false;
		document.getElementById('detail1').disabled = true;
		document.getElementById('detail3').disabled = true;
}

	else if (x.report.value==6){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
}

	else if (x.report.value==7){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
}

	else if (x.report.value==8){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = false;

}

	else if (x.report.value==9){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
}

	else if (x.report.value==10){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
}

	else if (x.report.value==11){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
}

	else if (x.report.value==12){
		document.getElementById('groupby1').disabled = true;
		document.getElementById('groupby2').disabled = true;
		document.getElementById('groupby3').disabled = true;
		document.getElementById('groupby4').disabled = true;
		document.getElementById('groupby5').disabled = true;
		document.getElementById('groupby6').disabled = true;
		document.getElementById('groupby7').disabled = true;
		
		document.getElementById('detail1').disabled = true;	
		document.getElementById('detail2').disabled = true;
		document.getElementById('detail3').disabled = true;
}

}
function changeExportLocal(){
	var x = document.form1;
	
	if(document.getElementById('Chk_exportlocal').checked)
	{
		x.exportlocal.value = 'export';
	}
	else
		if(document.getElementById('Chk_exportlocal2').checked)
		{
			x.exportlocal.value = 'local';
		}
		else
			if(document.getElementById('Chk_exportlocal3').checked)
			{
				x.exportlocal.value = 'all';
			}
}
function changeVat()
{
	var x = document.form1;
	if(document.getElementById('Chk_Vat').checked)
	{
		x.vat.value= 'yes';
	}
	else
		if(document.getElementById('Chk_Vat2').checked)
		{
			x.vat.value= 'no';
		}
		else
		    if(document.getElementById('Chk_Vat3').checked)
		    {
			x.vat.value= 'all';
		    }
}
function changeActive()
{
	var x = document.form1;
	if(document.getElementById('Chk_active').checked)
	{
		x.active.value = "yes";
	}
	else
		if(document.getElementById('Chk_active2').checked)
	    {
		x.active.value = "no";
	    }
		else
			if(document.getElementById('Chk_active3').checked)
			{
				x.active.value = "all";
			}
}
function openSalesmen()
{
	var str = 'select_salesman.php?item=3';
	window.open(str, 'mywindow','width=850,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
	
}
function changeSalesmanName()
{
	var x = event.keyCode;
	//alert(x);
	if(x == 13)
	{
		//alert("hello");
		var salesman_code = document.form1.salesman_code.value;
		var str = "Form_Archive_Actions.php?actionmode=getSalesmanName&salesman_code="+salesman_code;
		var xhttp = new XMLHttpRequest();
		xhttp.onreadystatechange = function() {
           if (xhttp.readyState == 4 && xhttp.status == 200) {
		   var data = xhttp.responseText.split('[BRK]');
		   //alert(data[0]);
		   if(data[0] == "")
		   {
			   openSalesmen();
		   }
		   else
		   {
		    document.form1.salesman_name.value = data[0];
		   }
		   }
		};
		xhttp.open("GET", str, true);
        xhttp.send();
	}
}
function changeShowBalance()
{
	var x = document.form1;
	if(x.Chk_balance.checked)
	{
		x.showBalance.value = 1;
	}
	else
	{
		x.showBalance.value=0;
	}
}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Archive</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 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>
</head>
<body >
<form name='form1' method='post'  enctype='multipart/form-data'>
<input type='hidden' name='actionmode' value='$actionmode'>
<input type='hidden' name='mainaction' value='$mainaction'>
<input type='hidden' name='message' value='$message' size='200'>

HERE;

//$message='';


if($report == '') $report=1;

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'>Archive</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='800px' align='left'>";

echo" <button type='reset' id='btnClear' name='btnClear'  title='Clear Page'><span><span>Clear</span></span></button>";
     

	 echo" <button type='button' id='preview' name='preview' onClick=\"PrintPrev()\"; title='Preview'><span><span>Preview</span></span></button>";
	

if ($ExporttoExcel==1){
	 echo" <button type='button' id='btnExcel' name='btnExcel' onClick=\"ExportExcel(".$HTTP_SESSION_VARS['module'].")\"; title='Export Excel'><span><span>Export Excel</span></span></button>";

}	



echo"</td>";



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><td valign='top' align='left' colspan='10'>";
   
print <<<HERE

		<table border="0" width=100%>
		  <col width=80>
		  <col width=120>
		  <col width=300>
		  <col width=120>
		  <col width=40>
		  <col width=70>
		  <col width=50>
		  <col width=70>
		  <col width=100>
		  <col width=150>
		

HERE;

echo" <tr>";	  
echo"   <td valign='middle' bgcolor='#F5F5F5' ><span class='style8'>From</span></td>";
echo"   <td valign='middle' bgcolor='#F5F5F5' ><span class='style8'>";
echo"      <input type='text' name='fromdate'  id='fromdate' value='$fromdate' maxlength='10' size='8'>";
echo"      <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></span></td>";
echo "</tr>";



echo" <tr>";
echo"   <td valign='top' bgcolor='#F5F5F5'><span class='style8'>To</span></td>";
echo"   <td valign='top' bgcolor='#F5F5F5'><span class='style8'>";
echo"      <input type='text' name='todate'  id='todate' value='$todate'  maxlength='10' size='8'>";
echo"      <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></span></td>";
echo" </tr>";

echo "<tr>
<td valign='middle' bgcolor='#F5F5F5' ><span class='style8'><input type='checkbox' name='Chk_balance' onclick='changeShowBalance()'>Show Balance
<input type='hidden' name='showBalance' value='0'>
</span></td>
</tr>";

echo "<tr height='30px' >
		<td class='style8' style='width:150px'> Master By: </td>
		<td class='style8' style='width:220px'> Group By: </td>
		<td class='style8' style='width:100px'> Show With: </td>
		<td class='style8' style='width:150px'> Show With: </td>
		<td class='style8' style='width:150px'> Show: </td>
		<td class='style8' style='width:400px'> Salesman: </td>				
		</tr>";

echo "<tr>"; 
echo"   <td colspan='1' valign='top' bgcolor='#F5F5F5' style='vertical-align: top'>";
echo"   <span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='13' onClick='funcDisable()' ".($report==1?' checked ':'')." >Items</label></span><br>";
echo"   <br><span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='1' onClick='funcDisable()' checked >Clients</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='3' onClick='funcDisable()' >Salesmen</label></span>";
echo"   <br><span class='style8'><label>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='2' onClick='funcDisable()' >Suppliers</label></span><br>";
echo"      <input name='report' id='reports' type='radio' value='4' onClick='funcDisable()' >Grouping</label></span><br>";
echo"      <input name='report' id='reports' type='radio' value='5' onClick='funcDisable()' >Currency</label></span><br>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='6' onClick='funcDisable()' >Project</label></span><br>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='7' onClick='funcDisable()' >CostCenter</label></span><br>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='8' onClick='funcDisable()' >Area</label></span><br>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='9' onClick='funcDisable()' >SubGroup</label></span><br>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='10' onClick='funcDisable()' >Warehouse</label></span><br>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='11' onClick='funcDisable()' >Category</label></span><br>";
echo"   <span class='style8'><label>";
echo"      <input name='report' id='reports' type='radio' value='12' onClick='funcDisable()' >Items</label></span><br>";
echo"   <span class='style8'><label>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='4' onClick='funcDisable()'>Currency</label></span>";
//echo"   <br><span class='style8' id='reports'><label>";
//echo"      <input name='report' id='reports' type='radio' value='8' onClick='funcDisable()'>Grouping</label></span><br>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='5' onClick='funcDisable()'>Project</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='6' onClick='funcDisable()' >Cost Center</label></span><br>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='7' onClick='funcDisable()' >Area</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='9' onClick='funcDisable()'>Warehouse</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='10' onClick='funcDisable()'>Subgroup</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='11' onClick='funcDisable()'>Selling Price</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='report' id='reports' type='radio' value='12' onClick='funcDisable()'>Category</label></span></td>";



echo "  <td colspan='1' valign='top' bgcolor='#F5F5F5'><span class='style8'><label>";
echo"      <input name='groupby' type='radio' id='groupby1' value='1' >Salesmen</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='groupby' type='radio'  id='groupby2' value='2' >Project</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='groupby' type='radio' id='groupby3' value='3' >Cost Center</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='groupby' type='radio' id='groupby4' value='4' >Selling Price</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='groupby' type='radio' id='groupby5' value='5' >Export</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='groupby' type='radio' id='groupby6' value='6' >Local</label></span>";
//echo"   <br><span class='style8'><label>";
//echo"      <input name='groupby' type='radio' id='groupby7' value='7' >VAT</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='groupby' type='radio' id='groupby8' value='8' checked>None</label></span>";
echo"</td>";

echo "<td style='vertical-align: top'><span class='style8'><input type='radio' name='Chk_exportlocal' id='Chk_exportlocal' value='export' onclick='changeExportLocal()'>Export</span><br>
<span class='style8'><input type='radio' name='Chk_exportlocal' value='local' onclick='changeExportLocal()' id='Chk_exportlocal2'>Local</span><br>
<span class='style8'><input type='radio' name='Chk_exportlocal' value='all' checked onclick='changeExportLocal()' id='Chk_exportlocal3'>All</span>
<input type='hidden' name='exportlocal' value='all'>
</td>";

echo "<td style='vertical-align: top; width: 100px'><span class='style8'><input type='radio' name='Chk_Vat' id='Chk_Vat' value='yes' onclick='changeVat()'>VAT</span><br>
<span class='style8'><input type='radio' name='Chk_Vat' id='Chk_Vat2' value='no' onclick='changeVat()'>Without VAT</span><br>
<span class='style8'><input type='radio' name='Chk_Vat' id='Chk_Vat3' value='all' checked onclick='changeVat()'>All</span>
<input type='hidden' name='vat' value='all'>
</td>";

echo "<td style='vertical-align: top; width: 100px'><span class='style8'><input type='radio' name='Chk_active' id='Chk_active' onclick='changeActive()' value='yes'>Active</span><br>
<span class='style8'><input type='radio' name='Chk_active' id='Chk_active2' onclick='changeActive()' value='no'>None Active</span><br>
<span class='style8'><input type='radio' name='Chk_active' id='Chk_active3' onclick='changeActive()' value='all' checked>All</span>
<input type='hidden' name='active' value='all'>
</td>";

echo "  <td colspan='3' valign='top' bgcolor='#F5F5F5'><span class='style8'>
<input type='text' name='salesman_code' value='' style='width: 50px;' onkeypress='changeSalesmanName()'>&nbsp;&nbsp;<input type='text' name='salesman_name' value='' style='width: 266px;'>&nbsp;<img src='img/btnopen.jpg' height=20 width=15 style='cursor: pointer' onclick='openSalesmen()'>
</span>";
echo "</select>

</div>
</td>";


echo "</tr>";



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

echo" </table>  ";

?>