{include file="header.dwt"}
	<script language="javascript" type="text/javascript">
	function check_item()
	{
	  if(report_create.tbWI.value==""){
		 alert("WI Version must be selected!");
		 report_create.tbWI.focus();
	  }else if(report_create.tbInspectLevel.value==""){
		 alert("Inspection level must be filled,Please select WI Version first!");
		 report_create.tbInspectLevel.focus();
	  }else if(report_create.tbSampleSize.value==""){
		 alert("Sample Size must be filled!");
		 report_create.tbSampleSize.focus();
	  }else if(report_create.Critical.value==""){
		 alert("Critical must be filled!");
		 report_create.Critical.focus();
	  }else if(report_create.Major .value==""){
		 alert("Major must be filled!");
		 report_create.Major .focus();
	  }else if(report_create.Minor.value==""){
		 alert("Minor must be filled!");
		 report_create.Minor.focus();
	  }else if(report_create.tbCR.value==""){
		 alert("AQL CR must be filled!");
		 report_create.tbCR.focus();
	  }else if(report_create.tbMA.value==""){
		 alert("AQL MA must be filled!");
		 report_create.tbMA.focus();
	  }else if(report_create.tbMI.value==""){
		 alert("AQL MI must be filled!");
		 report_create.tbMI.focus();
	  }else if(report_create.tbPacking.value==""){
		 alert("Packing must be filled!");
		 report_create.tbPacking.focus();
	  }else if(report_create.tbStyle.value==""){
		 alert("Style, Material, Color must be filled!");
		 report_create.tbStyle.focus();
	  }else if(getRadioBoxValue('tbResult')==""){
		 alert("Inspection Result Must Be Selected!");
		 document.getElementsByName("tbResult")[0].focus();
	  }else if(report_create.tbMS.value==""){
		 alert("Manufacture Signature must be selected!");
		 report_create.tbMS.focus();
	  }else{
		 return true;
	  }	 
	  return false;
	}
	function getRadioBoxValue(radioName) 
	{  
	   var str='';
	   var obj = document.getElementsByName(radioName);
	   for(i=0;i<obj.length;i++){ 
			if(obj[i].checked){ 
			  str+=obj[i].value; 
			} 
	   }
	   return str;
	}  
	</script>
	<script language="javascript" src="ajax/ajax_report.js"></script>
    <script language="javascript" src="ajax/me.fileuploader.js"></script>
	<script language="javascript" src="ajax/ajaxfileupload.handle_v2.js"></script>
   <form action="report_create.php?act=save_report&id={$id}&client={$pre}" method="post" name="report_create" onsubmit="return check_item();">
      <div id="list" class="f_l">
      <div id="show_item"></div>
      <h2 style="text-align:center; margin-top:30px;">INSPECTION REPORT</h2>
      <TABLE width="100%" border="1" cellPadding="1" cellSpacing="1" bordercolor="#5272A9">
          <TBODY>
            <TR class="tb_title">
              <TD width="100%">&nbsp;  </TD>
            </TR>
            <TR>
              <TD><div align="center">
                <table width="98%"  border="0" cellpadding="1" cellspacing="1">
                  <tr>
                    <td width="22%"><div class="strong_r">CY PO Number：</div></td>
                    <td width="28%"><div align="left">{$rep.tbPONumber}</div></td>
                    <td width="22%"><div class="strong_r">Report Number：</div></td>
                    <td width="28%"><div align="left">{$rep.tbReportNumber}</div></td>
                  </tr>
                  <tr>
                    <td><div class="strong_r">Buyer：</div></td>
                    <td><div align="left">{$rep.client}</div></td>
                    <td><div class="strong_r">Factory：</div></td>
                    <td><div align="left">{$rep.tbCompanyName}</div></td>
                  </tr>
                  <tr>
                    <td><div class="strong_r">Inspection Date：</div></td>
                    <td><div align="left">{$rep.tbInspectionDate}</div></td>
                   <td><div class="strong_r">Factory Booking NO.：</div></td>
                   <td><div align="left">{$rep.tbFactoryBookNO} </div></td>
                  </tr>
				  <tr>
                    <td><div class="strong_r">Inspection Location：</div></td>
                    <td colspan="3"><div align="left">{$rep.tbAddress}</div></td>
                  </tr>
                </table>
              </div></TD>
            </TR>
            <TR class="tb_title">
              <TD>Inspection Criteria & Method Applied</TD>
            </TR>
            <TR>
              <TD><div align="center">
                <table width="98%"  border="0" cellpadding="1" cellspacing="1">
                  <tr>
                    <td><div class="strong_r">WI Version：</div></td>
                    <td><div align="left" class="f_red">
					     <select name="tbWI" id="tbWI" onchange="get_wi('{$rep.tbProductName}',this.value);">
                            <option value="{$rep.tbWI}">Rev.{$rep.tbWI}</option>
                            <!--{foreach from=$ver item=v}-->
							<option value="{$v.tbVersion}">Rev.{$v.tbVersion}</option>
                            <!--{/foreach}-->
                          </select>
					     (*Please Select if You Need Change WI Version)</div></td>
                    <td><div class="strong_r">Sample Plan： </div></td>
                    <td><div align="left" id="SamplePlan">{$wi_summary.tbPlan}</div></td>
                  </tr>
                  <tr>
				    <td width="22%"><div class="strong_r">Inspection Level：</div></td>
                    <td width="28%"><div align="left">
					<input name="tbInspectLevel" type="text" value="{$rep.tbInspectLevel}" id="tbInspectLevel" size="15" /></div></td>
					<td width="22%"><div class="strong_r">Sample Size：</div></td>
                    <td width="28%"><div align="left"><input name="tbSampleSize" type="text" value="{$rep.tbSampleSize}" id="tbSampleSize" size="8" /></div></td>
                  </tr>
                  <tr>
				    <td><div class="strong_r">AQL：</div></td>
                    <td>
					<div align="left">
