<?php


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

include("config.inc.php");

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

$query="select ifnull(ShowReportHeader,0) as ShowReportHeader from ".$HTTP_SESSION_VARS['dbLabel'].".loginstk where user_account='".$HTTP_SESSION_VARS['useraccount']."' ";
$result=mysql_query($query,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($result)){
	extract($rows);
}
if($ShowReportHeader=='')
	$ShowReportHeader=1;

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


if ($loginaccess=='' or $loginaccess==0)
	header("location:menu.php");
/*	
if ($ExporttoExcel==1)
	$ExporttoExcelStatus= 'button';
else
	$ExporttoExcelStatus= 'hidden';		*/


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_Delivery,0) As Module_Delivery, ifNull(Module_Grn,0) As Module_Grn, ifNull(Module_DoubleUnit,0) As Module_DoubleUnit, ".
			 " ifNull(Module_SerialNo,0) As Module_SerialNo, 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);
}


$querylog=" select ifNull(FI_RepRestrictProject,0) As FI_RepRestrictProject, ifNull(FI_RepRestrictCostcenter,0) As FI_RepRestrictCostcenter, ".
		  " ifNull(FI_RepRestrictWarehouse,0) As FI_RepRestrictWarehouse, ifNull(FI_ShowCostPrice,0) As FI_ShowCostPrice ".
          " from ".$HTTP_SESSION_VARS['dbLabel'].".login where user_account='".$HTTP_SESSION_VARS['useraccount']."' and Upper(Login_Schema) = Upper('".$HTTP_SESSION_VARS['dbName']."') ";
$resultlog=mysql_query($querylog) or die(mysql_error());
while($rows=mysql_fetch_array($resultlog)){
	extract($rows);
}

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

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

//Costcenter List
$querycostcent=" select distinct costcent.costcent_code, costcent_name ".
               " from costcent left join ".$HTTP_SESSION_VARS['dbLabel'].".loginstk on costcent.costcent_code like concat(ifnull(loginstk.costcent_code,costcent.costcent_code),'%') ".
			   " where user_account='".$HTTP_SESSION_VARS['useraccount']."' ".
			   " and (loginstk.costcent_code is not null and loginstk.costcent_code != '') ".
			   " order by costcent.costcent_code";
$costcentresult = mysql_query($querycostcent,$connection) or die(mysql_error());
$costcentexist  = mysql_num_rows($costcentresult);		  
if ($costcentexist == 0 || $FI_RepRestrictCostcenter == 0)
    $querycostcent=" select distinct costcent_code, costcent_name from costcent order by costcent_code ";			  
	
$resultfromcostcent= mysql_query($querycostcent,$connection) or die(mysql_error());
$costcentrows      = mysql_num_rows($resultfromcostcent);
$resulttocostcent  = mysql_query($querycostcent,$connection) or die(mysql_error());


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

//Warehouse List
$querywarehouse=" select distinct warehouse.warehouse_code, warehouse_name ".
				" from warehouse where warehouse_code in (select warehouse_code from ".$HTTP_SESSION_VARS['dbLabel'].".loginstk ".
				"                                         where user_account='".$HTTP_SESSION_VARS['useraccount']."' ".
				"                                         and (loginstk.warehouse_code is not null and loginstk.warehouse_code != '') ) ".
				" order by warehouse.warehouse_code";
$resultwh = mysql_query($querywarehouse,$connection) or die(mysql_error());
$whexist   = mysql_num_rows($resultwh);
if ($whexist == 0 || $FI_RepRestrictWarehouse == 0)
	$querywarehouse="select warehouse_code,warehouse_name from warehouse order by warehouse_code";
	
$resultfromwarehouse=mysql_query($querywarehouse,$connection) or die(mysql_error());
$resulttowarehouse=mysql_query($querywarehouse,$connection) or die(mysql_error());
$resultfromtranswh=mysql_query($querywarehouse,$connection) or die(mysql_error());
$resulttotranswh=mysql_query($querywarehouse,$connection) or die(mysql_error());

//Item Groups List
$querygroup=" select distinct group_code,group_name ".
			" from grouping where group_code in (select group_code from ".$HTTP_SESSION_VARS['dbLabel'].".loginstk where user_account='".$HTTP_SESSION_VARS['useraccount']."') ".
			" order by group_code";
$resultgroup = mysql_query($querygroup,$connection) or die(mysql_error());
$groupexist   = mysql_num_rows($resultgroup);
if ($groupexist == 0)
	$querygroup="select distinct group_code,group_name from grouping order by group_code";
$resultfromgroup=mysql_query($querygroup,$connection) or die(mysql_error());
$resulttogroup=mysql_query($querygroup,$connection) or die(mysql_error());


