|
@@ -34,7 +34,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="startDt"></param>
|
|
|
/// <param name="endDt"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task<Result> SalaryCalculatorAsync(
|
|
|
+ public static async Task<Result> SalaryCalculatorAsync1(
|
|
|
List<Pm_WageSheet> pm_WageSheetDattaSources, List<UserNameView> userNames, int userId, string thisYearMonth, DateTime startDt, DateTime endDt)
|
|
|
{
|
|
|
if (pm_WageSheetDattaSources.Count <= 0)
|
|
@@ -51,7 +51,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
//计算时间段内工作日
|
|
|
|
|
|
- int work_days = GetWorkDays(startDt, endDt);
|
|
|
+ int work_days = await GetWorkDays(thisYearMonth);
|
|
|
|
|
|
//获取所有打卡数据
|
|
|
CheckInView checkIn = await _qiYeWeChatApiService.GetCheckin_MonthDataAsync(startDt, endDt); //时间段内所有 打卡数据
|
|
@@ -296,6 +296,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
#endregion
|
|
|
|
|
|
Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" }; //打卡
|
|
|
+
|
|
|
List<Ex_Item> ex_reissuecard_Items = new List<Ex_Item>();
|
|
|
#region 打卡补卡 补卡次数 处理
|
|
|
|
|
@@ -737,7 +738,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="startDt"></param>
|
|
|
/// <param name="endDt"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task<Result> SalaryCalculatorAsync1(
|
|
|
+ public static async Task<Result> SalaryCalculatorAsync(
|
|
|
List<Pm_WageSheet> pm_WageSheetDattaSources, List<UserNameView> userNames, int userId, string thisYearMonth, DateTime startDt, DateTime endDt)
|
|
|
{
|
|
|
if (pm_WageSheetDattaSources.Count <= 0)
|
|
@@ -753,7 +754,12 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
|
|
|
//计算时间段内工作日
|
|
|
- int work_days = GetWorkDays(startDt, endDt);
|
|
|
+ int work_days = await GetWorkDays(thisYearMonth);
|
|
|
+ if (work_days <=0)
|
|
|
+ {
|
|
|
+ _result.Msg = thisYearMonth+" 工作日未设置,请前往《工作日管理页面》设置!";
|
|
|
+ return _result;
|
|
|
+ }
|
|
|
|
|
|
UserIdListView userIdListView = await _qiYeWeChatApiService.GetUserIdListAsync();
|
|
|
if (userIdListView.errcode != 0)
|
|
@@ -770,7 +776,8 @@ namespace OASystem.API.OAMethodLib
|
|
|
return _result;
|
|
|
}
|
|
|
//筛选出工作日日报
|
|
|
- List<Root> workday_userRoots = checkInDayDataView.datas.Where(it => it.base_info.day_type == 0).ToList(); //工作日日报
|
|
|
+ List<Root> workday_userRoots = checkInDayDataView.datas.Where(it => it.base_info.day_type == 0 && it.base_info.record_type == 1).ToList(); //工作日日报
|
|
|
+ workday_userRoots = workday_userRoots.OrderBy(it => it.base_info.date).ToList();
|
|
|
|
|
|
//获取 请假类型 Sp_Detail.template_id
|
|
|
string leave_template_id = "C4NzTJCh1onCUK915rRkvy7Fh5Vqz4YbiEV9jrBY1";
|
|
@@ -825,42 +832,449 @@ namespace OASystem.API.OAMethodLib
|
|
|
sickLeave_deduction = dailyWage - sickLeave_dailywage;
|
|
|
|
|
|
List<Ex_Items> ex_Items = new List<Ex_Items>();//假勤 And 打卡备注集合
|
|
|
-
|
|
|
+ Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" }; //打卡
|
|
|
+ Ex_Items ex_Items_jq = new Ex_Items() { Type = "假勤" }; //假勤
|
|
|
#endregion
|
|
|
|
|
|
- List<Root> userRoots = workday_userRoots.Where(it => it.base_info.name == itemName && it.base_info.day_type == 0).ToList(); //工作日日报
|
|
|
+ List<Root> userRoots = workday_userRoots.Where(it => it.base_info.name == itemName).ToList(); //工作日日报 1-固定上下班;
|
|
|
+ userRoots = userRoots.Distinct().ToList();
|
|
|
|
|
|
int dk_work_days = userRoots.Count; //应出勤天数
|
|
|
|
|
|
+ if (dk_work_days > work_days)
|
|
|
+ {
|
|
|
+ dk_work_days = work_days;
|
|
|
+ }
|
|
|
meal_subsidy = dk_work_days * 10; //应发放餐补
|
|
|
|
|
|
|
|
|
if (!itemName.Equals("张海麟"))
|
|
|
{
|
|
|
+ string acctid = userRoots[0].base_info.acctid;
|
|
|
+ List<Ex_Item> ex_reissuecard_Items = new List<Ex_Item>(); //打卡类型 数据
|
|
|
+ List<Sp_items> acc_sp_items = new List<Sp_items>(); //审批数据
|
|
|
+
|
|
|
+ #region 迟到 早退 矿工
|
|
|
+
|
|
|
+ int user_cd_zt_num = 0; //早退/迟到 次数 10分钟内 2次以内不记处罚 三次及以上50一次
|
|
|
foreach (var root in userRoots)
|
|
|
{
|
|
|
List<Holiday_infos> holiday_Infos = root.holiday_infos; //当天假勤信息
|
|
|
List<Exception_infos> exception_infos = root.exception_infos; //当天校准状态信息
|
|
|
List<Sp_items> sp_Items = root.sp_items;//当天假勤统计信息
|
|
|
- #region 假勤处理
|
|
|
if (sp_Items.Count > 0)
|
|
|
{
|
|
|
+ sp_Items = sp_Items.Where(it => it.count > 0).ToList();
|
|
|
+ acc_sp_items.AddRange(sp_Items);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var exception_info in exception_infos)
|
|
|
+ {
|
|
|
+ decimal timelength = ConvertToDecimal((Convert.ToDecimal(exception_info.duration) / 3600.00M) * 60.00M); //时长 分钟
|
|
|
+
|
|
|
+ if (timelength == 9) timelength = 7.50M;
|
|
|
+
|
|
|
+ int exception = exception_info.exception; //异常类型
|
|
|
+ decimal day_miner_unit = ConvertToDecimal(dailyWage / 15); //以0.5小时为单位
|
|
|
+
|
|
|
+ //1:一个自然月内,不足 10 分钟的迟到/早退,不超过 2 次的部分,不做处罚;3 次及以上,按50 元 / 次处罚;
|
|
|
+ //2:超过 10 分钟(含 10 分钟),不足 60 分钟的迟到 / 早退,按 50 元 / 次处罚;
|
|
|
+ //3:超过 60 分钟(含 60 分钟),不足 3 小时的迟到 / 早退,且无请假者,按旷工半日处理;超过 3 小时的迟到 / 早退,且无请假者,按旷工一日处理。
|
|
|
+
|
|
|
+ long date = root.base_info.date; //当日工作日期
|
|
|
+ long earliest_time = root.summary_info.earliest_time; //最早打卡时间
|
|
|
+ long lastest_time = root.summary_info.lastest_time; //最晚打卡时间
|
|
|
+ long this_date = date + earliest_time;
|
|
|
+ DateTime thisDt = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddTicks(this_date * 10000000);
|
|
|
+
|
|
|
+ string thisDtStr = thisDt.ToString("yyyy-MM-dd");
|
|
|
+
|
|
|
+ Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 4,
|
|
|
+ SubType = "旷工",
|
|
|
+ Duration = timelength,
|
|
|
+ StartTimeDt = Convert.ToDateTime(root.base_info.dateDt.ToString("yyyy-MM-dd HH:mm:ss")),
|
|
|
+ Unit = "分钟",
|
|
|
+ };
|
|
|
+
|
|
|
+ decimal day_deduction = 0.00M;
|
|
|
+ //1 - 迟到;2 - 早退;3 - 缺卡;4 - 旷工;5 - 地点异常;6 - 设备异常
|
|
|
+ if (exception == 1) //迟到
|
|
|
+ {
|
|
|
+ if (timelength < 10)
|
|
|
+ {
|
|
|
+ user_cd_zt_num++;
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "迟到";
|
|
|
+
|
|
|
+ string thisStartDt = (TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddTicks((date + earliest_time) * 10000000))
|
|
|
+ .ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ beLate_belate_ex.StartTimeDt = Convert.ToDateTime(thisStartDt);
|
|
|
+
|
|
|
+ if (user_cd_zt_num >= 3)
|
|
|
+ {
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = 0.00M;
|
|
|
+ }
|
|
|
+ beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ }
|
|
|
+ else if (timelength >= 10 && timelength <= 60)
|
|
|
+ {
|
|
|
+ string thisStartDt = (TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddTicks((date + earliest_time) * 10000000))
|
|
|
+ .ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ beLate_belate_ex.StartTimeDt = Convert.ToDateTime(thisStartDt);
|
|
|
+
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ beLate_deduction += day_deduction; //迟到扣款 总额
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "迟到";
|
|
|
+ }
|
|
|
+ else if (timelength > 60 && timelength <= 180)
|
|
|
+ {
|
|
|
+ day_deduction = day_miner_unit * 6; //3小时
|
|
|
+ meal_deduction += 10.00M; //餐补扣款
|
|
|
+ absenteeism_deduction += day_deduction; //矿工半日
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = dailyWage;
|
|
|
+ absenteeism_deduction += day_deduction; //矿工一日
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ }
|
|
|
+
|
|
|
+ beLate_belate_ex.Deduction = day_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+ else if (exception == 2) //早退
|
|
|
+ {
|
|
|
+ if (timelength < 10)
|
|
|
+ {
|
|
|
+ user_cd_zt_num++;
|
|
|
+ beLate_belate_ex.SubTypeId = 2;
|
|
|
+ beLate_belate_ex.SubType = "早退";
|
|
|
+ string thisEndDt = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddTicks((date + lastest_time) * 10000000)
|
|
|
+ .ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ beLate_belate_ex.StartTimeDt = Convert.ToDateTime(thisEndDt);
|
|
|
+
|
|
|
+
|
|
|
+ if (user_cd_zt_num >= 3)
|
|
|
+ {
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = 0.00M;
|
|
|
+ }
|
|
|
+ early_deduction += day_deduction; //早退扣款 总计
|
|
|
+ }
|
|
|
+ else if (timelength >= 10 && timelength <= 60)
|
|
|
+ {
|
|
|
+ day_deduction = 50.00M;
|
|
|
+ early_deduction += day_deduction; //早退扣款 总计
|
|
|
+ beLate_belate_ex.SubTypeId = 2;
|
|
|
+ beLate_belate_ex.SubType = "早退";
|
|
|
+ string thisEndDt = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddTicks((date + lastest_time) * 10000000)
|
|
|
+ .ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ beLate_belate_ex.StartTimeDt = Convert.ToDateTime(thisEndDt);
|
|
|
+ }
|
|
|
+ else if (timelength > 60 && timelength <= 180)
|
|
|
+ {
|
|
|
+ day_deduction = day_miner_unit * 6; //3小时
|
|
|
+ absenteeism_deduction += day_deduction; //矿工半日
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = dailyWage;
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ absenteeism_deduction += day_deduction; //矿工一日
|
|
|
+ }
|
|
|
+
|
|
|
+ beLate_belate_ex.Deduction = day_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+ else if (exception == 3) //缺卡
|
|
|
+ {
|
|
|
+
|
|
|
+ if (root.exception_infos.Count == 2)
|
|
|
+ {
|
|
|
+ day_deduction = dailyWage;
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ absenteeism_deduction += day_deduction;
|
|
|
+ beLate_belate_ex.Reason = "上午-下午 缺卡/未打卡为旷工 一天";
|
|
|
+ beLate_belate_ex.Deduction = day_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (root.exception_infos.Count == 1)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (earliest_time == lastest_time)
|
|
|
+ {
|
|
|
+ DateTime thisDt1 = Convert.ToDateTime(thisDtStr + " 12:00");
|
|
|
+
|
|
|
+
|
|
|
+ if (thisDt <= thisDt1) //旷工 下午
|
|
|
+ {
|
|
|
+ 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) //旷工下午
|
|
|
+ {
|
|
|
+ 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 //矿工一日
|
|
|
+ {
|
|
|
+
|
|
|
+ day_deduction = dailyWage;
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (exception == 4) //旷工
|
|
|
+ {
|
|
|
+ if (timelength > 60 && timelength <= 180)
|
|
|
+ {
|
|
|
+ day_deduction = day_miner_unit * 6; //3小时
|
|
|
+ beLate_belate_ex.Reason = thisDtStr + " 缺卡/未打视为旷工上午(3小时)";
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ absenteeism_deduction += day_deduction; //矿工半日
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_deduction = dailyWage;
|
|
|
+ beLate_belate_ex.Reason = thisDtStr + " 上午(09:00)-下午(18:00) 缺卡/未打视为旷工一天(7.5小时)";
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ absenteeism_deduction += day_deduction; //矿工一日
|
|
|
+ }
|
|
|
+
|
|
|
+ beLate_belate_ex.Deduction = day_deduction;
|
|
|
+ ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 假勤/补卡次数 审批
|
|
|
+
|
|
|
+ int leaveNum = 0; //请假次数
|
|
|
+ int reissuecardNum = 0; //补卡次数\
|
|
|
+ //类型:1 - 请假;2 - 补卡;3 - 出差;4 - 外出;100 - 外勤
|
|
|
+ leaveNum = acc_sp_items.Where(it => it.type == 1).ToList().Count();
|
|
|
+ reissuecardNum = acc_sp_items.Where(it => it.type == 2).ToList().Count();
|
|
|
+
|
|
|
+ //请假审批
|
|
|
+ if (leaveNum > 0)
|
|
|
+ {
|
|
|
+ List<Sp_Detail> sp_leave_details = new List<Sp_Detail>();
|
|
|
+ sp_leave_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 1); //时间段内所有 已同意的 请假 审批数据
|
|
|
+ if (sp_leave_details.Count <= 0)
|
|
|
+ {
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 请假 审批数据获取未获取到!\r\n";
|
|
|
+ //continue;
|
|
|
+ }
|
|
|
+ List<Ex_Item> ex_ItemInfos = new List<Ex_Item>();
|
|
|
+
|
|
|
+ foreach (Sp_Detail sp_item in sp_leave_details)
|
|
|
+ {
|
|
|
+ Apply_data? apply_data = sp_item.apply_data;
|
|
|
+ if (apply_data != null)
|
|
|
+ {
|
|
|
+ List<ContentsItem> contents = apply_data.contents;
|
|
|
+ ContentsItem content_Vacation = contents.Where(it => it.control == "Vacation").FirstOrDefault(); //请假类型
|
|
|
+ ContentsItem content_Textarea = contents.Where(it => it.control == "Textarea").FirstOrDefault(); //多行文本
|
|
|
+
|
|
|
+ if (content_Vacation != null)
|
|
|
+ {
|
|
|
+ Vacation vacation = content_Vacation.value.vacation;
|
|
|
+ Attendance attendance = vacation.attendance; //假勤组件
|
|
|
+ Selector selector = vacation.selector; //请假类型
|
|
|
+
|
|
|
+ List<OptionsItem> optionsItems = selector.options; //key 请假类型 id
|
|
|
+ List<TitleItem> value = optionsItems[0].value; // value 文本描述值
|
|
|
+
|
|
|
+ int leaveType = int.Parse(optionsItems[0].key); //key 请假子类型 id
|
|
|
+ Date_range date_Range = attendance.date_range;
|
|
|
+
|
|
|
+ //筛选 不在工作日内的假勤申请
|
|
|
+ if (startDt >= date_Range.new_begin_dt || date_Range.new_end_dt > endDt)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ decimal thisTypeDeduction = 0.00M;//当前类型扣款
|
|
|
+ string leave_starttime = date_Range.new_begin_dt.ToString("HH:mm");
|
|
|
+ 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;
|
|
|
+
|
|
|
+ //计算餐补 假勤类型扣款
|
|
|
+ CalculateTypeFee(leaveType, date_Range.type, leave_starttime, leave_endtime, amountPayable, work_days, new_duration,
|
|
|
+ out leave_meals, out thisTypeDeduction);
|
|
|
+
|
|
|
+ #region 累计类型扣款
|
|
|
+ //1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他;9丧假
|
|
|
+
|
|
|
+ if (leaveType == 2) //事假
|
|
|
+ {
|
|
|
+ personalLeaveTotal += thisTypeDeduction;
|
|
|
+ }
|
|
|
+ else if (leaveType == 3) //病假
|
|
|
+ {
|
|
|
+ sickLeaveTotal = thisTypeDeduction;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ meal_deduction += leave_meals;
|
|
|
+
|
|
|
+
|
|
|
+ Ex_Item ex_Item = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = leaveType,
|
|
|
+ SubType = typeName,
|
|
|
+ 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")),
|
|
|
+ //Approval_name = sp_item.approval_name,
|
|
|
+ };
|
|
|
+ ex_ItemInfos.Add(ex_Item);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ if (ex_ItemInfos.Count > 0)
|
|
|
+ {
|
|
|
+ ex_Items_jq.Ex_ItemInfo = ex_ItemInfos.OrderBy(it => it.SubTypeId).ThenBy(it => it.Apply_time_dt).ToList();
|
|
|
+ ex_Items.Add(ex_Items_jq);
|
|
|
+ }
|
|
|
|
|
|
- #endregion
|
|
|
+ }
|
|
|
|
|
|
- #region 打卡补卡
|
|
|
+ //打卡补卡
|
|
|
+ if (reissuecardNum > 0)
|
|
|
+ {
|
|
|
+ List<Sp_Detail> sp_buka_details = new List<Sp_Detail>();
|
|
|
+ sp_buka_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 2); //时间段内所有 已同意的 请假 审批数据
|
|
|
|
|
|
- #endregion
|
|
|
+ int bukaNum = 1;
|
|
|
+ foreach (var item in sp_buka_details)
|
|
|
+ {
|
|
|
+ Apply_data? apply_data = item.apply_data;
|
|
|
+ if (apply_data != null)
|
|
|
+ {
|
|
|
+ List<ContentsItem> contents = apply_data.contents;
|
|
|
+ ContentsItem content_Vacation = contents.Where(it => it.control == "PunchCorrection").FirstOrDefault(); //请假类型
|
|
|
+ ContentsItem content_Textarea = contents.Where(it => it.control == "Textarea").FirstOrDefault(); //多行文本
|
|
|
+
|
|
|
+ if (content_Vacation != null)
|
|
|
+ {
|
|
|
+ var punch_correction = content_Vacation.value.punch_correction;
|
|
|
|
|
|
- #region 迟到 早退 矿工
|
|
|
+ DateTime bukaDt = punch_correction.time_dt;
|
|
|
+
|
|
|
+ //筛选 不在工作日内的假勤申请
|
|
|
+ if (startDt >= bukaDt || bukaDt > endDt)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
+ decimal bukaPrice = 0.00M;
|
|
|
+ if (bukaNum <= 2)
|
|
|
+ {
|
|
|
+ bukaPrice = 10.00M;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bukaPrice = 50.00M;
|
|
|
+ }
|
|
|
+ var app_data = item.apply_data;
|
|
|
+ var punch_correction1 = app_data.contents[0].value.punch_correction; //未打卡时间
|
|
|
+ var punch_correction2 = app_data.contents[1].value;
|
|
|
+
|
|
|
+ Ex_Item ex_reissueCard = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 7,
|
|
|
+ SubType = "打卡补卡",
|
|
|
+ StartTimeDt = Convert.ToDateTime(punch_correction1.time_dt.ToString("yyyy-MM-dd HH:mm:ss")), //未打卡时间
|
|
|
+ Deduction = bukaPrice,
|
|
|
+ Reason = punch_correction2.text,
|
|
|
+ Unit = string.Empty
|
|
|
+ };
|
|
|
+ unprinted_deduction += bukaPrice;
|
|
|
+ ex_reissuecard_Items.Add(ex_reissueCard);
|
|
|
+ bukaNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- #endregion
|
|
|
+ if (ex_reissuecard_Items.Count > 0)
|
|
|
+ {
|
|
|
+ ex_Items_dk.Ex_ItemInfo = ex_reissuecard_Items;
|
|
|
+ ex_Items_dk.Ex_ItemInfo = ex_reissuecard_Items.OrderBy(it => it.SubTypeId).ThenBy(it => it.StartTimeDt).ToList();
|
|
|
+ ex_Items.Add(ex_Items_dk);
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -878,7 +1292,15 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- salaryTotal = (dk_work_days * dailyWage) + mealTotal; //应发合计
|
|
|
+ if (itemName.Equals("张海麟"))
|
|
|
+ {
|
|
|
+ salaryTotal = amountPayable + mealTotal; //应发合计
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ salaryTotal = (dk_work_days * dailyWage) + mealTotal; //应发合计
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -892,7 +1314,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
#region 处理当月工资数据
|
|
|
pm_wsInfo.YearMonth = thisYearMonth;
|
|
|
pm_wsInfo.StartDate = startDt.ToString("yyyy-MM-dd");
|
|
|
- pm_wsInfo.EndDate = endDt.AddDays(-1).ToString("yyyy-MM-dd");
|
|
|
+ pm_wsInfo.EndDate = endDt.ToString("yyyy-MM-dd");
|
|
|
pm_wsInfo.WorkDays = work_days; //当月应出勤天数
|
|
|
pm_wsInfo.RegularDays = dk_work_days; //当月正常出勤天数
|
|
|
|
|
@@ -1291,77 +1713,20 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="startDt"></param>
|
|
|
/// <param name="endDt"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static int GetWorkDays(DateTime startDt,DateTime endDt)
|
|
|
+ public static async Task<int> GetWorkDays(string yearMonth)
|
|
|
{
|
|
|
- string startYear = startDt.ToString("yyyy");
|
|
|
- string endYear = endDt.ToString("yyyy");
|
|
|
-
|
|
|
- var holidays = AppSettingsHelper.Get<HoliDaysDataSourceView>("HoliDayDataSource");
|
|
|
- List<HoliDaysDataSourceView> holiDatas = new List<HoliDaysDataSourceView>();
|
|
|
- if (startYear.Equals(endYear))
|
|
|
- {
|
|
|
- holiDatas.Add(holidays.Where(it => it.Year == startYear).FirstOrDefault());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- holiDatas.Add(holidays.Where(it => it.Year == startYear).FirstOrDefault());
|
|
|
- holiDatas.Add(holidays.Where(it => it.Year == endYear).FirstOrDefault());
|
|
|
- }
|
|
|
+ int workdays = 0;
|
|
|
+ string sql = string.Format(@"Select * From Pm_WageIssueWorkingDay
|
|
|
+ Where Isdel = 0 And YearMonth = '{0}' ", yearMonth);
|
|
|
|
|
|
- int _totalDays = (int)(endDt - startDt).TotalDays;
|
|
|
- List<HolidaysInfo> _holidays = new List<HolidaysInfo>();
|
|
|
- List<HolidaysInfo> _weekdys = new List<HolidaysInfo>();
|
|
|
- List<HolidaysInfo> _workdays = new List<HolidaysInfo>();
|
|
|
- string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
|
|
+ var data = await _usersRep._sqlSugar.SqlQueryable<WageYearMonthView>(sql).FirstAsync();
|
|
|
|
|
|
- for (int i = 0; i <= _totalDays; i++)
|
|
|
+ if (data != null)
|
|
|
{
|
|
|
- string thisYear = startDt.ToString("yyyy");
|
|
|
- string thisDt = startDt.ToString("MM-dd");
|
|
|
- string thisYMD = startDt.ToString("yyyy-MM-dd");
|
|
|
- string thisWeek = Day[Convert.ToInt32(startDt.DayOfWeek.ToString("d"))].ToString();
|
|
|
-
|
|
|
-
|
|
|
- HoliDaysDataSourceView holiDaysData = new HoliDaysDataSourceView();
|
|
|
- holiDaysData = holiDatas.Where(it => it.Year == thisYear).FirstOrDefault();
|
|
|
- //周末
|
|
|
- if (thisWeek.Equals("星期六") || thisWeek.Equals("星期日"))
|
|
|
- {
|
|
|
- HolidaysInfo holidaysInfo = new HolidaysInfo();
|
|
|
- holidaysInfo = holiDaysData.Holidays.Where(it => it.HoliDate == thisDt).FirstOrDefault();
|
|
|
- if (holidaysInfo != null)
|
|
|
- {
|
|
|
- if (holidaysInfo.HoliName.Equals("工作日"))
|
|
|
- {
|
|
|
- _workdays.Add(new HolidaysInfo { HoliDate = thisYMD, HoliName = Day[Convert.ToInt32(startDt.DayOfWeek.ToString("d"))].ToString() });
|
|
|
- startDt = startDt.AddDays(1);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- _weekdys.Add(new HolidaysInfo { HoliDate = thisYMD, HoliName = thisWeek });
|
|
|
- startDt = startDt.AddDays(1);
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- //节假日
|
|
|
- if (holiDaysData != null)
|
|
|
- {
|
|
|
- HolidaysInfo holidaysInfo = new HolidaysInfo();
|
|
|
- holidaysInfo = holiDaysData.Holidays.Where(it => it.HoliDate == thisDt).FirstOrDefault();
|
|
|
- if (holidaysInfo != null)
|
|
|
- {
|
|
|
- _holidays.Add(new HolidaysInfo { HoliDate = thisYMD, HoliName = holidaysInfo.HoliName });
|
|
|
- startDt = startDt.AddDays(1);
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- //工作日
|
|
|
- _workdays.Add(new HolidaysInfo { HoliDate = thisYMD, HoliName = Day[Convert.ToInt32(startDt.DayOfWeek.ToString("d"))].ToString() });
|
|
|
-
|
|
|
- startDt = startDt.AddDays(1);
|
|
|
+ workdays = data.Workdays;
|
|
|
}
|
|
|
|
|
|
- return _workdays.Count();
|
|
|
+ return workdays;
|
|
|
}
|
|
|
}
|
|
|
}
|