<!--
<input name="tbAQL" type="text" id="tbAQL" size="15" value="{$rep.tbAQL}" />-->
					CR <input name="Critical" type="text" id="Critical" size="3" value="{$aql[0]}" /> , 
					MA <input name="Major" type="text" id="Major" size="3" value="{$aql[1]}" /> , 
					MI <input name="Minor" type="text" id="Minor" size="3" value="{$aql[2]}" />
					</div>					</td>
					<td><div class="strong_r">Sample Provided By：</div></td>
                    <td><div align="left">{$wi_summary.factory}</div></td>
                  </tr> 
                  <tr>
                    <td><div class="strong_r" style="line-height:30px; margin-top:2px;">Reference Standard：</div></td>
                    <td colspan="3"><div style="line-height:30px; text-align:left;">Inspection Criteria: 
					 <a href="#" target="_blank"><img src="pics/acrobat.gif" class="doc"></a>
                    Test Plan:
					<input name="tbTestPlan" type="hidden" id="tbTestPlan" value="{$rep.tbTestPlan}" />
					  <a href="#" target="_blank"><img src="pics/word.gif" class="doc"></a>
					 Kit Bom:
					<input name="tbKitBom" type="hidden" id="tbKitBom" value="{$rep.tbKitBom}" /> 
					  <a href="#" target="_blank"><img src="pics/excel.gif" class="doc"></a></div></td>
                  </tr>
                </table>
                </div></TD>
            </TR>
            <TR class="tb_title">
              <TD>Product Model & Quantity</TD>
            </TR>
            <TR>
              <TD>
			  <div align="center">
                <table width="98%"  border="0" cellpadding="1" cellspacing="1">
                  <tr>
                    <td width="22%"><div class="strong_r">Lot Quantity：</div></td>
                    <td width="28%"><div align="left" class="f_red">{$rep.tbShippingQty}</div></td>
					<td width="22%"><div class="strong_r">Service Perfomed：</div></td>
                    <td width="28%"><div align="left" class="font_blue">{$rep.tbCheckone}</div></td>
                  </tr>
				  <tr><td colspan="4"><hr width=98%></td></tr>
                </table>
				<TABLE width="95%" border="0">			  
				  
								  <TR align="middle">
									<TD><div align="center">Products Name</div></TD>
									<TD><div align="center">Model NO</div></TD>
									<TD><div align="center">PO Number </div></TD>
									<TD><div align="center">Qty</div></TD>
									<TD><div align="center">CTN</div></TD>
									<TD><div align="center">Short Qty</div></TD>
									<TD><div align="center">Serial NO </div></TD>
								  </TR>
					  <!--{if substr_count($rep.tbModelNO,'&')}--> 
								  <!--{section name=loop loop=substr_count($rep.tbModelNO,'&')+1 start='0'}-->
								  <TR align="middle" onMouseOver="this.style.backgroundColor='#E1FFDF'" onMouseOut="this.style.backgroundColor='#ffffff'">
									<TD><div align="center" class="font_blue">{$rep.tbProductName}</div></TD>
									
									<TD><div align="center">
									<!--{if $models=explode('&',$rep.tbModelNO)}-->
										<!--{if $models[$smarty.section.loop.index] neq ''}-->
	<input name="models_{$smarty.section.loop.index}" type="text" id="models_{$smarty.section.loop.index}" size="18" value="{$models[$smarty.section.loop.index]}" disabled="disabled" />
										<!--{else}-->
	<input name="models_{$smarty.section.loop.index}" type="text" id="models_{$smarty.section.loop.index}" size="18" value="" disabled="disabled" />
										<!--{/if}-->
									<!--{else}-->
									<input name="models_{$smarty.section.loop.index}" type="text" id="models_{$smarty.section.loop.index}" size="18" value="{$rep.tbModelNO}" disabled="disabled" />
									<!--{/if}--></div></TD>
									
									<TD><div align="center">
									<!--{if substr_count($rep.tbClientPONo,'&')}--> 
										<!--{if $ClientPO = explode('&',$rep.tbClientPONo)}-->
											<!--{if $ClientPO[$smarty.section.loop.index] neq ''}-->
		<input name="ClientPO_{$smarty.section.loop.index}" type="text" id="ClientPO_{$smarty.section.loop.index}" size="8" value="{$ClientPO[$smarty.section.loop.index]}" disabled="disabled" />
											<!--{else}-->
		<input name="ClientPO_{$smarty.section.loop.index}" type="text" id="ClientPO_{$smarty.section.loop.index}" size="8" value="" />
											<!--{/if}-->
										<!--{/if}-->
									<!--{else}--><input name="ClientPO_{$smarty.section.loop.index}" type="text" id="ClientPO_{$smarty.section.loop.index}" size="8" value="{$rep.tbClientPONo}" disabled="disabled" />
									<!--{/if}--></div></TD>
									
									<TD><div align="center">
									<!--{if substr_count($rep.tbShippingQty,'&')}--> 
										<!--{if $ShipQty = explode('&',$rep.tbShippingQty)}-->
											<!--{if $ShipQty[$smarty.section.loop.index] neq ''}-->
		<input name="ShipQty_{$smarty.section.loop.index}" type="text" id="ShipQty_{$smarty.section.loop.index}" size="4" value="{$ShipQty[$smarty.section.loop.index]}" />
											<!--{else}-->
		<input name="ShipQty_{$smarty.section.loop.index}" type="text" id="ShipQty_{$smarty.section.loop.index}" size="4" value="" />
											<!--{/if}-->
										<!--{/if}-->
									<!--{else}-->
									<input name="ShipQty_{$smarty.section.loop.index}" type="text" id="ShipQty_{$smarty.section.loop.index}" size="4"  value="{$rep.tbShippingQty}" />
									<!--{/if}--></div></TD>
									
									<TD><div align="center">
									<!--{if substr_count($rep.tbCTNQty,'&')}--> 
										<!--{if $CTNQty = explode('&',$rep.tbCTNQty)}-->
											<!--{if $CTNQty[$smarty.section.loop.index] neq ''}-->
		<input name="CTNQty_{$smarty.section.loop.index}" type="text" id="CTNQty_{$smarty.section.loop.index}" size="10" value="{$CTNQty[$smarty.section.loop.index]}" />
											<!--{else}-->
		<input name="CTNQty_{$smarty.section.loop.index}" type="text" id="CTNQty_{$smarty.section.loop.index}" size="10" value="" />
											<!--{/if}-->
										<!--{/if}-->
									<!--{else}-->
									<input name="CTNQty_{$smarty.section.loop.index}" type="text" id="CTNQty_{$smarty.section.loop.index}" size="10" value="{$rep.tbCTNQty}" />
									<!--{/if}--></div></TD>
									
									<TD><div align="center">
									<!--{if substr_count($rep.tbShortQty,'&')}--> 
										<!--{if $Short = explode('&',$rep.tbShortQty)}-->
											<!--{if $Short[$smarty.section.loop.index] neq ''}-->
		<input name="Short_{$smarty.section.loop.index}" type="text" id="Short_{$smarty.section.loop.index}" size="3" value="{$Short[$smarty.section.loop.index]}" />
											<!--{else}-->
		<input name="Short_{$smarty.section.loop.index}" type="text" id="Short_{$smarty.section.loop.index}" size="3" value="" />
											 <!--{/if}-->
										<!--{/if}-->
									<!--{else}-->
									<input name="Short_{$smarty.section.loop.index}" type="text" id="Short_{$smarty.section.loop.index}" size="3" value="{$rep.tbShortQty}" />
									<!--{/if}--></div></TD>
									
									<TD><div align="center">
									<!--{if substr_count($rep.tbSerialNO,'&')}--> 
										<!--{if $SerialNO = explode('&',$rep.tbSerialNO)}-->
											 <!--{if $SerialNO[$smarty.section.loop.index] neq ''}-->
		<input name="SerialNO_{$smarty.section.loop.index}" type="text" id="SerialNO_{$smarty.section.loop.index}" size="26" value="{$SerialNO[$smarty.section.loop.index]}" />
											<!--{else}-->
		<input name="SerialNO_{$smarty.section.loop.index}" type="text" id="SerialNO_{$smarty.section.loop.index}" size="26" value="" />
											<!--{/if}-->
										<!--{/if}-->
									<!--{else}-->
									<input name="SerialNO_{$smarty.section.loop.index}" type="text" id="SerialNO_{$smarty.section.loop.index}" size="26" value="{$rep.tbSerialNO}" />
									<!--{/if}--></div></TD>
								  </TR>	
								  <!--{/section}-->
					  
					  <!--{else}-->
								  <TR align="middle" onMouseOver="this.style.backgroundColor='#E1FFDF'" onMouseOut="this.style.backgroundColor='#ffffff'">
									<TD><div align="center" class="font_blue">{$rep.tbProductName}</div></TD>
									<TD><div align="center"><input name="tbModelNO" type="text" id="tbModelNO" size="18" value="{$rep.tbModelNO}" /></div></TD>
									<TD><div align="center"><input name="tbClientPONo" type="text" id="tbClientPONo" size="8" value="{$rep.tbClientPONo}" /></div></TD>
									<TD><div align="center"><input name="tbShippingQty" type="text" id="tbShippingQty" size="4" value="{$rep.tbShippingQty}" /></div></TD>
									<TD><div align="center"><input name="tbCTNQty" type="text" id="tbCTNQty" size="10" value="{$rep.tbCTNQty}" /></div></TD>
									<TD><div align="center"><input name="tbShortQty" type="text" id="tbShortQty" size="3" value="{$rep.tbShortQty}" /></div></TD>
									<TD><div align="center"><input name="tbSerialNO" type="text" id="tbSerialNO" size="26" value="{$rep.tbSerialNO}" /></div></TD>
								  </TR>	
					  <!--{/if}-->
				  </TABLE>
              </div>			 </TD>
            </TR>
			<TR class="tb_title">
              <TD>Inspection Summary</TD>
            </TR>
            <TR>
              <TD><div align="center">
                  <table width="98%"  border="0" cellpadding="2" cellspacing="2">
                    <tr>
                      <td width="22%"><div class="strong_r">Quantity：</div></td>
                      <td width="28%"><div align="left">
					<select name="tbCheckQuantity" id="tbCheckQuantity">
    <!--{if $rep.tbCheckQuantity eq 'Pass'}-->
					<option value="Pass" selected="selected">Pass</option>
					<option value="Fail">Fail</option>
	<!--{else}-->
		 			<option value="Fail" selected="selected"><font class="f_red">Fail</font></option>
					<option value="Pass">Pass</option>
	<!--{/if}-->
                    </select>
                      </div></td>
                      <td width="22%"><div class="strong_r">Packing / Label：</div></td>
                      <td width="28%"><div align="left">
				    <select name="tbCheckPacking" id="tbCheckPacking">
	<!--{if $rep.tbCheckPacking eq 'Pass'}-->                            
				    <option value="Pass" selected="selected">Pass</font></option>
					<option value="Fail">Fail</option>
	<!--{else}-->
		 			<option value="Fail" selected="selected"><font class="f_red">Fail</font></option>
					<option value="Pass">Pass</option>
	<!--{/if}-->				
                          </select>
                      </div></td>
                    </tr>
                    <tr>
                      <td><div class="strong_r">Style, Material, Color：</div></td>
                      <td><div align="left">
					      <select name="tbCheckSMC" id="tbCheckSMC">
    <!--{if $rep.tbCheckSMC eq 'Pass'}-->                            
				    <option value="Pass" selected="selected">Pass</font></option>
					<option value="Fail">Fail</option>
	<!--{else}-->
		 			<option value="Fail" selected="selected"><font class="f_red">Fail</font></option>
					<option value="Pass">Pass</option>
	<!--{/if}-->	
                          </select>
                      </div></td>
                      <td><div class="strong_r">Appearance / Function：</div></td>
                      <td><div align="left">
					      <select name="tbCheckAppearance" id="tbCheckAppearance">
    <!--{if $rep.tbCheckAppearance eq 'Pass'}-->                            
				    <option value="Pass" selected="selected">Pass</font></option>
					<option value="Fail">Fail</option>
	<!--{else}-->
		 			<option value="Fail" selected="selected"><font class="f_red">Fail</font></option>
					<option value="Pass">Pass</option>
	<!--{/if}-->	
                          </select>
                      </div></td>
                    </tr>
                    <tr>
                      <td><div class="strong_r">Data Measurement / Field Tests：</div></td>
                      <td><div align="left">
					      <select name="tbCheckMeasure" id="tbCheckMeasure">
    <!--{if $rep.tbCheckMeasure eq 'Pass'}-->                            
				    <option value="Pass" selected="selected">Pass</font></option>
					<option value="Fail">Fail</option>
	<!--{else}-->
		 			<option value="Fail" selected="selected">Fail</font></option>
					<option value="Pass">Pass</option>
	<!--{/if}-->	
                          </select>
                      </div></td>
                      <td><div align="right"><input id="path" name="path" type="hidden" value="{$pre}"></div></td>
                      <td><div align="left"></div></td>
                    </tr>
                  </table>
              </div></TD>
            </TR>
            <TR class="tb_title">
              <TD>Inspection Result</TD>
            </TR>
            <TR>
              <TD><div align="center">
                <table width="98%"  border="0" cellpadding="2" cellspacing="2">
                  <tr height="35">
                    <td width="22%"><div class="strong_r">Inspection Result：</div></td>
					<td colspan="3">
					<div id="list_result">
					     <ul>
						 	 <li style="margin-left:60px;">
