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

     

     <link href="../style/gv_paging.css" rel="stylesheet" />
        
     <br /> 

   

    
    
    <div style="margin:20px;" class="form-inline">
         

    BOM物品名称<asp:TextBox runat="server" CssClass="form-control"  ID="txt_bomname"></asp:TextBox>&nbsp;&nbsp;

     客户名<asp:TextBox runat="server"  CssClass="form-control"  ID="txt_customername"></asp:TextBox>&nbsp;&nbsp;

   报价单号<asp:TextBox runat="server"   CssClass="form-control"  ID="txt_quotecode"></asp:TextBox>&nbsp;&nbsp;


       
          <asp:Button runat="server" ID="btn_search" Text="查询" CssClass="btn btn-primary" />

 
    
    </div>
    
    <asp:GridView runat="server" ID="gv_list"        
         AutoGenerateColumns="false" GridLines="None" 
        AllowPaging="true" 
        PageSize="10" class="table   table-hover"
      
         DataSourceID="SqlDataSource1">
        <Columns>


            <asp:HyperLinkField DataNavigateUrlFields="bomid" DataTextField="productname" 
                
                 HeaderStyle-Width="100px" Target="_blank"  DataNavigateUrlFormatString="bom_detail.aspx?id={0}"
                 HeaderText="BOM成品名称"
                />
              
              <asp:BoundField DataField="productcode"    HeaderText="BOM编号"  HeaderStyle-Width="90px" />   
              <asp:BoundField DataField="bomrevision"    HeaderText="BOM版本号"  HeaderStyle-Width="80px" />  
             
                 <asp:BoundField DataField="customername"    HeaderText="客户名"  HeaderStyle-Width="90px" />  
         
                 <asp:BoundField DataField="customercode"    HeaderText="客户号"  HeaderStyle-Width="60px" />  
         

               <asp:HyperLinkField DataNavigateUrlFields="quoteid" DataTextField="quotecode" 
                
                 HeaderStyle-Width="100px" Target="_blank"  DataNavigateUrlFormatString="quote_detail.aspx?id={0}"
                 HeaderText="报价单号"
                />
              

              

              <asp:BoundField DataField="quote_revision"    HeaderText="报价单版本"  HeaderStyle-Width="80px" />  


              <asp:BoundField DataField="sellname"    HeaderText="销售人员"  HeaderStyle-Width="90px" />  

                <asp:BoundField DataField="piece"    HeaderText="单位"  HeaderStyle-Width="90px" />  

               <asp:BoundField DataField="price"    HeaderText="单价"  HeaderStyle-Width="90px" />  

                <asp:BoundField DataField="note"    HeaderText="报价说明"  HeaderStyle-Width="200px" />  

             

        </Columns>
            <PagerStyle CssClass="pagination-ys" />
    </asp:GridView>

     
   


      









    
    <asp:SqlDataSource ID="SqlDataSource1"
    
     ConnectionString="<%$ConnectionStrings:ConnectionString %>"
     runat="server" 


 




    SelectCommand="

        select 
purchase_bom.id as bomid,
purchase_bom.productname, 
purchase_bom.productcode, 
purchase_bom.revision as bomrevision, 
purchase_bom.designname, 
purchase_bom.customername ,
purchase_bom.customername,
purchase_bom.customercode,

quotecode,
purchase_quote.id as quoteid,
sellname,
purchase_quote.revision as quote_revision,
purchase_quote.price,
        purchase_quote.piece,
            purchase_quote.note
from purchase_bom inner join


purchase_quote
on purchase_bom.id=purchase_quote.bomid
         
            where (@bomname='' or purchase_bom.productname+purchase_bom.productcode like '%'+@bomname+'%')
        and   (@customername='' or purchase_bom.customername+purchase_bom.customercode like '%'+@customername+'%')
         and   (@quotename='' or quotecode like '%'+@quotename+'%')
        

 order by purchase_bom.id desc 


        ">









        <SelectParameters>

            <asp:ControlParameter ControlID="txt_bomname" Name="bomname" ConvertEmptyStringToNull="false" />
               <asp:ControlParameter ControlID="txt_customername" Name="customername" ConvertEmptyStringToNull="false" />
               <asp:ControlParameter ControlID="txt_quotecode" Name="quotename" ConvertEmptyStringToNull="false" />
             
        </SelectParameters>


    </asp:SqlDataSource>


     

     





    <script>

        function _del(obj,_id, _defaults)
        {
            
            if (_defaults == "0") {
                $.ajax({
                    url: "ajax/del_mat_sup_relation.aspx",
                    data: { id: _id, defaults: _defaults },
                    success: function (data) {
                        $(obj).parent().parent().remove();
                    }
                })
            }
            else {

               

                $.ajax({
                    url: "ajax/del_mat_sup_relation.aspx",
                    data: { id: _id, defaults: _defaults },
                    success: function (data) {
                         
                        $(obj).parent().parent().find("td:eq(6)").html('');
                        $(obj).parent().parent().find("td:eq(7)").html('');
                    }
                })


            }
             
        }

    </script>



























</asp:Content>
