<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?php
header("Content-type: text/html; charset=windows-1256");
session_start();
if($_SESSION['dbName']==""){
header("location:../index.php");
}


print <<< HERE
<HTML>
<HEAD>
<TITLE> Receipt Voucher </TITLE>

   
</style>




</HEAD>

HERE;



include("config.inc.php");
include 'function.inc.php';

//Set Time Execution For the Report
ini_set('max_execution_time', $config['ReportTimeExecution']);

$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 print as printaccess 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 ($printaccess==0 or $printaccess=='')
echo'<BODY oncontextmenu="return false;">';
else
echo'<BODY>';


$querysetup="select COMPANY_NAME, Company_memo, COMPANY_TELEPHONE, company_email, COMPANY_LOGO, DecimalBase, DecimalBase1, DecimalBase2, Base1, Base2 from setup";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultsetup)){
  extract($rows);
}

$query = "select Trans_Reference, date_format(Trans_Date, '%d/%m/%Y') from trans where trans_id = $TransId and trans_type='$TransType' ";
$result = mysql_query($query, $connection);
$row = mysql_fetch_row($result);
$ref 		= $row[0];
$transDate  = $row[1];

echo "<table cellpadding=0 cellspacing=0 border=0 width=100%><col width=30%><col width=60%><col width=30%>";
echo "<tr>
		<td colspan='2'><span style='font-size: 20px;font-weight: bold;'>$COMPANY_NAME</span><br><span style='font-size: 19px;font-weight: bold;'>".nl2br($Company_memo)."</span></td>
		<td align='center'><img src='LogoFile.php' width=120px></td>
	 </tr>";
echo "<tr><td colspan='3' align='center'><span style='font-size: 18px;font-weight: bold;'>Receipt Voucher - $ref</span></td></tr>";
echo "<tr><td colspan='2'></td><td align='center'><span style='font-size: 18px;font-weight: bold;'>Date: $transDate</span></td></tr>";
echo "</table>";

echo "<table cellpadding=0 cellspacing=0 border=0 width=100%><col width=30%><col width=60%><col width=30%>";

echo "</table>";
if ($printaccess==1)
print <<< HERE

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

?>