|
@@ -15,6 +15,7 @@ using System.Collections.Generic;
|
|
|
using System.Diagnostics.Eventing.Reader;
|
|
|
using System.Drawing;
|
|
|
using System.Linq.Expressions;
|
|
|
+using System.Text.Json.Nodes;
|
|
|
using TencentCloud.Ocr.V20181119.Models;
|
|
|
|
|
|
namespace OASystem.API.OAMethodLib
|
|
@@ -99,6 +100,38 @@ namespace OASystem.API.OAMethodLib
|
|
|
//工作日日报
|
|
|
workday_userRoots = workday_userRoots.OrderBy(it => it.base_info.date).ToList();
|
|
|
|
|
|
+
|
|
|
+ #region 特殊日期-不用打卡日期信息
|
|
|
+
|
|
|
+ //获取企业打卡规则
|
|
|
+ CorpCheckInRuleView corpCheckInRole = await _qiYeWeChatApiService.GetCheckIn_CorpCheckInOptionAsync();
|
|
|
+ if (corpCheckInRole.errcode != 0)
|
|
|
+ {
|
|
|
+ _result.Msg = "【企业微信】【打卡】【获取企业打卡规则】【Msg】" + corpCheckInRole.errmsg;
|
|
|
+ return _result;
|
|
|
+ }
|
|
|
+
|
|
|
+ int spe_offdays = 0;
|
|
|
+
|
|
|
+ GroupItem group = corpCheckInRole.group.Where(it => it.groupid == 4).FirstOrDefault();
|
|
|
+ if (group != null)
|
|
|
+ {
|
|
|
+ foreach (var item in group.spe_offdays)
|
|
|
+ {
|
|
|
+ if (item.begtime_dt>= startDt && item.endtime_dt <= endDt)
|
|
|
+ {
|
|
|
+ if (item.endtime_dt > startDt)
|
|
|
+ {
|
|
|
+ TimeSpan ts = item.endtime_dt - item.begtime_dt;
|
|
|
+ spe_offdays = (ts.Days + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//获取 请假类型 Sp_Detail.template_id
|
|
|
string leave_template_id = "C4NzTJCh1onCUK915rRkvy7Fh5Vqz4YbiEV9jrBY1";
|
|
|
List<VacationLeaveTypeView> vacationLeaveTypes = await GetVacationLeaveTypes(leave_template_id);
|
|
@@ -565,7 +598,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
SubTypeId = 4,
|
|
|
SubType = "旷工",
|
|
|
Duration = 0,
|
|
|
- StartTimeDt = Convert.ToDateTime(thisDay),
|
|
|
+ StartTimeDt = Convert.ToDateTime(goOutPunchItem.StartDt),
|
|
|
Unit = "分钟",
|
|
|
Reason ="数据来源【外出打卡】"
|
|
|
};
|
|
@@ -638,12 +671,12 @@ namespace OASystem.API.OAMethodLib
|
|
|
{
|
|
|
day_deduction = 0.00M;
|
|
|
}
|
|
|
- beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ early_deduction += day_deduction; //迟到扣款 总额
|
|
|
}
|
|
|
else if (timeLong >= 10 && timeLong < 60)
|
|
|
{
|
|
|
day_deduction = 50.00M;
|
|
|
- beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ early_deduction += day_deduction; //迟到扣款 总额
|
|
|
beLate_belate_ex.SubTypeId = 1;
|
|
|
beLate_belate_ex.SubType = "早退";
|
|
|
}
|
|
@@ -727,9 +760,15 @@ namespace OASystem.API.OAMethodLib
|
|
|
Date_range date_Range = attendance.date_range;
|
|
|
|
|
|
//筛选 不在工作日内的假勤申请
|
|
|
- if ( Convert.ToDateTime(date_Range.new_begin_dt) < startDt || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
|
|
|
+
|
|
|
+ //if (Convert.ToDateTime(date_Range.new_begin_dt) < startDt || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
|
|
|
+ //{
|
|
|
+ // continue;
|
|
|
+ //}
|
|
|
+
|
|
|
+ if (Convert.ToDateTime(date_Range.new_begin_dt) < startDt || Convert.ToDateTime(date_Range.new_begin_dt) > endDt)
|
|
|
{
|
|
|
- continue;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
string leave_starttime = date_Range.new_begin_dt.ToString("HH:mm");
|
|
@@ -871,6 +910,8 @@ namespace OASystem.API.OAMethodLib
|
|
|
endTime1 = date_Range_new_end_dt.ToString("HH:mm:ss");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
LeaveDetails leaveDetails1 = new LeaveDetails()
|
|
|
{
|
|
|
TypeId = leaveType,
|
|
@@ -923,6 +964,26 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
int leaveType = leave_item.TypeId;
|
|
|
decimal new_duration = leave_item.New_Duration;
|
|
|
+
|
|
|
+ #region 处理跨月天数
|
|
|
+
|
|
|
+ if (leave_item.EndDt > endDt)
|
|
|
+ {
|
|
|
+ DateTime dt1 = Convert.ToDateTime(leave_item.StartDt.ToString("yyyy-MM-dd") + " 12:00");
|
|
|
+ DateTime dt2 = Convert.ToDateTime(leave_item.StartDt.ToString("yyyy-MM-dd") + " 09:00");
|
|
|
+ TimeSpan ts = Convert.ToDateTime(endDt.ToString("yyyy-MM-dd") + " 18:00") - Convert.ToDateTime(leave_item.StartDt.ToString("yyyy-MM-dd"));
|
|
|
+ if (dt2 >= leave_item.StartDt && leave_item.StartDt <= dt1)
|
|
|
+ {
|
|
|
+ new_duration = ts.Days + 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ new_duration = ts.Days + 1.00M + 0.50M;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
//计算餐补 假勤类型扣款
|
|
|
CalculateTypeFee1(leaveDetails,leaveType, leave_item.DtType, leave_item.StartDt, leave_item.EndDt, amountPayable, work_days,
|
|
|
new_duration,out leave_meals, out thisTypeDeduction);
|
|
@@ -1201,7 +1262,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
Date_range date_Range = attendance.date_range;
|
|
|
|
|
|
//筛选 不在工作日内的假勤申请
|
|
|
- if (startDt >= date_Range.new_begin_dt || Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd")) > endDt)
|
|
|
+ if (date_Range.new_begin_dt < startDt || date_Range.new_end_dt < endDt)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
@@ -1339,7 +1400,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
|
|
|
#region 应发合计 实发合计 扣款合计(假勤扣款,其他扣款,社保扣款,公积金代扣,个税扣款)
|
|
|
-
|
|
|
+ int workDays = dk_work_days + spe_offdays;
|
|
|
decimal mealTotal = meal_subsidy - meal_deduction; //餐补
|
|
|
decimal salaryTotal = 0.00M;
|
|
|
if (dk_work_days >= work_days)
|
|
@@ -1355,7 +1416,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- salaryTotal = (dk_work_days * dailyWage) + mealTotal + pm_wsInfo.OtherHandle; //应发合计
|
|
|
+ salaryTotal = (workDays * dailyWage) + mealTotal + pm_wsInfo.OtherHandle; //应发合计
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1373,8 +1434,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
pm_wsInfo.StartDate = startDt.ToString("yyyy-MM-dd");
|
|
|
pm_wsInfo.EndDate = endDt.ToString("yyyy-MM-dd");
|
|
|
pm_wsInfo.WorkDays = work_days; //当月应出勤天数
|
|
|
- pm_wsInfo.RegularDays = dk_work_days; //当月正常出勤天数
|
|
|
-
|
|
|
+ pm_wsInfo.RegularDays = workDays; //当月正常出勤天数
|
|
|
pm_wsInfo.SickLeave = sickLeaveTotal; //病假
|
|
|
pm_wsInfo.SomethingFalse = personalLeaveTotal; //事假
|
|
|
pm_wsInfo.LateTo = beLate_deduction; //迟到
|
|
@@ -1399,8 +1459,6 @@ namespace OASystem.API.OAMethodLib
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -1611,7 +1669,6 @@ namespace OASystem.API.OAMethodLib
|
|
|
if (duration % 1 > 0)
|
|
|
{
|
|
|
typeDeduction = (personalkLeave_dailywage_day / 2.00M) * (duration / 0.50M);
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1804,7 +1861,6 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2109,7 +2165,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
if (date_Range_type == "halfday")
|
|
|
{
|
|
|
- mealDeduction = duration * 10; //餐补扣款
|
|
|
+ mealDeduction = Math.Ceiling(duration) * 10; //餐补扣款
|
|
|
}
|
|
|
else if (date_Range_type == "hour")
|
|
|
{
|
|
@@ -2260,5 +2316,19 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
return workdays;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取一个类指定的属性值
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="info">object对象</param>
|
|
|
+ /// <param name="field">属性名称</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static object GetPropertyValue(object info, string field)
|
|
|
+ {
|
|
|
+ if (info == null) return null;
|
|
|
+ System.Type t = info.GetType();
|
|
|
+ IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == field.ToLower() select pi;
|
|
|
+ return property.First().GetValue(info, null);
|
|
|
+ }
|
|
|
}
|
|
|
}
|