<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Manage.aspx.cs" Inherits="TotCms.Web.Office.Customer.Manage" %>
<%@ Register assembly="TotCms.Controls" namespace="TotCms.Controls" tagprefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>客户管理</title>    
    <link href="../style/global.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery-ui-1.8.10/css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    #windownbg{display:none;position:absolute;width:100%;height:100%;background:#000;top:0;left:0;}
    #windown-box{position:fixed;_position:absolute;border:5px solid #E9F3FD;background:#FFF;text-align:left;}
    #windown-title{position:relative;height:30px;border:1px solid #A6C9E1;overflow:hidden;background:url(../../images/tipbg.png) 0 0 repeat-x;}
    #windown-title h2{position:relative;left:10px;top:5px;font-size:14px;color:#666;}
    #windown-close{position:absolute;right:10px;top:8px;width:10px;height:16px;text-indent:-10em;overflow:hidden;background:url(../../images/tipbg.png) 100% -49px no-repeat;cursor:pointer;}
    #windown-content-border{position:relative;top:-1px;border:1px solid #A6C9E1;padding:5px 0 5px 5px;}
    #windown-content img,#windown-content iframe{display:block;}
    #windown-content .loading{position:absolute;left:50%;top:50%;margin-left:-8px;margin-top:-8px;}
    </style>

    <script src="../../js/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-ui-1.8.10/js/jquery.ui.core.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-ui-1.8.10/js/jquery.ui.widget.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-ui-1.8.10/js/jquery.ui.datepicker.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-ui-1.8.10/js/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
    <script src="../../js/areas.js" type="text/javascript"></script>
    <script src="../../js/tipswindown.js" type="text/javascript"></script>
    <script type="text/javascript">
      $(function () {
        $('.dates').datepicker($.datepicker.regional["zh-CN"]);
      });
    </script>
    <script type="text/javascript">
      /*
      *弹出本页指定ID的内容于窗口
      *id 指定的元素的id
      *title:	window弹出窗的标题
      *width:	窗口的宽,height:窗口的高
      */
      function showTipsWindown(title, id, width, height) {
        
      }
      function showwin(id) {
        tipsWindown("详细", "id:" + "win_" + id, 400, 300, "true", "", "0", "win_" + id);
      }
      function confirmTerm(s) {
        parent.closeWindown();
        if (s == 1) {
          parent.document.getElementById("isread").checked = true;
        }
      }
      function ToExcel() {
        var gourl = 'ExportXls.aspx?comclass=' + $('#ddComClass').val();
        gourl += '&comstar=' + $('#ddComStar').val();
        gourl += '&comstatus=' + $('#ddStatus').val();
        gourl += '&industry=' + $('#ddIndustry').val();
        gourl += '&province=' + $('#Province').val();
        gourl += '&city=' + $('#City').val();
        gourl += '&staffid=' + <%=_staffid%>;
        window.location.href = gourl;
      }
      function ProvinceSelect(pid) {
        var pts = document.getElementById('Province');
        for (var i = 0; i < pts.length; i++) {
          if(pts.options[i].value==pid)
          pts.options[i].selected = true;
        }
      }
