<?php


session_start();
if($_SESSION['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($_SESSION['dbName'],$connection) or die("Could not find DB");


$querylog="SELECT RI_expirydate as loginaccess ,ExporttoExcel 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");

	
if ($ExporttoExcel==1)
	$ExporttoExcelStatus= 'button';
else
	$ExporttoExcelStatus= 'hidden';	
	
	
	
$querylog="select * from ".$_SESSION['dbLabel'].".login where user_account='".$_SESSION['useraccount']."' and Upper(Login_Schema) = Upper('".$_SESSION['dbName']."')";
$resultlog=mysql_query($querylog) or die(mysql_error());
while($rows=mysql_fetch_array($resultlog)){
extract($rows);

}

$printaccess=$Print;


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

HERE;
//Read From Module Table
$querymodule=" Select ifNull(Module_Project,0) As Module_Project, ifNull(Module_Costcenter,0) As Module_CostCenter, ifNull(Module_Weight,0) as Module_Weight ".
             " From Module";
$resultmodule=mysql_query($querymodule,$connection) or die(mysql_error());
while($rowmodule=mysql_fetch_array($resultmodule)){
	extract($rowmodule);
}


$querysalessetup="select Salesttc from salessetup";
$resultsalessetup=mysql_query($querysalessetup,$connection) or die(mysql_error());
while($rowssalessetup=mysql_fetch_array($resultsalessetup)){
  extract($rowssalessetup);
}

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

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

$fromyear  = strftime("%Y");
$toyear    = strftime("%Y");
$frommonth = strftime("%B");
$tomonth   = strftime("%B");
// Setting Initial Values For Parameters
/* $querydate=" Select Date_Format(Min(SalesJV_Date),'%d/%m/%Y') As DefaultFromDate, ".
           " Date_Format(Max(SalesJV_Date),'%d/%m/%Y') As DefaultToDate ".
		   " From SalesJV ";
$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 (!isset($fromdate))  $fromdate = displayToday();
if (!isset($todate))   $todate   = displayToday();




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 MoveLevel12(option) {
	var ob = document.form1.availgroupby;
	var leng = ob.options.length;
	
	var vSelectedOptionValue='';
	var vSelectedOptionName='';
	var vSelectedCount=0;
	
	if(ob.selectedIndex == -1) {
		alert('No selection is done.');
		return;
	}
	
	while (ob.selectedIndex != -1)
    {
        if (ob.selectedIndex != -1) {
			vSelectedCount = vSelectedCount + 1;
			vSelectedOptionName  = ob.options[ob.selectedIndex].text;
			vSelectedOptionValue = ob.options[ob.selectedIndex].value;
		}	
        ob.options[ob.selectedIndex].selected = false;
    }

	if (vSelectedCount == 1) {
		if (option == 1) {
			document.form1.groupbylevel1name.value  = vSelectedOptionName;
			document.form1.groupbylevel1value.value = vSelectedOptionValue;
		}	
		else {
			document.form1.groupbylevel2name.value  = vSelectedOptionName;
			document.form1.groupbylevel2value.value = vSelectedOptionValue;
		}	
	}	
	else
		alert ('Not allowed multi selection for Level 1 and 2');
		
	
}

function RemoveLevel12(option) {
	var x = document.form1;
	
	if (option == 1) {
		x.groupbylevel1name.value = '';
		x.groupbylevel1value.value = '';
	}	
	else {
		x.groupbylevel2name.value = '';
		x.groupbylevel2value.value = '';
	}	
}

function MoveLevel3() {
	var ob = document.form1.availgroupby;
	var leng = ob.options.length;
	var TargetElement = document.form1.assigngroupby.options;
	
	var vExists = 0;
	
	if(ob.selectedIndex == -1) {
		alert('No selection is done.');
		return;
	}
	
	if(TargetElement[0] != null) {
		if (TargetElement[0].value=='') 
			TargetElement[0] = null;
	}	

		
	while (ob.selectedIndex != -1)
    {  
        if (ob.selectedIndex != -1) {
		
			vExists = 0;
			for(i=0; i < TargetElement.length; i++) {
				if (TargetElement[i].value == ob.options[ob.selectedIndex].value)
					vExists = 1;
			}
			
			if (vExists == 0)
				TargetElement[TargetElement.length] = new Option(ob.options[ob.selectedIndex].text, ob.options[ob.selectedIndex].value);
		}	  

		ob.options[ob.selectedIndex].selected = false;
    }

	
}

function RemoveLevel3() {
	var ob = document.form1.assigngroupby;
	var leng = ob.options.length;
	
	if(ob.selectedIndex == -1) {
		alert('No selection is done.');
		return;
	}
	
	while (ob.selectedIndex != -1)
    {  
        if (ob.selectedIndex != -1) 
			  ob.options[ob.selectedIndex] = null;
    }
	
}



function printPrev(printaccess)
{
	width = screen.width - 10;
	height = screen.height - 66;
	var str='';
	var x = document.form1;
	

	//fromdate = x.fromdate.value;
	//todate = x.todate.value;
		
	var fromdate    =  x.fromdate.value.split("/").reverse().join("-");
	var todate     =   x.todate.value.split("/").reverse().join("-");
	
	 if (document.getElementById('option1').checked == false) {
          fromdate = '';
		  todate = '';
        } 
	
	
	
	var itemcode      = document.getElementById('fromitem').value;
    var suppliercode  = document.getElementById('fromsupplier').value;

		
 str = 'rep_expirydate.php?fromdate='+fromdate+'&todate='
+todate+'&itemcode='+itemcode+'&suppliercode='+suppliercode;
		 
 
 
			   
	if (printaccess==1)
		window.open(str);
	else
		window.open(str,"Report", "width=900,height=600,screenX=0,left=50,screenY=0,top=0,status=no,menubar=no,scrollbars=yes,resizable=yes");
	 
}

function exportExcel()
{
	width = screen.width - 10;
	height = screen.height - 66;
	var str='';
  	
	for (var i=0; i < document.form1.period.length; i++)
	{
		if (document.form1.period[i].checked)
		{
		  var varperiod = document.form1.period[i].value;
		}
	}
	  
	for (var i=0; i < document.form1.masterby.length; i++)
	{
		if (document.form1.masterby[i].checked)
		{
		  var varmasterby = document.form1.masterby[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;
		}
	}
	  
	  
	for (var i=0; i < document.form1.prfmarby.length; i++)
	{
		if (document.form1.prfmarby[i].checked)
		{
		  var varprfmarby = document.form1.prfmarby[i].value;
		}
	}
	  
	  
	for (var i=0; i < document.form1.promprint.length; i++)
	{
		if (document.form1.promprint[i].checked)
		{
			var varpromprint = document.form1.promprint[i].value;
		}
	}  
	
	for (var i=0; i < document.form1.activeclt.length; i++)
	{
		if (document.form1.activeclt[i].checked)
		{
			var varactiveclt = document.form1.activeclt[i].value;
		}
	}
	
	for (var i=0; i < document.form1.activeitem.length; i++)
	{
		if (document.form1.activeitem[i].checked)
		{
			var varactiveitem = document.form1.activeitem[i].value;
		}
	}
	  
	//Getting Group By Levels 1 and 3
	vargroupby1   = document.form1.groupbylevel1value.value;
	vargroupby2   = document.form1.groupbylevel2value.value;
	  
	//Getting Assigngroupby Values for level 3
	var ob = document.form1.assigngroupby;
	var vargroupby3 = '';
	for (var i = 0; i < ob.options.length; i++) {
		if (vargroupby3.length > 0)
			vargroupby3 += ",";
				
		vargroupby3 += ob.options[i].value;
	}
	  
	// If No Group By Option Selected
	if (vargroupby3 == '') vargroupby3 = 1;

	varprtmargin = 0;
	if (document.form1.prtmargin.checked) 
		varprtmargin = 1;	 
		
	varprtcost = 0;
	if (document.form1.prtcost.checked) 
		varprtcost = 1;	 

	varupdmeancost = 0;
	if (document.form1.updmeancost.checked) 
		varupdmeancost = 1;	 	 
	  
	varprtdt = 0;
	if (document.form1.prtdt.checked)
		varprtdt = 1;		
		
	//If No Group By Option Selected	
	if (vargroupby3 == 1 && vargroupby1 == '' && vargroupby2 == '')
		varprtdt = 1;
		
	varprtsubdt = 0;
	if (document.form1.prtsubdt.checked)
		varprtsubdt = 1;			
		
	varpricettc = 0;
	if (document.getElementById('pricettc')) {
		if (document.form1.pricettc.checked)
			varpricettc = 1;
	}

	varprtqty = 0;
	if (document.form1.prtqty.checked)
		varprtqty = 1;
		
	varprtprice = 0;
	if (document.form1.prtprice.checked)
		varprtprice = 1;

	varprtamt = 0;
	if (document.form1.prtamt.checked)
		varprtamt = 1;		
		
	varprtvat = 0;
	if (document.form1.prtvat.checked)
		varprtvat = 1;			
		
	varshowweight = 0;
	if (document.getElementById('showweight')) {
		if (document.form1.showweight.checked)
			varshowweight = 1;	
	}	
	
	varshowsales = 0;
	if (document.form1.showsales.checked)
		varshowsales = 1;
	varshowretsales = 0;
	if (document.form1.showretsales.checked)
		varshowretsales = 1;

	varfrommonth  = document.form1.frommonth.value;
	vartomonth    = document.form1.tomonth.value;  
	varfromyear   = document.form1.fromyear.value;
	vartoyear     = document.form1.toyear.value;
	varfromdate   = document.form1.fromdate.value;
	vartodate     = document.form1.todate.value;
	varfromitem   = document.form1.fromitem.value;
	vartoitem     = document.form1.toitem.value;
	varfromgrp    = document.form1.fromgroup.value;
	vartogrp      = document.form1.togroup.value;
	varfromsubgrp = document.form1.fromsubgroup.value;
	vartosubgrp   = document.form1.tosubgroup.value;
	varfromprj    = document.form1.fromproject.value;
	varfromcst    = document.form1.fromcostcent.value;
	varfromclient    = document.form1.fromclient.value;
	vartoclient      = document.form1.toclient.value;
	varfromsupplier  = document.form1.fromsupplier.value;
	vartosupplier    = document.form1.tosupplier.value;
	varfromsalesman  = document.form1.fromsalesman.value;
	vartosalesman    = document.form1.tosalesman.value;
	varfromwarehouse = document.form1.fromwarehouse.value;
	varfromarea      = document.form1.fromarea.value;
	varsubproj       = document.form1.subproj.value;
	varsubcostcent   = document.form1.subcostcent.value;
	varfrombustype   = document.form1.frombustype.value;
	vartobustype     = document.form1.tobustype.value;
  
	varsubproj       = varsubproj.replace(/%/g,'-');
	varsubcostcent   = varsubcostcent.replace(/%/g,'-');
  
	var prttemp2 = 0;
	if(document.getElementById("prttemp2").checked)
		prttemp2 = 1;
    
	if(prttemp2==1 && ( varperiod == 2 || varperiod == 3))
		var rep = 'Exp_YearlySalestemp2.php';
	else 
		var rep = 'Exp_YearlySales.php';
	
	str =   rep+'?fromdate='+varfromdate+'&todate='+vartodate+'&frommonth='+varfrommonth+'&tomonth='+vartomonth
	       +'&fromyear='+varfromyear+'&toyear='+vartoyear+'&fromitem='+varfromitem+'&toitem='+vartoitem
		   +'&fromclient='+varfromclient+'&toclient='+vartoclient+'&fromsupplier='+varfromsupplier+'&tosupplier='+vartosupplier
		   +'&fromsalesman='+varfromsalesman+'&tosalesman='+vartosalesman+'&fromgroup='+varfromgrp+'&togroup='+vartogrp
		   +'&fromsubgroup='+varfromsubgrp+'&tosubgroup='+vartosubgrp+'&fromproject='+varfromprj+'&fromcostcent='+varfromcst
		   +'&fromwarehouse='+varfromwarehouse+'&fromarea='+varfromarea+'&curr='+varcurrency+'&period='+varperiod+'&prfmarby='+varprfmarby
		   +'&groupby1='+vargroupby1+'&groupby2='+vargroupby2+'&groupby3='+vargroupby3+'&masterby='+varmasterby+'&prtcost='+varprtcost
		   +'&updmeancost='+varupdmeancost+'&prtdt='+varprtdt+'&prtsubdt='+varprtsubdt+'&prtmargin='+varprtmargin+'&prtqty='+varprtqty
		   +'&prtprice='+varprtprice+'&prtamt='+varprtamt+'&pricettc='+varpricettc+'&subproj='+varsubproj+'&subcostcent='+varsubcostcent
		   +'&frombustype='+varfrombustype+'&tobustype='+vartobustype+'&promprint='+varpromprint+'&showweight='+varshowweight+'&prtvat='+varprtvat
		   +'&showsales='+varshowsales+'&showretsales='+varshowretsales+'&activeclt='+varactiveclt+'&activeitem='+varactiveitem;
		   
  
	window.open(str);
  
}


function CheckPrintMargin() {
    var x= document.form1;
	if (x.prtmargin.checked == true) {
	    
		for (var i=0; i < x.prfmarby.length; i++)
		{
			x.prfmarby[i].disabled = false;
		}
	}  
	else { 
	    
		for (var i=0; i < x.prfmarby.length; i++)
		{
			x.prfmarby[i].disabled = true;
		}
	}
}

function CheckPrintDetail() {
    var x= document.form1;
	if (x.prtdt.checked == true) {
	    x.prtsubdt.disabled = false;
		x.prtsubdt.checked  = true;
	}  
	else { 
	    x.prtsubdt.disabled = true;
		x.prtsubdt.checked  = false;
	}
}


function SelectPeriod(option) {
    var x= document.form1;
	if (option == 1 || option == 2 || option == 4)
	{
		x.frommonth.disabled = false;
		x.tomonth.disabled   = false;
		x.fromyear.disabled  = false;
		x.toyear.disabled    = false;
		x.fromdate.disabled  = true;
		x.todate.disabled    = true;
	} else 
	{
		x.frommonth.disabled = true;
		x.tomonth.disabled   = true;
		x.fromyear.disabled  = true;
		x.toyear.disabled    = true;
		x.fromdate.disabled  = false;
		x.todate.disabled    = false;
	}

}

function ChangeDate(){
	var x= document.form1;
	 
	var sdays = 29;	
	var sdate = x.fromdate.value;
	sdate = FormatDate(sdate);
	var d = new Date(sdate); 
		
	d.setDate(d.getDate() + sdays); 
		
	str = d.getDate();
	str1 = str.toString();
		
	if (str1.length == 1)	str1 = "0"+str1;
			
	str = d.getMonth()+1;
	str2 = str.toString();
		
	if (str2.length == 1)	str2 = "0"+str2;	
		
	x.todate.value=(str1 + "/" + str2 + "/" + d.getFullYear()); 
}

function FormatDate(sdate){
	var idate = new String;
	idate = sdate;
      
    dt_array = idate.split("/");
      
    if ((dt_array[0] < 10) && (dt_array[0].length == 1))
		dt_array[0] = "0" + dt_array[0];
        
	if ((dt_array[1] < 10) && (dt_array[1].length == 1))
		dt_array[1] = "0" + dt_array[1];
   	
	fdate = dt_array[1] + "-" + dt_array[0] + "-" + dt_array[2];
	
	return fdate;
}

function LoadOptions() {
	x = document.form1;
    win = window.open('List_ReportsOptionsTemplates.php?formname=yearlysales', 'List_ReportsOptionsTemplates', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=1040,height=450,top=100,left=0');		
	win.creator = self;
	win.focus();		

}

function SelectOptions() {
	x = document.form1;
	vTemplateId = x.templateid.value;
	
    win = window.open('Form_ReportsOptions.php?isseloption=1&templateid='+vTemplateId+'&formname=yearlysales', 'Form_ReportsOptions', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=1200,height=550,top=50,left=0');
	win.creator = self;
	win.focus();		

}



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

function AddOption(selectId, text, value) {
	var ob = document.form1.assigngroupby;
	var i = ob.options.length;
	var o = new Option(text,value);
	ob.options[i] = o;
	
}

function RemoveOption(selectId) {
	var ob = document.form1.assigngroupby;
	
	//Empty Assigngroupby Values
	for (var k=0; k < ob.options.length; k++) {
		ob.options[k].selected = true;
	}
	
	while (ob.selectedIndex != -1)
	{  
		if (ob.selectedIndex != -1) 
		  ob.options[ob.selectedIndex] = null;
	}
	

}


-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Expiry Date</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>

<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>
	
	 <!--       Form Report Functions          -->
      <script type="text/javascript" src="report/js/jquery-1.9.1.js"></script>
      <script type="text/javascript" src="report/js/jquery-ui.min.js"></script>
      <script type="text/javascript" src="report/js/autocomplete.js"></script>
      <link type="text/css" href="report/js/autocomplete.css" rel="stylesheet">
      <link type="text/css" href="report/js/jquery-ui.css" rel="stylesheet">
   <!--     End  Form Report Functions          -->   

   
   
</head>
<body>
HERE;

echo "<form id='form1' name='form1' method='post' action='$_SERVER[PHP_SELF]'>
		<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;'><span class='title'>Expiry Date</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>";

	if ($ExporttoExcel==1){
		echo" <button type='button'  style= 'visibility:hidden;' id='btnExcel' name='btnExcel' onClick=\"exportExcel()\"; title='Export Excel'><span><span>Export Excel</span></span></button>";

	}	
	  
/* 	echo" <button type='button' id='btnLoadOptions' name='btnLoadOptions' onClick=\"LoadOptions()\"; title='Load Template'><span><span>Load Options</span></span></button>";  
	echo" <button type='button' id='btnSelectOptions' name='btnSelectOptions' onClick=\"SelectOptions()\"; title='Select Options'><span><span>Select Options</span></span></button>";  */ 
echo"	</td></tr></table>";
echo"</td></tr>";				

		
echo"<tr> ";

PRINT <<<HERE

<td id="content-body">
<table border="0" align="center" valign="top" width="100%" class="tablecontent">
<tbody>


<!-- new -->
 <tr bgcolor="#F7F7F7">
    <td valign="top" align="left" colspan="10">
        <table border="0" align="center" valign="top" width="50%" style = 'margin:0 0 0 0;'>
            <tbody>
                <tr>
                    <td width="20%" height="19" colspan="2" align="left" bgcolor="#F5F5F5"><span class="style8">	

					<input name="option" id="option1"  type="checkbox" value="1" checked="">Date</span></td>
                    
                </tr>
                <tr height="25">
                    <td width="5%" valign="middle" bgcolor="#F5F5F5"><span class="style8">From</span></td>
                    <td width="15%" valign="middle" bgcolor="#F5F5F5"><span class="style8">      <input type="text"  id = 'fromdate' name="fromdate" value="$fromdate" maxlength="10" size="10">      <a href="#" onclick="displayCalendar(document.form1.fromdate,'dd/mm/yyyy',this); return false;" name="anchor1" id="anchor1"><img src="./img/cal.gif" border="0" align="center"></a></span></td>
                    </tr>
                <tr height="25">
                    <td width="5%" valign="top" bgcolor="#F5F5F5"><span class="style8">To</span></td>
                    <td width="15%" valign="top" bgcolor="#F5F5F5"><span class="style8">      <input type="text"  id = 'todate' name="todate" value="$todate" maxlength="10" size="10">      <a href="#" onclick="displayCalendar(document.form1.todate,'dd/mm/yyyy',this); return false;" name="anchor1" id="anchor1"><img src="./img/cal.gif" border="0" align="center"></a></span></td>
              </tr>
              
               
              
                
               
              
                <tr height="30">
                    <td colspan="8" bgcolor="#F5F5F5"><span class="style8">&nbsp;</span></td>
                </tr>
            </tbody>
        </table>
    </td>
</tr>
			
			
			
<!-- end new -->			

<tr bgcolor="#F7F7F7"><td valign="top" align="left" colspan="10"> 
 <table   border="0" align="center" width="100%" cellpadding="0"> 
 
<tr>   <td colspan="2" bgcolor="#F5F5F5"><span class="style8">Supplier Code /Description</span></td>   <td colspan="2" bgcolor="#F5F5F5"><span class="style8">Item Code/Description</span></td> </tr>

<tr>     <td width="44%" valign="middle" bgcolor="#F5F5F5"><span class="style8">   <label>
        <input name="fromsupplier" type="text" id="fromsupplier" size="15" value="" tag="primarykey" onfocus="_AutoCompleteData(event,this.id,'fromsupplier','fromsuppdesc','SUPPLIERS','tosupplier','tosuppdesc');" onkeyup="_AutoCompleteData(event,this.id,'fromsupplier','fromsuppdesc','SUPPLIERS','tosupplier','tosuppdesc');" onkeydown="_Check_EnterPressed(event,this.id,'fromsuppdesc','primarykey','SUPPLIERS','tosupplier','tosuppdesc');" onblur="return _CHECKISVALID(event,this.id,'fromsuppdesc','primarykey','SUPPLIERS','tosupplier','tosuppdesc')" class="ui-autocomplete-input" autocomplete="off"><span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
        <input name="fromsuppdesc" type="text" id="fromsuppdesc" size="39" value="" tag="description" onfocus="_AutoCompleteData(event,this.id,'fromsupplier','fromsuppdesc','SUPPLIERS','tosupplier','tosuppdesc');" onkeyup="_AutoCompleteData(event,this.id,'fromsupplier','fromsuppdesc','SUPPLIERS','tosupplier','tosuppdesc');" onkeydown="_Check_EnterPressed(event,this.id,'fromsupplier','description','SUPPLIERS','tosupplier','tosuppdesc');" onblur="return _CHECKISVALID(event,this.id,'fromsupplier','description','SUPPLIERS','tosupplier','tosuppdesc')">
        </label>
      </span>
      <label><span class="style11"><a href="javascript:void(0);" name="My Window Name" title=" Select Supplier From " onclick="_Check_EnterPressed(event,'fromsupplier','fromsuppdesc','primarykey','SUPPLIERS','tosupplier','tosuppdesc','btn');"><img src="img/btnopen.jpg" width="15" height="20" border="0"></a> </span></label></td>   <td width="6%" align="right" bgcolor="#F5F5F5"><span class="style8">&nbsp;</span></td>   <td width="44%" bgcolor="#F5F5F5"><span class="style8">   <label>
        <input name="fromitem" type="text" id="fromitem" size="15" value="" tag="primarykey" onfocus="_AutoCompleteData(event,this.id,'fromitem','fromitemdesc','ITEMS_TYPE0','toitem','toitemdesc');" onkeyup="_AutoCompleteData(event,this.id,'fromitem','fromitemdesc','ITEMS_TYPE0','toitem','toitemdesc');" onkeydown="_Check_EnterPressed(event,this.id,'fromitemdesc','primarykey','ITEMS_TYPE0','toitem','toitemdesc');" onblur="return _CHECKISVALID(event,this.id,'fromitemdesc','primarykey','ITEMS_TYPE0','toitem','toitemdesc')" class="ui-autocomplete-input" autocomplete="off">
        <input name="fromitemdesc" type="text" id="fromitemdesc" size="39" value="" tag="description" onfocus="_AutoCompleteData(event,this.id,'fromitem','fromitemdesc','ITEMS_TYPE0','toitem','toitemdesc');" onkeyup="_AutoCompleteData(event,this.id,'fromitem','fromitemdesc','ITEMS_TYPE0','toitem','toitemdesc');" onkeydown="_Check_EnterPressed(event,this.id,'fromitem','description','ITEMS_TYPE0','toitem','toitemdesc');" onblur="return _CHECKISVALID(event,this.id,'fromitem','description','ITEMS_TYPE0','toitem','toitemdesc')">
        </label>
      </span>
      <label><span class="style11"><a href="javascript:void(0);" name="My Window Name" title=" Select Salesman From " onclick="_Check_EnterPressed(event,'fromitem','fromitemdesc','primarykey','ITEMS_TYPE0','toitem','toitemdesc','btn');"><img src="img/btnopen.jpg" width="15" height="20" border="0"></a> </span></label></td> </tr>
	  
	 
	  
	  
 
 </table>
 <tr>
</tbody>
</table>
</td>

HERE;

 
echo "</tr><tr height='30'><td align='center' id='content-bottom' ></td></tr>"; 
echo" </tbody></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");
}
	  
?>