<!--{if $rep.tbResult eq 'Accepted'}-->
<input name="tbResult" type="radio" value="Accepted" checked="checked" />
<!--{else}-->
<input name="tbResult" type="radio" value="Accepted" />
<!--{/if}-->
<strong>Accepted</strong>							 </li>
					         <li>
<!--{if $rep.tbResult eq 'Rejected'}-->
<input name="tbResult" type="radio" value="Rejected" checked="checked" />
<!--{else}-->
<input name="tbResult" type="radio" value="Rejected" />
<!--{/if}-->
<strong>Rejected</strong></li>
							 <li>
<!--{if $rep.tbResult eq "Concessed"}-->						
<input name="tbResult" type="radio" value="Concessed" checked="checked" />
<!--{else}-->
<input name="tbResult" type="radio" value="Concessed" />
<!--{/if}-->
<strong>Concessed</strong>							 </li>
						</ul>
					</div>					</td>
                  </tr>
                  <tr>
                    <td width="22%"><div class="strong_r">Manufacture Signature： </div></td>
                    <td width="28%"><div align="left">
					      <select name="tbMS" id="tbMS">
<!--{foreach from=$factory_user item=fus}-->
<!--{if $fus.tbName eq $rep.tbMS}-->
<option value="{$fus.tbName}" selected="selected">{$fus.tbName}</option>
<!--{else}-->							
<option value="{$fus.tbName}">{$fus.tbName}</option>
<!--{/if}-->
<!--{/foreach}-->
                          </select></div></td>
                    <td width="22%"><div class="strong_r">Signature Date：</div></td>
                    <td width="28%"><div align="left">{$rep.tbReportDate}</div></td>
                  </tr>
                  <tr>
                    <td><div class="strong_r">Report Submit By ：</div></td>
                    <td><div align="left"><input name="tbJudge" type="text" id="tbJudge" size="20" value="{$rep.tbJudge}" /></div></td>
                    <td><div class="strong_r">Signature Date：</div></td>
                    <td><div align="left">{$rep.tbReportDate}</div></td>
                  </tr>
                </table>
                </div></TD>
            </TR>
			<TR class="tb_title">
              <TD>Appearance / Function Inspection Findings</TD>
            </TR>
            <TR>
              <TD><div id="list_defects">
					   <div class="t_line">
							<li style="width:140px;">Category </li>
							<li style="width:240px;">Topical </li>
							<li style="width:300px;">Defect Description </li>
							<li style="width:210px;">Serial NO. </li>
							<li>Critical </li>
							<li>Major </li>
							<li>Minor </li>
							<li style="width:80px; margin-left:20px;">Add/Remove </li>
					  </div>
 				      <div id="show_defects">
					     <!--{foreach from=$defects item=de}-->
						  <div class='b_line'>
								<li style='width:140px;'>&nbsp;{$de.tbCategory}&nbsp;</li>
								<li style='width:240px;'>&nbsp;{$de.tbTopical}&nbsp;</li>
								<li style='width:300px;'>&nbsp;{$de.tbDefection}&nbsp;</li>
								<li style='width:210px;'>&nbsp;{$de.tbSerial_NO}&nbsp;</li>
								<li style='width:50px;'>&nbsp;{$de.tbCritical}&nbsp;</li>
								<li style='width:50px;'>&nbsp;{$de.tbMajor}&nbsp;</li>
								<li style='width:50px;'>&nbsp;{$de.tbMinor}&nbsp;</li>
								<li style='width:80px; margin-left:20px;'>
								   <img src='pics/edit.png' onclick='editdefect("{$pre}","{$de.tbFN}","{$de.tbReportNumber}");' title='Edit(编辑)' style="cursor:pointer;" />
								   <img src='pics/remove.png' onclick='deldefect("{$pre}","{$de.tbFN}","{$de.tbReportNumber}");' title='Remove(删除)' style="cursor:pointer;" />								</li>
						  </div>
					     <!--{/foreach}-->
					  </div>
					  <div class="b_line">
							<li style="width:140px;">
								  <select name="tbCategory" id="tbCategory" style="width:100px;" onchange="get_topic();">
									  <option value=''>==Select==</option>
									  <option value="Function" >Function</option>
									  <option value="Cosmetic" >Cosmetic</option>
									  <option value="Packing" >Packing</option>            
									  <option value="Other" >Other</option>                  
								  </select>
							</li>
							<li style="width:240px;">
								  <select name="tbTopical" id="tbTopical" style="width:160px;" onchange="get_defect();">
									  <option value=''>==Select==</option>                   
								  </select>
							</li>
							<li style="width:300px;">
								  <input name="tbDefection" type="text" id="tbDefection" size="25">
							</li>
							<li style="width:210px;">
								  <input name="tbSerial_NO" type="text" id="tbSerial_NO" size="20">
							</li>
							<li>
								  <input name="tbCritical" type="text" id="tbCritical" size="2">
							</li>
							<li>
								  <input name="tbMajor" type="text" id="tbMajor" size="2">
							</li>
							<li>
								  <input name="tbMinor" type="text" id="tbMinor" size="2">
							</li>
							<li style="width:80px; margin-left:20px;">
							  <input name="tbFN" type="hidden" id="tbFN" value="" size="8">
							  <img src="pics/save.png" onclick="save_defect('{$pre}','{$rep.tbReportNumber}');" title="Save(保存)" style="cursor:pointer;" />
							  <img src="pics/add.png" onclick="adddefect();" title="Add(增加)" style="cursor:pointer;" />							</li>
					  </div>
				 </div>
                  <div align="center" class="upload-img">
                      <input type="file" id="appearance_img" name="appearance_img[]" nctype="ajaxupfile" multiple="multiple" accept="image/*" filetype="jpg|jpeg|png|gif" maxsize="2">
                      <div class="preview-img" id="appearance_preview_img">
                          <ul>
                              <!--{foreach from=$pic.tbAppearanceimg item=de}-->
                              <li>
							  		<img src="../upload/files/{$pre}/defects/{$de}" alt="{$de}">
							  <input type="hidden" name="appearance_upload[]" value="{$de}"><div class="delete-img">删除</div></li>
                              <!--{/foreach}-->
                          </ul>
                      </div>
                  </div>			  </TD>
            </TR>
			<TR>
              <TD style=" border:none;">
			  <div align="center">
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<tr class="strong_l">
				  <td align="right" width="65%">&nbsp; Maximum Allowed: </td>
				  <td align="center">CR <input name="tbCR" type="text" id="tbCR" size="6" value="{$rep.tbCR}"></td>
				  <td align="center">MA <input name="tbMA" type="text" id="tbMA" size="6" value="{$rep.tbMA}"></td>
				  <td align="center">MI <input name="tbMI" type="text" id="tbMI" size="6" value="{$rep.tbMI}"></td>
				</tr>
				</table>
				<table width="94%"  border="0" cellpadding="1" cellspacing="1">
					    <tr class="strong_l"><td align="left">Remark:</td></tr>
						<tr><td><textarea name="tbSupplement" id="tbSupplement" cols="142" rows="4">{$rep.tbSupplement}</textarea></td>
						</tr>
				 </table>
			  </div> 			  </TD>
            </TR>
						<TR class="tb_title">
              <TD>Data Measurement / Field Tests</TD>
            </TR>
            <TR>
              <TD><div id="list_points">
					   <div class="p_line">
					   		<li style="width:30px; padding:3px 0 3px 0;">SN </li>
							<li style="width:360px;">Check Points </li>
							<li style="width:50px;">Qty </li>
							<li style="width:80px;">Test Result </li>
							<li style="width:380px;">Specification/Tolerance </li>
							<li style="width:120px;">Options</li>
							<li style="width:80px; margin-left:20px;">Add/Remove </li>
					  </div>
					  <hr>
 				      <div id="show_points">
					     <!--{foreach from=$tested item=te}-->
						  <div class='c_line'>
						  		<li style="width:30px; padding:3px 0 3px 0;">{$te.tbPosition}: </li>
								<li style='width:360px;'>&nbsp;
				<!--{if strpos($te.tbTestedID,',')}-->
					{$testedf}
				<!--{else}-->
					{$te.tbCheckPoint}
				<!--{/if}-->
				&nbsp;</li>
								<li style='width:50px;'>&nbsp;{$te.tbQty}&nbsp;</li>
								<li style='width:80px;'>&nbsp;{$te.tbResult}&nbsp;</li>
								<li style='width:380px;'>&nbsp;{$te.tbSpec}&nbsp;</li>
								<li style='width:120px;'>&nbsp;&nbsp;&nbsp;&nbsp;</li>
								<li style='width:80px;margin-left:20px;'>
								   <img src='pics/edit.png' onclick='editpoint("{$pre}","{$te.tbTN}","{$te.tbReportNo}","{$te.tbPosition}");' title='Edit(编辑)' style="cursor:pointer;" />
								   <img src='pics/remove.png' onclick='delpoint("{$pre}","{$te.tbTN}","{$te.tbReportNo}");' title='Remove(删除)' style="cursor:pointer;" />								</li>
						  </div>
					     <!--{/foreach}-->
					  </div>
					  <hr>
					  <table width="100%"  border="0" cellpadding="0" cellspacing="0">
					    <tr><td width="78%" align="left" style="border-bottom:1px solid #666666; padding-bottom:10px;">
					  <div class="c_line">
					  		<li style="width:30px; padding-top:3px 0 3px 0;">0: </li>
							<li style="width:360px;">
							  <input name="fuTest" id="fuTest" value="{$fuTest}" style="width:360px;" disabled="disabled"><input name="tbTestedID_0" id="tbTestedID_0" value="{$tbTest}" type="hidden">							
							</li>
							<li style="width:50px;">
							  <input name="tbQty_0"  id="tbQty_0" type="text" size="2" value="{$rep.tbSampleSize}">
							</li>
							<li style="width:70px;">
							  <select name="tbTestResult_0" id="tbTestResult_0" style="width:70px;">
                          <option value="Pass" selected="selected">Pass</option>
                          <option value="Fail">Fail</option>
                        </select>
							</li>
							<li style="width:380px;">
							  <input name="tbSpec_0" id="tbSpec_0" type="text" size="50" value="">
							</li>
							</div>
							</td><td width="18%" style="border-bottom:1px solid #666666; padding-bottom:10px;">

