Commit cc4d031f authored by liudong1993's avatar liudong1993

简易报表调整

parent 1f96fb75
This diff is collapsed.
......@@ -246,7 +246,7 @@ FROM rb_class_plan as a
LEFT JOIN rb_class c on a.ClassId = c.ClassId
LEFT JOIN rb_teacher AS T ON a.TeacherId=T.TId
LEFT JOIN rb_course as cou on cou.CourseId=c.CouseId
where a.`Status`=0 and c.ClassStatus=2 and c.`Status`=0");
where a.`Status`=0 and c.ClassStatus in(2,3) and c.`Status`=0");
if (query != null)
{
if (query.Group_Id > 0)
......
......@@ -258,11 +258,21 @@ LEFT JOIN rb_sell_commission_periods AS p ON r.PeriodId = p.Id where {where} ";
/// <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)
public List<RB_Sell_Commission_Details_ViewModel> GetSellCommissionForDate(int group_Id, int schoolId, string classIds, string startTime, string endTime)
{
string where = "";
if (!string.IsNullOrEmpty(classIds)) {
where += $@" and d.ClassId in ({classIds})";
}
if (schoolId >= 0)
{
where = $@" and c.School_Id ={schoolId}";
}
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'
left join rb_class c on d.ClassId = c.ClassId
WHERE p.Group_Id ={group_Id} {where} 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();
}
......
......@@ -353,11 +353,20 @@ where {where}";
/// <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)
public List<RB_Teaching_BonusDetail_ViewModel> GetTeacherBonusForDate(int group_Id, int schoolId, string classIds, string startTime, string endTime)
{
string where = "";
if (!string.IsNullOrEmpty(classIds)) {
where = $@" and d.ClassId in ({classIds})";
}
if (schoolId >= 0) {
where = $@" and c.School_Id ={schoolId}";
}
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'
left join rb_class c on d.ClassId = c.ClassId
WHERE p.Group_Id ={group_Id} {where} 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();
}
......
......@@ -258,10 +258,20 @@ where {where}";
/// <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)
public List<RB_Teaching_Perf_ViewModel> GetTeacherPerfForDate(int group_Id,int schoolId, string classIds, string sTime, string eTime)
{
string where = "";
if (!string.IsNullOrEmpty(classIds)) {
where = $@" and d.ClassId in ({classIds})";
}
if (schoolId >= 0)
{
where = $@" and c.School_Id ={schoolId}";//left join rb_class c on d.ClassId = c.ClassId
}
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'
left join rb_class c on d.ClassId = c.ClassId
WHERE d.Group_Id ={group_Id} {where} and d.ConfirmDate >='{sTime}' and d.ConfirmDate <='{eTime} 23:59:59'
GROUP BY d.ClassId";
return Get<RB_Teaching_Perf_ViewModel>(sql).ToList();
}
......
......@@ -235,6 +235,11 @@ WHERE {1} {2} ", TableName, where, " ORDER BY A.FrID DESC");
{
where.Append(" and IFNULL(E.TCID,0)=0");
}
if (model.TCID == -2)
{
where.Append(" and IFNULL(E.TCID,0) >0");//班级上的单据
where.Append(" and IFNULL(b.OrderID,0) =0");
}
if (model.OrderSource.HasValue)
{
where.Append(" and IFNULL(b.OrderSource,0) =" + (int)model.OrderSource);
......@@ -252,6 +257,69 @@ LEFT JOIN rb_travel_finance_relation as E ON A.FinanceId=E.FinanceId where 1=1 "
return Get<RB_Finance_Extend>(builder.ToString() + " ORDER BY b.FrID DESC ").ToList();
}
/// <summary>
/// 班级专用查询
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<RB_Finance_Extend> GetListForReportClass(RB_Finance_Extend model, string datebaseStr)
{
StringBuilder where = new StringBuilder();
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");
}
else if (model.sAduitDate.HasValue)
{
where.Append(" AND case when b.Type=2 then b." + nameof(RB_Finance.CreateDate) + ">='" + model.sAduitDate.Value.ToString("yyyy-MM-dd") + "' else b." + nameof(RB_Finance.TradeDate) + ">='" + model.sAduitDate.Value.ToString("yyyy-MM-dd") + "' end");
}
else if (model.eAduitDate.HasValue)
{
where.Append(" AND case when b.Type=2 then b." + nameof(RB_Finance.CreateDate) + "<='" + model.eAduitDate.Value.ToString("yyyy-MM-dd") + " 23:59:59' else b." + nameof(RB_Finance.TradeDate) + "<='" + model.eAduitDate.Value.ToString("yyyy-MM-dd") + " 23:59:59' end");
}
if (model.RB_Group_Id > 0)
{
where.Append(" AND b." + nameof(RB_Finance.RB_Group_Id) + "=" + model.RB_Group_Id + "");
}
if (!string.IsNullOrEmpty(model.TCIDStr))
{
where.Append(" and E.TCID in(" + model.TCIDStr + ")");
}
if (model.TCID == -1)
{
where.Append(" and IFNULL(E.TCID,0)=0");
}
if (model.TCID == -2)
{
where.Append(" and IFNULL(E.TCID,0) >0");//班级上的单据
where.Append(" and IFNULL(b.OrderID,0) =0");
}
if (model.RB_Branch_Id >= 0)
{
where.Append(" AND c.School_Id =" + model.RB_Branch_Id);
}
if (model.OrderSource.HasValue)
{
where.Append(" and IFNULL(b.OrderSource,0) =" + (int)model.OrderSource);
}
if (model.FinanceType.HasValue && model.FinanceType > 0)
{
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,IFNULL(b.OrderID,0) 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
LEFT JOIN rb_tradeway as td ON b.FrID=td.FinanceId
LEFT JOIN rb_travel_finance_relation as E ON A.FinanceId=E.FinanceId
left join {datebaseStr}.rb_class c on c.ClassId = E.TCID
where 1=1 " + where);
return Get<RB_Finance_Extend>(builder.ToString() + " ORDER BY b.FrID DESC ").ToList();
}
/// <summary>
/// 获取资金调拨 汇兑损益
/// </summary>
......
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