</script>


    <style type="text/css">
      .style1
      {
        width: 16px;
        height: 16px;
      }
      .btn_excel{ border:0px solid #fff; background-color:#fff; height:14px; padding:0px;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
     <div class="br"></div>
    <div>
        <table style="width: 100%;" border="0" cellpadding="0" cellspacing="1" class="border">
            <tr class="suphead">
                <td>
                    客户管理</td>
            </tr>
            <tr>
                <td height="30"><asp:DropDownList ID="ddComClass" runat="server">
                  <asp:ListItem Value="-1">类别</asp:ListItem>
                  <asp:ListItem Value="0">个人</asp:ListItem>
                  <asp:ListItem Value="1">企业</asp:ListItem>
                  </asp:DropDownList>
                  来源：<asp:DropDownList ID="ddComFrom" runat="server">                    
                  </asp:DropDownList>
&nbsp;星级：<asp:DropDownList ID="ddComStar" runat="server">
                    <asp:ListItem Value="0">--</asp:ListItem>
                    <asp:ListItem Value="1">★</asp:ListItem>
                    <asp:ListItem Value="2">★★</asp:ListItem>
                    <asp:ListItem Value="3">★★★</asp:ListItem>
                    <asp:ListItem Value="4">★★★★</asp:ListItem>
                    <asp:ListItem Value="5">★★★★★</asp:ListItem>
                  </asp:DropDownList>
                  状态：<asp:DropDownList ID="ddStatus" runat="server">                    
                  </asp:DropDownList>
                  行业：<asp:DropDownList ID="ddIndustry" runat="server">
                  </asp:DropDownList>
                  <br />
                  地区：<select id="Province" name="Province" onchange="GetAreaChilds(this.options[this.selectedIndex].value,0,'City')">
                    <option value="0">选择城市</option>
                  <script type="text/javascript">                    document.write(GetAreaFirst(0, ''));</script>
                  </select> &gt; <select id="City" name="City">
                    <option value="0">--</option>
                  </select> 关键字：<asp:TextBox ID="tbKey" runat="server"></asp:TextBox>
                  按：<asp:DropDownList ID="ddSby" runat="server">
                    <asp:ListItem Selected="True" Value="comname">公司名称</asp:ListItem>
                    <asp:ListItem Value="tel">电话</asp:ListItem>
                    <asp:ListItem Value="email">邮箱</asp:ListItem>
                  </asp:DropDownList>
                    <asp:Button ID="btnGo" runat="server" Text="查询" onclick="btnGo_Click" />                
                
                </td>
            </tr>
        </table>
    </div>
    <div class="br"></div>

     <table>
       <tr>
         <td>
           <img class="style1" src="../images/plus.png" /> <a href="Customer_Edit.aspx">添加新客户</a>
           <img class="style1" src="../images/icon/blue/16x16/communication.png" />
           <a href="javascript:ToExcel()">导出Excel</a>
           </td>
       </tr>
     </table>

    <div>
        <asp:ListView ID="lvList" runat="server" ItemPlaceholderID="items" OnItemCommand="lvList_ItemCommand" OnItemDataBound="lvList_ItemDataBound" DataKeyNames="id">
            <LayoutTemplate>
                <table cellpadding="0" cellspacing="1" border="0" width="100%" class="border">
                    <tr class="suphead">
                        <td width="3%">
                            <asp:CheckBox ID="cbSelect" runat="server" OnCheckedChanged="CbSelectChanged" AutoPostBack="true" />
                        </td>
                        <td>编号</td>
                        <td>公司名称</td>
                        <td>类别</td>
                        <td>来源</td>
                        <td>星级</td>
                        <td>状态</td>
                        <td>责任人</td>
                        <td>联系人</td>
                        <td>电话</td>
                        <td>QQ</td>
                        <td>手机</td>
                        <td>邮箱</td>
                        <td>创建</td>
                        <td>修改</td>
                        <td>操作</td>
                    </tr>
                    <asp:PlaceHolder runat="server" ID="items"></asp:PlaceHolder>
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr class="lines">
                    <td>
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:CheckBox ID="ChkId" runat="server" Checked="false" />
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="BtnSelect" EventName="Click" />
                            </Triggers>
                        </asp:UpdatePanel>
                        <asp:TextBox ID="ChkTxt" runat="server" CssClass="hidden" Text='<%# Eval("id") %>'></asp:TextBox>
                    </td>                    
                    <td><%# Eval("id")%></td>
                    <td><a href='javascript:showwin(<%# Eval("id") %>)'><%# Eval("ComName")%></a></td>
                    <td><%# Convert.ToInt32(Eval("ComClass"))==1?"企业":"个人"%></td>
                    <td><%# Eval("ComFrom")%></td>
                    <td><%# Eval("ComStar")%></td>
                    <td><%# Eval("ComStatus")%></td>
                    <td><%# Eval("UserName")%></td>
                    <td><%# Eval("ContactMan")%></td>
                    <td><%# Eval("Tel")%></td>
                    <td><%# Eval("QQ")%></td>
                    <td><%# Eval("Mobile")%></td>
                    <td><%# Eval("Email")%></td>
                    <td><%# Eval("CreateBy")%><br /><%# FormatDate(Eval("CreateDate"))%></td>
                    <td><%# Eval("ModBy")%><br /><%# FormatDate(Eval("ModDate"))%></td>
                    <td>   
                    <a href='Customer_Edit.aspx?id=<%# Eval("id") %>'>编辑</a>
                        <asp:LinkButton ID="LinkButton1" OnLoad="Delete_Load" runat="server" CommandName="deleteobj"
                            CommandArgument='<%# Eval("id") %>'>删除</asp:LinkButton>
                    <br />
                    <a href='Visit.aspx?comid=<%# Eval("id") %>' style="color:Blue;">拜访明细</a>
                    </td>                    
                </tr>
            </ItemTemplate>
            <EmptyDataTemplate>
                <table cellpadding="0" cellspacing="1" border="0" width="100%" class="border">
                    <tr class="suphead">
                        <td>
                           暂时没有数据
                        </td>
                    </tr>
                </table>
            </EmptyDataTemplate>
        </asp:ListView>
        <div align="center">
            <asp:Button ID="BtnSelect" runat="server" Text="全选" OnClick="BtnSelect_Click" />
            <asp:DropDownList ID="BatRunType" runat="server">
                <asp:ListItem Text="批量删除" Value="delete"></asp:ListItem>
            </asp:DropDownList>
            <asp:Button ID="BtnRun" runat="server" Text="执行操作" OnClick="BtnRun_Click" OnClientClick="return confirm('确定执行吗?')" />
        </div>
        <cc1:Pager ID="Pager1" runat="server" GenerateFirstLastSection="True" 
      GenerateGoToSection="True" GenerateHiddenHyperlinks="False" 
      QueryStringParameterName="CurrentPage" OnCommand="pager_Command" 
      GoToStyle="text" OfClause="/" PageClause="页" PageSize="15" />
    </div>
    <div runat ="server" id="divs" style="display:none;"></div>
    </form>
</body>
</html>