<input name="tbTN_0" id="tbTN_0" type="hidden" value="" size="8">
<input name="Per" id="Per" type="radio" title="Get general criteria" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Per',0);">Per

<input name="Plan" id="Plan" type="radio" title="Get test plan file name" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Plan',0);">Plan
<input name="Kit" id="Kit" type="radio" title="Get Kitbom file name" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Kit',0);">Kit <input name="Spec" id="Spec" type="radio" title="Per factory spec." value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Spec',0);">Spec</td><td style="border-bottom:1px solid #666666; padding:0 5px 10px 5px;"><input type="button" value="Save" name="save_0" id="save_0" onclick="save_point('{$pre}','{$rep.tbReportNumber}',0);" title="Save(保存)" style="cursor:pointer;" />
							  </td>
						</tr>
<!--{foreach from=$meTest key=k item=me }-->					    <!--{foreach from=$me key=tbTestedID item=con }-->
						<tr><td width="78%" align="left" style="border-bottom:1px solid #666666; padding-bottom:10px;">
					  <div class="c_line">
					  		<li style="width:30px; padding:3px 0 3px 0;">{$k+1}: </li>
							<li style="width:360px;">
							  <select name="tbTestedID_{$k+1}" id="tbTestedID_{$k+1}" style="width:360px;">
								<!--{foreach from=$tests item=test }-->		
			<!--{if $test.tbSN eq $tbTestedID}-->
									<option value='{$test.tbSN}' selected="selected">{$test.tbCheckPoint}</option>		
			<!--{else}-->				
		<option value='{$test.tbSN}'>{$test.tbCheckPoint}</option>
			<!--{/if}-->
                                <!--{/foreach}-->
                              </select>
							</li>
							<li style="width:50px;">
							  <input name="tbQty_{$k+1}" id="tbQty_{$k+1}" type="text" size="2" value="{$rep.tbSampleSize}">
							</li>
							<li style="width:80px;">
							  <select name="tbTestResult_{$k+1}" id="tbTestResult_{$k+1}" style="width:80px;">
                          <option value="Pass" selected="selected">Pass</option>
                          <option value="Fail">Fail</option>
                        </select>
							</li>
							<li style="width:380px;">
							  <input name="tbSpec_{$k+1}" id="tbSpec_{$k+1}" type="text" size="50" value="">
							</li>
							</div>
							</td><td width="18%" style="border-bottom:1px solid #666666; padding-bottom:10px;">