//Item SubGroups List
$querysubgroup= " select distinct subgroup_code, subgroup_name ".
				" from subgroup where subgroup_code in (select subgroup_code from ".$HTTP_SESSION_VARS['dbLabel'].".loginstk where user_account='".$HTTP_SESSION_VARS['useraccount']."') ".
				" order by subgroup_code";
$resultsubgroup = mysql_query($querysubgroup,$connection) or die(mysql_error());
$subgroupexist   = mysql_num_rows($resultsubgroup);
if ($subgroupexist == 0)
	$querysubgroup="select distinct subgroup_code,subgroup_name from subgroup order by subgroup_code";
$resultfromsubgroup=mysql_query($querysubgroup,$connection) or die(mysql_error());
$resulttosubgroup=mysql_query($querysubgroup,$connection) or die(mysql_error());

//Item Category List
$querycategory= " select distinct category_code, category_name ".
				" from category  ".
				" order by category_code";
$resultfromcategory=mysql_query($querycategory,$connection) or die(mysql_error());
$resulttocategory=mysql_query($querycategory,$connection) or die(mysql_error());



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

if ((!isset($fromproject)) && $Module_Project == 1 && $FI_RepRestrictProject == 1 && $Module_RestrictProjectReport==1)
	$fromproject = $defaultproject;
if ((!isset($toproject)) && $Module_Project == 1 && $FI_RepRestrictProject == 1 && $Module_RestrictProjectReport==1)
	$toproject = $defaultproject;
if ((!isset($fromcostcent)) && $Module_CostCenter == 1 && $FI_RepRestrictCostcenter == 1)	
	$fromcostcent = $defaultcostcent;	
if ((!isset($tocostcent)) && $Module_CostCenter == 1 && $FI_RepRestrictCostcenter == 1)	
	$tocostcent = $defaultcostcent;	

