<%@ Control Language="C#" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="Kesion.Components" %>
<script runat="server" type="text/C#">
	dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
	bool isLoadPage = true;  //定义页面是否加载
	public UserInfo __info = UserManage.GetUserInfo();
	public static DataRow dr;
	public static string name;
	public static int TcId = 0;
	public static string tname;
	public static string goodsmoney, paytime, Target;
	public float wang = 0;

	
	protected void Page_Load(object sender, EventArgs e)
	{
		if (__info == null || CheckUserLogin.Check() != "success")
		{
			(new TemporaryVar()).ComeUrl = Request.Url.ToString();
			Utils.ShowError("对不起，您没有登录!", "error.gif", 2, KSCMS.GetInstallDir() + "index.aspx");
		}
		if (__info.GroupID != 4)
		{
			JS.AlertClose("您不是教师会员！");
		}
		using (DataTable dts = DataFactory.GetDataTable("select top 1 * from KS_CosTeacher where Field='" + __info.UserName + "'"))
		{
			if (dts.Rows.Count > 0)
			{
				dr = dts.Rows[0];
				TcId = Utils.StrToInt(dr["tcid"].ToString());
				float sum = Utils.StrToFloat(DataFactory.GetOnlyValue("select sum(b.Freight) from KS_CosOrder a inner join KS_CosOrderItem b on a.orderid=b.orderid   where b.AttrID=" + (__info.GroupID == 3 ? 1 : 2) + " and  a.status=1 and b.business='" + UserManage.GetUserInfo().UserName + "'"));
				//已提金额
				float face = Utils.StrToFloat(DataFactory.GetOnlyValue("select sum(Money) from  KS_EnterPriseAccount  where  tcid=" + (__info.GroupID == 3 ? 0 : 1) + " and  username='" + UserManage.GetUserInfo().UserName + "'"));
				//可提金额
				 wang = sum - face;
				if (wang <= 0) wang = 0;
			}
			else
			{
				Response.Redirect(BasicField.GetUserUrl("teacher/teacher"));
			}
		}
	
	}

	
</script>
<%
    if (!isLoadPage) return;
%>

