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

<!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>

    <style type="text/css">
    #SearchDlg {
        padding: 10px;
        width: 700px;
        height: 230px;
    }

    .SearchTable {
        width: 700px;
        height: auto;
    }

    .SearchTable .TdTitle {
        width: 15%;
    }

    .SearchTable .TdContent {
        width: 35%;
    }

    #CostNames {
        width: 550px;
        height: 30px;
        border: 1px solid #cccccc;
        font-size: 12px;
        padding: 2px;
        resize: none;
    }

    #CommNames {
        width: 550px;
        height: 60px;
        border: 1px solid #cccccc;
        font-size: 12px;
        padding: 2px;
        resize: none;
    }
</style>
</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;" 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" colspan="3">
                        <input class="easyui-searchbox" searcher="SelCost" id="CostNames"
                            name="CostNames" runat="server" /><input id="CorpCostIDs" type="hidden"
                                name="CorpCostIDs" runat="server" /></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="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、本期实收金额：费用时间属于当年1-1到统计结束时间，本期实收-退款费用；<br />
                        3、本年实收金额：费用时间属于统计时间1-1到统计时间12-31,本年实收-退款费用；<br />
                        4、往欠实收金额：费用小于统计时间1-1，往年实收-退款费用；<br />
                        5、预收以后年度金额：费用时间大于统计时间12-31，预收费用；<br />
                        6、预存金额：统计期的预存收款-预存退款；<br />
                        7、合计金额：本年实收金额 + 往欠实收金额 + 预收以后年度金额 + 预存金额；<br />
                        </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");
            }

            InitTableHeight();

            var column = [[
                {
                    field: 'PaidRoomNum', title: '实收户数', align: 'left', sortable: true, width: 120, formatter: function (value, row, index) {

                        return value;
                    }
                },
                {
                    field: 'CurPaidAmount', title: '本期实收金额', align: 'left', sortable: true, width: 120, formatter: function (value, row, index) {
                            
                        return value;
                    }
                },
                {
                    field: 'CurYearPaidAmount', title: '本年实收金额', align: 'left', sortable: true, width: 120, formatter: function (value, row, index) {
                            
                        return value;
                    }
                },
                {
                    field: 'BefPaidAmount', title: '往欠实收金额', align: 'left', sortable: true, width: 120, formatter: function (value, row, index) {

                        return value;
                        //return formatNumberRgx(value);
                    }
                },
                {
                    field: 'AftPrecAmount', title: '预收以后年度金额', align: 'left', sortable: true, width: 120, formatter: function (value, row, index) {

                        return value;
                    }
                },
                {
                    field: 'PrecAmount', title: '预存金额', align: 'left', sortable: true, width: 120, formatter: function (value, row, index) {
                            
                        return value;
                    }
                },
                {
                    field: 'TotalAmount', title: '合计金额', align: 'left', sortable: true, width: 120, formatter: function (value, row, index) {
                            
                        return value;
                    }
                }
            ]];

            var frozenColumns = [[
                { field: 'OrganName', title: '区域名称', rowspan:2, align: 'left', sortable: true, width: 100 },
                { field: 'CommName', title: '项目名称', rowspan: 2, align: 'left', sortable: true, width: 100 },

                { colspan: 2, title: '组团信息'},

                { field: 'CostName', title: '费用名称', rowspan: 2, align: 'left', sortable: true, width: 150 }
            ], [
                    { field: 'HousekeeperName', title: '管家', align: 'left', sortable: true, width: 100 },
                    { field: 'RegionName', title: '组团区域', align: 'left', sortable: true, width: 100 }
                ]
            ];

            var Headcolumn = [[
                { field: 'OrganName', title: '区域名称', rowspan: 2, align: 'left', sortable: true, width: 100 },
                { field: 'CommName', title: '项目名称', rowspan: 2, align: 'left', sortable: true, width: 100 },

                { colspan: 2, title: '组团信息' },

                { field: 'CostName', title: '费用名称', rowspan: 2, align: 'left', sortable: true, width: 100 },

                { field: 'PaidRoomNum', title: '实收户数', rowspan: 2, align: 'left', sortable: true, width: 120 },

                { field: 'CurPaidAmount', title: '本期实收金额', rowspan: 2, align: 'left', sortable: true, width: 120 },
                { field: 'CurYearPaidAmount', title: '本年实收金额', rowspan: 2, align: 'left', sortable: true, width: 120 },
                { field: 'BefPaidAmount', title: '往欠实收金额', rowspan: 2, align: 'left', sortable: true, width: 120 },
                { field: 'AftPrecAmount', title: '预收以后年度金额', rowspan: 2, align: 'left', sortable: true, width: 120 },
                { field: 'PrecAmount', title: '预存金额', rowspan: 2, rowspan: 2, align: 'left', sortable: true, width: 120 },
                { field: 'TotalAmount', title: '合计金额', rowspan: 2, align: 'left', sortable: true, width: 120 }
                
            ], [
                    { field: 'HousekeeperName', title: '管家', align: 'left', sortable: true, width: 100 },
                    { field: 'RegionName', title: '组团区域', align: 'left', sortable: true, width: 100 }
                ]
            ];

            var ExcelCol = [
                { field: 'OrganName', title: '区域名称', align: 'left', sortable: true, width: 100 },
                { field: 'CommName', title: '项目名称', align: 'left', sortable: true, width: 100 },

                { field: 'HousekeeperName', title: '管家', align: 'left', sortable: true, width: 100 },
                { field: 'RegionName', title: '组团区域', align: 'left', sortable: true, width: 100 },

                { field: 'CostName', title: '费用名称', align: 'left', sortable: true, width: 100 },

                { field: 'PaidRoomNum', title: '实收户数', align: 'left', sortable: true, width: 120 },

                { field: 'CurPaidAmount', title: '本期实收金额', align: 'left', sortable: true, width: 120 },
                { field: 'CurYearPaidAmount', title: '本年实收金额', align: 'left', sortable: true, width: 120 },
                { field: 'BefPaidAmount', title: '往欠实收金额', align: 'left', sortable: true, width: 120 },
                { field: 'AftPrecAmount', title: '预收以后年度金额', align: 'left', sortable: true, width: 120 },
                { field: 'PrecAmount', title: '预存金额', align: 'left', sortable: true, width: 120 },
                { field: 'TotalAmount', title: '合计金额', align: 'left', sortable: true, width: 120 }
                ];

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

            function SearchDlg2() {
                $('#DlgMemo').parent().appendTo($("form:first"))
                $('#DlgMemo').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('组团实收报表', $('#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 == "CommName") {
                            if (rows[i].CommName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        } else if (FiledName == "OrganName") {
                            if (rows[i].OrganName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        } else if (FiledName == "CostName") {
                            if (rows[i].CostName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        } else if (FiledName == "HousekeeperName") {
                            if (rows[i].HousekeeperName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        } else if (FiledName == "RegionName") {
                            if (rows[i].RegionName != "") {
                                tableString += ('' + rows[i][FiledName] + '');
                            } else tableString += "";
                        } else if (FiledName == "PaidRoomNum") {
                            if (rows[i].PaidRoomNum != "") {
                                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 == "BefPaidAmount") {
                            if (rows[i].BefPaidAmount != "") {
                                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 == "CurPaidAmount") {
                            if (rows[i].CurPaidAmount != "") {
                                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 == "CurYearPaidAmount") {
                            if (rows[i].CurYearPaidAmount != "") {
                                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 == "AftPrecAmount") {
                            if (rows[i].AftPrecAmount != "") {
                                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 == "PrecAmount") {
                            if (rows[i].PrecAmount != "") {
                                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 == "TotalAmount") {
                            if (rows[i].TotalAmount != "") {
                                var parts = rows[i][FiledName].toString().split(".");
                                parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                                tableString += ('' + parts.join(".") + '');
                            } 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";

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

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

            function StartTask() {
                //启动一个任务
                $.tool.DataPostNoLoading('FeesPaidComm', '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: 500,
                    pageList: [500, 1000, 2000],
                    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("FeesPaidComm", "LoadData", "TableContainer", param);
                    },
                    onLoadSuccess: function (data) {

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

            }

            LoadList(1, 50);

            //获取进度
            function TakeProgress() {
                $.tool.DataPostNoLoading('FeesPaidComm', '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 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 SelCost() {
                HDialog.Open('700', '450', "../dialogNew/MultiCorpCostDlg.aspx" + "?Ram=" + Math.random(), '收费项目选择', false, function (_data) {
                    var varReturn = _data;

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

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

                });

            }

            function btnClear_OnClick() {

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

            }

            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>
