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

<!DOCTYPE html>
<html>
<head>
    <title></title>

    <script type="text/javascript" src="../jscript/jquery-1.11.3.min.js"></script>
    <script src="../jscript/jquery.tool.new.js" type="text/javascript"></script>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
    <script src="../jscript/format.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" />
    <script type="text/javascript" src="../Jscript-Ui/JQForm/JQForm.js"></script>
    <script src="../jscript/jquery.tool.new.js" type="text/javascript"></script>
    <script type="text/javascript" src="../jscript/export.js"></script>
    <script type="text/javascript" src="../jscript/DatePicker/WdatePicker.js"></script>



    <script language="javascript" type="text/javascript">

        function Win_OnLoad() {
            var strPrintParms = getObject("PrintParms").value;
            if (strPrintParms != "") {
                showOperatWin(strPrintParms);

                getObject("PrintParms").value = "";
            }
        }

    </script>
</head>
<body scroll="no">
    <form id="NewFeesDueCutSearch" runat="server">

        <input id="BuildSNums" type="hidden" name="BuildSNums" runat="server" />

        <input id="hiRoomSigns" type="hidden" name="hiRoomSigns" runat="server" />
        <input id="RoomIDs" type="hidden" name="RoomIDs" runat="server" />

        <input id="RegionSNums" type="hidden" name="RegionSNums" runat="server" />
        <input id="hiRegionNames" type="hidden" name="hiRegionNames" runat="server" />

        <input id="CustID" type="hidden" name="CustID" runat="server" />
        <input id="hiCustName" type="hidden" name="hiCustName" runat="server" />
        <input id="RoomID" type="hidden" name="RoomID" runat="server" />
        <input id="hiRoomSign" type="hidden" name="hiRoomSign" runat="server" />

        <input id="RoomStates" type="hidden" name="RoomStates" runat="server" />
        <input id="hiRoomStateNames" type="hidden" name="hiRoomStateNames" runat="server" />

        <input id="CarparkIDs" type="hidden" name="CarparkIDs" runat="server" />
        <input id="hiCarparkNames" type="hidden" name="hiCarparkNames" runat="server" />

        <input id="ParkIDs" type="hidden" name="ParkIDs" runat="server" />
        <input id="hiParkNames" type="hidden" name="hiParkNames" runat="server" />

        <input id="CostIDs" type="hidden" name="CostIDs" runat="server" />
        <input id="hiCostNames" type="hidden" name="hiCostNames" runat="server" />

        <input id="StanIDs" type="hidden" name="StanIDs" runat="server" />
        <input id="hiStanNames" type="hidden" name="hiStanNames" runat="server" />

        <input id="hiCommID" type="hidden" name="hiCommID" runat="server" />
        <input id="hiLoginUserCode" type="hidden" name="hiLoginUserCode" runat="server" />
        <input id="hiIsSQLData" type="hidden" name="hiIsSQLData" runat="server" />

        <input id="hiLoadFeesPaid" type="hidden" name="hiLoadFeesPaid" runat="server" />
        <input id="hiLoadFeesPaidPrec" type="hidden" name="hiLoadFeesPaidPrec" runat="server" />
        <input id="hiLoadFeesPaidLt" type="hidden" name="hiLoadFeesPaidLt" runat="server" />
        <input id="IsDetail" type="hidden" name="IsDetail" runat="server" />
        <input id="hiDetailType" type="hidden" name="hiDetailType" runat="server" />
        <input id="hiStatID" type="hidden" name="hiStatID" runat="server" />
        <input id="ApplicationPath" type="hidden" name="ApplicationPath" runat="server" />
        <input id="hiIsPrec" type="hidden" value="1" name="hiIsPrec" runat="server">
        <input id="PageIndex" type="hidden" name="PageIndex" runat="server" />
        <input id="PrintParms" type="hidden" name="PrintParms" runat="server" />
        <input id="CostGeneType" type="hidden" name="CostGeneType" runat="server" />
        <input id="OptCode" type="hidden" name="OptCode" runat="server" />
        <input id="Flag" type="hidden" name="Flag" runat="server">
        <input id="SelectBuild" type="hidden" name="SelectBuild" runat="server">

        <div style="width: 100%; background-color: #cccccc;" id="TableContainer"></div>

        <div id="SearchDlg" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 800px; height: 300px; padding: 10px;">
            <table class="DialogTable" id="SearchTable">
                <tr>
                    <td class="TdTitle">费用期间从</td>
                    <td class="TdContentSearch">
                        <input type="text" class="Wdate" style="width: 163px;" id="EditBeginDate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" runat="server" name="EditBeginDate" /></td>
                    <td class="TdTitle">到</td>
                    <td class="TdContentSearch">
                        <input type="text" runat="server" style="width: 163px;" class="Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" id="EditEndDate" name="EditEndDate" /></td>
                </tr>
                <tr>
                    <td class="TdTitle">收款时间从</td>
                    <td class="TdContentSearch">
                        <input type="text" class="Wdate" style="width: 163px;" onclick="WdatePicker({ startDate: '%y-%M-01 00:00:00', dateFmt: 'yyyy-MM-dd HH:mm:ss', alwaysUseStartDate: true })" id="ChargeBeginDate" runat="server" name="ChargeBeginDate" /></td>
                    <td class="TdTitle">到</td>
                    <td class="TdContentSearch">
                        <input type="text" class="Wdate" style="width: 163px;" runat="server" onclick="WdatePicker({ startDate: '%y-%M-01 23:59:59', dateFmt: 'yyyy-MM-dd HH:mm:ss', alwaysUseStartDate: true })" id="ChargeEndDate" name="ChargeEndDate" /></td>
                </tr>
                <tr>
                    <td class="TdTitle">楼宇</td>
                    <td class="TdContentSearch">
                        <input id="BuildNames" class="easyui-searchbox" searcher="SelBuild" data-options="editable:false"
                            name="BuildNames" runat="server" /></td>
                    <td class="TdTitle">组团区域</td>
                    <td class="TdContentSearch">
                        <input id="RegionNames" class="easyui-searchbox" searcher="SelRegion" data-options="editable:false"
                            name="RegionNames" runat="server" /></td>
                </tr>
                <tr>
                    <td class="TdTitle">客户类别</td>
                    <td class="TdContentSearch">
                        <select id="CustTypeID" class="easyui-combobox" name="CustTypeID" runat="server">
                            <option selected></option>
                        </select></td>

                    <td style="display: none;" class="TdTitle">收费类型</td>
                    <td style="display: none;" class="TdContentSearch">
                        <select id="ChargeTypeID" class="easyui-combobox" name="ChargeTypeID" runat="server">
                            <option selected></option>
                        </select></td>
                </tr>

                <tr style="display: none;">
                    <td class="TdTitle">交房状态</td>
                    <td class="TdContentSearch">
                        <input id="RoomStateNames" class="easyui-searchbox" searcher="SelRoomState"
                            name="RoomStateNames" runat="server" />
                    </td>
                    <td class="TdTitle">统计范围</td>
                    <td class="TdContentSearch">
                        <select id="ListType" class="easyui-combobox" name="ListType" runat="server">
                            <option value="0" selected>费用项目</option>
                            <option value="1">收费标准</option>
                        </select></td>
                </tr>
                <tr>
                    <td class="TdTitle">费用项目</td>
                    <td class="TdContentSearch">
                        <input id="CostNames" class="easyui-searchbox" data-options="editable:false" searcher="SelCost"
                            name="CostNames" runat="server" /></td>
                    <td style="display: none;" class="TdTitle">收费标准</td>
                    <td style="display: none;" class="TdContentSearch">
                        <input id="StanNames" class="easyui-searchbox" data-options="editable:false" searcher="SelStan"
                            name="StanNames" runat="server" />
                    </td>
                </tr>
                <tr style="display: none;">
                    <td class="TdTitle">车位区域</td>
                    <td class="TdContentSearch">
                        <input id="CarparkNames" class="easyui-searchbox" data-options="editable:false" searcher="SelCarpark"
                            name="CarparkNames" runat="server" />
                    </td>
                    <td class="TdTitle">车位</td>
                    <td class="TdContentSearch">
                        <input id="ParkNames" class="easyui-searchbox" data-options="editable:false" searcher="SelPark"
                            name="ParkNames" runat="server" />
                    </td>
                </tr>
                <tr style="display: none;">

                    <td class="TdTitle">预收是否计入</td>
                    <td class="TdContentSearch">
                        <input type="checkbox" id="IsPrec" name="IsPrec" />
                    </td>
                    <td class="TdTitle">数据挖掘</td>
                    <td class="TdContentSearch">
                        <input type="checkbox" id="CkIsDetail" name="CkIsDetail" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick=" JavaScript:ExcuteOnServer(); ">统计</a></td>
                </tr>
            </table>
        </div>

        <div id="DlgDetail" class="easyui-dialog" title="收费率明细" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 1024px; height: 500px; padding: 10px;">
            <div id='tb'>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="ToExcel();">Excel导出</a>
            </div>
            <div style="width: 90%; background-color: #cccccc;" id="TableContainerDetail"></div>
        </div>
        <div id="DlgMemo" class="easyui-dialog" title="备注" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 750px; height: 440px; padding: 10px;">
            <table cellpadding="0" cellspacing="0" border="0" width="100%" style='color: red; font-size: 14px;'>
                <tr>
                    <td rowspan="4" width="40px" valign="top" style='color: red; font-size: 14px;'>备注：<br />
                        1、用于统计某一期间收费率的达成情况；<br />
                        2、年初往年欠费：收款时间截止上年12月31日、费用时间截止上年12月31日的欠费金额；<br />
                        3、	期初往年欠费：收款时间截止所选费用开始时间、费用时间截止上年12月31日的欠费金额；<br />
                        4、期初本年前期欠费：收款时间截止所选费用开始时间、费用时间1月1号至所选费用开始时间的欠费金额；<br />
                        5、期初欠费小计：	期初往年欠费、本年前期欠费的合计金额；<br />
                        6、	本期应收：所选费用时间段内的应收金额；<br />
                        7、全部应收小计：期初往年欠费、本年前期欠费、本期应收的合计金额；<br />
                        8、	本期实收往年：所选收款时间段内收取的、费用时间截止上年12月31日的欠费金额；<br />
                        9、	本期实收本年前期：所选收款时间段内收取的、费用时间1月1号至所选费用开始时间的欠费金额；<br />
                        10、前期实收本期：收款时间截止所选收款开始时间之前收取的、所选费用期间段内的费用金额；<br />
                        11、本期实收本期：所选收款时间段内收取的、所选费用期间段内的费用金额；<br />
                        12、本期实收后期：所选收款时间段内收取的、所选费用结束时间之后的费用金额；<br />
                        13、本期实收小计：本期实收往年、本期实收本年前期、本期实收本期、本期实收后期的合计金额；<br />
                        14、本期冲抵往年：所选收款时间段内预交冲抵的、费用时间截止上年12月31日的欠费金额；<br />
                        15、本期冲抵本年前期：所选收款时间段内预交冲抵的、费用时间1月1日至所选费用开始时间的欠费金额；<br />
                        16、前期冲抵本期：截止所选收款开始时间之前预交冲抵的、所选费用期间段内的费用金额；<br />
                        17、本期冲抵本期：所选收款时间段内预交冲抵的、所选费用期间段内的费用金额；<br />
                        18、本期冲抵后期：所选收款时间段内预交冲抵的、所选费用结束时间之后的费用金额；<br />
                        19、本期冲抵小计：本期冲抵往年、本期冲抵本年前期、本期冲抵本期、本期冲抵后期的合计金额；<br />
                        20、本年前期减免往年：本年1月1日至所选收款开始时间段内减免冲销的、费用时间截止上年12月31日的欠费金额；<br />
                        21、本期减免往年：所选收款时间段内减免冲销的、费用时间截止上年12月31日的欠费金额；<br />
                        22、本期减免本年前期：所选收款时间段内减免冲销的、费用时间1月1日至所选费用开始时间的欠费金额；<br />
                        23、前期减免本期：截止所选收款开始时间之前减免冲销的、所选费用期间段内的费用金额；<br />
                        24、本期减免本期：所选收款时间段内减免冲销的、所选费用期间段的费用金额；<br />
                        25、本期减免后期：所选收款时间段内减免冲销的、所选费用结束时间之后的费用金额；<br />
                        26、本期减免小计：本期减免往年、本期减免本年前期、本期减免本期、本期减免后期的合计金额；<br />
                        27、期末往年欠费：收款时间截止所选收款结束时间、费用时间截止上年12月31日的欠费金额；<br />
                        28、期末本年前期欠费：收款时间截止所选收款结束时间、费用时间1月1号至所选费用开始时间的欠费金额；<br />
                        29、期末本期欠费：收款时间截止所选收款结束时间、所选费用期间段内的欠费金额；<br />
                        30、期末欠费小计：期末往年欠费、期末本年前期欠费、期末本期欠费的合计金额；<br />
                        31、往年欠费回收率=(本期实收往年 + 本期冲抵往年) / (年初往年欠费-本年前期减免往年- 本期减免往年) * 100 %；<br />
                        32、本年前期欠费回收率= (本期实收本年前期 + 本期冲抵本年前期) / (本年前期欠费  - 本期减免本年前期) * 100%；<br />
                        33、本月收缴率=(前期实收本期 + 本期实收本期+前期冲抵本期+本期冲抵本期) / (本期应收 -前期减免本期 - 本期减免本期) * 100%；<br />
                        34、本年累计收缴率=（截止收款结束时间收取和预交冲抵的、本年1月1日至费用结束时间的费用金额）/（本年1月1日至费用结束时间的应收金额-截止收款结束时间减免冲销的、本年1月1日至费用结束时间的费用金额）*100%；<br />
                        35、本年应收及往年欠费收缴率=（本年1月1日至收款结束时间收取和预交冲抵的往年欠费金额+截止收款结束时间收取和预交冲抵的、本年1月1日至费用结束时间的费用金额）/（年初往年欠费金额+本年1月1日至费用结束时间的应收金额-本年1月1日至收款结束时间减免冲销的往年欠费金额-截止收款结束时间减免冲销的、本年1月1日至费用结束时间的费用金额）*100%。

                    </td>

                </tr>
            </table>
        </div>


        <div class="datagrid-mask" style="height: 100%; width: 100%;"></div>
        <div class="datagrid-mask-msg" style='font-size: 12px; height: 55px; border: 1px solid #cccccc; z-index: 999999;'>
            <div id='DivProgressBar' class='easyui-progressbar' style='width: 200px; border: 1px solid #cccccc; margin-top: 10px;'></div>
            <div id='DivMsg' style='width: 200px; text-align: center; margin-top: 5px;'></div>
        </div>

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

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

                $("#TableContainerDetail").css("height", "440px");

                var travelExpenseFrame = document.getElementById("pag");
            }

            InitTableHeight();

            var column = [
                [
                    { colspan: 1, title: '年初欠费' },
                    { colspan: 3, title: '期初欠费' },
                    { colspan: 2, title: '应收费用' },
                    { colspan: 6, title: '实收费用' },
                    { colspan: 6, title: '预存冲抵' },
                    { colspan: 7, title: '减免冲抵' },
                    { colspan: 4, title: '期末欠费' },
                    { colspan: 5, title: '收缴率' }
                ], [
                    {
                        field: '年初往年欠费', title: '往年欠费<br>（1）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {
                            if (row.StatType == 0 || row.StatType == 1) {
                                //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'年初往年欠费');\">" + value + "</a>";
                                return formatNumberRgx(value);
                            }
                            else {
                                return formatNumberRgx(value);
                            }
                            //return value;
                        }
                    },
                    {
                        field: '期初往年欠费', title: '往年欠费<br>（2）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'期初往年欠费');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '期初本年前期欠费', title: '本年前期欠费<br>（3）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'期初本年前期欠费');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '期初欠费小计', title: '期初欠费小计<br>（4=2+3）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'期初本年前期欠费');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期应收', title: '本期应收<br>（5）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期应收');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '全部应收小计', title: '全部应收小计<br>（6=4+5）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'全部应收小计');\">" + value + "</a>";
                            return value;
                        }
                    },
                    {
                        field: '本期实收往年', title: '本期实收往年<br>（7）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期实收往年');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期实收本年前期', title: '本期实收本年前期<br>（8）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期实收本年前期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '前期实收本期', title: '前期实收本期<br>（9）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'前期实收本期');\">" + value + "</a>";
                            return value;
                        }
                    },
                    {
                        field: '本期实收本期', title: '本期实收本期<br>（10）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期实收本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期实收后期', title: '本期实收后期<br>（11）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期实收本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期实收小计', title: '本期实收小计<br>（12=7+8+10+11）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期实收小计');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期冲抵往年', title: '本期冲抵往年<br>（13）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期冲抵往年');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期冲抵本年前期', title: '本期冲抵本年前期<br>（14）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期冲抵本年前期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '前期冲抵本期', title: '前期冲抵本期<br>（15）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'前期冲抵本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期冲抵本期', title: '本期冲抵本期<br>（16）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期冲抵本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期冲抵后期', title: '本期冲抵后期<br>（17）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期冲抵本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期冲抵小计', title: '本期冲抵小计<br>（18=13+14+16+17）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期冲抵小计');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本年前期减免往年', title: '本年前期减免往年<br>（19）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本年前期减免往年');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期减免往年', title: '本期减免往年<br>（20）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期减免往年');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期减免本年前期', title: '本期减免本年前期<br>（21）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期减免本年前期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '前期减免本期', title: '前期减免本期<br>（22）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'前期减免本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期减免本期', title: '本期减免本期<br>（23）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期减免本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期减免后期', title: '本期减免后期<br>（24）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期减免本期');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '本期减免小计', title: '本期减免小计<br>（25=20+21+23+24）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'本期减免小计');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '期末往年欠费', title: '往年欠费<br>（26=2-7-13-20）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'期末往年欠费');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '期末本年前期欠费', title: '本年前期欠费<br>（27=3-8-14-21）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'期末本年前期欠费');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '期末本期欠费', title: '本期欠费<br>（28=5-9-10-15-16-22-23）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'期末本期欠费');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '期末欠费小计', title: '期末欠费小计<br>（29=26+27+28）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {

                            //return "<a href=\"#\" id=\"" + row.StatID + "\" onclick=\"ShowDetail(this.id,'TotalDebtsAmount');\">" + value + "</a>";
                            return formatNumberRgx(value);
                        }
                    },
                    {
                        field: '往年欠费回收率', title: '往年欠费回收率(%)<br>（7+13）/（1-19-20）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {
                            if (value != "") {
                                return value + "%";
                            }
                        }
                    },
                    {
                        field: '本年前期欠费回收率', title: '本年前期欠费回收率(%)<br>（8+14）/（3-21）', align: 'left', sortable: true, width: 160, formatter: function (value, row, index) {
                            if (value != "") {
                                return value + "%";
                            }
                        }
                    },
                    {
                        field: '本月收缴率', title: '本期收缴率(%)<br>（9+10+15+16）/（5-22-23）', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {
                            if (value != "") {
                                return value + "%";
                            }
                        }
                    },
                    {
                        field: '本年累计收缴率', title: '本年累计收缴率(%)', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {
                            if (value != "") {
                                return value + "%";
                            }
                        }
                    },
                    {
                        field: '本年应收及往年欠费收缴率', title: '本年应收及往年欠费收缴率(%)', align: 'left', sortable: true, width: 160, formatter: function (value, row, index) {
                            if (value != "") {
                                return value + "%";
                            }
                        }
                    }
                ]

            ];
            var frozenColumns = [[
                { field: 'BuildName', title: '楼栋', align: 'left', sortable: true, width: 150 },
                { field: 'RegionName', title: '管家姓名', align: 'left', sortable: true, width: 150 },
                { field: 'CostName', title: '费用名称', align: 'left', sortable: true, width: 100 },
                { field: 'SysCostName', title: '费用类型', align: 'left', sortable: true }
            ]];

            var Headcolumn = [[
                { field: 'BuildName', rowspan: 2, title: '楼栋', align: 'left', sortable: true },
                { field: 'RegionName', rowspan: 2, title: '管家姓名', align: 'left', sortable: true },
                { field: 'CostName', rowspan: 2, title: '费用名称', align: 'left', sortable: true, width: 200 },
                { field: 'SysCostName', rowspan: 2, title: '费用类型', align: 'left', sortable: true },
                { colspan: 1, title: '年初欠费' },
                { colspan: 3, title: '期初欠费' },
                { colspan: 2, title: '应收费用' },
                { colspan: 6, title: '实收费用' },
                { colspan: 6, title: '预交冲抵' },
                { colspan: 7, title: '减免冲销' },
                { colspan: 4, title: '期末欠费' },
                { colspan: 5, title: '收缴率' }
            ], [
                {
                    field: '年初往年欠费', title: '往年欠费<br>（1）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期初往年欠费', title: '往年欠费<br>（2）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期初本年前期欠费', title: '本年前期欠费<br>（3）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期初欠费小计', title: '期初欠费小计<br>（4=2+3）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期应收', title: '本期应收<br>（5）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '全部应收小计', title: '全部应收小计<br>（6=4+5）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收往年', title: '本期实收往年<br>（7）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收本年前期', title: '本期实收本年前期<br>（8）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '前期实收本期', title: '前期实收本期<br>（9）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收本期', title: '本期实收本期<br>（10）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收后期', title: '本期实收后期<br>（11）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收小计', title: '本期实收小计<br>（12=7+8+10+11）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵往年', title: '本期冲抵往年<br>（13）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵本年前期', title: '本期冲抵本年前期<br>（14）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '前期冲抵本期', title: '前期冲抵本期<br>（15）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵本期', title: '本期冲抵本期<br>（16）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵后期', title: '本期冲抵后期<br>（17）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵小计', title: '本期冲抵小计<br>（18=13+14+16+17）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年前期减免往年', title: '本年前期减免往年<br>（19）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免往年', title: '本期减免往年<br>（20）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免本年前期', title: '本期减免本年前期<br>（21）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '前期减免本期', title: '前期减免本期<br>（22）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免本期', title: '本期减免本期<br>（23）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免后期', title: '本期减免后期<br>（24）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免小计', title: '本期减免小计<br>（25=20+21+23+24）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末往年欠费', title: '往年欠费<br>（26=2-7-13-20）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末本年前期欠费', title: '本年前期欠费<br>（27=3-8-14-21）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末本期欠费', title: '本期欠费<br>（28=5-9-10-15-16-22-23）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末欠费小计', title: '期末欠费小计<br>（29=26+27+28）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '往年欠费回收率', title: '往年欠费回收率(%)<br>（7+13）/（1-19-20）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年前期欠费回收率', title: '本年前期欠费回收率(%)<br>（8+14）/（3-21）', align: 'left', sortable: true, width: 160
                },
                {
                    field: '本月收缴率', title: '本期收缴率(%)<br>（9+10+15+16）/（5-22-23）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年累计收缴率', title: '本年累计收缴率(%)', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年应收及往年欠费收缴率', title: '本年应收及往年欠费收缴率(%)', align: 'left', sortable: true, width: 160
                }
            ]];

            var ExcelCol = [
                { field: 'BuildName', title: '楼栋', align: 'left', sortable: true },
                { field: 'RegionName', title: '管家姓名', align: 'left', sortable: true },
                { field: 'CostName', title: '费用名称', align: 'left', sortable: true, width: 200 },
                { field: 'SysCostName', title: '费用类型', align: 'left', sortable: true },

                {
                    field: '年初往年欠费', title: '往年欠费<br>（1）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期初往年欠费', title: '往年欠费<br>（2）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期初本年前期欠费', title: '本年前期欠费<br>（3）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期初欠费小计', title: '期初欠费小计<br>（4=2+3）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期应收', title: '本期应收<br>（5）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '全部应收小计', title: '全部应收小计<br>（6=4+5）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收往年', title: '本期实收往年<br>（7）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收本年前期', title: '本期实收本年前期<br>（8）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '前期实收本期', title: '前期实收本期<br>（9）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收本期', title: '本期实收本期<br>（10）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收后期', title: '本期实收后期<br>（11）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期实收小计', title: '本期实收小计<br>（12=7+8+10+11）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵往年', title: '本期冲抵往年<br>（13）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵本年前期', title: '本期冲抵本年前期<br>（14）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '前期冲抵本期', title: '前期冲抵本期<br>（15）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵本期', title: '本期冲抵本期<br>（16）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵后期', title: '本期冲抵后期<br>（17）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期冲抵小计', title: '本期冲抵小计<br>（18=13+14+16+17）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年前期减免往年', title: '本年前期减免往年<br>（19）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免往年', title: '本期减免往年<br>（20）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免本年前期', title: '本期减免本年前期<br>（21）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '前期减免本期', title: '前期减免本期<br>（22）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免本期', title: '本期减免本期<br>（23）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免后期', title: '本期减免后期<br>（24）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本期减免小计', title: '本期减免小计<br>（25=20+21+23+24）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末往年欠费', title: '往年欠费<br>（26=2-7-13-20）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末本年前期欠费', title: '本年前期欠费<br>（27=3-8-14-21）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末本期欠费', title: '本期欠费<br>（28=5-9-10-15-16-22-23）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '期末欠费小计', title: '期末欠费小计<br>（29=26+27+28）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '往年欠费回收率', title: '往年欠费回收率(%)<br>（7+13）/（1-19-20）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年前期欠费回收率', title: '本年前期欠费回收率(%)<br>（8+14）/（3-21）', align: 'left', sortable: true, width: 160
                },
                {
                    field: '本月收缴率', title: '本期收缴率(%)<br>（9+10+15+16）/（5-22-23）', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年累计收缴率', title: '本年累计收缴率(%)', align: 'left', sortable: true, width: 100
                },
                {
                    field: '本年应收及往年欠费收缴率', title: '本年应收及往年欠费收缴率(%)', align: 'left', sortable: true, width: 160
                }
            ];

            var columnDetail = [[
                { field: 'CustName', title: '客户名称', align: 'left', sortable: true, width: 100 },
                { field: 'RoomSign', title: '房屋编号', align: 'left', sortable: true, width: 100 },
                { field: 'CostName', title: '费用名称', align: 'left', sortable: true, width: 100 },
                { field: 'ParkName', title: '车位编号', align: 'left', sortable: true, width: 100 },
                { field: 'FeeDueYearMonth', title: '费用日期', align: 'left', sortable: true, width: 100 },
                {
                    field: 'AccountsDueDate', title: '应收日期', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {
                        var str = row.AccountsDueDate.ToCustomizeDate();
                        return str;
                    }
                },
                {
                    field: 'FeesStateDate', title: '开始日期', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {
                        var str = row.FeesStateDate.ToCustomizeDate();
                        return str;
                    }
                },
                {
                    field: 'FeesEndDate', title: '结束日期', align: 'left', sortable: true, width: 100, formatter: function (value, row, index) {
                        var str = row.FeesEndDate.ToCustomizeDate();
                        return str;
                    }
                },
                { field: 'FeesAmount', title: '金额', align: 'left', sortable: true, width: 100 },
                { field: 'DueAmount', title: '应收金额', align: 'left', sortable: true, width: 100 },
                { field: 'PaidAmount', title: '实收金额', align: 'left', sortable: true, width: 100 },
                { field: 'PrecAmount', title: '预存冲抵', align: 'left', sortable: true, width: 100 },
                { field: 'WaivAmount', title: '减免冲销', align: 'left', sortable: true, width: 100 },
                { field: 'RefundAmount', title: '退款金额', align: 'left', sortable: true, width: 100 },
                { field: 'ExpenseAmount', title: '付款金额', align: 'left', sortable: true, width: 100 },
                { field: 'OptDate', title: '操作时间', align: 'left', sortable: true, width: 100 },
                { field: 'IsCommisionName', title: '是否佣金', align: 'left', sortable: true, width: 100 }

            ]]

            function SearchDlg() {
                btnClear_OnClick();
                $('#SearchDlg').parent().appendTo($("form:first"))
                $('#SearchDlg').dialog('open');
            }

            function SearchDlg2() {
                $('#DlgMemo').parent().appendTo($("form:first"))
                $('#DlgMemo').dialog('open');
            }

            function setIsSQLData() {
                document.getElementById('hiIsSQLData').value = 1;

                var isCheck = document.getElementById('CkIsDetail').checked;
                if (isCheck) {
                    document.getElementById('IsDetail').value = "1";
                }
                else {
                    document.getElementById('IsDetail').value = "0";
                }

                var vIsPrec = document.getElementById('IsPrec').checked;
                if (vIsPrec) {
                    document.getElementById('hiIsPrec').value = "1";
                }
                else {
                    document.getElementById('hiIsPrec').value = "0";
                }
            }

            function ShowDetail(sStatID, DetailType) {
                document.getElementById('hiStatID').value = sStatID;
                document.getElementById('hiDetailType').value = DetailType;

                $("#TableContainerDetail").datagrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=FeesChargeRateHouseKeeper&Command=LoadDataDetail&' + $("#NewFeesDueCutSearch").serialize(),
                    method: "get",
                    loadMsg: '数据加载中,请稍候...',
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    columns: columnDetail,
                    fitColumns: false,
                    singleSelect: true,
                    rownumbers: true,
                    pagination: true,
                    border: false,
                    width: "100%",
                    toolbar: '#tb',
                    sortOrder: "asc"
                });

                $('#DlgDetail').parent().appendTo($("form:first"))
                $('#DlgDetail').dialog('open');
            }

            var beforeLoad = function (param) {

                if (document.getElementById('hiIsSQLData').value != "-1") {
                    var h = parseInt($(window).height()) + parseInt($(window).scrollTop());
                    var ht = parseInt($(window).scrollTop());
                    $(".datagrid-mask").css({ display: "block", width: "100%", height: h });
                    $(".datagrid-mask-msg").css({ display: "block", left: ($(document.body).outerWidth(true) - 350) / 2, top: ht + 240 });
                    $('#divtime').html("正在查询中,请等待，耗时: 0秒");
                }

                $("select").each(function () {

                    var key = $(this).attr("id");
                    if (key != "") {
                        if (!param[key]) {
                            param[key] = $(this).val();
                        }
                    }
                });

                $("input").each(function () {

                    var key = $(this).attr("id");
                    if (key != "") {
                        if (!param[key]) {
                            param[key] = $(this).val();
                        }
                    }
                });
                var gridOpts = $('#TableContainer').datagrid('getPager').data("pagination").options;

                param.page = gridOpts.pageNumber;
                param.rows = gridOpts.pageSize;
            };

            var intervalProcess;

            var toolbar = [
                {
                    text: '筛选',
                    iconCls: 'icon-search',
                    handler: function () {
                        $('#SearchDlg').parent().appendTo($("form:first"))
                        $('#SearchDlg').dialog('open');
                    }
                }, '-',
                {
                    text: '导出Excel',
                    iconCls: 'icon-page_white_excel',
                    handler: function () {
                        var rowData = $('#TableContainer').datagrid('getData');
                        if (rowData == '') {
                            HDialog.Info('请先生成报表');
                        }
                        else {
                            Export('收费率报表Excel', $('#TableContainer'));
                        }
                    }
                }, '-',
                {
                    text: '备注',
                    iconCls: 'icon-help',
                    handler: function () {
                        SearchDlg2();
                    }
                }
            ];

            function ChangeToTable3(printDatagrid, HeadcolumnsList, columnsList) {
                var tableString = '<table cellspacing="0" class="pb">';
                var frozenColumns = undefined;  // 得到frozenColumns对象
                var columns = HeadcolumnsList; //printDatagrid.datagrid("options").columns;    // 得到columns对象
                var nameList = columnsList;


                // 载入title
                if (typeof columns != 'undefined' && columns != '') {
                    $(columns).each(function (index) {
                        tableString += '\n<tr>';
                        if (typeof frozenColumns != 'undefined' && typeof frozenColumns[index] != 'undefined') {
                            for (var i = 0; i < frozenColumns[index].length; ++i) {
                                if (!frozenColumns[index][i].hidden) {
                                    tableString += '\n<th width="' + frozenColumns[index][i].width + '"';
                                    if (typeof frozenColumns[index][i].rowspan != 'undefined' && frozenColumns[index][i].rowspan > 1) {
                                        tableString += ' rowspan="' + frozenColumns[index][i].rowspan + '"';
                                    }
                                    if (typeof frozenColumns[index][i].colspan != 'undefined' && frozenColumns[index][i].colspan > 1) {
                                        tableString += ' colspan="' + frozenColumns[index][i].colspan + '"';
                                    }
                                    tableString += '>' + frozenColumns[0][i].title + '</th>';
                                }
                            }
                        }
                        for (var i = 0; i < columns[index].length; ++i) {
                            if (!columns[index][i].hidden) {
                                tableString += '\n<th width="' + columns[index][i].width + '"';
                                if (typeof columns[index][i].rowspan != 'undefined' && columns[index][i].rowspan > 1) {
                                    tableString += ' rowspan="' + columns[index][i].rowspan + '"';
                                }
                                if (typeof columns[index][i].colspan != 'undefined' && columns[index][i].colspan > 1) {
                                    tableString += ' colspan="' + columns[index][i].colspan + '"';
                                }
                                tableString += '>' + columns[index][i].title + '</th>';
                            }
                        }
                        tableString += '\n</tr>';
                    });
                }
                // 载入内容
                var rows = printDatagrid.datagrid("getRows"); // 这段代码是获取当前页的所有行
                for (var i = 0; i < rows.length; i++) {
                    tableString += '\n<tr>';
                    for (var j = 0; j < nameList.length; j++) {


                        tableString += '\n<td';
                        if (nameList[j].align != 'undefined' && nameList[j].align != '') {
                            tableString += ' style="text-align:' + nameList[j].align + ';"';
                        }
                        tableString += '>';
                        var FiledName = nameList[j].field;
                        if (FiledName == "SysCostName") {
                            if (rows[i].SysCostName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        }
                        else if (FiledName == "BuildName") {
                            if (rows[i].CostName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        }
                        else if (FiledName == "RegionName") {
                            if (rows[i].CostName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        }
                        else if (FiledName == "CostName") {
                            if (rows[i].CostName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        } else if (FiledName == "年初往年欠费") {
                            if (rows[i].年初往年欠费 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "期初往年欠费") {
                            if (rows[i].期初往年欠费 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "期初本年前期欠费") {
                            if (rows[i].期初本年前期欠费 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "期初欠费小计") {
                            if (rows[i].期初欠费小计 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期应收") {
                            if (rows[i].本期应收 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "全部应收小计") {
                            if (rows[i].全部应收小计 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期实收往年") {
                            if (rows[i].本期实收往年 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期实收本年前期") {
                            if (rows[i].本期实收本年前期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "前期实收本期") {
                            if (rows[i].前期实收本期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期实收本期") {
                            if (rows[i].本期实收本期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期实收后期") {
                            if (rows[i].本期实收后期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期实收小计") {
                            if (rows[i].本期实收小计 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期冲抵往年") {
                            if (rows[i].本期冲抵往年 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期冲抵本年前期") {
                            if (rows[i].本期冲抵本年前期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "前期冲抵本期") {
                            if (rows[i].前期冲抵本期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期冲抵本期") {
                            if (rows[i].本期冲抵本期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期冲抵后期") {
                            if (rows[i].本期冲抵后期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期冲抵小计") {
                            if (rows[i].本期冲抵小计 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本年前期减免往年") {
                            if (rows[i].本年前期减免往年 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期减免往年") {
                            if (rows[i].本期减免往年 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期减免本年前期") {
                            if (rows[i].本期减免本年前期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "前期减免本期") {
                            if (rows[i].前期减免本期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期减免本期") {
                            if (rows[i].本期减免本期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期减免后期") {
                            if (rows[i].本期减免后期 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "本期减免小计") {
                            if (rows[i].本期减免小计 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "期末往年欠费") {
                            if (rows[i].期末往年欠费 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "期末本年前期欠费") {
                            if (rows[i].期末本年前期欠费 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "期末本期欠费") {
                            if (rows[i].期末本期欠费 != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "TotalDebtsAmount") {
                            if (rows[i].TotalDebtsAmount != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } else tableString += "";
                        } else if (FiledName == "往年欠费回收率") {
                            if (rows[i].往年欠费回收率 != "") {
                                tableString += ('' + rows[i][FiledName] + '%');
                            } else tableString += "";
                        } else if (FiledName == "本年前期欠费回收率") {
                            if (rows[i].本年前期欠费回收率 != "") {
                                tableString += ('' + rows[i][FiledName] + '%');
                            } else tableString += "";
                        } else if (FiledName == "本月收缴率") {
                            if (rows[i].本月收缴率 != "") {
                                tableString += ('' + rows[i][FiledName] + '%');
                            } else tableString += "";
                        } else if (FiledName == "本年累计收缴率") {
                            if (rows[i].本年累计收缴率 != "") {
                                tableString += ('' + rows[i][FiledName] + '%');
                            } else tableString += "";
                        } else if (FiledName == "本年应收及往年欠费收缴率") {
                            if (rows[i].本年应收及往年欠费收缴率 != "") {
                                tableString += ('' + rows[i][FiledName] + '%');
                            } else tableString += "";
                        }
                        tableString += '</td>';
                    }
                    tableString += '\n</tr>';
                }
                tableString += '\n</table>';
                return tableString;
            }

            function Export(strXlsName, exportGrid) {
                var f = $('<form action="../export.aspx" method="post" id="fm1"></form>');
                var i = $('<input type="hidden" id="txtContent" name="txtContent" />');
                var l = $('<input type="hidden" id="txtName" name="txtName" />');
                i.val(ChangeToTable3(exportGrid, Headcolumn, ExcelCol));
                i.appendTo(f);
                l.val(strXlsName);
                l.appendTo(f);
                f.appendTo(document.body).submit();
                document.body.removeChild(f);
            }

        </script>

        <script type="text/javascript">
            var ProgressInterval;

            function ExcuteOnServer() {
                document.getElementById('hiIsSQLData').value = "1";

                var isCheck = document.getElementById('CkIsDetail').checked;

                if (isCheck) {
                    document.getElementById('IsDetail').value = "1";
                }
                else {
                    document.getElementById('IsDetail').value = "0";
                }

                var vIsPrec = document.getElementById('IsPrec').checked;

                if (vIsPrec) {
                    document.getElementById('hiIsPrec').value = "1";
                }
                else {
                    document.getElementById('hiIsPrec').value = "0";
                }

                $("#SearchDlg").dialog("close");
                //启动任务
                StartTask();
                //展示进度
                ShowProgress();
                //获取执行情况进度
                ProgressInterval = setInterval("TakeProgress()", 1000);

                //LoadList(1, 50);
                //$('#SearchDlg').dialog('close');
                btnClear_OnClick();
            }

            function StartTask() {
                //启动一个任务
                $.tool.DataPostNoLoading('FeesChargeRateHouseKeeper', 'StartTask', $('#NewFeesDueCutSearch').serialize(),
                    function Init() {
                    },
                    function callback(_Data) {
                    },
                    function completeCallback() {
                    },
                    function errorCallback() {
                    });
            }

            function LoadList(page, rows) {


                $("#TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataPostControl.aspx',
                    method: "post",
                    title: '',
                    nowrap: false,
                    pageSize: 100,
                    pageList: [100, 200, 300],
                    columns: column,
                    frozenColumns: frozenColumns,
                    fitColumns: false,
                    remoteSort: false,
                    pagination: true,
                    width: "100%",
                    toolbar: toolbar,
                    sortOrder: "asc",
                    singleSelect: true,
                    selectOnCheck: false,
                    checkOnSelect: false,
                    rownumbers: true,
                    border: false,
                    sortOrder: "asc",
                    onBeforeLoad: function (param) {
                        param = $.JQForm.GetParam("FeesChargeRateHouseKeeper", "LoadData", "TableContainer", param);
                    },
                    onLoadSuccess: function (data) {

                    },
                    rowStyler: function (index, row) {
                        if (row.StatType == 1) {
                            return 'color:red;';
                        }
                    }
                });

            }

            LoadList(1, 50);

            //获取进度
            function TakeProgress() {
                $.tool.DataPostNoLoading('FeesChargeRateHouseKeeper', 'TakeProgress', $('#NewFeesDueCutSearch').serialize(),
                    function Init() {
                    },
                    function callback(_Data) {
                        var Obj = JSON.parse(_Data);
                        if (_Data == '[]') {

                            LoadList(1, 50);
                            CloseProgress();
                        }
                        else {
                            SetProgress(Obj);

                            if (Obj[0].Curr == '100') {
                                $('#hiIsSQLData').val('1');
                                LoadList(1, 50);
                                CloseProgress();
                            }
                            else {
                            }
                        }
                    },
                    function completeCallback() {
                    },
                    function errorCallback() {
                    });
            }

            //显示进度
            function ShowProgress() {
                var h = parseInt($(window).height()) + parseInt($(window).scrollTop());
                var ht = parseInt($(window).scrollTop());
                $(".datagrid-mask").css({ display: "block", width: "100%", height: h });
                $(".datagrid-mask-msg").css({ display: "block", left: ($(document.body).outerWidth(true) - 350) / 2, top: ht + 240 });
            }
            //关闭进度
            function CloseProgress() {
                clearInterval(ProgressInterval);
                $(".datagrid-mask").hide();
                $(".datagrid-mask-msg").hide();
            }
            //设置进度
            function SetProgress(Obj) {
                var i = parseInt(Obj[0].Curr);
                $('#DivProgressBar').progressbar('setValue', Obj[0].Curr);
                $('#DivMsg').html(Obj[0].MessageInfo);
            }

            function ToExcel() {
                var StatID = document.getElementById('hiStatID').value;
                var DetailType = document.getElementById('hiDetailType').value;
                var hiIsPrec = document.getElementById('hiIsPrec').value;

                window.location.href = "../CorpCostStatistNew/FeesChargeRateDetailCre.aspx?StatID=" + StatID + "&DetailType=" + DetailType + "&hiIsPrec=" + hiIsPrec;
            }

            function SelBuild() {

                HDialog.Open('700', '400', "../dialogNew/NewMultiBuildingDlg.aspx", '楼宇选择', false, function callback(_Data) {
                    if (_Data != "") {//**获得返回 刷新
                        //debugger
                        var DData = JSON.parse(_Data);
                        var BuildNames = "";
                        var BuildSNums = "";
                        if (DData.length > 0) {
                            for (var i = 0; i < DData.length; i++) {
                                BuildNames = BuildNames + "," + DData[i].text;
                                BuildSNums = BuildSNums == "" ? DData[i].attributes.BuildSNum : BuildSNums + ',' + DData[i].attributes.BuildSNum;
                            }
                        }
                        $('#SelectBuild').val(_Data);
                        $('#BuildNames').textbox('setValue', BuildNames.substring(1, BuildNames.length));
                        $("#BuildSNums").val(BuildSNums);
                    }
                });
            }

            function SelRegion() {

                HDialog.Open('700', '400', "../dialogNew/MultiRegionDlg.aspx", '组团选择', false, function callback(_Data) {

                    if (_Data != "") {//**获得返回 刷新
                        var varObjects = _Data.split("|");
                        var RegionSNums = "";
                        var RegionNames = "";

                        $('#RegionSNums').val(RegionSNums);
                        $('#RegionNames').searchbox('setValue', RegionNames);
                        $('#hiRegionNames').val(RegionNames);

                        for (var i = 0; i < varObjects.length; i++) {
                            if (varObjects[i].indexOf(",") > 0) {

                                RegionSNums = RegionSNums + "," + varObjects[i].split(',')[2];
                                RegionNames = RegionNames + "," + varObjects[i].split(',')[1];
                            }

                        }
                        $('#RegionSNums').val(RegionSNums.substring(1, RegionSNums.length));
                        $('#RegionNames').searchbox('setValue', RegionNames.substring(1, RegionNames.length));

                        $('#hiRegionNames').val(RegionNames);

                    }
                });

            }

            function SelCarpark() {

                HDialog.Open('700', '400', "../dialogNew/MultiCarparkDlg.aspx", '车位区域选择', false, function callback(_Data) {


                    if (_Data != "") {//**获得返回 刷新
                        var varObjects = _Data.split("|");

                        var CarparkIDs = "";
                        var CarparkNames = "";
                        $('#CarparkIDs').val(CarparkIDs);
                        $('#CarparkNames').searchbox('setValue', CarparkNames);

                        for (var i = 0; i < varObjects.length; i++) {
                            if (varObjects[i].indexOf(",") > 0) {
                                var d1 = varObjects[i].split(",")[0];
                                var d2 = varObjects[i].split(",")[1];

                                CarparkIDs = CarparkIDs + "," + varObjects[i].split(',')[0];
                                CarparkNames = CarparkNames + "," + varObjects[i].split(',')[1];
                            }

                        }
                        $('#CarparkIDs').val(CarparkIDs.substring(1, CarparkIDs.length));
                        $('#CarparkNames').searchbox('setValue', CarparkNames.substring(1, CarparkNames.length));

                    }
                });

            }

            function SelPark() {

                HDialog.Open('700', '400', "../dialogNew/MultiParkDlg.aspx", '车位选择', false, function callback(_Data) {

                    if (_Data != "") {//**获得返回 刷新                        

                        var data = _Data.split('|');
                        if (data.length > 0) {
                            var ParkIDs = "";
                            var ParkNames = "";

                            for (var i = 0; i < data.length; i++) {
                                if (data[i] != "") {
                                    var obj = JSON.parse(data[i]);
                                    if (obj.ParkID != 0) {
                                        ParkIDs = ParkIDs + "," + obj.ParkID;
                                        ParkNames = ParkNames + ',' + obj.ParkName;
                                    }
                                }
                            }

                            $('#ParkIDs').val(ParkIDs.substring(1, ParkIDs.length));
                            $('#ParkNames').searchbox('setValue', ParkNames.substring(1, ParkNames.length));
                        }
                    }
                });

            }

            function SelCost() {

                HDialog.Open('700', '400', "../dialogNew/MultiCorpCommCostDlg.aspx", '收费项目选择', false, function callback(_Data) {

                    if (_Data != "") {//**获得返回 刷新
                        var varObjects = _Data.split("\t");

                        $('#CostIDs').val(varObjects[0]);
                        $('#CostNames').searchbox('setValue', varObjects[1]);

                    }
                });

                return false;
            }

            function SelStan() {
                var tmpCostIDs = $('#CostIDs').val();

                if (tmpCostIDs == "") {
                    HDialog.Info("请选择费用项目,此项不能为空!");

                    $('#btnSelCost').focus();
                    return false;
                }

                var w = 700;
                var h = 400;

                HDialog.Open('700', '400', "../dialogNew/MultiStanDlg.aspx?CostIDs=" + tmpCostIDs + "&IsShowHis=1" + "&Ram=" + Math.random(), '收费标准选择', false, function callback(_Data) {

                    if (_Data != "") {//**获得返回 刷新
                        var varObjects = _Data.split("\t");

                        $('#StanIDs').val(varObjects[0]);
                        $('#StanNames').searchbox('setValue', varObjects[1]);

                        var varObjects = _Data.split("|");
                        var StanIDs = "";
                        var StanNames = "";

                        $('#StanIDs').val(StanIDs);
                        $('#StanNames').searchbox('setValue', StanNames);

                        for (var i = 0; i < varObjects.length; i++) {
                            if (varObjects[i].indexOf(",") > 0) {
                                var d1 = varObjects[i].split(",")[0];
                                var d2 = varObjects[i].split(",")[1];

                                StanIDs = StanIDs + "," + varObjects[i].split(',')[0];
                                StanNames = StanNames + "," + varObjects[i].split(',')[1];
                            }

                        }
                        $('#StanIDs').val(StanIDs.substring(1, StanIDs.length));
                        $('#StanNames').searchbox('setValue', StanNames.substring(1, StanNames.length));

                    }
                });

                return false;
            }

            function SelRoomState() {

                var strRoomStates = "";

                HDialog.Open('700', '450', "../dialogNew/MultiRoomStateDlg.aspx" + "?RoomStates=" + strRoomStates + "&Ram=" + Math.random(), '房屋状态选择', false, function (_data) {
                    var varReturn = _data;

                    if (varReturn != "") {//**获得返回 刷新
                        var varObjects = varReturn.split("\t");

                        $('#RoomStates').val(varObjects[0]);
                        $('#RoomStateNames').searchbox('setValue', varObjects[1]);
                        $('#hiRoomStateNames').val(varObjects[0]);
                        //var arrRoomStateSNums = varObjects[0].split(',');
                        //$('#RoomStateNum').val(arrRoomStateSNums.length);
                    }

                });
            }

            function btnClear_OnClick() {

                $('#BuildSNums').val('');
                $('#BuildNames').searchbox('setValue', '');
                $('#RegionSNums').val('');
                $('#RegionNames').searchbox('setValue', '');
                $('#hiRegionNames').val('');

                $('#CustTypeID').val('');
                $('#ChargeTypeID').val('');

                $('#CustName').searchbox("setValue", '');
                $('#CustID').val('');
                $('#RoomSign').searchbox("setValue", '');
                $('#RoomID').val('');
                $('#SelectRoomID').combobox({ data: [], valueField: 'RoomID', textField: 'RoomText' });

                //$('#RoomState').val('');
                $('#SearchRange').val('');
                $('#BankName').val('');

                $('#CarparkIDs').val('');
                $('#CarparkNames').searchbox('setValue', '');

                $('#ParkIDs').val('');
                $('#ParkNames').searchbox('setValue', '');

                $('#CostIDs').val('');
                $('#CostNames').searchbox('setValue', '');

                $('#StanIDs').val('');
                $('#StanNames').searchbox('setValue', '');

                $('#RoomStates').val('');
                $('#RoomStateNames').searchbox('setValue', '');
                $('#hiRoomStateNames').val('');
                //$('#RoomStateNum').val('');

                $('#IsPrec').val('');
                //$('#IsProperty').val('');

            }

            function formatNumberRgx(num) {
                var parts = num.toString().split(".");
                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                return parts.join(".");
            };
        </script>

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