<input name="tbTN_{$k+1}" id="tbTN_{$k+1}" type="hidden" value="" size="8">
<input name="Per" id="Per" type="radio" title="Get general criteria" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Per',{$k+1});">Per

<input name="Plan" id="Plan" type="radio" title="Get test plan file name" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Plan',{$k+1});">Plan
<input name="Kit" id="Kit" type="radio" title="Get Kitbom file name" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Kit',{$k+1});">Kit <input name="Spec" id="Spec" type="radio" title="Per factory spec." value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Spec',{$k+1});">Spec <input name="AC" id="AC" type="radio" title="V:100-240V, Freq:50/60HZ" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'AC',{$k+1});">AC <input name="Hi" id="Hi" type="radio" title="3000V AC, 5mA, 2S" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Hi',{$k+1});">Hi <input name="Run" id="Run" type="radio" title="On rated voltage at least 2 hours" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Run',{$k+1});">Run <input name="BT" id="BT" type="radio" title="Per factory spec:10M" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'BT',{$k+1});">BT <input name="Rub" id="Rub" type="radio" title="Rub 15s with cotton with 75% alcohol" value="1" onClick="get_wi('{$pre}','{$rep.tbProductName}',this.value,'Rub',{$k+1});">Rub</td><td style="border-bottom:1px solid #666666; padding:0 5px 10px 5px;"><input type="button" value="Save" name="save_{$k+1}" id="save_{$k+1}" onclick="save_point('{$pre}','{$rep.tbReportNumber}',{$k+1});" title="Save(保存)" style="cursor:pointer;" />
</td></tr>
    <!--{/foreach}-->
