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


$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> 
<script language="javascript" src="../jscript/calendar.js"></script>

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


$report_no = $_GET['report_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='../quality/dry_tile_inspection_sheet.php?' method="GET" name="form2" target="_top" id="form2">
    <table border="0" align="left" cellpadding="0" cellspacing="0" class="list2" id="select_table" width="372">
    <tr>
      <td height="59" colspan="2" align="center">
        
        <label class="label_std">To approve report no <?php echo $report_no ?>, set date,<br />
          select your user name and enter password:</label>
        </td>
    </tr>
    <tr>
      <td width="125" height="38" align="right"><label class="label_std">Approve date:&nbsp;&nbsp;</label></td>
      <td width="247" ><?php
		
		  
		$myCalendar = new tc_calendar("approve_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2015, 2090);
		$myCalendar->writeScript();
?></td>
    </tr>
    <tr>
      <td height="49" colspan="2" align="center"><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="report_no" id="report_no" value="<?php echo $report_no ?>"/>
<input type="hidden" name="approve" id="approve" value="1"/>
<input name="password" id="password" type="hidden" value="" /></td>
    </tr>
       <tr>
         <td height="98" colspan="2" align="center">
        <input name="input" type="submit" value="Approve" class="imagebutton"  />
        <input name="button2" type="button" id="button2" class="imagebutton" onclick="MM_goToURL('parent','../quality/dry_tile_inspection_sheet.php?report_no=<?php echo $report_no?>&approve=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("user_select","req","Please select your username and enter password.");  
</script>
</body>
</html>