{include file="header.dwt"}
      <div id="list" class="f_l">
			<script type="text/JavaScript">
			  $(function() {
			/*下面这段不能删除，删掉后不能连续操作变更结果，不知道什么原因？*/  
				 var name = $( "#name" ),
				  email = $( "#email" ),
				  password = $( "#password" ),
				  allFields = $( [] ).add( name ).add( email ).add( password );
				  tips = $( ".validateTips" );
			
				$( "#dialog-form" ).dialog({
				  autoOpen: false,height: 480,width: 500,modal: true,
				  buttons: {
					"Change Result": function() {
					  tbPN = $( "#tbPN" ),
					  client= $( "#pre" ),
					  approvaled = $( "#approvaled" ),
					  tbModify = $( "#tbModify" ),
					  result = $( "#result" ),
					  tbAppDate = $( "#tbAppDate" ),
					  tbIssue = $( "#tbIssue" ),
					  tbReason = $( "#tbReason" ),
					  alldatas = $( [] ).add(tbPN).add( client ).add( approvaled ).add( tbModify ).add( result ).add( tbAppDate ).add( tbIssue ).add( tbReason );	
					  var bValid = true;
					  allFields.removeClass( "ui-state-error" );
					  if ( bValid ) {
						$.post("reports.php?act=chgresult" , alldatas
			/*关闭下面这行发邮件功能,开启时alldatas后面跟逗号			
							function(data){
			window.location.href="send_mail.php?act=chgresult&id="+data;
							}
			*/				
							);
						$( this ).dialog( "close" );
					 				}
					},
					  "Cancel": function() {
					  $( this ).dialog( "close" );}
				  },
				      "Close": function() {
					  allFields.val( "" ).removeClass( "ui-state-error" );}
				});
			 
			  });
			</script>
			<script type="text/JavaScript">
			function openresult(pre,id,cid){
					$( "#dialog-form" ).dialog( "open" );
					$.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']);
						$("#pre").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>
		  <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" 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}&client={$pre}&active=2">Page {$per_page}</option>
				<!--{else}-->
				<option value="search.php?act={$act}&nowpage={$per_page}&client={$pre}&category={$cat_val}&keywords={$keywords}">Page {$per_page}</option>
				<!--{/if}-->
                <!-- {/foreach} -->
              </select>
			</form>			</td>
		  </tr>
		  </table>
        
      </div>
	  <!--修改报告结果部分-->
	  <div id="dialog-form" title="Modify Inspection Result">
  <form name="chg_result" id="chg_result">
    <div id="pconfirm"></div>
	<p style=" border-top:1px solid #999999; padding-top:10px;">
    <input name="tbPN" id="tbPN" type="hidden" />
	<input name="pre" id="pre" type="hidden" />
    Approvaled By:<select name="approvaled" id="approvaled">
    </select><br />
	Released &nbsp;&nbsp; By:<select name="tbModify" id="tbModify"></select> &nbsp;&nbsp;<a onClick="loadid();" style="cursor:pointer;"><b>Upload Email</b></a><br />
	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>
    <label for="issue">Issues:</label>
    <textarea name="tbIssue" id="tbIssue" cols="60" rows="6"></textarea>
    <label for="reason">Modify Reason:</label>
    <textarea name="tbReason" id="tbReason" cols="60" rows="6"></textarea>
	</p>
  </form>
	</div>
      {include file="footer.dwt"}
</div>
</body>
</html>
