<%@ Page Title="" Language="C#"   MasterPageFile="bps.Master" AutoEventWireup="true" CodeBehind="material_list.aspx.cs" Inherits="purchase.purchase.Product_Lists" %>

<%@ Register src="../UserControl/CatTab.ascx" tagname="CatTab" tagprefix="uc1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <h1  class="border-active subnav" ><%=isen?"Material List":"原料列表" %>  </h1>

   

      <uc1:CatTab ID="CatTab" runat="server"  currentindex="0" />
    


    <style>
        .theread {
         font-weight:bold; color:red;
        }
        .bgselect {
         background-color:orange; 
         font-weight:bold;
        } 
    </style>

     
             <div  >

 
 

 

        
         <!-- Right1 -->
         
               

                
                <asp:UpdatePanel runat="server" ID="pls"  >
                   
                    
                     <ContentTemplate>



<div style=" background-color:#f9f9f9; margin:10px 0px;  padding:8px;" class="form-inline">
      
 
 <asp:DropDownList runat="server"  Width="200px"  CssClass="form-control inline" ID="ddl_cat1" AutoPostBack="True" OnSelectedIndexChanged="ddl_cat1_SelectedIndexChanged"></asp:DropDownList>
      <asp:DropDownList runat="server"  Width="200px"  ID="ddl_cat2" CssClass="form-control inline" AutoPostBack="True" OnSelectedIndexChanged="ddl_cat2_SelectedIndexChanged"></asp:DropDownList>
    
      
     物品名称 <asp:TextBox runat="server" ID="txt_key" CssClass="form-control inline" Width="220px" placeholder="物品编号/物品名称/VNr/供应商"></asp:TextBox>
    <asp:Button ID="btn_search"   OnClick="btn_search_Click" runat="server" Text="搜索" class="btn btn-sm  btn-primary btn-flat" />
       
  
     
&nbsp; | &nbsp; 
 
 
    <asp:LinkButton runat="server" CssClass="btn btn-danger btn-sm" ID="btn_del" Text="删除"  OnClientClick="if(!isselect()) return false; return confirm('确认删除吗'); " OnClick="btn_del_Click"></asp:LinkButton>

    
     <a href="javascript:void(0)" onclick="if(!isselect()) return false; _Move()" class="btn btn-sm btn-success">移动</a>

    
 &nbsp; | &nbsp;

      <asp:LinkButton runat="server" CssClass="btn btn-sm btn-primary" ID="lb_edit" Text="批量编辑"  OnClick="btn_edit_Click"></asp:LinkButton>
    <asp:LinkButton runat="server" CssClass="btn btn-sm  btn-success" ID="lb_update" Text="更新"  OnClick="btn_update_Click"></asp:LinkButton>
     <asp:LinkButton runat="server" CssClass="btn btn-sm  btn-default" ID="lb_cancel" Text="取消"  OnClick="btn_calcel_Click"></asp:LinkButton>

     &nbsp; | &nbsp;

    

    <a href="javascript:void(0);" onclick="ept('Export_Data.aspx?types=productlist'); return false;" class="btn btn-sm bg-fuchsia">导出</a> 

    <a href="javascript:void(0);" onclick="ept('Import_Data.aspx?types=productlist'); return false;" class="btn btn-sm bg-maroon">导入</a>

      &nbsp; | &nbsp;
    <a href="###" onclick="Pop('material_addEdit.aspx',1250,650,'添加原料');" class="btn btn-primary btn-sm" ><%=isen?"Add Material":"添加原料" %>  </a>  

</div>



