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

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

$table_name = $_SESSION['db_prefix']."_presets";
$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockin1'  ";
$time_result = mySQL_query($time_query);
$time_num = mysql_num_rows($time_result);
if ($time_num!=0) {
$hours1 = mysql_result($time_result, 0, "preset_value");
}
else {
	$hours1 = 0;
}

$clockin_hours1 =  floor($hours1/60); 
$clockin_mins1 =   $hours1 % 60; 
if ($clockin_hours1<10) { $clockin_hours1 = 0 . $clockin_hours1; }
if ($clockin_mins1<10) { $clockin_mins1 = 0 . $clockin_mins1; }

$table_name = $_SESSION['db_prefix']."_presets";

$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockout1'  ";
$time_result = mySQL_query($time_query);
$hours1 = mysql_result($time_result, 0, "preset_value");

$grace_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'grace1'  ";
$grace_result = mySQL_query($grace_query);
$grace1 = mysql_result($grace_result, 0, "preset_value");

$lunch_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'lunch1'  ";
$lunch_result = mySQL_query($lunch_query);
$lunch1 = mysql_result($lunch_result, 0, "preset_value");


$clockout_hours1 =  floor($hours1/60); 
$clockout_mins1 =   $hours1 % 60; 
if ($clockout_hours1<10) { $clockout_hours1 = 0 . $clockout_hours1; }
if ($clockout_mins1<10) { $clockout_mins1 = 0 . $clockout_mins1; }


$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockin2'  ";
$time_result = mySQL_query($time_query);
$hours2 = mysql_result($time_result, 0, "preset_value");

$grace_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'grace2'  ";
$grace_result = mySQL_query($grace_query);
$grace2 = mysql_result($grace_result, 0, "preset_value");

$lunch_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'lunch2'  ";
$lunch_result = mySQL_query($lunch_query);
$lunch2 = mysql_result($lunch_result, 0, "preset_value");


$clockin_hours2 =  floor($hours2/60); 
$clockin_mins2 =   $hours2 % 60; 
if ($clockin_hours2<10) { $clockin_hours2 = 0 . $clockin_hours2; }
if ($clockin_mins2<10) { $clockin_mins2 = 0 . $clockin_mins2; }


$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockout2'  ";
$time_result = mySQL_query($time_query);
$hours2 = mysql_result($time_result, 0, "preset_value");


$clockout_hours2 =  floor($hours2/60); 
$clockout_mins2 =   $hours2 % 60; 
if ($clockout_hours2<10) { $clockout_hours2 = 0 . $clockout_hours2; }
if ($clockout_mins2<10) { $clockout_mins2 = 0 . $clockout_mins2; }

