<?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 RA_StatementofAccount 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']."'";
$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;

$querylog=" select ifNull(FI_RepRestrictProject,0) As FI_RepRestrictProject, ifNull(FI_RepRestrictCostcenter,0) As FI_RepRestrictCostcenter ".
          " 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);
}

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

$querysetup ="select base1, base2 from setup ";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
$rowsetup=mysql_fetch_row($resultsetup);

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


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

$queryjvtype="select type_name from jourtype order by type_name";
$resultjvtype=mysql_query($queryjvtype,$connection) or die(mysql_error());


$querydflproject="select project_code as defaultproject from ".$_SESSION['dbLabel'].".loginstk where user_account='".$_SESSION['useraccount']."' and default_project=1 ";
//echo$querydflproject;
$resultdflproject=mysql_query($querydflproject,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultdflproject)){
	extract($rows);
}
$querydflcostcent="select costcent_code as defaultcostcent from ".$_SESSION['dbLabel'].".loginstk where user_account='".$_SESSION['useraccount']."' and default_costcenter=1 ";
$resultdflcostcent=mysql_query($querydflcostcent,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultdflcostcent)){
	extract($rows);
}

if ((empty($fromproject)) && $Module_Project == 1  && $Module_RestrictProjectReport == 1 )
	$fromproject = $defaultproject;
if ((empty($fromcostcent)) && $Module_CostCenter == 1)
	$fromcostcent = $defaultcostcent;	

$query="select ifnull(ShowReportHeader,0) as ShowReportHeader from ".$_SESSION['dbLabel'].".loginstk where user_account='".$_SESSION['useraccount']."' ";
$result=mysql_query($query,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($result)){
	extract($rows);
}
if($ShowReportHeader=='')
	$ShowReportHeader=1;
	
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 type="text/javascript" src="js/grid/jquery-1.9.1.js"></script>
<script language="JavaScript" src="CalendarPopup.js" ></script><!-- Date only with year scrolling -->

<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 cgr7(){
x=document.form1;
//code1a=x.code1a.value;
document.form1.action="select_item.php?item=1";
document.form1.btncode1.submit();

}

function cgr8(){
x=document.form1;
//code2a=x.code2a.value;
document.form1.action="select_item.php?item=2";
document.form1.btncode2.submit();

}

all = 0;  // 0 means 'no', 1 means 'yes'




