Commit 8d3b7c36 authored by liudong1993's avatar liudong1993

班级月度统计

parent 7262b9b1
......@@ -136,5 +136,11 @@ namespace Edu.Model.Entity.StudyAbroad
/// 封面图
/// </summary>
public string ImgCover { get; set; }
}
/// <summary>
/// 确认时间(确认后 才能发提成 才进报表)
/// </summary>
public DateTime? ConfirmDate { get; set; }
}
}
......@@ -84,5 +84,15 @@ namespace Edu.Model.ViewModel.StudyAbroad
/// 结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 确认开始时间
/// </summary>
public string ConfirmSTime { get; set; }
/// <summary>
/// 确认结束时间
/// </summary>
public string ConfirmETime { get; set; }
}
}
......@@ -1143,6 +1143,7 @@ namespace Edu.Module.Course
ClassInfo = new
{
cModel.ClassName,
cModel.ClassNo,
tModel?.TeacherName,
tModel?.TeacherIcon,
zModel?.AssistName,
......
This diff is collapsed.
......@@ -534,7 +534,7 @@ ORDER BY tt.ClassDate ASC
/// <param name="contractNo"></param>
/// <param name="groupId"></param>
/// <returns></returns>
public List<RB_Class_Check_ViewModel> GetStudentConsumptionHoursDetialList(int teacherId, int schoolId, int classId, string startMonth, string endMonth, string studentName, int orderId, string contractNo, int groupId)
public List<RB_Class_Check_ViewModel> GetStudentConsumptionHoursDetialList(int teacherId, int schoolId, int classId, string startMonth, string endMonth, string studentName, int orderId, string contractNo, int groupId, string classIds="")
{
string where = $@" ";
if (teacherId > 0)
......@@ -549,6 +549,10 @@ ORDER BY tt.ClassDate ASC
{
where += $@" and p.ClassId ={classId}";
}
if (!string.IsNullOrEmpty(classIds) && classIds != "0")
{
where += $@" and p.ClassId in({classIds})";
}
if (!string.IsNullOrEmpty(studentName))
{
where += $@" and t2.GuestName like '%{studentName}%'";
......@@ -643,5 +647,40 @@ GROUP BY tt.ClassId,tt.OrderGuestId
}
#endregion
#region 简易报表
/// <summary>
/// 获取时间范围内的班级
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="classId"></param>
/// <param name="classNo"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Class_Check_ViewModel> GetAllClassNowMonthStatistics(string startTime, string endTime, int classId, string classNo, int group_Id)
{
string where = "";
if (classId > 0) {
where += " and cc.ClassId =" + classId;
}
if (!string.IsNullOrEmpty(classNo)) {
where += " and c.ClassNo ='" + classNo + "'";
}
string sql = $@"
SELECT q.ClassId,q.ClassNo,q.ClassName,SUM(q.CurrentDeductionHours) AS CurrentDeductionHours FROM(
SELECT cc.ClassId,cc.ClassDate,cc.ClassTimeId,MAX(cc.CurrentDeductionHours) as CurrentDeductionHours,
c.ClassName,c.ClassNo
FROM rb_class_check cc
LEFT JOIN rb_class c on cc.ClassId = c.ClassId
WHERE cc.`Status` =0 and cc.Group_Id ={group_Id} and cc.ClassDate >='{startTime}' and cc.ClassDate <='{endTime} 23:59:59' {where} GROUP BY cc.ClassId,cc.ClassDate,cc.ClassTimeId)q GROUP BY q.ClassId";
return Get<RB_Class_Check_ViewModel>(sql).ToList();
}
#endregion
}
}
......@@ -249,5 +249,22 @@ FROM
LEFT JOIN rb_sell_commission_periods AS p ON r.PeriodId = p.Id where {where} ";
return Get<RB_Sell_Commission_Details_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取日期范围 应发放的销售提成
/// </summary>
/// <param name="group_Id"></param>
/// <param name="classIds"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <returns></returns>
public List<RB_Sell_Commission_Details_ViewModel> GetSellCommissionForDate(int group_Id, string classIds, string startTime, string endTime)
{
string sql = $@"SELECT d.ClassId,SUM(d.CurrentPeriodMoney + d.CurrentExtraMoney + d.DeductionMoney + d.DeductionExtraMoney) AS CurrentPeriodMoney FROM rb_sell_commission_details d
INNER JOIN rb_sell_commission_periods p on d.PeriodId = p.Id
WHERE p.Group_Id ={group_Id} and d.ClassId in ({classIds}) and STR_TO_DATE(CONCAT(p.Periods,'-01'),'%Y-%m-%d') >='{startTime}' and STR_TO_DATE(CONCAT(p.Periods,'-01'),'%Y-%m-%d') <='{endTime} 23:59:59'
GROUP BY d.ClassId";
return Get<RB_Sell_Commission_Details_ViewModel>(sql).ToList();
}
}
}
......@@ -344,5 +344,22 @@ where {where}";
string sql = $@" select A.*,,b.`Month` from RB_Teaching_BonusDetail as A LEFT JOIN rb_teaching_bonus as b on a.BonusId=b.Id where {where} order by a.Id desc";
return Get<RB_Teaching_BonusDetail_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取时间范围老师课时费
/// </summary>
/// <param name="group_Id"></param>
/// <param name="classIds"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <returns></returns>
public List<RB_Teaching_BonusDetail_ViewModel> GetTeacherBonusForDate(int group_Id, string classIds, string startTime, string endTime)
{
string sql = $@"SELECT d.ClassId,SUM(d.Money) AS Money FROM rb_teaching_bonusdetail d
INNER JOIN rb_teaching_bonus p on d.BonusId = p.Id
WHERE p.Group_Id ={group_Id} and d.ClassId in ({classIds}) and STR_TO_DATE(CONCAT(p.`Month`,'-01'),'%Y-%m-%d') >='{startTime}' and STR_TO_DATE(CONCAT(p.`Month`,'-01'),'%Y-%m-%d') <='{endTime} 23:59:59'
GROUP BY d.ClassId";
return Get<RB_Teaching_BonusDetail_ViewModel>(sql).ToList();
}
}
}
......@@ -249,5 +249,21 @@ where {where}";
var obj = ExecuteScalar(sql);
return obj == null ? 0 : Convert.ToDecimal(obj);
}
/// <summary>
/// 获取时间范围 班级绩效
/// </summary>
/// <param name="group_Id"></param>
/// <param name="classIds"></param>
/// <param name="sTime"></param>
/// <param name="eTime"></param>
/// <returns></returns>
public List<RB_Teaching_Perf_ViewModel> GetTeacherPerfForDate(int group_Id, string classIds, string sTime, string eTime)
{
string sql = $@"SELECT d.ClassId,SUM(d.Money) AS Money FROM rb_teaching_perf d
WHERE d.Group_Id ={group_Id} and d.ClassId in ({classIds}) and d.ConfirmDate >='{sTime}' and d.ConfirmDate <='{eTime} 23:59:59'
GROUP BY d.ClassId";
return Get<RB_Teaching_Perf_ViewModel>(sql).ToList();
}
}
}
......@@ -177,6 +177,10 @@ namespace Edu.Repository.Finance
{
where += string.Format(" AND A." + nameof(RB_Finance.RB_Branch_Id) + "={0}", model.RB_Branch_Id);
}
if (model.RB_Group_Id > 0)
{
where += string.Format(" AND A." + nameof(RB_Finance.RB_Group_Id) + "={0}", model.RB_Group_Id);
}
if (model.OrderSource.HasValue)
{
where += string.Format(" AND A." + nameof(RB_Finance.OrderSource) + "={0}", (int)model.OrderSource);
......@@ -203,7 +207,6 @@ WHERE {1} {2} ", TableName, where, " ORDER BY A.FrID DESC");
where.Append(" and b.Status in(1,2,5) and b.Is_Auto=0 ");
StringBuilder builder = new StringBuilder();
//老徐喊修改的 2019-05-11 收款用交易日期 付款用制单日期
if (model.sAduitDate.HasValue && model.eAduitDate.HasValue)
{
where.Append(" AND case when b.Type=2 then b.CreateDate>='" + model.sAduitDate.Value.ToString("yyyy-MM-dd") + "' and b.CreateDate<='" + model.eAduitDate.Value.ToString("yyyy-MM-dd") + " 23:59:59' else b.TradeDate>='" + model.sAduitDate.Value.ToString("yyyy-MM-dd") + "' and b." + nameof(RB_Finance.TradeDate) + "<='" + model.eAduitDate.Value.ToString("yyyy-MM-dd") + " 23:59:59' end");
......@@ -234,16 +237,13 @@ WHERE {1} {2} ", TableName, where, " ORDER BY A.FrID DESC");
}
if (model.OrderSource.HasValue)
{
where.Append(" and IFNULL(b.OrderSource,0)!=" + (int)model.OrderSource);
where.Append(" and IFNULL(b.OrderSource,0) =" + (int)model.OrderSource);
}
if (model.Is_TCID == 1)
{
where.Append(" and IFNULL(b.OrderSource,0) not in(" + (int)OrderResourceEnum.BulkAirTicket + "," + (int)OrderResourceEnum.DomesticTicket + "," + (int)OrderResourceEnum.TicketService + "," + (int)OrderResourceEnum.Visia + ")");
}
if (model.Is_ProfitFoHF == 1)
if (model.FinanceType.HasValue && model.FinanceType > 0)
{
where.Append($@" And case when td.{nameof(RB_TradeWay.Type)}={(int)BranchAccountEnum.CashPool} then td.AccountId not in (14,15,19,20,21,22,23) else 1=1 end ");//日本 老挝地接部专户
where.Append(" AND b." + nameof(RB_Finance.FinanceType) + "=" + model.FinanceType + "");
}
builder.AppendFormat(@"select distinct b.FrID,IFNULL(b.MatchMoney,0) as MatchMoney,IFNULL(E.TCID,0)TCID,D.Name,b.Status,b.TradeDate,b.CreateDate,b.RB_Branch_Id,a.ID,a.CostTypeId,IFNULL(b.Is_Cashier,0)Is_Cashier,a.Money,b.OrderID,b.OrderSource,b.SourceID,IFNULL(b.PayMoney,0)PayMoney,IFNULL(b.Fee,0)Fee,b.Type
from rb_financedetail a INNER JOIN rb_finance as b on a.FinanceId=b.FrID and a.`Status`=0
INNER JOIN rb_costtype AS D ON D.ID=a.CostTypeId
......
......@@ -229,6 +229,14 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0} <='{1} 23:59:59'", nameof(RB_StudyAbroad_ViewModel.CreateTime), query.EndTime);
}
if (!string.IsNullOrEmpty(query.ConfirmSTime))
{
builder.AppendFormat(" AND A.{0} >='{1}'", nameof(RB_StudyAbroad_ViewModel.ConfirmDate), query.ConfirmSTime);
}
if (!string.IsNullOrEmpty(query.ConfirmETime))
{
builder.AppendFormat(" AND A.{0} <='{1} 23:59:59'", nameof(RB_StudyAbroad_ViewModel.ConfirmDate), query.ConfirmETime);
}
return Get<RB_StudyAbroad_ViewModel>(builder.ToString(), parameters).ToList();
}
}
......
......@@ -1998,6 +1998,8 @@ namespace Edu.WebApi.Controllers.Finance
var userInfo = base.UserInfo;
string StartTime = base.ParmJObj.GetStringValue("StartTime");//开始时间
string EndTime = base.ParmJObj.GetStringValue("EndTime");//结束时间
int ClassId = base.ParmJObj.GetInt("ClassId", 0);
string ClassNo = base.ParmJObj.GetStringValue("ClassNo");//班号
if (string.IsNullOrEmpty(StartTime))
{
return ApiResult.ParamIsNull();
......@@ -2016,7 +2018,7 @@ namespace Edu.WebApi.Controllers.Finance
return ApiResult.Failed("日期格式有误,请核实后再试");
}
var Robj = financeModule.GetAllClassNowMonthStatistics(StartTime, EndTime, userInfo);
var Robj = financeModule.GetAllClassNowMonthStatistics(StartTime, EndTime, ClassId, ClassNo, userInfo);
return ApiResult.Success("", Robj);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment