<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Course.KS_CsStatisticalCourseOrder" Codebehind="KS.CsStatisticalCourseOrder.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 viewlist(courseid, title) {

        parent.openWin("查看"+title,"Course/KS.CsStatisticalCourseOrder.aspx?action=viewlist&courseid="+courseid,false,900,500);
    }
</script>
<asp:Panel ID="ListPanel" runat="server" Width="100%">
    <div id="manage_top" class="menu_top_fixed">
    	<ul class="titleTab">
            <li><a href="KS.AddNew.aspx">开通课程</a></li>
            <li class="curr"><a href="KS.CsStatisticalCourseOrder.aspx">按课程查看订单记录</a></li>
            <li><a href="KS.CsStatisticalUserOrder.aspx">按学生查看订单记录</a></li>
        </ul>
    </div>
    <div class="menu_top_fixed_height"></div>
    <div class="content-area">
        <div class="myTitle">
            按课程查看订单记录
             <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" CssClass="fr button mr20">导出Excel</asp:LinkButton>
        </div>
        <div class="quickSearch clearfix">
            <div class="SearchBox fl">
                <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:DropDownList>
                <asp:TextBox Style="color: #ccc" 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="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                   <asp:TextBox ID="TxtEndDate" placeholder="格式：YYYY-MM-DD" Width="150px" 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("type")==""?" class='active'":string.Empty %>><a href="KS.CsStatisticalCourseOrder.aspx"><span>所有订单</span></a></li>
                        <li <%=KSCMS.S("type")=="1"?" class='active'":string.Empty %>><a href="KS.CsStatisticalCourseOrder.aspx?type=1"><span>机构订单</span></a></li>
                        <li <%=KSCMS.S("type")=="2"?" class='active'":string.Empty %>><a href="KS.CsStatisticalCourseOrder.aspx?type=2"><span>教师订单</span></a></li>
                        <li <%=KSCMS.S("type")=="3"?" class='active'":string.Empty %>><a href="KS.CsStatisticalCourseOrder.aspx?type=3"><span>面授课程订单</span></a></li>
                        <li <%=KSCMS.S("type")=="4"?" class='active'":string.Empty %>><a href="KS.CsStatisticalCourseOrder.aspx?type=4"><span>点播课程订单</span></a></li>
                        <li <%=KSCMS.S("type")=="5"?" class='active'":string.Empty %>><a href="KS.CsStatisticalCourseOrder.aspx?type=5"><span>直播课程订单</span></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <asp:Repeater ID="CourseRepeater" runat="server">
            <HeaderTemplate>
            <table width="99%" border="0" cellpadding="2" cellspacing="1" class="CTable">
                <tr align="center" class="CTitle">
                    <td width="5%" height="40px" align="center"><input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);" /></td>
                    <td width="5%" align="center"><b>封面</b></td>
                    <td width="10%" align="center"><b>课程名称</b></td>
                    <td width="5%" align="center"><b>课程类型</b></td>
                    <td width="6%" align="center"><b>发布者  </b></td>
                    <%if(KSCMS.S("type") != "2") {%>
                    <td width="10%"   align="center"><b>教师名称</b></td>
                    <%} %>
                    <%if(KSCMS.S("type") != "3") {%>
                    <td width="6%"  align="center"><b>机构名称</b></td>
                    <%} %>
                    <td width="7%" align="center"><b>浏览人数</b></td>
                    <td width="10%" align="center"><b>课程价格</b></td>
                    <td width="10%" align="center"><b>资料价格</b></td>
                    <td width="10%" align="center"><b>课程税金</b></td>
                    <td width="10%" align="center"><b>课程总价</b></td>
                    <td width="6%" align="center" nowrap><b>成单次数/单</b></td>
                    <td width="6%" align="center" nowrap><b>详情</b></td>
                </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tdbg">
                    <td align="center">
                        <input type="checkbox" name="ids" id="ids" value="<%# Eval("CourseID") %>" />
                    </td>
                    <td align="center">
                        <img src="<%# Eval("photourl") %>" style="height: 50px; width: 50px;" onerror="this.src='/sysimg/nopic.gif'" />
                    </td>
                    <td align="left"><%# Eval("CourseName") %></td>
                    <td align="center"><%# Eval("CourseType") %> </td>
                    <td align="center"><%# Eval("username") %> </td>
                    <%if(KSCMS.S("type") != "2") {%>
                    <td align="center"><%# Eval("TName").ToString()==""?"---":Eval("TName") %> </td>
                    <%} %>
                    <%if(KSCMS.S("type") != "3") {%>
                    <td align="center"><%# (Eval("schoolname").ToString()==""|| Eval("schoolname").ToString()=="0")?"---":Eval("schoolname") %> </td>
                    <%} %>
                    <td align="center"><%# Eval("lookcount") %> </td>
                    <td align="center"><span><%#MyCache.GetCurrencySymbol %></span><span class="c_price"><%# Utils.StrToFloat(Eval("OrderTotalPrice")).ToString("f2") %></span> </td>
                    <td align="center"><span><%#MyCache.GetCurrencySymbol %></span><span class="n_price"><%# Utils.StrToFloat(Eval("NotePrice")).ToString("f2") %></span> </td>
                    <td align="center"><span><%#MyCache.GetCurrencySymbol %></span><span class="t_price"><%# Utils.StrToFloat(Eval("TaxPrice")).ToString("f2") %></span> </td>
                    <td align="center"><span><%#MyCache.GetCurrencySymbol %></span><span class="all_price"><%# Utils.StrToFloat(Eval("TotalPrice")).ToString("f2") %></span> </td>
                    <td align="center" class="num greenFont"><%# Eval("num") %> </td>
                    <td align="center">
                      <a href='javascript:;' onclick="viewlist('<%#Eval("CourseID")%>','<%#Eval("CourseName")%>')" class="greenFont">详情</a>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                <tr class="tdbg" style="display: <%# bool.Parse((CourseRepeater.Items.Count>0).ToString())?"":"none"%>">
                    <td colspan="8" style="text-align: right;">本页合计：</td>
                    <td class="Ctd redFont" style="text-align: center;">
                        ￥<span class="total_c f16">0</span>
                    </td>
                    <td class="Ctd redFont" style="text-align: center;">
                        ￥<span class="total_n f16">0</span>
                    </td>
                    <td class="Ctd redFont" style="text-align: center;">
                        ￥<span class="total_t f16">0</span>
                    </td>
                    <td class="Ctd redFont" style="text-align: center;">
                        ￥<span class="total_all f16">0</span>
                    </td>
                    <td class="Ctd" style="text-align: center;">
                        <span class="total_num f16 greenFont">0</span>
                    </td>
                    <td></td>
                </tr>
                <tr class="tdbg" style="display: <%# bool.Parse((CourseRepeater.Items.Count==0).ToString())?"":"none"%>">
                    <td class="Ctd" style="text-align: center" colspan="14">
                        <div class="empty">没有任何订单</div>
                    </td>
                </tr>
            </table>
            </FooterTemplate>
        </asp:Repeater>

        <KS:Page ID="Page1" runat="server" />
    </div>
    <script>
        $(function () {
            var total_c = 0;
            var total_n = 0;
            var total_t = 0;
            var total_all = 0;
            var total_num = 0;
            $(".c_price").each(function () {
                total_c += parseFloat($(this).html());
            });
            $(".n_price").each(function () {
                total_n += parseFloat($(this).html());
            });
            $(".t_price").each(function () {
                total_t += parseFloat($(this).html());
            });
            $(".all_price").each(function () {
                total_all += parseFloat($(this).html());
            });
            $(".num").each(function () {
                total_num += parseInt($(this).html());
            });
            $(".total_c").html(total_c.toFixed(2));
            $(".total_n").html(total_n.toFixed(2));
            $(".total_t").html(total_t.toFixed(2));
            $(".total_all").html(total_all.toFixed(2));
            $(".total_num").html(total_num);
        });
        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('');
            }
        }
    </script>
