<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelRoomPayer.aspx.cs" Inherits="M_Main.DialogNew.SelRoomPayer" %>

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="../jscript/jquery-1.8.3.min.js"></script>
    <script src="../jscript/jquery.tool.new.js" type="text/javascript"></script>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.4/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.4/themes/icon.css" />
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/locale/easyui-lang-zh_CN.js"></script>
    <link href="../css/framesearch.css" type="text/css" rel="stylesheet" />
    <link href="../css/framedialog_eightcol.css" rel="stylesheet" />
    <script type="text/javascript" src="../jscript/DatePicker/WdatePicker.js"></script>
    <script src="../jscript/format.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Jscript-Ui/JQForm/JQForm.js"></script>

</head>
<body>
    <form id="frmForm">
        <input type="hidden" id="SelPhones" name="SelPhones" value="" runat="server" />
        <input type="hidden" id="SelPayerNames" name="SelPayerNames" value="" runat="server" />
        <input type="hidden" id="CommIDs" name="CommIDs" runat="server" />
        <input type="hidden" id="RoomSignID" name="RoomSignID" runat="server" />
        <div id="SearchDlg" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 650px; height: 200px;">

            <input id="AllCheck" size="1" type="hidden" name="AllCheck" runat="server" />
            <input id="IsAll" size="1" type="hidden" name="IsAll" runat="server" />

            <table style="width: 100%; padding-top: 5px">
                <tr>
                    <td class="TdTitle">缴费人</td>
                    <td class="TdContent">
                        <input class="easyui-textbox" id="PayerName" name="PayerName">
                    </td>
                    <td class="TdTitle">移动电话</td>
                    <td class="TdContentSearch">
                        <input class="easyui-textbox" id="inputTelephone" name="inputTelephone">
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="4">
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick=" LoadCustList();">确定筛选</a>
                    </td>
                </tr>
            </table>
        </div>
        <div style="width: 100%;" id="TableContainer">
        </div>

        <script src="../jscript/CloseAjaxCache.js" type="text/javascript"></script>
        <script type="text/javascript">

            var column = [[
                { field: 'ck', checkbox: true },
                { field: 'OrganName', title: '区域名称', width: 120, align: 'left', sortable: true },
                { field: 'CommName', title: '项目名称', width: 120, align: 'left', sortable: true },
                { field: 'RoomSign', title: '房屋编号', width: 160, align: 'left', sortable: true },
                { field: 'BuildArea', title: '建筑面积', width: 120, align: 'left', sortable: true },
                { field: 'StateName', title: '交房状态', width: 120, align: 'left', sortable: true },
                { field: 'TelName', title: '客户名称', width: 220, align: 'left', sortable: true },
                { field: 'CustTypeName', title: '客户类别', width: 150, align: 'left', sortable: true },
                { field: 'PaperCode', title: '证件号码', width: 180, align: 'left', sortable: true },
                {
                    field: 'MobilePhone', title: '移动电话', width: 200, align: 'left', sortable: true, formatter: function (value, row, index) {
                        var va = eval("row." + $(this).attr("field"));
                        return formatBr(24, va);
                    }
                }
            ]];

            function InitTableHeight() {
                var h = $(window).height();
                $("#TableContainer").css("height", h + "px");
            }
            InitTableHeight();

            var toolbar = [
                {
                    text: '筛选',
                    iconCls: 'icon-search',
                    handler: function () {
                        $('#SearchDlg').parent().appendTo($("form:first"));
                        $('#SearchDlg').dialog('open');
                    }
                }, '-',
                {
                    text: '确定选择',
                    iconCls: 'icon-save',
                    handler: function () {
                        var SelPhones = '';
                        var SelPayerNames = '';
                        var row = $("#TableContainer").datagrid('getChecked');
                        if (row == null) {
                            HDialog.Info('请选择数据！');
                        } else {
                            for (var i = 0; i < row.length; i++) {
                                var itemPhone = row[i].TelePhone;
                                var itemName = row[i].TelName;

                                if (!SelPhones.indexOf(itemPhone) > -1) {
                                    SelPhones = SelPhones + itemPhone + '、';
                                }
                                if (!SelPayerNames.indexOf(itemName) > -1) {
                                    SelPayerNames = SelPayerNames + itemName + '、';
                                }
                            }
                        }

                        HDialog.Close(SelPhones + '|' + SelPayerNames);
                    }
                }
            ];

            function LoadCustList() {
                $("#TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataPostControl.aspx',
                    method: "post",
                    nowrap: false,
                    pageSize: 100,
                    pageList: [100, 150, 300],
                    columns: column,
                    //height: 250,
                    toolbar: toolbar,
                    fitColumns: false,
                    rownumbers: true,
                    remoteSort: true,
                    singleSelect: true,
                    selectOnCheck: false,
                    checkOnSelect: false,
                    pagination: true,
                    border: false,
                    width: "100%",
                    sortOrder: "asc",
                    onBeforeLoad: function (param) {
                        param = $.JQForm.GetParam("IncidentCallCenter", "CustSearch", "TableContainer", param);
                    },
                    onLoadSuccess: function (data) {
                        $('#SearchDlg').dialog('close');
                    }
                });
            }
            LoadCustList();

            function formatBr(len, value) {
                var slengh = value.length;
                var restr = "";
                var flag = true;
                for (var i = 1; i <= 100; i++) {
                    len2 = i * len;
                    if (slengh >= len2) {
                        flag = false;
                        restr += value.substring(len2 - len, len2) + "</br>"
                    } else {
                        break;
                    }
                }
                if (flag) {
                    restr += value;
                } else {
                    if (len2 - len <= value.length - 1) {
                        restr += value.substring(len2 - len, value.length)
                    }
                }
                return restr;
            }

        </script>
    </form>
</body>
</html>
