<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<?php
include('../include/session.php');

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


?>
<script language="javascript" src="../jscript/calendar.js"></script>

<style>
body {
	max-height:350px;
}

input.imagebutton{
	background-color:#E1E1E1;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#0047D4;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow:0px 0px 0px #CCC;
	-webkit-box-shadow:0px 0px 0px #CCC;
	box-shadow:0px 0px 0px #CCC;
	
}

input.imagebutton:hover{
	background-color:#E4E4E4;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:2px;
	border-color:#0047D4;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow:5px 5px 5px #666;
	-webkit-box-shadow:5px 5px 5px #666;
	box-shadow:5px 5px 5px #666;
}

input.text40{
    background:#FFF;
    border: 1px solid #E6E6E6;
    padding: 2px;
    width:40px;
	height:20px;
	color:#000;
}
input.text40:focus{
     border-color:#0047D4;
}

input.text100{
    background:#FFF;
    border: 1px solid #E6E6E6;
    padding: 2px;
    width:100px;
	height:20px;
	color:#000;
}
input.text100:focus{
     border-color:#0047D4;
}

select.selectbox120{
    background:#FFF;
    border: 1px solid #ddd;
    padding: 2px;
    width:120px;
	color:#000;
}
select.selectbox120:focus{
     border-color:#0047D4;
}

label.label_std{
	margin-left:5px;
    line-height:20px;
	padding-top:6px;
    color:#000;
    text-shadow:1px 1px 1px #fff;
    font:bold 12px Arial;
}
</style>

<?php

//include('../include/db.php');


$order_reference = $_GET['order_reference'];

$table_name = $_SESSION['db_prefix']."_orders";
$order_query = "SELECT order_no, cust_id, delivery_date FROM $table_name WHERE order_reference = '".$order_reference."' ";
$order_result = mySQL_query($order_query);
$order_no = mysql_result($order_result, 0, "order_no");
$delivery_date = mysql_result($order_result, 0, "delivery_date");
$cust_id = mysql_result($order_result, 0, "cust_id");

$table_name2 = $_SESSION['db_prefix']."_customer";
				$customer_query = "SELECT account_type, title, name_2, comp_name FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
				$customer_result = mySQL_query($customer_query);
				$customer_num = mysql_num_rows($customer_result);	
				$account_type = mysql_result($customer_result, 0, "account_type");
				$cust_name = mysql_result($customer_result, 0, "comp_name"); 
				
?>




<script type="text/javascript">
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
</script>
</head>
<body >

    
    <form action='../edit_windows/change_delivery_date_save.php' method="GET" name="form2" target="_top" id="form2">
    <table border="0" align="left" cellpadding="0" cellspacing="0" id="select_table" >
    <tr>
      <td height="59" colspan="2" align="center"><label class="label_std">
      Order no.: <?php echo $order_no ?><br /><?php echo $cust_name ?>
      <br />
      Recorded delivery date: <?php echo date("d-m-Y", strtotime($delivery_date)) ?></label></td>
    </tr>
    <tr>
      <td width="125" height="34" align="right"><label class="label_std">New delivery  date:&nbsp;&nbsp;</label></td>
      <td width="247" ><?php
		
		  
		$myCalendar = new tc_calendar("new_delivery_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2015, 2090);
		$myCalendar->writeScript();
?>
      <input type="hidden" name="order_reference" id="order_reference" value="<?php echo $order_reference ?>"/>
      <input type="hidden" name="delivery_date" id="delivery_date" value="<?php echo $delivery_date ?>"/>
      </td>
    </tr>
    <tr>
      <td height="40" colspan="2" align="center">
        <input name="input" type="submit" value="Save" class="imagebutton"  />
      <input name="button2" type="button" id="button2" class="imagebutton" onclick="MM_goToURL('parent','../store/outstanding_orders_list.php?order_reference=<?php echo $order_reference?>&amp;approve=0'); return document.MM_returnValue" value="Cancel" /></td>
    </tr>
  </table>
</form>
</body>
</html>