<?php

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

$Title = 'Fixed Assets';
$HeaderTitle = ucfirst(strtolower($Title)).' Report';

print <<< HERE
<HTML>
<HEAD>
<TITLE> $HeaderTitle </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">

<style type="text/css">

table.master th { font-size: 14px; 
                  font-weight: bold;
                  font-family:Times-New-Roman;
                }				 
table.master td { font-size: 14px; 
                  font-family:Times-New-Roman;
                 }
table.detail th { font-size: 14px; 
                  font-weight: bold;
                  font-family:Times-New-Roman;
                }				 
				 
table.detail td { font-size: 12px; 
                  font-family:Times-New-Roman;
                 }

table.subdetail th { font-size: 12px; 
                     font-weight: bold;
                     font-family:Times-New-Roman;
                   }				 
				 
table.subdetail td { font-size: 11px; 
                     font-family:Times-New-Roman;
                   }				 
				 

</style>


</HEAD>

<BODY>
HERE;

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

//Read From Setup Table							
$querysetup= " select DecimalBase, DecimalBase1, DecimalBase2, base1, base2, grid_color1, grid_color2  from setup ";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
while($rowsetup=mysql_fetch_array($resultsetup)){
	extract($rowsetup);
}

//Read From Module Table
$querymodule=" Select ifNull(Module_PaymentRqst,0) As Module_PaymentRqst From Module ";
$resultmodule=mysql_query($querymodule,$connection) or die(mysql_error());
while($rowmodule=mysql_fetch_array($resultmodule)){
	extract($rowmodule);
}

	
$now=current_server_time($connection);
$dt=split(" ",$now[0]);
$printdate=split("-",$dt[0]);

$TotalQty = 0;


