<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="SNList.aspx.cs" Inherits="OAWeb.crm.product.SNList" %>

<%@ Register Src="../../UserControls/ProductNav.ascx" TagName="ProductNav" TagPrefix="uc1" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlace" runat="server">
    <!--主体左侧-->
    <style>
        .data_field ul li
        {
            float: left;
            margin-right: 3px;
        }
    </style>
    <table id="plc_profile" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td class="main_left">
                <uc1:ProductNav ID="ProductNav1" runat="server" />
            </td>
            <td class="main_center">
                <!--主体-->
                <div class="page_main">
                    <div class="page_content">
                        <table class="data_title" cellspacing="3">
                            <tr>
                                <td class="data_caption">
                                    <em style="float: left">
                                        <img src="/images/02.gif" />
                                    </em>序列号管理<br />
                                    <span class="tip01">管理商品序列号.您可以添加、编辑、删除序列号</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="data_field">
                                    <asp:Panel ID="pnlLink" runat="server">
                                        <asp:HyperLink ID="hypAll" runat="server" NavigateUrl="/crm/product/SNList.aspx?s=1&l=0">所有</asp:HyperLink>
                                        <asp:HyperLink ID="hypAvailDate" runat="server" NavigateUrl="/crm/product/SNList.aspx?s=1&l=1">将到期</asp:HyperLink>
                                        <asp:HyperLink ID="hypAvailDate2" runat="server" NavigateUrl="/crm/product/SNList.aspx?s=1&l=2">已到期</asp:HyperLink>
                                        <br />
                                    </asp:Panel>
                                    <ul>
                                        <li>序列号:<asp:TextBox ID="txtProductSN" runat="server" CssClass="text_box width120"></asp:TextBox>
                                        </li>
                                        <li style="width: 260px;">品名:<asp:TextBox ID="txtSKUName" runat="server" CssClass="text_box width120"
                                            ReadOnly="true"></asp:TextBox>&nbsp;
                                            <input type="button" value="选择" onclick="OpenRadioDialog('/Dialog/SNProductSelectDialog.aspx','选择商品',CallbackRadioFun);" />
                                            <input type="button" value="置空" onclick=" Reset();" /><asp:HiddenField ID="hdfSKUId"
                                                runat="server" />
                                        </li>
                                        <li style="width: 260px;">客户:<asp:TextBox ID="txtCustomerName" runat="server" CssClass="text_box width120"
                                            ReadOnly="true"></asp:TextBox>&nbsp;
                                            <input type="button" value="选择" onclick="OpenRadioDialog('/Dialog/CustomerDialog.aspx','选择客户',CallbackCustomerFun);" />
                                            <input type="button" value="置空" onclick=" ResetCustomer();" />
                                            <asp:HiddenField ID="hdfCustomerID" runat="server" />
                                        </li>
                                        <li>状态:<asp:DropDownList ID="ddlUseState" runat="server">
                                            <asp:ListItem Value="0">所有</asp:ListItem>
                                            <asp:ListItem Value="1">正常</asp:ListItem>
                                            <asp:ListItem Value="2">停用</asp:ListItem>
                                            <asp:ListItem Value="-1">废置</asp:ListItem>
                                        </asp:DropDownList>
                                        </li>
                                        <li style="width: 300px;">日期:<asp:TextBox ID="txtDateStart" runat="server" CssClass="text_box width120"
                                            onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"></asp:TextBox>-<asp:TextBox
                                                ID="txtDateEnd" runat="server" CssClass="text_box width120" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"></asp:TextBox>
                                        </li>
                                        <li>&nbsp;
                                            <asp:Button ID="btnSearch" runat="server" Text="查  询" class="btn_77px" /></li>
                                    </ul>
                                </td>
                            </tr>
                        </table>
                        <asp:Panel ID="pnlOp" runat="server">
                            <div class="page_op">
                                <asp:Button ID="btnNew" runat="server" Text="新增序列号" CssClass="btn_77px" OnClientClick="return OpenDialog('SNEdit.aspx','新增序列号');" />
                                <asp:Button ID="btnDelete" runat="server" Text="删除序列号" CssClass="btn_77px" />
                            </div>
                        </asp:Panel>
                        <div class="list">
                            <asp:GridView ID="gvData" runat="server" AutoGenerateColumns="False" DataKeyNames="SNId"
                                GridLines="None" CellPadding="0" CssClass="table_list" EnableModelValidation="True"
                                OnRowDataBound="gvData_RowDataBound">
                                <RowStyle HorizontalAlign="Left" />
                                <Columns>
                                    <asp:TemplateField HeaderText="编号">
                                        <HeaderTemplate>
                                            <input name="chkHeader" onclick="javascript:SelectAll(this);" type="checkbox" value="chkHeader" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <input id="chkItem" type="checkbox" value="<%#Eval("SNId") %>" />
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" ForeColor="White"></HeaderStyle>
                                        <ItemStyle HorizontalAlign="Center" Width="10px"></ItemStyle>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="序列号">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbtnProductSN" runat="server"><%# Eval("ProductSN") %></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="SKUName" HeaderText="品名"></asp:BoundField>
                                    <asp:BoundField DataField="AgentUserName" HeaderText="经销商"></asp:BoundField>
                                     <asp:HyperLinkField DataNavigateUrlFields="CustomerId" 
                                        DataNavigateUrlFormatString="/crm/customer/CustomerView.aspx?CustomerID={0}" 
                                        DataTextField="CustomerCompanyName" HeaderText="客户名称" Target="_blank" />
                                    <asp:BoundField DataField="" HeaderText="客户归属"></asp:BoundField>
                                    <asp:BoundField DataField="CreateDate" HeaderText="创建日期" 
                                        DataFormatString="{0:yyyy-MM-dd HH:mm}"></asp:BoundField>
                                    <asp:BoundField DataField="AuditDate" HeaderText="交付日期" 
                                        DataFormatString="{0:yyyy-MM-dd HH:mm}"></asp:BoundField>
                                    <asp:BoundField DataField="AvailDate" HeaderText="服务期限" 
                                        DataFormatString="{0:yyyy-MM-dd HH:mm}"></asp:BoundField>
                                    <asp:BoundField DataField="AuditStateText" HeaderText="交付状态"></asp:BoundField>
                                    <asp:TemplateField HeaderText="操作">
                                        <ItemTemplate>
                                            <asp:HyperLink ID="hypPay" runat="server">订购</asp:HyperLink>
                                            <asp:LinkButton ID="lbtnEdit" runat="server">编辑</asp:LinkButton>
                                            <asp:LinkButton ID="lbtnDelete" runat="server">删除</asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                            <div class="pager-bar">
                                <webdiyer:AspNetPager ID="pager" runat="server" CssClass="anpager" currentpagebuttonclass="cpb"
                                    PageSize="20" NextPageText="下一页" LastPageText="页 尾" FirstPageText="第一页" PrevPageText="上一页"
                                    ShowBoxThreshold="10" SubmitButtonText="跳 转" UrlPaging="True">
                                </webdiyer:AspNetPager>
                            </div>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        function CallbackRadioFun(text, value) {
            $('#<%=txtSKUName.ClientID %>').val(text);
            $('#<%=hdfSKUId.ClientID %>').val(value);
        }
        function Reset() {
            $('#<%=txtSKUName.ClientID %>').val("");
            $('#<%=hdfSKUId.ClientID %>').val("");
            return false;
        }
        function CallbackCustomerFun(text, value) {
            $('#<%=txtCustomerName.ClientID %>').val(text);
            $('#<%=hdfCustomerID.ClientID %>').val(value);
        }
        function ResetCustomer() {
            $('#<%=txtCustomerName.ClientID %>').val("");
            $('#<%=hdfCustomerID.ClientID %>').val("");
            return false;
        }
    </script>
</asp:Content>
