Преглед на файлове

计算工资
调整 病假 事假

leiy преди 1 година
родител
ревизия
f9e6d7a64b

+ 99 - 10
OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs

@@ -558,6 +558,14 @@ namespace OASystem.API.OAMethodLib
                                         string endTime = string.Empty;
                                         string startTime1 = string.Empty;
                                         string endTime1 = string.Empty;
+                                        Slice_info slice_info = new Slice_info();
+                                        //2事假;3病假;
+                                        if (leaveTypeId == 2 || leaveTypeId ==3)
+                                        {
+                                            slice_info = vacation.attendance.slice_info;
+                                        }
+
+
                                         //计算请假类型扣款金额
                                         decimal new_duration = 0.00M;
                                         if (date_Range.type == "halfday")
@@ -566,10 +574,24 @@ namespace OASystem.API.OAMethodLib
                                             unit = "天";
                                             startTime = date_Range.new_begin_dt.ToString("yyyy-MM-dd") + " 09:00";
                                             endTime = date_Range.new_begin_dt.ToString("yyyy-MM-dd") + " 18:00";
-                                            if (new_duration == 1)
+
+                                            if (new_duration >= 0.50M)
                                             {
-                                                startTime1 = "09:00:00";
-                                                endTime1 = "18:00:00";
+                                                if (slice_info != null)
+                                                {
+                                                    decimal qjLongTime = slice_info.duration / 3600.00M;
+                                                    if (qjLongTime == 4.50M)
+                                                    {
+                                                        startTime1 = "12:00";
+                                                        endTime1 = "18:00:00";
+                                                    }
+                                                    else if (qjLongTime == 3.00M)
+                                                    {
+                                                        startTime1 = "09:00";
+                                                        endTime1 = "12:00:00";
+                                                    }
+
+                                                }
                                             }
                                             else
                                             {
@@ -596,7 +618,7 @@ namespace OASystem.API.OAMethodLib
                                             DtType = date_Range.type,
                                             Unit = unit,
                                             New_Duration = new_duration,
-                                            ApplyDt = Convert.ToDateTime(sp_item.apply_time_dt.ToString("yyyy-MM-dd HH:mm:ss"))
+                                            SliceInfo = slice_info
                                         };
                                         leaveDetails.Add(leaveDetails1);
                                     }
@@ -644,13 +666,13 @@ namespace OASystem.API.OAMethodLib
                                     #region 累计类型扣款
                                     //1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他;9丧假
 
-                                    if (leaveType == 2) //调休
+                                    if (leaveType == 2) //
                                     {
                                         personalLeaveTotal += thisTypeDeduction;
                                     }
                                     else if (leaveType == 3) //病假
                                     {
-                                        sickLeaveTotal = thisTypeDeduction;
+                                        sickLeaveTotal += thisTypeDeduction;
                                     }
 
                                     #endregion