if (empty($fromdate)) $fromdate = displayToday();
if (empty($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">

<!--

</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Inventory</title>
<style type="text/css">
<!--

thead th:last-child ,thead tr:last-child ,thead td:last-child {
    border-right: none;
	width:100%
}
body,td,th,tr,thead {
	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>";

//Header Title Panel
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'>Bank Reconcila</span></td>
				<td class='message' valign='middle' style='height:26px;'>".htmlspecialchars($message, ENT_QUOTES)."</td>
			</tr></table>
		</td>
	  </tr>";

//Buttons 
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='clearbtn' name='clearbtn'  title='Clear Page'><span><span>Clear</span></span></button>";	
						echo"<button type='button' id='Save' name='Save'  onClick=\"PrintPrev('".$Search."')\"; title='Preview'><span><span>Save</span></span></button>";
						echo"<button type='button' id='Search' name='Search'  onClick=\"PrintPrev('".$Search."')\"; title='Preview'><span><span>Search</span></span></button>";
			   echo"</td>";
		   echo"</tr>";
	   echo"</table>";
   echo"</td>";
echo"</tr>";				

//Panel Body		
echo"<tr><td id='content-body'>
		<table border='0'  align='center' valign='top' width=99% class='tablecontent'>
			<tr bgcolor='#F7F7F7'><td valign='top' align='left' colspan='10'>";						
		echo '  <table height="75" border="0" align="center" width="100%">'; 
		
	
	//ledger
	echo"   <td width='10%' height='19' colspan='2' align='left' bgcolor='#F5F5F5'><span class='style8'>Ledger</span></td> ";
	echo"   <td width='5%'  valign='middle' bgcolor='#F5F5F5' ><span class='style8'>From:</span></td>";
	echo"   <td width='35%'  valign='middle' bgcolor='#F5F5F5' ><span class='style8'>";
	echo"  	<label>
			<input name='fromitemdesc' type='text' id='fromitemdesc' size='35' value='".$fromitemdesc."' />
			<input name='btncode1' type='hidden' id='btncode1' value='...'  style='width:20px; height:20px; border:thin;' title='Select Item From' />
			</label>
			</span>
			<label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title=' Select Item From ' 
            onClick='showlistitem(1); '><img src='img/btnopen.jpg' width='15' height='20' border='0' /></a>
			</span></label>";
			

	echo"   <td width='5%' valign='top' bgcolor='#F5F5F5'><span class='style8'>To:</span></td>";
	echo"   <td width='35%' valign='top' bgcolor='#F5F5F5'><span class='style8'>";
	echo"   <label>
			<input name='toitemdesc' type='text' id='toitemdesc' size='35' value='".$toitemdesc."' />
			<input name='btncode2' type='hidden' id='btncode2' value='...'  style='width:20px; height:20px; border:thin;' title='Select Item To' />
			</label>
			</span>
			<label><span class='style11'><a href='javascript:void(0);' NAME='My Window Name' title=' Select Item To ' 
			onClick='showlistitem(2); '><img src='img/btnopen.jpg' width='15' height='20' border='0' /></a> 
			</span></label>";
	echo"   </tr>";

	
	//Date
	echo"   <td width='10%' height='19' colspan='2' align='left' bgcolor='#F5F5F5'><span class='style8'>Date</span></td> ";
	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' value='$fromdate' maxlength='10' size='10'>";
	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='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' value='$todate'  maxlength='10' size='10'>";
	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"   <td width='18%' rowspan='2' valign='top' bgcolor='#F5F5F5'><span class='style8'><label>";
	echo"   <td width='12%' rowspan='2' valign='top' bgcolor='#F5F5F5'><span class='style8'>&nbsp;</span>";	

echo"   </tr>";
echo"   </table>";


//Pannel 2 Result
echo '<table class="scroll" border=1 width=100%>';
echo "<thead width=75%>
			<trwidth=75%>
				<th>Ledger Name</th>
				<th>Date</th>
				<th>Checkbox</th>
			</tr>
		</thead>

			<tr width=75%>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr>
			<tr width=75%;>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr>
			<tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr>
			<tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr><tr>
				<td>Content 1</td>
				<td>Content 2</td>
				<td><input type='checkbox' name='check_ledger'></td>
			</tr>
	</table>";

echo" </table>
	 
	</form>
</body>
</html>";




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




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

include("config.inc.php");

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




$querylog="SELECT RA_StatementofAccount as loginaccess , ExporttoExcel from ".$_SESSION['dbLabel'].".login where user_account='".$_SESSION['useraccount']."' 	and Upper(Login_Schema) = Upper('".$HTTP_SESSION_VARS['dbName']."')	";
	$resultlog=mysql_query($querylog,$connection) or die(mysql_error());
	while($rows=mysql_fetch_array($resultlog)){
		extract($rows);
	}
	
if ($loginaccess=='' or $loginaccess==0)
	header("location:menu.php");
	
if ($ExporttoExcel==1)
	$ExporttoExcelStatus = 'button';
else
	$ExporttoExcelStatus = 'hidden';


	
$querylog="select * from ".$HTTP_SESSION_VARS['dbLabel'].".login where user_account='".$HTTP_SESSION_VARS['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 ".$HTTP_SESSION_VARS['dbLabel'].".login where user_account='".$HTTP_SESSION_VARS['useraccount']."' and Upper(Login_Schema) = Upper('".$HTTP_SESSION_VARS['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 ".$HTTP_SESSION_VARS['dbLabel'].".loginstk where user_account='".$HTTP_SESSION_VARS['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 ".$HTTP_SESSION_VARS['dbLabel'].".loginstk where user_account='".$HTTP_SESSION_VARS['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 ".$HTTP_SESSION_VARS['dbLabel'].".loginstk where user_account='".$HTTP_SESSION_VARS['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;	
	
	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;
	
	
  
	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');
  
  
    
	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+'&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;
  
	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 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;	
	
	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;	
	
	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;
	
	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');
  
	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+'&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+'&varprtbreak='+varprtbreak;
   
	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
        selectpage = 'select_document.php?item='+str;	  
    }
  }

  
  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;	  
	
	}
		
	

}
-->
</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>";

//Header Title Panel
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'>Bank Ledger</span></td>
				<td class='message' valign='middle' style='height:26px;'>".htmlspecialchars($message, ENT_QUOTES)."</td>
			</tr></table>
		</td>
	  </tr>";

//Buttons
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='btnsave' name='btnsave'  onClick=\"printPrev('".$printaccess."')\"; title='Save'><span><span>Save</span></span></button>";
	echo"<button type='button' id='btnsearch' name='btnsearch'  onClick=\"printPrev('".$printaccess."')\"; title='btnsearch'><span><span>Search</span></span></button>";
echo"	</td></tr></table>";
echo"</td></tr>";				


//body panel1	
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%">';

//space table
echo" <tr>";	  
echo"   <td width='20%' height='19' colspan='2' align='left' bgcolor='#F5F5F5'><span class='style8'>";
echo" </tr>";

//from date
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='10'>";
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='25%' rowspan='2' bgcolor='#F5F5F5'><span class='style8'><label>";
echo "</tr>";

//to date
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='10'>";
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>";


//Ledger Header Tittle
echo" <tr height='20px'>";
echo"   <td colspan='3' bgcolor='#F5F5F5'><span class='style8'>Ledger No. / Name ";
echo" </tr>";


//from ledger
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='35' 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='25%' rowspan='3' valign='top' bgcolor='#F5F5F5'><span class='style8'><label></td>";		
echo" </tr>";


//to ledger
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='35' 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></td>";
echo" </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>";

?>