<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  
<!--style sheets-->
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<link href="../css/main.css" rel="stylesheet" type="text/css" />

<!--jscript-->
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/lower_case.js"  type="text/javascript"></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/upper_case.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/capitalize_textbox.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>   
<?php
include ("../navigation/header.php");
?>

<?php
	$table_name = $_SESSION['db_prefix']."_list_company";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId3 = array ();
	$arrName3 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId3[$b] = mysql_result($position_result, $b, "item_name");
		$arrName3[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
	
$machine_id = $_GET['machine_id'];
$user_id = $_SESSION['username'];

	
$table_name2 = $_SESSION['db_prefix']."_machinery";
$machine_query = "SELECT * FROM $table_name2 WHERE machine_id ='".$machine_id."' ";
$machine_result = mySQL_query($machine_query);
$machine_num = mysql_num_rows($machine_result);	
$machine_id = mysql_result($machine_result, 0, "machine_id");
$a0 = mysql_result($machine_result, 0, "machine_name");
$a1 = mysql_result($machine_result, 0, "make");
$a2 = mysql_result($machine_result, 0, "model");
$a4 = mysql_result($machine_result, 0, "department");
$a6 = mysql_result($machine_result, 0, "in_service");
$a7 = mysql_result($machine_result, 0, "serial_no");
$a8 = mysql_result($machine_result, 0, "clock");
$a9 = mysql_result($machine_result, 0, "service_interval");
$a10 = mysql_result($machine_result, 0, "clock_reading");
$a14 = mysql_result($machine_result, 0, "notes");




?>



</head>
<body>
<?php

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

if ($permission_num==1) {
	include ("../navigation/store_sidebar.php");
?>
<div class="main_frame">
<form action="machine_details_edit_save.php" method="POST" name="form1">
  <div class="page_head_frame">
      <table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="385"><label class="label_page_head">Machinery</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="label_page_head_2"><?php echo $a0 ?></label></td>
            <td width="253">&nbsp;</td>
            <td width="171" align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
        
<div class="page_middle_frame">
<div class="page_inside_frame">
<div align="left">Machine  details</div>
  <table width="670" id="table_details_display">
    <tr>
      <td width="126" height="25">Machine name:</td>
      <td><b><?php echo $a0?> 
        <input type="hidden" name="machine_id_text" id="machine_id_text" value="<?php echo $machine_id?>" />
      </b></td>
      <td>&nbsp;</td>
      <td><input type="checkbox" name="in_service_checkbox" id="in_service_checkbox" <?php if ($a6=='yes') { ?> checked <?php } ?>> 
        in service</td>
      </tr>
    <tr>
      <td height="25">Make:</td>
      <td width="191"><input type="text" name="make_text" id="make_text" value="<?php echo $a1 ?>" class="text200"></td>
      <td width="116">Model:</td>
      <td width="217"><input type="text" name="model_text" id="model_text" value="<?php echo $a2 ?>" class="text200"></td>
      </tr>
  </table>
</div>
<div class="page_inside_frame">
<div align="left">Vehicle specifications</div>
  <table width="670" id="table_details_display">
    <tr>
      <td width="126" height="25">Company:</td>
      <td width="207"><select name="department_select" class="select200">
        <option value="<?php echo $a4 ?>" selected="selected"><?php echo $a4 ?></option>
        <?php
        	for ($j = 0; $j < count($arrId3); $j++) {
    		echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
	}
?>
      </select></td>
      <td width="135">&nbsp;</td>
      <td width="182">&nbsp;</td>
      </tr>
    <tr>
      <td height="25">Service interval:</td>
      <td><input type="text" name="service_text" id="service_text" value="<?php echo $a2 ?>" class="text100"></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      </tr>
    <tr>
      <td height="25">Clock:</td>
      <td><select name="clock_select" id="clock_select">
        <option value="<?php echo $a8 ?>"><?php echo $a8 ?></option>
        <option value="hrs">hrs</option>
        <option value="no">no</option>
      </select></td>
      <td>Clock reading:</td>
      <td><input name="clock_reading_text" type="text" class="text100" id="clock_reading_text" value="<?php echo $a10 ?>" onfocus = "this.select();" onkeypress="return numbersonly(this, event)"/></td>
      </tr>
  </table>
</div>
<div class="page_inside_frame">
  <table width="670" id="table_details_display">
    <tr>
      <td width="126" height="25">Serial no:</td>
      <td width="191"><input name="serial_text" type="text" class="text150" id="serial_text" value="<?php echo $a7 ?>" onfocus = "this.select();" onkeyup="ToUpper(this)"/></td>
      <td width="134">&nbsp;</td>
      <td width="199">&nbsp;</td>
      </tr>
  </table>
</div>
<div class="page_inside_frame">
  <div align="left">Miscelaneous</div>
  <table width="670" id="table_details_display">
    <tr>
      <td width="93" height="25" valign="top">Notes:</td>
      <td width="565"><textarea name="notes_text" id="notes_text" cols="50" rows="3"><?php echo $a14 ?></textarea></td>
    </tr>
  </table>
</div>

<div class="page_inside_frame">
  <table width="645" border="0">
    <tr>
      <td width="20"></td>
      <td width="615" align="right"><input type="hidden" name="machine_id_text" id="machine_id_text" value="<?php echo $machine_id ?>" />
        <input name="button2" type="button" class="imagebutton" id="button2" onclick="cancel_confirmation(3, '../store/store_main.php?date=0');" 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>

</div>
</form>  
</div>
<?php include ('../navigation/side_bar.php'); ?>
</body>
<?php } else {
$_SESSION['denied_return'] = "store/store_main.php?date=0&subCatSelect=Tiles";	
    include ("../navigation/store_sidebar.php");?>
    <?php include ('../navigation/side_bar.php'); ?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>

</html>