function showlistsalesman(str){
  var vdate, vcode; 
  vcode=encodeURIComponent(document.form1.clientsalesman.value);
  vname=encodeURIComponent(document.form1.clientsalesmanname.value);
  if(vcode=='')
	vcode=vname;
  window.open('List_Salesmen.php?frm=20&str=20&item='+str+'&PLedger_number='+vcode,'mywindow','width=850,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}



function Exportexcel(){

	width = screen.width - 10;
	height = screen.height - 66;
	var str='';
  	
	for (var i=0; i < document.form1.date.length; i++)
	{
		if (document.form1.date[i].checked)	{
			var vardate = document.form1.date[i].value;
		}
	}	 
  
	for (var i=0; i < document.form1.transaction.length; i++)
	{
		if (document.form1.transaction[i].checked){
			var vartransaction = document.form1.transaction[i].value;
		}
	}
	 
	for (var i=0; i < document.form1.ledgeroption.length; i++)
	{
		if (document.form1.ledgeroption[i].checked) {
			var varledgeroption = document.form1.ledgeroption[i].value;
		}
	}
  
  
	varexclude = 0;
	if (document.form1.exclude.checked)   varexclude = 1;	
	
	varalltypes = 0;
	if (document.form1.alltypes.checked)  varalltypes = 1;	
	
	var checkname;
	var x, varjvtype;
	varjvtype = '';
	for (var i=1; i <= document.form1.i.value; i++)
	{
		checkname='type'+i;
	
		x = document.getElementById(checkname);
		if (varalltypes == 0 && x.checked) 
			varjvtype = varjvtype+",'"+x.value+"'";
    
	}
	varjvtype = varjvtype.substr(1);
  
	varcurr = 0;
	if (document.form1.curr.checked)    varcurr = 1;	 
	
	varcurrbase1 = 0;
	if (document.form1.currbase1.checked)  varcurrbase1 = 1;	
	
	varcurrbase2 = 0;
	if (document.form1.currbase2.checked)   varcurrbase2 = 1;		
	
	varcum = 0;
	if (document.form1.cumulative.checked)   varcum = 1;	
 	
  	

	varprtfolio = 0;
	if (document.form1.prtfolio.checked)   varprtfolio = 1;			
	
	varprtref = 0;
	if (document.form1.prtref.checked)	   varprtref = 1;
	
	varprtdesc = 0;
	if (document.form1.prtdesc.checked)    varprtdesc = 1;	
	
	varprtvaluedate = 0;
	if (document.form1.prtvaluedate.checked)    varprtvaluedate = 1;	
	
	varprtjvtype = 0;
	if (document.form1.prtjvtype.checked)    varprtjvtype = 1;		
	
	varshowunposted = 0;
	if (document.form1.showunposted.checked)    varshowunposted = 1;	

	varprtcostcentc = 0;
	if (document.form1.prtcostcentc.checked)    varprtcostcentc = 1;	
  
	varprtprojectc = 0;
	if (document.form1.prtprojectc.checked)    varprtprojectc = 1;
	
	varprtcostcent = 0;
	if (document.form1.prtcostcent.checked)    varprtcostcent = 1;		
  
	varprtproject = 0;
	if (document.form1.prtproject.checked)	   varprtproject = 1;			
	
	varprevbal = 0;
	if (document.form1.prevbal.checked)    varprevbal = 1;			
	
	vardtjv = 0;
	if (document.form1.dtjv.checked)    vardtjv = 1;	

	vardtdate = 0;
	if (document.form1.dtdate.checked)    vardtdate = 1;		
	
	varchecks = 0;
	if (document.form1.checks.checked)    varchecks = 1;	

	varparentprj = 0;
	if (document.form1.parentprj.checked)    varparentprj = 1;	
	
	varprintaging = 0;
	if (document.form1.prtaging.checked)    varprintaging = 1;		
	
	varprtheader = 0;
	if (document.form1.prtheader.checked)    varprtheader = 1;	
	
	varprtcstjour = 0;
	if (document.form1.prtcstjour.checked)    varprtcstjour = 1;	
	
	varprtwording = 0;
	if (document.form1.prtwording.checked)    varprtwording = 1;
	
    varprtwnac =0;
	if (document.form1.prtwnac.checked)    varprtwnac = 1;
	
	varshowman =0;
	if (document.form1.showman.checked)    varshowman = 1;
	if (document.form1.prtwnac.checked)    varprtwnac = 1;
	
	varOrdshowman =0;
	if (document.form1.Ordshowman.checked)    varOrdshowman = 1;
	
	varprtshowuser =0;
	if (document.form1.prtshowuser.checked)    varprtshowuser = 1;
  
	varfromdate   = document.form1.fromdate.value;
	vartodate     = document.form1.todate.value;
	varfromledger = document.form1.fromledger.value;
	vartoledger   = document.form1.toledger.value;
	varfromprj    = document.form1.fromproject.value;
	varfromcst    = document.form1.fromcostcent.value;
	varfromcur    = document.form1.fromcur.value;
	varcltprj     = document.form1.clientproject.value;
	varcltcst     = document.form1.clientcostcent.value;
	varsalesman     = document.form1.clientsalesman.value;
  
	varcltprj = varcltprj.replace('&','%26');
	varcltcst = varcltcst.replace('&','%26');
  
  
    if(document.getElementById("prtspecial").checked)
		var specialcheck = 1;
	else var specialcheck = 0;
	if(specialcheck == 1)
		str =   'Exp_StatementofAccountaction.php?fromdate='+varfromdate+'&todate='+vartodate+'&fromledger='+varfromledger
           +'&toledger='+vartoledger+'&fromproject='+varfromprj+'&fromcst='+varfromcst+'&fromcur='+varfromcur
		   +'&dateoption='+vardate+'&transaction='+vartransaction+'&ledgeroption='+varledgeroption
		   +'&curr='+varcurr+'&currbase1='+varcurrbase1+'&currbase2='+varcurrbase2+'&cum='+varcum
		   +'&alltypes='+varalltypes+'&exclude='+varexclude+'&jvtype='+varjvtype+'&showunposted='+varshowunposted
		   +'&prtfolio='+varprtfolio+'&prtref='+varprtref+'&prtdesc='+varprtdesc+'&prtvaluedate='+varprtvaluedate
		   +'&prtjvtype='+varprtjvtype+'&prtcostcent='+varprtcostcent+'&prtproject='+varprtproject+'&prevbal='+varprevbal
		   +'&dtjv='+vardtjv+'&dtdate='+vardtdate+'&checks='+varchecks+'&cltcst='+varcltcst+'&cltprj='+varcltprj
		   +'&parentprj='+varparentprj+'&prtaging='+varprintaging+'&prtheader='+varprtheader+'&prtcstjour='+varprtcstjour
		   +'&prtwording='+varprtwording+'&salesman='+varsalesman+'&prtwnac='+varprtwnac+'&showman='+varshowman+'&OrdManNo='+varOrdshowman;
	else
	str =   'Exp_statementofaccount.php?fromdate='+varfromdate+'&todate='+vartodate+'&fromledger='+varfromledger
           +'&toledger='+vartoledger+'&fromproject='+varfromprj+'&fromcst='+varfromcst+'&fromcur='+varfromcur
		   +'&dateoption='+vardate+'&transaction='+vartransaction+'&ledgeroption='+varledgeroption
		   +'&curr='+varcurr+'&currbase1='+varcurrbase1+'&currbase2='+varcurrbase2+'&cum='+varcum
		   +'&alltypes='+varalltypes+'&exclude='+varexclude+'&jvtype='+varjvtype+'&showunposted='+varshowunposted
		   +'&prtfolio='+varprtfolio+'&prtref='+varprtref+'&prtdesc='+varprtdesc+'&prtvaluedate='+varprtvaluedate
		   +'&prtjvtype='+varprtjvtype+'&prtcostcentc='+varprtcostcentc+'&prtcostcent='+varprtcostcent+'&prtprojectc='+varprtprojectc+'&prtproject='+varprtproject+'&prevbal='+varprevbal
		   +'&dtjv='+vardtjv+'&dtdate='+vardtdate+'&checks='+varchecks+'&cltcst='+varcltcst+'&cltprj='+varcltprj
		   +'&parentprj='+varparentprj+'&prtaging='+varprintaging+'&prtheader='+varprtheader+'&prtcstjour='+varprtcstjour
		   +'&prtwording='+varprtwording+'&salesman='+varsalesman+'&prtwnac='+varprtwnac+'&showman='+varshowman+'&OrdManNo='+varOrdshowman+'&prtshowuser='+varprtshowuser;
  
	window.open(str);
  
}


function kdClient(choice,e,app)
{   
	 x = document.form1;
	if(app==0){
		var clientcode = x.fromledger.value;
		if(clientcode=='')
		var clientcode = x.fromledgername.value;
	} else {
		var clientcode = x.toledger.value;
		if(clientcode=='')
		var clientcode = x.toledgername.value;
	}	
    var intKey = (window.Event) ? e.which : e.keyCode;
	
		
    if (intKey == 13) { //enter key
	
	
		var xmlhttp = getXMLHttpRequest();	
		
		
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				var data = xmlhttp.responseText.split("[BRK]");
				
					if(app==0){
						if(data[0]!=''){
								x.fromledger.value = data[0];
								x.fromledgername.value = data[1];
									if(x.toledger.value==''){
									x.toledger.value = data[0];
									x.toledgername.value = data[1];
									
									}
						}
						else showlistledger(1);
					} else {
						if(data[0]!=''){
								x.toledger.value = data[0];
								x.toledgername.value = data[1];
							//if(x.toledgername.value!=''){
							//	x.submit();	
							//} 
						}
						else showlistledger(2);						
					}
			}
		}
	    
		xmlhttp.open("GET","Form_Statementofaccount_Action.php?mode=getclientname&clientcode="+clientcode+"&choice="+choice);
		xmlhttp.send();
	
      
			
			
    }
	

}

