<!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 ("../navigation/header.php");
$page_name = "Production-edit job details";
include ("../navigation/access.php");

?>
<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />

<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript">
</script>  <script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/capitalize_textbox.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>  

</head>

<?php 
if ($permission_num==1) {
	include ("../navigation/production_sidebar.php");
	
	$job_no = $_GET['job_no'];
	
	$table_name = $_SESSION['db_prefix']."_list_roofcover";
$dropDownQuery = "SELECT  item_name FROM $table_name  ORDER BY item_name";
$dropDownResult = execsql($dropDownQuery);
	$num = mysql_num_rows($dropDownResult);
	$a = 0;
	$arrId = array ();
	$arrName = array ();
	while ($a < $num) {
		$arrId[$a] = mysql_result($dropDownResult, $a, "item_name");
		$arrName[$a] = mysql_result($dropDownResult, $a, "item_name");
				
		$a++;
	}

$table_name = $_SESSION['db_prefix']."_list_designers";
$designers_query = "SELECT item_name FROM $table_name  ORDER BY item_name ASC";
	$designers_result = execsql($designers_query);
	$designers_num = mysql_num_rows($designers_result);
	$v = 0;
	$arrId1 = array ();
	$arrName1 = array ();
	while ($v < $designers_num) {
		$arrId1[$v] = mysql_result($designers_result, $v, "item_name");
		$arrName1[$v] = mysql_result($designers_result, $v, "item_name");
		$v++;
	}
	
	$table_name = $_SESSION['db_prefix']."_captured_jobs";
	$job_query = "SELECT cust_id, captured, compiled, cutting_bill, supplied, authorisation, produced, delivered FROM $table_name WHERE job_no = '".$job_no."' ";
	$job_result = mySQL_query($job_query);
	$cust_id = mysql_result($job_result, 0, "cust_id");
	$captured = mysql_result($job_result, 0, "captured");
	$compiled = mysql_result($job_result, 0, "compiled");
	$cutting_bill = mysql_result($job_result, 0, "cutting_bill");
	$supplied = mysql_result($job_result, 0, "supplied");
	$authorisation = mysql_result($job_result, 0, "authorisation");
	$produced = mysql_result($job_result, 0, "produced");
	$delivered = mysql_result($job_result, 0, "delivered");
		
	$quote='no';
	
?>

<body>
<div class="main_frame">
<table id="tableMain" > <!--begin of tableMain-->
    <tr>
      <td width="830" height="125" valign="top" >
  <div class="page_head_frame">
    <table width="809" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="385"><label class="label_page_head">Job details edit</label></td>
        <td width="182" align="right"><label style="font-size:24px; color:#FB6808;"><?php echo "J".$job_no ?></label></td>
        <td width="113" align="right">&nbsp;</td>
      </tr>
    </table>
  </div>
  <div class="page_middle_frame">
         
      <br />
      <br />
    
    <?php 
	include('../include/customer_block.php');
	echo '<br />';
	
	?>
  </div><br />
<br />
<form action="job_details_edit_save.php" method="get" name="form1"> 
  
 
 
    <?php
require_once ('../include/tc_calendar.php');



$table_name = $_SESSION['db_prefix']."_captured_jobs";
$job_query = "SELECT * FROM $table_name WHERE job_no = '".$job_no."' ";
$job_result = mySQL_query($job_query);
//$job_no = mysql_result($job_result, 0, "job_no");
$project_no = mysql_result($job_result, 0, "project_no");
$project_place = mysql_result($job_result, 0, "project_place");
$cust_id = mysql_result($job_result, 0, "cust_id");
$designer = mysql_result($job_result, 0, "designer");
$roof_cover = mysql_result($job_result, 0, "roof_cover");
$roof_pitch = mysql_result($job_result, 0, "roof_pitch");
$max_overhang = mysql_result($job_result, 0, "max_overhang");
$roof_area = mysql_result($job_result, 0, "roof_area");
$floor_area = mysql_result($job_result, 0, "floor_area");
$quote_note = mysql_result($job_result, 0, "quote_note");
$value = mysql_result($job_result, 0, "value");
$order_date = mysql_result($job_result, 0, "date");
$del_date = mysql_result($job_result, 0, "del_date");
$note = mysql_result($job_result, 0, "quote_note");
$install = mysql_result($job_result, 0, "install_by");


require_once ('../include/tc_calendar.php');
$order = strtotime($order_date);
$do = date("d", $order );
$mo = date("m", $order );
$yo = date("Y", $order );

$deliver = strtotime($del_date);
$d = date("d", $deliver );
$m = date("m", $deliver );
$y = date("Y", $deliver );


?>
<div class="page_middle_frame">  
  <table width="680" id="table_details_display">
    <tr>
    <td align="left" valign="top"><?php if($quote=='yes') { echo 'Quote no:';} else {echo 'Job no:'; }?></td>
    <td align="left" valign="top"><?php if ($job_no!=0) { echo $job_no; } ?><input name="job_no_text" type="hidden" value="<?php echo $job_no?>" /></td>
    <td align="left" valign="top">Project:</td>
    <td width="252" align="left" valign="top">
      <input name="project_no_text" type="text" class="text200" id="project_no_text"  value="<?php echo $project_no; ?>" autocomplete="off" onBlur="capitalize(this)" onfocus = "this.select();"/>
      <input name="project_place_text" type="text" class="text200" id="project_place_text"  value="<?php echo $project_place; ?>" autocomplete="off"onBlur="capitalize(this)" onfocus = "this.select();"/>
      <br /></td>
  </tr>
  <tr>
    <td align="left" valign="top">Order date:</td>
    <td align="left" valign="top"><?php

		$myCalendar = new tc_calendar("order_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($do, $mo, $yo);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2014, 2090);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
    <td align="left" valign="top">Delivery date:</td>
    <td align="left" valign="top"><?php

		$myCalendar = new tc_calendar("deliver_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2014, 2090);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
  </tr>
  <tr>
    <td align="left" valign="top">Job value:</td> 
    <td align="left" valign="top">
      <input name="job_value_text" type="text" class="text100" id="job_value_text"  value="<?php echo $value ?>" onKeyPress="return isNumberKey(event)" onchange=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" onfocus = "this.select();"/></td>
    <td align="left" valign="top">Designer:</td>
    <td align="left" valign="top"><select name="designer_select" id="designer_select" class="select160" tabindex="7">
      <option value="<?php echo $designer?>" selected="selected"><?php echo $designer?></option>
        <?php 
    	for ($v = 0; $v < count($arrId1); $v++) {
		echo "<option value=\"".$arrId1[$v] . "\"" . ">" . $arrName1[$v] . "</option>";	
	    }
     ?>
    </select></td>
    </tr>
  <tr>
    <td width="80" align="left" valign="top">Roof cover:</td>
    <td align="left" valign="top"><select name="roof_cover_select" id="roof_cover_select" class="select200" autofocus="autofocus">
      <option value="<?php echo $roof_cover?>"><?php echo $roof_cover?></option>
      <?php
    	for ($i = 0; $i < count($arrId); $i++) {
		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
		$_SESSION['productName'] = $arrName[$i];
		}
     ?>
    </select>      &nbsp;</td>
    <td align="left" valign="top">Vertex install:</td>
    <td align="left" valign="top">
                        <input type="radio" name="install_group" value="Yes" id="install_group_0" <?php if ($install=="Yes") {?>checked="checked" <?php }?>>
                        Yes</label>
                      
                      <label class="label_std">
                        <input type="radio" name="install_group" value="No" id="install_group_1" <?php if ($install=="No") {?>checked="checked" <?php }?>>
                        No</label></td>
  </tr>
  <tr>
    <td align="left" valign="top">Roof pitch:</td>
    <td width="236" align="left" valign="top"><input name="roof_pitch_text" type="text" class="text60" id="roof_pitch_text"  value="<?php echo $roof_pitch; ?>" autocomplete="off" onKeyPress="return isNumberKey(event)" onchange=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" onfocus = "this.select();"/>
      deg</td>
    <td width="92" align="left" valign="top">Max overhang:</td>
    <td align="left" valign="top"><input name="overhang_text" type="text" class="text60" id="overhang_text"  value="<?php echo $max_overhang ?>" onkeypress="return numbersonly(this, event)" autocomplete="off" style="text-align:right" onfocus = "this.select();"/>
      mm</td>
  </tr>
  <tr>
    <td align="left" valign="top">Roof area:</td>
    <td align="left" valign="top"><input name="roof_area_text" type="text" class="text60" id="roof_area_text"  value="<?php echo $roof_area ?>" onKeyPress="return isNumberKey(event)" onchange=" this.value = this.value.replace (/(\...).*/, '$1')" autocomplete="off" style="text-align:right" onfocus = "this.select();"/>
      m<sup>2</sup></td>
    <td align="left" valign="top">Floor area:</td>
    <td align="left" valign="top"><input name="floor_area_text" type="text" class="text60" id="floor_area_text"  value="<?php echo $floor_area ?>" autocomplete="off" onKeyPress="return isNumberKey(event)" onchange=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" onfocus = "this.select();"/>
      m<sup>2</sup></td>
  </tr>
  <tr>
    <td align="left" valign="top">Notes:</td>
    <td colspan="3" align="left" valign="top"><label for="notes_text"></label>
      <textarea name="notes_text" cols="80" rows="3" class="text_box" id="notes_text"><?php echo $quote_note ?></textarea></td>
  </tr>
</table>

  </div>
  <div class="page_middle_frame">
    <table width="645" border="0">
      <tr>
      <td width="20"></td>
      <td width="615" align="right"><input type="hidden" name="job_no" id="job_no" value="<?php echo $job_no ?>" />
        <input name="button2" type="button" class="imagebutton" id="button2" onclick="cancel_confirmation(3, '../production/production_main.php');" value="Close"/>
        <input name="save_button"  id="save_button" type="submit" class="imagebutton" value="Save " onclick="needToConfirm = false; confirmRefresh();" />
        <input name="save_close_button"  id="save_close_button" type="submit" class="imagebutton" value="Save &amp; Close" onclick="needToConfirm = false; confirmRefresh();" /></td>
    </tr>
</table>
  </div>
</form>  
      </td> 
      <!--center of tableMain-->
</tr>
<tr>
<td> <!--center of tableMain-->


  <p>&nbsp;</p>
</td>
</tr>
</table>  <!--end of tableMain-->  
</div>

<script type="text/javascript">
	initTriStateCheckBox('tristateBox2', 'tristateBox2State', true);
	initTriStateCheckBox('tristateBox3', 'tristateBox3State', true);
	initTriStateCheckBox('tristateBox4', 'tristateBox4State', true);
	initTriStateCheckBox('tristateBox5', 'tristateBox5State', true);
	initTriStateCheckBox('tristateBox6', 'tristateBox6State', true);
	initTriStateCheckBox('tristateBox7', 'tristateBox7State', true);
</script>

</body>

<?php include ('../navigation/side_bar.php'); ?>


<?php } else {
    $_SESSION['denied_return'] = "production/production_main.php";
    include ("../navigation/production_sidebar.php");?>
	<body onLoad="accessdenied(); return false">	
    <?php include ('../navigation/side_bar.php'); ?>
	</body>
<?php }
?>
</html>