From 27b6937f1b299717f7f5bfdbc58119218182b98d Mon Sep 17 00:00:00 2001
From: zzj <31836194@qq.com>
Date: Thu, 25 Jan 2024 11:33:13 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=88=97=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E5=BA=94=E5=8F=91=E5=90=88=E8=AE=A1=EF=BC=8C=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E6=96=B9=E6=B3=95=E5=A4=8D=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Views/Gz_Amounts/Index.cshtml | 3 +-
.../Views/Gz_Amounts/MyAmount.cshtml | 3 +-
.../Gz_Amounts/Gz_AmountsCols.cs | 4 +
.../Gz_Amounts/Gz_AmountsService.cs | 161 ++++++++++--------
4 files changed, 99 insertions(+), 72 deletions(-)
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/Index.cshtml
index 8432d73b2..350050ed7 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/Index.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/Index.cshtml
@@ -130,9 +130,10 @@
{ prop: 'RealName', label: '职员姓名' },
{ prop: 'SendDate', label: '发放时间' },
{ prop: 'SendCount', label: '发放次数' },
- { prop: 'TotalDeduction', label: '扣款合计' },
{ prop: 'Year', label: '发放年份' },
{ prop: 'Month', label: '发放月份' },
+ { prop: 'TotalDeduction', label: '扣款合计' },
+ { prop: 'TotalPay', label: '应发合计' },
{ prop: 'TotalSend', label: '实发合计' },
{ prop: 'Remark', label: '备注' },
{ prop: 'Reviewer', label: '审核人' }
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/MyAmount.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/MyAmount.cshtml
index cdd3fc494..5454639c2 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/MyAmount.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Gz_Amounts/MyAmount.cshtml
@@ -120,9 +120,10 @@
{ prop: 'RealName', label: '职员姓名' },
{ prop: 'SendDate', label: '发放时间' },
{ prop: 'SendCount', label: '发放次数' },
- { prop: 'TotalDeduction', label: '扣款合计' },
{ prop: 'Year', label: '发放年份' },
{ prop: 'Month', label: '发放月份' },
+ { prop: 'TotalDeduction', label: '扣款合计' },
+ { prop: 'TotalPay', label: '应发合计' },
{ prop: 'TotalSend', label: '实发合计' },
{ prop: 'Remark', label: '备注' },
{ prop: 'Reviewer', label: '审核人' }
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsCols.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsCols.cs
index 43ad312ee..ea4258bfa 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsCols.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsCols.cs
@@ -47,6 +47,10 @@
///
public string TotalDeduction { get; set; }
///
+ /// 应发合计
+ ///
+ public string TotalPay{ get; set; }
+ ///
/// 实发合计
///
public string TotalSend { get; set; }
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs
index 2fd72e679..be5158694 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Gz_Amounts/Gz_AmountsService.cs
@@ -340,52 +340,17 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
monthEnd = ts.Month;
}
- var items = this.BaseRepository("CollegeMIS").FindList(x => x.IsShow == true).ToList();
-
- if (items.Any())
+ var kw = string.Empty;
+ if (!qj["keyword"].IsEmpty())
{
- var xmId = items.FirstOrDefault(x => x.Name == "职员姓名")?.Id ?? "职员姓名";
- var deptCodeId = items.FirstOrDefault(x => x.Name == "部门代码")?.Id ?? "部门代码";
- var deptId = items.FirstOrDefault(x => x.Name == "部门名称")?.Id ?? "部门名称";
- var ptcId = items.FirstOrDefault(x => x.Name == "职员类型代码")?.Id ?? "职员类型代码";
- var ptId = items.FirstOrDefault(x => x.Name == "职员类型")?.Id ?? "职员类型";
- var sendId = items.FirstOrDefault(x => x.Name == "发放时间")?.Id ?? "发放时间";
- var sendCountId = items.FirstOrDefault(x => x.Name == "发放次数")?.Id ?? "发放次数";
- var kchjId = items.FirstOrDefault(x => x.Name == "扣款合计")?.Id ?? "扣款合计";
- var sfhjId = items.FirstOrDefault(x => x.Name == "实发合计")?.Id ?? "实发合计";
- var bzId = items.FirstOrDefault(x => x.Name == "备注")?.Id ?? "备注";
- var shrId = items.FirstOrDefault(x => x.Name == "审核人")?.Id ?? "审核人";
-
- var itemId = items.Select(x => x.Id).ToArray();
-
- var q = this.BaseRepository("CollegeMIS").FindList(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.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 ?? "", TotalSendDecimal = x.FirstOrDefault(a => a.ItemId == sfhjId)?.Amount ?? 0, 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["department"].IsEmpty())
- {
- var dept = qj["department"].ToString();
- ls = ls.Where(x => x.DeptCode == dept);
- }
-
- totalSend = ls.Sum(x => x.TotalSendDecimal);
-
- var rs = ls.Skip(skip).Take(pagination.rows);
- return rs;
+ kw = qj["keyword"].ToString();
}
- else
+ var dept = string.Empty;
+ if (!qj["department"].IsEmpty())
{
- totalSend = 0;
- return new List();
+ dept = qj["department"].ToString();
}
+ return GetAmountsCols(pagination, yearStart, monthStart, yearEnd, monthEnd, string.Empty, kw, dept, out totalSend);
}
catch (Exception ex)
@@ -433,7 +398,6 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
var yearEnd = DateTime.Now.Year;
var monthEnd = DateTime.Now.Month;
- var skip = pagination.rows * (pagination.page - 1);
var qj = queryJson.ToJObject();
@@ -450,40 +414,42 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
monthEnd = ts.Month;
}
- var items = this.BaseRepository("CollegeMIS").FindList(x => x.IsShow == true).ToList();
- if (items.Any())
- {
- var xmId = items.FirstOrDefault(x => x.Name == "职员姓名")?.Id ?? "职员姓名";
- var deptCodeId = items.FirstOrDefault(x => x.Name == "部门代码")?.Id ?? "部门代码";
- var deptId = items.FirstOrDefault(x => x.Name == "部门名称")?.Id ?? "部门名称";
- var ptcId = items.FirstOrDefault(x => x.Name == "职员类型代码")?.Id ?? "职员类型代码";
- var ptId = items.FirstOrDefault(x => x.Name == "职员类型")?.Id ?? "职员类型";
- var sendId = items.FirstOrDefault(x => x.Name == "发放时间")?.Id ?? "发放时间";
- var sendCountId = items.FirstOrDefault(x => x.Name == "发放次数")?.Id ?? "发放次数";
- var kchjId = items.FirstOrDefault(x => x.Name == "扣款合计")?.Id ?? "扣款合计";
- var sfhjId = items.FirstOrDefault(x => x.Name == "实发合计")?.Id ?? "实发合计";
- var bzId = items.FirstOrDefault(x => x.Name == "备注")?.Id ?? "备注";
- var shrId = items.FirstOrDefault(x => x.Name == "审核人")?.Id ?? "审核人";
+ return GetAmountsCols(pagination, yearStart, monthStart, yearEnd, monthEnd, userNo, string.Empty, string.Empty, out var total);
- var itemId = items.Select(x => x.Id).ToArray();
+ //var items = this.BaseRepository("CollegeMIS").FindList(x => x.IsShow == true).ToList();
+ //if (items.Any())
+ //{
+ // var xmId = items.FirstOrDefault(x => x.Name == "职员姓名")?.Id ?? "职员姓名";
+ // var deptCodeId = items.FirstOrDefault(x => x.Name == "部门代码")?.Id ?? "部门代码";
+ // var deptId = items.FirstOrDefault(x => x.Name == "部门名称")?.Id ?? "部门名称";
+ // var ptcId = items.FirstOrDefault(x => x.Name == "职员类型代码")?.Id ?? "职员类型代码";
+ // var ptId = items.FirstOrDefault(x => x.Name == "职员类型")?.Id ?? "职员类型";
+ // var sendId = items.FirstOrDefault(x => x.Name == "发放时间")?.Id ?? "发放时间";
+ // var sendCountId = items.FirstOrDefault(x => x.Name == "发放次数")?.Id ?? "发放次数";
+ // var kchjId = items.FirstOrDefault(x => x.Name == "扣款合计")?.Id ?? "扣款合计";
+ // var sfhjId = items.FirstOrDefault(x => x.Name == "实发合计")?.Id ?? "实发合计";
+ // var bzId = items.FirstOrDefault(x => x.Name == "备注")?.Id ?? "备注";
+ // var shrId = items.FirstOrDefault(x => x.Name == "审核人")?.Id ?? "审核人";
- var q = this.BaseRepository("CollegeMIS").FindList(x => x.UserNo == userNo && 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 itemId = items.Select(x => x.Id).ToArray();
- var query = q.GroupBy(x => new { x.UserNo, x.Year, x.Month });
- pagination.records = query.Count();
+ // var q = this.BaseRepository("CollegeMIS").FindList(x => x.UserNo == userNo && 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 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 ?? "", TotalSendDecimal = x.FirstOrDefault(a => a.ItemId == sfhjId)?.Amount ?? 0, Remark = x.FirstOrDefault(a => a.ItemId == bzId)?.OriVal ?? "", Reviewer = x.FirstOrDefault(a => a.ItemId == shrId)?.OriVal ?? "" });
+ // var query = q.GroupBy(x => new { x.UserNo, x.Year, x.Month });
+ // pagination.records = query.Count();
+ // 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 ?? "", TotalSendDecimal = x.FirstOrDefault(a => a.ItemId == sfhjId)?.Amount ?? 0, Remark = x.FirstOrDefault(a => a.ItemId == bzId)?.OriVal ?? "", Reviewer = x.FirstOrDefault(a => a.ItemId == shrId)?.OriVal ?? "" });
- var rs = ls.Skip(skip).Take(pagination.rows);
- return rs;
- }
- else
- {
- pagination.records = 0;
- return new List();
- }
+
+ // var rs = ls.Skip(skip).Take(pagination.rows);
+ // return rs;
+ //}
+ //else
+ //{
+ // pagination.records = 0;
+ // return new List();
+ //}
}
catch (Exception ex)
{
@@ -497,6 +463,61 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
}
}
}
+
+ private List GetAmountsCols(Pagination pagination, int yearStart, int monthStart, int yearEnd, int monthEnd, string userNo, string kw, string dept, out decimal total)
+ {
+ var items = this.BaseRepository("CollegeMIS").FindList(x => x.IsShow == true).ToList();
+ var skip = pagination.rows * (pagination.page - 1);
+
+ if (items.Any())
+ {
+ var xmId = items.FirstOrDefault(x => x.Name == "职员姓名")?.Id ?? "职员姓名";
+ var deptCodeId = items.FirstOrDefault(x => x.Name == "部门代码")?.Id ?? "部门代码";
+ var deptId = items.FirstOrDefault(x => x.Name == "部门名称")?.Id ?? "部门名称";
+ var ptcId = items.FirstOrDefault(x => x.Name == "职员类型代码")?.Id ?? "职员类型代码";
+ var ptId = items.FirstOrDefault(x => x.Name == "职员类型")?.Id ?? "职员类型";
+ var sendId = items.FirstOrDefault(x => x.Name == "发放时间")?.Id ?? "发放时间";
+ var sendCountId = items.FirstOrDefault(x => x.Name == "发放次数")?.Id ?? "发放次数";
+ var kchjId = items.FirstOrDefault(x => x.Name == "扣款合计")?.Id ?? "扣款合计";
+ var sfhjId = items.FirstOrDefault(x => x.Name == "实发合计")?.Id ?? "实发合计";
+ var yfhjId = items.FirstOrDefault(x => x.Name == "应发合计")?.Id ?? "应发合计";
+ var bzId = items.FirstOrDefault(x => x.Name == "备注")?.Id ?? "备注";
+ var shrId = items.FirstOrDefault(x => x.Name == "审核人")?.Id ?? "审核人";
+
+ var itemId = items.Select(x => x.Id).ToArray();
+
+ var q = this.BaseRepository("CollegeMIS").FindList(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))));
+
+ if (!userNo.IsEmpty())
+ {
+ q = q.Where(x => x.UserNo == userNo);
+ }
+
+ var query = q.GroupBy(x => new { x.UserNo, x.Year, x.Month });
+ pagination.records = query.Count();
+
+ 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 ?? "", TotalSendDecimal = x.FirstOrDefault(a => a.ItemId == sfhjId)?.Amount ?? 0, Remark = x.FirstOrDefault(a => a.ItemId == bzId)?.OriVal ?? "", Reviewer = x.FirstOrDefault(a => a.ItemId == shrId)?.OriVal ?? "", TotalPay = x.FirstOrDefault(a => a.ItemId == yfhjId)?.OriVal ?? "" });
+
+ if (!kw.IsEmpty())
+ {
+ ls = ls.Where(x => x.UserNo.Contains(kw) || x.RealName.Contains(kw));
+ }
+ if (!dept.IsEmpty())
+ {
+ ls = ls.Where(x => x.DeptCode == dept);
+ }
+
+ total = ls.Sum(x => x.TotalSendDecimal);
+
+ var rs = ls.Skip(skip).Take(pagination.rows).ToList();
+ return rs;
+ }
+ else
+ {
+ total = 0;
+ return new List();
+ }
+ }
#endregion
}
}