<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerCommunicationRecord_B.aspx.cs"
    Inherits="CRMSYS.CustomerInformation.CustomerCommunicationRecord.CustomerCommunicationRecord_B" %>

<!DOCTYPE html>
<html lang="zh-cn">
<head id="Head1" runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>客户详细信息</title>
    <meta name="description" content="客户详细信息" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
   <link href="../../Scripts/BootStrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/layer/skin/layer.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
    <link rel="stylesheet" href="../../Scripts/BootStrap/css/ace.min.css" />
    <link rel="stylesheet" href="../../Scripts/BootStrap/css/ace-skins.min.css" />
    <link rel="stylesheet" href="../../Scripts/BootStrap/css/ace-rtl.min.css" />
     
    <script src="../../Scripts/Yui/jquery-1.8.0.min.js" type="text/javascript"></script>
    <link href="../../Scripts/BootStrap/css/pagion.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/BootStrap/js/pagion.js" type="text/javascript"></script>
    <script src="../../Scripts/layer/layer.min.js" type="text/javascript"></script>
    <script src="../../Scripts/BootStrap/js/tcwlValidate.js" type="text/javascript"></script>
    <script src="../../Scripts/BootStrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="../../Scripts/Money/accounting.js" type="text/javascript"></script>
    <script src="../../Scripts/BootStrap/js/regRulr.js" type="text/javascript"></script>
    
    <!--日期-->
    <link href="../../Scripts/Date/datepicker.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/Date/theme.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/Date/datepicker.js" type="text/javascript"></script>
    <script src="../../Scripts/Date/datepicker-zh-CN.js" type="text/javascript"></script>
        <!--上传-->
    <link href="../../Scripts/Uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/Uploadify/jquery.uploadify.js" type="text/javascript"></script>
    <link href="../../Scripts/BootStrap/css/client.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript">
        var mPage = 1;
        var aryau = "";
        var firstLoad = 0;
        var orderpage = 1;
        var orderload = 0;
        var contrpage = 1;
        var contrload = 0;
        var userID = "";
        var srvID = "";
        var ID = "";
        var fileNStr = '';
        var fileOStr = '';
        var selectFirst = 0;
        var fsave = false;
        var _frmData = { id: '', srvid: '' };
        var ifrm;
        function resize_r() {
            var s = 0;
            var ss = $(window.parent.document).find('iframe[id=' + ifrm + ']');
            var p = $(window.parent.document).height() - ss.offset().top;
            var c = $(document).height();
            if (p > c) {
                s = p;
            }
            else {
                s = $(document).height();
            }

            $($(window.parent.document).find('iframe[id=' + ifrm + ']')).height(s);
            window.parent.sidebar_r();
        }

        $(function () {
            $("#sj").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
            $("#usj").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
            $("#csrq_Lxr").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
            $("#ucsrq_Lxr").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
            $("#jsj").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
            $("#qdrq").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
            $("#dqrq").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1
            });
            $("[tag]").hide();
            $(window).resize(function () {
                var top = ($(window).height() - $('#tcanchor').height()) / 2;
                //alert(top);
                //alert($(window).height());
                var left = ($(window).width() - $('#tcanchor').width());
                var scrollTop = $(document).scrollTop();
                var scrollLeft = $(document).scrollLeft();
                $('#tcanchor').css({ position: 'absolute', 'top': 150, left: left })
                $('#tcanchor').show();

            });

            $(window.parent).scroll(function () {
                var top = ($(window).height() - $('#tcanchor').height()) / 2;
                var left = ($(window).width() - $('#tcanchor').width());
                var scrollTop = $(this).scrollTop();
                var scrollLeft = $(this).scrollLeft();
                $('#tcanchor').css({ position: 'absolute', 'top': 150 + scrollTop, left: left })
            });

            $('#tcanchor').find('a').each(function (index, element) {
                $(this).bind('click', function () {
                    if ($(this).attr('rel')) {
                        var eoffset = $('#' + $(this).attr('rel')).offset();
                        window.parent.scrollTo(eoffset.left,
 eoffset.top);
                    }
                });
            });

        });
        jQuery(function ($) {
            $('[data-rel=tooltip]').tooltip();
            $('[data-rel=popover]').popover({ html: true });
        });
        //加载点击事件
        function ClickEvent() {
            $('[data-rel=tooltip]').tooltip();
            $('[data-rel=popover]').popover({ html: true });
        }
        //判断是否存在此权限
        function existRole(s, p) {
            var e = p.indexOf(s);
            if (e == -1) {
                return false;
            }
            else {
                return true;
            }
        }
        //判断权限
        function SelRole() {
            $('[tag]').each(function (i, e) {
                var tag = $(e).attr('tag');
                if (tag != 'undefined') {
                    if (existRole(tag, aryau)) {
                        if ($("#hiduser").val() == 1) {
                            $(e).show();
                        }
                        else {
                            $(e).hide();
                            $(e).removeAttr("onclick");
                        }
                    }
                    else {
                        $(e).hide();
                        $(e).removeAttr("onclick");
                    }
                }
            });
        }
        //联系人生成分页控件
        function createPage(pageSize, buttons, total) {
            $("#pagelink").jBootstrapPage({
                pageSize: pageSize,
                total: total,
                maxPageButton: buttons,
                onPageClicked: function (obj, pageIndex) {
                    mPage = pageIndex + 1;
                    LoadLinkMan(mPage, pageSize);
                }
            });
        }
        //订单生成分页控件
        function createOrderPage(pageSize, buttons, total) {
            $("#pageorder").jBootstrapPage({
                pageSize: pageSize,
                total: total,
                maxPageButton: buttons,
                onPageClicked: function (obj, pageIndex) {
                    orderpage = pageIndex + 1;
                    LoadOrder(orderpage, pageSize);
                }
            });
        }
        //合同生成分页控件
        function createContrPage(pageSize, buttons, total) {
            $("#pagecontract").jBootstrapPage({
                pageSize: pageSize,
                total: total,
                maxPageButton: buttons,
                onPageClicked: function (obj, pageIndex) {
                    mPage = pageIndex + 1;
                    createContr(contrpage, pageSize);
                }
            });
        }

        //加载数据
        function LoadData() {
            var arry = window.location.href.split('?')[1].split('&');
            if (!arry[2]) {
                $('html').empty();
                return;
            }
            srvID = arry[1].split('=')[1];
            ID = arry[0].split('=')[1];
            userID = arry[2].split('=')[1];
            ifrm = arry[3].split('=')[1];
            var cjr = arry[4].split('=')[1];
            var coksau = document.cookie.substring(document.cookie.indexOf('TCWL_All'));
            aryau = coksau.split(';')[0].split('=')[2];
            $('#srvid').val(srvID);
            $('#KHID').val(ID);
            $('#userid').val(userID);
            $("#hiduser").val(cjr);
            resize_r();


            var l = layer.load('正在加载数据......');
            //上传
            $('#uploadify').uploadify({
                'auto': true,
                'buttonCursor': 'hand',
                'buttonText': '选择文件',
                'height': 30,
                'width': 100,
                'debug': false,
                'multi': true,
                'queueSizeLimit': 3,
                'fileTypeDesc': '描述文件类型',
                'fileTypeExts': '*.gif; *.jpg; *.png; *.jpeg; *.psd; *.wps; *.doc; *.dot; *.docx; *.rar; *.zip; *.pdf; *.xls; *.xlsx; *.xlt; *.xlsm; *.dif; *.txt; *.ppt; *.pot; *.dpt; *.pps',
                'preventCaching': true,
                'queueID': 'fileQueue',
                'removeTimeout': 1,
                'swf': '../../Scripts/Uploadify/uploadify.swf',
                'uploader': '../../Handlers/Order/Order.aspx?method=upload',
                'fileSizeLimit': '5120KB',
                'formData': _frmData,
                'folder': 'UploadFile',
                'cancelImage': '../../Scripts/Uploadify/uploadify-cancel.png',
                'onUploadSuccess': function (file, data, response) {
                    //var mc = data.split('/')[5];
                    if (selectFirst > 0) {
                        $("#fj").val('');
                    }
                    selectFirst = 0;
                    fileNStr = fileNStr + data + '╯';
                    var mc = data.substring(data.lastIndexOf('/') + 1);
                    mc = mc.substring(0, mc.lastIndexOf('.'));

                    $("#fj").val($("#fj").val() + data + '╯');
                    //document.getElementById("uploadify").style.display = "none";
                    //$('#fList').show();
                    $('#uploadlist').show();
                    var eachItem = $('<li style="float:left;"><img ></img><a style="float:left;"></a></li>');
                    eachItem.find('a').attr('href', "../" + data);
                    eachItem.find('a').attr('target', "_blank");
                    eachItem.find('a').css({ 'display': 'block' });
                    eachItem.find('img').attr('src', "../../Scripts/BootStrap/img/fj.png");
                    eachItem.find('img').css({ 'width': '15px', 'height': '15px', 'float': 'left', 'margin-left': '5px' });
                    eachItem.find('a').text(mc);
                    $('#fList').append(eachItem);
                    //                    document.getElementById("xz").style.display = "block";width: 15px;height: 15px;
                    //                    document.getElementById("xz").href = "../" + data;
                    //                    document.getElementById("xz").text = mc;
                },
                'onUploadComplete': function (file) {

                }, 'onQueueComplete': function (stats) {
                    $('#animate').hide();
                    $('#fList').show();
                }, 'onSelect': function (file) {
                    if (selectFirst == 0) {
                        selectFirst++;
                        fileOStr += $("#fj").val();
                    }
                    $('#fList').empty();
                    $('#animate').show();
                    $('#fList').hide();
                    var bh = ID;
                    if (bh == "") {
                        $('#uploadify').uploadify('cancel');
                        alert("请先选择客户！");
                        return;
                    }
                    _frmData.id = $("#khbh").val();
                    _frmData.srvid = srvID;
                    $("#uploadify").uploadify("settings", "formData", { 'srv': srvID, "user": userID });
                }
            });
            $('#AddOrderDialog').on('hide.bs.modal', function () {
                if (fsave == true) {
                    delFile(fileOStr);
                    
                }
                else {
                    fileOStr += $('#fj').val();
                    delFile(fileOStr);
                }
                $('#delfile').val('');
            });
            function delFile(fname) {
                fsave = false;
                if (fname.length < 1) {
                    return;
                }
                
                $('#delfile').val(fname);
                $.ajax({ url: '../../Handlers/common/common.aspx?Method=DelFile&user=' + userID + '&srvid=' + srvID, type: "post", cache: false, data: $('#frmDelFile').serialize(), success: function (d) {

                }, error: function () {

                    $('#LJFalse').modal('show');
                }
                });
            }

            //时间选择
            var myDate = new Date();
            var shijian = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
            $("#sj").val(shijian);
            $("#jsj").val(shijian);
            $("#qdrq").val(shijian);
            $("#dqrq").val(myDate.getFullYear() + "-" + (myDate.getMonth() + 4) + "-27");
            $("#csrq_Lxr").val("1900-01-01");
            //表单默认属性
            $("#yszje").val(0);
            $("#sszje").val(0);
            var ordername = "HT" + myDate.getFullYear() + (myDate.getMonth() + 1) + myDate.getDate() + myDate.getHours() + myDate.getMinutes() + myDate.getSeconds();
            $("#ddbh").val(ordername);

            //客户信息
            $.ajax({
                url: "../../Handlers/CustomerInformation/PublicManagement/PublicMg.aspx?Method=GetByID&id=" + encodeURI(encodeURI(ID)),
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data_kh) {
                    $('#More_table').find('tr').each(function (index, element) {
                        if (index == 0) {
                            $(this).find('lable').text(data_kh.rows[0].KeHuMingCheng);
                        }
                        if (index == 1) {
                            $(this).find('lable').eq(1).text(data_kh.rows[0].KeHuDiZhi);
                        }
                        if (index == 2) {
                            $(this).find('td').eq(0).find('lable').eq(1).text(data_kh.rows[0].Contact);
                            $(this).find('td').eq(1).find('lable').eq(1).text(data_kh.rows[0].DianHuaHaoMa);
                            $(this).find('td').eq(2).find('lable').eq(1).text(data_kh.rows[0].MSN);
                            $(this).find('td').eq(3).find('lable').eq(1).text(data_kh.rows[0].Position);
                        }
                        if (index == 3) {
                            $(this).find('td').eq(0).find('lable').eq(1).text(data_kh.rows[0].YouXiang);
                            $(this).find('td').eq(1).find('lable').eq(1).text(data_kh.rows[0].QQ);
                            $(this).find('td').eq(2).find('lable').eq(1).text(data_kh.rows[0].ChuanZhen);
                            $(this).find('td').eq(3).find('lable').eq(1).text(data_kh.rows[0].YouBian);
                        }
                        if (index == 4) {
                            $(this).find('td').eq(0).find('lable').eq(1).text(data_kh.rows[0].KeHuLaiYuan);
                            $(this).find('td').eq(1).find('lable').eq(1).text(data_kh.rows[0].KeHuDengJi);
                            $(this).find('td').eq(2).find('lable').eq(1).text(data_kh.rows[0].KeHuXinYuDu);
                            $(this).find('td').eq(3).find('lable').eq(1).text(data_kh.rows[0].ZhuangTai);
                        }
                        if (index == 5) {
                            $(this).find('td').eq(0).find('lable').eq(1).text(data_kh.rows[0].ChuangJianRen);
                            $(this).find('td').eq(1).find('lable').eq(1).text(data_kh.rows[0].Sex);
                            $(this).find('td').eq(2).find('lable').eq(1).text(data_kh.rows[0].TimeStr);
                        }
                        if (index == 6) {
                            $(this).find('lable').eq(1).text(data_kh.rows[0].Beizhu);
                        }
                      
                    });

                    layer.close(l);
                    resize_r();
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
            //联系人信息
            LoadLinkMan(1, 10);
            //合同
            LoadOrder(1, 10);
            //跟踪记录
            CreateRecord();
            SelRole();
        }

        //加载订单列表
        function LoadOrder(page, pagesize) {
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadOrder_K&dd=" + ID + "&page=" + page + "&rows=" + pagesize + "",
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    CreateOrder(data);
                    if (orderload == 0) {
                        createOrderPage(pagesize, 3, data.total);
                        orderload = 1;
                    }
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
        }
        //订单生成表格
        function CreateOrder(data) {
            $('#count_dd').empty();
            for (var i = 0; i < data.rows.length; i++) {
                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.append('<div class="hidden-sm hidden-xs action-buttons" style="cursor:pointer;" ><a onclick="Select_Kh(this);">' + data.rows[i].orderID + '</a></div>');
                var _td2 = $('<td></td>');
                if (data.rows[i].KeHuMingCheng.length >= 20) {
                    _td2.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].KeHuMingCheng + '">' + data.rows[i].KeHuMingCheng.substring(0, 20) + "..." + '</span>');
                } else {
                    _td2.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].KeHuMingCheng + '">' + data.rows[i].KeHuMingCheng + '</span>');
                }
                var _td3 = $('<td style="text-align:left;padding-right:15px;"></td>');
                _td3.text(accounting.formatMoney(data.rows[i].totalMoney));
                var _td4 = $('<td style="text-align:left;padding-right:15px;"></td>');
                if (data.rows[i].count == '0') {
                    _td4.text(accounting.formatMoney(data.rows[i].JUncollected));
                } else {
                    _td4.append('<div title="有未审核的回款记录" style="float:left;cursor:pointer;" class="ui-pg-div ui-inline-edit" ><i class="ace-icon fa fa-bell icon-animated-bell red" style="margin-right:5px;"></i></div>' + accounting.formatMoney(data.rows[i].JUncollected));

                }

                var _td5 = $('<td></td>');
                _td5.text(data.rows[i].Invoice);
                var _td6 = $('<td></td>');
                _td6.text(data.rows[i].userXM);
                var _td7 = $('<td></td>');
                _td7.text(data.rows[i].state);
                var _td20 = $('<td></td>');
                _td20.text(data.rows[i].timeStr);
                var _td8 = $('<td style="display: none;"></td>');
                _td8.append('');

                var _td9 = $('<td style="display: none;"></td>');
                _td9.text(data.rows[i].ID);
                var _td10 = $('<td style="display: none;"></td>');
                _td10.text(data.rows[i].clientID); //客户ID
                var _td11 = $('<td style="display: none;"></td>');
                _td11.text(data.rows[i].relationPersonID); //联系人ID
                var _td12 = $('<td style="display: none;"></td>');
                _td12.text(data.rows[i].actualMoney); //实收总金额
                var _td13 = $('<td style="display: none;"></td>');
                _td13.text(data.rows[i].ContractCategory); //合同类别
                var _td14 = $('<td style="display: none;"></td>');
                _td14.text(data.rows[i].Remarks); //备注
                var _td15 = $('<td style="display: none;"></td>');
                _td15.text(data.rows[i].Annex); //附件
                var _td16 = $('<td style="display: none;"></td>');
                _td16.text(data.rows[i].ContactTelephone); //联系人电话
                var _td17 = $('<td style="display: none;"></td>');
                _td17.text(data.rows[i].LianXiRenMingCheng); //联系人名称
                var _td18 = $('<td style="display: none;"></td>');
                _td18.text(data.rows[i].saleMan); //销售人员
                var _td19 = $('<td style="display: none;"></td>');
                _td19.text(data.rows[i].userXM); //创建人员
                var _td21 = $('<td style="display: none;"></td>');
                _td21.text(data.rows[i].Noremarks); //不生效原因
                var _td22 = $('<td style="display: none;"></td>');
                _td22.text(data.rows[i].totalMoney); //未转换的应收金额
                var _td24 = $('<td style="display: none;"></td>');
                _td24.text(data.rows[i].ExpirationTime); //到期日期
                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                _tr1.append(_td7);
                _tr1.append(_td20);
                _tr1.append(_td8);
                _tr1.append(_td9); //ID
                _tr1.append(_td10); //客户ID
                _tr1.append(_td11); //联系人ID
                _tr1.append(_td12); //实收总金额
                _tr1.append(_td13); //合同类别
                _tr1.append(_td14); //备注
                _tr1.append(_td15); //附件
                _tr1.append(_td16); //联系人电话
                _tr1.append(_td17); //联系人名称
                _tr1.append(_td18); //销售人员
                _tr1.append(_td19); //创建人员
                _tr1.append(_td21); //不生效原因
                _tr1.append(_td22); //未转换的应收金额
                _tr1.append(_td24);
                $('#count_dd').append(_tr1);
                ClickEvent();
                resize_r();
            }
        }

        //查看客户信息
        function Select_Kh(obj) {

            var tds = $(obj).parent().parent().parent().find('td');
            $('#sddbh').val(tds.eq(0).text());
            $('#skhmc').val(tds.eq(1).text());
            $('#skhbh').val(tds.eq(10).text());
            $('#slxr').val(tds.eq(17).text());
            $('#slxrbh').val(tds.eq(11).text());
            $('#slxdh').val(tds.eq(16).text());
            $('#shtlb').val(tds.eq(13).text());
            $('#syszje').val(tds.eq(21).text());
            $('#ssszje').val(tds.eq(12).text());
            $('#sfp').val(tds.eq(4).text());
            $('#sbz').val(tds.eq(14).text());
            $("#sxz").hide();
            $('#lookfList').empty();
            if (tds.eq(15).text() != "") {
                $('#sfj').val(tds.eq(15).text());
                var fjlist = tds.eq(15).text().split('╯');
                for (var i = 0; i < fjlist.length; i++) {
                    if (fjlist[i].length > 0) {
                        var mc = fjlist[i].substring(fjlist[i].lastIndexOf('/')+1,fjlist[i].lastIndexOf('.'));
                        var eachItem = $('<li style="float:left;"><img ></img><a style="float:left;"></a></li>');
                        eachItem.find('a').attr('href', "../" + fjlist[i]);
                        eachItem.find('a').attr('target', "_blank");
                        eachItem.find('a').css({ 'display': 'block' });
                        eachItem.find('img').attr('src', "../../Scripts/BootStrap/img/fj.png");
                        eachItem.find('img').css({ 'width': '15px', 'height': '15px', 'float': 'left', 'margin-left': '5px' });
                        eachItem.find('a').text(mc);
                        $('#lookfList').append(eachItem);
                    }
                }
//                document.getElementById("sxz").href = tds.eq(15).text();
//                $("#sxz").text("下载");
//                $("#sxz").attr("target", "_blank");
            } else {
                $('#sfj').val("");
                $("#sxz").text("没附件");
                $("#sxz").removeAttr('target');
                document.getElementById("sxz").href = "javascript:void(0);";
                $("#sxz").show();
            }
            $('#sqdrq').val(tds.eq(7).text());
            $('#sdqrq').val(tds.eq(22).text());
//            if (tds.eq(15).text() != "") {
//                $("#sxz").attr("href", "../" + tds.eq(15).text());
//                $("#sxz").text("下载");
//            }
//            else {
//                $("#sxz").attr("href", "");
//                $("#sxz").text("");
//            }
            $('#sHid').val(tds.eq(9).text());
            $('#sxsrybh').val(tds.eq(18).text());
            $('#sxsry').val(tds.eq(19).text());
            $('#sHzt').val(tds.eq(6).text());
            if (tds.eq(6).text() == "未生效") {
                $("#sli_yy").show();
                var tb = document.getElementById("sManagement_A_Y");
                for (var i = tb.rows.length - 1; i > 0; i--) {
                    tb.deleteRow(i);
                }
                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td style="text-align:right;width:70px;"></td>');
                _td1.text("原因:");
                var _td2 = $('<td></td>');
                if (tds.eq(20).text().length >= 20) {
                    _td2.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + tds.eq(20).text() + '">' + tds.eq(20).text().substring(0, 20) + "..." + '</span>');
                } else {
                    _td2.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + tds.eq(20).text() + '">' + tds.eq(20).text() + '</span>');
                }

                _tr1.append(_td1);
                _tr1.append(_td2);
                $('#sManagement_A_Y tbody').append(_tr1);
                ClickEvent();
            }
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadCP&page=1&rows=10000&order=" + tds.eq(9).text(),
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    sCreateTable_CPList(data);

                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadJL&page=1&rows=10000&order=" + tds.eq(9).text(),
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    sCreateTable_JLList(data);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
            window.parent.scrollTo(0,0);
            $('#sAddDialog').modal('show');
        }
        //查看合同中产品表格
        function sCreateTable_CPList(data) {
            var tb = document.getElementById("sManagement_A_C");
            var zt = $("#sHzt").val();
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {

                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.text(data.rows[i].ProductsName);
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].actualPrice);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].saleCount);
                var _td4 = $('<td></td>');
                _td4.append(data.rows[i].AllMoney);
                var _td5 = $('<td></td>');

                var _td6 = $('<td style="display: none;"></td>');
                _td6.text(data.rows[i].ID);
                var _td7 = $('<td style="display: none;"></td>');
                _td7.text(data.rows[i].productID);

                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td6);
                _tr1.append(_td7);
                $('#sManagement_A_C tbody').append(_tr1);

            }
            resize_r();
        }
        //查看合同中付款记录
        function sCreateTable_JLList(data) {
            var tb = document.getElementById("sManagement_A_J");
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {
                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.text(data.rows[i].dueDates);
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].Payment);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].Invoice);
                var _td4 = $('<td></td>');
                _td4.text(data.rows[i].receivedAmount);
                var _td5 = $('<td></td>');
                if (data.rows[i].Beizhu.length >= 5) {
                    _td5.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].Beizhu + '">' + data.rows[i].Beizhu.substring(0, 20) + "..." + '</span>');
                    //_td5.append('<p><span style="cursor:pointer;" data-rel="popover" data-placement="top" data-content="' + data.rows[i].Beizhu + '">' + data.rows[i].Beizhu.substring(0, 20) + "..." + '</span></p>');
                } else {
                    _td5.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].Beizhu + '">' + data.rows[i].Beizhu + '</span>');
                    //_td5.append('<p><span style="cursor:pointer;" data-rel="popover" data-placement="top" data-content="' + data.rows[i].Beizhu + '">' + data.rows[i].Beizhu + '</span></p>');
                }
                var _td6 = $('<td></td>');
                _td6.text(data.rows[i].State);
                var _td7 = $('<td style="display: none;"></td>');
                _td7.text(data.rows[i].ID);
                var _td8 = $('<td style="display: none;"></td>');
                _td8.text(data.rows[i].Beizhu);
                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                _tr1.append(_td7);
                _tr1.append(_td8);
                $('#sManagement_A_J tbody').append(_tr1);
                ClickEvent();
                resize_r();
            }
        }
        //跟踪记录生成表格
        function CreateRecord() {
            $("#Management").empty();
            $.ajax({
                url: "../../Handlers/CustomerInformation/CustomerCommunicationRecord/CommunicationRecord.aspx?Method=All&page=1&rows=5&ID=" + ID + "&srvid=" + srvID,
                type: "get",
                cache: false,
                dataType: "json",
                success: function (data) {
                    var count_gz = "";
                    for (var i = 0; i < data.rows.length; i++) {
                        if (data.rows[i].XiangXiXinXi.length > 0) {
                            count_gz += "<div class=\"timeline-items\"><div class=\"timeline-item clearfix\"><div class=\"timeline-info\"><input ID=\"GY_" + data.rows[i].ID + "\" value=\"" + data.rows[i].GaiYao + "\" type=\"hidden\" /><span class=\"timeline-indicator ace-icon btn btn-warning no-hover green\" style=\"font-size:12px;height:20px;line-height:14px;\">" + data.rows[i].GaiYao + "</span></div><div class=\"widget-box transparent\"><div  style=\"background: #f9f9f9;\" class=\"widget-header widget-header-small\"><h5 class=\"widget-title smaller\"><input ID=\"DD_" + data.rows[i].ID + "\" value=\"" + data.rows[i].DiDian + "\" type=\"hidden\" /><input ID=\"SJ_" + data.rows[i].ID + "\" value=\"" + data.rows[i].ShiJian + "\" type=\"hidden\" /><span class=\"grey\">" + data.rows[i].ShiJian + "</span><span class=\"widget-toolbar no-border\"><a title=\"修改\"  tag=\"M_100_ER\" href=\"javascript:Update_Gzjl_CZ('" + data.rows[i].ID + "');\"><span class=\"tbqbgw\">修改</span></a> <a title=\"删除\"  tag=\"M_100_DR\" href=\"javascript:Del_Gzjl_CZ('" + data.rows[i].ID + "');\"><span class=\"tbqbgw\">删除</span></a></span></h5></div><div class=\"widget-body\"><input ID=\"XX_" + data.rows[i].ID + "\" value=\"" + data.rows[i].XiangXiXinXi + "\" type=\"hidden\" /><div class=\"widget-main\"  style=\"background: #f9f9f9;\">" + data.rows[i].XiangXiXinXi + "</div></div></div></div>";
                        } else {
                            count_gz += "<div class=\"timeline-items\"><div class=\"timeline-item clearfix\"><div class=\"timeline-info\"><input ID=\"GY_" + data.rows[i].ID + "\" value=\"" + data.rows[i].GaiYao + "\" type=\"hidden\" /><span class=\"timeline-indicator ace-icon btn btn-warning no-hover green\" style=\"font-size:13px;\">" + data.rows[i].GaiYao + "</span></div><div class=\"widget-box transparent\"><div  style=\"background: #f9f9f9;\" class=\"widget-header widget-header-small fbiaoti_ad\"><h5 class=\"widget-title smaller\"><input ID=\"DD_" + data.rows[i].ID + "\" value=\"" + data.rows[i].DiDian + "\" type=\"hidden\" /><input ID=\"SJ_" + data.rows[i].ID + "\" value=\"" + data.rows[i].ShiJian + "\" type=\"hidden\" /><span class=\"grey\">" + data.rows[i].ShiJian + "</span><span class=\"widget-toolbar no-border\"><a title=\"修改\"  tag=\"M_100_ER\" href=\"javascript:Update_Gzjl_CZ('" + data.rows[i].ID + "');\"><span class=\"tbqbgw\">修改</span></a> <a title=\"删除\"  tag=\"M_100_DR\" href=\"javascript:Del_Gzjl_CZ('" + data.rows[i].ID + "');\"><span class=\"tbqbgw\">删除</span></a></span></h5></div><div class=\"widget-body\"  style=\"background: #f9f9f9;\"><input ID=\"XX_" + data.rows[i].ID + "\" value=\"" + data.rows[i].XiangXiXinXi + "\" type=\"hidden\" /></div></div></div>";
                        }
                    }
                    $("#Management").html(count_gz);
                    SelRole();
                    resize_r();
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }
        //加载联系人
        function LoadLinkMan(page, pagesize) {
            $("#count_lxr").empty();
            $.ajax({
                url: "../../Handlers/CustomerInformation/CustomerContact/CustomerContact.aspx?Method=All&srvid=" + srvID + "&userid=" + userID + "&page=" + page + "&rows=" + pagesize + "&ID=" + ID,
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    CreateLinkMan(data);
                    if (firstLoad == 0) {
                        createPage(pagesize, 3, data.total);
                        firstLoad = 1;
                    }
                    resize_r();
                },
                error: function () {

                    layer.msg('加载失败！', 1, 3);
                    resize_r();
                }
            });
        }
        //联系人生成表格
        function CreateLinkMan(data) {
            $('#count_lxr').empty();
            for (var i = 0; i < data.rows.length; i++) {
                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.text(data.rows[i].LianXiRenMingCheng);
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].DianHuaHaoMa);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].ZhiWei);
                var _td4 = $('<td></td>');
                _td4.text(data.rows[i].YouXiang);
                var _td5 = $('<td></td>');
                _td5.text(data.rows[i].QQ);
                var _td6 = $('<td></td>');
                if (data.rows[i].BeiZhu.length >= 20) {
                    _td6.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].BeiZhu + '">' + data.rows[i].BeiZhu.substring(0, 20) + "..." + '</span>');
                } else {
                    _td6.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].BeiZhu + '">' + data.rows[i].BeiZhu + '</span>');
                }
                //_td6.text(data.rows[i].BeiZhu);
                var _td7 = $('<td></td>');
                _td7.append('<div class="wjsygn"><a data-toggle="modal" data-target="#uDialog" href="javascript:void(0)"  tag="M_100_EL" title="修改" onclick="Update_Lxr_CZ(this);" ><span class=\"tbqbgw\">修改</span></a><a title="删除"  tag="M_100_DL" href="javascript:Del_Lxr_CZ(\'' + data.rows[i].ID + '\');"><span class=\"tbqbgw\">删除</span></a></div>');

                var _td8 = $('<td style="display: none;"></td>');
                _td8.text(data.rows[i].YingWenMingCheng);
                var _td9 = $('<td style="display: none;"></td>');
                _td9.text(data.rows[i].XingBie);
                var _td10 = $('<td style="display: none;"></td>');
                _td10.text(data.rows[i].JueCeDengJi);
                var _td11 = $('<td style="display: none;"></td>');
                _td11.text(data.rows[i].HunFou);
                var _td12 = $('<td style="display: none;"></td>');
                _td12.text(data.rows[i].DianHuaLeiXing);
                var _td13 = $('<td style="display: none;"></td>');
                _td13.text(data.rows[i].ChuShengRiQi);
                var _td14 = $('<td style="display: none;"></td>');
                _td14.text(data.rows[i].ChuanZhen);
                var _td15 = $('<td style="display: none;"></td>');
                _td15.text(data.rows[i].MSN);
                var _td16 = $('<td style="display: none;"></td>');
                _td16.text(data.rows[i].AiHao);
                var _td17 = $('<td style="display: none;"></td>');
                _td17.text(data.rows[i].ID);
                var _td18 = $('<td style="display: none;"></td>');
                _td18.text(data.rows[i].BeiZhu);
                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                _tr1.append(_td7);
                _tr1.append(_td8);
                _tr1.append(_td9);
                _tr1.append(_td10);
                _tr1.append(_td11);
                _tr1.append(_td12);
                _tr1.append(_td13);
                _tr1.append(_td14);
                _tr1.append(_td15);
                _tr1.append(_td16);
                _tr1.append(_td17);
                _tr1.append(_td18);
                $('#count_lxr').append(_tr1);
                ClickEvent();
            }
            SelRole();
            resize_r();
        }
        //查看合同
        function CheckHt(id) {
            $.getJSON("../../Handlers/Contract/ContractManagement/ContractMg.aspx?Method=GetByID", { "id": id }, function (data, status) {
                if (status == "success") {
                    var jsons = data.rows[0];

                    //绑定数据
                    $('#lbNo').text(jsons.contractNO);
                    $("#lbName").text(jsons.contractName);
                    $("#lbSum").text(jsons.AmountMoney);
                    $("#lbQdDate").text(jsons.signingDate);
                    $("#lbQdMan").text(jsons.signingStaff);
                    $("#lbLink").text(jsons.Contacts);
                    $("#lbTel").text(jsons.ContactTelephone);
                    $("#lbEmail").text(jsons.ContactEmail);
                    $("#lbAddr").text(jsons.ContactAddress);
                    $("#lbAttr").text(jsons.Attachments);
                    $("#lbSaler").text(jsons.SaleMan);
                    $("#lbBz").text(jsons.Remarks);
                    $("#ContrLink").text(jsons.Contacts);
                    $("#lbDd").text(jsons.DdName);
                    $("#lbKh").text(jsons.KhName);
                    $("#lbQdMan").text(jsons.QdMan);
                    //发票转换
                    var fptext = "无";
                    if (jsons.FaPiao == "true") {
                        fptext = "有";
                    }
                    $("#lbFp").text(fptext);
                    $("#lbPay").text(jsons.PayType);
                    //合同ID 
                    $("#lbHtId").text(jsons.ID);

                    //serverid
                    $("#lbServerid").text(jsons.ServiceID);

                    $('#HtCheck').modal('show');
                } else {
                    alert("网络错误！请稍后重试！");
                }
            });
            GetPlanList(id);
        }
        //获取计划列表
        function GetPlanList(id) {
            //根据合同获取付款计划

            $.getJSON("../../Handlers/Contract/ContractManagement/ContractMg.aspx?Method=GetPlanByHt", { "id": id }, function (data, status) {
                if (status == "success") {
                    for (var i = 0; i < data.rows.length; i++) {
                        var _tr1 = $('<tr></tr>');

                        var _td1 = $('<td></td>');
                        _td1.text(data.rows[i].dueDates);
                        var _td2 = $('<td></td>');
                        _td2.text(data.rows[i].NeiRong);
                        var _td3 = $('<td></td>');
                        _td3.text(data.rows[i].Beizhu);
                        var _td4 = $('<td></td>');
                        _td4.text(data.rows[i].receivedAmount);
                        var _td5 = $('<td></td>');
                        _td5.text(data.rows[i].State);
                        var _td6 = $('<td></td>');
                        _td6.text(data.rows[i].Percentage);
                        _tr1.append(_td1);
                        _tr1.append(_td2);
                        _tr1.append(_td3);
                        _tr1.append(_td4);
                        _tr1.append(_td5);
                        _tr1.append(_td6);
                        $('#CheckPlTb tbody').append(_tr1);
                    }
                    resize_r();
                } else {
                    alert("网络错误！请稍后重试！");
                }
            });
        }
        function QueRen() {
            $('#QueRen').modal('hide');
        }
        //添加
        function ADD_Gzjl() {
            $(".popover ").remove();
            var myDate = new Date();
            var shijian = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
            $("#sj").val(shijian);
            $("#dd").val("");
            $("#xxxx").val("");
            window.parent.scrollTo(0,0);
            $('#AddDialog').modal('show');
        }
        function Add_Gzjl_CZ() {
            $('#JAdd').validation();
            var alm = $(".popover");
            if (alm.length > 0) {
                return;
            }
            var sj = document.getElementById("sj").value;
            var dd = document.getElementById("dd").value;
            var gy = document.getElementById("gy").value;
            var xxxx = document.getElementById("xxxx").value;
            var khid = document.getElementById("KHID").value;
            var serv = document.getElementById("srvid").value;
            sj = encodeJson_News(sj);
            dd = encodeJson_News(dd);
            gy = encodeJson_News(gy);
            xxxx = encodeJson_News(xxxx);
            khid = encodeJson_News(khid);
            serv = encodeJson_News(serv);
            var l = layer.load("正在提交，请稍等...");
            $.ajax({
                type: "post",
                url: "../../Handlers/CustomerInformation/CustomerCommunicationRecord/CommunicationRecord.aspx?Method=Add&khbh=" + khid + "&serviceid=" + serv + "&sj=" + encodeURI(encodeURI(sj)) + "&dd=" + encodeURI(encodeURI(dd)) + "&gy=" + encodeURI(encodeURI(gy)) + "&xxxx=" + encodeURI(encodeURI(xxxx)),
                cache: false,
                success: function (msg) {
                    layer.close(l);
                    if (msg == "sucess") {
                        $('#AddDialog').modal('hide');
                        $('#sj').val("");
                        $('#dd').val("");
                        $('#gy').val("");
                        $('#xxxx').val("");
                        $("#Management").empty();
                        CreateRecord();
                    }
                    else {
                        layer.close(l);
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }
        //操作列的修改
        function Update_Gzjl_CZ(ID) {
            var sj = document.getElementById("SJ_" + ID).value;
            var dd = document.getElementById("DD_" + ID).value;
            var gy = document.getElementById("GY_" + ID).value;
            var xx = document.getElementById("XX_" + ID).value;
            //绑定数据

            $('#usj').val(sj);
            $('#udd').val(dd);
            $('#ugy').val(gy);
            $('#uxxxx').val(xx);
            $('#uID').val(ID);

            $('#uAddDialog').modal('show');
        }
        function Update_Gzjl_ZD() {
            $('#uJAdd').validation();
            var alm = $(".popover");
            if (alm.length > 0) {
                return;
            }
            var sj = document.getElementById("usj").value;
            var dd = document.getElementById("udd").value;
            var gy = document.getElementById("ugy").value;
            var xxxx = document.getElementById("uxxxx").value;
            var ID = document.getElementById("uID").value;
            sj = encodeJson_News(sj);
            dd = encodeJson_News(dd);
            gy = encodeJson_News(gy);
            xxxx = encodeJson_News(xxxx);
            ID = encodeJson_News(ID);
            $.ajax({
                type: "post",
                url: "../../Handlers/CustomerInformation/CustomerCommunicationRecord/CommunicationRecord.aspx?Method=Update&JwjlID=" + ID + "&sj=" + encodeURI(encodeURI(sj)) + "&dd=" + encodeURI(encodeURI(dd)) + "&gy=" + encodeURI(encodeURI(gy)) + "&xxxx=" + encodeURI(encodeURI(xxxx)),
                cache: false,
                success: function (msg) {
                    if (msg == "sucess") {
                        $('#uAddDialog').modal('hide');
                        $("#Management").empty();
                        CreateRecord();
                    }
                    else {
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }
        //操作列的删除
        function Del_Gzjl_CZ(ID) {
            $("#DelID").val(ID);
            $('#Del').modal('show');
        }
        function Del_Gzjl_ZD() {
            var ID = document.getElementById("DelID").value;
            $.ajax({
                type: "post",
                url: "../../Handlers/CustomerInformation/CustomerCommunicationRecord/CommunicationRecord.aspx?Method=Del&ID=" + ID,
                cache: false,
                success: function (msg) {
                    if (msg == "sucess") {
                        $('#Del').modal('hide');
                        $("#Management").empty();
                        CreateRecord();
                    }
                    else {
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }

        //联系人添加
        function ADD_Lxr() {
            //            $(".popover ").remove();
            //            $("#LAdd_Lxr input").val("");
            //            $("#csrq_Lxr").val("1980-01-01");
            //            loadPositon("", "zw_Lxr");
            //            $("#xz").removeAttr("href").text("");
            //            $("#fj").val("");
            $('#AddDialog_Lxr').modal('show');
        }
        //加载职位信息
        function loadPositon(name, id) {
            var severid = srvID;
            $.ajax({
                dataType: 'json',
                type: "get",
                url: "../../Handlers/CustomerInformation/PublicManagement/PublicMg.aspx?Method=ukhposition",
                async: false,
                data: { id: severid },
                success: function (jsons) {
                    var droplist = $("#" + id + "");
                    $("#" + id + " option[value!='']").remove();
                    for (i = 0; i < jsons.length; i++) {
                        $option = $("<option></option>");
                        $option.attr("value", jsons[i].text);
                        $option.text(jsons[i].text);
                        droplist.append($option);
                    }
                    if (name != "") {
                        $("#" + id + " option[value=" + name + "]").attr("selected", true);
                    }
                },
                error: function () {
                    alert("网络错误，不能加载职位信息！");
                }
            });
        }
        //点击添加职位信息
        function CreatePosition() {
            var poid = "zw_Lxr";
            $("#hidid").val(poid);
            $("#M_Position").modal("show");
        }
        //点击添加职位信息
        function CreatePositionEdit() {
            var poid = "uzw_Lxr";
            $("#hidid").val(poid);
            $("#M_Position").modal("show");
        }
        //确认添加职位信息
        function PositionAdd(id) {
            id = $("#hidid").val();
            $('#frmAddCategory').validation();
            var alm = $(".popover");
            if (alm.length > 0) {
                return;
            }
            var name = $("#txtFName").val();
            name = encodeJson_News(name);
            $.ajax({ url: '../../Handlers/CustomerInformation/PublicManagement/PublicMg.aspx?Method=addposi&srvid=' + srvID + "&name=" + name, cache: false, type: 'post', success: function (data) {
                if (data == "success") {
                    $("#M_Position").modal("hide");
                    layer.msg('添加成功！', 1, 1);
                    loadPositon(name, id);
                }
                else {
                    if (data == "exist") {
                        layer.msg('已经存在此类别！', 1, 3);
                    }
                    else {
                        layer.msg('添加失败！', 1, 3);
                    }
                }
            }, error: function () { alert('添加产品类别错误！'); }
            });
        }
        function Add_Lxr_CZ() {
            $('#LAdd_Lxr').validation();
            var alm = $(".popover");
            if (alm.length > 0) {
                return;
            }
            var xm = $("#lxrmc_Lxr").val();
            if (xm == "") {
                $("#lxrmc_Lxr").focus();
                return;
            }
            var ywmc = document.getElementById("ywmc_Lxr").value;
            var xb = document.getElementById("xb_Lxr").value;
            var zw = document.getElementById("zw_Lxr").value;
            var jcdj = document.getElementById("jcdj_Lxr").value;
            var hf = document.getElementById("hf_Lxr").value;
            var dhlx = document.getElementById("dhlx_Lxr").value;
            var dhhm = document.getElementById("dhhm_Lxr").value;
            var cz = document.getElementById("cz_Lxr").value;
            var QQ = document.getElementById("QQ_Lxr").value;
            var MSN = document.getElementById("MSN_Lxr").value;
            var yx = document.getElementById("yx_Lxr").value;
            var ah = document.getElementById("ah_Lxr").value;
            var bz = document.getElementById("bz_Lxr").value;
            var csrq = document.getElementById("csrq_Lxr").value;
            var khid = document.getElementById("KHID").value;
            xm = encodeJson_News(xm);
            ywmc = encodeJson_News(ywmc);
            xb = encodeJson_News(xb);
            zw = encodeJson_News(zw);
            jcdj = encodeJson_News(jcdj);
            hf = encodeJson_News(hf);
            dhlx = encodeJson_News(dhlx);
            dhhm = encodeJson_News(dhhm);
            cz = encodeJson_News(cz);
            QQ = encodeJson_News(QQ);
            MSN = encodeJson_News(MSN);
            yx = encodeJson_News(yx);
            ah = encodeJson_News(ah);
            bz = encodeJson_News(bz);
            csrq = encodeJson_News(csrq);
            var l = layer.load("正在提交，请稍等...");
            $.ajax({
                type: "post",
                url: "../../Handlers/CustomerInformation/CustomerContact/CustomerContact.aspx?Method=Add&khbh=" + khid + "&lxrmc=" + encodeURI(encodeURI(xm)) + "&ywmc=" + encodeURI(encodeURI(ywmc)) + "&xb=" + encodeURI(encodeURI(xb)) + "&zw=" + encodeURI(encodeURI(zw)) + "&jcdj=" + encodeURI(encodeURI(jcdj)) + "&hf=" + encodeURI(encodeURI(hf)) + "&dhlx=" + encodeURI(encodeURI(dhlx)) + "&dhhm=" + encodeURI(encodeURI(dhhm)) + "&cz=" + encodeURI(encodeURI(cz)) + "&QQ=" + encodeURI(encodeURI(QQ)) + "&MSN=" + encodeURI(encodeURI(MSN)) + "&yx=" + encodeURI(encodeURI(yx)) + "&ah=" + encodeURI(encodeURI(ah)) + "&bz=" + encodeURI(encodeURI(bz)) + "&csrq=" + encodeURI(encodeURI(csrq)),
                cache: false,
                success: function (msg) {
                    layer.close(l);
                    if (msg == "sucess") {
                        $('#AddDialog_Lxr').modal('hide');
                        $('#lxrmc_Lxr').val("");
                        $('#ywmc_Lxr').val("");
                        $('#xb_Lxr').val("");
                        $('#zw_Lxr').val("");
                        $('#jcdj_Lxr').val("");
                        $('#hf_Lxr').val("");
                        $('#dhlx_Lxr').val("");
                        $('#dhhm_Lxr').val("");
                        $('#cz_Lxr').val("");
                        $('#QQ_Lxr').val("");
                        $('#MSN_Lxr').val("");
                        $('#yx_Lxr').val("");
                        $('#ah_Lxr').val("");
                        $('#bz_Lxr').val("");
                        $('#csrq_Lxr').val("");
                        LoadLinkMan(1, 10);
                        firstLoad = 0;
                        mPage = 1;
                    }
                },
                error: function () {
                    layer.close(l);
                    $('#LJFalse_Lxr').modal('show');
                }
            });
        }
        //联系人操作列的修改
        function Update_Lxr_CZ(obj) {
            var tds = $(obj).parent().parent().parent().find('td');
            //绑定数据
            $('#ulxrmc_Lxr').val(tds.eq(0).text());
            $('#udhhm_Lxr').val(tds.eq(1).text());
            loadPositon(tds.eq(2).text(), "uzw_Lxr");
            $('#uyx_Lxr').val(tds.eq(3).text());
            $('#uQQ_Lxr').val(tds.eq(4).text());
            $('#ubz_Lxr').val(tds.eq(17).text());
            $('#uywmc_Lxr').val(tds.eq(7).text());
            $("#uxb_Lxr [option value=" + tds.eq(8).text() + "]").attr("selected", true);
            $('#ujcdj_Lxr').val(tds.eq(9).text());
            $('#uhf_Lxr').val(tds.eq(10).text());
            $('#udhlx_Lxr').val(tds.eq(11).text());
            $('#ucsrq_Lxr').val(tds.eq(12).text());
            $('#ucz_Lxr').val(tds.eq(13).text());
            $('#uMSN_Lxr').val(tds.eq(14).text());
            $('#uah_Lxr').val(tds.eq(15).text());
            $('#uID_Lxr').val(tds.eq(16).text());

            $('#uAddDialog_Lxr').modal('show');
        }
        function Update_Lxr_ZD() {
            $('#uLAdd_Lxr').validation();
            var alm = $(".popover");
            if (alm.length > 0) {
                return;
            }
            var xm = document.getElementById("ulxrmc_Lxr").value;
            var ywmc = document.getElementById("uywmc_Lxr").value;
            var xb = document.getElementById("uxb_Lxr").value;
            var zw = document.getElementById("uzw_Lxr").value;
            var jcdj = document.getElementById("ujcdj_Lxr").value;
            var hf = document.getElementById("uhf_Lxr").value;
            var dhlx = document.getElementById("udhlx_Lxr").value;
            var dhhm = document.getElementById("udhhm_Lxr").value;
            var cz = document.getElementById("ucz_Lxr").value;
            var QQ = document.getElementById("uQQ_Lxr").value;
            var MSN = document.getElementById("uMSN_Lxr").value;
            var yx = document.getElementById("uyx_Lxr").value;
            var ah = document.getElementById("uah_Lxr").value;
            var bz = document.getElementById("ubz_Lxr").value;
            var csrq = document.getElementById("ucsrq_Lxr").value;
            var ID = document.getElementById("uID_Lxr").value;
            xm = encodeJson_News(xm);
            ywmc = encodeJson_News(ywmc);
            xb = encodeJson_News(xb);
            zw = encodeJson_News(zw);
            jcdj = encodeJson_News(jcdj);
            hf = encodeJson_News(hf);
            dhlx = encodeJson_News(dhlx);
            dhhm = encodeJson_News(dhhm);
            cz = encodeJson_News(cz);
            QQ = encodeJson_News(QQ);
            MSN = encodeJson_News(MSN);
            yx = encodeJson_News(yx);
            ah = encodeJson_News(ah);
            bz = encodeJson_News(bz);
            csrq = encodeJson_News(csrq);
            if (xm == "" || dhhm == "") {
                $('#XMorDH').modal('show');
                return;
            } else {
                $.ajax({
                    type: "post",
                    url: "../../Handlers/CustomerInformation/CustomerContact/CustomerContact.aspx?Method=Update&LxrId=" + ID + "&lxrmc=" + encodeURI(encodeURI(xm)) + "&ywmc=" + encodeURI(encodeURI(ywmc)) + "&xb=" + encodeURI(encodeURI(xb)) + "&zw=" + encodeURI(encodeURI(zw)) + "&jcdj=" + encodeURI(encodeURI(jcdj)) + "&hf=" + encodeURI(encodeURI(hf)) + "&dhlx=" + encodeURI(encodeURI(dhlx)) + "&dhhm=" + encodeURI(encodeURI(dhhm)) + "&cz=" + encodeURI(encodeURI(cz)) + "&QQ=" + encodeURI(encodeURI(QQ)) + "&MSN=" + encodeURI(encodeURI(MSN)) + "&yx=" + encodeURI(encodeURI(yx)) + "&ah=" + encodeURI(encodeURI(ah)) + "&bz=" + encodeURI(encodeURI(bz)) + "&csrq=" + encodeURI(encodeURI(csrq)),
                    cache: false,
                    success: function (msg) {
                        if (msg == "sucess") {
                            $('#uAddDialog_Lxr').modal('hide');
                            LoadLinkMan(1, 10);
                            firstLoad = 0;
                            mPage = 1;
                        }
                        else {
                            $('#False').modal('show');
                        }
                    },
                    error: function () {
                        $('#LJFalse_Lxr').modal('show');
                    }
                });
            }
        }
        //联系人操作列的删除
        function Del_Lxr_CZ(ID) {
            $("#DelID_Lxr").val(ID);
            $('#Del_Lxr').modal('show');
        }
        function Del_Lxr_ZD() {
            var ID = document.getElementById("DelID_Lxr").value;
            $.ajax({
                type: "post",
                url: "../../Handlers/CustomerInformation/CustomerContact/CustomerContact.aspx?Method=Del&ID=" + ID,
                cache: false,
                success: function (msg) {
                    if (msg == "sucess") {
                        $("#Del_Lxr").modal("hide");
                        LoadLinkMan(1, 10);
                        firstLoad = 0;
                        mPage = 1;
                    }
                    else {
                        $('#False').modal('show');
                        $('#Del').modal('hide');
                    }
                },
                error: function () {
                    $('#LJFalse_Lxr').modal('show');
                    $('#Del').modal('hide');
                }
            });
        }

        var page = 2;
        // 监听滚动条变化的事件
        window.onscroll = function () {
            if ((document.documentElement.scrollTop | document.body.scrollTop) == 0) {
                $("#nav").fadeOut(1000);
            }
            else {
                $("#nav").fadeIn(1000);
            }
            // 检查滚动条是否已达到底部
            if (document.documentElement.scrollHeight == (document.documentElement.scrollTop | document.body.scrollTop) + document.documentElement.clientHeight) {
                $.ajax({
                    url: "../../Handlers/CustomerInformation/CustomerCommunicationRecord/CommunicationRecord.aspx?Method=All&page=" + page + "&rows=5&ID=" + ID + "&srvid=" + srvID,
                    type: "post",
                    cache: false,
                    dataType: "json",
                    success: function (data) {
                        var count_gz = "";
                        if (data.rows.length > 0) {
                            for (var i = 0; i < data.rows.length; i++) {
                                count_gz += "<div class=\"timeline-items\"><div class=\"timeline-item clearfix\"><div class=\"timeline-info\"><input ID=\"GY_" + data.rows[i].ID + "\" value=\"" + data.rows[i].GaiYao + "\" type=\"hidden\" /><span class=\"timeline-indicator ace-icon btn btn-warning no-hover green\" style=\"font-size:13px;\">" + data.rows[i].GaiYao + "</span></div><div class=\"widget-box transparent\"><div class=\"widget-header widget-header-small \"><h5 class=\"widget-title smaller\"><input ID=\"DD_" + data.rows[i].ID + "\" value=\"" + data.rows[i].DiDian + "\" type=\"hidden\" /><input ID=\"SJ_" + data.rows[i].ID + "\" value=\"" + data.rows[i].ShiJian + "\" type=\"hidden\" /><span class=\"grey\">" + data.rows[i].ShiJian + "</span><span class=\"widget-toolbar no-border\"><a href=\"javascript:Update_Gzjl_CZ('" + data.rows[i].ID + "');\"><i class=\"ace-icon fa fa-pencil green bigger-125\"></i></a> <a href=\"javascript:Del_Gzjl_CZ('" + data.rows[i].ID + "');\"><i class=\"ace-icon fa fa-trash-o red bigger-125\"></i></a></span></h5></div><div class=\"widget-body\"><input ID=\"XX_" + data.rows[i].ID + "\" value=\"" + data.rows[i].XiangXiXinXi + "\" type=\"hidden\" /><div class=\"widget-main\">" + data.rows[i].XiangXiXinXi + "</div></div></div></div>";

                            }
                            $("#Management").append(count_gz);
                            page++;
                        }
                        else {
                            //$("#Management").append("<div style='margin:20px auto; text-align:center'>没有了...</div>");
                            window.onscroll = function () {
                                if ((document.documentElement.scrollTop | document.body.scrollTop) == 0) {
                                    $("#nav").fadeOut(1000);
                                }
                                else {
                                    $("#nav").fadeIn(1000);
                                }
                            };
                        }
                    },
                    error: function () {
                        $('#LJFalse').modal('show');
                    }
                });

            }
        }
        //添加订单
        function ADD_DD() {
            $(".popover ").remove();
            $("#FmAddDd input").val("").removeAttr("selected");
            $("#yszje").val(0);
            $("#sszje").val(0);
            $('#xz').text('');
            $('#fList').empty();
            $('#fj').val('');
            $('#uploadlist').show() ;
            $('#uploadify').show();
            var tb = document.getElementById("Management_A_C");
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }

            var tb2 = document.getElementById("Management_A_J");
            for (var i = tb2.rows.length - 1; i > 0; i--) {
                tb2.deleteRow(i);
            }
            window.parent.scrollTo(0, 0);
            fileOStr = '';
            $("#AddOrderDialog").modal("show");
        }
        function Add() {
            $('#FmAddDd').validation();
            var alm = $(".popover");
            if (alm.length > 0) {
                return;
            }
            var ddbh = $("#ddbh").val();
            var khbh = ID;
            var lxrbh = document.getElementById("lxrbh").value;
            var lxdh = document.getElementById("lxdh").value;
            var htlb = document.getElementById("htlb").value;
            var yszje = $("#yszje").val();
            var sszje = $("#sszje").val();
            var fp = document.getElementById("fp").value;
            if ($('#fj').val().length>0) {
                $('#fj').val($('#fj').val().substring(0, $('#fj').val().length));
            }
            var fj = document.getElementById("fj").value; ;
            var bz = document.getElementById("bz").value;
            var xs = userID;
            var qdrq = $("#qdrq").val();
            var dqrq = $("#dqrq").val();

            var rowcount = $("#Management_A_C tbody tr");
            var trtd = "";

            bz = encodeJson(bz);

            for (i = 0; i < rowcount.length; i++) {

                trtd += $(rowcount[i]).children(":eq(5)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(1)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(2)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(3)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(4)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(0)").text() + ";";
            }
            if (trtd.length > 0) {
                trtd = encodeJson_News(trtd.substring(0, trtd.length - 1));
            }
            else {

            }

            var rowcount_jl = $("#Management_A_J tbody tr");
            var jl = "";
            for (var i = 0; i < rowcount_jl.length; i++) {
                jl += $(rowcount_jl[i]).children(":eq(0)").text() + "︿";
                jl += $(rowcount_jl[i]).children(":eq(1)").text() + "︿";
                jl += $(rowcount_jl[i]).children(":eq(2)").text() + "︿";
                jl += $(rowcount_jl[i]).children(":eq(3)").text() + "︿";
                jl += encodeJson($(rowcount_jl[i]).children(":eq(5)").text()) + "︶";
            }
            if (jl.length>0) {
                jl = jl.substring(0, jl.length - 1);
            }
            fsave = true;
            var l = layer.load("正在提交，请稍等...");
            $.ajax({
                type: "post",
                url: "../../Handlers/Order/Order.aspx?Method=Add&srvid=" + srvID + "&userID=" + userID + "&ddbh=" + encodeURI(encodeURI(ddbh)) + "&khbh=" + khbh + "&lxrbh=" + encodeURI(encodeURI(lxrbh)) + "&lxdh=" + encodeURI(encodeURI(lxdh)) + "&htlb=" + encodeURI(encodeURI(htlb)) + "&yszje=" + encodeURI(encodeURI(yszje)) + "&sszje=" + encodeURI(encodeURI(sszje)) + "&fp=" + encodeURI(encodeURI(fp)) + "&fj=" + encodeURI(encodeURI(fj)) + "&bz=" + encodeURI(encodeURI(bz)) + "&cp=" + encodeURI(encodeURI(trtd)) + "&xs=" + encodeURI(encodeURI(xs)) + "&jl=" + encodeURI(encodeURI(jl)) + "&qdrq=" + encodeURI(encodeURI(qdrq)) + "&dqrq=" + encodeURI(encodeURI(dqrq)),
                cache: false,
                success: function (msg) {
                    layer.close(l);
                    if (msg == "sucess") {
                        $('#AddOrderDialog').modal('hide');
                        layer.msg('添加成功！', 1, 1);
                        $("#khmc").val("");
                        $("#khbh").val("");
                        $("#lxrbh").val("");
                        $("#lxdh").val("");
                        $("#htlb").val("");
                        $("#yszje").val("");
                        $("#sszje").val("");
                        $("#fp").val("");
                        $("#bz").val("");
                        $("#yszje").val(0);
                        $("#sszje").val(0);
                        $("#lxr").val("");
                        $("#fj").val("");
                        document.getElementById("uploadify").style.display = "block";
                        document.getElementById("xz").style.display = "none";
                        document.getElementById("xz").href = "";
                        document.getElementById("xz").text = "";

                        var tb = document.getElementById("Management_A_C");
                        for (var i = tb.rows.length - 1; i > 0; i--) {
                            tb.deleteRow(i);
                        }
                        var jtb = document.getElementById("Management_A_J");
                        for (var i = jtb.rows.length - 1; i > 0; i--) {
                            jtb.deleteRow(i);
                        }
                        LoadOrder(1, 10);
                        orderload = 0;
                        orderpage = 1;
                    }
                    else {
                        layer.close(l);
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }

        //添加产品
        function ADD_CP(pagesize, page) {
            var l = layer.load('正在加载数据......');
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadproduct&page=" + page + "&rows=" + pagesize + "&srvid=" + srvID,
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    layer.close(l);
                    CreateTable_CP(data);
                    createPage_C(pagesize, 5, data.total);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
            $('#CP_S').modal('show');
        }
        //创建产品分页
        function createPage_C(pageSize, buttons, total) {
            $("#cp_p").jBootstrapPage({
                pageSize: pageSize,
                total: total,
                maxPageButton: buttons,
                onPageClicked: function (obj, pageIndex) {
                    mPage_C = pageIndex + 1;
                    ADD_CP($("#PSize_C").val(), mPage_C);
                }
            });
        }

        //插入产品信息到表格
        function CreateTable_CP(data) {
            var tb = document.getElementById("Management_C");
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {
                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.append('<label class="position-relative"><input type="checkbox" class="ace" value="' + data.rows[i].productName + ',' + data.rows[i].ID + '" /><span class="lbl"></span></label>');
                var _td2 = $('<td></td>');
                if (data.rows[i].productName.length >= 6) {
                    _td2.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].productName + '">' + data.rows[i].productName.substring(0, 6) + "..." + '</span>');
                } else {
                    _td2.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + data.rows[i].productName + '">' + data.rows[i].productName + '</span>');
                }
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].productType);
                var _td4 = $('<td></td>');
                _td4.append('<input id="JG_' + data.rows[i].ID + '" style="width:70px;" type="text" value="' + data.rows[i].price + '" >');
                var _td5 = $('<td></td>');
                _td5.append('<input id="SL_' + data.rows[i].ID + '" style="width:70px;" value="1" />');
                var _td6 = $('<td class="center"></td>');
                _td6.append('<div class="hidden-sm hidden-xs action-buttons"><a title="选择" href="javascript:CP_D(\'' + encodeJson_Order(data.rows[i].productName) + '\',\'' + encodeJson_Order(data.rows[i].productType) + '\',\'' + data.rows[i].ID + '\');"><span class="ace-icon fa fa-check bigger-120 blue"></span></a></div>');
                var _td7 = $('<td style="display: none;"></td>');
                _td7.text(data.rows[i].ID);

                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                _tr1.append(_td7);
                $('#Management_C tbody').append(_tr1);
            }
        }
        //选择产品
        function CP_D(MC, LX, ID) {
            var jg = $("#JG_" + ID).val();
            var sl = document.getElementById("SL_" + ID).value;
            var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字//判断正整数 /^[1-9]+[0-9]*]*$/
            if (!re.test(sl)) {
                alert("请输入数字！");
                return;
            } else {
                if (!re.test(jg)) {
                    alert("产品价格格式不正确！");
                    return;
                } else {
                    var zong = jg * sl;
                    var zje = $("#yszje").val();
                    $("#yszje").val(parseInt(zong) + parseInt(zje));
                    var _tr1 = $('<tr></tr>');
                    var _td1 = $('<td></td>');
                    _td1.text(MC);
                    var _td2 = $('<td></td>');
                    _td2.text(jg);
                    var _td3 = $('<td></td>');
                    _td3.text(sl);
                    var _td4 = $('<td></td>');
                    _td4.append(zong);
                    var _td5 = $('<td style="display: none;"></td>');
                    _td5.text(ID);

                    _tr1.append(_td1);
                    _tr1.append(_td2);
                    _tr1.append(_td3);
                    _tr1.append(_td4);
                    _tr1.append(_td5);
                    $('#Management_A_C tbody').append(_tr1);
                }
            }
            $('#CP_S').modal('hide');
        }

        //查询产品信息
        function Btn_check_C(page) {
            var l = layer.load('正在加载数据......');
            var name = $("#cpname").val();
            var pagesize = $('#PSize_C').val();
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadproduct&name=select&page=" + page + "&rows=" + pagesize + "&srvid=" + srvID + "&value=" + encodeURI(encodeURI(name)),
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    layer.close(l);
                    CreateTable_CP(data);
                    createPage_C(pagesize, 5, data.total);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
        }

        //批量添加产品
        function CP_PList(op) {
            var cbs = $('#Management_C tbody').find('tr > td:first-child :checkbox:checked');
            var cbslt = cbs.length;
            var list = "";
            if (cbslt <= 0) {
                alert("请选择要添加的产品！");
            }
            else {
                for (var i = 0; i < cbslt; i++) {
                    list += $(cbs[i]).parent().parent().parent().find("td").eq(1).text() + "," + $(cbs[i]).parent().parent().parent().find("td").eq(3).children().val() + "," + $(cbs[i]).parent().parent().parent().find("td").eq(4).children().val() + "," + $(cbs[i]).parent().parent().parent().find("td").eq(6).text() + ";";
                }
                list = list.substring(0, list.length - 1);
                CP_AList(list, op);
            }
        }
        function CP_AList(list, op) {
            var arry = list.split(';');
            for (var i = 0; i < arry.length; i++) {
                var MC = arry[i].split(',')[0];
                var jg = arry[i].split(',')[1];
                var sl = arry[i].split(',')[2];
                var ID = arry[i].split(',')[3];
                var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字//判断正整数 /^[1-9]+[0-9]*]*$/
                if (!re.test(sl)) {
                    alert("请输入数字！");
                    return;
                } else {
                    if (!re.test(jg)) {
                        alert("产品价格格式不正确！");
                        return;
                    } else {
                        var zong = jg * sl;
                        var zje = $("#yszje").val();
                        $("#yszje").val(parseInt(zong) + parseInt(zje));

                        var _tr1 = $('<tr></tr>');
                        var _td1 = $('<td></td>');
                        _td1.text(MC);
                        var _td2 = $('<td></td>');
                        _td2.text(jg);
                        var _td3 = $('<td></td>');
                        _td3.text(sl);
                        var _td4 = $('<td></td>');
                        _td4.append(zong);
                        var _td5 = $('<td style="display: none;"></td>');
                        var _td6 = $('<td></td>');
                        _td6.append('<div class="hidden-sm hidden-xs action-buttons"><a href="#" onclick="{if(confirm(\'确定要删除吗?\')) {Del_CP(this,\'' + zong + '\',\'add\'); }else {}}"><i class="ace-icon fa fa-trash-o bigger-120 red"></i></a></div>');
                        _td5.text(ID);
                        _tr1.append(_td1);
                        _tr1.append(_td2);
                        _tr1.append(_td3);
                        _tr1.append(_td4);
                        _tr1.append(_td5);
                        _tr1.append(_td6);
                        $('#Management_A_C tbody').append(_tr1);

                    }
                }
            }
            $('#CP_S').modal('hide');
        }
        //删除产品
        function Del_CP(obj, money, op) {
            $(obj).parent().parent().parent().remove();
            if (op == "add") {
                var zje = $("#yszje").val();
                var sszje = $("#sszje").val();
                $("#yszje").val(parseInt(zje) - parseInt(money));
            } else {
                var zje = $("#uyszje").val();
                var sszje = $("#usszje").val();
                $("#uyszje").val(parseInt(zje) - parseInt(money));
            }
            resize_Add(-35);
        }

        //全选
        $(document).on('click', 'th input:checkbox', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
			    .each(function () {
			        this.checked = that.checked;
			        $(this).closest('tr').toggleClass('selected');
			    });
        });
        //添加收款记录
        function ADD_JL(op, id) {
            if (op == "cz") {
                $('#cJL_S').modal('show');
                $("#cid").val(id);
            } else {
                if (op == "update") {
                    $('#uJL_S').modal('show');
                } else {
                    $('#JL_S').modal('show');
                }
            }
        }
        function ADD_CZ(op) {
            if (op == "add") {
                $('#staticFm').validation();
                var alm = $(".popover");
                if (alm.length > 0) {
                    return;
                }
                var jsj = $("#jsj").val();
                var fs = $("#jfs").val();
                var jfp = $("#jfp").val();
                var jje = $("#jje").val();
                var jbz = $("#jbz").val();

                var zong = $("#sszje").val();
                var ys = $("#yszje").val();
                var gong = parseInt(zong) + parseInt(jje);
                if (gong <= ys) {
                    var _tr1 = $('<tr></tr>');
                    var _td1 = $('<td></td>');
                    _td1.text(jsj);
                    var _td2 = $('<td></td>');
                    _td2.text(fs);
                    var _td3 = $('<td></td>');
                    _td3.text(jfp);
                    var _td4 = $('<td></td>');
                    _td4.append(jje);
                    var _td5 = $('<td></td>');
                    if (jbz.length >= 5) {
                        _td5.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + jbz + '">' + jbz.substring(0, 20) + "..." + '</span>');
                    } else {
                        _td5.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + jbz + '">' + jbz + '</span>');
                    }

                    var _td6 = $('<td style="display: none;"></td>');
                    _td6.append(jbz);
                    _tr1.append(_td1);
                    _tr1.append(_td2);
                    _tr1.append(_td3);
                    _tr1.append(_td4);
                    _tr1.append(_td5);
                    _tr1.append(_td6);
                    $('#Management_A_J tbody').append(_tr1);
                    $("#sszje").val(gong);
                    $("#JL_S").modal("hide");
                    ClickEvent();
                } else {
                    $('#QueRen').modal('show');
                }

            } else {
                $('#ustaticFm').validation();
                var alm = $(".popover");
                if (alm.length > 0) {
                    return;
                }
                var jsj = $("#ujsj").val();
                var fs = $("#ujfs").val();
                var jfp = $("#ujfp").val();
                var jje = $("#ujje").val();
                var jbz = $("#ujbz").val();

                var zong = $("#usszje").val();
                var ys = $("#uyszje").val();
                var gong = parseInt(zong) + parseInt(jje);
                if (gong <= ys) {
                    var _tr1 = $('<tr></tr>');
                    var _td1 = $('<td></td>');
                    _td1.text(jsj);
                    var _td2 = $('<td></td>');
                    _td2.text(fs);
                    var _td3 = $('<td></td>');
                    _td3.text(jfp);
                    var _td4 = $('<td></td>');
                    _td4.append(jje);
                    var _td5 = $('<td></td>');
                    //_td5.text(jbz);
                    if (jbz.length >= 5) {
                        _td5.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + jbz + '">' + jbz.substring(0, 20) + "..." + '</span>');
                        //_td5.append('<p><span style="cursor:pointer;" data-rel="popover" data-placement="top" data-content="' + jbz + '">' + jbz.substring(0, 20) + "..." + '</span></p>');
                    } else {
                        _td5.append('<span style="cursor:pointer;" class="tooltip-info" data-placement="right" data-rel="tooltip" data-original-title="' + jbz + '">' + jbz + '</span>');
                        //_td5.append('<p><span style="cursor:pointer;" data-rel="popover" data-placement="top" data-content="' + jbz + '">' + jbz + '</span></p>');
                    }
                    var _td6 = $('<td></td>');
                    _td6.text('待审');
                    var _td7 = $('<td style="display: none;"></td>');
                    _td7.text("");
                    var _td8 = $('<td style="display: none;"></td>');
                    _td8.append(jbz);

                    _tr1.append(_td1);
                    _tr1.append(_td2);
                    _tr1.append(_td3);
                    _tr1.append(_td4);
                    _tr1.append(_td5);
                    _tr1.append(_td6);
                    _tr1.append(_td7);
                    _tr1.append(_td8);
                    $('#uManagement_A_J tbody').append(_tr1);
                    $("#JL_S").modal("hide");
                    ClickEvent();
                } else {
                    $('#QueRen').modal('show');
                }
            }

        }
        //修改时添加收款记录
        function ADD_TJ() {
            var sj = $("#csj").val();
            var fs = $("#cfs").val();
            var fp = $("#cfp").val();
            var je = $("#cje").val();
            var bz = $("#cbz").val();
            var id = $("#cid").val();
            $('#cstaticFm').validation();
            var alm = $(".popover");
            if (alm.length > 0) {
                return;
            }
            $.ajax({
                type: "post",
                url: "../../Handlers/Order/Order.aspx?Method=AddJL&id=" + encodeURI(encodeURI(id)) + "&sj=" + encodeURI(encodeURI(sj)) + "&fs=" + encodeURI(encodeURI(fs)) + "&fp=" + encodeURI(encodeURI(fp)) + "&je=" + encodeURI(encodeURI(je)) + "&bz=" + encodeURI(encodeURI(bz)) + "&userID=" + encodeURI(encodeURI(userID)),
                cache: false,
                success: function (msg) {
                    if (msg == "sucess") {
                        layer.msg('添加成功！', 1, 1);
                        $('#cJL_S').modal('hide');
                        $("#cje").val("");
                        $("#cbz").val("");
                        $("#cid").val("");
                        firstLoad = 0;
                        mPage = 1;
                        LoadData($("#PSize").val(), 1);
                    }
                    else {
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }
        //删除订单
        function Del_CZ(ID) {
            $("#DelID").val(ID);
            $('#DelOrder').modal('show');
        }
        function Del_ZD() {
            var ID = document.getElementById("DelID").value;
            $.ajax({
                type: "get",
                url: "../../Handlers/Order/Order.aspx?Method=Del&ID=" + ID,
                cache: false,
                success: function (msg) {
                    if (msg == "sucess") {
                        layer.msg('删除成功！', 1, 1);
                        $('#DelOrder').modal('hide');
                        LoadOrder(1, 10);
                        orderload = 0;
                        orderpage = 1;
                    }
                    else {
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }
        //修改订单
        function Update_Kh(obj) {
            var tds = $(obj).parent().parent().parent().find('td');
            $('#uddbh').val(tds.eq(0).text());
            //类别
            $('#uhtlb').val(tds.eq(10).text());
            //金额
            $('#uyszje').val(tds.eq(2).text());
            $('#usszje').val(tds.eq(3).text());
            //发票
            $('#ufp').val(tds.eq(4).text());
            //备注
            $('#ubz').val(tds.eq(12).text());
            $('#ufj').val(tds.eq(11).text());
            document.getElementById("uxz").href = "../" + tds.eq(11).text();
            $('#uHid').val(tds.eq(8).text());
            $('#uHzt').val(tds.eq(6).text());
            if (tds.eq(6).text() == "审核中") {
                document.getElementById("utj").style.display = "block";
                document.getElementById("ucp").style.display = "block";
                document.getElementById("ujl").style.display = "block";
            }

            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadCP&page=1&rows=10000&order=" + tds.eq(8).text(),
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    uCreateTable_CPList(data);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadJL&page=1&rows=10000&order=" + tds.eq(8).text(),
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    uCreateTable_JLList(data);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
            $('#EditOrder').modal('show');
        }
        //创建产品表
        function uCreateTable_CPList(data) {
            var tb = document.getElementById("uManagement_A_C");
            var zt = $("#uHzt").val();
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {

                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.text(data.rows[i].productName);
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].actualPrice);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].saleCount);
                var _td4 = $('<td></td>');
                _td4.append(data.rows[i].AllMoney);
                var _td5 = $('<td></td>');
                if (zt == "审核中") {
                    _td5.append('<div class="hidden-sm hidden-xs action-buttons"><a href="#" onclick=\'{if(confirm("确定要删除吗?")) {Del_CP(this,' + data.rows[i].AllMoney + '); }else {}}\'>删除</a></div>');
                } else {
                    _td5.text("");
                }
                var _td6 = $('<td style="display: none;"></td>');
                _td6.text(data.rows[i].ID);
                var _td7 = $('<td style="display: none;"></td>');
                _td7.text(data.rows[i].productID);

                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                _tr1.append(_td7);
                $('#uManagement_A_C tbody').append(_tr1);
            }
        }
        //创建记录表
        function uCreateTable_JLList(data) {
            var tb = document.getElementById("uManagement_A_J");
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {

                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.text(data.rows[i].dueDates);
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].Payment);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].Invoice);
                var _td4 = $('<td></td>');
                _td4.text(data.rows[i].receivedAmount);
                var _td5 = $('<td></td>');
                _td5.text(data.rows[i].Beizhu);
                var _td6 = $('<td style="display: none;"></td>');
                _td6.text(data.rows[i].ID);

                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                $('#uManagement_A_J tbody').append(_tr1);
            }
        }
        //修改时删除产品
        function Del_CP(obj, money) {
            $(obj).parent().parent().parent().remove();
            var zje = $("#uyszje").val();
            var sszje = $("#usszje").val();
            $("#uyszje").val(parseInt(zje) - parseInt(money));
            $("#usszje").val(parseInt(sszje) - parseInt(money));
        }
        //确定修改订单
        function uAdd() {
            var ddbh = $("#uddbh").val();
            var lxrbh = "";
            var lxdh = "";
            var htlb = document.getElementById("uhtlb").value;
            var yszje = $("#uyszje").val();
            var sszje = $("#usszje").val();
            var fp = document.getElementById("ufp").value;
            var fj = document.getElementById("ufj").value;
            var bz = document.getElementById("ubz").value;
            var id = document.getElementById("uHid").value;
            var khbh = ID;
            var xs = userID;
            var rowcount = $("#uManagement_A_C tbody tr");
            var trtd = "";
            for (i = 0; i < rowcount.length; i++) {
                trtd += $(rowcount[i]).children(":eq(0)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(1)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(2)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(3)").text() + ",";
                trtd += $(rowcount[i]).children(":eq(6)").text() + ";";
            }
            trtd = trtd.substring(0, trtd.length - 1);

            var rowcount_jl = $("#uManagement_A_J tbody tr");
            var jl = "";
            for (i = 0; i < rowcount_jl.length; i++) {
                jl += $(rowcount_jl[i]).children(":eq(0)").text() + ",";
                jl += $(rowcount_jl[i]).children(":eq(1)").text() + ",";
                jl += $(rowcount_jl[i]).children(":eq(2)").text() + ",";
                jl += $(rowcount_jl[i]).children(":eq(3)").text() + ",";
                jl += $(rowcount_jl[i]).children(":eq(4)").text() + ";";
            }
            jl = jl.substring(0, jl.length - 1);
            $.ajax({
                type: "post",
                url: "../../Handlers/Order/Order.aspx?Method=Update&ID=" + encodeURI(encodeURI(id)) + "&ddbh=" + encodeURI(encodeURI(ddbh)) + "&khbh=" + khbh + "&lxrbh=" + encodeURI(encodeURI(lxrbh)) + "&lxdh=" + encodeURI(encodeURI(lxdh)) + "&htlb=" + encodeURI(encodeURI(htlb)) + "&yszje=" + encodeURI(encodeURI(yszje)) + "&sszje=" + encodeURI(encodeURI(sszje)) + "&fp=" + encodeURI(encodeURI(fp)) + "&fj=" + encodeURI(encodeURI(fj)) + "&bz=" + encodeURI(encodeURI(bz)) + "&cp=" + encodeURI(encodeURI(trtd)) + "&xs=" + encodeURI(encodeURI(xs)) + "&jl=" + encodeURI(encodeURI(jl)) + "",
                cache: false,
                success: function (msg) {
                    if (msg == "sucess") {
                        layer.msg('修改成功！', 1, 1);
                        $('#uAddDialog').modal('hide');
                        LoadOrder(1, 10);
                        orderload = 0;
                        orderpage = 1;
                    }
                    else {
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
            $("#EditOrder").modal("hide");
        }

        //生成合同
        function Add_HT(id, kh, mc, zje, ysk, bh) {
            $('#HT_S').modal('show');
            $("#hid").val(id);
            $("#hbh").val(bh);
            $("#hkhid").val(kh);
            $("#hkh").val(mc);
            $("#hzje").val(zje);
            $("#hysk").val(ysk);
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadCP&page=1&rows=10000&order=" + id,
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    hCreateTable_CPList(data);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadJL&page=1&rows=10000&order=" + id,
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    hCreateTable_JLList(data);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
        }

        function hCreateTable_CPList(data) {
            var tb = document.getElementById("Management_H_C");
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {

                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.text(data.rows[i].productName);
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].actualPrice);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].saleCount);
                var _td4 = $('<td></td>');
                _td4.append(data.rows[i].AllMoney);
                var _td5 = $('<td style="display: none;"></td>');
                _td5.text(data.rows[i].ID);

                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                $('#Management_H_C tbody').append(_tr1);
            }
        }
        function hCreateTable_JLList(data) {
            var tb = document.getElementById("Management_H_J");
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {

                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.text(data.rows[i].dueDates);
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].Payment);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].Invoice);
                var _td4 = $('<td></td>');
                _td4.text(data.rows[i].receivedAmount);
                var _td5 = $('<td></td>');
                _td5.text(data.rows[i].Beizhu);
                var _td6 = $('<td style="display: none;"></td>');
                _td6.text(data.rows[i].ID);

                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                $('#Management_H_J tbody').append(_tr1);
            }
        }
        //提交生成合同
        function SC_HT() {
            var bh = $("#hbh").val();
            var sj = $("#hsj").val();
            var lb = $("#hlb").val();
            var fp = $("#hfp").val();
            var fs = $("#hfs").val();
            var bz = $("#hbz").val();
            var id = $("#hid").val();
            $.ajax({
                type: "post",
                url: "../../Handlers/Order/Order.aspx?Method=UpdateHT&ID=" + encodeURI(encodeURI(id)) + "&bh=" + encodeURI(encodeURI(bh)) + "&sj=" + encodeURI(encodeURI(sj)) + "&lb=" + encodeURI(encodeURI(lb)) + "&fp=" + encodeURI(encodeURI(fp)) + "&fs=" + encodeURI(encodeURI(fs)) + "&bz=" + encodeURI(encodeURI(bz)) + "&sszje=" + encodeURI(encodeURI(sszje)) + "&fp=" + encodeURI(encodeURI(fp)) + "&fj=" + encodeURI(encodeURI(fj)) + "&bz=" + encodeURI(encodeURI(bz)) + "&user=" + encodeURI(encodeURI(userID)),
                cache: false,
                success: function (msg) {
                    if (msg == "sucess") {
                        layer.msg('生成成功！', 1, 1);
                        $('#HT_S').modal('hide');
                    }
                    else {
                        $('#False').modal('show');
                    }
                },
                error: function () {
                    $('#LJFalse').modal('show');
                }
            });
        }

        //添加产品--修改
        function uADD_CP(pagesize, page) {
            var l = layer.load('正在加载数据......');
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadproduct&page=" + page + "&rows=" + pagesize + "&srvid=" + srvID,
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    uCreateTable_CP(data);
                    ucreatePage_C(pagesize, 5, data.total);
                    layer.close(l);
                },
                error: function () {
                    alert("网络请求错误！");
                }
            });
            $('#uCP_S').modal('show');
        }

        //插入产品信息到表格
        function uCreateTable_CP(data) {
            var tb = document.getElementById("uManagement_C");
            for (var i = tb.rows.length - 1; i > 0; i--) {
                tb.deleteRow(i);
            }
            for (var i = 0; i < data.rows.length; i++) {
                var _tr1 = $('<tr></tr>');
                var _td1 = $('<td></td>');
                _td1.append('<label class="position-relative"><input type="checkbox" value="' + data.rows[i].productName + ',' + data.rows[i].ID + '" /><span class="lbl"></span></label>');
                var _td2 = $('<td></td>');
                _td2.text(data.rows[i].productName);
                var _td3 = $('<td></td>');
                _td3.text(data.rows[i].productType);
                var _td4 = $('<td></td>');
                _td4.append('<input id="uJG_' + data.rows[i].ID + '" style="width:70px;" type="text" value="' + data.rows[i].price + '" >');
                var _td5 = $('<td></td>');
                _td5.append('<input id="uSL_' + data.rows[i].ID + '" style="width:70px;" type="text" value="1" />');
                var _td6 = $('<td class="center"></td>');
                _td6.append('<div class="hidden-sm hidden-xs action-buttons"><a title="选择" href="javascript:uCP_D(\'' + data.rows[i].productName + '\',\'' + data.rows[i].productType + '\',\'' + data.rows[i].ID + '\');"><span class="ace-icon fa fa-check bigger-120 blue"></span></a></div>');
                var _td7 = $('<td style="display: none;"></td>');
                _td7.text(data.rows[i].ID);

                _tr1.append(_td1);
                _tr1.append(_td2);
                _tr1.append(_td3);
                _tr1.append(_td4);
                _tr1.append(_td5);
                _tr1.append(_td6);
                _tr1.append(_td7);
                $('#uManagement_C tbody').append(_tr1);
            }
        }
        //确定产品信息
        function uCP_D(MC, LX, ID) {
            var jg = $("#uJG_" + ID).val();
            var sl = document.getElementById("uSL_" + ID).value;
            var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字//判断正整数 /^[1-9]+[0-9]*]*$/
            if (!re.test(sl)) {
                alert("请输入数字！");
                //$('#sz').modal('show');
                return;
            } else {
                if (!re.test(jg)) {
                    alert("产品价格格式不正确！");
                    return;
                } else {
                    var zong = jg * sl;
                    var zje = $("#uyszje").val();
                    $("#uyszje").val(parseInt(zong) + parseInt(zje));
                    //$("#usszje").val(parseInt(zong) + parseInt(zje));

                    var _tr1 = $('<tr></tr>');
                    var _td1 = $('<td></td>');
                    _td1.text(MC);
                    var _td2 = $('<td></td>');
                    _td2.text(jg);
                    var _td3 = $('<td></td>');
                    _td3.text(sl);
                    var _td4 = $('<td></td>');
                    _td4.text(zong);
                    var _td5 = $('<td></td>');
                    _td5.append('<div class="hidden-sm hidden-xs action-buttons"><a href="#" onclick=\'{if(confirm("确定要删除吗?")) {Del_CP(this,' + zong + '); }else {}}\'>删除</a></div>');
                    var _td6 = $('<td style="display: none;"></td>');
                    _td6.text(ID);
                    var _td7 = $('<td style="display: none;"></td>');
                    _td7.text(ID);

                    _tr1.append(_td1);
                    _tr1.append(_td2);
                    _tr1.append(_td3);
                    _tr1.append(_td4);
                    _tr1.append(_td5);
                    _tr1.append(_td6);
                    _tr1.append(_td7);
                    $('#uManagement_A_C tbody').append(_tr1);
                }
            }
            $('#uCP_S').modal('hide');
        }
        function ucreatePage_C(pageSize, buttons, total) {
            $("#ucp_p").jBootstrapPage({
                pageSize: pageSize,
                total: total,
                maxPageButton: buttons,
                onPageClicked: function (obj, pageIndex) {
                    umPage_C = pageIndex + 1;
                    uADD_CP($("#uPSize_C").val(), umPage_C);
                }
            });
        }
        //搜索联系人
        function SerchLink(value, page) {
            var l = layer.load("正在加载...");
            $.ajax({
                url: "../../Handlers/CustomerInformation/CustomerContact/CustomerContact.aspx?Method=All&srvid=" + srvID + "&userid=" + userID + "&value=" + value + "&page=" + page + "&rows=10&ID=" + ID,
                type: "get",
                cache: false,
                dataType: "json",
                success: function (data) {
                    layer.close(l);
                    firstLoad = 0;
                    CreateLinkMan(data);
                    if (firstLoad = 0) {
                        $("#pagelink").jBootstrapPage({
                            pageSize: 10,
                            total: data.total,
                            maxPageButton: 3,
                            onPageClicked: function (obj, pageIndex) {
                                mPage = pageIndex + 1;
                                SerchLink(value, mPage);
                            }
                        });
                        firstLoad = 1;
                    }
                },
                error: function () {
                    layer.close(l);
                    layer.msg('加载失败！', 1, 3);
                }
            });
        }
        //搜索订单
        function SerchOrder(value, page) {
            var l = layer.load("正在加载...");
            $.ajax({
                url: "../../Handlers/Order/Order.aspx?Method=loadOrder_K&dd=" + ID + "&page=" + page + "&rows=10&value=" + value + "",
                type: "post",
                cache: false,
                dataType: "json",
                success: function (data) {
                    layer.close(l);
                    orderload = 0;
                    CreateOrder(data);
                    if (orderload == 0) {
                        $("#pageorder").jBootstrapPage({
                            pageSize: 10,
                            total: data.total,
                            maxPageButton: 3,
                            onPageClicked: function (obj, pageIndex) {
                                orderpage = pageIndex + 1;
                                SerchOrder(value, orderpage);
                            }
                        });
                        orderload = 1;
                    }
                },
                error: function () {
                    layer.close(l);
                    alert("网络请求错误！");
                }
            });
        }
        //搜索合同
        function SerchContr(value, page) {
            $.ajax({
                url: "../../Handlers/Contract/ContractManagement/ContractManagement.aspx?Method=GetHT_K&page=" + page + "&rows=10&kh=" + ID + "&where=where&value=" + value + "",
                type: "get",
                cache: false,
                dataType: "json",
                success: function (data) {
                    createContr(data);
                    if (contrload == 0) {
                        $("#pagecontract").jBootstrapPage({
                            pageSize: 10,
                            total: data.total,
                            maxPageButton: 3,
                            onPageClicked: function (obj, pageIndex) {
                                contrpage = pageIndex + 1;
                                SerchOrder(value, contrpage);
                            }
                        });
                        contrload = 1;
                    }
                },
                error: function () {
                    alert("网络请求错误！请稍后重试！");
                }
            });
        }
        function Getmore(op) {
            if (op == "more") {
                $("#More").hide();
                $("#More_div").show();
                $("#tb3").show();
                $("#Reduce").show();
            } else {
                $("#More").show();
                $("#More_div").hide();
                $("#tb3").hide();
                $("#Reduce").hide();
            }
        }
    </script>

    <style type="text/css">
  .timeline-container{ padding-top:50px;}
        .biaoti{margin-top:5px;  }
        h2{ display:inline}
        .timeline-item .transparent.widget-box{ border-left:0;}
        .widget-box{ border-top:0;}
        .fbiaoti{ height:36px; background:#f5f5f5; border:1px solid #5dade2; line-height:36px; box-shadow:0 1px 0px 0 #fff inset }
		.fbiaoti_ad{height:24px !important; background:#f5f5f5 !important;  border:1px solid #ddd !important; line-height:24px !important; box-shadow:0 1px 0px 0 #fff inset !important;}
		.fbiaoti h2{font-size: 14px;  font-weight: bold; line-height: 34px; margin: 0 !important;  padding-left: 20px;}
        .fbiaoti input{ height:24px; line-height:24px; font-size:12px; border-radius: 4px !important;border: 1px solid #ddd; padding:0 0 0 8px;width: 140px;}
        .fbiaoti .serch{ float:right; height:32px; line-height: 32px;position: relative;right: 15px;}
        .nav-search-icon{position: relative;right: 180px;}
         .form-horizontal .control-label{ margin-right:0}
         #Sec_Record{ margin-bottom:200px;}
         html{ overflow-x:hidden;}
         .tab-pane{height:350px;}
		 .fbiaoti span{ line-height:32px;}
		 .gzjl{padding-left: 15px;margin-bottom: 15px;}
    </style>

</head>
<body onload="LoadData();" style="background-color:#fff;" data-spy="scroll" data-target="#myScrollspy">
    
    <input id="srvid" name="srvid" type="hidden" />
    <input id="KHID" name="KHID" type="hidden" />
    <input id="userid" name="userid" type="hidden" />
    <input id="hiduser" name="hiduser" type="hidden" />
    <div class="">
        <div style=" padding-right:0 !important;" class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            
            <div id="timeline-1">
                <div class="row">
                    <div class="wygxxyhm" >
                        <!--客户信息-->
                        <a name="tcclent" id="tcclent"></a>
                        <div id="Sec_Kehu">
						    <div class="timeline-items" >
                            
                                <div class="widget-box" style="border:1px solid #ccc;">
                                    <div class="widget-header widget-header-flat widget-header-small" style="border:none;color:#999;">
                                    
                                        <h5 class="widget-title">
                                            客户详细信息</h5>
                                    </div>
                                    <div class="widget-body">
                                        <div class="widget-main">
                                            <table id="More_table" style="width: 100%">
                                                <tr>
                                                    <td colspan="4">
                                                        <div class="c-group">
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="4">
                                                        <div class="c-group">
                                                            <lable class="control-label1">地址:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">联系人:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">手机:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">固话:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">职务:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>

                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">邮箱:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">QQ:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">传真:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">邮编:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <div class="c-group">
                                                        <lable class="control-label1">来源:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                            
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">等级:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">信誉度:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">状态:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                 <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">所属人:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">性别:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <div class="c-group">
                                                            <lable class="control-label1">创建日:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="3">
                                                        <div class="c-group">
                                                            <lable class="control-label1">备注:</lable>
                                                            <lable class=" lable-field1 label-field-content"></lable>
                                                        </div>
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                       
                        <!--联系人-->
                        <a name="tclxr" id="tclxr"></a>
                        <div id="Sec_Linkman">
                            <div class="timeline-items">
                                <div class="clearfix">
                                    <div class="widget-box" style="border: 1px solid #ccc;">
                                        <div class="widget-header widget-header-flat widget-header-small" style="border: none;
                                            color: #999;">
                                            
                                            <h5 class="widget-title">
                                                其他联系人信息</h5>
                                            <span style="float: right">
                                                <input type="text" placeholder="输入联系人搜索 ..." onkeyup="SerchLink(this.value,1)" />
                                                <a title="添加联系人" tag="M_100_AL" href="javascript:ADD_Lxr();"><span class="label-field-content">
                                                    添加</span> </a></span>
                                        </div>
                                        <div class="widget-body">
                                            <div class="">
                                                <table class="table table-bordered table-striped table-hover no-margin-bottom no-border-top"
                                                    style="text-align: center">
                                                    <thead>
                                                        <th style="text-align: left; min-width: 60px;">
                                                            姓 名
                                                        </th>
                                                        <th style="text-align: left; min-width: 60px;">
                                                            电 话
                                                        </th>
                                                        <th style="text-align: left; min-width: 60px;">
                                                            职 位
                                                        </th>
                                                        <th style="text-align: left; min-width: 60px;">
                                                            邮 箱
                                                        </th>
                                                        <th style="text-align: left; min-width: 60px;">
                                                            QQ
                                                        </th>
                                                        <th style="text-align: left; min-width: 60px;">
                                                            备 注
                                                        </th>
                                                        <th style="text-align: left; width: 100px; min-width: 60px;">
                                                            操 作
                                                        </th>
                                                    </thead>
                                                    <tbody id="count_lxr">
                                                        <!-- 内容 -->
                                                    </tbody>
                                                </table>
                                                <ul class="pagination" id="pagelink">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
  
                        

                        <!--合同管理--> 
                        <a name="tcht" id="tcht"></a>
                        <div id="Sec_order">
						    <div class="timeline-items" >
                                <div class=" clearfix">
                                    <div class="widget-box" style="border: 1px solid #ccc;">
                                        <div class="widget-header widget-header-flat widget-header-small" style="border: none;
                                            color: #999;">
                                            
                                            <h5 class="widget-title">
                                                合同信息</h5>
                                            <span style="float: right">
                                                <input type="text" placeholder="输入合同编号搜索 ..." onkeyup="SerchOrder(this.value,1)" />
                                                <a title="添加合同" tag="M_104_A" href="javascript:ADD_DD();"><span 
                                                    class="label-field-content">添加</span> </a></span>
                                        </div>
                                        <div class="widget-body">
										    <div class="" >
											    <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top" style="text-align:center" >
				                                    <thead>
					                                    <tr>
						                                    <th style="text-align:left;min-width:80px;">合同编号</th>
						                                    <th style="text-align:left;min-width:80px;">客户名称</th>
						                                    <th style="text-align:left;min-width:70px;">总金额</th>
						                                    <th style="text-align:left;min-width:70px;">未收款</th>
						                                    <th style="text-align:left;min-width:60px;">发 票</th>
						                                    <th style="text-align:left;min-width:80px;">销售人员</th>
						                                    <th style="text-align:left;min-width:60px;">状 态</th>
                                                            <th style="text-align:left;min-width:60px;">时 间</th>
                                                            <th style=" display:none;min-width:60px;">操 作</th>
					                                    </tr>
				                                    </thead>
				                                    <tbody id="count_dd">
                                                        <!-- 内容 -->
				                                    </tbody>
			                                    </table>
                                                <ul class="pagination" id="pageorder"></ul>
										    </div>
									    </div>
                                    </div>
								   
							    </div>
                            </div>
                        </div>

                        <!--跟踪记录-->
                        <a name="tchzjl" id="tchzjl"></a>
                        <div id="Sec_Record">
						    <div class="timeline-items" >
                                <div class="clearfix">
                                    <div class="widget-box" style="border: 1px solid #ccc;">
                                        <div class="widget-header widget-header-flat widget-header-small" style="border: none;
                                            color: #999;">
                                            
                                            <h5 class="widget-title">
                                                跟踪记录</h5>
                                            <span style="float: right;margin-top: 5px;"><a title="添加跟踪记录" tag="M_100_AR" href="javascript:ADD_Gzjl();">
                                                <span class="label-field-content">添加</span> </a></span>
                                        </div>
                                        <div class="widget-body">
                                            <div class="">
                                                <div class="timeline-items" id="Management" style="margin-top:10px;">
                                                </div>
                                                <ul class="pagination" id="Ul1">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>

							    </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--添加合同-->
    <div class="modal fade" id="AddOrderDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
        aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title">
                        添加合同信息
                    </div>
                </div>
                <div class="modal-body">
                    <form id="Form2" method="post">
                    <input id="Hidden2" name="Hukhid" type="hidden" />
                    <div class="tabbable">
                        <ul class="nav nav-tabs" id="myTab">
                            <li class="active"><a data-toggle="tab" href="#Basic">基本信息 </a></li>
                            <li><a data-toggle="tab" href="#Products">产品信息 </a></li>
                            <li><a data-toggle="tab" href="#Collect">收款记录 </a></li>
                        </ul>
                        <div class="tab-content">
                            <div id="Basic" class="tab-pane in active">
                                <table>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>合同编号：</span>
                                        </td>
                                        <td style="text-align: left;" colspan="4">
                                            <input type="text" id="ddbh" name="ddbh" class="col-xs-15 col-sm-12" placeholder="请输入合同编号"
                                                btvd-type="requiredlength" btvd-err="合同编号不能为空且最多输入20个字" btvd-class='btvdclass'
                                                l="20" />
                                        </td>
                                        <td>
                                            <input id="xsry" name="xsry" type="hidden" />
                                            <input id="xsrybh" name="xsrybh" type="hidden" />
                                            <input id="lxr" name="lxr" type="hidden" />
                                            <input id="lxrbh" name="lxrbh" type="hidden" />
                                            <input id="lxdh" name="lxdh" type="hidden" />
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>签订日期：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input type="text" id="qdrq" name="qdrq" class="datepicker" readonly>
                                        </td>
                                        <td style="width: 20px;">
                                        </td>
                                        <td style="text-align: right; width: 100px;">
                                            <span>到期日期：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input type="text" id="dqrq" name="dqrq" class="datepicker" readonly>
                                        </td>
                                        <td style="text-align: right; width: 100px; display: none">
                                            <span>发 票：</span>
                                        </td>
                                        <td style="text-align: left; display: none">
                                            <select class="form-control" id="fp" name="fp">
                                                <option value="否">否</option>
                                                <option value="是">是</option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>应收金额：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input id="yszje" name="yszje" type="text" class="form-control" readonly />
                                        </td>
                                        <td style="width: 20px;">
                                        </td>
                                        <td style="text-align: right; width: 100px;">
                                            <span>实收金额：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input id="sszje" name="sszje" type="text" class="col-xs-15 col-sm-12" placeholder="请输入金额"
                                                btvd-type="number" btvd-err="实收金额应为数字" btvd-class='btvdclass' readonly />
                                        </td>
                                        <td style="width: 20px;">
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>合同类别：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <select class="form-control" id="htlb" name="htlb">
                                                <option value="新建">新建</option>
                                                <option value="续签">续签</option>
                                                <option value="维护">维护</option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr style="height:38px; display:none;" id="uploadlist">
                                        <td colspan=5><div id="animate" style="display:none;margin-left: 60px;" ><img  src="../../Scripts/BootStrap/img/wait.jpg" style="width: 38px;height: 38px;" />正在上传......</div><ul id="fList" style="display:none; list-style:none;"></ul></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>上传附件：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input id="fj" name="fj" type="hidden" class="form-control" />
                                            <a href="" target="_blank" id="xz" style="display: none;">下载</a>
                                            <input type="file" name="file_upload" id="uploadify" />
                                        </td>

                                        <td colspan=3>
                                            <span style="color: Red; font-size: 12px;">最多上传3个文件（不大于5M/个)，点击文件预览</span>
                                        </td>
                                        <td >
                                        </td>
                                        <td></td>
                                    </tr>
                                </table>
                                <table>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>备 注：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <textarea id="bz" name="bz" style="width: 450px; height: 96px;" class="form-control"
                                                btvd-type="requiredlength" btvd-err="不能为空且最多输入50个字" btvd-class='btvdclass' l="50"
                                                placeholder="最多输入50个字"></textarea>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div id="Products" class="tab-pane">
                                <button type="button" class="btn tcbtn tcbutton-royal btn-xs" onclick="ADD_CP($('#PSize_C').val(), 1)"
                                    style="margin-top: -15px; margin-left: 5px;">
                                    添加产品</button>
                                <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                                    id="Management_A_C">
                                    <thead>
                                        <tr>
                                            <th style="text-align: left; min-width: 80px;">
                                                产品名称
                                            </th>
                                            <th style="text-align: left; min-width: 60px;">
                                                单 价
                                            </th>
                                            <th style="text-align: left; min-width: 60px;">
                                                数 量
                                            </th>
                                            <th style="text-align: left; min-width: 70px;">
                                                总金额
                                            </th>
                                            <th style="text-align: left; min-width: 60px;">
                                                操 作
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                            <div id="Collect" class="tab-pane">
                                <button type="button" class="btn tcbtn tcbutton-royal btn-xs" onclick="ADD_JL('add','','')"
                                    style="margin-top: -15px; margin-left: 5px;">
                                    添加记录</button>
                                <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                                    id="Management_A_J">
                                    <thead>
                                        <tr>
                                            <th style="text-align: left; min-width: 80px;">
                                                收款时间
                                            </th>
                                            <th style="text-align: left; min-width: 80px;">
                                                付款方式
                                            </th>
                                            <th style="text-align: left; min-width: 80px;">
                                                是否发票
                                            </th>
                                            <th style="text-align: left; min-width: 60px;">
                                                金 额
                                            </th>
                                            <th style="text-align: left; min-width: 60px;">
                                                备 注
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="Add();" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
     <!--添加跟踪记录-->
    <div class="modal fade" id="AddDialog" tabindex="-1"  role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
       <div class="modal-dialog">
          <div class="modal-content">
             <div class="modal-header ui-widget-header">
                <button type="button" class="close" 
                   data-dismiss="modal" aria-hidden="true">
                      &times;
                </button>
                <div class="modal-title" id="Div3">
                   添加跟踪记录信息
                </div>
             </div>
             <form id="JAdd" method="post" class="form-horizontal">
             <div class="modal-body">
                    <input id="Hsrvid" name="Hsrvid" type="hidden"/>
                    <input id="Huserid" name="Huserid" type="hidden" />
                    <div style="padding:10px 0; border:1px solid #ccc;min-height: 300px;">
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="sj">
                                    时间：
                                </label>
                                <span class="col-sm-8">
                                    <input id="sj" name="sj" readonly placeholder="2014-01-01" class="col-sm-8 datepicker" type="text" btvd-type="required" btvd-err="时间不能为空" btvd-class='btvdclass' /><font style="color: Red">*</font>
                                </span>
                            </div>
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="dd">
                                    地点：
                                </label>
                                <span class="col-sm-8">
                                    <input id="dd"  name="dd"  class="col-sm-8" type="text"  btvd-type="length" btvd-err="最多输入30个字" btvd-class='btvdclass' lang="30"/>
                                </span>
                            </div>
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="gy">
                                    方式：
                                </label>
                                <span class="col-sm-8">
                                    <select id="gy" name="gy">
                                        <option value="拜访">拜访</option>
                                        <option value="电话">电话</option> 
                                        <option value="网络">网络</option>  
                                    </select>
                                </span>
                            </div>
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    备注：
                                </label>
                                <span class="col-sm-8">
                                    <textarea id="xxxx" name="xxxx" placeholder="最多输入250个字" class="form-control" rows="4" style="width:389px" btvd-type="length" btvd-err="长度不能超过50" btvd-class='btvdclass' l="250" ></textarea>
                                </span>
                            </div>
                    </div>
             </div>
             <div class="modal-footer">
                <button type="button" onclick="Add_Gzjl_CZ();" class="btn btn-white btn-info btn-bold">
                    <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                </button>
                <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                    <i class="ace-icon fa fa-times red2"></i>关闭
                </button>
             </div>
                </form>
          </div>
        </div>
    </div>
    <!--修改跟踪记录-->
    <div class="modal fade" id="uAddDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
       <div class="modal-dialog">
          <div class="modal-content">
             <div class="modal-header ui-widget-header">
                <button type="button" class="close" 
                   data-dismiss="modal" aria-hidden="true">
                      &times;
                </button>
                <div class="modal-title" id="myModalLabel">
                   修改交往记录信息
                </div>
             </div>
                <form id="uJAdd" method="post" class="form-horizontal">
                    <div class="modal-body">
                         <div style="padding:10px 0; border:1px solid #ccc;min-height: 300px;">
                            <input id="uID" name="uID" type="hidden" />
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="sj">
                                    时间：
                                </label>
                                <span class="col-sm-8">
                                    <input id="usj" name="usj"  class="col-sm-8 datepicker" type="text" btvd-type="required" btvd-err="时间不能为空" btvd-class='btvdclass' /><font style="color: Red">*</font>
                                </span>
                            </div>
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="dd">
                                    地点：
                                </label>
                                <span class="col-sm-8">
                                    <input id="udd"  name="udd"  class="col-sm-8" type="text"  btvd-type="length" btvd-err="最多输入30个字" btvd-class='btvdclass' lang="30" />
                                </span>
                            </div>
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="gy">
                                    方式：
                                </label>
                                <span class="col-sm-8">
                                    <select id="ugy" name="ugy">
                                        <option value="拜访">拜访</option>
                                        <option value="电话">电话</option> 
                                        <option value="网络">网络</option>  
                                    </select>
                                </span>
                            </div>
                            <div class="gzjl col-sm-12">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    备注：
                                </label>
                                <span class="col-sm-8">
                                    <textarea id="uxxxx" name="uxxxx" placeholder="最多输入250个字" class="form-control" rows="4" style="width:389px" btvd-type="length" btvd-err="长度不能超过50" btvd-class='btvdclass' l="250" ></textarea>
                                </span>
                            </div>
                        </div>
                     </div>
                     <div class="modal-footer">
                        <button type="button" onclick="Update_Gzjl_ZD();" class="btn btn-white btn-info btn-bold">
                            <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                        </button>
                        <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                            <i class="ace-icon fa fa-times red2"></i>关闭
                        </button>
                     </div>
                </form>
          </div>
        </div>
    </div>
    <!--删除跟踪记录-->
    <div class="modal fade" id="Del" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
        aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <input id="DelID" name="DelID" type="hidden" />
                <div class="modal-header ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"
                    style="cursor: hand;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title" id="Div7">
                        询问信息
                    </div>
                </div>
                <div class="modal-body">
                    <p>
                        确认要删除吗？
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="Del_Gzjl_ZD()" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-check bigger-120 blue"></i>删除
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>取消
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!--操作成功-->
    <div class="modal fade" id="True" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:250px;">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">操作成功!</h3>
                </div>
                <div class="panel-body" style="text-align:right;">
                    <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>
    <!--操作失败-->
    <div class="modal fade" id="False" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:250px;">
            <div class="panel panel-danger">
                <div class="panel-heading">
                    <h3 class="panel-title">操作失败!</h3>
                </div>
                <div class="panel-body" style="text-align:right;">
                    <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>
    <!--连接失败-->
    <div class="modal fade" id="LJFalse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:250px;">
            <div class="panel panel-warning">
                <div class="panel-heading">
                    <h3 class="panel-title">请求服务器失败!</h3>
                </div>
                <div class="panel-body" style="text-align:right;">
                    <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>
    <!--内容不能为空-->
    <div class="modal fade" id="NeiRong" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:250px;">
            <div class="panel panel-danger">
                <div class="panel-heading">
                    <h3 class="panel-title">详细信息不能为空!</h3>
                </div>
                <div class="panel-body" style="text-align:right;">
                    <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!--添加联系人-->
    <div class="modal fade" id="AddDialog_Lxr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
       <div class="modal-dialog" >
          <div class="modal-content">
             <div class="modal-header ui-widget-header">
                <button type="button" class="close" 
                   data-dismiss="modal" aria-hidden="true">
                      &times;
                </button>
                <div class="modal-title" id="Div1">
                   添加联系人信息
                </div>
             </div>
            <form id="LAdd_Lxr" method="post" class="form-horizontal"  role="from">
             <div class="modal-body">
                    <input id="Hsrvid_Lxr" name="Hsrvid_Lxr" type="hidden" />
                    <input id="Huserid_Lxr" name="Huserid_Lxr" type="hidden" />
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">姓名：</label>
                        <div class="col-sm-3">
                            <input   id="lxrmc_Lxr" name="lxrmc_Lxr" type="text"btvd-type="requiredlength" btvd-err="姓名不能为空且最多输入10个字！"  l="10"  btvd-class='btvdclass'/><font style="color: Red" >*</font>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">电话：</label>
                        <div class="col-sm-3">
                            <input  id="dhhm_Lxr" name="dhhm_Lxr" placeholder="例如：15100000000"   type="text" btvd-type="requiredlength" btvd-err="电话不能为空最多输入40个数字" btvd-class='btvdclass' l="40"/><font style="color: Red">*</font>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">职位：</label>
                        <div class="col-sm-3">
                            <select id="zw_Lxr"  name="zw_Lxr">
                                <option value="">请选择</option>
                            </select>
                            <div title="添加职位信息" tag="M_100_AJ" onclick="CreatePosition()"  style="display:inline; cursor:pointer"><span class="ace-icon fa fa-trash-o fa-pencil bigger-120 blue"></span></div>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">英文姓名：</label>
                        <div class="col-sm-3">
                            <input   id="ywmc_Lxr" name="ywmc_Lxr" type="text" btvd-type="char" btvd-err="英文姓名必须为英文字符且长度为20个字符" btvd-class='btvdclass' l="20"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">性别：</label>
                        <div class="col-sm-3">
                            <select  id="xb_Lxr" name="xb_Lxr">
                                <option value="">请选择</option>
                                <option value="男">男</option>   
                                <option value="女">女</option>   
                            </select>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">邮箱：</label>
                        <div class="col-sm-3">
                            <input id="yx_Lxr"  name="yx_Lxr" type="text" placeholder="例如：tcwl@sohu.com"  btvd-type="email" btvd-err="邮箱格式不正确" btvd-class='btvdclass' l="30"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">决策等级：</label>
                        <div class="col-sm-3">
                            <select  id="jcdj_Lxr" name="jcdj_Lxr">
                                <option value="低">低</option>
                                <option value="中">中</option>
                                <option value="高">高</option>  
                            </select>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">婚否：</label>
                        <div class="col-sm-3">
                            <select  id="hf_Lxr" name="hf_Lxr">
                                <option value="">请选择</option>
                                <option value="已婚">已婚</option>   
                                <option value="未婚">未婚</option>   
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right"  style="display:none">电话类型：</label>
                        <div class="col-sm-3" style="display:none">
                            <select  id="dhlx_Lxr" name="dhlx_Lxr">
                                <option value="手机">手机</option>
                                <option value="固话">固话</option> 
                            </select>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">出生日期：</label>
                        <div class="col-sm-3">
                            <input class="datepicker" readonly id="csrq_Lxr" name="csrq_Lxr" type="text" placeholder="例如：2014-01-01" btvd-type="required" btvd-err="出生日期不能为空" btvd-class='btvdclass'/>
                        </div>
                         <label class="col-sm-2  control-label no-padding-right">QQ：</label>
                        <div class="col-sm-3">
                            <input   id="QQ_Lxr"  name="QQ_Lxr" type="text" btvd-type="QQ" btvd-err="QQ格式不正确" btvd-class='btvdclass' lang="15"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">爱好：</label>
                        <div class="col-sm-3">
                            <input  id="ah_Lxr" name="ah_Lxr"  type="text" btvd-type="length" btvd-err="最多输入30个字" btvd-class='btvdclass' l="30" />
                        </div>
                       <label class="col-sm-2  control-label no-padding-right">MSN：</label>
                        <div class="col-sm-3">
                            <input id="MSN_Lxr" name="MSN_Lxr"  type="text" btvd-type="length" btvd-err="MSN最多输入30个字" btvd-class='btvdclass' l="30"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">传真：</label>
                        <div class="col-sm-3">
                            <input id="cz_Lxr" name="cz_Lxr" type="text" btvd-type="fax" btvd-err="传真格式不正确" placeholder="例:0371-12345678" btvd-class='btvdclass' />
                        </div>
                        
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="txtName">备注：</label>
                        <div class="col-sm-10">
                            <textarea id="bz_Lxr" name="bz_Lxr" class="form-control" rows="4" btvd-type="length" btvd-err="长度不能超过50" btvd-class='btvdclass' l="50" placeholder="最多输入50个字" ></textarea>
                        </div>
                    </div>
             </div>
              <div class="modal-footer">
                <button type="button" onclick="Add_Lxr_CZ();" class="btn btn-white btn-info btn-bold">
                    <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                </button>
                <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                    <i class="ace-icon fa fa-times red2"></i>关闭
                </button>
                </div>
            </form>
          </div>
        </div>
    </div>
    <!--修改联系人-->
    <div class="modal fade" id="uAddDialog_Lxr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
       <div class="modal-dialog" >
          <div class="modal-content">
             <div class="modal-header ui-widget-header">
                <button type="button" class="close" 
                   data-dismiss="modal" aria-hidden="true">
                      &times;
                </button>
                <div class="modal-title" >
                   修改联系人信息
                </div>
             </div>
            <form id="uLAdd_Lxr" method="post" role="from" class="form-horizontal">
             <div class="modal-body">
                    <input id="uID_Lxr" name="uID_Lxr" type="hidden" />
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">姓名：</label>
                        <div class="col-sm-3">
                            <input   id="ulxrmc_Lxr" name="ulxrmc_Lxr" type="text" btvd-type="requiredlength" btvd-err="姓名不能为空且最多输入10个字！"  l="10"  btvd-class='btvdclass'/><font style="color: Red">*</font>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">电话：</label>
                        <div class="col-sm-3">
                            <input  id="udhhm_Lxr" name="udhhm_Lxr"  type="text" btvd-type="requiredlength" btvd-err="电话不能为空最多输入40个数字" btvd-class='btvdclass' l="40"/><font style="color: Red">*</font>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">职位：</label>
                        <div class="col-sm-3">
                            <select id="uzw_Lxr"  name="uzw_Lxr">
                                <option value="">请选择</option>
                            </select>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">英文姓名：</label>
                        <div class="col-sm-3">
                            <input   id="uywmc_Lxr" name="uywmc_Lxr" type="text" btvd-type="char" btvd-err="英文姓名必须为英文字符且最多输入20个字母" btvd-class='btvdclass' l="20"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">性别：</label>
                        <div class="col-sm-3">
                            <select  id="uxb_Lxr" name="uxb_Lxr">
                                <option value="">请选择</option>
                                <option value="男">男</option>   
                                <option value="女">女</option>   
                            </select>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">邮箱：</label>
                        <div class="col-sm-3">
                            <input id="uyx_Lxr"  name="uyx_Lxr" type="text" btvd-type="email" btvd-err="邮箱格式不正确" btvd-class='btvdclass' l="30"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">决策等级：</label>
                        <div class="col-sm-3">
                            <select  id="ujcdj_Lxr" name="ujcdj_Lxr">
                                <option value="中">中</option>
                                <option value="高">高</option> 
                                <option value="低">低</option>   
                            </select>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">婚否：</label>
                        <div class="col-sm-3">
                            <select  id="uhf_Lxr" name="uhf_Lxr">
                                <option value="已婚">已婚</option>   
                                <option value="未婚">未婚</option>   
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right" style="display:none">电话类型：</label>
                        <div class="col-sm-3"  style="display:none">
                            <select   id="udhlx_Lxr"  name="udhlx_Lxr">
                                <option value="手机">手机</option>
                                <option value="固话">固话</option> 
                            </select>
                        </div>
                        <label class="col-sm-2  control-label no-padding-right">出生日期：</label>
                        <div class="col-sm-3">
                            <input class="datepicker"   id="ucsrq_Lxr" name="ucsrq_Lxr" type="text" placeholder="例如：2014-01-01" />
                        </div>
                         <label class="col-sm-2  control-label no-padding-right">QQ：</label>
                        <div class="col-sm-3">
                            <input  id="uQQ_Lxr"  name="uQQ_Lxr" type="text" btvd-type="length" btvd-err="QQ不能为空且最多输入20个字！"  l="20"  btvd-class='btvdclass'/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">爱好：</label>
                        <div class="col-sm-3">
                            <input  id="uah_Lxr" name="uah_Lxr"  type="text" btvd-type="length" btvd-err="爱好不能为空且最多输入20个字！"  l="20"  btvd-class='btvdclass'/>
                        </div>
                       <label class="col-sm-2  control-label no-padding-right">MSN：</label>
                        <div class="col-sm-3">
                            <input  id="uMSN_Lxr" name="uMSN_Lxr"  type="text" btvd-type="length" btvd-err="MSN不能为空且最多输入20个字！"  l="20"  btvd-class='btvdclass' />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2  control-label no-padding-right">传真：</label>
                        <div class="col-sm-3">
                            <input   id="ucz_Lxr" name="ucz_Lxr" type="text" btvd-type="length" btvd-err="传真不能为空！"  btvd-class='btvdclass'/>
                        </div>
                        
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="txtName">备注：</label>
                        <div class="col-sm-10">
                            <textarea id="ubz_Lxr" name="ubz_Lxr" class="form-control" rows="4" btvd-type="length" btvd-err="长度不能超过50" btvd-class='btvdclass' l="50" placeholder="最多输入50个字" ></textarea>
                        </div>
                    </div>
             </div>
            <div class="modal-footer">
                <button type="button" onclick="Update_Lxr_ZD();"class="btn btn-white btn-info btn-bold">
                    <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>提交
                </button>
                <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                    <i class="ace-icon fa fa-times red2"></i>关闭
                </button>
                </div>
                </form>
          </div>
        </div>
    </div>
    <!--删除联系人-->
    
    <div class="modal fade" id="Del_Lxr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
        aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <input id="DelID_Lxr" name="DelID_Lxr" type="hidden" />
                <div class="modal-header ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"
                    style="cursor: hand;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title" id="Div9">
                        询问信息
                    </div>
                </div>
                <div class="modal-body">
                    <p>
                        确认要删除吗？
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="Del_Lxr_ZD()" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-check bigger-120 blue"></i>删除
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>取消
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!--姓名或电话不能为空-->
    <div class="modal fade" id="XMorDH" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:250px;">
            <div class="panel panel-danger">
                <div class="panel-heading">
                    <h3 class="panel-title">姓名或电话不能为空!</h3>
                </div>
                <div class="panel-body" style="text-align:right;">
                    <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>
    <!--连接失败-->
    <div class="modal fade" id="LJFalse_Lxr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:250px;">
            <div class="panel panel-warning">
                <div class="panel-heading">
                    <h3 class="panel-title">请求服务器失败!</h3>
                </div>
                <div class="panel-body" style="text-align:right;">
                    <button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">确定</button>
                </div>
            </div>
        </div>
    </div>
    <!--查看合同信息-->
    <div class="modal fade" id="HtCheck" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
       <div class="modal-dialog">
          <div class="modal-content panel panel-primary" style="width:800px;">
             <div class="modal-header panel-heading">
                <button type="button" class="close" 
                   data-dismiss="modal" aria-hidden="true">
                      &times;
                </button>
                <div class="modal-title" id="Div2">
                   合同信息
                <input type="hidden" id="lbHtId" name="lbHtId" />
                <input type="hidden" id="lbServerid" name="lbServerid" />
                </div>
             </div>
              <div class="modal-body">
                  <form id="UpdateKH" method="post" style="margin-top: 30px;" runat="server">
                      <input id="Hukhid" name="Hukhid" type="hidden" />
                      <!--基本信息-->
                      <div style="border:1px solid #cccccc;padding-bottom:10px;">
                        <p style=" width:60px; height:30px; line-height:45px; background-color:#FFFFFF; color:#000000;position:relative; top:-25px; left:30px;color:#cccccc;">基本信息</p>
                          <table>
                        <tr>
                            <td style="text-align:right;width:100px;"><span>合同编号：</span></td>
                            <td style="text-align:left;">
                                <label id="lbNo" class="control-label" ></label>
                            </td>
                            <td></td>
                            <td style="width:20px;color:Red;font-size:22px;"></td>

                            <td style="text-align:right;width:100px;"><span>合同名称：</span></td>
                            <td style="text-align:left;">
                                <label id="lbName" class="control-label" ></label>
                            </td>
                            <td style="width:20px;color:Red;font-size:22px;"></td>
                            <td style="text-align:right;width:100px;"><span>客户名称：</span></td>
                            <td style="text-align:left;">
                                <label id="lbKh" class="control-label" ></label>
                            </td>
                            <td ></td> 
                        </tr>
                        <tr style="height:15px;">
                            <td></td>
                        </tr>
                        <tr>
                            <td style="text-align:left;width:100px;"><span>总金额：</span></td>
                            <td style="text-align:left;">
                                  <label id="lbSum" class="control-label" ></label>
                            </td>
                            <td></td>
                            <td style="width:20px;"></td>

                            <td style="text-align:right;width:100px;"><span>签订日期：</span></td>
                            <td style="text-align:left;">
                                <label id="lbQdDate" class="control-label" ></label>
                            </td>
                            <td style="width:20px;"></td>

                            <td style="text-align:right;width:100px;"><span>签订人员：</span></td>
                            <td style="text-align:left;">
                                <label id="lbQdMan" class="control-label" ></label>
                               
                            </td>
                            <td style="width:20px;"></td>
                        </tr>
                        <tr style="height:15px;">
                            <td></td>
                        </tr>
                        <tr>
                            <td style="text-align:right;width:100px;"><span>联系人：</span></td>
                            <td style="text-align:left;">
                                <label id="lbLink" class="control-label" ></label>
                            </td>
                            <td></td>
                            <td style="width:20px;"></td>

                            <td style="text-align:right;width:100px;"><span>联系电话：</span></td>
                            <td style="text-align:left;">
                                <label id="lbTel" class="control-label" ></label>
                            </td>
                            <td style="width:20px;"></td>

                            <td style="text-align:right;width:100px;"><span>联系邮箱：</span></td>
                            <td style="text-align:left;">
                                 <label id="lbEmail" class="control-label" ></label>
                            </td>
                            <td style="width:20px;"></td>

                        </tr>
                
                        <tr style="height:15px;">
                            <td></td>
                        </tr>
                        <tr >
                            <td style="text-align:right;width:100px;"><span>联系地址：</span></td>
                            <td style="text-align:left;">
                                <label id="lbAddr" class="control-label" ></label>
                            </td>
                            <td></td>
                            <td style="width:20px;"></td> 

                           <td style="text-align:right;width:100px;"><span>是否有发票：</span></td>
                            <td style="text-align:left;">
                                <label id="lbFp" class="control-label" ></label>
                            </td>
                            <td style="width:20px;"></td>
                            <td style="text-align:right;width:100px;"><span>附件：</span></td>
                            <td style="text-align:left;">
                                <label id="lbAttr" class="control-label" ></label>
                            </td>
                            <td style="width:20px;"></td>
                        </tr>
                        <tr style="height:15px;">
                            <td></td>
                        </tr>
                        <tr>
                            <td style="text-align:right;width:100px;"><span>付款方式：</span></td>
                            <td style="text-align:left;">
                                 <label id="lbPay" class="control-label" ></label>
                            </td>
                            <td></td>
                            <td style="width:20px;"></td>
                            <td style="text-align:right;width:100px;"><span>销售人员：</span></td>
                            <td style="text-align:left;">
                                <label id="lbSaler" class="control-label" ></label>
                            </td>
                            <td style="width:20px;"></td>
                            <td style="text-align:right;width:100px;"><span>订单：</span></td>
                            <td style="text-align:left;">
                                <label id="lbDd" class="control-label" ></label>
                            </td>
                            <td style="width:20px;"></td>
                        </tr>
                        <tr style="height:15px;">
                            <td></td>
                        </tr>
                        <tr>
                            <td style="text-align:right;"><span>备注：</span></td>
                            <td style="text-align:left;" colspan="8">
                               <label id="lbBz" class="control-label" placeholder="最多输入50个字"  btvd-type="length" btvd-err="长度不能超过50个字！"  btvd-class='btvdclass' l="50"></label>
                            </td>
                        </tr>
                    </table>
                      </div>
                      <div style="height:15px;"></div>
                      <!--产品信息-->
                      <div style="border:1px solid #cccccc;padding-bottom:10px;">
                        <p style="width:60px; height:25px; line-height:25px; background-color:#FFFFFF; color:#000000;position:relative; top:-15px; left:30px;color:#cccccc;">收款计划</p>
                        <table class="table table-hover table-bordered  table-striped  no-margin-bottom no-border-top" id="CheckPlTb">
                           <thead>
                              <tr>
                                <th style="text-align:left;min-width:80px;">计划时间</th>
						        <th style="text-align:left;min-width:60px;">内 容</th>
					            <th style="text-align:left;min-width:60px;">备 注</th>
						        <th style="text-align:left;min-width:80px;">收款金额</th>
                                <th style="text-align:left;min-width:80px;">是否付款</th>
						        <th style="text-align:left;min-width:90px;">收款百分比</th>
                              </tr>
                           </thead>
                           <tbody>
                           </tbody>
                        </table>
                      </div>
                  </form>
              </div>
          </div>
        </div>
    </div>
    <!--订单下的产品信息-->
    <div class="modal fade" id="CS_S" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:80%;">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">产品信息</h3>
                </div>
                <div class="modal-body">
                    <table  class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top" id="Management_CS">
			            <thead>
				            <tr>
			                    <th style="text-align:left;min-width:80px;">产品名称</th>
			                    <th style="text-align:left;min-width:60px;">单 价</th>
                                <th style="text-align:left;min-width:60px;">数 量</th>
                                <th style="text-align:left;min-width:70px;">总金额</th>
				            </tr>
			            </thead>

			            <tbody >
			            </tbody>
		            </table>
                </div>
            </div>
        </div>
    </div>

    <!--产品信息-->
    <div class="modal fade" id="CP_S" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal_htgl" >
            <div class="modal-content">
                <div class="modal-header  ui-widget-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    产品信息
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <table>
                            <tr>
                                <td>
                                    <input type="text" data-provide="typeahead"  class="form-control" id="cpname" name="cpname" placeholder="请输入产品名称"  >
                                </td>
                                <td><button type="button" class="btn btn-purple btn-sm" onclick="Btn_check_C(1)"><i class="ace-icon fa fa-search icon-on-right bigger-110"></i>查询</button></td>
                                <td style="padding-left:5px;"><button type="button" class="btn btn-purple btn-sm" onclick="CP_PList()"><i class="ace-icon fa fa-plus  bigger-110"></i>批量添加</button></td>
                            </tr>
                        </table>
                    </div>
                    <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top" id="Management_C">
			            <thead>
				            <tr>
                                <th class="center">
									<label class="position-relative">
										<input type="checkbox" class="ace" value="" />
										<span class="lbl"></span>
									</label>
								</th>
			                    <th style="text-align:left;">名称</th>
			                    <th style="text-align:left;">单位</th>
			                    <th style="text-align:left;">价格</th>
			                    <th style="text-align:left;">数量</th>
                                <th style="text-align:left;">操作</th>
				            </tr>
			            </thead>

			            <tbody >
			            </tbody>
		            </table>
                </div>
                <div >
                    <table>
                        <tr>
                            <td>
                                <select id="PSize_C">
                                    <option value="10">10</option>
                                    <option value="20" selected="selected">20</option>
                                    <option value="30">30</option>
                                    <option value="40">40</option>
                                </select>
                            </td>
                            <td>
                                <ul class="pagination" id="cp_p">
                                </ul>
                            </td>
                            <td>
                                <span id="pFooter_C"></span>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!--收款记录-->
    <div id="JL_S" class="modal fade" tabindex="2">
        <div class="modal-Eject">
            <div class="modal-content">
                <div class="modal-header  ui-widget-header " style="color:White;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    添加收款记录
                </div>
                <form class="form-horizontal" role="form" id="staticFm">
                <div class="modal-body">
                    <div class="widget-box">
                        <div class="widget-content nopadding">
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    选择日期:
                                </label>
                                <div class="col-sm-9">
                                    <input id="jsj" name="jsj" type="text" class="form-control datepicker" placeholder="2014-01-01" readonly="readonly">
                                    <font style="color: Red">*</font>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    付款方式:
                                </label>
                                <div class="col-sm-9">
                                    <select id="jfs">
                                        <option value="现金">现 金</option>
                                        <option value="中国工商银行转账">中国工商银行转账</option>
                                        <option value="招商银行转账">招商银行转账</option>
                                        <option value="中国农业银行转账">中国农业银行转账</option>
                                        <option value="中国建设银行转账">中国建设银行转账</option>
                                        <option value="中国银行转账">中国银行转账</option>
                                        <option value="中国民生银行转账">中国民生银行转账</option>
                                        <option value="中信银行转账">中信银行转账</option>
                                        <option value="其他">其 他</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    是否发票:
                                </label>
                                <div class="col-sm-9">
                                    <select id="jfp">
                                        <option value="否">否</option>
                                        <option value="是">是</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    收款金额:
                                </label>
                                <div class="col-sm-9">
                                    <input id="jje" name="jje" placeholder="请输入收款金额" class="col-xs-10 col-sm-10" type="text"
                                        btvd-type="number" btvd-err="收款金额值必须为数字" btvd-class='btvdclass' />
                                    <font style="color: Red">*</font>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    备注:
                                </label>
                                <div class="col-sm-9">
                                    <textarea id="jbz" name="jbz" style="width: 200px; height: 104px;" class="span11"
                                        btvd-type="length" btvd-err="长度不能超过250" btvd-class='btvdclass' l="250" placeholder="最多输入250个字" ></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="ADD_CZ('add')" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
                </form>
            </div>
        </div>
    </div>
    <!--操作列的添加收款记录-->
    <div id="cJL_S" class="modal fade" tabindex="2">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header  ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"
                    style="cursor: hand;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    添加收款计划
                    <input type="hidden" name="cid" id="cid" />
                </div>
                <form class="form-horizontal" role="form" id="cstaticFm">
                <div class="modal-body">
                    <div class="widget-box">
                        <div class="widget-content nopadding">
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    选择日期
                                </label>
                                <div class="col-sm-9">
                                    <input id="csj" name="csj" type="date" class="form-control datepicker" placeholder="2014-01-01">
                                    <font style="color: Red">*</font>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    付款方式
                                </label>
                                <div class="col-sm-9">
                                    <select id="cfs" >
                                        <option value="现金">现 金</option>
                                        <option value="中国工商银行转账">中国工商银行转账</option>
                                        <option value="招商银行转账">招商银行转账</option>
                                        <option value="中国农业银行转账">中国农业银行转账</option>
                                        <option value="中国建设银行转账">中国建设银行转账</option>
                                        <option value="中国银行转账">中国银行转账</option>
                                        <option value="中国民生银行转账">中国民生银行转账</option>
                                        <option value="中信银行转账">中信银行转账</option>
                                        <option value="其他">其 他</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    是否发票
                                </label>
                                <div class="col-sm-9">
                                    <select id="cfp" >
                                        <option value="否">否</option>
                                        <option value="是">是</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    收款金额
                                </label>
                                <div class="col-sm-9">
                                    <input id="cje" name="cje" placeholder="请输入收款金额" class="col-xs-10 col-sm-10"
                                        type="text" btvd-type="number" btvd-err="收款金额值必须为数字" btvd-class='btvdclass' />
                                        <font style="color: Red">*</font>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    备注
                                </label>
                                <div class="col-sm-9">
                                    <textarea id="cbz" name="cbz" style="width: 348px; height: 104px;" class="span11" btvd-type="length"
                                        btvd-err="长度不能超过250" btvd-class='btvdclass' l="250" placeholder="最多输入250个字" ></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="ADD_TJ()" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
                </form>
            </div>
        </div>
    </div>
    <!--删除收款记录-->
    <div class="modal fade" id="DelOrder" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
        aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content" style="width: 400px;">
                <input id="Hidden1" name="DelID" type="hidden" />
                <div class="modal-header ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"
                    style="cursor: hand;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title" id="Div6">
                        询问信息
                    </div>
                </div>
                <div class="modal-body">
                    <p>
                        确实要删除吗？
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="Del_ZD();" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-check bigger-120 blue"></i>确定
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>取消
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!--修改订单-->
    <div class="modal fade" id="EditOrder" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
       <div class="modal-dialog">
          <div class="modal-content" style="width:800px;">
             <div class="modal-header">
                <button type="button" class="close" 
                   data-dismiss="modal" aria-hidden="true">
                      &times;
                </button>
                <div class="modal-title" id="umyModalLabel">
                   修改合同信息
                </div>
             </div>
              <div class="modal-body">
                  <form id="uUpdateKH" method="post" style="margin-top: 30px;" >
                      <input id="uHukhid" name="uHukhid" type="hidden" />
                      <input id="uHid" name="uHid" type="hidden" />
                      <input id="uHzt" name="uHzt" type="hidden" />
                      <!--基本信息-->
                      <div style="border:1px solid #cccccc;padding-bottom:10px;">
                        <p style=" width:60px; height:30px; line-height:45px; background-color:#FFFFFF; color:#000000;position:relative; top:-25px; left:30px;color:#cccccc;">基本信息</p>
                          <table>
                              <tr>
                                  <td style="text-align: right; width: 100px;">
                                      <span>合同编号：</span>
                                  </td>
                                  <td style="text-align: left;">
                                      <input type="text" class="form-control" id="uddbh" name="uddbh" readonly />
                                  </td>
                                  <td style="width: 20px;"></td> 

                                   <td style="text-align: right; width: 100px;">
                                      <span>上传附件：</span>
                                  </td>
                                  <td style="text-align: left;">
                                      <button type="button" class="btn btn-purple btn-xs" onclick="FJ_S('Update')">上传</button>
                                      <input id="ufj" name="ufj" type="hidden" class="form-control" />&nbsp;
                                      <a href="" id="uxz">下载</a>
                                  </td>
                                  <td style="width: 80px; color: Red; font-size: 22px;">
                                      <input id="uxsry" name="uxsry" type="hidden" class="form-control" />
                                      <input id="uxsrybh" name="uxsrybh" type="hidden" />
                                      <input id="ulxr" name="ulxr" type="hidden" class="form-control" />
                                      <input id="ulxrbh" name="ulxrbh" type="hidden" />
                                      <input id="ulxdh" name="ulxdh" type="hidden" class="form-control" />
                                  </td> 
                                      
                              </tr>
                              <tr style="height: 15px;">
                                  <td>
                                  </td>
                              </tr>
                              <tr>
                                  <td style="text-align: right; width: 100px;">
                                      <span>合同类别：</span>
                                  </td>
                                  <td style="text-align: left;">
                                      <select class="form-control" id="uhtlb" name="uhtlb">
                                          <option value="新建">新建</option>
                                          <option value="续签">续签</option>
                                          <option value="维护">维护</option>
                                      </select>
                                  </td>
                                  <td style="width: 20px;">
                                  </td>

                                  <td style="text-align: right; width: 100px;display:none">
                                      <span>发 票：</span>
                                  </td>
                                  <td style="text-align: left;display:none">
                                      <select class="form-control" id="ufp" name="ufp">
                                          <option value="是">是</option>
                                          <option value="否">否</option>
                                      </select>
                                  </td>
                                  <td style="width: 50px;">&nbsp;
                                      
                                      
                                  </td>
                              </tr>
                              <tr style="height: 15px;">
                                  <td>
                                  </td>
                              </tr>
                              <tr>                                  
                                  <td style="text-align: right; width: 100px;">
                                      <span>应收总金额：</span>
                                  </td>
                                  <td style="text-align: left;">
                                      <input id="uyszje" name="uyszje" type="text" class="form-control" readonly />
                                  </td>
                                  <td style="width: 20px;">
                                  </td>

                                  <td style="text-align: right; width: 100px;">
                                      <span>实收总金额：</span>
                                  </td>
                                  <td style="text-align: left;">
                                      <input id="usszje" name="usszje" type="text" class="form-control" readonly />
                                  </td>
                                  <td style="width: 20px;">
                                  </td>
                              </tr>
                              <tr style="height: 15px;">
                                  <td>
                                  </td>
                              </tr>
                          </table>
                          <div style="height: 15px;">
                          </div>
                          <table>
                              <tr>
                                  <td style="text-align: right; width: 100px;">
                                      <span>备 注：</span>
                                  </td>
                                  <td style="text-align: left;">
                                      <textarea id="ubz" name="ubz" class="form-control" style="width: 650px; height: 96px;"></textarea>
                                  </td>
                              </tr>
                          </table>
                      </div>
                      <div style="height:15px;"></div>
                      <!--产品信息-->
                      <div style="border: 1px solid #cccccc; padding-bottom: 10px;">
                          <p style="width: 60px; height: 25px; line-height: 25px; background-color: #FFFFFF;
                              color: #000000; position: relative; top: -15px; left: 30px; color: #cccccc;">
                              产品信息</p>
                          <button type="button" class="btn btn-purple btn-xs" onclick="uADD_CP($('#uPSize_C').val(), 1)"
                              style="margin-top: -15px; margin-left: 5px;display:none;" id="ucp">
                              添加产品</button>
                          <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                              id="uManagement_A_C">
                              <thead>
                                  <tr>
                                      <th style="text-align: center;min-width:80px;">
                                          产品名称
                                      </th>
                                      <th style="text-align: center;min-width:60px;">
                                          单 价
                                      </th>
                                      <th style="text-align: center;min-width:60px;">
                                          数 量
                                      </th>
                                      <th style="text-align: center;min-width:70px;">
                                          总金额
                                      </th>
                                      <th style="text-align: center;min-width:60px;">
                                          操 作
                                      </th>
                                  </tr>
                              </thead>
                              <tbody>
                              </tbody>
                          </table>
                      </div>
                      <div style="height:15px;"></div>
                      <!--收款计划-->
                      <div style="border: 1px solid #cccccc; padding-bottom: 10px;">
                          <p style="width: 60px; height: 25px; line-height: 25px; background-color: #FFFFFF;
                              color: #000000; position: relative; top: -15px; left: 30px; color: #cccccc;">
                              收款记录</p>
                          <button type="button" class="btn btn-purple btn-xs" onclick="ADD_JL('update','')"
                              style="margin-top: -15px; margin-left: 5px;display:none;" id="ujl">
                              添加记录</button>
                          <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                              id="uManagement_A_J">
                              <thead>
                                  <tr>
                                      <th style="text-align: center;min-width:80px;">
                                          收款时间
                                      </th>
                                      <th style="text-align: center;min-width:80px;">
                                          付款方式
                                      </th>
                                      <th style="text-align: center;min-width:80px;">
                                          是否发票
                                      </th>
                                      <th style="text-align: center;min-width:60px;">
                                          金 额
                                      </th>
                                      <th style="text-align: center;min-width:60px;">
                                          备 注
                                      </th>
                                  </tr>
                              </thead>
                              <tbody>
                              </tbody>
                          </table>
                      </div>
                  </form>
              </div>
             <div class="modal-footer">
                <button type="button" onclick="uAdd();" class="btn btn-white btn-info btn-bold" style="display:none;" id="utj">
                    <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>提交
                </button>
                <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                    <i class="ace-icon fa fa-times red2"></i>关闭
                </button>
             </div>
          </div>
        </div>
    </div>
    <!--生成客户-->
    <div class="modal fade" id="HT_S" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content" style="width: 800px;">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title">
                        生成合同
                    </div>
                </div>
                <div class="modal-body">
                    <form id="HT_f" method="post" style="margin-top: 30px;" >
                    <input id="hid" name="hid" type="hidden" />
                    <!--基本信息-->
                    <div style="border: 1px solid #cccccc; padding-bottom: 10px;">
                        <p style="width: 60px; height: 30px; line-height: 45px; background-color: #ffffff;
                            color: #000000; position: relative; top: -25px; left: 30px; color: #cccccc;">
                            基本信息</p>
                        <table>
                            <tr>
                                <td style="text-align: right; width: 100px;">
                                    <span>合同编号：</span>
                                </td>
                                <td style="text-align: left;">
                                    <input id="hbh" name="hbh" type="text" class="form-control" />
                                </td>
                                <td style="width: 20px;">
                                </td>
                                <td style="text-align: right; width: 100px;">
                                    <span>客户名称：</span>
                                </td>
                                <td style="text-align: left;">
                                    <input id="hkh" name="hkh" type="text" readonly />
                                    <input id="hkhid" name="hkhid" type="hidden" />
                                </td>
                                <td style="width: 20px;">
                                </td>
                                <td style="text-align: right; width: 100px;">
                                    <span>签订日期：</span>
                                </td>
                                <td style="text-align: left;">
                                    <input id="hsj" name="hsj" type="date" class="form-control datepicker" placeholder="2014-01-01">
                                </td>
                                <td style="width: 20px;">
                                </td>
                            </tr>
                            <tr style="height: 15px;">
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right; width: 100px;">
                                    <span>订单类别：</span>
                                </td>
                                <td style="text-align: left;">
                                    <select id="hlb" name="hlb">
                                        <option value="新签">新 签</option>
                                        <option value="续费">续 费</option>
                                        <option value="维护">维 护</option>
                                    </select>
                                </td>
                                <td style="width: 20px;">
                                </td>
                                <td style="text-align: right; width: 100px;display:none">
                                    <span>是否发票：</span>
                                </td>
                                <td style="text-align: left;display:none">
                                    <select class="form-control" id="hfp" name="hfp">
                                        <option value="否">否</option>
                                        <option value="是">是</option>
                                    </select>
                                </td>
                                <td style="width: 20px;">
                                </td>
                                <td style="text-align: right; width: 100px;">
                                    <span>付款方式：</span>
                                </td>
                                <td style="text-align: left;">
                                    <select id="hfs" name="hfs">
                                        <option value="现金">现 金</option>
                                        <option value="中国工商银行转账">中国工商银行转账</option>
                                        <option value="招商银行转账">招商银行转账</option>
                                        <option value="中国农业银行转账">中国农业银行转账</option>
                                        <option value="中国建设银行转账">中国建设银行转账</option>
                                        <option value="中国银行转账">中国银行转账</option>
                                        <option value="中国民生银行转账">中国民生银行转账</option>
                                        <option value="中信银行转账">中信银行转账</option>
                                        <option value="其他">其 他</option>
                                    </select>
                                </td>
                                <td style="width: 20px;">
                                </td>
                            </tr>
                            <tr style="height: 15px;">
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: right; width: 100px;">
                                    <span>总金额：</span>
                                </td>
                                <td style="text-align: left;">
                                    <input id="hzje" name="hzje" placeholder="请输入总金额" class="col-xs-10 col-sm-10" type="text"
                                        btvd-type="number" btvd-err="总金额值必须为数字" btvd-class='btvdclass' readonly />
                                </td>
                                <td style="width: 20px;">
                                </td>
                                <td style="text-align: right; width: 100px;">
                                    <span>收款金额：</span>
                                </td>
                                <td style="text-align: left;">
                                    <input id="hysk" name="hysk" placeholder="请输入收款金额" class="col-xs-10 col-sm-10" type="text"
                                        btvd-type="number" btvd-err="收款金额值必须为数字" btvd-class='btvdclass' readonly />
                                </td>
                                <td style="width: 20px;">
                                </td>
                            </tr>
                        </table>
                        <div style="height: 15px;">
                        </div>
                        <table>
                            <tr>
                                <td style="text-align: right; width: 100px;">
                                    <span>备 注：</span>
                                </td>
                                <td style="text-align: left;">
                                    <textarea id="hbz" name="hbz" style="width: 642px; height: 87px;" class="span11"
                                        btvd-type="length" btvd-err="长度不能超过250" btvd-class='btvdclass' l="250"></textarea>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="height: 15px;">
                    </div>
                    <!--产品信息-->
                    <div style="border: 1px solid #cccccc; padding-bottom: 10px;">
                        <p style="width: 60px; height: 25px; line-height: 25px; background-color: #ffffff;
                            color: #000000; position: relative; top: -15px; left: 30px; color: #cccccc;">
                            产品信息</p>
                        <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                            id="Management_H_C">
                            <thead>
                                <tr>
                                    <th style="text-align: center;min-width:80px;">
                                        产品名称
                                    </th>
                                    <th style="text-align: center;min-width:60px;">
                                        单 价
                                    </th>
                                    <th style="text-align: center;min-width:60px;">
                                        数 量
                                    </th>
                                    <th style="text-align: center;min-width:70px;">
                                        总金额
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    <div style="height: 15px;">
                    </div>
                    <!--收款计划-->
                    <div style="border: 1px solid #cccccc; padding-bottom: 10px;">
                        <p style="width: 60px; height: 25px; line-height: 25px; background-color: #ffffff;
                            color: #000000; position: relative; top: -15px; left: 30px; color: #cccccc;">
                            收款记录</p>
                        <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                            id="Management_H_J">
                            <thead>
                                <tr>
                                    <th style="text-align: center;min-width:80px;">
                                        收款时间
                                    </th>
                                    <th style="text-align: center;min-width:80px;">
                                        付款方式
                                    </th>
                                    <th style="text-align: center;min-width:80px;">
                                        是否发票
                                    </th>
                                    <th style="text-align: center;min-width:60px;">
                                        金 额
                                    </th>
                                    <th style="text-align: center;min-width:60px;">
                                        备 注
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="SC_HT();" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>提交
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!--修改--产品信息-->
    <div class="modal fade" id="uCP_S" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:800px;">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">产品信息</h3>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <table>
                            <tr>
                                <td><label for="name">产品名称</label></td>
                                <td>
                                    <input type="text" data-provide="typeahead"  class="form-control" id="ucpname" name="ucpname" placeholder="请输入产品名称"  >
                                </td>
                                <td><button type="button" class="btn btn-default" onclick="Btn_check_C('Update',1)">查询</button></td>
                                <td><button type="button" class="btn btn-default" onclick="CP_PList('Update')">批量添加</button></td>
                            </tr>
                        </table>
                    </div>
                    <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top" id="uManagement_C">
			            <thead>
				            <tr>
                                <th class="center">
									<label class="position-relative">
										<input type="checkbox" class="ace" value="" />
										<span class="lbl"></span>
									</label>
								</th>
			                    <th style="text-align:center;">名称</th>
			                    <th style="text-align:center;">单位</th>
			                    <th style="text-align:center">价格</th>
			                    <th style="text-align:center;">数量</th>
                                <th style="text-align:center;">操作</th>
				            </tr>
			            </thead>

			            <tbody >
			            </tbody>
		            </table>
                </div>
                <div class="row">
                    <table>
                        <tr>
                            <td>
                                <select id="uPSize_C">
                                    <option value="10">10</option>
                                    <option value="20" selected="selected">20</option>
                                    <option value="30">30</option>
                                    <option value="40">40</option>
                                </select>
                            </td>
                            <td>
                                <ul class="pagination" id="ucp_p">
                                </ul>
                            </td>
                            <td>
                                <span id="upFooter_C"></span>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <!--修改--收款记录-->
    <div id="uJL_S" class="modal fade" tabindex="2">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header  ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"
                    style="cursor: hand;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    添加收款计划
                </div>
                <form class="form-horizontal" role="form" id="ustaticFm">
                <div class="modal-body">
                    <div class="widget-box">
                        <div class="widget-content nopadding">
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    选择日期
                                </label>
                                <div class="col-sm-9">
                                    <input id="ujsj" name="ujsj" type="date" class="form-control datepicker" placeholder="2014-01-01">
                                    <font style="color: Red">*</font>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    付款方式
                                </label>
                                <div class="col-sm-9">
                                    <select id="ujfs" >
                                        <option value="现金">现 金</option>
                                        <option value="中国工商银行转账">中国工商银行转账</option>
                                        <option value="招商银行转账">招商银行转账</option>
                                        <option value="中国农业银行转账">中国农业银行转账</option>
                                        <option value="中国建设银行转账">中国建设银行转账</option>
                                        <option value="中国银行转账">中国银行转账</option>
                                        <option value="中国民生银行转账">中国民生银行转账</option>
                                        <option value="中信银行转账">中信银行转账</option>
                                        <option value="其他">其 他</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    是否发票
                                </label>
                                <div class="col-sm-9">
                                    <select id="ujfp" >
                                        <option value="否">否</option>
                                        <option value="是">是</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    收款金额
                                </label>
                                <div class="col-sm-9">
                                    <input id="ujje" name="ujje" placeholder="请输入收款金额" class="col-xs-10 col-sm-10"
                                        type="text" btvd-type="number" btvd-err="收款金额值必须为数字" btvd-class='btvdclass' />
                                        <font style="color: Red">*</font>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    备注
                                </label>
                                <div class="col-sm-9">
                                    <textarea id="ujbz" name="ujbz" style="width: 348px; height: 104px;" class="span11" btvd-type="length"
                                        btvd-err="长度不能超过250" btvd-class='btvdclass' l="250"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="ADD_CZ('update')" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
                </form>
            </div>
        </div>
    </div>
    <!--添加职位信息-->
    <div class="modal fade" id="M_Position" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content" style="">
                <div class="modal-header ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"
                    style="cursor: hand;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                </div>
                <form action="#" method="post" class="form-horizontal" id="frmAddCategory">
                <div class="modal-body">
                    <div class="widget-box">
                        <div class="widget-content nopadding">
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="txtName">
                                    职位名称：
                                </label>
                                <input type="hidden" id="hidid" />
                                <div class="col-sm-9">
                                    <input id="txtFName" name="txtName" placeholder="输入职位名称" class="col-xs-10 col-sm-10" type="text" btvd-type="requiredlength" btvd-err="职位名称不能为空且长度不能超过20个字" btvd-class='btvdclass' l="20"  placeholder="最多输入20个字" /><font style="color: Red">*</font>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="PositionAdd();" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>添加
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
                </form>
            </div>
        </div>
    </div>
    <!--查看合同信息-->
    <div class="modal fade" id="sAddDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
        aria-hidden="true" style="color:#999;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title" id="Div4">
                        查看合同信息
                    </div>
                </div>
                <div class="modal-body">
                    <form id="form1" method="post">
                    <input id="sHukhid" name="sHukhid" type="hidden" />
                    <input id="sHid" name="sHid" type="hidden" />
                    <input id="sHzt" name="sHzt" type="hidden" />
                    <div class="tabbable">
                        <ul class="nav nav-tabs" id="smyTab">
                            <li class="active"><a data-toggle="tab" href="#sBasic">基本信息 </a></li>
                            <li><a data-toggle="tab" href="#sProducts">产品信息 </a></li>
                            <li><a data-toggle="tab" href="#sCollect">收款记录 </a></li>
                            <li id="sli_yy" style="display: none;"><a data-toggle="tab" href="#sdiv_yy">不生效原因 </a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div id="sBasic" class="tab-pane in active">
                                <table>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>合同编号：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input type="text" class="form-control msg-font-color" id="sddbh" name="sddbh" readonly />
                                        </td>
                                        <td style="text-align: right; width: 100px;">
                                            <span>客户名称：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input type="text" class="form-control msg-font-color" id="skhmc" name="skhmc" readonly />
                                            <input id="skhbh" name="skhbh" type="hidden" />
                                        </td>
                                        <td style="">
                                            <input id="sxsry" name="sxsry" type="hidden" class="form-control" />
                                            <input id="sxsrybh" name="sxsrybh" type="hidden" />
                                            <input id="slxr" name="slxr" type="hidden" class="form-control" />
                                            <input id="slxrbh" name="slxrbh" type="hidden" />
                                            <input id="slxdh" name="slxdh" type="hidden" class="form-control" />
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                       <td style="text-align: right; width: 100px;">
                                            <span>签订日期：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input type="text" id="sqdrq" name="sqdrq" class="form-control msg-font-color" readonly>
                                        </td>
                                        <td style="text-align: right; width: 100px;">
                                            <span>签订日期：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input type="text" id="sdqrq" name="sdqrq" class="form-control msg-font-color" readonly>
                                        </td>
                                        <td style="text-align: right; width: 100px; display: none;">
                                            <span>发 票：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input id="sfp" name="sfp" type="text" class="form-control msg-font-color" readonly style="display: none;" />
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>应收金额：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input id="syszje" name="syszje" type="text" class="form-control msg-font-color" readonly />
                                        </td>
                                        <td style="text-align: right; width: 100px;">
                                            <span>实收金额：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input id="ssszje" name="ssszje" type="text" class="form-control msg-font-color" readonly />
                                        </td>
                                        <td style="width: 20px;">
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                         <td style="text-align: right; width: 100px;">
                                            <span>合同类别：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <input id="shtlb" name="shtlb" type="text" class="form-control msg-font-color" readonly />
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td>
                                        </td>
                                    </tr>
                                    <tr style="height: 15px;">
                                        <td style="text-align: right; width: 100px;">
                                            <span>上传附件：</span>
                                        </td>
                                        <td colspan=4 style="text-align: left;"  >
                                            <input id="sfj" name="sfj" type="hidden" class="form-control" />&nbsp; <a href=""
                                                id="sxz" target="_blank" style="display:none;">下载</a>
                                                <ul style="list-style: outside none none;margin-top: -20px;margin-left: -5px;" id="lookfList"></ul>
                                        </td>
                                        <td style="">
                                        </td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                </table>
                                <div style="height: 15px;">
                                </div>
                                <table>
                                    <tr>
                                        <td style="text-align: right; width: 100px;">
                                            <span>备 注：</span>
                                        </td>
                                        <td style="text-align: left;">
                                            <textarea id="sbz" name="sbz" class="form-control msg-font-color" style="width: 450px; height: 96px;" readonly></textarea>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div id="sProducts" class="tab-pane">
                                <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                                    id="sManagement_A_C">
                                    <thead>
                                        <tr>
                                            <th style="text-align: center;">
                                                产品名称
                                            </th>
                                            <th style="text-align: center;">
                                                单 价
                                            </th>
                                            <th style="text-align: center;">
                                                数 量
                                            </th>
                                            <th style="text-align: center;">
                                                总金额
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                            <div id="sCollect" class="tab-pane">
                                <table class="table table-hover table-bordered table-striped table-hover no-margin-bottom no-border-top"
                                    id="sManagement_A_J">
                                    <thead>
                                        <tr>
                                            <th style="text-align: center;">
                                                收款时间
                                            </th>
                                            <th style="text-align: center;">
                                                付款方式
                                            </th>
                                            <th style="text-align: center;">
                                                是否发票
                                            </th>
                                            <th style="text-align: center;">
                                                金 额
                                            </th>
                                            <th style="text-align: center;">
                                                备 注
                                            </th>
                                            <th style="text-align: center;">
                                                状 态
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                            <div id="sdiv_yy" class="tab-pane">
                                <table id="sManagement_A_Y">
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>关闭
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!--提示实收款超出应收款-->
    <div class="modal fade" id="QueRen" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
        aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"
                    style="cursor: hand;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <div class="modal-title" id="Div5">
                        提示信息
                    </div>
                </div>
                <div class="modal-body">
                    <p>
                        实收金额超出应收金额！！！
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="QueRen();" class="btn btn-white btn-info btn-bold">
                        <i class="ace-icon fa fa-check bigger-120 blue"></i>确定
                    </button>
                    <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal">
                        <i class="ace-icon fa fa-times red2"></i>取消
                    </button>
                </div>
            </div>
        </div>
    </div>
    <form id="frmDelFile" method="post">
    <input  type="hidden" id="delfile" name="file"/>
    </form>
        <div class="tcanchor" id="tcanchor" style="display:none;">
            <a href="javascript:void(0);" rel="tcclent"  data-hover="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;">客户信息</a> 
            <a href="javascript:void(0);" rel="tclxr"  data-hover="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;">其他信息</a> 
            <a href="javascript:void(0);" rel="tcht"  data-hover="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;">合同信息</a> 
            <a href="javascript:void(0);" rel="tchzjl" data-hover="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;">跟踪信息</a>
        </div>
</body>
</html>
