private MonthSalaryClass GetEmpSalary(Model.Employee emp) { int mTemp = 0; int mHicount = 0; int mTimeBonus = 0; //统计满足<时数补贴>的次数 double mLateHalfCount = 0; StringBuilder strBU = new StringBuilder(); int totalDay = DateTime.DaysInMonth(hryear, hrmonth); MonthSalaryClass _ms; ////////////////////////////////////////////////////////////////// _ms = new MonthSalaryClass(); _ms.mIdentifyDate = new DateTime(hryear, hrmonth, 1); _ms.mEmployeeId = emp.EmployeeId; _ms.mEmployeeName = emp.EmployeeName; _ms.mIDNo = emp.IDNo; _ms.mDepartmetName = emp.Department == null ? "" : emp.Department.DepartmentName; #region 取考勤记录 //全勤天数 int attendDays = 0; //加班天数 int overDays = 0; //无薪假天数 double noPayleaveDays = 0; //实际上班时间 double onWorkHours = 0; //全勤,公假,年假,周末,週六休假,隔周休天数 int hasPayDays = 0; //请假的天数 int halfDays = 0; //请半天的日基数总和 double halfDayFactors = 0; //请半天的班别津贴 double halfSpecialBonus = 0; //外劳请假天数 double MigrantWorkerLeaveDays = 0; //出勤半天的天数 double halfattend = 0; //周末天数 int WeekendDays = 0; //时数补贴事假,病假,曠職,婚假,特殊休(有薪) 喪假扣减 double TimeBonus = 0; //旷职扣减 double Kuangzhi = 0; //婚假,丧假,产假计算到底薪的出勤日中 double hunSangChan = 0; //隔周休假 double gezhouxiu = 0; //公假 ,年假,出差 天数 double gnDays = 0; //周六天数 int saturdays = 0; foreach (Model.HrDailyEmployeeAttendInfo attend in this._hrManager.SelectByEmpMonth(emp, hryear, hrmonth)) { if (attend.LateInMinute.HasValue && attend.LateInMinute.Value != 0) { strBU.Append(attend.LateInMinute.ToString() + "|"); mTemp = mTemp + attend.LateInMinute.Value; //if (mTemp <= 10) //{ // mCount = mCount + 1; //} if (attend.LateInMinute.Value > 30) { mHicount = mHicount + 1; if ((attend.LateInMinute.Value + 30) % 60 > 30) { mLateHalfCount = mLateHalfCount + (attend.LateInMinute.Value + 30) / 60 + 0.5; } else { mLateHalfCount = mLateHalfCount + (attend.LateInMinute.Value + 30) / 60; } } //在职务津贴扣除符合条件假期 } _ms.mNote = attend.Note; if (!string.IsNullOrEmpty(_ms.mNote)) { if (_ms.mNote != "週日休假" && _ms.mNote != "周日休假" && _ms.mNote.IndexOf("公假") < 0 && _ms.mNote.IndexOf("婚假") < 0 && _ms.mNote.IndexOf("喪假") < 0 && _ms.mNote.IndexOf("年假") < 0 && _ms.mNote.IndexOf("出差") < 0 && _ms.mNote.IndexOf("遲到") < 0) { _ms.mCount = _ms.mCount + 1; } else if (_ms.mNote.Contains("事假") || _ms.mNote.Contains("病假")) { _ms.mCount = _ms.mCount + 1; } //if (_ms.mNote.Contains("無薪假") && !(bool)emp.IsCadre && !emp.IsMigrantWorker) if (_ms.mNote.Contains("無薪假") && !Convert.ToBoolean(emp.IsCadre)) { if (_ms.mNote.Contains("整日")) { noPayleaveDays++; } else { noPayleaveDays += 0.5; } } //if (_ms.mNote.Contains("公假") || _ms.mNote == "週日休假" || _ms.mNote == "周日休假" || _ms.mNote.Contains("年假") || _ms.mNote.Contains("出差") || (_ms.mNote.Contains("週六休假") && (emp.IDNo.ToUpper().StartsWith("J") || emp.IDNo.ToUpper().StartsWith("O")))) if (_ms.mNote.Contains("公假") || _ms.mNote == "週日休假" || _ms.mNote == "周日休假" || _ms.mNote.Contains("年假") || _ms.mNote.Contains("出差") || (_ms.mNote.Contains("週六休假"))) { hasPayDays++; if (_ms.mNote == "週日休假" || _ms.mNote == "周日休假") { WeekendDays++; } if (_ms.mNote.Contains("週六休假")) { saturdays++; } if (_ms.mNote.Contains("公假") || _ms.mNote.Contains("年假") || _ms.mNote.Contains("出差")) { if (_ms.mNote.Contains("整日")) { gnDays++; } //else //{ // if (_ms.mNote.Contains("公假") && _ms.mNote.Contains("年假")) // gnDays++; // else // gnDays += 0.5; //} } } //if (_ms.mNote.Contains("隔周休假") && emp.GeZhouChuQinJJ) // hasPayDays++; if (_ms.mNote.Contains("隔周休假")) { gezhouxiu++; if (emp.GeZhouChuQinJJ) { hasPayDays++; } } if (_ms.mNote.Contains("上半日") || _ms.mNote.Contains("下半日") || _ms.mNote.Contains("整日")) { if (!_ms.mNote.Contains("曠職")) { if (!_ms.mNote.Contains("無薪假")) { halfDays++; halfDayFactors += Convert.ToDouble(attend.DayFactor); } if (_ms.mNote.Contains("整日")) { MigrantWorkerLeaveDays++; } else { MigrantWorkerLeaveDays += 0.5; } } if (((_ms.mNote.Contains("上半日") && !_ms.mNote.Contains("下半日")) || (!_ms.mNote.Contains("上半日") && _ms.mNote.Contains("下半日"))) && !_ms.mNote.Contains("卻刷卡資料")) { onWorkHours += 4; halfattend += 0.5; } } if (_ms.mNote.Contains("上半日") || _ms.mNote.Contains("下半日")) { halfSpecialBonus += Convert.ToDouble(attend.SpecialBonus); } //if (VPerson.specialEmpOfAttendJJ.Contains(emp.EmployeeId) && this.hrSpecificHolidayManager.ISExistsByName(_ms.mNote)) // hasPayDays++; if ((emp.IDNo.ToUpper().StartsWith("J")) && this.annualHolidayManager.IsNationalHoliday(attend.DutyDate.Value, attend.Note)) { hasPayDays++; gnDays++; } if (_ms.mNote.Contains("曠職") || _ms.mNote.Contains("病假") || _ms.mNote.Contains("事假") || _ms.mNote.Contains("婚假") || _ms.mNote.Contains("喪假") || _ms.mNote.Contains("無薪假") || _ms.mNote.Contains("特殊休(有薪)") || _ms.mNote.Contains("公傷假") || _ms.mNote.Contains("週六休假") || _ms.mNote.Contains("產假") || _ms.mNote.Contains("選舉假") || _ms.mNote.Contains("產檢假") || _ms.mNote.Contains("過年大掃除") || _ms.mNote.Contains("陪產假") || _ms.mNote.Contains("國定假日補休") || _ms.mNote.Contains("颱風假") || _ms.mNote.Contains("育嬰假") || _ms.mNote.Contains("隔周休假") || _ms.mNote.Contains("留職停薪") || _ms.mNote.Contains("補休年假")) { //TimeBonus++; if (_ms.mNote.Contains("整日")) { TimeBonus += 6; } else //如果上下半日都有请假记录,若记录无公假,年假,出差,则说明都是扣时数补贴的假 { if (_ms.mNote.Contains("上半日") && _ms.mNote.Contains("下半日")) { if (!_ms.mNote.Contains("公假") && !_ms.mNote.Contains("年假") && !_ms.mNote.Contains("出差")) { TimeBonus += 6; } else { TimeBonus += 3; } } else { TimeBonus += 3; } } if (_ms.mNote.Contains("曠職")) { if (_ms.mNote.Contains("整日")) { Kuangzhi += this.KuangzhiFactor; } else { Kuangzhi += this.KuangzhiFactor / 2; } } } if (_ms.mNote.Contains("婚假") || _ms.mNote.Contains("喪假") || _ms.mNote.Contains("產假")) { if (_ms.mNote.Contains("整日")) { hunSangChan++; } else { if (_ms.mNote.Contains("婚假") && (_ms.mNote.Contains("喪假") || _ms.mNote.Contains("產假")) || _ms.mNote.Contains("喪假") && (_ms.mNote.Contains("婚假") || _ms.mNote.Contains("產假")) || _ms.mNote.Contains("產假") && (_ms.mNote.Contains("喪假") || _ms.mNote.Contains("婚假"))) { hunSangChan++; } else { hunSangChan += 0.5; } } } } //计算没有请假,休假等的出勤天数 if (attend.ShouldCheckIn != null) { if (string.IsNullOrEmpty(_ms.mNote)) { attendDays++; } else if (_ms.mNote == "遲到" || _ms.mNote == "早退" || _ms.mNote == ";遲到" || _ms.mNote == ";早退" || _ms.mNote == "遲到;" || _ms.mNote == "早退;") { attendDays++; } } //加班天数 if (attend.ShouldCheckIn == null && attend.ActualCheckIn != null && attend.ActualCheckOut != null) { if (!string.IsNullOrEmpty(_ms.mNote)) { overDays++; } } if (attend.DutyDate.Value.DayOfWeek != DayOfWeek.Sunday) { //if (!this._HrSpecificHolidays.Contains(_ms.mNote) && _ms.mNote.IndexOf("半日") < 0 && _ms.mNote.IndexOf("假") < 0 && _ms.mNote.IndexOf("曠職") < 0) // mTimeBonus = mTimeBonus + 1; } } mTimeBonus = attendDays; //全勤天数+公假天数+周末,计算出勤奖 hasPayDays += attendDays; //判断是否给发时数补贴 onWorkHours += attendDays * 7.5; #endregion #region 取薪资计算 DataSet dsms = this.monthlySalaryManager.getMonthlySummaryFee(emp.EmployeeId, _ms.mIdentifyDate, hryear, hrmonth); if (dsms.Tables[0].Rows.Count > 0) { DataRow dr = dsms.Tables[0].Rows[0]; _ms.mLunchFee = mStrToDouble(dr["LunchFee"]); //午餐費m _ms.mOverTimeFee = mStrToDouble(dr["OverTimeFee"]); //加班費 _ms.mGeneralOverTime = mStrToDouble(dr["GeneralOverTime"]); //平日加班(時數) _ms.mHolidayOverTime = mStrToDouble(dr["HolidayOverTime"]); //假日加班(時數) _ms.GeneralOverTimeCountBig = mStrToDouble(dr["GeneralOverTimeCountBig"]); //平日加班2小时之外(時數) _ms.GeneralOverTimeCountSmall = mStrToDouble(dr["GeneralOverTimeCountSmall"]); //平日加班2小时以下(時數) _ms.HolidayOverTimeCountBig = mStrToDouble(dr["HolidayOverTimeCountBig"]); //假日加班2小时之外(時數) _ms.HolidayOverTimeCountSmall = mStrToDouble(dr["HolidayOverTimeCountSmall"]); //假日加班2小时以下(時數) _ms.mLateCount = mStrToDouble(dr["LateCount"]); //遲到次數 _ms.mTotalLateInMinute = mStrToDouble(dr["TotalLateInMinute"]); //總遲到(分) _ms.mOverTimeBonus = mStrToDouble(dr["OverTimeBonus"]); //加班津貼 _ms.mSpecialBonus = mStrToDouble(dr["SpecialBonus"]); //中夜班津貼 //_ms.mDaysFactor = mStrToDouble(dr["DaysFactor"]); //總日基數 _ms.mMonthFactor = mStrToDouble(dr["MonthFactor"]); //總月基數 _ms.mDutyDateCount = mStrToDouble(dr["DutyDateCount"]); //總出勤記錄數 _ms.mLeaveDate = (dr["LeaveDate"] == null || dr["LeaveDate"].ToString() == "") ? global::Helper.DateTimeParse.NullDate : Convert.ToDateTime(dr["LeaveDate"].ToString()); //离职日期 _ms.mPunishLeaveCount = mStrToDouble(dr["PunishLeaveCount"]); //倒扣款假總數 _ms.mLeaveCount = mStrToDouble(dr["LeaveCount"]); //請假總數 _ms.mAbsentCount = mStrToDouble(dr["AbsentCount"]); //曠工總數 _ms.mTotalHoliday = mStrToDouble(dr["TotalHoliday"]); //該月總例假數 _ms.mLoanFee = mStrToDouble(dr["LoanFee"]); //借支 // int WuXinCount = Int32.Parse(dr["WuXinCount"].ToString()); //考勤 不满一月 日基数 = 日基数-实际假数-扣款请假天数-旷职-无薪假 //矿工待处理 //if (_ms.mDutyDateCount < totalDay) // _ms.mDaysFactor = _ms.mDaysFactor - _ms.mTotalHoliday; // if (_ms.mDutyDateCount < totalDay && _ms.mLeaveDate != global::Helper.DateTimeParse.NullDate && _ms.mLeaveDate.ToString() != "") //總出勤記錄數 // _ms.mDaysFactor = _ms.mMonthFactor - _ms.mTotalHoliday - _ms.mPunishLeaveCount - _ms.mAbsentCount - WuXinCount; // else if ((_ms.mLeaveDate == global::Helper.DateTimeParse.NullDate || _ms.mLeaveDate.ToString() == "") && _ms.mDutyDateCount < totalDay) // _ms.mDaysFactor = _ms.mMonthFactor - _ms.mTotalHoliday - _ms.mPunishLeaveCount - _ms.mAbsentCount - WuXinCount; } else { _ms.mLoanFee = 0; _ms.mLunchFee = 0; _ms.mOverTimeFee = 0; _ms.mGeneralOverTime = 0; _ms.mHolidayOverTime = 0; _ms.mLateCount = 0; _ms.mTotalLateInMinute = 0; _ms.mOverTimeBonus = 0; _ms.mSpecialBonus = 0; //_ms.mDaysFactor = 0; _ms.mMonthFactor = 0; _ms.mDutyDateCount = 0; _ms.mPunishLeaveCount = 0; _ms.mLeaveCount = 0; _ms.mTotalHoliday = 0; } dsms.Clear(); #endregion #region 底薪 DataSet dx_ds = this.monthlySalaryManager.getMonthlySalary(emp.EmployeeId, _ms.mIdentifyDate);//只有一行记录,故取第一行即可. if (dx_ds.Tables[0].Rows.Count > 0) { DataRow dx_dr = dx_ds.Tables[0].Rows[0]; //_ms.mDailyPay = mStrToDouble(dx_dr["DailyPay"]); //日工资 _ms.mMonthlyPay = mStrToDouble(dx_dr["MonthlyPay"]); //月工资 if (VPerson.specialEmp.Contains(emp.EmployeeId)) { _ms.mDutyPay = this.GetSiSheWuRu(mStrToDouble(dx_dr["DutyPay"]), 0); } else if (emp.EmployeeJoinDate <= Convert.ToDateTime(hryear.ToString() + "-" + hrmonth.ToString() + '-' + 01.ToString()) && (_ms.mLeaveDate > Convert.ToDateTime(hryear.ToString() + "-" + hrmonth.ToString() + '-' + totalDay.ToString()) || _ms.mLeaveDate == global::Helper.DateTimeParse.NullDate)) { _ms.mDutyPay = this.GetSiSheWuRu(mStrToDouble(dx_dr["DutyPay"]) / (30 - WeekendDays - saturdays) * (30 - totalDay + attendDays + gnDays), 0); } //责任津贴 新版改为出勤奖金 后改为 伙食津贴 现改为 津贴. 改 年终 _ms.mGivenDays = mStrToDouble(dx_dr["HolidayBonusGivenDays"]); //年假(补休)天数 _ms.mAnnualHolidayFee = this.GetSiSheWuRu(_ms.mMonthlyPay / 30 * _ms.mGivenDays, 0); //年假(补休)金额,2016年3月2日16:06:28改为固定除以30天 _ms.mOtherPunish = mStrToDouble(dx_dr["OtherPunish"]); //其它扣款 _ms.mJiuYuanKouJiao = mStrToDouble(dx_dr["JiuYuanKouJiao"]); //就源扣缴 if (VPerson.specialEmp.Contains(emp.EmployeeId)) { _ms.mBasePay = _ms.mMonthlyPay; } else if (emp.EmployeeJoinDate > Convert.ToDateTime(hryear.ToString() + "-" + hrmonth.ToString() + '-' + 01.ToString()) || (_ms.mLeaveDate != global::Helper.DateTimeParse.NullDate && _ms.mLeaveDate < Convert.ToDateTime(hryear.ToString() + "-" + hrmonth.ToString() + '-' + 01.ToString()).AddMonths(1))) { _ms.mBasePay = this.GetSiSheWuRu(_ms.mMonthlyPay / 30 * (attendDays + halfattend - Kuangzhi), 0); } else { if (emp.AttendanceDays.HasValue && emp.AttendanceDays.Value > Convert.ToDouble(attendDays) + halfattend + hunSangChan) { _ms.mBasePay = this.GetSiSheWuRu(_ms.mMonthlyPay - _ms.mMonthlyPay / 30 * (Kuangzhi + totalDay - _ms.mMonthFactor + noPayleaveDays + halfDays - halfDayFactors + WeekendDays), 0); } else { _ms.mBasePay = this.GetSiSheWuRu(_ms.mMonthlyPay - _ms.mMonthlyPay / 30 * (Kuangzhi + totalDay - _ms.mMonthFactor + noPayleaveDays + halfDays - halfDayFactors), 0); } } } #endregion #region 迟到扣款 int mIcount = 0; //和小于10分 次数小于3次 if ((_ms.mTotalLateInMinute > 10 || _ms.mLateCount > 2) && !VPerson.vipPerson.Contains(emp.EmployeeId) && !VPerson.specialEmp.Contains(emp.EmployeeId)) { string[] strs = new string[31]; IList <int> a = new List <int>(); if (strBU.Length > 0) { strs = strBU.ToString(0, strBU.Length - 1).Split('|'); } for (int i = 0; i < strs.Length; i++) { if (strs[i] != null) { if (strs[i] == "0") { continue; } else { a.Add(Int32.Parse(strs[i])); } } } int temp = 0; for (int i = 0; i < a.Count; i++) { for (int j = i + 1; j < a.Count; j++) { if (a[i] > a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } } } int sum = 0; int m; for (m = 0; m < a.Count; m++) { sum = sum + a[m]; if (sum > 10) { break; } } if (m > 2) { m = 2; } mIcount = m; _ms.mTotalLateInHour = (_ms.mLateCount - mIcount - mHicount) * 0.5 + mLateHalfCount; _ms.mLatePunish = global::Helper.DateTimeParse.GetSiSheWuRu(_ms.mTotalLateInHour * _ms.mMonthlyPay / 30 / 8, 0); } else { _ms.mTotalLateInHour = 0; _ms.mLatePunish = 0; mIcount = (int)_ms.mLateCount; // 10分钟内 3次之内 用于全勤奖 } #endregion #region 假日&平日加班算法修改 2013年4月26日15:09:41 陈宁 if (!VPerson.specialEmp.Contains(emp.EmployeeId)) { //平日加班 小于2小时 为 时薪*1.33*加班小时,超出2小时部分 为 时薪*1.66*加班小时 _ms.mGeneralOverTimeFee = GetSiSheWuRu((_ms.mMonthlyPay / 30 / 8) * (_ms.GeneralOverTimeCountSmall * 1.334 + _ms.GeneralOverTimeCountBig * 1.667), 0); //假日加班 一律 为时薪 两倍. _ms.mHolidayOverTimeFee = GetSiSheWuRu(((_ms.mMonthlyPay / 30 / 8) * 3 / 2) * _ms.mHolidayOverTime, 0); } #endregion return(_ms); }
public CalculationListForm(MonthSalaryClass ms) : this() { this._ms = ms; }
/// <summary> /// 三个参数的构造函数 /// </summary> /// <param name="employee"></param> /// <param name="dueDate"></param> public OverTimeForm(MonthSalaryClass ms, Book.Model.Employee emp) : this() { this._ms = ms; this._employee = emp; }
/// <summary> /// 三个参数的构造函数 /// </summary> /// <param name="employee"></param> /// <param name="year"></param> /// <param name="month"></param> public LunchDetailForm(MonthSalaryClass ms) : this() { this._ms = ms; }
/// <summary> /// 三个参数的构造函数 /// </summary> /// <param name="Employees"></param> /// <param name="year"></param> /// <param name="month"></param> public WordBonusList(MonthSalaryClass ms) : this() { this._ms = ms; }