<!--{/foreach}-->
</table>
				 </div>
                  <div align="center" class="upload-img">
                    <input type="file" id="test_img" name="test_img[]" nctype="ajaxupfile" multiple="multiple" accept="image/*" filetype="jpg|jpeg|png|gif" maxsize="2">
                    <div class="preview-img" id="test_preview_img">
                          <ul>
                              <!--{foreach from=$pic.tbTestimg item=de}-->
                              <li><img src="../upload/files/{$pre}/testimg/{$de}" alt="{$de}"><input type="hidden" name="test_upload[]" value="{$de}"><div class="delete-img">删除</div></li>
                              <!--{/foreach}-->
                          </ul>
                    </div>
                </div>			  </TD>
            </TR>
            <TR class="tb_title">
              <TD>Style, Material, Color</TD>
            </TR>
            <TR>
              <TD>
					<div align="center"><textarea name="tbStyle" id="tbStyle" cols="142" rows="4">{$rep.tbStyle}</textarea></div>
                  <div align="center" class="upload-img"><input type="file" id="style_img" name="style_img[]" nctype="ajaxupfile" multiple="multiple" accept="image/*" filetype="jpg|jpeg|png|gif" maxsize="2"></div>
                  <div class="preview-img" id="style_preview_img">
                      <ul>
                          <!--{foreach from=$pic.tbStyleimg item=de}-->
                          <li>
						  		<img src="../upload/files/{$pre}/styleimg/{$de}" alt="{$de}"><input type="hidden" name="style_upload[]" value="{$de}"><div class="delete-img">删除</div></li>
                          <!--{/foreach}-->
                      </ul>
                  </div>              </TD>
			</TR>
			 <TR class="tb_title">
              <TD>Packing Method / Label</TD>
            </TR>
            <TR>
              <TD>
			        <div align="center"><textarea name="tbPacking" id="tbPacking" cols="142" rows="20">{$rep.tbPacking}</textarea></div>
			        <div align="center" class="upload-img"><input type="file" id="pack_img" name="pack_img[]" nctype="ajaxupfile" multiple="multiple" accept="image/*" filetype="jpg|jpeg|png|gif" maxsize="2"></div>
                  <div class="preview-img" id="pack_preview_img">
                      <ul>
                          <!--{foreach from=$pic.tbPackimg item=de}-->
                          <li>
						  		<img src="../upload/files/{$pre}/packimg/{$de}" alt="{$de}">
						  <input type="hidden" name="pack_upload[]" value="{$de}"><div class="delete-img">删除</div></li>
                          <!--{/foreach}-->
                      </ul>
                  </div>			  </TD>
			</TR>
			<TR class="tb_title">
              <TD> &nbsp;&nbsp;</TD>
			</TR>
		  </TBODY>
		</TABLE>
		<div style="width:100%; text-align:center; float:left; margin-top:8px;"><input name="Close" type="button" value="Close Page" onclick="javascript:self.close();"/><input name="GoBack" type="button" value="Go Back To Report Page" onclick="location.href='reports.php?client={$pre}'" />
		<input name="Save" type="submit" value="Save Report" /></div>
     </div>
      {include file="footer.dwt"}
	</form>	 
