Przeglądaj źródła

计算工资 5.10

leiy 1 rok temu
rodzic
commit
097b7b0a7d

+ 41 - 14
OASystem/OASystem.Api/OAMethodLib/PayrollComputation.cs

@@ -214,20 +214,30 @@ namespace OASystem.API.OAMethodLib
                                 string leave_endtime = date_Range.new_end_dt.ToString("HH:mm");
 
                                 string typeName = string.Empty;
+                                string unit = string.Empty;
                                 int leaveTypeId = leaveType;
                                 var leaveTypeData = vacationLeaveTypes.Where(it => it.id == leaveTypeId).FirstOrDefault();
 
                                 if (leaveTypeData != null) { typeName = leaveTypeData.name; }
-                                //计算请假类型扣款金额
 
+
+                                string startTime = string.Empty;
+                                string endTime = string.Empty;
+                                //计算请假类型扣款金额
                                 decimal new_duration = 0.00M;
                                 if (date_Range.type == "halfday")
                                 {
                                     new_duration = Convert.ToDecimal(date_Range.new_duration) / 86400M;
+                                    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";
                                 }
                                 else if (date_Range.type == "hour")
                                 {
                                     new_duration = Convert.ToDecimal(date_Range.new_duration) / 3600M;
+                                    unit = "小时";
+                                    startTime = date_Range.new_begin_dt.ToString("yyyy-MM-dd HH:mm:ss");
+                                    endTime = date_Range.new_end_dt.ToString("yyyy-MM-dd HH:mm:ss");
                                 }
                                 decimal leave_meals = 0.00M;
 
@@ -251,16 +261,16 @@ namespace OASystem.API.OAMethodLib
                                 #endregion
 
                                 meal_deduction += leave_meals;
-                                string startEndTiime = startEndTiime = date_Range.new_begin_dt.ToString("yyyy-MM-dd HH:mm") + " - " +
-                                    date_Range.new_end_dt.ToString("yyyy-MM-dd HH:mm");
+                                
 
                                 Ex_Item ex_Item = new Ex_Item()
                                 {
                                     SubTypeId = leaveType,
                                     SubType = typeName,
-                                    StartTimeDt = Convert.ToDateTime(date_Range.new_begin_dt.ToString("yyyy-MM-dd HH:mm:ss")),
-                                    EndTimeDt = Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd HH:mm:ss")),
+                                    StartTimeDt = Convert.ToDateTime(startTime),
+                                    EndTimeDt = Convert.ToDateTime(endTime),
                                     Duration = new_duration,
+                                    Unit = unit,
                                     Deduction = thisTypeDeduction,
                                     //Reason = apply_data.reason,
                                     Apply_time_dt = Convert.ToDateTime(sp_item.apply_time_dt.ToString("yyyy-MM-dd HH:mm:ss")),
@@ -313,7 +323,7 @@ namespace OASystem.API.OAMethodLib
                                 StartTimeDt = Convert.ToDateTime(punch_correction1.time_dt.ToString("yyyy-MM-dd HH:mm:ss")),  //未打卡时间
                                 Deduction = bukaPrice,
                                 Reason = punch_correction2.text,
-                                unit = string.Empty
+                                Unit = string.Empty
                             };
                             unprinted_deduction += bukaPrice;
                             ex_reissuecard_Items.Add(ex_reissueCard);
