<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Course.KS_CsStatisticalUserOrder" Codebehind="KS.CsStatisticalUserOrder.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.APPCode" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
      <script>
        function SetDate() {
            var today = new Date();
            if ($("#showdate").is(":hidden")) {
                $("#showdate").show();
                $('#<%=TxtBeginDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
                $('#<%=TxtEndDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
            }
            else {
                $("#showdate").hide();
                $('#<%=TxtBeginDate.ClientID%>').val('');
                $('#<%=TxtEndDate.ClientID%>').val('');
            }
        }
        function keyWordFocus() {
            if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '请输入关键字！') {
                jQuery("#<%=this.KeyWord.ClientID %>").val('');
            }
        }
        function keyWordBlur() {
            if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '') {
                jQuery("#<%=this.KeyWord.ClientID %>").val('请输入关键字！');
            }
        }
    </script>
    <div id="manage_top" class="menu_top_fixed">
        
    	<ul class="titleTab">
            <li><a href="KS.AddNew.aspx">开通课程</a></li>
            <li ><a href="KS.CsStatisticalCourseOrder.aspx">按课程查看订单记录</a></li>
            <li class="curr"><a href="KS.CsStatisticalUserOrder.aspx">按学生查看订单记录</a></li>
        </ul>
    </div>
    <div class="menu_top_fixed_height"></div>

    <div class="content-area">
        <div class="tabs_header longTabs">
              <ul class="tabs">
                    <li <%=KSCMS.S("costype")==""?" class='active'":string.Empty %>><a href="?status=<%=status %>">点播订单</a></li>
                    <li <%=KSCMS.S("costype")=="2"?" class='active'":string.Empty %> ><a href="?costype=2&status=<%=status %>">直播订单</a></li>
                    <li <%=KSCMS.S("costype")=="1"?" class='active'":string.Empty %>><a href="?costype=1&status=<%=status %>">面授订单</a></li>
                    
                    <div class="fr headOperation">
                        <ul>
                            <li id="p18" class="fl"><asp:LinkButton ID="ExcelBtn" runat="server" Text="本页导出Excel" OnClick="ExcelBtn_Click" CssClass="button">本页导出Excel</asp:LinkButton></li>
                            <li id="p18" class="fl"><asp:LinkButton ID="WordBtn" runat="server" Text="本页导出Word" OnClick="WordBtn_Click" CssClass="button">本页导出Word</asp:LinkButton></li>
                            <li id="p18" class="fl"><a href="KS.CsOrderExportExcel.aspx" class="button">按条件导出Excel或Word</a></li>
                        </ul>
                    </div>
            
        </div>
        <div class="quickSearch clearfix">
            <div class="SearchBox fl">
             
                        <asp:DropDownList ID="DrpPaymentPlat" runat="server" style="margin-right:8px;">
                            <asp:ListItem Value="-1">-选择支付方式-</asp:ListItem>
                            <asp:ListItem Value="0"> 余额支付</asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList ID="DropDownList3" runat="server" style="margin-right:8px;">
                            <asp:ListItem Value="0">订单来源</asp:ListItem>
                            <asp:ListItem Value="1">PC端</asp:ListItem>
                            <asp:ListItem Value="2">手机端</asp:ListItem>
                            <asp:ListItem Value="3">微信</asp:ListItem> 
                            <asp:ListItem Value="4">APP</asp:ListItem> 
                            <asp:ListItem Value="5">小程序</asp:ListItem> 
                        </asp:DropDownList>
                        <asp:DropDownList ID="DrpSearchType" runat="server" style="margin-right:8px;">
                            <asp:ListItem Value="1">订单编号</asp:ListItem>
                            <asp:ListItem Value="2">课程名称</asp:ListItem>
                            <asp:ListItem Value="3">购买学员</asp:ListItem>
                            <asp:ListItem Value="4">姓名</asp:ListItem>
                            <asp:ListItem Value="5">联系电话</asp:ListItem>
                        </asp:DropDownList>
                        <asp:TextBox onfocus="keyWordFocus();" onblur="keyWordBlur();" Style="color: #ccc" Text="请输入关键字！" CssClass="textbox" ID="KeyWord" runat="server" Width="180px"></asp:TextBox>
                        <b class="link-color" onclick="SetDate()">日期范围？</b>
                        <span id="showdate" <%if (this.TxtBeginDate.Text == ""){ %> style="display: none" <%} %>>
                            <asp:TextBox ID="TxtBeginDate" placeholder="格式：YYYY-MM-DD" Width="180px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                            <asp:TextBox ID="TxtEndDate" placeholder="格式：YYYY-MM-DD" Width="180px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>
                        </span>
                        <asp:Button ID="Button1" runat="server" Text="开始搜索" CssClass="button" OnClick="Button1_Click" />
                 
            </div>
            <div class="property">
                <div class="name button ml15">筛选</div>
                <div class="propertyBox">
                	<ul class="clearfix">
                        <span class="screen fl">订单查看：</span>
                        <li <%=KSCMS.S("status")==""?" class='active'":string.Empty %>><a href="?costype=<%=cosType %>"><span>所有订单</span></a></li>
                        <li <%=KSCMS.S("status")=="1"?" class='active'":string.Empty %>><a href="?status=1&costype=<%=cosType %>"><span>今日订单</span></a></li>
                        <li <%=KSCMS.S("status")=="2"?" class='active'":string.Empty %>><a href="?status=2&costype=<%=cosType %>"><span>已付款</span></a></li>
                        <li <%=KSCMS.S("status")=="3"?" class='active'":string.Empty %>><a href="?status=3&costype=<%=cosType %>"><span>未付款</span></a></li>
                        <li <%=KSCMS.S("status")=="4"?" class='active'":string.Empty %>><a href="?status=4&costype=<%=cosType %>"><span>已关闭</span></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <asp:Repeater ID="CourseRepeater" runat="server" OnItemCommand="CourseRepeater_ItemCommand">
            <HeaderTemplate>
            <table width="99%" border="0" cellpadding="2" cellspacing="1" class="CTable">
                <tr align="center" class="CTitle">
                    <td width="3%"  height="40px" align="center"><input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);" /></td>
                    <td align="center" width="8%"><b>下单时间</b></td>
                    <td width="8%"><b>订单编号</b></td>
                    <td width="20%" align="center" colspan="2"><b>课程名称</b></td>
                    <td width="5%"  align="center"><b>课程类型</b></td>
                    <td width="6%"  align="center"><b>订单来源  </b></td>
                    <td width="7%"  align="center"><b>支付方式</b></td>
                    <td width="8%" align="center"><b>购买学员</b></td>
                    <td width="8%" align="center"><b>联系人</b></td>
                    <td width="8%" align="center"><b>联系电话</b></td>
                    <td width="8%" align="center"><b>实付价格</b></td>
                    <td width="6%"  align="center" nowrap><b>状态</b></td>
                    <td width="5%" align="center">删除</td>
                </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tdbg">
                    <td align="center">
                        <input type="checkbox" name="ids" id="ids" value="<%# Eval("CourseID") %>" />
                    </td>
                    <td align="center">
                        <%# Eval("InputTime") %>
                    </td>
                     <td align="center">
                        <%# Eval("orderid") %>
                    </td>
                    <td align="right">
                    	<a href="<%# Kesion.APPCode.Public.GetCosUrl(Utils.StrToInt(Eval("Orderflag")),Utils.StrToInt(Eval("OrderType")),Utils.StrToInt(Eval("CourseID")),ref courseType,Utils.StrToInt(Eval("isBundleSale")),Utils.StrToInt(Eval("bindtype"))) %>" target="_blank"><img src="<%# Eval("photourl") %>" style="height: 50px; width: 50px;" onerror="this.src='/sysimg/nopic.gif'" /></a>
                    </td>
                    <td align="left">
                        <a href="<%# Kesion.APPCode.Public.GetCosUrl(Utils.StrToInt(Eval("Orderflag")),Utils.StrToInt(Eval("OrderType")),Utils.StrToInt(Eval("CourseID")),ref courseType,Utils.StrToInt(Eval("isBundleSale")),Utils.StrToInt(Eval("bindtype")))%>" target="_blank">
                        <%# Eval("cName") %>
                      </a>
                    </td>
                    <td align="center"><%#courseType %></td>
                    <td align="center"><%# Utils.OrderDeviceName(Utils.StrToInt(Eval("OrderDevice"))) %> </td>
                    <td align="center"><%# MyCache.GetPayMentPlatName(Utils.StrToInt(Eval("paymentplatid")), "PlatName")%></td>
                    <td align="center"><%# Eval("username") %></td>
                    <td align="center">
						<%#Eval("RealName") %>
                    </td>
                    <td align="center">
                        <%#Eval("Mobile") %>
                    </td>
                    <td align="center">
					 	<%# Utils.StrToInt(Eval("scoretf").ToString())==0?Utils.StrToInt(Eval("orderscore").ToString())>0?Eval("orderscore").ToString()+"积分"+(Utils.StrToDecimal(Eval("OrderTotalPrice"))>0?@"+"+Public.ReturnShopPrice(Convert.ToString(Eval("OrderTotalPrice"))):""):""+"¥"+Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(Eval("OrderTotalPrice"))):Eval("orderscore").ToString()+"积分" %>
                    </td>
                    <td align="center">
					 	<%#Kesion.Course.CourseOrderService.GetCosOrderStatus(Utils.StrToInt(Eval("Status")),Utils.StrToInt(Eval("DeliverStatus")),Utils.StrToInt(Eval("IsSendNote")),Utils.StrToInt(Eval("IsInvoice")) ) %>      
                    </td>
                    <td align="center" class="Ctd">
                    	<asp:LinkButton CssClass="delete" ToolTip="删除" runat="server" ID="LinkButton1" Visible='<%# Utils.StrToInt(Eval("status")) > 0? false:true %>' CommandArgument='<%#Eval("id") %>' OnClientClick="return(confirm('确定删除该订单吗?'));" CommandName="del">删除</asp:LinkButton>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                <tr class="tdbg" style="display: <%# bool.Parse((CourseRepeater.Items.Count==0).ToString())?"":"none"%>">
                    <td class="Ctd" style="text-align: center" colspan="12">
                        <div class="empty">没有任何订单</div>
                    </td>
                </tr>
            </table>
            </FooterTemplate>
        </asp:Repeater>
        <KS:Page ID="Page1" runat="server" />
    </div>
</asp:Content>
