20230607新增月报费用取值,上报集团报表(月报)默认自动取值功能新增
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -451,31 +452,94 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static Model.SeDinMonthReport6Item getSeDinMonthReportNullPage6(string projectId, string month, string startDate, string endDate)
|
||||
{
|
||||
var startDateD = Funs.GetNewDateTime(startDate);
|
||||
var endDateD = Funs.GetNewDateTime(endDate);
|
||||
var getLists = new Model.SeDinMonthReport6Item
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
SafetyMonth = 0,
|
||||
SafetyYear = 0,
|
||||
SafetyTotal = 0,
|
||||
LaborMonth = 0,
|
||||
LaborYear = 0,
|
||||
LaborTotal = 0,
|
||||
ProgressMonth = 0,
|
||||
ProgressYear = 0,
|
||||
ProgressTotal = 0,
|
||||
EducationMonth = 0,
|
||||
EducationYear = 0,
|
||||
EducationTotal = 0,
|
||||
SumMonth = 0,
|
||||
SumYear = 0,
|
||||
SumTotal = 0,
|
||||
ContractMonth = 0,
|
||||
ContractYear = 0,
|
||||
ContractTotal = 0,
|
||||
ConstructionCost = 0,
|
||||
};
|
||||
return getLists;
|
||||
var startDateD = Funs.GetNewDateTime(startDate);
|
||||
var endDateD = Funs.GetNewDateTime(endDate);
|
||||
DateTime monthD = Funs.GetNewDateTimeOrNow(month);
|
||||
var getLists = new Model.SeDinMonthReport6Item();
|
||||
///当月费用
|
||||
var getCostManage = from x in db.CostGoods_CostManageItem
|
||||
join y in db.CostGoods_CostManage on x.CostManageId equals y.CostManageId
|
||||
where y.ProjectId ==projectId && y.CostManageDate >= startDateD && y.CostManageDate < endDateD.Value.AddDays(1)
|
||||
&& y.States == Const.State_2
|
||||
select x;
|
||||
if (getCostManage.Count() > 0)
|
||||
{
|
||||
var getData1 = getCostManage.Where(x => x.SupSortIndex == 1);
|
||||
if (getData1.Count() > 0)
|
||||
{
|
||||
getLists.SafetyMonth = getLists.SafetyYear = getLists.SafetyTotal = getData1.Sum(x => x.PriceMoney ?? 0);
|
||||
}
|
||||
var getData2 = getCostManage.Where(x => x.SupSortIndex == 2);
|
||||
if (getData2.Count() > 0)
|
||||
{
|
||||
getLists.LaborMonth = getLists.LaborYear = getLists.LaborTotal = getData2.Sum(x => x.PriceMoney ?? 0);
|
||||
}
|
||||
var getData3 = getCostManage.Where(x => x.SupSortIndex == 3);
|
||||
if (getData3.Count() > 0)
|
||||
{
|
||||
getLists.ProgressMonth = getLists.ProgressYear = getLists.ProgressTotal = getData3.Sum(x => x.PriceMoney ?? 0);
|
||||
}
|
||||
var getData4 = getCostManage.Where(x => x.SupSortIndex == 4);
|
||||
if (getData4.Count() > 0)
|
||||
{
|
||||
getLists.EducationMonth = getLists.EducationYear = getLists.EducationTotal = getData4.Sum(x => x.PriceMoney ?? 0);
|
||||
}
|
||||
|
||||
getLists.SumMonth = getLists.SumYear = getLists.SumTotal = getLists.SafetyMonth + getLists.LaborMonth + getLists.ProgressMonth + getLists.EducationMonth;
|
||||
}
|
||||
|
||||
///上月费用
|
||||
var getMonthReport = db.SeDin_MonthReport.FirstOrDefault(x => x.ProjectId == projectId && x.ReporMonth == monthD.AddMonths(-1));
|
||||
if (getMonthReport != null)
|
||||
{
|
||||
var getLastMonthReport6 = db.SeDin_MonthReport6.FirstOrDefault(x => x.MonthReportId == getMonthReport.MonthReportId);
|
||||
if (getLastMonthReport6 != null)
|
||||
{
|
||||
if (getMonthReport.ReporMonth.Value.Year == monthD.Year)
|
||||
{
|
||||
if (monthD >= Funs.GetNewDateTime("2023-07-01"))
|
||||
{
|
||||
getLists.SafetyYear += getLastMonthReport6.SafetyYear;
|
||||
getLists.SafetyTotal += getLastMonthReport6.SafetyTotal;
|
||||
getLists.ProgressYear += getLastMonthReport6.ProgressYear;
|
||||
getLists.ProgressTotal += getLastMonthReport6.ProgressTotal;
|
||||
getLists.EducationYear += getLastMonthReport6.EducationYear;
|
||||
getLists.EducationTotal += getLastMonthReport6.EducationTotal;
|
||||
}
|
||||
else
|
||||
{
|
||||
getLists.SafetyYear += (getLastMonthReport6.SafetyYear + getLastMonthReport6.ProgressYear + getLastMonthReport6.EducationYear);
|
||||
getLists.SafetyTotal += (getLastMonthReport6.SafetyTotal + getLastMonthReport6.ProgressTotal + getLastMonthReport6.EducationTotal);
|
||||
}
|
||||
getLists.LaborYear += getLastMonthReport6.LaborYear;
|
||||
getLists.LaborTotal += getLastMonthReport6.LaborTotal;
|
||||
getLists.SumYear += getLastMonthReport6.SumYear;
|
||||
getLists.SumTotal += getLastMonthReport6.SumTotal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (monthD >= Funs.GetNewDateTime("2023-07-01"))
|
||||
{
|
||||
getLists.SafetyTotal += getLastMonthReport6.SafetyTotal;
|
||||
getLists.ProgressTotal += getLastMonthReport6.ProgressTotal;
|
||||
getLists.EducationTotal += getLastMonthReport6.EducationTotal;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
getLists.SafetyTotal += (getLastMonthReport6.SafetyTotal + getLastMonthReport6.ProgressTotal + getLastMonthReport6.EducationTotal);
|
||||
|
||||
}
|
||||
getLists.LaborTotal += getLastMonthReport6.LaborTotal;
|
||||
getLists.SumTotal += getLastMonthReport6.SumTotal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getLists;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 获取赛鼎月报初始化页面 --7、项目HSE培训统计
|
||||
|
||||
Reference in New Issue
Block a user