|
@@ -1,9 +1,12 @@
|
|
|
-using OASystem.API.OAMethodLib.QiYeWeChatAPI;
|
|
|
+using Google.Protobuf.WellKnownTypes;
|
|
|
+using OASystem.API.OAMethodLib.QiYeWeChatAPI;
|
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.Entities.PersonnelModule;
|
|
|
using OASystem.Domain.ViewModels.PersonnelModule;
|
|
|
using OASystem.Domain.ViewModels.QiYeWeChat;
|
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
|
+using System;
|
|
|
+using System.Linq.Expressions;
|
|
|
using TencentCloud.Ocr.V20181119.Models;
|
|
|
|
|
|
namespace OASystem.API.OAMethodLib
|
|
@@ -44,6 +47,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
//获取所有打卡数据
|
|
|
CheckInView checkIn = await _qiYeWeChatApiService.GetCheckin_MonthDataAsync(startDt, endDt); //时间段内所有 打卡数据
|
|
|
if (checkIn.errcode != 0)
|
|
@@ -54,23 +58,15 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
List<Data> checkInDatas = checkIn.datas;
|
|
|
|
|
|
- //请假
|
|
|
- List<Sp_Detail> sp_leave_details = new List<Sp_Detail>();
|
|
|
- sp_leave_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, 2, 1); //时间段内所有 已同意的 请假 审批数据
|
|
|
- if (sp_leave_details.Count <= 0)
|
|
|
+ //获取 请假类型 Sp_Detail.template_id
|
|
|
+ string leave_template_id = "C4NzTJCh1onCUK915rRkvy7Fh5Vqz4YbiEV9jrBY1";
|
|
|
+ List<VacationLeaveTypeView> vacationLeaveTypes = await GetVacationLeaveTypes(leave_template_id);
|
|
|
+ if (vacationLeaveTypes.Count <= 0)
|
|
|
{
|
|
|
- string errMsg = startDt + " - " + endDt + "请假 审批数据获取失败!";
|
|
|
+ _result.Msg = startDt + " - " + endDt + "请假 类型数据 获取失败!";
|
|
|
return _result;
|
|
|
}
|
|
|
|
|
|
- //打卡补卡
|
|
|
- List<Sp_Detail> sp_reissuecard_details = new List<Sp_Detail>();
|
|
|
- sp_reissuecard_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, 2, 2); //时间段内所有 已同意的 打卡补卡 审批数据
|
|
|
- if (sp_reissuecard_details.Count <= 0)
|
|
|
- {
|
|
|
- string errMsg = startDt + " - " + endDt + "打卡补卡 审批数据获取失败!";
|
|
|
- return _result;
|
|
|
- }
|
|
|
|
|
|
foreach (var pm_wsInfo in pm_WageSheetDattaSources)
|
|
|
{
|
|
@@ -105,6 +101,16 @@ namespace OASystem.API.OAMethodLib
|
|
|
if (checkInData == null) { continue; }
|
|
|
string acctid = checkInData.base_info.acctid; //用户Id
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ List<Sp_Detail> sp_reissuecard_details = new List<Sp_Detail>();
|
|
|
+ sp_reissuecard_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 2); //时间段内所有 已同意的 补卡 审批数据
|
|
|
+ if (sp_reissuecard_details.Count <= 0)
|
|
|
+ {
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 打卡补卡 审批数据获取未获取到!\r\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
//当月总计数据
|
|
|
Summary_Info? summary_Info = checkInData.summary_info;
|
|
|
if (summary_Info == null) { continue; }
|
|
@@ -120,7 +126,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
decimal amountPayable = pm_wsInfo.Basic + pm_wsInfo.Floats + pm_wsInfo.PostAllowance + pm_wsInfo.GarmentWashSubsidies + pm_wsInfo.CommunicationSubsidies +
|
|
|
pm_wsInfo.TrafficSubsidies + pm_wsInfo.InformationSecurityFee + pm_wsInfo.OperationBonus + pm_wsInfo.SpecialAllowance + pm_wsInfo.OtherSubsidies + pm_wsInfo.GroupCost;
|
|
|
|
|
|
- // 日薪 = 事假日薪 *计算方式:日平均工资 = 月工资/当月应出勤天数。
|
|
|
+ // 日薪 = *计算方式:日平均工资 = 月工资/当月应出勤天数。
|
|
|
decimal dailyWage = amountPayable / work_days;
|
|
|
|
|
|
// 病假日薪 *计算方式:日平均工资 = 成都市最低工资标准的80%/当月应出勤天数。 短期病假=当月15天内
|
|
@@ -168,13 +174,19 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
#region 请假类型金额/餐补 处理
|
|
|
|
|
|
- List<Sp_Detail> sp_leave_item_infosData = sp_leave_details.Where(it => it.applyer.userid == acctid).ToList();
|
|
|
+ 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_Items> ex_Items = new List<Ex_Items>();//假勤 And 打卡备注集合
|
|
|
Ex_Items ex_Items_jq = new Ex_Items() { Type = "假勤" }; //假勤
|
|
|
List<Ex_Item> ex_ItemInfos = new List<Ex_Item>();
|
|
|
|
|
|
- foreach (Sp_Detail sp_item in sp_leave_item_infosData)
|
|
|
+ foreach (Sp_Detail sp_item in sp_leave_details)
|
|
|
{
|
|
|
Apply_data? apply_data = sp_item.apply_data;
|
|
|
if (apply_data != null)
|
|
@@ -188,172 +200,60 @@ namespace OASystem.API.OAMethodLib
|
|
|
Vacation vacation = content_Vacation.value.vacation;
|
|
|
Attendance attendance = vacation.attendance; //假勤组件
|
|
|
Selector selector = vacation.selector; //请假类型
|
|
|
- }
|
|
|
|
|
|
- //请假时长
|
|
|
- //double leaveLength = (sp_leave.end_time_dt - sp_leave.start_time_dt).TotalHours;
|
|
|
-
|
|
|
- //string typeName = string.Empty;
|
|
|
- ////leave_type 1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他
|
|
|
- //switch (sp_leave.leave_type)
|
|
|
- //{
|
|
|
- // case 1: //年假
|
|
|
- // typeName = "年假";
|
|
|
- // if (sp_leave.timeunit == 0) //半天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.timeunit == 1) //小时
|
|
|
- // {
|
|
|
- // if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.duration > 7.5)
|
|
|
- // {
|
|
|
- // decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
|
|
|
- // meal_deduction += daysPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case 2: //事假 需调整
|
|
|
- // typeName = "事假";
|
|
|
- // if (sp_leave.timeunit == 0) //半天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // personalLeaveTotal += dailyWage / 2;
|
|
|
- // }
|
|
|
- // else if (sp_leave.timeunit == 1) //小时
|
|
|
- // {
|
|
|
- // if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.duration > 7.5)
|
|
|
- // {
|
|
|
- // decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
|
|
|
- // meal_deduction += daysPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case 3: //病假 需调整
|
|
|
- // typeName = "病假";
|
|
|
- // if (sp_leave.timeunit == 0) //半天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // sickLeaveTotal += sickLeave_deduction / 2;
|
|
|
- // }
|
|
|
- // else if (sp_leave.timeunit == 1) //小时
|
|
|
- // {
|
|
|
- // if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.duration > 7.5)
|
|
|
- // {
|
|
|
- // decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
|
|
|
- // meal_deduction += daysPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case 4: //调休假
|
|
|
- // typeName = "调休假";
|
|
|
- // if (sp_leave.timeunit == 0) //半天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.timeunit == 1) //小时
|
|
|
- // {
|
|
|
- // if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.duration > 7.5)
|
|
|
- // {
|
|
|
- // decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
|
|
|
- // meal_deduction += daysPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case 5: //婚假
|
|
|
- // typeName = "婚假";
|
|
|
- // if (sp_leave.timeunit == 0) //半天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.timeunit == 1) //小时
|
|
|
- // {
|
|
|
- // if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.duration > 7.5)
|
|
|
- // {
|
|
|
- // decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
|
|
|
- // meal_deduction += daysPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case 6: //产假
|
|
|
- // typeName = "产假";
|
|
|
- // if (sp_leave.timeunit == 0) //半天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.timeunit == 1) //小时
|
|
|
- // {
|
|
|
- // if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.duration > 7.5)
|
|
|
- // {
|
|
|
- // decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
|
|
|
- // meal_deduction += daysPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // case 7: //陪产假
|
|
|
- // typeName = "陪产假";
|
|
|
- // if (sp_leave.timeunit == 0) //半天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.timeunit == 1) //小时
|
|
|
- // {
|
|
|
- // if (sp_leave.duration >= 3 && sp_leave.duration <= 7.5) //7.5小时 一天
|
|
|
- // {
|
|
|
- // meal_deduction += 10;
|
|
|
- // }
|
|
|
- // else if (sp_leave.duration > 7.5)
|
|
|
- // {
|
|
|
- // decimal daysPrice = Convert.ToDecimal(sp_leave.duration / 7.5 * 10);
|
|
|
- // meal_deduction += daysPrice;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // break;
|
|
|
- // default:
|
|
|
- // break;
|
|
|
- //}
|
|
|
-
|
|
|
- //Ex_Item ex_Item = new Ex_Item()
|
|
|
- //{
|
|
|
- // SubTypeId = sp_leave.leave_type,
|
|
|
- // SubType = typeName,
|
|
|
- // Start_time_dt = sp_leave.start_time_dt,
|
|
|
- // End_time_dt = sp_leave.end_time_dt,
|
|
|
- // Duration = sp_leave.duration,
|
|
|
- // Reason = sp_leave.reason,
|
|
|
- // Apply_time_dt = sp_item.apply_time_dt,
|
|
|
- // Approval_name = sp_item.approval_name,
|
|
|
- //};
|
|
|
- //ex_ItemInfos.Add(ex_Item);
|
|
|
+ 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;
|
|
|
+
|
|
|
+ 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;
|
|
|
+ int leaveTypeId = leaveType;
|
|
|
+ var leaveTypeData = vacationLeaveTypes.Where(it => it.id == leaveTypeId).FirstOrDefault();
|
|
|
+
|
|
|
+ if (leaveTypeData != null) { typeName = leaveTypeData.name; }
|
|
|
+ //计算请假类型扣款金额
|
|
|
+
|
|
|
+ int new_duration = 0;
|
|
|
+ if (date_Range.type == "halfday")
|
|
|
+ {
|
|
|
+ new_duration =date_Range.new_duration / 86400;
|
|
|
+ }
|
|
|
+ else if (date_Range.type == "hour")
|
|
|
+ {
|
|
|
+ new_duration =date_Range.new_duration / 3600;
|
|
|
+ }
|
|
|
+ decimal leave_meals = 0.00M;
|
|
|
+ CalculateTypeFee(leaveType, date_Range.type, leave_starttime, leave_endtime, amountPayable, work_days, new_duration,
|
|
|
+ out leave_meals, out thisTypeDeduction);
|
|
|
+
|
|
|
+ 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,
|
|
|
+ Start_end_time_dt = startEndTiime,
|
|
|
+ Duration = new_duration,
|
|
|
+ Deduction = thisTypeDeduction,
|
|
|
+ //Reason = apply_data.reason,
|
|
|
+ Apply_time_dt = sp_item.apply_time_dt,
|
|
|
+ //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.Start_time_dt).ToList();
|
|
|
+ ex_Items_jq.Ex_ItemInfo = ex_ItemInfos.OrderBy(it => it.SubTypeId).ThenBy(it => it.Apply_time_dt).ToList();
|
|
|
ex_Items.Add(ex_Items_jq);
|
|
|
}
|
|
|
|
|
@@ -572,12 +472,314 @@ namespace OASystem.API.OAMethodLib
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
+
|
|
|
_result.Code = 0;
|
|
|
_result.Data = pm_WageSheetDattaSources;
|
|
|
|
|
|
return _result;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 获取请假类型
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="template_id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static async Task<List<VacationLeaveTypeView>> GetVacationLeaveTypes(string template_id)
|
|
|
+ {
|
|
|
+ List<VacationLeaveTypeView> vacationLeaveTypes = new List<VacationLeaveTypeView>();
|
|
|
+
|
|
|
+ TemplateDetailView templateDetailView = new TemplateDetailView();
|
|
|
+ templateDetailView = await _qiYeWeChatApiService.GetTemplateDetailAsync(template_id);
|
|
|
+ if (templateDetailView.errcode != 0)
|
|
|
+ {
|
|
|
+ return vacationLeaveTypes;
|
|
|
+ }
|
|
|
+ List<VacationItemInfo> VacationItemInfos = templateDetailView.vacation_list.item;
|
|
|
+
|
|
|
+ foreach (var item in VacationItemInfos)
|
|
|
+ {
|
|
|
+ ValueItem valueInfo = item.name.Where(it => it.lang == "zh_CN").FirstOrDefault();
|
|
|
+ if (valueInfo != null)
|
|
|
+ {
|
|
|
+ vacationLeaveTypes.Add(
|
|
|
+ new VacationLeaveTypeView()
|
|
|
+ {
|
|
|
+ id = item.id,
|
|
|
+ name = valueInfo.text
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return vacationLeaveTypes;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 计算类型费用
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="leaveType">
|
|
|
+ /// 1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他;9丧假
|
|
|
+ /// </param>
|
|
|
+ /// <param name="date_Range_type">
|
|
|
+ /// halfday 全天
|
|
|
+ /// hour 小时
|
|
|
+ /// </param>
|
|
|
+ /// <param name="startTime"></param>
|
|
|
+ /// <param name="endTime"></param>
|
|
|
+ /// <param name="duration"></param>
|
|
|
+ /// <param name="mealDeduction"></param>
|
|
|
+ /// <param name="typeDeduction"></param>
|
|
|
+ public static void CalculateTypeFee(int leaveType, string date_Range_type, string startTime, string endTime,decimal amountPayable,int work_days,
|
|
|
+ int duration, out decimal mealDeduction, out decimal typeDeduction)
|
|
|
+ {
|
|
|
+ typeDeduction = 0;
|
|
|
+ mealDeduction = 0;
|
|
|
+
|
|
|
+ string am_starttime = "08:59";
|
|
|
+ string am_endtime = "13:01";
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ decimal personalkLeave_dailywage_day = amountPayable / work_days; //日薪 = 事假日薪 *计算方式:日平均工资 = 当月应发工资 /当月应出勤天数。
|
|
|
+
|
|
|
+ //半小时单位
|
|
|
+ decimal halfHour = Convert.ToDecimal(7.5) / Convert.ToDecimal(0.5);
|
|
|
+
|
|
|
+ switch (leaveType)
|
|
|
+ {
|
|
|
+ case 1: //年假
|
|
|
+ CalculateTypeFeeSub(date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 2: //2事假
|
|
|
+ // 事假日薪 *计算方式:日平均工资 = 当月应发工资 /当月应出勤天数。
|
|
|
+ decimal personalkLeave_dailywage_halfhour = personalkLeave_dailywage_day / halfHour; //事假单位 0.5小时
|
|
|
+
|
|
|
+ if (date_Range_type == "halfday")
|
|
|
+ {
|
|
|
+ mealDeduction = 10; //餐补扣款
|
|
|
+ typeDeduction = personalkLeave_dailywage_day;
|
|
|
+ }
|
|
|
+ else if (date_Range_type == "hour")
|
|
|
+ {
|
|
|
+ int leave_halfHour = duration / Convert.ToInt32(0.5);
|
|
|
+ typeDeduction = personalkLeave_dailywage_halfhour * leave_halfHour;
|
|
|
+ if (duration >= 3) //单天请假三小时 && 请假时间在上午 则没有餐补
|
|
|
+ {
|
|
|
+ //处理开始时间
|
|
|
+ if (startTime.CompareTo(am_starttime) > 0 && startTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ //处理结束时间
|
|
|
+ if (endTime.CompareTo(am_starttime) > 0 && endTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ mealDeduction = 10; //餐补扣款
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (duration > 7.5) //多天计算
|
|
|
+ {
|
|
|
+ int leave_halfHour1 = duration / Convert.ToInt32(0.5);
|
|
|
+ typeDeduction = personalkLeave_dailywage_halfhour * leave_halfHour1;
|
|
|
+
|
|
|
+ decimal leaveDays = Convert.ToDecimal(duration / 7.5);
|
|
|
+ if (leaveDays % 1 == 0)
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * leaveDays; //餐补扣款
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Convert.ToInt32(leaveDays);
|
|
|
+
|
|
|
+ //得到最后一天的请假时间 是否有餐补
|
|
|
+ int lastHours = (Convert.ToDateTime(endTime) - Convert.ToDateTime("09:00")).Hours;
|
|
|
+ if (lastHours >= 3)
|
|
|
+ {
|
|
|
+ //处理结束时间
|
|
|
+ if (endTime.CompareTo(am_starttime) > 0 && endTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ mealDeduction += 10; //餐补扣款
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 3: //3病假
|
|
|
+ // 病假日薪 *计算方式:日平均工资 = 成都市最低工资标准的80% /当月应出勤天数。 短期病假=当月15天内
|
|
|
+
|
|
|
+ decimal chengDuMinimumWage_halrHour = _chengDuMinimumWage / work_days / halfHour;
|
|
|
+ decimal sickLeave_dailywage_halfhour_deduction = personalkLeave_dailywage_day - chengDuMinimumWage_halrHour; //病假单位 0.5小时 扣款金额
|
|
|
+
|
|
|
+ if (date_Range_type == "halfday")
|
|
|
+ {
|
|
|
+ mealDeduction = 10; //餐补扣款
|
|
|
+ typeDeduction = sickLeave_dailywage_halfhour_deduction * halfHour;
|
|
|
+ }
|
|
|
+ else if (date_Range_type == "hour")
|
|
|
+ {
|
|
|
+ int sickLeave_halfHour = duration / Convert.ToInt32(0.5);
|
|
|
+ typeDeduction = sickLeave_dailywage_halfhour_deduction *sickLeave_halfHour ;
|
|
|
+ if (duration >= 3 && duration <= 7.5) //单天请假三小时 && 请假时间在上午 则没有餐补
|
|
|
+ {
|
|
|
+ //处理开始时间
|
|
|
+ if (startTime.CompareTo(am_starttime) > 0 && startTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ //处理结束时间
|
|
|
+ if (endTime.CompareTo(am_starttime) > 0 && endTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ mealDeduction = 10; //餐补扣款
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (duration > 7.5) //多天计算
|
|
|
+ {
|
|
|
+ int sickLeave_halfHour1 = duration / Convert.ToInt32(0.5);
|
|
|
+ typeDeduction = sickLeave_dailywage_halfhour_deduction * sickLeave_halfHour1;
|
|
|
+
|
|
|
+ decimal leaveDays = Convert.ToDecimal(duration / 7.5);
|
|
|
+ if (leaveDays % 1 == 0)
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * leaveDays; //餐补扣款
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Convert.ToInt32(leaveDays);
|
|
|
+
|
|
|
+ //得到最后一天的请假时间 是否有餐补
|
|
|
+ int lastHours = (Convert.ToDateTime(endTime) - Convert.ToDateTime("09:00")).Hours;
|
|
|
+ if (lastHours >= 3)
|
|
|
+ {
|
|
|
+ //处理结束时间
|
|
|
+ if (endTime.CompareTo(am_starttime) > 0 && endTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ mealDeduction += 10; //餐补扣款
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 4: //4调休假
|
|
|
+ CalculateTypeFeeSub(date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 5: //5婚假
|
|
|
+ CalculateTypeFeeSub(date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 6: //6产假
|
|
|
+ CalculateTypeFeeSub(date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 7: //7陪产假
|
|
|
+ CalculateTypeFeeSub(date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 8: //8其他
|
|
|
+ CalculateTypeFeeSub(date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+ case 9: //9丧假
|
|
|
+ CalculateTypeFeeSub(date_Range_type, startTime, endTime, duration, out mealDeduction);
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 计算类型费用
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="date_Range_type">
|
|
|
+ /// halfday 全天
|
|
|
+ /// hour 小时
|
|
|
+ /// </param>
|
|
|
+ /// <param name="startTime"></param>
|
|
|
+ /// <param name="endTime"></param>
|
|
|
+ /// <param name="duration"></param>
|
|
|
+ /// <param name="mealDeduction"></param>
|
|
|
+ public static void CalculateTypeFeeSub(string date_Range_type, string startTime, string endTime, int duration, out decimal mealDeduction)
|
|
|
+ {
|
|
|
+ mealDeduction = 0;
|
|
|
+ string am_starttime = "08:59";
|
|
|
+ string am_endtime = "13:01";
|
|
|
+
|
|
|
+ if (date_Range_type == "halfday")
|
|
|
+ {
|
|
|
+ mealDeduction = 10; //餐补扣款
|
|
|
+ }
|
|
|
+ else if (date_Range_type == "hour")
|
|
|
+ {
|
|
|
+ if (duration >= 3 && duration < 7) //单天请假三小时 && 请假时间在上午 则没有餐补
|
|
|
+ {
|
|
|
+ //处理开始时间
|
|
|
+ if (startTime.CompareTo(am_starttime) > 0 && startTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ //处理结束时间
|
|
|
+ if (endTime.CompareTo(am_starttime) > 0 && endTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ mealDeduction = 10; //餐补扣款
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (duration >= 7 && duration <= 7.5 )
|
|
|
+ {
|
|
|
+ mealDeduction = 10; //餐补扣款
|
|
|
+ }
|
|
|
+ else if (duration >= 7.5) //多天计算
|
|
|
+ {
|
|
|
+ decimal leaveDays = Convert.ToDecimal(duration / 7.5);
|
|
|
+
|
|
|
+ if (leaveDays % 1 == 0)
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * leaveDays; //餐补扣款
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mealDeduction = 10 * Convert.ToInt32(leaveDays);
|
|
|
+
|
|
|
+ //得到最后一天的请假时间 是否有餐补
|
|
|
+ int lastHours = (Convert.ToDateTime(endTime) - Convert.ToDateTime("09:00")).Hours;
|
|
|
+ if (lastHours >= 3)
|
|
|
+ {
|
|
|
+ //处理结束时间
|
|
|
+ if (endTime.CompareTo(am_starttime) > 0 && endTime.CompareTo(am_endtime) < 0)
|
|
|
+ {
|
|
|
+ mealDeduction += 10; //餐补扣款
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取打卡补卡类型
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="template_id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static async Task<List<VacationLeaveTypeView>> GetVacationReissueCardTypes(string template_id)
|
|
|
+ {
|
|
|
+ List<VacationLeaveTypeView> vacationLeaveTypes = new List<VacationLeaveTypeView>();
|
|
|
+
|
|
|
+ TemplateDetailView templateDetailView = new TemplateDetailView();
|
|
|
+ templateDetailView = await _qiYeWeChatApiService.GetTemplateDetailAsync(template_id);
|
|
|
+ if (templateDetailView.errcode != 0)
|
|
|
+ {
|
|
|
+ return vacationLeaveTypes;
|
|
|
+ }
|
|
|
+ List<VacationItemInfo> VacationItemInfos = templateDetailView.vacation_list.item;
|
|
|
+
|
|
|
+ foreach (var item in VacationItemInfos)
|
|
|
+ {
|
|
|
+ ValueItem valueInfo = item.name.Where(it => it.lang == "zh_CN").FirstOrDefault();
|
|
|
+ if (valueInfo != null)
|
|
|
+ {
|
|
|
+ vacationLeaveTypes.Add(
|
|
|
+ new VacationLeaveTypeView()
|
|
|
+ {
|
|
|
+ id = item.id,
|
|
|
+ name = valueInfo.text
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return vacationLeaveTypes;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 打卡数据
|