</div>
<script>
	var appearanceImgTpl = '<li><img src="(imgSrc)" alt="(sourceFileName)"><input type="hidden" name="appearance_upload[]" value="(fileName)"><div class="delete-img">删除</div></li>';
	var testImgTpl = '<li><img src="(imgSrc)" alt="(sourceFileName)"><input type="hidden" name="test_upload[]" value="(fileName)"><div class="delete-img">删除</div></li>';
    var packImgTpl = '<li><img src="(imgSrc)" alt="(sourceFileName)"><input type="hidden" name="pack_upload[]" value="(fileName)"><div class="delete-img">删除</div></li>';
    var styleImgTpl = '<li><img src="(imgSrc)" alt="(sourceFileName)"><input type="hidden" name="style_upload[]" value="(fileName)"><div class="delete-img">删除</div></li>';
    var appearance_preview_img = $("#appearance_preview_img"),test_preview_img = $("#test_preview_img"),style_preview_img = $("#style_preview_img"),pack_preview_img = $("#pack_preview_img");
    function previewImg(id, data) {
        console.log(id,data);
        switch(id){
            case 'pack_img':
                var previewImgLi = '';
                for(var i=0;i<data.length;i++){
                    previewImgLi += packImgTpl.replace(/\(imgSrc\)/g, '../upload/files/{$pre}/packimg/'+data[i].realFileName).replace(/\(fileName\)/g, data[i].realFileName).replace(/\(sourceFileName\)/g, data[i].sourceFileName);
                }
//                console.log(previewImgLi);
                pack_preview_img.find('ul').append(previewImgLi);
                break;
			case 'test_img':
                var previewImgLi = '';
                for(var i=0;i<data.length;i++){
                    previewImgLi += testImgTpl.replace(/\(imgSrc\)/g, '../upload/files/{$pre}/testimg/'+data[i].realFileName).replace(/\(fileName\)/g, data[i].realFileName).replace(/\(sourceFileName\)/g, data[i].sourceFileName);
                }
//                console.log(previewImgLi);
                test_preview_img.find('ul').append(previewImgLi);
                break;
            case 'style_img':
                var previewImgLi = '';
                for(var i=0;i<data.length;i++){
                    previewImgLi += styleImgTpl.replace(/\(imgSrc\)/g, '../upload/files/{$pre}/styleimg/'+data[i].realFileName).replace(/\(fileName\)/g, data[i].realFileName).replace(/\(sourceFileName\)/g, data[i].sourceFileName);
                }
//                console.log(previewImgLi);
                style_preview_img.find('ul').append(previewImgLi);
                break;
            case 'appearance_img':
                var previewImgLi = '';
                for(var i=0;i<data.length;i++){
                    previewImgLi += appearanceImgTpl.replace(/\(imgSrc\)/g, '../upload/files/{$pre}/defects/'+data[i].realFileName).replace(/\(fileName\)/g, data[i].realFileName).replace(/\(sourceFileName\)/g, data[i].sourceFileName);
                }
//                console.log(previewImgLi);
                appearance_preview_img.find('ul').append(previewImgLi);
                break;
        }

    }

    $(document).on("click", '.delete-img', function(){
       $(this).parents('li').remove();
    });
</script>
</body>
</html>
