// GET: PersonnelSettlement/PersonnelSettlement/Details/5 public JsonResult Details(string loginid, string types, string PersonSettlementID) { if (!string.IsNullOrEmpty(loginid)) { ViewBag.LoginID = loginid; } else { ViewBag.LoginID = ""; } if (!string.IsNullOrEmpty(types)) { ViewBag.Type = types; } else { ViewBag.Type = ""; } string JsonStr = string.Empty; //只查询当前日期中月的记录 PersonSettlement model = personnelSettDAL.GetModelByParam(PersonSettlementID); if (model != null) { JsonStr = leaveDetailDAL.GetModelListJSON(PersonSettlementID, model.SettlementDate.Month); } return(Json(JsonStr)); }
public ActionResult PersonSettl(string loginid, int PersonID, int CustomerID, int OutCompanyID, int page = 1) { if (!string.IsNullOrEmpty(loginid)) { ViewBag.LoginID = loginid; } else { ViewBag.LoginID = ""; } CustomerOutsourc custOut = custOutDAL.GetModelByID(Convert.ToInt32(loginid)); if (custOut != null) { ViewBag.Type = custOut.Type; } ViewBag.PersonID = PersonID; ViewBag.CustomerID = CustomerID; ViewBag.OutCompanyID = OutCompanyID; Models.PersonSettlViewModel viewModel = new Models.PersonSettlViewModel(); DateTime now = DateTime.Now; DateTime d1 = new DateTime(now.Year, now.Month, 1); //当月第一天 DateTime d2 = d1.AddMonths(1).AddDays(-1); //当月最后一天 long workDays = dateDiff(d1, d2); //获取当前月工作天数 viewModel.StartDate = d1.ToString("yyyy-MM-dd"); viewModel.EndDate = d2.ToString("yyyy-MM-dd"); viewModel.workDays = workDays; PersonSettlement model = personnelSettDAL.GetModelByParam(PersonID, OutCompanyID, CustomerID, d1); if (model == null) { model = new PersonSettlement(); model.ID = Guid.NewGuid().ToString(); model.PersonID = PersonID; model.CustomerID = CustomerID; model.OutCompanyID = OutCompanyID; model.WorkDays = (int)workDays; model.SettlementDate = DateTime.Now; model.Wages = (double)personEntryDAL.GetModelBy(PersonID, CustomerID, OutCompanyID).EntryMoney; personnelSettDAL.Insert(model); } //else //{ //} viewModel.LeaveDetail = model.LeaveDetail.OrderBy(m => m.LeaveStartDate).ToPagedList <LeaveDetail>(page, 8); viewModel.Money = model.Wages; ViewBag.PersonSettlementID = model.ID; return(View(viewModel)); }
public ActionResult SettlementPerson(string loginid, string type, string PersonSettlementID, int page) { if (!string.IsNullOrEmpty(loginid)) { ViewBag.LoginID = loginid; } else { ViewBag.LoginID = ""; } if (!string.IsNullOrEmpty(type)) { ViewBag.Type = type; } else { ViewBag.Type = ""; } ViewBag.QueryMonth = Request["isQueryCurrentMonth"]; //只查询当前日期中月的记录 PersonSettlement model = personnelSettDAL.GetModelByParam(PersonSettlementID); if (model != null) { #region 计算考勤工资 const double HourByDay = 0.125; //8小时按1天算 float leaveDays = 0f, leaveTotalMoney = 0f; //事假小时与事假被扣总金额; float overTimesPremium = 0f, overTimePremiumTotalMoney = 0f; //加班补助金额和加班时间; float LeaveOffDay = 0f, LeaveOffDayTotalMoney = 0f; //事假(调休)的时长和金额 float overTimes = 0f, overTimesTotalMoney = 0f; // 加班时长和加班金额; //统计考勤中的加班与请假天数 foreach (var item in leaveDetailDAL.GetModelList(HttpUtility.HtmlEncode(PersonSettlementID), model.SettlementDate.Month)) { switch (item.LeaveType) { case 1: //事假 leaveDays += (float)item.LeaveHours; leaveTotalMoney += (float)item.LeaveMoney; break; case 2: //加班补助 overTimesPremium += (float)item.LeaveHours; overTimePremiumTotalMoney += (float)item.LeaveMoney; break; case 3: //事假调休 LeaveOffDay += (float)item.LeaveHours; LeaveOffDayTotalMoney += (float)item.LeaveMoney; break; case 4: //加班 overTimes += (float)item.LeaveHours; overTimesTotalMoney += (float)item.LeaveMoney; break; } } //工资结算中只包含加班补助和事假工资计算; // 计算请假天数=请假天数+调休天数 model.LeaveDays = leaveDays == 0 ? 0 : Math.Round((leaveDays + LeaveOffDay) * HourByDay, 2); //计算加班天数 model.OvertimeDays = overTimes == 0 ? 0 : Math.Round(overTimes * HourByDay, 2); //计算实际工作日=本月工作日-(请假时间+调休时间)*时间基数 model.RealWorkDays = Math.Round(model.WorkDays - (leaveDays + LeaveOffDay) * HourByDay, 2); //到手工资=应得工资+加班补助+事假工资 model.RealWages = Math.Round(model.Wages + overTimePremiumTotalMoney + leaveTotalMoney, 2);//计算请假后的工资; personnelSettDAL.Update(model); #endregion } return(RedirectToAction("PersonResignedSettlement", new { loginid = loginid, type = type, page = page, isQueryCurrentMonth = ViewBag.QueryMonth })); //return View(); }
public ActionResult SetResignedDate(string loginid, int ID, DateTime ResignedDate, int pageIndex) { if (!string.IsNullOrEmpty(loginid)) { ViewBag.LoginID = loginid; } else { ViewBag.LoginID = ""; } CustomerOutsourc custOut = custOutDAL.GetModelByID(Convert.ToInt32(loginid)); if (custOut != null) { ViewBag.Type = custOut.Type; } PersonsEntrySet personEntry = personEntryDAL.GetModelBy(ID); if (personEntry != null) { personEntry.ResignedDate = ResignedDate; personEntry.EntryStatus = 1; personEntryDAL.Update(personEntry); //离职后更改个人信息中个人状态 PersonalInfo person = personInfoDAL.GetPersonalInfo(personEntry.PersonalInfoId); if (person != null) { person.PeopleStatue = 1; personInfoDAL.Update(person); } //离职后直接结算个人账务 DateTime d1 = new DateTime(ResignedDate.Year, ResignedDate.Month, 1); //当月第一天 DateTime d2 = d1.AddMonths(1).AddDays(-1); //当月最后一天 long workDays = dateDiff(d1, d2); //本月工作日 long RealworkDays = dateDiff(d1, ResignedDate); //本月实际工作日 //通过参数获取个人结算表中当月是否有记录 PersonSettlement model = personnelSettDAL.GetModelByParam(personEntry.PersonalInfoId, personEntry.OutsourcingCompanyCompnayId, personEntry.CustomerCompnayCompnayId, ResignedDate); if (model == null)//没有就添加 { model = new PersonSettlement(); model.ID = Guid.NewGuid().ToString(); model.PersonID = personEntry.PersonalInfoId; model.CustomerID = personEntry.CustomerCompnayCompnayId; model.OutCompanyID = personEntry.OutsourcingCompanyCompnayId; } model.WorkDays = (int)workDays; model.SettlementDate = ResignedDate; model.Wages = (double)personEntryDAL.GetModelBy(personEntry.PersonalInfoId, personEntry.CustomerCompnayCompnayId, personEntry.OutsourcingCompanyCompnayId).EntryMoney; if (model == null) { personnelSettDAL.Insert(model); } #region 计算考勤工资 const double HourByDay = 0.125; //8小时按1天算 //工作日-实际出勤日=请假日或未上班的天数 double leaveDays = (workDays - RealworkDays) * 8; //事假小时与事假被扣总金额; double leaveTotalMoney = ((model.Wages / workDays) / 8 * leaveDays) * -1; float overTimesPremium = 0f, overTimePremiumTotalMoney = 0f; //加班补助金额和加班时间; float LeaveOffDay = 0f, LeaveOffDayTotalMoney = 0f; //事假(调休)的时长和金额 float overTimes = 0f, overTimesTotalMoney = 0f; // 加班时长和加班金额; #region 统计考勤中的加班与请假天数 foreach (var item in leaveDetailDAL.GetModelList(model.ID, model.SettlementDate.Month)) { switch (item.LeaveType) { case 1: //事假 leaveDays += (float)item.LeaveHours; leaveTotalMoney += (float)item.LeaveMoney; break; case 2: //加班补助 overTimesPremium += (float)item.LeaveHours; overTimePremiumTotalMoney += (float)item.LeaveMoney; break; case 3: //事假调休 LeaveOffDay += (float)item.LeaveHours; LeaveOffDayTotalMoney += (float)item.LeaveMoney; break; case 4: //加班 overTimes += (float)item.LeaveHours; overTimesTotalMoney += (float)item.LeaveMoney; break; } } #endregion //工资结算中只包含加班补助和事假工资计算; // 计算请假天数=请假天数+调休天数 model.LeaveDays = leaveDays == 0 ? 0 : Math.Round((leaveDays + LeaveOffDay) * HourByDay, 2); //计算加班天数 model.OvertimeDays = overTimes == 0 ? 0 : Math.Round(overTimes * HourByDay, 2); //计算实际工作日=本月工作日-(请假时间+调休时间)*时间基数 model.RealWorkDays = Math.Round(model.WorkDays - (leaveDays + LeaveOffDay) * HourByDay, 2); //到手工资=应得工资+加班补助+事假工资 model.RealWages = Math.Round(model.Wages + overTimePremiumTotalMoney + leaveTotalMoney, 2);//计算请假后的工资; personnelSettDAL.Update(model); #endregion } string url = string.Format("loginid={0}&page={1}", loginid, pageIndex); return(Content(url)); }