<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php 
include ("../navigation/header.php");

$page_name = "Stores-main";
include ("../navigation/access.php");

require_once ('../include/tc_calendar.php');
$return_date = strtotime($today);
$d = date("d", $return_date );
$m = date("m", $return_date );
$y = date("Y", $return_date );

if ($permission_num==1) {

$entry_reference = $_GET['entry_reference'];

$table_name = $_SESSION['db_prefix']."_pallets_balance";
$credit_query = "SELECT cust_id, ret_qty, ret_date FROM $table_name WHERE entry_reference = '".$entry_reference."'  ORDER BY pallets_balance_id DESC LIMIT 1";
$credit_result = mySQL_query($credit_query);
$cust_id = mysql_result($credit_result, 0, "cust_id");
$ret_qty = mysql_result($credit_result, 0, "ret_qty");
$ret_date = mysql_result($credit_result, 0, "ret_date");

$table_name = $_SESSION['db_prefix']."_customer";
$comp_query = "SELECT comp_name, postal_place  FROM $table_name WHERE cust_id = '".$cust_id."' ";
$comp_result = mySQL_query($comp_query);
$comp_name = mysql_result($comp_result, 0, "comp_name");
$postal_place = mysql_result($comp_result, 0, "postal_place");


include ("../navigation/store_sidebar.php");


?>
<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>  
       
</head>

<body>

<div class="main_frame">
<div class="page_head_frame">
    <label class="label_page_head">Pallets Return Credit note</label> 
    
</div>


<div class="page_middle_frame">


<div class="page_inside_frame">


<div style="float:left;">
<table width="600" id="table_display_wizard2">
  <tr>
    <td height="30">Returning pallets from:</td>
    <td><?php echo $comp_name.'&nbsp;&nbsp;--&nbsp;&nbsp;'.$postal_place ?><input name="cust_id_text" type="hidden" value="<?php echo $cust_id ?>"></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="33">Return date:</td>
    <td><?php echo date("d-m-Y", strtotime($ret_date ))?></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="33">No of pallets returned:</td>
    <td><?php echo $ret_qty ?></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="33">Entry reference:</td>
    <td><?php echo $entry_reference ?></td>
    <td>&nbsp;</td>
  </tr>
</table>

<br>
</div>

<div class="page_inside_frame">
<a href="return_pallets_display_print.php?entry_reference=<?php echo $entry_reference  ?>" target="_blank"><input name="print_button" type="button" class="imagebutton" value="Print return sheet"></a>
</div>

</div>
</div>
</div>




<?php include ('../navigation/side_bar.php'); ?>
</body>
<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "store/store_main.php?branch=$date=";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>