@@ -401,7 +411,7 @@ namespace OASystem.API.OAMethodLib
                             {
                                 foreach (var exception_info in roots_ex.exception_infos)
                                 {
-                                    decimal timelength = (Convert.ToDecimal(exception_info.duration) / 3600.00M) * 60.00M;  //时长 分钟
+                                    decimal timelength = ConvertToDecimal( (Convert.ToDecimal(exception_info.duration) / 3600.00M) * 60.00M);  //时长 分钟
 
                                     if (timelength == 9) timelength = 7.50M;
 
@@ -425,8 +435,8 @@ namespace OASystem.API.OAMethodLib
                                         SubTypeId = 4,
                                         SubType = "旷工",
                                         Duration = timelength,
-                                        StartTimeDt = Convert.ToDateTime(roots_ex.base_info.dateDt.ToString("yyyy-MM-dd")),
-                                        unit = "分钟",
+                                        StartTimeDt = Convert.ToDateTime(roots_ex.base_info.dateDt.ToString("yyyy-MM-dd HH:mm:ss")),
+                                        Unit = "分钟",
                                     };
 
 
@@ -443,8 +453,12 @@ namespace OASystem.API.OAMethodLib
                                             if (reissueCardNum >= 3)
                                             {
                                                 day_deduction = 50.00M;
-                                                beLate_deduction += day_deduction; //迟到扣款 总额
                                             }
+                                            else
+                                            {
+                                                day_deduction = 10.00M;
+                                            }
+                                            beLate_deduction += day_deduction; //迟到扣款 总额
                                         }
                                         else if (timelength >= 10 && timelength <= 60)
                                         {
@@ -527,18 +541,32 @@ namespace OASystem.API.OAMethodLib
                                             {
                                                 DateTime thisDt1 = Convert.ToDateTime(thisDtStr + " 12:00");
 
+                                                //ex_ItemInfos
+
+                                                Ex_Item zt_jq = new Ex_Item();
+                                                zt_jq = ex_ItemInfos.Where(it => it.StartTimeDt.ToString("yyyy-MM-dd") == thisDtStr).FirstOrDefault();
+
                                                 if (thisDt <= thisDt1)  //旷工 下午
                                                 {
+                                                    if (zt_jq != null)  if (zt_jq.EndTimeDt == Convert.ToDateTime(thisDtStr + " 18:00")) continue; //排除已有假期的缺卡
+
                                                     day_deduction = day_miner_unit * 9; //4.5小时
                                                     meal_deduction += 10.00M;
                                                     absenteeism_deduction += day_deduction; //矿工半日
                                                     beLate_belate_ex.Reason = thisDtStr + " 下午(18:00)缺卡/未打卡视为下午旷工(4.5小时)";
+
+                                                    beLate_belate_ex.Deduction = day_deduction;
+                                                    ex_reissuecard_Items.Add(beLate_belate_ex);
                                                 }
                                                 else if (thisDt >= thisDt1) //旷工下午
                                                 {
+                                                    if (zt_jq != null) if (zt_jq.EndTimeDt == Convert.ToDateTime(thisDtStr + " 09:00")) continue; //排除已有假期的缺卡
                                                     day_deduction = day_miner_unit * 6; //3小时
                                                     absenteeism_deduction += day_deduction; //矿工半日
                                                     beLate_belate_ex.Reason = thisDtStr + " 上午(09:00)缺卡/未打卡视为上午旷工(3小时)";
+
+                                                    beLate_belate_ex.Deduction = day_deduction;
+                                                    ex_reissuecard_Items.Add(beLate_belate_ex);
                                                 }
                                                 else //矿工一日
                                                 {
@@ -547,10 +575,11 @@ namespace OASystem.API.OAMethodLib
                                                     meal_deduction += 10.00M;
                                                     absenteeism_deduction += day_deduction;
                                                     beLate_belate_ex.Reason = thisDtStr + " 上午(09:00)-下午(18:00) 缺卡/未打视为旷工一天(7.5小时)";
+
+                                                    beLate_belate_ex.Deduction = day_deduction;
+                                                    ex_reissuecard_Items.Add(beLate_belate_ex);
                                                 }
 
-                                                beLate_belate_ex.Deduction = day_deduction;
-                                                ex_reissuecard_Items.Add(beLate_belate_ex);
 
                                             }
                                         }
@@ -659,7 +688,6 @@ namespace OASystem.API.OAMethodLib
             return Convert.ToDecimal(number.ToString("0.00"));
         }
 
-
         /// <summary>
         /// 获取请假类型
         /// </summary>
@@ -862,7 +890,6 @@ namespace OASystem.API.OAMethodLib
             }
         }
 
-
         /// <summary>
         /// 计算类型费用
         /// </summary>

+ 1 - 1
OASystem/OASystem.Domain/ViewModels/PersonnelModule/WageSheetView.cs

@@ -345,7 +345,7 @@ namespace OASystem.Domain.ViewModels.PersonnelModule
         /// <summary>
         /// 请假时长,单位小时
         /// </summary>
-        public string unit { get; set; } = "小时";
+        public string Unit { get; set; } = "小时";
 
         /// <summary>
         /// 请假事由