function kdProject(choice,e,app)
{   
	 x = document.form1;
	if(app==0){
		var projectcode = x.fromproject.value;
		if(projectcode=='')
		var projectcode = x.fromprojectname.value;
	} else {
		var projectcode = x.toproject.value;
		if(projectcode=='')
		var projectcode = x.toprojectname.value;
	}	
    var intKey = (window.Event) ? e.which : e.keyCode;
	
		
    if (intKey == 13) { //enter key
	
	
		var xmlhttp = getXMLHttpRequest();	
		
		 
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				var data = xmlhttp.responseText.split("[BRK]");
				
					if(app==0){
						if(data[0]!=''){
								x.fromproject.value = data[0];
								x.fromprojectname.value = data[1];
									if(x.toproject.value==''){
									x.toproject.value = data[0];
									x.toprojectname.value = data[1];
									
									}
						}
					} else {
						if(data[0]!=''){
								x.toproject.value = data[0];
								x.toprojectname.value = data[1];
							//if(x.toprojectname.value!=''){
							//	x.submit();	
							//} 
						}
					}
			}
		}
	    
		xmlhttp.open("GET","Form_statementofaccount_Action.php?mode=getprojectname&projectcode="+projectcode+"&choice="+choice);
		xmlhttp.send();
	
      
			
			
    }
	

}



function kdSalesman(choice,e,app)
{   
	 x = document.form1;
	if(app==0){
		var clientcode = x.clientsalesman.value;
		var clientname = x.clientsalesmanname.value;
	} else {
		var clientcode = x.clientsalesman.value;
		var clientname = x.clientsalesmanname.value;
	}	
    var intKey = (window.Event) ? e.which : e.keyCode;
	
		
    if (intKey == 13) { //enter key
	
	
		var xmlhttp = getXMLHttpRequest();	
		
		
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				var data = xmlhttp.responseText.split("[BRK]");
				 
					
					 
						if(data[0]!=''){
								x.clientsalesmanname.value = data[1];
									if(x.clientsalesman.value==''){
									x.clientsalesman.value = data[0];
									x.clientsalesmanname.value = data[1];
									
									}
						}
						else showlistsalesman(1);
					 
			}
		}
	    
		xmlhttp.open("GET","Form_statementofaccount_action.php?mode=getsalesmanname&clientcode="+clientcode+"&choice="+choice+"&clientname="+clientname);
		xmlhttp.send();
	
      
			
			
    }
	
	
  


}