</asp:Panel>
<asp:Panel ID="PanelDetail" runat="server" Width="100%">
    <script>
        function SetDate() {
            var today = new Date();
            if ($("#showdate2").is(":hidden")) {
                $("#showdate2").show();
                $('#<%=TextBox2.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
                $('#<%=TextBox3.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
            }
            else {
                $("#showdate2").hide();
                $('#<%=TextBox2.ClientID%>').val('');
                $('#<%=TextBox3.ClientID%>').val('');
            }
        }
        function keyWordFocus2() {
            if (jQuery("#<%=this.TextBox12.ClientID %>").val() == '请输入关键字！') {
                  jQuery("#<%=this.TextBox12.ClientID %>").val('');
            }
        }
        function keyWordBlur2() {
            if (jQuery("#<%=this.TextBox12.ClientID %>").val() == '') {
                jQuery("#<%=this.TextBox12.ClientID %>").val('请输入关键字！');
            }
        }
    </script>
	<style>
    	.scroll_Rcontent {padding-right:0px;}
    </style>
    <div class="pageBlank">
        <div class="myTitle">
          <%=courseName %>
            <asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButton2_Click" CssClass="fr button mr20">导出Excel</asp:LinkButton>
        </div>
        <div class="quickSearch clearfix">
            <div class="longquickSearch">
                <div class="quickSelect">
                    <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="DropDownList1" 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>
                 </div>
             </div>
            <div class="longliwrap">
                 <div class="SearchBox fl">
                    <asp:TextBox onfocus="keyWordFocus2();" onblur="keyWordBlur2();" Style="color: #ccc" Text="请输入关键字！" CssClass="textbox" ID="TextBox12" runat="server" Width="180px"></asp:TextBox>
                    <b class="link-color" onclick="SetDate()">日期范围？</b>
                    <span id="showdate2" <%if (this.TextBox2.Text == ""){ %> style="display: none" <%} %>>
                        <asp:TextBox ID="TextBox2" placeholder="格式：YYYY-MM-DD" Width="160px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                        <asp:TextBox ID="TextBox3" placeholder="格式：YYYY-MM-DD" Width="160px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>
                    </span>
                    <asp:Button ID="Button2" runat="server" Text="搜索" CssClass="button" OnClick="Button2_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="KS.CsStatisticalCourseOrder.aspx?action=viewlist&courseid=<%=courseId%>"><span>所有订单</span></a></li>
                            <li <%=KSCMS.S("status")=="1"?" class='active'":string.Empty %>><a href="?status=1&action=viewlist&courseid=<%=courseId%>"><span>今日订单</span></a></li>
                            <li <%=KSCMS.S("status")=="2"?" class='active'":string.Empty %>><a href="?status=2&action=viewlist&courseid=<%=courseId%>"><span>已付款</span></a></li>
                            <li <%=KSCMS.S("status")=="3"?" class='active'":string.Empty %>><a href="?status=3&action=viewlist&courseid=<%=courseId%>"><span>未付款</span></a></li>
                            <li <%=KSCMS.S("status")=="4"?" class='active'":string.Empty %>><a href="?status=4&action=viewlist&courseid=<%=courseId%>"><span>已关闭</span></a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <asp:Repeater ID="Repeater1" runat="server" >
            <HeaderTemplate>
            <table width="99%" border="0" cellpadding="2" cellspacing="1" class="CTable">
                <tr align="center" class="CTitle">

                    <td align="center" width="8%"><b>下单时间</b></td>
                    <td width="8%"><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="6%"  align="center" nowrap><b>状态</b></td>
                </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class="tdbg"> 
                    <td align="center">
                        <%# Eval("InputTime") %>
                    </td>
                     <td align="center">
                        <%# Eval("orderid") %>
                    </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">
                      <%#Kesion.Course.CourseOrderService.GetCosOrderStatus(Utils.StrToInt(Eval("Status")),Utils.StrToInt(Eval("DeliverStatus")),Utils.StrToInt(Eval("IsSendNote")),Utils.StrToInt(Eval("IsInvoice")) ) %>           
                  </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="8">
                        <div class="empty">没有任何订单</div>
                    </td>
                </tr>
            </table>
            </FooterTemplate>
        </asp:Repeater>
        <KS:Page ID="Page2" runat="server" />
    </div>
</asp:Panel>
</asp:Content>
