{include file="header.dwt"}
<div id="list" class="f_l">
<script type="text/JavaScript">
function openresult(pre,id,cid){
	$("#choiceWindow").slideDown(300);
	$("#backGround").show();
	$.post("reports.php?act=loadman", { client:pre,cid: cid },
		function(data){
		//alert("Data Loaded: " + data);
		addOptions("#approvaled",data,'tbName','tbName',0);
		addOptions("#tbModify",data,'tbName','tbName',0);
	},"json");

	$.post("reports.php?act=loadresult", { client:pre,id:id },
		function(data){
		//alert("Data Loaded: " + data);
		$("#result").append("<option value='" + data['tbResult'] + "' selected='selected'>" + data['tbResult'] + "</option>"); 
		$("#approvaled").append("<option value='" + data['tbApproval'] + "' selected='selected'>" + data['tbApproval'] + "</option>"); 
		$("#tbPN").val(data['tbPN']);
		$("#tbPre").val(pre);
		$("#tbAppDate").val(data['tbAppDate']);
		$("#tbModify").append("<option value='" + data['tbModify'] + "' selected='selected'>" + data['tbModify'] + "</option>"); 
		$("#tbIssue").val(data['tbIssue']);
		$("#tbReason").val(data['tbModifyReason']);
		txt="Report No. &nbsp;&nbsp;&nbsp;&nbsp; :<font color='red'>" + data['tbReportNumber'] + "</font> | ProductName:<font color='red'>" + data['tbProductName'] + "</font> | InspectionDate:<font color='red'>" + data['tbInspectionDate'] + "</font> | Qty:<font color='red'>" + data['tbLotQty'] + "</font>";
		$("#pconfirm").html(txt);
	},"json");
			
}
</script>
<script type="text/JavaScript">
	function loadid(){
var id=document.getElementById("tbPN").value;
fnLaunch(id,'email');
}
</script>
<script type="text/javascript">
	function chageResult(){
PN=$("#tbPN").val();
if(PN!=""){	
	 $.ajax({ url: 'reports.php',
			 type:'post',
			 data:{ act: 'chgresult',
			 	  tbPN:PN,
				  client:$("#tbPre").val(),
				  approvaled:$("#approvaled").val(),
				  tbModify:$("#tbModify").val(),
				  result:$("#result").val(),
				  tbAppDate:$("#tbAppDate").val(),
				  tbIssue:$("#tbIssue").val(),
				  tbReason:$("#tbReason").val()
				  },
			  dataType:'json',
			  success: function(data)
			  {
				$("#choiceWindow").slideUp(300);
				$("#backGround").hide();
			   }
			}); 	
	}else{
	alert("Report Numbers Is Empty,Error!" );
	}
}         
</script>
		  <TABLE width="100%" border="0" align="center"  cellSpacing="1">
		    <TR><TD colspan="10" class="font_big title" >Report List</TD></TR>
			<TR align="middle" class="tb_title">
			  <TD>Report Number</TD>
			  <TD>Products</TD>
			  <TD>Customer</TD>
			  <TD>Factory</TD>
			  <TD>Factory Booking NO.</TD>
			  <TD>Inspection Date</TD>
			  <TD>Quantity</TD>
			  <TD>WI</TD>
			  <TD>Result</TD>
			  <TD>Report</TD>
			</TR>
		 
		  <!-- {foreach from=$list_rep item=con} -->
            <TR align="middle" height="30" bgcolor="#ffffff" onMouseOver="this.style.backgroundColor='#E1FFDF'" onMouseOut="this.style.backgroundColor='#ffffff'" class="cline">
              <TD><a href="report_page.php?id={$con.tbPN}&active=2&client={$pre}" target="_blank">{$con.tbReportNumber}</a></TD>
              <TD>{$con.tbProductName}</TD>
              <TD>{$con.client}</TD>
              <TD>{$con.tbNickName}</TD>
              <TD>{$con.tbFactoryBookNO}</TD>
			  <TD>{$con.tbInspectionDate}</TD>
              <TD>&nbsp;{$con.tbLotQty}&nbsp;</TD>
              <TD>&nbsp;{$con.tbWI}&nbsp;</TD>
			  <TD>
		<!--{if $rank eq "90"}-->
			  <!--{if $con.tbResult eq "Accepted"}-->
			  <a href="#" onclick="openresult('{$pre}','{$con.tbPN}','{$con.tbClientID}');"><font color="#006600"><b>A</b></font></a>
			  <!--{elseif $con.tbResult eq "Rejected"}-->
			  <a href="#" onclick="openresult('{$pre}','{$con.tbPN}','{$con.tbClientID}');"><font color="#FF0000"><b>R</b></font></a>
			  <!--{elseif $con.tbResult eq "Concessed"}-->
			  <a href="#" onclick="openresult('{$pre}','{$con.tbPN}','{$con.tbClientID}');"><font color="#0000FF"><b>C</b></font></a>
			  <!--{else}-->
			  <font color="#0000FF"><b>&nbsp;</b></font>
			  <!--{/if}-->
		<!--{else}-->
			  <!--{if $con.tbResult eq "Accepted"}-->
			  <font color="#006600"><b>A</b></font>
			  <!--{elseif $con.tbResult eq "Rejected"}-->
			  <font color="#FF0000"><b>R</b></font>
			  <!--{elseif $con.tbResult eq "Concessed"}-->
			  <font color="#0000FF"><b>C</b></font>
			  <!--{else}-->
			  <font color="#0000FF"><b>&nbsp;</b></font>
			  <!--{/if}-->
		<!--{/if}-->			  
			  
			  </TD>
			  <TD>
			  <!--{if $con.tbReport eq "0"}-->
			      <!--{if $rank > "50"}-->
				  <a href="report_create.php?id={$con.tbPN}&act=ready&active=2&client={$pre}"><font class="f_blue">Create Report</font></a>
				  <!--{else}-->
			      <font class="f_blue">On Going</font>
				  <!--{/if}-->
			  <!--{elseif $con.tbReport eq "1"}-->
			      <!--{if $rank > "50"}-->
				  <a href="report_page.php?id={$con.tbPN}&active=2&client={$pre}"><font class="f_blue">Create Serial NO</font></a>
				  <!--{else}-->
			      <font class="f_blue">On Going</font>
				  <!--{/if}-->
			  <!--{elseif $con.tbReport eq "2"}-->
			      <!--{if $rank > "50"}-->
				  <a href="report_page.php?id={$con.tbPN}&active=2&client={$pre}"><font class="f_red">Release Report</font></a>
				  <!--{else}-->
			      <font class="f_blue">On Going</font>
				  <!--{/if}-->
			  <!--{elseif $con.tbReport eq "3"}-->
			  <a href="report_page.php?id={$con.tbPN}&active=2&client={$pre}" target="_blank"><img src="pics/go.jpg" width="20" height="20" /></a>
			  <!--{else}-->
			  <font color="#FF0000">Cancelled</font>
			  <!--{/if}-->
			  
			  </TD>
			</TR>
			
          <!-- {/foreach} -->
     	  </TABLE>
		  
		  <table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr height="50">
		    <td width="12">&nbsp;  </td>
			<td width="700" class="font_big"><font class="font_green">A:</font> Accepted &nbsp; <font class="font_red">R:</font> Rejected &nbsp; <font class="font_blue">C:</font> Concessible</td>
			<td width="200">Current Page:{$now_page} / {$all_page}</td>
			<td width="64" align="right">Jump To:</td>
			<td width="110" align="right">
			<form name="jump_form" id="jump_form">
			  <select name="menu1" onchange="MM_jumpMenu('parent',this,0)" style="width:100px; margin-right:4px;">
                <option value="">Page {$now_page}</option>
                <option value="">======</option>
                <!-- {foreach from=$all_pages item=per_page} -->
				<!--{if $act neq 'search'}-->
                <option value="reports.php?nowpage={$per_page}&amp;client={$pre}&amp;active=2">Page {$per_page}</option>
				<!--{else}-->
				<option value="search.php?act={$act}&amp;nowpage={$per_page}&amp;client={$pre}&amp;category={$cat_val}&amp;keywords={$keywords}">Page {$per_page}</option>
				<!--{/if}-->
                <!-- {/foreach} -->
              </select>
			</form>			</td>
		  </tr>
		  </table>
        
      </div>
	  <!--修改报告结果部分-->
	  <div id="choiceWindow">
  <form name="chg_result" id="chg_result">
    <div id="pconfirm"></div>
	<p style=" border-top:1px solid #999999; padding-top:10px; line-height:20px;">
    <input name="tbPN" id="tbPN" type="hidden" value="" />
	<input name="tbPre" id="tbPre" type="hidden" value="" />
    Approvaled By: <select name="approvaled" id="approvaled">
    </select>
	<p/>
	<p style="line-height:20px;">
	Released &nbsp;&nbsp; By: <select name="tbModify" id="tbModify"></select> &nbsp;&nbsp;<a onClick="loadid();" style="cursor:pointer;"><b>Upload Email</b></a>
	</p>
	<p style="line-height:20px;">
	Approval Date:<input name="tbAppDate" id="tbAppDate" />
    Result:<select name="result" id="result">
      <option value='Accepted'>Accepted</option>
	  <option value='Rejected'>Rejected</option>
	  <option value="Concessed">Concessed</option>
      </select>
	</p>
    <label for="issue">Issues:</label>
	<p style="line-height:20px;">
    <textarea name="tbIssue" id="tbIssue" cols="60" rows="6"></textarea>
	</p>
    <label for="reason">Modify Reason:</label>
	<p style="line-height:20px;">
    <textarea name="tbReason" id="tbReason" cols="60" rows="6"></textarea>
	</p>
	<p>
	<label id="x" style="position: absolute;top:540px;left: 70%;font-size: 14px;" onClick="chageResult();">Change Result</label>
	</p>
  </form>
	  </div>
      <div id="backGround"></div>
      {include file="footer.dwt"}
</div>
</body>
</html>
