<%@ Page Title="" Language="C#" MasterPageFile="~/bps/basic.Master" AutoEventWireup="true" CodeBehind="add_bom_product.aspx.cs" Inherits="bps.bps.add_bom_product" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


      <script src="../javascript/layer/layer.js"></script>
    <div style="margin:10px; font-size:12px;">

   <style>
       .num {
        width:70px;
       }
   </style>
      
     <div class="form-inline">

  
     成品名称 <asp:TextBox runat="server" ID="txt_key" CssClass="form-control inline" Width="220px"  ></asp:TextBox>
    <asp:Button ID="btn_search"   OnClick="btn_search_Click" runat="server" Text="搜索" class="btn btn-sm  btn-primary btn-flat" />
       
  </div>
 


    

<asp:ListView ID="ListView1" runat="server"  EnableViewState="false"
    DataKeyNames="id" 
    DataSourceID="SqlDataSource1" 
  
     >
                   <LayoutTemplate>
                  
              <table id="itemPlaceholderContainer" runat="server" class="table  ">
                                        <tr    >
                                           
                                    
                                            <th runat="server"  width="80px">成品编号</th>
                                            <th runat="server"  width="150px">成品名称</th>  
                                        
                                             <th runat="server"  width="90px">版本号</th>  
                                

                                             <th   runat="server"  width="150px">客户名称</th>  

                                            <th runat="server"  width="70px">客户编号</th>
                                       

                                            <th runat="server"  width="100px">设计日期</th>
                                               
                                              

                                          <th runat="server"    width="70px">复制物料</th>  

                                              
                                          
                                       
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                
                    </LayoutTemplate>
    
      
                    <ItemTemplate>
                        <tr>
                          
                            
                            
                            <td>
                                 <asp:HiddenField runat="server" ID="hf_id"   value='<%# Eval("id") %>'/>
                                <asp:Label ID="lbl_code" runat="server" Text='<%# Eval("productcode") %>' />
                         
                            </td>
                            
                            <td>
                               
                               <%# Eval("productname") %> 
                            </td>
                             

                              <td>
                               <%# Eval("revision") %> 
                             </td>



                            
                            <td>
                                    <%# Eval("customername") %> 
                       
                            </td>


                            <td>
                              <%# Eval("customercode") %> 

                      
                            </td>

                              
                             <td>
                              <%#  DtHelper.FormatDt(Eval("designdate")) %> 

                      
                            </td>

                              <td>
                              
                                   <a href="###" onclick="_add(this,<%#Eval("id")%> );">复制物料</a>

                            </td>
                           
                            


                          
                           

                          
                           

                     

                            
                        </tr>
                    </ItemTemplate>
                   
   

     </asp:ListView>
                 
 











<div>
 <asp:DataPager ID="DataPager1"   class="btn-group btn-group-sm"  
      PagedControlID="ListView1" runat="server" PageSize=20>
 <Fields>
           
     
            <asp:NextPreviousPagerField 
                PreviousPageText="<" 
                FirstPageText="|<" 
                ShowPreviousPageButton="true"
                ShowFirstPageButton="true" 
                ShowNextPageButton="false" 
                ShowLastPageButton="false"
                ButtonCssClass="btn btn-default" 
                RenderNonBreakingSpacesBetweenControls="false" 
                RenderDisabledButtonsAsLabels="false" />

            <asp:NumericPagerField 
                ButtonType="Link" 
                CurrentPageLabelCssClass="btn btn-primary disabled"  
                RenderNonBreakingSpacesBetweenControls="false"
                NumericButtonCssClass="btn btn-default" 
                ButtonCount="10" 
                NextPageText="..." 
                NextPreviousButtonCssClass="btn btn-default" />
            
           <asp:NextPreviousPagerField 
               NextPageText=">" 
               LastPageText=">|" 
               ShowNextPageButton="true"
               ShowLastPageButton="true" 
               ShowPreviousPageButton="false" 
               ShowFirstPageButton="false"
               ButtonCssClass="btn btn-default" 
               RenderNonBreakingSpacesBetweenControls="false" 
               RenderDisabledButtonsAsLabels="false"/>
      

  </Fields> 
</asp:DataPager>
</div>



     




  <asp:SqlDataSource ID="SqlDataSource1" 
    
     ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
    runat="server"  
        SelectCommand="  select id, productname, productcode, customername,customercode, revision,designdate from purchase_bom where (@key='' or productname like '%'+@key+'%') and id<>@id     ORDER BY [id] DESC" 
       
         
 
  >
       
        <SelectParameters>
              <asp:ControlParameter ControlID="txt_key" Name="key" Type="String"  ConvertEmptyStringToNull="false" />
            <asp:QueryStringParameter Name="id" QueryStringField="id" ConvertEmptyStringToNull="false"/>
        </SelectParameters>
         
 
  
  
 
 
 </asp:SqlDataSource>

 






        
    <script>

        function _add(obj,_mid)
        {
        

            if(confirm('确定要把组成此成品的物料清单复制到现有的成品里去吗？'))
            {
             
             $.get("ajax/ajax_bom_add_item.aspx?t=batch&bomid=<%=Request.QueryString["id"]%>&mid="+_mid); 
            $(obj).hide();
            layer.msg("添加成功，刷新后显示");
            }

        }



    </script>













     </div>



</asp:Content>
