@@ -318,12 +318,27 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
{
try
{
var yearStart = DateTime.Now.Year;
var monthStart = DateTime.Now.Month;
var yearEnd = DateTime.Now.Year;
var monthEnd = DateTime.Now.Month;
var skip = pagination.rows * (pagination.page - 1);
var qj = queryJson.ToJObject();
var year = Convert.ToInt32(qj["Year"]);
var month= Convert.ToInt32(qj["Month"]);
if(!qj["time1"].IsEmpty())
{
var ts = Convert.ToDateTime(qj["time1"]);
yearStart = ts.Year;
monthStart = ts.Month;
}
if (!qj["time2"].IsEmpty())
{
var ts = Convert.ToDateTime(qj["time2"]);
yearEnd = ts.Year;
monthEnd = ts.Month;
}
var items = this.BaseRepository("CollegeMIS").FindList<Gz_ItemsEntity>(x => x.IsShow == true).ToList();
@@ -341,12 +356,26 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
var itemId = items.Select(x => x.Id).ToArray();
var query = this.BaseRepository("CollegeMIS").FindList<Gz_AmountsEntity>(x => itemId.Contains(x.ItemId) && x.Year == year && x.Month == month).GroupBy(x => new { x.UserNo, x.Year, x.Month });
var q = this.BaseRepository("CollegeMIS").FindList<Gz_AmountsEntity>(x => itemId.Contains(x.ItemId) && ((yearStart==yearEnd && x.Year==yearStart && x.Month>=monthStart && x.Month<=monthEnd) ||(yearStart<yearEnd &&(x.Year==yearStart && x.Month>=monthStart) || (x.Year==yearEnd && x.Month<=monthEnd) || (x.Year>yearStart && x.Year<yearEnd))));
var query = q.GroupBy(x => new { x.UserNo, x.Year, x.Month });
pagination.records = query.Count();
var ls = query.Skip(skip).Take(pagination.rows).Select(x=>new Gz_AmountsCols {UserNo=x.Key.UserNo,Year=x.Key.Year??0,Month=x.Key.Month??0 ,RealName=x.FirstOrDefault(a=>a.ItemId==xmId)?.OriVal??"",DeptCode= x.FirstOrDefault(a => a.ItemId == deptCodeId)?.OriVal ?? "", DeptName= x.FirstOrDefault(a => a.ItemId == deptId)?.OriVal ?? "", PersonTypeCode= x.FirstOrDefault(a => a.ItemId == ptcId)?.OriVal ?? "", PersonType= x.FirstOrDefault(a => a.ItemId == ptId)?.OriVal ?? "", SendDate= x.FirstOrDefault(a => a.ItemId == sendId)?.OriVal ?? "", SendCount= x.FirstOrDefault(a => a.ItemId == sendCountId)?.OriVal ?? "", TotalDeduction= x.FirstOrDefault(a => a.ItemId == kchjId)?.OriVal ?? "", TotalSend= x.FirstOrDefault(a => a.ItemId == sfhjId)?.OriVal ?? "", Remark= x.FirstOrDefault(a => a.ItemId == bzId)?.OriVal ?? "", Reviewer= x.FirstOrDefault(a => a.ItemId == shrId)?.OriVal ?? "" }).ToList();
var ls = query.Select(x=>new Gz_AmountsCols {UserNo=x.Key.UserNo,Year=x.Key.Year??0,Month=x.Key.Month??0 ,RealName=x.FirstOrDefault(a=>a.ItemId==xmId)?.OriVal??"",DeptCode= x.FirstOrDefault(a => a.ItemId == deptCodeId)?.OriVal ?? "", DeptName= x.FirstOrDefault(a => a.ItemId == deptId)?.OriVal ?? "", PersonTypeCode= x.FirstOrDefault(a => a.ItemId == ptcId)?.OriVal ?? "", PersonType= x.FirstOrDefault(a => a.ItemId == ptId)?.OriVal ?? "", SendDate= x.FirstOrDefault(a => a.ItemId == sendId)?.OriVal ?? "", SendCount= x.FirstOrDefault(a => a.ItemId == sendCountId)?.OriVal ?? "", TotalDeduction= x.FirstOrDefault(a => a.ItemId == kchjId)?.OriVal ?? "", TotalSend= x.FirstOrDefault(a => a.ItemId == sfhjId)?.OriVal ?? "", Remark= x.FirstOrDefault(a => a.ItemId == bzId)?.OriVal ?? "", Reviewer= x.FirstOrDefault(a => a.ItemId == shrId)?.OriVal ?? "" });
if(!qj["keyword"].IsEmpty())
{
var k = qj["keyword"].ToString();
ls = ls.Where(x => x.UserNo.Contains(k) || x.RealName.Contains(k));
}
if(!qj["value"].IsEmpty())
{
var dept = qj["value"].ToString();
ls = ls.Where(x => x.DeptCode == dept);
}
return ls;
var rs = ls.Skip(skip).Take(pagination.rows);
return rs;
}
catch (Exception ex)