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


<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>微信订单</title>
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/jquery.min.js"></script>
    <script src="../jscript/JSClient.js" type="text/javascript"></script>
    <script src="../jscript/jquery.tool.new.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/Dialog.js" type="text/javascript"></script>

    <link href="../css/button.css" rel="stylesheet" />
    <script src="../jscript/DateFormat.js" type="text/javascript"></script>
    <script src="../jscript/format.js" type="text/javascript"></script>
    <style type="text/css">
        #CommNames {
            width: 91.7%;
            height: 60px;
            border: 1px solid #cccccc;
            font-size: 12px;
            padding: 2px;
            resize: none;
        }
    </style>
</head>
<body>
    <form id="BankCustSurrBrowse" method="post" 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: 700px; height: 220px; padding: 10px;">
            <table class="DialogTable" style="line-height: 25px;">
                <tr>
                    <td class="TdTitle">项目名称
                    </td>
                    <td colspan="3">
                        <textarea id="CommNames" name="CommNames" runat="server" ru="server" onclick="SelComm();"></textarea>
                        <input id="hidCommId" size="1" type="hidden" name="hidCommId" runat="server" />
                        <input id="CommIDs" size="1" type="hidden" name="CommIDs" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="TdTitle">房屋编号</td>
                    <td class="TdContentSearch">
                        <input id="RoomSign" style="width: 83%;" class="easyui-validatebox" name="RoomSign" runat="server" /></td>
                    <td class="TdTitle">客户名称</td>
                    <td class="TdContentSearch">
                        <input id="CustName" style="width: 83%;" class="easyui-validatebox" name="CustName" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="TdTitle">对账时间从</td>
                    <td class="TdContentSearch">
                        <input id="BeginDate1" style="width: 83%;" class="easyui-datebox" data-options="editable:false" name="BeginDate1" runat="server" /></td>
                    <td class="TdTitle">到</td>
                    <td class="TdContentSearch">
                        <input id="BeginDate2" style="width: 83%;" class="easyui-datebox" data-options="editable:false" name="BeginDate2" runat="server" /></td>
                </tr>
                <tr>
                    <td align="center" colspan="4">
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>&nbsp;&nbsp;
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-filter'" onclick="CancelParm();">清&nbsp;&nbsp;空</a>
                    </td>
                </tr>
            </table>

        </div>
    </form>