<style>
        .f-f56{font-size: 56px;}
        .ty_content>ul>li{float: left;width: 20%;text-align: center}
        .money-code {border-radius: 10px;border: 1px solid #eaeeee;  box-shadow: 0 0 3px #eaeeee;  font-size: 14px;  color: #fff;padding: 15px 0;margin-right:20px;cursor:pointer}
        .ty_content>ul>li:last-child .money-code{margin-right:0}
        .num-val{font-size:20px;line-height:28px;}
        .floor_2_title {position: relative;}
        .con1{background-color: #00acac}
        .con2{background-color: #348fe2}
        .con3{background-color: #727cb6}
        .con4{background-color: #ff6b6b}
        .con5{background-color: #ab6eb1}
        .cartogram-l{width: 70%;float: left;}
        .cartogram-r{width: 30%;float:right;}
        .cartogram-r .inner{margin-left:20px;}
        .cartogram-r .inner,
        .cartogram-l .inner{border:1px solid #e3e3e3;box-shadow: 0 1px 1px rgba(0,0,0,0.1) }
        .cartogram-r li{line-height: 50px;height: 50px;padding:0 20px 0 30px;position: relative;font-size:13px;border-top:1px solid #eee; }
        .cartogram-r a{color:#8b8b8b;}
        .cartogram-r li:hover{background-color: #f1f1f1}
        .cartogram-r label{margin-left:5px;}
        .col-5f{color:#5faee3;}
        .font-w{font-weight: bold}
        .circle-num {width: 20px;height: 20px;border-radius: 50%;display: block;position: absolute;top:50%;margin-top: -10px;right: 20px;line-height: 20px;text-align: center}
        .cartogram-r .circle-bg1{background-color: #ff6e6e;color: #fff}
        .cartogram-r .circle-bg2{background-color: #27b3b3;color: #fff}
        .bg-white{background-color:#fff}
        .con-btn{min-width: 80px;height: 26px;line-height: 24px; margin-top: 15px;background: #5faee3;color: #fff;border: 1px solid #5faee3;border-radius: 3px;}
        .tubiao_div{width:500px; height:48px; margin:0px auto;  text-align:center; line-height:30px; overflow:hidden}
      .tubiao_div_line{width: 16px;height: 16px;margin-top: 10px;display: block;border-radius: 50%;background: #2ac7cc;float: left;margin-right: 20px;}
      .tubiao_div_lwen{ float:left; margin-top:3px; margin-right:30px;}
      .bt_yue1_hide{background-color:red; width:90px; float:right; position: absolute; margin-top:10px; margin-right:-2px; z-index:100; cursor:pointer; box-shadow:0 0 2px #CCCCCC; display:none;right:46px;top:-160px;}
      .bt_yue_hide{width:100%; height:35px; background-color:white; text-align:center; line-height:35px;}
      .bt_yue_hide:hover{width:100%; height:35px; background-color:#bbbbbb; text-align:center; line-height:35px;color:white;}
        .bt_yue1_hide{background-color:red; width:90px; float:right; position:absolute;  margin-right:-7px; z-index:100; cursor:pointer; box-shadow:0 0 2px #CCCCCC; display:none;}
      .bt_yue_hide{width:100%; height:35px; background-color:white; text-align:center; line-height:35px;}
      .bt_yue_hide:hover{width:100%; height:35px; background-color:#bbbbbb; text-align:center; line-height:35px;color:white;}     
        .floor_3_title{color:#696969; float:right; height:20px; line-height:20px; cursor:pointer;margin-right:40px;}
        .tcindexmain .right {background-color:#eee !important;}
        div#bt_yue3 {width:90px; background:#eceff4;height:32px;line-height:32px;text-align:center;}
        .ini-block {display:inline-block;vertical-align: middle;margin-left:15px}
        .mt10{margin-top:10px}
        .echart-box{padding:20px;border-top:1px solid #eee;}

</style>

<div class="t_tybox" style="background-color:#eee">
    <div class="tytitle" style="background-color:#eee;padding:0"><h4>财务信息</h4></div>
    <div class="ty_content clearfix">
       <ul>
           <li onclick="location.href='<%=BasicField.GetUserUrl("order/UserEpAccount") %>'">
               <div class="money-code con1">
              <img src="SysImg/teacher/capital.png" style="width: 56px;vertical-align: middle">
               <span class="ini-block"><p>可提现</p><p class="num-val"><%=Math.Round(Utils.StrToFloat(dr["divideInto"].ToString()),2)%></p></span>
               </div>
           </li>
           <li onclick="location.href='<%=BasicField.GetUserUrl("order/UserEpAccount") %>'">
               <div class="money-code con2">
                    <img src="SysImg/teacher/inte2.png" style="width: 56px;vertical-align: middle">
                   <span class="ini-block"><p>已提现</p><p class="num-val"><%=Math.Round(Utils.StrToFloat(dr["Withdrawals"].ToString()),2)%></p></span>
               </div>
           </li>
           <li onclick="location.href='<%=BasicField.GetUserUrl("Teacher/TcAchieve","do-collect") %>'">
               <div class="money-code con3">
                    <img src="SysImg/teacher/concern.png" style="width: 56px;vertical-align: middle">
                    <span class="ini-block"><p>关注数</p><p class="num-val"><%=dr["totalc"].ToString() %></p></span>
               </div>
           </li>
           <li onclick="location.href='<%=BasicField.GetUserUrl("Teacher/TcAchieve","do-zan") %>'">
               <div class="money-code con4">
                   <img src="SysImg/teacher/upvote.png" style="width: 56px;vertical-align: middle">
                    <span class="ini-block"><p>点赞数</p><p class="num-val"><%=dr["totalz"].ToString() %></p></span>
               </div>
           </li>
           <li onclick="location.href='<%=BasicField.GetUserUrl("Teacher/TcAchieve","do-pj") %>'">
               <div class="money-code con5">
                    <img src="SysImg/teacher/opinion.png" style="width: 56px;vertical-align: middle">
                   <span class="ini-block"><p>评价数</p><p class="num-val"><%=dr["Pjcount"].ToString() %></p></span>
               </div>
           </li>
       </ul>
    </div>
    <div class="cartogram" style="margin-top: 25px">
        <div class="cartogram-l" >
        	<div class="inner bg-white">
	            <div class="tytitle"><h4>订单情况</h4></div>
	            <div class="echart-box">
	            	<div id="Echart" style="width: 100%;height:400px;"></div>
	            </div>
	        
	              <div class="floor_2_title">
                    <div id="bt_yue3_hide" class="bt_yue1_hide" style="display: none;">
                       <div class="active bt_yue_hide">近一周</div>
                    	 <div class="bt_yue_hide" id="month">近20天</div>
                        <div class="bt_yue_hide" id="quarter">近半年</div>
                        <div class="bt_yue_hide">近年</div>
                    </div>
                   <div class="floor_3_title"><div id="bt_yue3">近一周</div></div>   
                    <div class="tubiao_div">
                    	<span class="tubiao_div_line" style="background-color:#2ac7cc; "></span>
                        <span class="tubiao_div_lwen">直播课程</span>
                        <span class="tubiao_div_line" style="background-color:#60b1e6;"></span>
                        <span class="tubiao_div_lwen">面授课程</span>
                        <span class="tubiao_div_line" style=" background-color:#b6a6d3;"></span>
                        <span class="tubiao_div_lwen">点播课程</span>
                    </div>
                </div>
        </div>
        </div>
        <div class="cartogram-r" >
        	<div class="inner bg-white">
          	  <div class="tytitle"><h4>待办事项</h4></div>
	            <ul>
	                <li>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/courselist") %>">主讲课程数<label class="red_cor">(<%=dr["Coursetotal"].ToString() %>)</label></a>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/courselist","do-add") %>" class="icon iconfont icon-iconjia f-r col-5f font-w"></a>
	                </li>
	                <li>
	                    <a href="<%=BasicField.GetUserUrl("sj/TcSjList") %>">发布的试卷数<label class="red_cor">(<%=DataFactory.GetOnlyValue("select top 1 count(id) from KS_SJ where Inputer='"+__info.UserName+"'") %>)</label></a>
	                    <a href="<%=BasicField.GetUserUrl("sj/TcSjList","do-add") %>" class="icon iconfont icon-iconjia f-r col-5f font-w"></a>
	                </li>
	                <li>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcChatInfo") %>">留言总数<label class="red_cor">(<%=dr["MessageCount"].ToString() %>)</label></a>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcChatInfo") %>" class="circle-num f-r circle-bg1"><%=dr["MessageCount"].ToString() %></a>
	                </li> 
	                <li>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcClassRoom") %>">班级总数<label class="red_cor">(<%=DataFactory.GetOnlyValue("select top 1 COUNT(1) from KS_CosClassRoom where UserID='"+__info.UserID+"'") %>)</label></a>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcClassRoom","do-add") %>" class="icon iconfont icon-iconjia f-r col-5f font-w"></a>
	                </li>
	                <li>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcClassRoom") %>">作业数量<label class="red_cor">(<%=DataFactory.GetOnlyValue("select top 1 count(1) from KS_CosHomeWork where userid="+__info.UserID+"") %>)</label></a>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcClassRoom") %>" class="icon iconfont icon-bianji f-r col-5f font-w"></a>
	                </li>
	                <li>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcGroup") %>">兴趣小组<label class="red_cor">(<%=DataFactory.GetOnlyValue("select top 1 count(BoardID) from KS_BBSBoard where username='"+__info.UserName+"'") %>)</label></a>
	                    <a href="<%=BasicField.GetUserUrl("Teacher/TcGroup","do-add") %>" class="icon iconfont icon-iconjia f-r col-5f font-w"></a>
	                </li>
	             

	            </ul>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
</div>

<script  type="text/javascript" language="javascript">

	var date = new Date();
	var year = date.getFullYear();
	var mouth = date.getMonth() + 1;
	var days;

	if (mouth == 2) {
		days = year % 4 == 0
	}
	else if (mouth == 1 || mouth == 3 || mouth == 5 || mouth == 7 || mouth == 8 || mouth == 10 || mouth == 12) {

		days = 31;
	}
	else {
		days = 30;

	};
	var listAttr = '1';
	var num = days / 3;
	for (var d = 0; d < num; d++) {
		var a = Math.min((d + 1) * 3, days)
		listAttr = listAttr + ',' + a;

	};

	//$('#month').attr('data-list', listAttr);

	var quarterAttr = '10,11,12';

	if (mouth < 3) {
		quarterAttr = '1,2,3'
	} else if (mouth < 6) {
		quarterAttr = '4,5,6'
	} else if (mouth < 9) {
		quarterAttr = '7,8,9'
	};

//	$('#quarter').attr('data-list', quarterAttr);


</script>  
      

   