<!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');

$table_name = $_SESSION['db_prefix']."_users";
$select_query = "SELECT userid, username FROM $table_name ORDER BY username";
	$arrId = array ();
	$arrName = array ();
	$select_result = execsql($select_query);
	$select_num = mysql_num_rows($select_result);
	$a = 0;
	while ($a < $select_num) {
		$arrId[$a] = mysql_result($select_result, $a, "userid");
		$arrName[$a] = mysql_result($select_result, $a, "username");
		$a++;
	}
?>
<script language="JavaScript" src="../jscript/md5.min.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/gen_validatorv4_2.js"  type="text/javascript" xml:space="preserve"></script> 

<style>
input.imagebutton{
	background-color:#E6E6E6;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#FB6808;
	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:#E6E6E6;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:2px;
	border-color:#FB6808;
	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:#FB6808;
}

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

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

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');


$quote_no = $_GET['quote_no'];
?>




<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='../sales/cash_quotation_edit.php?job_no=<?php echo $quote_no ?>&authorise=1' method="POST" name="form2" target="_top" id="form2">
    <table border="0" align="left" cellpadding="0" cellspacing="0" class="list2" id="select_table">
    <tr>
      <td height="38" align="center"><label class="label_std">Discount: <input name="discount_text" type="text" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" max="100" />%</label>
        <input type="hidden" name="job_no" id="job_no"  value="<?php echo $quote_no ?>"/>
        <br />
        <br />
 
        <label class="label_std">Select user name and enter password:</label><br />
        <br />
        <select name="user_select"  id="user_select" class="selectbox120"  onchange="document.getElementById('password_text').disabled=false; document.getElementById('password_text').focus();">
          <option value=""></option>
          <?php
        	for ($i = 0; $i < count($arrId); $i++) {
    		  echo "<option ".$arrId[$i].">".$arrName[$i]."</option>";
	}
?>
        </select>
        &nbsp;&nbsp;&nbsp; 
         <input name="password_text" id="password_text" class="text100" type="password" value='' autofocus="autofocus"  onfocus="document.getElementById('password_text').value='';"  autocomplete="off" onblur="encrypt_pass = document.getElementById('password_text').value; document.getElementById('password').value = md5(encrypt_pass); document.getElementById('password_text').value = ''; " onkeydown="return (event.keyCode!=13);" disabled/>
         <input type="hidden" name="authorise" id="authorise" value="1"/>
         <input name="password" id="password" type="hidden" value="" />
         <br />
        <br />
       
      </td>
    </tr>
    
      <td height="45" align="center">
        <input name="input" type="submit" value="Enter" class="imagebutton"  />
        <input name="button2" type="button" id="button2" class="imagebutton" onclick="MM_goToURL('parent','../sales/cash_quotation_edit.php?job_no=<?php echo $quote_no?>&authorise=0'); return document.MM_returnValue" value="Cancel" /></td>
    </tr>
  </table>
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form2");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("discount_text","req","Please enter discount.");
  frmvalidator.addValidation("user_select","req","Please select your username and enter password.");  
  
</script>
</body>
</html>