<asp:ListView ID="ListView1" runat="server" 
    DataKeyNames="id" 
    DataSourceID="SqlDataSource1" 
    OnItemDataBound="ListView1_ItemDataBound" 
     >
                   <LayoutTemplate>
                  
              <table id="itemPlaceholderContainer" runat="server" class="table  ">
                                        <tr    >
                                            <th runat="server" width="40px">
                                               <input type="checkbox"  class="ck_all"  id="cb_selectall"  />
                                            </th>
                                    
                                            <th runat="server"  width="80px">物品编号</th>
                                            <th runat="server"  width="140px">物料名称</th>  
                                        
                                             <th runat="server"  width="170px">规格型号</th>  
                                             <th runat="server"   width="70px">供应商料号</th>

                                             <th   runat="server"  width="80px">V.Nr</th>  

                                            <th runat="server"  width="70px">单位</th>
                                       

                                            <th runat="server"  width="80px">参考价格</th>
                                               

                                               <th runat="server"  width="70px">MOQ</th>  


                                          <th runat="server"    width="70px">LeadTime(天)</th>  

                                             
                                           
                                          <th   width="70px">采购负责人</th>  
                                          
                                       
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                
                    </LayoutTemplate>
    
      
                    <ItemTemplate>
                        <tr>
                            <td>
                              <input type="checkbox" class="ck_item" value='<%# Eval("id") %>'/>  
                                <asp:HiddenField runat="server" ID="hf_id"   value='<%# Eval("id") %>'/>
                            </td>
                            
                            
                            <td>
                                <asp:Label ID="lbl_code" runat="server" Text='<%# Eval("code") %>' />
                                <asp:TextBox ID="txt_code" Width="80px" runat="server" Text='<%# Eval("code") %>' />

                            </td>
                            
                            <td>
                               

                         <asp:PlaceHolder runat="server" ID="pl_catname"> 
                              <a href='###' onclick=Pop("material_addEdit.aspx?id=<%# Eval("id") %>",1250,650,'编辑原料');   >
                                   <asp:Label ID="lbl_catname" runat="server" Text='<%# Eval("catname") %>' />
                              </a>
                          </asp:PlaceHolder>

                           <asp:TextBox ID="txt_catname" Width="100px" runat="server" Text='<%# Eval("catname") %>' />

                            </td>
                             

                              <td>
                                <asp:Label ID="lbl_spec" runat="server" Text='<%# Eval("spec") %>' />
                                  <asp:TextBox ID="txt_spec" Width="100px" runat="server" Text='<%# Eval("spec") %>' />
                            </td>



                             <td  >
                                <asp:Label ID="lbl_supplyprocode" runat="server" Text='<%# Eval("supplyprocode") %>' />
                                  <asp:textbox ID="txt_supplyprocode" runat="server"  Width="90"  Text='<%# Eval("supplyprocode") %>' />
                            </td>

                            <td>
                                    <asp:Label ID="lbl_supplycode" runat="server" Text='<%# Eval("supplycode") %>' />
                                <asp:textbox ID="txt_supplycode" runat="server" Width="70px" Text='<%# Eval("supplycode") %>' />
       
                            </td>


                            <td>
                                <asp:Label ID="lbl_piece" runat="server" Text='<%# Eval("piece") %>' />

                                <asp:DropDownList runat="server" ID="ddl_piece"   ></asp:DropDownList>

                            </td>


                          

                            
                             <td    >
                                <asp:Label ID="lbl_price" runat="server" Text='<%# Eval("price") %>' />
                                <asp:TextBox ID="txt_price" Width="80px"  runat="server" Text='<%# Eval("price") %>' />
                            </td>
                           
                            
                           


                            
                              <td>
                                <asp:Label ID="lbl_moq" runat="server" Text='<%# Eval("moq") %>' /> 
                                <asp:textbox ID="txt_moq" runat="server"  Width="60px" Text='<%# Eval("moq") %>' />
                            </td>


                              <td>
                                <asp:Label ID="lbl_leadtime" runat="server" Text='<%# Eval("leadtime") %>' />
                                   <asp:textbox ID="txt_leadtime" runat="server"  Width="60px"  Text='<%# Eval("leadtime") %>' />

                            </td>
                           
                            


                          
                           

                            <td>
                                <asp:Label ID="lbl_defaultuser" runat="server" Text='<%# Eval("defaultuser") %>' /> 
                                 <asp:textbox ID="txt_defaultuser"  Enabled="false" runat="server" Width="50px" Text='<%# Eval("defaultuser") %>' />

                            

                           </td>

                           

                     

                            
                        </tr>
                    </ItemTemplate>
                   
   

    

             </asp:ListView>
                 
 











<div>
 <asp:DataPager ID="DataPager1"   class="btn-group btn-group-sm"  
      PagedControlID="ListView1" runat="server" PageSize=10>
 <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 purchase_categories.id, code, catname, supplyprocode, spec, purchase_supply.supplycode, piece, price,currency,moq,leadtime, [parentid],purchase_supply.purchaseuser as defaultuser, shipmethod, [iscat]  FROM [purchase_categories]  left join purchase_supply on purchase_supply.supplycode=purchase_categories.supplycode  WHERE ([iscat] = 0) and    (@pid=0 or parentid=@pid or parentid in (select id from purchase_categories where parentid=@pid)     )       and (@key='' or catname+' '+code+' '+purchase_categories.supplycode+' '+purchase_categories.supplyprocode like '%'+@key+'%')     ORDER BY [id] DESC" 
      
      OnSelecting="SqlDataSource1_Selecting" 
         
 
  >
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="iscat" Type="Int32" />
            <asp:Parameter DefaultValue="0" Name="pid" Type="Int32" />
            <asp:ControlParameter ControlID="txt_key" Name="key" Type="String"  ConvertEmptyStringToNull="false" />
          
       </SelectParameters>
         
 
  
  
 
 
 </asp:SqlDataSource>

 
                


                         
                        
                    
                    </ContentTemplate>

                </asp:UpdatePanel>
            
                       
                
                
                
         








 
    </div>


 
      
               
         










     
     

        <script>

             function  openP(id)
             {
                 url = 'Product_AddEdit.aspx?id=' + id;

                 if (id <=0)
                     url = 'Product_AddEdit.aspx';

                 layer.open({
                     type: 2,
                     title: "编辑添加产品",
                     area: ['1000px', '540px'],
                     fix: true, //不固定
                     maxmin: false,
                     content: url
                 });
             }



        function _Move() {
            url = 'Cat_Move.aspx?ids=' +$("#hf_ids").val(); 
            layer.open({
                type: 2,
                title: "编辑添加产品",
                area: ['600px', '350px'],
                fix: true, //不固定
                maxmin: false,
                content: url
            });
        }

    </script>



  
     









  
     <input  ID="selproid" name="selproid"  type="hidden"/>

  <input type="hidden" name="hf_ids" id="hf_ids" />
</asp:Content>
