using Learun.Util;
using System.Data;
using Learun.Application.TwoDevelopment.PersonnelManagement;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;
namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
{
///
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
/// 创 建:超级管理员
/// 日 期:2021-04-21 15:42
/// 描 述:工资条
///
public class Emp_PayrollController : MvcControllerBase
{
private Emp_PayrollIBLL emp_PayrollIBLL = new Emp_PayrollBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
///
/// 工资条统计
///
///
[HttpGet]
public ActionResult StatisticIndex()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 分页参数
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = emp_PayrollIBLL.GetPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取表单数据
///
/// 主键
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var EMP_PayrollData = emp_PayrollIBLL.GetEMP_PayrollEntity(keyValue);
var jsonData = new
{
EMP_Payroll = EMP_PayrollData,
};
return Success(jsonData);
}
///
/// 获取页面显示列表数据
///
/// 分页参数
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetStatisticList(string queryJson)
{
var data = emp_PayrollIBLL.GetList(queryJson);
var datagroup = data.GroupBy(x => new { x.IssueMonth, x.IssueYear }).Select(x => new EMP_PayrollEntity
{
IssueYear = x.Key.IssueYear,
IssueMonth = x.Key.IssueMonth,
PostSalary = x.Select(y => y.PostSalary.ToDecimal()).Sum().ToString(),
PayWages = x.Select(y => y.PayWages.ToDecimal()).Sum().ToString(),
UpTenpercent = x.Select(y => y.UpTenpercent.ToDecimal()).Sum().ToString(),
SchoolSub = x.Select(y => y.SchoolSub.ToDecimal()).Sum().ToString(),
TemporarySub = x.Select(y => y.TemporarySub.ToDecimal()).Sum().ToString(),
RankWage = x.Select(y => y.RankWage.ToDecimal()).Sum().ToString(),
DifferentialSub = x.Select(y => y.DifferentialSub.ToDecimal()).Sum().ToString(),
MeritPay = x.Select(y => y.MeritPay.ToDecimal()).Sum().ToString(),
MeritPayLess = x.Select(y => y.MeritPayLess.ToDecimal()).Sum().ToString(),
MonthlyoneMerit = x.Select(y => y.MonthlyoneMerit.ToDecimal()).Sum().ToString(),
Tilt = x.Select(y => y.Tilt.ToDecimal()).Sum().ToString(),
Classfees = x.Select(y => y.Classfees.ToDecimal()).Sum().ToString(),
SuperClass = x.Select(y => y.SuperClass.ToDecimal()).Sum().ToString(),
TrainingDollars = x.Select(y => y.TrainingDollars.ToDecimal()).Sum().ToString(),
Bonus = x.Select(y => y.Bonus.ToDecimal()).Sum().ToString(),
BabySubsidies = x.Select(y => y.BabySubsidies.ToDecimal()).Sum().ToString(),
ClassTeacher = x.Select(y => y.ClassTeacher.ToDecimal()).Sum().ToString(),
KeyBenefits = x.Select(y => y.KeyBenefits.ToDecimal()).Sum().ToString(),
PositionFill = x.Select(y => y.PositionFill.ToDecimal()).Sum().ToString(),
OvertimePay = x.Select(y => y.OvertimePay.ToDecimal()).Sum().ToString(),
OnDutyfee = x.Select(y => y.OnDutyfee.ToDecimal()).Sum().ToString(),
ExaminationFee = x.Select(y => y.ExaminationFee.ToDecimal()).Sum().ToString(),
SecurityPay = x.Select(y => y.SecurityPay.ToDecimal()).Sum().ToString(),
MedicalBills = x.Select(y => y.MedicalBills.ToDecimal()).Sum().ToString(),
CoolingPurposes = x.Select(y => y.CoolingPurposes.ToDecimal()).Sum().ToString(),
HousSub = x.Select(y => y.HousSub.ToDecimal()).Sum().ToString(),
PropertySub = x.Select(y => y.PropertySub.ToDecimal()).Sum().ToString(),
HeatingSub = x.Select(y => y.HeatingSub.ToDecimal()).Sum().ToString(),
ComprehensiveSub = x.Select(y => y.ComprehensiveSub.ToDecimal()).Sum().ToString(),
ControlSub = x.Select(y => y.ControlSub.ToDecimal()).Sum().ToString(),
Replacement = x.Select(y => y.Replacement.ToDecimal()).Sum().ToString(),
SendSum = x.Select(y => y.SendSum.ToDecimal()).Sum().ToString(),
LossInsurance = x.Select(y => y.LossInsurance.ToDecimal()).Sum().ToString(),
Bartender = x.Select(y => y.Bartender.ToDecimal()).Sum().ToString(),
OcPension = x.Select(y => y.OcPension.ToDecimal()).Sum().ToString(),
HousFund = x.Select(y => y.HousFund.ToDecimal()).Sum().ToString(),
HealthCare = x.Select(y => y.HealthCare.ToDecimal()).Sum().ToString(),
TheRent = x.Select(y => y.TheRent.ToDecimal()).Sum().ToString(),
InternetFee = x.Select(y => y.InternetFee.ToDecimal()).Sum().ToString(),
AssDeductions = x.Select(y => y.AssDeductions.ToDecimal()).Sum().ToString(),
OtherDeductions = x.Select(y => y.OtherDeductions.ToDecimal()).Sum().ToString(),
WithBuckletax = x.Select(y => y.WithBuckletax.ToDecimal()).Sum().ToString(),
DeductionsSum = x.Select(y => y.DeductionsSum.ToDecimal()).Sum().ToString(),
TaxRevenue = x.Select(y => y.TaxRevenue.ToDecimal()).Sum().ToString(),
TaxIncome = x.Select(y => y.TaxIncome.ToDecimal()).Sum().ToString(),
NetCombined = x.Select(y => y.NetCombined.ToDecimal()).Sum().ToString()
}).OrderByDescending(x => x.IssueYear).ThenByDescending(x => x.IssueMonth);
return Success(datagroup);
}
#endregion
#region 提交数据
///
/// 删除实体数据
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
emp_PayrollIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改)
///
/// 主键
/// 实体
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string strEntity)
{
EMP_PayrollEntity entity = strEntity.ToObject();
emp_PayrollIBLL.SaveEntity(keyValue, entity);
if (string.IsNullOrEmpty(keyValue))
{
}
return Success("保存成功!");
}
#endregion
}
}