<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="calloutoptrecordlist.aspx.cs" Inherits="HySoft.BaseCallCenter.Web.calloutmanage.calloutoptrecordlist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="../scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/core/base.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/Tab/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/ui/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="../scripts/CustomersData.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <link href="../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var strWhere = "";
        function OpenWindowShow1(Url, Title, Width, Height) {
            $.ligerDialog.open({ title: Title, isHidden: false, url: Url, height: Height, width: Width, isResize: true, modal: true, buttons: [
                { text: '关闭', onclick: function (item, dialog) { dialog.close(); } }
             ], isResize: true
            });
        }
        function Player(path) {
            OpenWindowShow1('../telmanage/voiceplay.aspx?path=' + path, '录音播放与下载', 600, 300);
            //voiceplay.aspx
            //var height = screen.availHeight / 2;
            //var width = screen.availWidth / 2 - 50;
            //window.showModalDialog(path, "Player", "dialogWidth:310px;dialogHeight:100px;dialogLeft:" + width + "px;dialogTop:" + height + "px;center:yes;help:no;resizable:no;status:no;scrollbars:no;");
        }

        function itemclick(item) {
            alert(item.text);
        }
        var gridlist;
        $(function () {
            LoadList();
        });
        function CallOut(phone) {
            top.PhoneCallOut(1, phone);
        }
        function LoadList() {
            var hfid = document.getElementById("txtHFId").value;
            gridlist = $("#divDataList").ligerGrid({
                checkbox: false,
                height: '100%',
                columns: [
                { display: '回拨', name: '_callnumber', width: 40, frozen: true, render: function (rowdata, rowindex, value) {
                    if (value == "") {
                        return;
                    }
                    else {
                        return "<img src=\"../images/phone3.png\" style=\"cursor:hand; width:24px;\" title=\"拨打" + value + "\" onclick=\"CallOut('" + encodeURI(value) + "');\" />";
                    }
                }
                },
                { display: '电话号码', name: '_callnumber', width: 100, frozen: true },
                 { display: '录音', name: '_filepath', width: 40, frozen: true, render: function (rowdata, rowindex, value) {
                     if (value == "") {
                         return;
                     }
                     else {
                         return "<img src=\"../images/notice.png\" style=\"cursor:hand;\" onclick=\"Player('" + encodeURI(value) + "');\" />";
                     }
                 }
                 },
                { display: '呼叫方向', name: '_calltype', width: 80, frozen: false, render: function (rowdata, rowindex, value) {
                    if (value == "0")
                        return "呼入";
                    else
                        return "呼出";
                }
                },
                { display: '是否回访', name: '_dealtype', width: 80, frozen: false, render: function (rowdata, rowindex, value) {
                    if (value == "7")
                        return "回访";
                    else
                        return "";
                }
                },
                { display: '呼叫状态', name: '_callstate', width: 80, frozen: false, render: function (rowdata, rowindex, value) {
                    if (value == "0")
                        return "未接通";
                    else
                        return "已接通";
                }
                },
                 { display: '是否处理', name: '_isdeal', width: 80, render: function (rowdata, rowindex, value) {
                     if (value == "0")
                         return "未处理";
                     else if (value == "1")
                         return "已处理";
                     else
                         return "注销";
                 }
                 }, { display: '坐席工号', name: '_usercode', width: 80 },
                { display: '坐席姓名', name: '_username', width: 80 },
                { display: '开始时间', name: '_begintime', width: 130, type: 'date', format: 'yyyy-MM-dd hh:mm:ss' },
                //                { display: 'IVR结束时间', name: '_ivrendtime', width: 130, type: 'date', format: 'yyyy-MM-dd hh:mm:ss' },
                {display: '通话开始时间', name: '_talkstarttime', width: 130, type: 'date', format: 'yyyy-MM-dd hh:mm:ss' },
                { display: '通话结束时间', name: '_talkendtime', width: 130, type: 'date', format: 'yyyy-MM-dd hh:mm:ss' },
                { display: '通话时长(s)', name: '_talklongtime', width: 80 },
                 { display: '按键', name: '_businesstype', width: 50}], url: '../telmanage/ajax/telrecords.ashx?hfid=' + hfid + '&action=gethflist' + strWhere, pageSize: 20, pageSizeOptions: [10, 20, 50], rownumbers: true
            });
            gridlist.changePage('first');
            $("#pageloading").hide();
        }
        function formatDateTime(value, rowData, rowIndex) {
            if (value != null) {
                var date = new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
                var result = date.getFullYear() + "-" + (date.getMonth() + 1 < 10 ? "0"
                    + (date.getMonth() + 1) : date.getMonth() + 1) + "-"
                    + (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " "
                    + (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":"
                    + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) + ":"
                    + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds());
                return result;
            }
            return value;
        }
        function deleteRow() {
            g.deleteSelectedRow();
        }
        function Delete() {
            try {
                //获取选择的行
                var rows = gridlist.getSelectedRows();
                if (rows.length > 0) {
                    $.ligerDialog.confirm('确定要批量删除选择的记录吗？', function (yes) {
                        if (yes) {
                            try {
                                var arr = new Array();
                                var i = 0;
                                for (var i = 0; i < rows.length; i++) {
                                    arr[i] = rows[i]._callrecordsid;
                                }
                                $.post("ajax/telrecords.ashx?action=deletelist&arrid=" + arr.toString(), function (data) {
                                    if (data == "success") {
                                        $.ligerDialog.success('删除成功');
                                        LoadList();
                                    }
                                    else {
                                        $.ligerDialog.error('删除失败');
                                    }
                                });
                            }
                            catch (e) {
                                alert(e.Message);
                            }
                        }
                        else {
                        }
                    });
                }
                else {
                    $.ligerDialog.error('没有选择要删除的行');
                }
            }
            catch (e) {
                $.ligerDialog.error(e.Message);
            }
        }
        function cleartextbox() {
            document.getElementById("txtTelphone").value = "";
            document.getElementById("txtstate").value = "";
            document.getElementById("txtzuowei").value = "";
            document.getElementById("txtstarttime").value = "";
            document.getElementById("txtendtime").value = "";
        }
        function getparams(params) {
            strWhere = "";
            if (params != "") {
                strWhere += params;
            }
            LoadList();
        }
        function getsql() {
            strWhere = "";
            var phone = document.getElementById("txtTelphone").value;
            var account = document.getElementById("ddlAccount").value;
            if (phone != "") {
                strWhere += "&phone=" + phone + "";
            }
            if (account != "") {
                strWhere += "&usercode=" + account + "";
            }
            LoadList();
        }
        function HighSearch() {
            $.ligerDialog.open({
                url: '../telmanage/recordhighsearch.aspx',
                title: '高级搜索',
                height: 300,
                width: 600,
                isResize: true
            });
        }
        document.onkeydown = function (event) {
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if (e && e.keyCode == 13) {
                getsql();
            }
        };
    </script>
</head>
<body style="margin: 0px; padding: 0px; overflow: hidden;">
    <form id="form1" runat="server">
    <div class="l-loading" style="display: block" id="pageloading">
    </div>
    <div class="tools_box">
        <div class="tools_bar">
            <div class="search_box">
                    电话号码：<asp:TextBox ID="txtTelphone" runat="server" CssClass="txtInput" Width="80px"></asp:TextBox>&nbsp;&nbsp;
                    坐席： <asp:DropDownList ID="ddlAccount" runat="server" CssClass="selectBox" Width="70px"> </asp:DropDownList>&nbsp;&nbsp;
                <input id="btnSearch" type="button" value="搜 索" class="btnSearch" onclick="getsql();" />&nbsp;&nbsp;
                <input id="btnHighSearch" type="button" value="高级搜索" class="btnSearch" onclick="HighSearch();" /><asp:HiddenField
                    ID="txtHFId" runat="server" Value="0" />
            </div>
        </div>
    </div>
    <div id="divDataList">
    </div>
    </form>
</body>
</html>
