<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerEdit.aspx.cs" Inherits="OAWeb.crm.customer.CustomerEdit"
    EnableEventValidation="false" ValidateRequest="false"  EnableViewState="true" %>

<!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="../../App_Themes/Default/default.css" rel="stylesheet" type="text/css" />
    <link href="/css/global.css" rel="Stylesheet" />
    <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
    <script src="/js/artDialog/artDialog.js?skin=default" type="text/javascript"></script>
    <script src="/js/artDialog/plugins/iframeTools.source.js" type="text/javascript"></script>
    <script src="/js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        var inprocess = false;
        function CheckProcess() {
            if (inprocess == true) {
                alert("正在处理中！");
                return true;
            }
            else {
                inprocess = true;
                return false;
            }
        }
        /*打开员工窗口*/
        function OpenEmployeeDialog() {
            var Url = "/Dialog/EmployeeDialog.aspx";
            Dialog.OpenSelectDialog("选择", Url, 650, 500, "<%=hidfldOwnerID.ClientID %>", "<%=txtOwnerName.ClientID %>");
            return false;
        }  
    </script>
    <script language="javascript" type="text/javascript">
        var xmlHttp = false;
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e2) {
                xmlHttp = false;
            }
        }
        var type = "", IsSucceed = false;
        function CallCity(objID) {
            var url = "";
            if (objID == "ddlProvinceID") {
                url = "../City.aspx?ID=0"; //省
                type = "First";
            }
            else if (objID == "ddlCityID") {
                url = "../City.aspx?ID=" + document.getElementById("ddlProvinceID").value; //市
                type = "Second";
            } else if (objID == "txtTelephone") {
                if (document.getElementById(objID).value == "") {
                    IsSucceed = false;
                    return false;
                }
                url = "../City.aspx?state=1&tel=" + document.getElementById(objID).value;

            } else if (objID == "txtMobilePhone" && !IsSucceed) {
                url = "../City.aspx?state=2&mobile=" + document.getElementById(objID).value;
            }

            if (objID == "txtTelephone" || (objID == "txtMobilePhone" && !IsSucceed)) {
                xmlHttp.open("GET", url, false);
                xmlHttp.onreadystatechange = SetProvinceCity;
                xmlHttp.send(null);
                if (objID == "txtMobilePhone") {
                    IsSucceed = false;
                }
            }
            else if (objID == "ddlProvinceID" || objID == "ddlCityID") {
                xmlHttp.open("GET", url, false);
                xmlHttp.onreadystatechange = SetRespond;
                xmlHttp.send(null);
            }

        }

        function SetRespond() {
            if (xmlHttp.readyState == 4) {
                var response = xmlHttp.responseText;
                var _List = response.split(",");
                var obj = null;
                if (type == "First") {
                    obj = document.getElementById("ddlProvinceID");
                }
                else if (type == "Second") {
                    obj = document.getElementById("ddlCityID");
                }

                for (var i = obj.options.length - 1; i >= 0; --i)   //撤消原来的列表项
                {
                    obj.options.remove(i)
                }
                for (var i = 0; i < _List.length; i++) {
                    var TypeID_Value = _List[i].split("#");
                    var oOption = document.createElement('OPTION');
                    oOption.text = TypeID_Value[1];
                    oOption.value = TypeID_Value[0];
                    obj.options.add(oOption);
                }
            }
        }

        function SetProvinceCity() {
            if (xmlHttp.readyState == 4) {
                var response = xmlHttp.responseText;
                var _List = response.split(",");
                var obj = document.getElementById("ddlProvinceID");
                if (_List.length > 1) {
                    bindOptions(obj, _List[0]);
                }

                obj = document.getElementById("ddlCityID");
                if (_List.length >= 2 && obj.value != _List[1]) {
                    CallCity("ddlCityID");
                    bindOptions(obj, _List[1]);
                }
                if (obj.value == _List[1])
                    IsSucceed = true;
                else
                    IsSucceed = false;
            }
        }

        function bindOptions(obj, value) {
            for (var i = 0; i < obj.options.length; i++) {
                if (obj.options[i].value == value)
                { obj.options.selectedIndex = i; break; }
            }
        }
    </script>
    <script type="text/javascript" language="javascript">
        /*打开线索窗口*/

        function OpenClueDialog() {
            var Url = "/Dialog/CustomerClueSelectDialog.aspx";
            OpenRadioDialog(Url, '选择线索', CallbackFun);

            return false;
        }

        function CallbackFun(text, value) {
            $('#<%=txtCustomerClueName.ClientID %>').val(text);
            $('#<%=hidfldCustomerClueId.ClientID %>').val(value);

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width: 700px; height: 500px; padding:10px; overflow-y: scroll; ">
        <table cellspacing="0" cellpadding="0" width="100%" border="0"  class="table_form">
            
            <tr>
                <td align="left" class="st13pt" colspan="4" style=" color:#003399;">
                    客户基本信息(<font class="c-red">v</font>表示必填字段)
                </td>
            </tr>
            <tr >
                <td class="data-label">
                    <span class="c-red">v</span>客户名称：
                </td>
                <td colspan="3" class="data-field">
                    <asp:TextBox ID="txtCustomerName" runat="server" Width="80%" MaxLength="50"></asp:TextBox>
                    <asp:Button ID="btnExists" runat="server" Text="检测重复" OnClick="btnExists_Click" />
                </td>
            </tr>
            <tr>
                <td class="data-label" style=" width:12%">
                    重要程度：
                </td>
                <td class="data-field"  style=" width:38%">
                    <asp:RadioButtonList ID="rblHotLevel" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal"
                        Width="231px">
                        <asp:ListItem Selected="True" Value="0">普通</asp:ListItem>
                        <asp:ListItem Value="1">重要</asp:ListItem>
                        <asp:ListItem Value="2">很重要</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td class="data-label" style=" width:15%">
                    是否正式客户：
                </td>
                <td class="data-field">

                    <asp:DropDownList ID="ddlIsPurchase" runat="server">
                    <asp:ListItem Value="False">否</asp:ListItem>
                    <asp:ListItem Value="True">是</asp:ListItem>
                    
                    </asp:DropDownList>

                </td>
            </tr>
            

            <tr>
                <td class="data-label">
                    登录名：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtLoginName" runat="server" Width="70%" MaxLength="50"></asp:TextBox>
                </td>
                <td class="data-label">
                <span id="spPassword" runat="server">密码：</span>
                </td>
                <td class="data-field">
                     <asp:TextBox ID="textPassword" TextMode="Password" runat="server" Width="70%" MaxLength="50"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    助记简称：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtShortName" runat="server" Width="70%" MaxLength="50"></asp:TextBox>
                </td>
                <td class="data-label">
                    <span style="color: #ff0000; font-family: Wingdings">v</span>行业：
                </td>
                <td class="data-field">
                    <asp:DropDownList ID="ddlIndustryID" runat="server">
                    </asp:DropDownList>
                    <asp:Label ID="lblhelp4" runat="server" ForeColor="DarkOrange" Text="(？提示)" ToolTip="填写行业有利于查询统计"></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    <span style="color: #ff0000; font-family: Wingdings">v</span>商业种类：
                </td>
                <td class="data-field">
                    <asp:DropDownList ID="ddlBizTypeID" runat="server" >
                    </asp:DropDownList>
                    <asp:Label ID="lblhelp3" runat="server" ForeColor="DarkOrange" Text="(？提示)" ToolTip="填写商业种类有利于查询统计"></asp:Label>
                </td>
                <td class="data-label">
                    使用类型：
                </td>
                <td class="data-field">
                    <asp:DropDownList ID="ddlTypeID" runat="server">
                    <asp:ListItem Value="0">企业</asp:ListItem>
                    <asp:ListItem Value="1">个人</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            
            <tr>
                <td class="data-label">
                    来源线索：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtCustomerClueName" runat="server" Width="150px" ReadOnly="true"></asp:TextBox><asp:Button
                        ID="btnSelectClue" runat="server" Text="选择" OnClientClick="return OpenClueDialog()" />
                    <asp:Button ID="btnClear" runat="server" Text="置空" OnClientClick="return clearClue()" />
                    <asp:HiddenField ID="hidfldCustomerClueId" runat="server" />
                    <script type="text/javascript">
                        function clearClue() {
                            document.getElementById('<%=hidfldCustomerClueId.ClientID %>').value = "";
                            document.getElementById('<%=txtCustomerClueName.ClientID %>').value = "";
                            return false;
                        }
                    </script>
                </td>
                <td class="data-label">
                是否黑名单
                </td>
                <td class="data-field">
                    <select id="ddlIsBlackList" runat="server">
                    <option value="0">否</option>
                    <option value="1">是</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    <span class="c-red">v</span>来源：
                </td>
                <td class="data-field">
                    <asp:DropDownList ID="ddlSourceID" runat="server">
                    </asp:DropDownList>
                    <asp:TextBox ID="txtOtherSource" runat="server" Width="100px"></asp:TextBox>
                    <asp:Label ID="lblhelp0" runat="server" ForeColor="DarkOrange" Text="(？提示)" ToolTip="填写来源有利于查询统计"></asp:Label>
                </td>
                <td class="data-label">
                    是否公司资源：
                </td>
                <td class="data-field">
                    <asp:CheckBox ID="cbbIsCorporateResources" runat="server" Text="是否公司资源" Checked="True" />
                </td>
            </tr>

            <tr>
                <td class="data-label">
                    客户等级：
                </td>
                <td class="data-field">
                    <asp:DropDownList ID="ddlCustomerGradeId" runat="server">
                    </asp:DropDownList>
                </td>
                <td class="data-label">
                    
                </td>
                <td class="data-field">
                </td>
            </tr>
            
           
            <tr>
                <td align="left" class="st13pt" colspan="4" style=" color:#003399;">
                    联系方式：(如果姓名为空，主联系人的相关联系信息将不被保存)
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    <span class="c-red">v</span>姓名：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtName" runat="server" Width="70%" MaxLength="20"></asp:TextBox>
                </td>
                <td class="data-label">
                    性别：
                </td>
                <td class="data-field">
                    <asp:DropDownList ID="ddlSex" runat="server">
                        <asp:ListItem Selected="True" Value="0">未指定</asp:ListItem>
                        <asp:ListItem Value="1">男</asp:ListItem>
                        <asp:ListItem Value="2">女</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    &nbsp;QQ：&nbsp;
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtQQ" runat="server" Width="70%" MaxLength="20"></asp:TextBox>
                </td>
                <td class="data-label">
                    手机：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtMobilePhone" runat="server" Width="70%" MaxLength="20" onblur="CallCity('txtMobilePhone')"></asp:TextBox>
                </td>
            </tr>
             <tr>
                <td class="data-label">
                    电话：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtTelephone" runat="server" Width="70%" MaxLength="20" onblur="CallCity('txtTelephone')"></asp:TextBox>
                </td>
                <td class="data-label">
                    传真：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtFax" runat="server" Width="70%" MaxLength="20"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    电子邮件：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtEmail" runat="server" Width="70%" MaxLength="50"></asp:TextBox>
                </td>
                <td class="data-label">
                    网址：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtWeb" runat="server" Width="70%" MaxLength="100">http://</asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    <span class="c-red">v</span>省份：
                </td>
                <td class="data-field">
                    <asp:DropDownList ID="ddlProvinceID" runat="server">
                    </asp:DropDownList>
                    城市：<asp:DropDownList ID="ddlCityID" runat="server">
                    </asp:DropDownList>
                    <asp:Label ID="lblhelp1" runat="server" ForeColor="DarkOrange" Text="(？提示)" ToolTip="填写省市有利于查询统计"></asp:Label>
                </td>
                <td class="data-label">
                    其他城市：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtCity" runat="server" Width="70%" MaxLength="20"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    地址：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtAddress" runat="server" Width="70%" MaxLength="100"></asp:TextBox>
                </td>
                <td class="data-label">
                    邮编：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtPostCode" runat="server" Width="70%" MaxLength="6"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left" class="st13pt" colspan="4" style=" color:#003399;">
                    备注：
                </td>
            </tr>
            <tr>
                <td class="data-label">
                    备注：
                </td>
                <td class="data-field" colspan="3">
                    <asp:TextBox ID="txtRemark" runat="server" Height="50px" TextMode="MultiLine" Width="99%"
                        MaxLength="255"></asp:TextBox>
                </td>
            </tr>
            <tr style=" height:80px; line-height:80px">
                <td class="data-label">
                    公司介绍：
                </td>
                <td class="data-field" colspan="3">
                    <asp:TextBox ID="txtCustomerInfo" runat="server" Height="50px" MaxLength="255" TextMode="MultiLine"
                        Width="99%"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left" class="st13pt" colspan="4" style=" color:#003399;">
                    业务信息：
                </td>
            </tr>
            <tr>
                <td class="data-label" colspan="4">
                    下次联系时间：  <asp:TextBox ID="txtNextContactTime" runat="server" onfocus="WdatePicker()"></asp:TextBox>
                </td>
                
                
            </tr>
            <tr style='display: <%=CustomerAssetID != Guid.Empty || ClueID != Guid.Empty ? "" : "none" %>'>
                <td class="data-label">
                    跟进人：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtOwnerName" runat="server"></asp:TextBox><input id="Button2" type="button"
                        value="..." onclick="OpenEmployeeDialog()" runat="server" />
                    <asp:HiddenField ID="hidfldOwnerID" runat="server" />
                </td>
                <td class="data-label">
                    创建人：
                </td>
                <td class="data-field">
                    <asp:TextBox ID="txtCreateMan" runat="server" Enabled="false"></asp:TextBox>
                </td>
            </tr>
            <tr id="trChk" runat="server">
                <td class="data-buttons" colspan="4">
                    <asp:CheckBox ID="chkClose" runat="server" Checked="True" Text="保存后关闭本窗口" />
                </td>
            </tr>
            <tr style=" height:50px; line-height:50px;">
                <td class="data-buttons" colspan="4" style=" text-align:center">
                    <asp:Button  CssClass="btn_77px" ID="btnSaveTrack" runat="server" OnClick="btnSaveTrack_Click" Text="保存并领用" />
                    &nbsp;<asp:Button  CssClass="btn_77px" ID="btnSave" runat="server" OnClick="btnSave_Click" Text="保 存"
                        Width="81px" />&nbsp;<asp:Button  CssClass="btn_77px" ID="btnCannel" runat="server" OnClick="btnCannel_Click"
                            Text="返 回"  />
                </td>
            </tr>
            
        </table>
    </div>
    <script language="javascript">
        if (form1.ddlSourceID.value == '其它') form1.txtOtherSource.style.display = ''; else form1.txtOtherSource.style.display = 'none';
        
    </script>
    </form>
</body>
</html>