function printPrev(printaccess)
{
	width = screen.width - 10;
	height = screen.height - 66;
	var str='';
  	
	for (var i=0; i < document.form1.date.length; i++)
	{
		if (document.form1.date[i].checked)   {
			var vardate = document.form1.date[i].value;
		}
	}	 
  
	for (var i=0; i < document.form1.transaction.length; i++)
	{
		if (document.form1.transaction[i].checked)   {
			var vartransaction = document.form1.transaction[i].value;
		}
	}
	 
	for (var i=0; i < document.form1.ledgeroption.length; i++)
	{
		if (document.form1.ledgeroption[i].checked) {
			var varledgeroption = document.form1.ledgeroption[i].value;
		}
	}
  
  
	varexclude = 0;
	if (document.form1.exclude.checked)   varexclude = 1;	
	
	varalltypes = 0;
	if (document.form1.alltypes.checked)   varalltypes = 1;	
	
	var checkname;
	var x, varjvtype;
	varjvtype = '';
	for (var i=1; i <= document.form1.i.value; i++)
	{
		checkname='type'+i;
	
		x = document.getElementById(checkname);
		if (varalltypes == 0 && x.checked) 
			varjvtype = varjvtype+",'"+x.value+"'";
    
	}
	varjvtype = varjvtype.substr(1);
  
	varcurr = 0;
	if (document.form1.curr.checked)     varcurr = 1;	 
	
	varcurrbase1 = 0;
	if (document.form1.currbase1.checked)    varcurrbase1 = 1;	
	
	varcurrbase2 = 0;
	if (document.form1.currbase2.checked)    varcurrbase2 = 1;		
	
	varcum = 0;
	if (document.form1.cumulative.checked)   varcum = 1;	
 	

	varprtfolio = 0;
	if (document.form1.prtfolio.checked)    varprtfolio = 1;			
	
	varprtref = 0;
	if (document.form1.prtref.checked)    varprtref = 1;
	
	varprtdesc = 0;
	if (document.form1.prtdesc.checked)    varprtdesc = 1;	
	
	varprtvaluedate = 0;
	if (document.form1.prtvaluedate.checked)    varprtvaluedate = 1;	
	
	varprtjvtype = 0;
	if (document.form1.prtjvtype.checked)    varprtjvtype = 1;		
	
	varshowunposted = 0;
	if (document.form1.showunposted.checked)    varshowunposted = 1;	
	
	varprtcostcentc = 0;
	if (document.form1.prtcostcentc.checked)    varprtcostcentc = 1;
	
	varprtcostcent = 0;
	if (document.form1.prtcostcent.checked)    varprtcostcent = 1;		
  
	varprtprojectc = 0;
	if (document.form1.prtprojectc.checked)    varprtprojectc = 1;
	varprtproject = 0;
	if (document.form1.prtproject.checked)    varprtproject = 1;			
	
	varprevbal = 0;
	if (document.form1.prevbal.checked)    varprevbal = 1;			
	
	vardtjv = 0;
	if (document.form1.dtjv.checked)    vardtjv = 1;	

	vardtdate = 0;
	if (document.form1.dtdate.checked)    vardtdate = 1;		
	
	varchecks = 0;
	if (document.form1.checks.checked)    varchecks = 1;	
	
	varparentprj = 0;
	if (document.form1.parentprj.checked)    varparentprj = 1;
	
	varprintaging = 0;
	if (document.form1.prtaging.checked)    varprintaging = 1;	
	
	varprtheader = 0;
	if (document.form1.prtheader.checked)    varprtheader = 1;	
	
	varprtbreak = 0;
	if (document.form1.prtbreak.checked)    varprtbreak = 1;
	
	varprtcstjour = 0;
	if (document.form1.prtcstjour.checked)    varprtcstjour = 1;	
	
	varprtwording = 0;
	if (document.form1.prtwording.checked)    varprtwording = 1;
  
   varprtwnac =0;
	if (document.form1.prtwnac.checked)    varprtwnac = 1;
	
	varshowman =0;
	if (document.form1.showman.checked)    varshowman = 1;
	
	
	varOrdshowman =0;
	if (document.form1.Ordshowman.checked)    varOrdshowman = 1;
	

	varprtshowuser =0;
	if (document.form1.prtshowuser.checked)    varprtshowuser = 1;
	
	
	varfromdate   = document.form1.fromdate.value;
	vartodate     = document.form1.todate.value;
	varfromledger = document.form1.fromledger.value;
	vartoledger   = document.form1.toledger.value;
	varfromprj    = document.form1.fromproject.value;	
	varfromcst    = document.form1.fromcostcent.value;
	varfromcur    = document.form1.fromcur.value;
	varcltprj       = document.form1.clientproject.value;
	varcltcst       = document.form1.clientcostcent.value;
     varsalesman   = document.form1.clientsalesman.value;
	varcltprj = varcltprj.replace('&','%26');
	varcltcst = varcltcst.replace('&','%26');
	
	
	
	if(document.getElementById("prtspecial").checked)
		var specialcheck = 1;
	else var specialcheck = 0;
	if(specialcheck == 1)
		str =   'Rep_StatementofAccountaction.php?fromdate='+varfromdate+'&todate='+vartodate+'&fromledger='+varfromledger
           +'&toledger='+vartoledger+'&fromproject='+varfromprj+'&fromcst='+varfromcst+'&fromcur='+varfromcur
		   +'&dateoption='+vardate+'&transaction='+vartransaction+'&ledgeroption='+varledgeroption
		   +'&curr='+varcurr+'&currbase1='+varcurrbase1+'&currbase2='+varcurrbase2+'&cum='+varcum
		   +'&alltypes='+varalltypes+'&exclude='+varexclude+'&jvtype='+varjvtype+'&showunposted='+varshowunposted
		   +'&prtfolio='+varprtfolio+'&prtref='+varprtref+'&prtdesc='+varprtdesc+'&prtvaluedate='+varprtvaluedate
		   +'&prtjvtype='+varprtjvtype+'&prtcostcent='+varprtcostcent+'&prtproject='+varprtproject+'&prevbal='+varprevbal
		   +'&dtjv='+vardtjv+'&dtdate='+vardtdate+'&checks='+varchecks+'&cltcst='+varcltcst+'&cltprj='+varcltprj
		   +'&parentprj='+varparentprj+'&prtaging='+varprintaging+'&prtheader='+varprtheader+'&prtcstjour='+varprtcstjour
		   +'&prtwording='+varprtwording+'&salesman='+varsalesman+'&prtwnac='+varprtwnac+'&showman='+varshowman+'&OrdManNo='+varOrdshowman+'&varprtbreak='+varprtbreak;
	else
	str =   'rep_statementofaccount.php?fromdate='+varfromdate+'&todate='+vartodate+'&fromledger='+varfromledger
           +'&toledger='+vartoledger+'&fromproject='+varfromprj+'&fromcst='+varfromcst+'&fromcur='+varfromcur
		   +'&dateoption='+vardate+'&transaction='+vartransaction+'&ledgeroption='+varledgeroption
		   +'&curr='+varcurr+'&currbase1='+varcurrbase1+'&currbase2='+varcurrbase2+'&cum='+varcum
		   +'&alltypes='+varalltypes+'&exclude='+varexclude+'&jvtype='+varjvtype+'&showunposted='+varshowunposted
		   +'&prtfolio='+varprtfolio+'&prtref='+varprtref+'&prtdesc='+varprtdesc+'&prtvaluedate='+varprtvaluedate
		   +'&prtjvtype='+varprtjvtype+'&prtcostcentc='+varprtcostcentc+'&prtcostcent='+varprtcostcent+'&prtproject='+varprtproject+'&prtprojectc='+varprtprojectc+'&prevbal='+varprevbal
		   +'&dtjv='+vardtjv+'&dtdate='+vardtdate+'&checks='+varchecks+'&cltcst='+varcltcst+'&cltprj='+varcltprj
		   +'&parentprj='+varparentprj+'&prtaging='+varprintaging+'&prtheader='+varprtheader+'&prtcstjour='+varprtcstjour
		   +'&prtwording='+varprtwording+'&salesman='+varsalesman+'&prtwnac='+varprtwnac+'&showman='+varshowman+'&OrdManNo='+varOrdshowman+'&varprtbreak='+varprtbreak
		   +'&prtshowuser='+varprtshowuser;
   
	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 showlistledger(str){

	if(str==1){
		varledger = document.form1.fromledger.value;
		varledgername = document.form1.fromledgername.value;
	} else {
		varledger   = document.form1.toledger.value;
		varledgername = document.form1.toledgername.value;
	}

  var str1, selectpage;
  for (var i=0; i < document.form1.ledgeroption.length; i++)
  {
    if (document.form1.ledgeroption[i].checked)
    {
      str1 = document.form1.ledgeroption[i].value;
	  if (str1 == 1)
	    selectpage = 'select_ledger.php?item='+str+'&PLedger_Number='+varledger+'&PLedger_Name='+varledgername;
	  else  if (str1 == 2)
        selectpage = 'select_document.php?item='+str+'&form=2';	
	   else  if (str1 == 3)
        selectpage = 'select_document.php?item='+str+'&form=3';		
    }
  }

  
  window.open(selectpage,'mywindow','width=800,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

function showlistProject(frm) {
	window.open('List_SorProject.php?frm='+frm+'&item=','mywindow','width=850,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

function showlistCostcenter(frm){

  window.open('List_SorCostcenter.php?frm='+frm+'&item=','mywindow','width=850,height=550,,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

function select_alljvtypes() {
   
   var checkname;
   var x;
   for (var i=1; i <= document.form1.i.value; i++)
  {
    checkname='type'+i;
	
	x = document.getElementById(checkname);
	if (document.form1.alltypes.checked) 
		x.checked = true;
	else
       	x.checked = false;
    
  }
  
  if (document.form1.alltypes.checked) {
     document.form1.exclude.checked = false;
     document.form1.exclude.disabled = true;
  }	 
  else
     document.form1.exclude.disabled = false;

}

function CheckCummulative() {

	var x= document.form1;
	if (x.curr.checked == false && ((x.currbase1.checked == true && x.currbase2.checked == false) || 
									(x.currbase1.checked == false && x.currbase2.checked == true))) 
		x.cumulative.disabled = false;	 
	else {
	    x.cumulative.checked = false;
        x.cumulative.disabled = true;	 	
	}	

}

function CheckValueDate(option) {

	var x= document.form1;
	if (x.prtvaluedate.checked == true && x.prtjvtype.checked == true && option == 1 ) 
		x.prtjvtype.checked = false;	 
		
	if (x.prtvaluedate.checked == true && x.prtjvtype.checked == true && option == 2 ) 
		x.prtvaluedate.checked = false;	 	

}

function CheckDetailedPerDate() {

	var x= document.form1;
	if (x.dtdate.checked == false ) { 
	
	  x.prtref.checked = false;
	  x.checks.checked = false;
	  x.dtjv.checked = false;
	  x.prtref.disabled = true;
	  x.checks.disabled = true;
	  x.dtjv.disabled = true;
	  
    } else {
      
      x.prtref.checked = true;
	  x.checks.checked = true;
	  x.prtref.disabled = false;
	  x.checks.disabled = false;
	  x.dtjv.disabled = false;	  
	
	}
		
	

}



function CheckOrdshowman() {
	var x= document.form1;
	if (x.showman.checked == false ) { 
	  x.Ordshowman.checked = false; 
    } else {
      x.Ordshowman.checked = true; 
	} 
}
function Checkshowman() {
	var x= document.form1;
	if (x.Ordshowman.checked == true ) {
      x.showman.checked = true; 
	} 
}

-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Statement of Account</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>
</head>
<body>
HERE;

echo "<form id='form1' name='form1' method='post' action='$_SERVER[PHP_SELF]'>";

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'>Statement of Account</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='reset' id='btnClear' name='btnClear'  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' id='btnExcel' name='btnExcel' onClick=\"Exportexcel()\"; title='Export Excel'><span><span>Export 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'>";		
   
echo '  <table height="534" border="0" align="center" width="100%">';

echo" <tr>";	  
echo"   <td width='25%' height='19' colspan='2' align='left' bgcolor='#F5F5F5'><span class='style8'>";
echo"      <label><input name='date' type='radio' value='1' checked='checked'>Date</label>&nbsp;&nbsp;&nbsp;";
echo"      <label><input name='date' type='radio' value='2'>Value Date</label></span></td> ";
echo"   <td width='20%' height='19' align='center' bgcolor='#F5F5F5'><span class='style8'>Currency</span></td>";
echo"   <td width='55%' height='19' colspan='3' align='center' bgcolor='#F5F5F5'><span class='style8'>Options </span></td>";
echo" </tr>";

echo" <tr height='15px'>";	  
echo"   <td width='5%'  valign='middle' bgcolor='#F5F5F5' ><span class='style8'>From</span></td>";
echo"   <td width='15%'  valign='middle' bgcolor='#F5F5F5' ><span class='style8'>";
echo"      <input type='text' name='fromdate'  id='fromdate' value='$fromdate' maxlength='10' size='6'>";
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"   <td width='15%' rowspan='2' bgcolor='#F5F5F5'><span class='style8'><label>";
echo"      <input name='curr' type='checkbox' value='currency1' onClick='return CheckCummulative();'  checked='checked'>Currency</label></span>";
echo"      <span class='style8'><select name='fromcur' id='fromcur'>";
		echo"<option></option>";
		while($curf=mysql_fetch_row($resultcurrency)){
		echo"<option ";
			if ($fromcur==$curf[0])
				echo " selected ";
		echo" value='$curf[0]'>$curf[0] </option>";
		}
		echo"</select></span>";

echo"   <br><span class='style8'><label>";
echo"      <input name='currbase1' type='checkbox' value='$rowsetup[0]' onClick='return CheckCummulative();'>$rowsetup[0]</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='currbase2' type='checkbox' value='$rowsetup[1]' onClick='return CheckCummulative();'>$rowsetup[1]</label></span>";
echo"      <span class='style8'><label>";
echo"      <input name='cumulative' type='checkbox' value='1' disabled>Cumulative</label></span></td>";

echo"   <td width='15%' rowspan='2' bgcolor='#F5F5F5' valign='top'><span class='style8'><label>";
echo"      <input name='checks' type='checkbox' id='checks' value='1' checked />";
echo"      Checks</label></span>";	

echo"   <br><span class='style8'><label>";
echo"      <input name='prtcostcentc' type='checkbox' id='prtcostcentc' value='1' />";
echo"      Print Costcenter Code</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtcostcent' type='checkbox' id='prtcostcent' value='1' />";
echo"      Print Costcenter Name</label></span>";

echo"   <br><span class='style8'><label>";
echo"      <input name='prtprojectc' type='checkbox' id='prtprojectc' value='1' />";
echo"      Print Shipment Ref Code</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtproject' type='checkbox' id='prtproject' value='1' />";
echo"      Print Shipment Ref Name</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtfolio' type='checkbox' id='prtfolio' value='1' checked />";
echo"      Print Folio</label></span>";
echo"	<br><span class='style8'><label>";
echo"		<input name='prtaging' type='checkbox' id='prtaging' value='1' />";
echo"      	Show Aging</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtwording' type='checkbox' id='prtwording' value='1' />";
echo"      Show Wording</label>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtshowuser' type='checkbox' id='prtshowuser' value='1' />";
echo"      Show User</label>";
echo "</span></td>";

		
echo"   <td width='13%' rowspan='2' bgcolor='#F5F5F5' valign='top'><span class='style8'><label>";
echo"      <input name='prtref' type='checkbox' id='prtref' value='1' checked />";
echo"      Print Reference</label></span>";	
echo"   <br><span class='style8'><label>";
echo"      <input name='prtdesc' type='checkbox' id='prtdesc' value='1' checked />";
echo"      Print Description</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtvaluedate' type='checkbox' id='prtvaluedate' value='1' OnClick='CheckValueDate(1); ' checked />";
echo"      Print Value Date</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtjvtype' type='checkbox' id='prtjvtype' value='1' OnClick='CheckValueDate(2); ' />";
echo"      Print Jv Type</label></span>";
echo"   <br><span class='style8'><label>";

if($ShowReportHeader== 1 && $module_ReferenceByCostcenter== 1)
	echo"      <input name='prtheader' type='checkbox' id='prtheader' value='1' checked />";
else
if($ShowReportHeader== 0 && $module_ReferenceByCostcenter== 1)
	echo"      <input name='prtheader' type='checkbox' id='prtheader' value='1'  />";
else
if($module_ReferenceByCostcenter== 0)
	echo"      <input name='prtheader' type='checkbox' id='prtheader' value='1' checked />";

else
	echo"      <input name='prtheader' type='checkbox' id='prtheader' value='1'  />";
echo"      Show Report Header</label></span>";

echo"   <br><span class='style8'><label>";
echo"      <input name='prtbreak' type='checkbox' id='prtbreak' value='1' checked />";
echo"      Seperate pages</label></span>";

echo"   <br><span class='style8'><label>";
echo"      <input name='prtspecial' type='checkbox' id='prtspecial' value='0' />";
echo"      Statement of Account Action</label></span></td>";
		
echo"   <td width='25%' rowspan='2' bgcolor='#F5F5F5' valign='top' ><span class='style8'><label>";
echo"      <input name='dtdate' type='checkbox' id='dtdate' value='1' OnClick='CheckDetailedPerDate();' checked />";
echo"      Detailed Per Date</label></span>";	
echo"   <br><span class='style8'><label>";
echo"      <input name='dtjv' type='checkbox' id='dtjv' value='1' />";
echo"      Detailed Jv</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='showunposted' type='checkbox' id='showunposted' value='1' />";
echo"      Show Unposted Trans.</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prevbal' type='checkbox' id='prevbal' value='1' checked />";
echo"      Previous Balance</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtcstjour' type='checkbox' id='prtcstjour' value='1' />";
echo"      Detail Shipment Ref/CostCent</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='prtwnac' type='checkbox' id='prtwnac' value='1' />";
echo"      Show statment with no Activity</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='showman' type='checkbox' id='showman' value='1'   OnClick='CheckOrdshowman();'/>";
echo"      Show Manual No.</label></span>";
echo"   <br><span class='style8'><label>";
echo"      <input name='Ordshowman' type='checkbox' id='Ordshowman' value='1'  OnClick='Checkshowman();' />";
echo"      Order By Manual No.</label></span>";
echo" </td></tr>";

echo" <tr height='15px'>";
echo"   <td width='5%' valign='top' bgcolor='#F5F5F5'><span class='style8'>To</span></td>";
echo"   <td width='15%' valign='top' bgcolor='#F5F5F5'><span class='style8'>";
echo"      <input type='text' name='todate'  id='todate' value='$todate'  maxlength='10' size='6'>";
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 height='25px'> ";
echo"   <td colspan='6' bgcolor='#F5F5F5'><span class='style8'>&nbsp;";
echo"Periods: <select name='period' id='period' onchange=\"setdateperiods(this.value,'fromdate','todate')\" >";
echo"<option value=0></option>";
echo"<option value=1>Today</option>";
echo"<option value=2>Week</option>";
echo"<option value=3>This Month</option>";
echo"<option value=4>1st Quarter</option>";
echo"<option value=5>2nd Quarter</option>";
echo"<option value=6>3rd Quarter</option>";
echo"<option value=7>Last Quarter</option>";
echo"<option value=8>This Year</option>";
echo"</select>";

echo"</span></td>";
echo" </tr>";

echo" <tr height='20px'>";
echo"   <td colspan='3' bgcolor='#F5F5F5'><span class='style8'>Ledger No. / Name ";
echo"   <label><input name='ledgeroption' type='radio' value='1' checked='checked'> Ledger No. </label>";
echo"   <label><input name='ledgeroption' type='radio' value='2' > Document </label>";
echo "  <label><input name='ledgeroption' type='radio' value='3' > Both </label>";
echo "  </span></td>";
echo"   <td colspan='2' bgcolor='#F5F5F5'><span class='style8'>Journal Type ";
echo"   <label><input name='alltypes' type='checkbox' id='alltypes' value='1' onclick='select_alljvtypes();'/> All Types  </label>";
echo"   <label><input name='exclude' type='checkbox' id='exclude' value='1' onclick='select_alljvtypes();'/> Exclude </label></span></td>";
echo"   <td  bgcolor='#F5F5F5'><span class='style8'>Transaction </span></td>";
echo" </tr>";



echo" <tr height='15px'>";	  
echo"   <td width='5%'  align='left' bgcolor='#F5F5F5' ><span class='style8'>From</span></td>";
echo"   <td width='40%'  colspan='2' valign='middle' bgcolor='#F5F5F5' ><span class='style8'>";
echo"   <input name='fromledger' type='text' id='fromledger' size='10' value='".$fromledger."'    onkeydown='return kdClient(0,event,0);'  />
        <input name='fromledgername' type='text' id='fromledgername' size='30' value='".$fromledgername."'     onkeydown='return kdClient(1,event,0);' />
        <input name='btncode1' type='hidden' id='btncode1' value='...' onclick='cgr7()' style='width:20px; height:20px; border:thin;' title='Select Ledger From' />
      </span>
      <label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title=' Select Ledger From ' 
             onClick='showlistledger(1);'><img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> </span></label>      ";

echo"   <td width='30%' colspan='2' rowspan='3' valign='top' bgcolor='#F5F5F5'><div style='overflow:auto; height:80px; width:80px;' ><table border='0'><tr><td>";
		
		$i = 0;
		while($jvtype=mysql_fetch_row($resultjvtype)){
		   $i = $i + 1;
		   $type  = 'type'.$i;
		   $$type = $jvtype[0];
		   
		   echo"<span class='style8'><label>";
           echo"<input name='$type' type='checkbox' id='$type' value='".$$type."' /> $jvtype[0] </label></span>";
		}
		echo "<input type='hidden' name='i' value='$i'>";
		echo "</td></tr></table></div></td>";   

echo"   <td width='25%' rowspan='3' valign='top' bgcolor='#F5F5F5'><span class='style8'><label>";
		if ($transaction=="1")
           echo "<input name='transaction' type='radio' value='1' checked />";
		else	
		   echo "<input name='transaction' type='radio' value='1' />";
		echo "Credit Transaction</label></span>";
echo"   <br><span class='style8'><label>";
		if ($transaction=="2")
           echo "<input name='transaction' type='radio' value='2' checked />";
		else	
		   echo "<input name='transaction' type='radio' value='2' />";
		echo "Debit Transaction</label></span>";		
echo"   <br><span class='style8'><label>";
		if ($transaction=="3"  || $transaction=="")
           echo "<input name='transaction' type='radio' value='3' checked />";
		else	
		   echo "<input name='transaction' type='radio' value='3' />";
		echo "All Transactions </label></span>";

echo"   </td>";		

echo" </tr>";
   
echo" <tr height='15px'>";	  
echo"   <td width='5%'  align='left' bgcolor='#F5F5F5' ><span class='style8'>To</span></td>";
echo"   <td width='40%'  colspan='2' valign='middle' bgcolor='#F5F5F5' ><span class='style8'>";
echo"   <input name='toledger' type='text' id='toledger' size='10' value='".$toledger."'   onkeydown='return kdClient(0,event,1);' />
        <input name='toledgername' type='text' id='toledgername' size='30' value='".$toledgername."'     onkeydown='return kdClient(1,event,1);' />
        <input name='btncode2' type='hidden' id='btncode2' value='...' onclick='cgr8()' style='width:20px; height:20px; border:thin;' title='Select Ledger To' />
      </span>
      <label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title=' Select Ledger To ' 
             onClick='showlistledger(2); '><img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> </span></label>      ";


echo" </tr>"; 
echo" <tr height='15px'>";
echo"   <td width='5%'  align='left' bgcolor='#F5F5F5' ><span class='style8'>Salesman</span></td>";
echo"   <td width='40%'  colspan='2' valign='middle' bgcolor='#F5F5F5' ><span class='style8'>";
echo"   <input name='clientsalesman' type='text' id='clientsalesman' style='width:100px;' value='".$clientsalesman."'  onkeydown='return kdSalesman(0,event);'  />";
echo"   <input name='clientsalesmanname' type='text' id='clientsalesmanname' style='width:240px;' value='".$clientsalesmanname."' />";
echo" <label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title=' Select Ledger To ' 
             onClick='showlistsalesman(2); '><img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> </span></label>   ";
echo" </tr>";

echo" <tr height='30'>";
echo"   <td colspan='3' bgcolor='#F5F5F5'><span class='style8'><label>";
echo"      <input name='parentprj' id='parentprj' type='checkbox' value='1' />Filter Parent Shipment Ref/Costcenter</label></span></td>";
echo" </tr>";





echo" <tr><td colspan='3' bgcolor='#F5F5F5' valign='top'><table border='0' cellpading=1 cellspacing=0 width=100%>";
echo" <tr>";
echo"   <td width='20%' bgcolor='#F5F5F5'><span class='style8'>Shipment Ref</span></td>";
echo"   <td width='80%' bgcolor='#F5F5F5'>
			<input name='fromproject' type='text' id='fromproject' style='width:100px;' value='".$fromproject."'   onkeydown='return kdProject(0,event,0);' />
			<input name='fromprojectname' type='text' id='fromprojectname' style='width:240px;' value='".$fromprojectname."'   onkeydown='return kdProject(1,event,0);' />
			<label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title='Select Project' onClick='showlistProject(17); '>
			<img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> </span></label>
		</td>";
echo" </tr>";

echo" <tr>";
echo"   <td width='20%' bgcolor='#F5F5F5'><span class='style8'>CostCenter</span></td>";
echo"   <td width='80%' bgcolor='#F5F5F5'>	
			<input name='fromcostcent' type='text' id='fromcostcent' style='width:100px;' value='".$fromcostcent."' />
			<input name='fromcostcentname' type='text' id='fromcostcentname' style='width:240px;' value='".$fromcostcentname."' />
			<label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title='Select CostCenter' onClick='showlistCostcenter(17); '>
			<img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> </span></label>
		</td>";
echo" </tr>";
echo" </table></td>";

echo" <td colspan='3' bgcolor='#F5F5F5' valign='top'><table border='0' cellpading=1 cellspacing=0 width=100%>";
echo" <tr>";
echo"   <td width='25%' bgcolor='#F5F5F5'><span class='style8'>Client Project</span></td>";
echo"   <td width='75%' bgcolor='#F5F5F5'>
			<input name='clientproject' type='text' id='clientproject' style='width:100px;' value='".$clientproject."' />
			<input name='clientprojectname' type='text' id='clientprojectname' style='width:250px;' value='".$clientprojectname."' />
			<label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title='Select Client Project' onClick='showlistProject(18); '>
			<img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> </span></label>
		</td>";
echo" </tr>";
echo" <tr>";
echo"	<td width='25%' bgcolor='#F5F5F5'><span class='style8'>Client CostCent</span></td>";
echo"   <td width='75%' bgcolor='#F5F5F5'>
			<input name='clientcostcent' type='text' id='clientcostcent' style='width:100px;' value='".$clientcostcent."' />
			<input name='clientcostcentname' type='text' id='clientcostcentname' style='width:250px;' value='".$clientcostcentname."' />
			<label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title='Select Client CostCenter' onClick='showlistCostcenter(18); '>
			<img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> </span></label>
		</td>";
echo" </tr>";
echo" </table></td>";		
echo" </tr>";



		

/*
echo" 
    <tr>
      <td colspan='6' align='center' bgcolor='#F5F5F5'>
	  <input name='clearbtn' type='reset'  value='Clear' style=' background-color:#4069A7; color:#FFFFFF;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;' />
	  <input name='preview' type='button' id='Preview' value='Preview' style=' background-color:#4069A7; color:#FFFFFF;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;' onClick=\"printPrev('".$printaccess."')\"; />
	  <input name='exporttoexcel' type='".$ExporttoExcelStatus."' id='exporttoexcel' value='Export Excel'  style=' background-color:#4069A7; color:#FFFFFF;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;' onClick=\"Exportexcel()\"; />
	  
      </td>
    </tr>*/
	
			echo"   </table></td></tr>"; 
	echo"   </table></td></tr><tr height='30'><td align='center' id='content-bottom' ></td></tr>"; 
  echo"</table>
 
</form>
</body>
</html>";

?>