</body>
</html>
<script type="text/javascript">
    var w = $(window).width();
    var h = $(window).height();
    $(function () {
        InitTableHeight();
        LoadList();

    });
    function SelComm() {
        if ($("#hidCommId").val() != '0')
            return;

        var w = $(window).width() * 0.7;
        HDialog.Open(w, 500, '../DialogNew/SelComm.aspx?IsCheck=1&isCommID=0', "选择管理项目", false, function callback(_Data) {
            var arrRet = JSON.parse(_Data);
            $("#CommIDs").val(arrRet.id);
            $("#CommNames").val(arrRet.name);
        });
    }

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

    var toolbar = [
        {
            text: '筛选',
            iconCls: 'icon-search',
            handler: function () {
                $('#SearchDlg').parent().appendTo($("form:first"))
                $('#SearchDlg').dialog('open');
            }
        }, '-'
        , {
            text: '反核销',
            iconCls: 'icon-undo',
            handler: function () {
                UnPayAccountFinAndBank();
            }
        }, '-'
        , {
            text: '导出Excel',
            iconCls: 'icon-page_white_excel',
            handler: function () {
                window.open("../ChargesNew/MobilePayAccountBrowseExcel.aspx?random=" + Math.random());
            }
        }
    ];

    function UnPayAccountFinAndBank() {

        var row = $("#TableContainer").datagrid("getChecked");
        if (row == null || row.length == 0) {
            HDialog.Info('请选择要操作的费用！');
            return;
        }
        if (row[0].type == "自动对账"){
            HDialog.Info('自动对账无法进行反核销！');
            return;
        }

        var id = row[0].id;

        $.tool.DataGet('Allinpay', 'UnAllinpayPayAccount', 'random=' + Math.random() + '&id=' + id,
            function Init() {
            },
            function callback(_Data) {
                HDialog.Info('反核销成功！');
                LoadList();
            },
            function completeCallback() {
            },
            function errorCallback() {
            });
    }

    var frozenColumns;
    frozenColumns = [[
        /*{ field: 'ck', checkbox: true },*/
        { field: 'CommName', title: '项目', width: 120, align: 'left', sortable: true },
        { field: 'CustName', title: '客户名称', width: 120, align: 'left', sortable: true },
    ]];

    var Column =
        [[
            { field: 'RoomSign', title: '房屋编号', width: 120, align: 'left', sortable: true },
            { field: 'orderSN', title: '天问业务订单号', width: 180, align: 'left', sortable: true },
            { field: 'DueAmount', title: '天问应付金额', width: 100, align: 'left', sortable: true },
            { field: 'PaidAmount', title: '天问收款金额', width: 100, align: 'left', sortable: true },
            {
                field: 'PayTime', title: '天问收款时间', width: 180, align: 'left', sortable: true,
                formatter: function (value, row, index) {
                    var str = formatDate(row.PayTime, "yyyy-MM-dd HH:mm:ss");
                    return str;
                }
            },
            { field: 'ChargeMode', title: '收款方式', width: 150, align: 'left', sortable: true },
            { field: 'shh', title: '商户号', width: 150, align: 'left', sortable: true },
            { field: 'mdmc', title: '门店名称', width: 250, align: 'left', sortable: true },

            { field: 'jyrq', title: '交易日期', width: 120, align: 'left', sortable: true },
            { field: 'jysj', title: '交易时间', width: 120, align: 'left', sortable: true },

            { field: 'jyje', title: '交易金额', width: 100, align: 'left', sortable: true },
            { field: 'sxf', title: '手续费', width: 100, align: 'left', sortable: true },
            { field: 'jylx', title: '交易类型', width: 100, align: 'left', sortable: true },
            { field: 'cplx', title: '产品类型', width: 100, align: 'left', sortable: true },

            { field: 'jydh', title: '第三方订单号', width: 180, align: 'left', sortable: true },
            { field: 'ddh', title: '订单号', width: 180, align: 'left', sortable: true },

            { field: 'type', title: '对账类型', width: 100, align: 'left', sortable: true },
            { field: 'remark', title: '对账备注', width: 150, align: 'left', sortable: true },
            { field: 'UserName', title: '对账人', width: 100, align: 'left', sortable: true },
            { field: 'createTime', title: '对账时间', width: 150, align: 'left', sortable: true },

        ]]

    function LoadList() {
        $("#TableContainer").datagrid({
            url: '/HM/M_Main/HC/DataPostControl.aspx',
            method: "post",
            loadMsg: '数据加载中,请稍候...',
            nowrap: false,
            pageSize: top.ListPageSize,
            pageList: top.ListPageList,
            columns: Column,
            frozenColumns: frozenColumns,
            fitColumns: false,
            singleSelect: true,
            rownumbers: true,
            border: false,
            pagination: true,
            width: "100%",
            checkOnSelect: true,
            selectOnCheck: true,
            /*singleSelect: true,*/
            toolbar: toolbar,
            showFooter: true,
            sortOrder: "asc",
            onBeforeLoad: function (param) {
                param = $.JQForm.GetParam("Allinpay", "SearchPaySearch", "TableContainer", param);
            }
        });
        $('#SearchDlg').dialog('close');
    }

    //清空条件
    function CancelParm() {
        $("#BeginDate1").datebox("setValue", '');
        $("#BeginDate2").datebox("setValue", '');
        $("#IsSucc").combobox('clear');

        $("#CustomerName").val("");
    }

    $("select").each(function () {
        var key = $(this).attr("id");
        $(this).css("width", '83%');
    });
</script>