if($AssetsId != ''){

	$sub_query1 = " Select Assets_refgovernment, Assets_ref, date_format(Assets_date,'%d/%m/%Y') as Assets_date, Assets_name, assets.Project_Code as Project_Code
					,assets.Costcenter_code as Costcenter_code, Round(ifNull(Assets_amount,0), ".$DecimalBase1.") as Assets_amount, Round(ifNull(Assets_amount1,0), ".$DecimalBase1.")
					, Assets_amount2
					,ledger.Ledger_number as Ledger_number,ledger.ledger_name, date_format(Journal_valuedate,'%d/%m/%Y')
					, assets.Currency_code as Currency_code,  Assets_desc, journal.Journal_refgovernment as Journal_refgovernment
					, assets.Journal_id
					,journal.Journal_folio as Journal_folio
					, Assets_sysdate, Assets_time, Assets_user, Curdt_rate
					,Curdt_parity, Assets_Edit, Assets_BelongsToGroup, assets.Synchronized, assets.SendReceive_Reference, Assets_MaturityDate
					from assets inner join ledger on ledger.ledger_number = assets.ledger_number
					left join journal on journal.journal_id = assets.journal_id
					where Assets_id = '".$AssetsId."'";
			//echo $sub_query1;
	$sub_result1=mysql_query($sub_query1,$connection) or die(mysql_error());
	while($sub_rows1=mysql_fetch_array($sub_result1)){
		extract($sub_rows1);
	}
	
	
		
	echo "<table border=0 width=100% cellspacing=0 cellpadding=0><tr><td align='left'>";
	echo "<table border=0 width='630' cellspacing=2 cellpadding=0 class='master' style='table-layout:fixed;' >
		  <col width=70>
		  <col width=60>
		  <col width=60>
		  <col width=100>
		  <col width=60>
		  <col width=100>
		  <col width=60>
		  <col width=120>";
	echo "<tr><td height='60' colspan='3'><img src='LogoFile.php' width='115' height='50' /></td><td align='center' colspan='3'><b><font size=4>$Title </font></td><td align='right' colspan=2 ><font size='2'><b>Printed&nbsp;Date&nbsp;&amp;&nbsp;Time:</b>&nbsp;&nbsp;";
	echo $printdate[2]."/".$printdate[1]."/".$printdate[0];
	echo "<br>".$dt[1]." ".$dt[2];
	echo "</font></td></tr>";
	
	echo "<tr height='10'><td colspan='8'><hr></td></tr>";
	
	echo "<tr>";
	echo "  <th align='left' >Reference</th>";
	echo "  <td align='left' >$Assets_refgovernment</td>";
	echo "  <th align='left' >JV Ref.</th>";
	echo "  <td align='left' >$Journal_refgovernment</td>";
	echo "  <th align='left' >Folio</th>";
	echo "  <td align='left' >$Journal_folio</td>";
	echo "  <th align='right' style='padding-right:10px;'>Date</th>";
	echo "  <td align='left' >$Assets_date</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	
	echo "  <th align='left' valign='top' colspan='1'>Amount</th>";
	echo "  <th align='left' valign='top' colspan='1'>$Currency_code $Assets_amount</th>";
	echo "</tr>";
	
	echo "<tr height=25px><td></td></tr>";
	echo "<tr>";
	echo "  <th align='left' valign='top' colspan='2'>Representative</th>";
	
	
		echo "  <td align='left' colspan='3'>$Assets_name</td>";
		echo "  <th align='right' valign='top' colspan='2' style='padding-right:10px;'></th>";
		echo "  <td align='left' valign='top'>$Ledger_number</td>";
	
	echo "</tr>";
		
		$queryalpha  = " SELECT Alpha_Num ('ENGLISH', '".$Currency_code."', ".$Assets_amount.") As AlphaAmount FROM Dual ";
		$resultalpha = mysql_query($queryalpha,$connection) or die(mysql_error());
		$rowalpha=mysql_fetch_array($resultalpha);
		
	echo "<tr>";
	echo "  <th align='left' valign='top' colspan='2'>The Sum of</th>";
	echo "  <td align='left' colspan='6'>$rowalpha[0]</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "   <th align='left'>Project</th>";
	echo "  <td align='left' colspan='2'>$Project_Code</td>";
	echo "	 <th align='left'>Cost Center</th>";
	echo "  <td align='left' colspan='2'>$Costcenter_code</td>";
	echo "</tr>";
	
	echo "<tr height='10'><td colspan='8'><hr></td></tr>";
	echo "</table></td></tr>";

	
			  
	$sub_query2="select assetsdt_id, assets_id, assetsdt.Ledger_number as Ledger_Number,ledger.ledger_name  as Ledger_Name
		, assetsdt.Currency_code as Currency_Code , assetsdt_description , Round(assetsdt_amount,".$DecimalBase.") As assetsdt_amount
		,Round(assetsdt_amount1,".$DecimalBase.") As assetsdt_amount1,Round(assetsdt_amount2,".$DecimalBase.") As assetsdt_amount2
		, date_format(assetsdt_ValueDate,'%d/%m/%Y') as assetsdt_ValueDate,assetsDt_IsVat
		from assetsdt inner join ledger on ledger.ledger_number = assetsdt.ledger_number 
		where assets_id = '$AssetsId'  order by assetsdt.Ledger_number";
		
		
	//echo $sub_query2;
			
	echo "<tr><td align='left'>";
	echo "<table border=0 width='630' cellspacing=2 class='detail' style='table-layout:fixed;' >
		  <col width=90>
		  <col width=150>
		  <col width=60>
		  <col width=100>
		  <col width=80>
		  <col width=80>
		  <col width=80>
		  ";
	echo "<tr bgcolor=#D8D8D8>";
	echo "   <th align='left'>Ledger No.</th>";
	echo "   <th align='left'>Name/Description</th>";
	echo "	 <th align='center'>Cur.</th>";
	echo "	 <th align='center'>Amount</th>";
	echo "	 <th align='center'>$base1</th>";
	echo "	 <th align='center'>$base2</th>";
	echo "	 <th align='center'>Value Date</th>";
	echo "</tr>";			
		  
	
	$sub_result2=mysql_query($sub_query2,$connection) or die(mysql_error());
	while($sub_rows2=mysql_fetch_array($sub_result2)){
		extract($sub_rows2);
		
		echo "<tr>";
		echo "  <td align='left' valign='top'>$Ledger_Number</td>";
		echo "  <td align='left' valign='top'>$Ledger_Name</td>";
		echo "  <td align='center' valign='top'>$Currency_Code</td>";
		echo "	<td align='center' valign='top'>".number_format($assetsdt_amount, $DecimalBase)."</td>";
		echo "	<td align='center' valign='top'>".number_format($assetsdt_amount1, $DecimalBase)."</td>";
		echo "	<td align='center' valign='top'>".number_format($assetsdt_amount2, $DecimalBase)."</td>";
		echo "	<td align='center' valign='top'>$assetsdt_ValueDate</td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "  <td align='left' valign='top'>&nbsp;</td>";
		echo "  <td align='left' valign='top' colspan='4'>$TransDt_Description</td>";
		echo "</tr>";
		
		
		// Display Checks
		$sub_query4="select itemjour_location,itemjour_barcode,ItemJour_Code,ItemJour_Description,ItemJour_prcnt
				,itemjour.Project_Code as Project_Code,project.project_name,itemjour.Costcent_code as Costcent_code,costcent.costcent_name as costcent_name
				,ItemJour_amount,ItemJour_amount1,ItemJour_amount2,itemjour.Ledger_Number as Ledger_Number,Ledger_NumberDebit
				,ledger.ledger_name as Ledger_NameDebit,Ledger_NumberCredit,ledgercredit.ledger_name as Ledger_NameCredit
				,Project_CodeCredit,projectcredit.project_name as  Project_NameCredit
				,CostCent_CodeCredit,costcentcredit.costcent_name as CostCent_NameCredit
				,ItemJour_Remark,date_format(ItemJour_PreviousDate,'%d-%m-%Y') as ItemJour_PreviousDate,autoincrement,assetsdt.Currency_Code as Currency_Code
				 from itemjour left join project on project.project_code=itemjour.project_code
               left join project as projectcredit on projectcredit.project_code=itemjour.Project_CodeCredit
               left join costcent on costcent.costcent_code=itemjour.costcent_code
               left join costcent as costcentcredit on costcentcredit.costcent_code=itemjour.costcent_code
               left join ledger on ledger.ledger_number=itemjour.Ledger_NumberDebit
               left join ledger as ledgercredit on ledgercredit.ledger_number=itemjour.Ledger_NumberCredit
               left join assetsdt as assetsdt on assetsdt.assetsdt_id=itemjour.assetsdt_id
			   where itemjour.assetsdt_id = '$assetsdt_id'  order by itemjour.Ledger_Number";
			   
		$sub_result4=mysql_query($sub_query4,$connection) or die(mysql_error());			  
		$ChkItemJour = mysql_num_rows($sub_result4);
		
		if ($ChkItemJour > 0) {			  
			echo "<tr><td colspan='5'>";	
			echo "<table border=0 width='630' cellspacing=1 class='subdetail' style='table-layout:fixed;' >
				  <col width=60>
				  <col width=80>
				  <col width=180>
				  <col width=70>
				  <col width=55>
				  <col width=80>
				  <col width=50>
				  <col width=50>";
			echo "<tr>";
			echo "   <th align='left'>&nbsp;</th>";
			echo "   <th align='left'>Item Code</th>";
			echo "	 <th align='left'>Description</th>";
			echo "	 <th align='center'>Percentage</th>";
			echo "	 <th align='center'>Currency</th>";
			echo "	 <th align='center'>Amount</th>";
			echo "   <th align='left'>Project</th>";
			echo "   <th align='left'>Costcenter</th>";
			echo "</tr>";	
			
			$sub_result4=mysql_query($sub_query4,$connection) or die(mysql_error());
			while($sub_rows4=mysql_fetch_array($sub_result4)){
				extract($sub_rows4);
				
				echo "<tr>";
				echo "  <td align='left' valign='top'>&nbsp;</td>";
				echo "  <td align='left' valign='top'>$ItemJour_Code</td>";
				echo "  <td align='left' valign='top'>$itemjour_barcode</td>";
				echo "	<td align='center' valign='top'>$ItemJour_prcnt</td>";
				echo "	<td align='center' valign='top'>$Currency_Code</td>";
				echo "	<td align='center' valign='top'>".number_format($ItemJour_amount, $DecimalBase)."</td>";
				echo "	<td align='center' valign='top'>$Project_Code</td>";
				echo "	<td align='center' valign='top'>$Costcent_code</td>";
				echo "</tr>";
				
			}	
			
			echo"</table></td></tr>";
		}
		
	}

}
else {

	$sub_query1 = " Select Assets_refgovernment, Assets_ref, date_format(Assets_date,'%d/%m/%Y') as Assets_date, Assets_name, assets.Project_Code as Project_Code
					,assets.Costcenter_code as Costcenter_code, Round(ifNull(Assets_amount,0), ".$DecimalBase1.") as Assets_amount, Round(ifNull(Assets_amount1,0), ".$DecimalBase1.")
					, Assets_amount2
					,ledger.Ledger_number as Ledger_number,ledger.ledger_name, date_format(Journal_valuedate,'%d/%m/%Y')
					, assets.Currency_code as Currency_code,  Assets_desc, journal.Journal_refgovernment as Journal_refgovernment
					, assets.Journal_id
					,journal.Journal_folio as Journal_folio
					, Assets_sysdate, Assets_time, Assets_user, Curdt_rate
					,Curdt_parity, Assets_Edit, Assets_BelongsToGroup, assets.Synchronized, assets.SendReceive_Reference, Assets_MaturityDate
					from assets inner join ledger on ledger.ledger_number = assets.ledger_number
					left join journal on journal.journal_id = assets.journal_id";
			//echo $sub_query1;
	$sub_result1=mysql_query($sub_query1,$connection) or die(mysql_error());
	while($sub_rows1=mysql_fetch_array($sub_result1)){
		extract($sub_rows1);
	}
	
	
		
	echo "<table border=0 width=100% cellspacing=0 cellpadding=0><tr><td align='left'>";
	echo "<table border=0 width='630' cellspacing=2 cellpadding=0 class='master' style='table-layout:fixed;' >
		  <col width=70>
		  <col width=60>
		  <col width=60>
		  <col width=100>
		  <col width=60>
		  <col width=100>
		  <col width=60>
		  <col width=120>";
	echo "<tr><td height='60' colspan='3'><img src='LogoFile.php' width='115' height='50' /></td><td align='center' colspan='3'><b><font size=4>$Title </font></td><td align='right' colspan=2 ><font size='2'><b>Printed&nbsp;Date&nbsp;&amp;&nbsp;Time:</b>&nbsp;&nbsp;";
	echo $printdate[2]."/".$printdate[1]."/".$printdate[0];
	echo "<br>".$dt[1]." ".$dt[2];
	echo "</font></td></tr>";
	
	echo "<tr height='10'><td colspan='8'><hr></td></tr>";
	
	echo "<tr>";
	echo "  <th align='left' >Reference</th>";
	echo "  <td align='left' >$Assets_refgovernment</td>";
	echo "  <th align='left' >JV Ref.</th>";
	echo "  <td align='left' >$Journal_refgovernment</td>";
	echo "  <th align='left' >Folio</th>";
	echo "  <td align='left' >$Journal_folio</td>";
	echo "  <th align='right' style='padding-right:10px;'>Date</th>";
	echo "  <td align='left' >$Assets_date</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	echo "  <th align='left' valign='top' colspan='1'></th>";
	
	echo "  <th align='left' valign='top' colspan='1'>Amount</th>";
	echo "  <th align='left' valign='top' colspan='1'>$Currency_code $Assets_amount</th>";
	echo "</tr>";
	
	echo "<tr height=25px><td></td></tr>";
	echo "<tr>";
	echo "  <th align='left' valign='top' colspan='2'>Representative</th>";
	
	
		echo "  <td align='left' colspan='3'>$Assets_name</td>";
		echo "  <th align='right' valign='top' colspan='2' style='padding-right:10px;'></th>";
		echo "  <td align='left' valign='top'>$Ledger_number</td>";
	
	echo "</tr>";
		
		$queryalpha  = " SELECT Alpha_Num ('ENGLISH', '".$Currency_code."', ".$Assets_amount.") As AlphaAmount FROM Dual ";
		$resultalpha = mysql_query($queryalpha,$connection) or die(mysql_error());
		$rowalpha=mysql_fetch_array($resultalpha);
		
	echo "<tr>";
	echo "  <th align='left' valign='top' colspan='2'>The Sum of</th>";
	echo "  <td align='left' colspan='6'>$rowalpha[0]</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "   <th align='left'>Project</th>";
	echo "  <td align='left' colspan='2'>$Project_Code</td>";
	echo "	 <th align='left'>Cost Center</th>";
	echo "  <td align='left' colspan='2'>$Costcenter_code</td>";
	echo "</tr>";
	
	echo "<tr height='10'><td colspan='8'><hr></td></tr>";
	echo "</table></td></tr>";

	
			  
	$sub_query2="select assetsdt_id, assets_id, assetsdt.Ledger_number as Ledger_Number,ledger.ledger_name  as Ledger_Name
		, assetsdt.Currency_code as Currency_Code , assetsdt_description , Round(assetsdt_amount,".$DecimalBase.") As assetsdt_amount
		,Round(assetsdt_amount1,".$DecimalBase.") As assetsdt_amount1,Round(assetsdt_amount2,".$DecimalBase.") As assetsdt_amount2
		, date_format(assetsdt_ValueDate,'%d/%m/%Y') as assetsdt_ValueDate,assetsDt_IsVat
		from assetsdt inner join ledger on ledger.ledger_number = assetsdt.ledger_number  order by assetsdt.Ledger_number";
		
		
	//echo $sub_query2;
			
	echo "<tr><td align='left'>";
	echo "<table border=0 width='630' cellspacing=2 class='detail' style='table-layout:fixed;' >
		  <col width=90>
		  <col width=150>
		  <col width=60>
		  <col width=100>
		  <col width=80>
		  <col width=80>
		  <col width=80>
		  ";
	echo "<tr bgcolor=#D8D8D8>";
	echo "   <th align='left'>Ledger No.</th>";
	echo "   <th align='left'>Name/Description</th>";
	echo "	 <th align='center'>Cur.</th>";
	echo "	 <th align='center'>Amount</th>";
	echo "	 <th align='center'>$base1</th>";
	echo "	 <th align='center'>$base2</th>";
	echo "	 <th align='center'>Value Date</th>";
	echo "</tr>";			
		  
	
	$sub_result2=mysql_query($sub_query2,$connection) or die(mysql_error());
	while($sub_rows2=mysql_fetch_array($sub_result2)){
		extract($sub_rows2);
		
		echo "<tr>";
		echo "  <td align='left' valign='top'>$Ledger_Number</td>";
		echo "  <td align='left' valign='top'>$Ledger_Name</td>";
		echo "  <td align='center' valign='top'>$Currency_Code</td>";
		echo "	<td align='center' valign='top'>".number_format($assetsdt_amount, $DecimalBase)."</td>";
		echo "	<td align='center' valign='top'>".number_format($assetsdt_amount1, $DecimalBase)."</td>";
		echo "	<td align='center' valign='top'>".number_format($assetsdt_amount2, $DecimalBase)."</td>";
		echo "	<td align='center' valign='top'>$assetsdt_ValueDate</td>";
		echo "</tr>";
		
		echo "<tr>";
		echo "  <td align='left' valign='top'>&nbsp;</td>";
		echo "  <td align='left' valign='top' colspan='4'>$TransDt_Description</td>";
		echo "</tr>";
		
		
		// Display Checks
		$sub_query4="select itemjour_location,itemjour_barcode,ItemJour_Code,ItemJour_Description,ItemJour_prcnt
				,itemjour.Project_Code as Project_Code,project.project_name,itemjour.Costcent_code as Costcent_code,costcent.costcent_name as costcent_name
				,ItemJour_amount,ItemJour_amount1,ItemJour_amount2,itemjour.Ledger_Number as Ledger_Number,Ledger_NumberDebit
				,ledger.ledger_name as Ledger_NameDebit,Ledger_NumberCredit,ledgercredit.ledger_name as Ledger_NameCredit
				,Project_CodeCredit,projectcredit.project_name as  Project_NameCredit
				,CostCent_CodeCredit,costcentcredit.costcent_name as CostCent_NameCredit
				,ItemJour_Remark,date_format(ItemJour_PreviousDate,'%d-%m-%Y') as ItemJour_PreviousDate,autoincrement,assetsdt.Currency_Code as Currency_Code
				 from itemjour left join project on project.project_code=itemjour.project_code
               left join project as projectcredit on projectcredit.project_code=itemjour.Project_CodeCredit
               left join costcent on costcent.costcent_code=itemjour.costcent_code
               left join costcent as costcentcredit on costcentcredit.costcent_code=itemjour.costcent_code
               left join ledger on ledger.ledger_number=itemjour.Ledger_NumberDebit
               left join ledger as ledgercredit on ledgercredit.ledger_number=itemjour.Ledger_NumberCredit
               left join assetsdt as assetsdt on assetsdt.assetsdt_id=itemjour.assetsdt_id
			   where itemjour.assetsdt_id = '$assetsdt_id'  order by itemjour.Ledger_Number";
			   //echo $sub_query4;
		$sub_result4=mysql_query($sub_query4,$connection) or die(mysql_error());			  
		$ChkItemJour = mysql_num_rows($sub_result4);
		
		if ($ChkItemJour > 0) {			  
			echo "<tr><td colspan='5'>";	
			echo "<table border=0 width='630' cellspacing=1 class='subdetail' style='table-layout:fixed;' >
				  <col width=60>
				  <col width=80>
				  <col width=180>
				  <col width=70>
				  <col width=55>
				  <col width=80>
				  <col width=50>
				  <col width=50>";
			echo "<tr>";
			echo "   <th align='left'>&nbsp;</th>";
			echo "   <th align='left'>Item Code</th>";
			echo "	 <th align='left'>Description</th>";
			echo "	 <th align='center'>Percentage</th>";
			echo "	 <th align='center'>Currency</th>";
			echo "	 <th align='center'>Amount</th>";
			echo "   <th align='left'>Project</th>";
			echo "   <th align='left'>Costcenter</th>";
			echo "</tr>";	
			
			$sub_result4=mysql_query($sub_query4,$connection) or die(mysql_error());
			while($sub_rows4=mysql_fetch_array($sub_result4)){
				extract($sub_rows4);
				
				echo "<tr>";
				echo "  <td align='left' valign='top'>&nbsp;</td>";
				echo "  <td align='left' valign='top'>$ItemJour_Code</td>";
				echo "  <td align='left' valign='top'>$itemjour_barcode</td>";
				echo "	<td align='center' valign='top'>$ItemJour_prcnt</td>";
				echo "	<td align='center' valign='top'>$Currency_Code</td>";
				echo "	<td align='center' valign='top'>".number_format($ItemJour_amount, $DecimalBase)."</td>";
				echo "	<td align='center' valign='top'>$Project_Code</td>";
				echo "	<td align='center' valign='top'>$Costcent_code</td>";
				echo "</tr>";
				
			}	
			
			echo"</table></td></tr>";
		}
		
	}	
	
	
	
	
	
	
}





function current_server_time($connection){

  $string="Select date_format(NOW(),'%Y-%m-%d %h:%i %p') ";
  $result=mysql_query($string,$connection) or die(mysql_error());
  $now=mysql_fetch_row($result);

  return $now;
}

function format_currency($amount, $DecimalBase) { 

    if($amount < 0) 
        return "(".number_format(abs($amount),$DecimalBase).")"; 
 
    else return number_format($amount, $DecimalBase); 
} 

print <<< HERE

<script language=javascript>
if (typeof(window.print) != 'undefined')
{
    window.print();
}
</script>
</BODY>
</HTML>
HERE;
?>