$table_name = $_SESSION['db_prefix']."_presets";
$high_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Priority high'  ";
$high_result = mySQL_query($high_query);
$high = mysql_result($high_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$normal_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Priority normal'  ";
$normal_result = mySQL_query($normal_query);
$normal = mysql_result($normal_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$low_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Priority low'  ";
$low_result = mySQL_query($low_query);
$low = mysql_result($low_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$diesel_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Diesel'  ";
$diesel_result = mySQL_query($diesel_query);
$diesel = number_format(mysql_result($diesel_result, 0, "preset_value"), 2, '.', '') ;


$table_name = $_SESSION['db_prefix']."_presets";
$petrol_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Petrol'  ";
$petrol_result = mySQL_query($petrol_query);
$petrol = number_format(mysql_result($petrol_result, 0, "preset_value"), 2, '.', '');

$table_name = $_SESSION['db_prefix']."_presets";
$vat_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'VAT'  ";
$vat_result = mySQL_query($vat_query);
$vat = number_format(mysql_result($vat_result, 0, "preset_value"), 2, '.', '');


$table_name = $_SESSION['db_prefix']."_presets";
$earth_loops_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Earth loops'  ";
$earth_loops_result = mySQL_query($earth_loops_query);
$earth_loops = number_format(mysql_result($earth_loops_result, 0, "preset_value"), 2, '.', '');


$table_name = $_SESSION['db_prefix']."_presets";
$outrigger_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Outrigger'  ";
$outrigger_result = mySQL_query($outrigger_query);
$outrigger = number_format(mysql_result($outrigger_result, 0, "preset_value"), 2, '.', '');

$table_name = $_SESSION['db_prefix']."_presets";
$wash_line_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Wash line'  ";
$wash_line_result = mySQL_query($wash_line_query);
$wash_line =number_format(mysql_result($wash_line_result, 0, "preset_value"), 2, '.', '') ;

$table_name = $_SESSION['db_prefix']."_presets";
$strobe_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Strobe'  ";
$strobe_result = mySQL_query($strobe_query);
$strobe = number_format(mysql_result($strobe_result, 0, "preset_value"), 2, '.', '');


$table_name = $_SESSION['db_prefix']."_presets";
$anti_lift_bar_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Anti lift bar'  ";
$anti_lift_bar_result = mySQL_query($anti_lift_bar_query);
$anti_lift_bar = number_format(mysql_result($anti_lift_bar_result, 0, "preset_value"), 2, '.', '');

$table_name = $_SESSION['db_prefix']."_presets";
$ace_100_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Ace 100 energizer'  ";
$ace_100_result = mySQL_query($ace_100_query);
$ace_100 = number_format(mysql_result($ace_100_result, 0, "preset_value"), 2, '.', '');

$table_name = $_SESSION['db_prefix']."_presets";
$residential_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out residential'  ";
$residential_result = mySQL_query($residential_query);
$residential =number_format(mysql_result($residential_result, 0, "preset_value"), 2, '.', '') ;

$table_name = $_SESSION['db_prefix']."_presets";
$commercial_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out commercial'  ";
$commercial_result = mySQL_query($commercial_query);
$commercial = number_format(mysql_result($commercial_result, 0, "preset_value"), 2, '.', '');

$table_name = $_SESSION['db_prefix']."_presets";
$gate_motor_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out gate motor'  ";
$gate_motor_result = mySQL_query($gate_motor_query);
$gate_motor = number_format(mysql_result($gate_motor_result, 0, "preset_value"), 2, '.', '');

$table_name = $_SESSION['db_prefix']."_presets";
$month_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Maintenance month'  ";
$month_result = mySQL_query($month_query);
$month = number_format(mysql_result($month_result, 0, "preset_value"), 2, '.', '');

$table_name = $_SESSION['db_prefix']."_presets";
$year_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Maintenance year'  ";
$year_result = mySQL_query($year_query);
$year = number_format(mysql_result($year_result, 0, "preset_value"), 2, '.', '');



$table_name = $_SESSION['db_prefix']."_list_names_foreman";
$select_query = "SELECT emp_id, item_name FROM $table_name";
	$arrId2 = array ();
	$arrName2 = array ();
	$select_result = execsql($select_query);
	$select_num = mysql_num_rows($select_result);
	$a = 0;
	while ($a < $select_num) {
		$arrId2[$a] = mysql_result($select_result, $a, "emp_id");
		$arrName2[$a] = mysql_result($select_result, $a, "item_name");
		$a++;
	}	
?>





<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>   
 
</head>
<body>
<?php 
include ("../navigation/header.php");
$page_name = "AD-presets";
include ("../navigation/access.php");
if ($permission_num==1) {
	include ("../navigation/admin_sidebar.php");
?>


<div class="main_frame">
<div class="page_head_frame">
    <table width="809" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="385"><label class="label_page_head">Presets</label></td>
        <td align="right">&nbsp;</td>
      </tr>
    </table>
  </div>
  <div class="page_middle_frame">
<form action="presets_save.php" method="get">
<div class="page_inside_frame">
  Working times: <br />
    Time zone 1 clock-in: 
  <input name="clockin_hour_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="1" max="9" style="text-align:right" value="<?php echo $clockin_hours1 ?>" onfocus = "this.select();"/>
    :
  <input name="clockin_min_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" style="text-align:right" max="59" value="<?php echo $clockin_mins1 ?>" onfocus = "this.select();"/>
  &nbsp; clock_out:
  <input name="clockout_hour_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" max="20" style="text-align:right" value="<?php echo $clockout_hours1 ?>"/>
    :
  <input name="clockout_min_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" max="59" style="text-align:right" value="<?php echo $clockout_mins1 ?>" onfocus = "this.select();"/>
&nbsp;&nbsp;&nbsp;&nbsp;grace time: 
<input type="text" name="grace_min_text" id="grace_min_text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" style="text-align:right" value="<?php echo $grace1 ?>"> minutes
&nbsp;&nbsp;&nbsp;&nbsp;lunch period:
<input type="text" name="lunch_min_text" id="lunch_min_text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" style="text-align:right" value="<?php echo $lunch1 ?>"> minutes
<br />
<br />
  
  Time zone 2 clock-in:
    <input name="clockin_hour_2_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="1" max="9" style="text-align:right" value="<?php echo $clockin_hours2 ?>" onfocus = "this.select();"/>
:
<input name="clockin_min_2_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" style="text-align:right" max="59" value="<?php echo $clockin_mins2 ?>" onfocus = "this.select();"/>
&nbsp; clock_out:
<input name="clockout_hour_2_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" max="20" style="text-align:right" value="<?php echo $clockout_hours2 ?>" onfocus = "this.select();"/>
:
<input name="clockout_min_2_text" type="text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" max="59" style="text-align:right" value="<?php echo $clockout_mins2 ?>" onfocus = "this.select();"/>
&nbsp;&nbsp;&nbsp;&nbsp;grace time: 
<input type="text" name="grace_min2_text" id="grace_min2_text" class="text20"  onkeypress="return numbersonly(this, event)" maxlength="2" style="text-align:right" value="<?php echo $grace2 ?>"> minutes
&nbsp;&nbsp;&nbsp;&nbsp;lunch period:
<input type="text" name="lunch_min2_text" id="lunch_min2_text" class="text20" onkeypress="return numbersonly(this, event)" maxlength="2" style="text-align:right" value="<?php echo $lunch2 ?>"> minutes  
</div>

<div class="page_inside_frame">
Quotation priority:<br />
High:&nbsp;&nbsp; 
<select name="high_select" id="high_select">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="14">14</option>
  <option value="21">21</option>
  <option value="28">28</option>
  <option value="<?php echo $high ?>" selected="selected"><?php echo $high ?></option>
</select> 
day(s)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Normal:&nbsp;&nbsp;
<select name="normal_select" id="normal_select">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="14">14</option>
  <option value="21">21</option>
  <option value="28">28</option>
  <option value="<?php echo $normal ?>" selected="selected"><?php echo $normal ?></option>
</select>
day(s)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Low:&nbsp;&nbsp;
<select name="low_select" id="low_select">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="14">14</option>
  <option value="21">21</option>
  <option value="28">28</option>
    <option value="<?php echo $low ?>" selected="selected"><?php echo $low ?></option>
</select>
day(s) </div>


<div class="page_inside_frame">
Fuel prices:<br />

Diesel:&nbsp;&nbsp;&nbsp;
P
<input name="diesel_text" type="text" class="text60" id="diesel_text" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $diesel ?>"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Petrol:
 &nbsp;P
 <input name="petrol_text" type="text" class="text60" id="petrol_text" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $petrol ?>"/>
</div>
<div class="page_inside_frame">
VAT: 
&nbsp;&nbsp;
<input type="text" name="vat_text" id="vat_text" class="text40" style="text-align:right" value="<?php echo number_format($vat, 0, '.', ',') ?>"> 
%
</div>
<div class="page_inside_frame">
  Electric fence optionals:
  <table width="640" border="0">
  <tr>
    <td width="97">Earth loops:</td>
    <td width="80"><input name="option1_text" type="text" class="text60" id="option1_text" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $earth_loops ?>"/></td>
    <td width="107">Out rigger:</td>
    <td width="116"><input name="option2_text" type="text" class="text60" id="option2_text" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $outrigger ?>"/></td>
    <td width="150">Wash line:</td>
    <td width="64"><input name="option3_text" type="text" class="text60" id="option3_text" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $wash_line ?>"/></td>
  </tr>
  <tr>
    <td>Strobe:</td>
    <td><input name="option4_text" type="text" class="text60" id="option4_text" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $strobe ?>"/></td>
    <td>Anti lift bar:</td>
    <td><input name="option5_text" type="text" class="text60" id="option5_text" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $anti_lift_bar ?>"/></td>
    <td>Ace 100 energizer:</td>
    <td><input name="option6_text" type="text" class="text60" id="option6_text" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $ace_100 ?>"/></td>
  </tr>
</table>

<?php
$table_name = $_SESSION['db_prefix']."_planning_legend";
$legend_query = "SELECT * FROM $table_name ORDER BY legend_no ASC  ";
$legend_result = mySQL_query($legend_query);
$legend_num = mysql_num_rows($legend_result);
$i=0;
while ($i<$legend_num) {
	$n=$i+1;
   $emp_id = mysql_result($legend_result, $i, "emp_id");
   
   if ($emp_id!='0') {
	 
   ${"legend_id".$n} = $emp_id;
   
   	$table_name2 = $_SESSION['db_prefix']."_employee";
	$employee_query = "SELECT emp_first_name, emp_last_name FROM $table_name2 WHERE emp_id ='".$emp_id."' ";
	$employee_result = mySQL_query($employee_query);
	$employee_num = mysql_num_rows($employee_result);
	${"legend_name".$n} = mysql_result($employee_result, 0, "emp_first_name").' '.mysql_result($employee_result, 0, "emp_last_name"); 
   }
   else {
	 ${"legend_id".$n} = '';
	 ${"legend_name".$n} = '';
   }
  $i++;
}

?>

</div>
<div class="page_inside_frame">Planning legend foreman:
  <table width="649" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="217"><select name="color_select_1" class="select200"  id="color_select_1" style="background-color:#ECC680">
      <option value="<?php echo $legend_id1 ?>"><?php echo $legend_name1 ?></option>
      <option value="  "> </option>
      <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    <td width="208"><select name="color_select_2" class="select200"  id="color_select_2" style="background-color:#B5DEA3">
      <option value="<?php echo $legend_id2 ?>" selected="selected"><?php echo $legend_name2 ?></option>
      <option value="  "> </option>
	  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    <td width="216"><select name="color_select_3" class="select200"  id="color_select_3" style="background-color:#FFC6E2">
      <option value="<?php echo $legend_id3 ?>" selected="selected"><?php echo $legend_name3 ?></option>
     <option value="  "> </option>
      <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    </tr>
  <tr>
    <td><select name="color_select_4" class="select200"  id="color_select_4" style="background-color:#A0CFF1">
      <option value="<?php echo $legend_id4 ?>" selected="selected"><?php echo $legend_name4 ?></option>
     <option value="  "> </option>
      <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    <td><select name="color_select_5" class="select200"  id="color_select_5" style="background-color:#DFBFFF">
      <option value="<?php echo $legend_id5 ?>" selected="selected"><?php echo $legend_name5 ?></option>
      <option value="  "> </option>
	  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    <td><select name="color_select_6" class="select200"  id="color_select_6" style="background-color:#B7B7FF">
      <option value="<?php echo $legend_id6 ?>" selected="selected"><?php echo $legend_name6 ?></option>
     <option value="  "> </option>
      <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    </tr>
  <tr>
    <td><select name="color_select_7" class="select200"  id="color_select_7" style="background-color:#FFFFC6">
      <option value="<?php echo $legend_id7 ?>" selected="selected"><?php echo $legend_name7 ?></option>
      <option value="  "> </option>
	  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    <td><select name="color_select_8" class="select200"  id="color_select_8" style="background-color:#80BFBF">
      <option value="<?php echo $legend_id8 ?>" selected="selected"><?php echo $legend_name8 ?></option>
      <option value="  "> </option>
	  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    <td><select name="color_select_9" class="select200"  id="color_select_9" style="background-color:#FF9D9D">
      <option value="<?php echo $legend_id9 ?>" selected="selected"><?php echo $legend_name9 ?></option>
      <option value="  "> </option>
	  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
    </select></td>
    </tr>
</table>
</div>
<div class="page_inside_frame">
Maintenance charges:<br /><br />
<table width="469" border="0" cellspacing="0" cellpadding="0">
  <tr>
      <td width="230">Maintenance call out residential:</td>
      <td width="239"><input type="text" name="residential_text" id="residential_text" class="text60" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $residential?>" /></td>
      </tr>
    <tr>
      <td>Maintenance call out commercial:</td>
      <td><input type="text" name="commercial_text" id="commercial_text" class="text60" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right"  value="<?php echo $commercial?>"/></td>
      </tr>
    <tr>
      <td>Maintenance call out gate motor:</td>
      <td><input type="text" name="gate_motor_text" id="gate_motor_text" class="text60" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right"  value="<?php echo $gate_motor?>"/></td>
    </tr>
    <tr>
      <td>Contract month charge:</td>
      <td><input type="text" name="month_text" id="month_text" class="text60" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $month?>" /></td>
      </tr>
    <tr>
      <td>Contract year charge (11months):</td>
      <td><input type="text" name="year_text" id="year_text" class="text60" onkeypress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $year?>"/></td>
      </tr>
</table>
</div>
<?php
$table_name = $_SESSION['db_prefix']."_team_planning_legend";
$legend_query = "SELECT * FROM $table_name ORDER BY legend_no ASC  ";
$legend_result = mySQL_query($legend_query);
$legend_num = mysql_num_rows($legend_result);
$i=0;
while ($i<$legend_num) {
	$n=$i+1;
   $team_id = mysql_result($legend_result, $i, "team_id");
   
   ${"legend_team_id".$n} = $team_id;
  
  
  $i++;
}

?>
<div class="page_inside_frame">Planning legend maintenance teams:
  <table width="649" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="217"><select name="team_color_select_1" class="select200"  id="team_color_select_10" style="background-color:#ECC680">
        <option value="<?php echo $legend_team_id1 ?>"><?php echo $legend_team_id1 ?></option>
        <option value="team 1">team 1</option>
        <option value="team 2">team 2</option>
        <option value="team 3">team 3</option>
        <option value="team 4">team 4</option>
        <option value="team 5">team 5</option>
        
      </select></td>
      <td width="208"><select name="team_color_select_2" class="select200"  id="team_color_select_2" style="background-color:#B5DEA3">
        <option value="<?php echo $legend_team_id2 ?>" selected="selected"><?php echo $legend_team_id2 ?></option>
        <option value="team 1">team 1</option>
        <option value="team 2">team 2</option>
        <option value="team 3">team 3</option>
        <option value="team 4">team 4</option>
        <option value="team 5">team 5</option>
      </select></td>
      <td width="216"><select name="team_color_select_3" class="select200"  id="team_color_select_3" style="background-color:#FFFFC6">
        <option value="<?php echo $legend_team_id3 ?>" selected="selected"><?php echo $legend_team_id3 ?></option>
        <option value="  "> </option>
        <option value="team 1">team 1</option>
        <option value="team 2">team 2</option>
        <option value="team 3">team 3</option>
        <option value="team 4">team 4</option>
        <option value="team 5">team 5</option>
      </select></td>
    </tr>
    <tr>
      <td><select name="team_color_select_4" class="select200"  id="team_color_select_4" style="background-color:#A0CFF1">
        <option value="<?php echo $legend_team_id4 ?>" selected="selected"><?php echo $legend_team_id4 ?></option>
        <option value="  "> </option>
        <option value="team 1">team 1</option>
        <option value="team 2">team 2</option>
        <option value="team 3">team 3</option>
        <option value="team 4">team 4</option>
        <option value="team 5">team 5</option>
?>
      </select></td>
      <td><select name="team_color_select_5" class="select200"  id="team_color_select_5" style="background-color:#DFBFFF">
        <option value="<?php echo $legend_team_id5 ?>" selected="selected"><?php echo $legend_team_id5 ?></option>
        <option value="  "> </option>
        <option value="team 1">team 1</option>
        <option value="team 2">team 2</option>
        <option value="team 3">team 3</option>
        <option value="team 4">team 4</option>
        <option value="team 5">team 5</option>
?>
      </select></td>
      <td>&nbsp;</td>
    </tr>
  </table>
</div>
<br />

<div class="page_inside_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="" />
        <input name="button2" type="button" class="imagebutton" id="button2" onClick="cancel_confirmation(3, '../admin_module/user_list.php');" value="Close"/>        
        <input name="save_button"  id="save_button" type="submit" class="imagebutton" value="Save" onClick="needToConfirm = false; confirmRefresh(); MM_showHideLayers('wait','','show');"/>        <input name="save_close_button"  id="save_close_button" type="submit" class="imagebutton" value="Save &amp; Close" onClick="needToConfirm = false; confirmRefresh(); MM_showHideLayers('wait','','show');" /></td>
    </tr>
</table>  
</div>
</form>
</div>  
</div>
</body>

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

<?php } else {
$_SESSION['denied_return'] = "admin_module/user_list.php";	
include ("../navigation/admin_sidebar.php");?>
	<body onload="accessdenied(); return false">
	</body>
<?php }
?>
</html>