@@ -1248,7 +1270,38 @@ namespace OASystem.API.OAMethodLib
                     if (date_Range_type == "halfday")
                     {
                         mealDeduction = 10.00M * Math.Ceiling(duration); //餐补扣款 
-                        typeDeduction = ConvertToDecimal(personalkLeave_dailywage_day * duration);
+                        if (duration % 1 == 0) //整天
+                        {
+                            typeDeduction = ConvertToDecimal(personalkLeave_dailywage_day * duration);
+                        }
+                        else //多含 半天 另外处理
+                        {
+                            decimal sj_wholeDay = Math.Floor(duration); //整天
+                            decimal sj_halfDay = duration % 1; //半天
+                            typeDeduction = personalkLeave_dailywage_day * sj_wholeDay;
+
+                            if (sj_halfDay > 0)
+                            {
+                                LeaveDetails sjDetails = leaveDetails.Where(it => it.StartDt == startTime && it.EndDt == endTime).FirstOrDefault();
+
+                                decimal sjPrice = 0.00M;
+                                if (sjDetails != null)
+                                {
+                                    Slice_info sj_slice_Info = sjDetails.SliceInfo;
+                                    decimal sjLongTime = sj_slice_Info.duration / 3600.00M;
+                                    if (sjLongTime == 3.00M)
+                                    {
+                                        typeDeduction += personalkLeave_dailywage_day / 7.50M * 3.50M;
+                                    }
+                                    else if (sjLongTime == 4.50M)
+                                    {
+                                        typeDeduction += personalkLeave_dailywage_day / 7.50M * 4.50M;
+                                    }
+                                }
+                            }
+
+                            typeDeduction = ConvertToDecimal(typeDeduction);
+                        }
                     }
                     else if (date_Range_type == "hour")
                     {
@@ -1294,14 +1347,50 @@ namespace OASystem.API.OAMethodLib
 
                     break;
                 case 3: //3病假
-                    // 病假日薪 *计算方式:日平均工资 = 成都市最低工资标准的80% /当月应出勤天数。 短期病假=当月15天内 
+                        // 病假日薪 *计算方式:日平均工资 = 成都市最低工资标准的80% /当月应出勤天数。 短期病假=当月15天内 
 
-                    decimal chengDuMinimumWage_halrHour = _chengDuMinimumWage / work_days / 7.50M;
+                    decimal chengDuMinimumWage_Day = _chengDuMinimumWage / work_days;
+                    decimal chengDuMinimumWage_halrHour = chengDuMinimumWage_Day / 7.50M;
                     decimal sickLeave_dailywage_halfhour_deduction1 = (personalkLeave_dailywage_day / 7.50M) - chengDuMinimumWage_halrHour; //病假单位 0.5小时 扣款金额
 
                     if (date_Range_type == "halfday")
                     {
-                        mealDeduction = 10.00M * duration; //餐补扣款 
+                        mealDeduction = 10.00M * Math.Ceiling(duration); //餐补扣款 
+
+                        decimal pl_dailywage_day = personalkLeave_dailywage_day - chengDuMinimumWage_Day;
+                        if (duration % 1 == 0) //整天
+                        {
+                            typeDeduction = ConvertToDecimal(pl_dailywage_day * duration);
+                        }
+                        else //多含 半天 另外处理
+                        {
+                            decimal bj_wholeDay = Math.Floor(duration); //整天
+                            decimal bj_halfDay = duration % 1; //半天
+                            typeDeduction = pl_dailywage_day * bj_wholeDay;
+
+                            if (bj_halfDay > 0)
+                            {
+                                LeaveDetails bjDetails = leaveDetails.Where(it => it.StartDt == startTime && it.EndDt == endTime).FirstOrDefault();
+
+                                decimal bjPrice = 0.00M;
+                                if (bjDetails != null)
+                                {
+                                    Slice_info bj_slice_Info = bjDetails.SliceInfo;
+                                    decimal bjLongTime = bj_slice_Info.duration / 3600.00M;
+                                    if (bjLongTime == 3.00M)
+                                    {
+                                        typeDeduction += pl_dailywage_day / 7.50M * 3.50M;
+                                    }
+                                    else if (bjLongTime == 4.50M)
+                                    {
+                                        typeDeduction += pl_dailywage_day / 7.50M * 4.50M;
+                                    }
+                                }
+                            }
+
+                            typeDeduction = ConvertToDecimal(typeDeduction);
+                        }
+
                         typeDeduction = ConvertToDecimal( sickLeave_dailywage_halfhour_deduction1 * halfHour);
                     }
                     else if (date_Range_type == "hour")

+ 6 - 0
OASystem/OASystem.Domain/ViewModels/PersonnelModule/WageSheetView.cs

@@ -1,5 +1,6 @@
 using Newtonsoft.Json;
 using OASystem.Domain.Entities.PersonnelModule;
+using OASystem.Domain.ViewModels.QiYeWeChat;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -482,6 +483,11 @@ namespace OASystem.Domain.ViewModels.PersonnelModule
         /// 申请时间
         /// </summary>
         public DateTime  ApplyDt { get; set; }
+
+        /// <summary>
+        /// 时长支持按天分片信息, 2020/10/01之前的历史表单不支持时长分片
+        /// </summary>
+        public Slice_info SliceInfo { get; set; }
     }
 
 

+ 8 - 0
OASystem/OASystem.Domain/ViewModels/QiYeWeChat/ApprovalDataView.cs

@@ -248,6 +248,14 @@ namespace OASystem.Domain.ViewModels.QiYeWeChat
         /// 日期的00:00:00时间戳,Unix时间
         /// </summary>
         public long daytime { get; set; }
+
+        public DateTime daytimeDt
+        {
+            get
+            {
+                return new DateTime(daytime * 10000000 + 621355968000000000L).ToLocalTime();
+            }
+        }
         ///// <summary>
         ///// 
         ///// </summary>