|
@@ -33,7 +33,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="endDt"></param>
|
|
|
/// <returns></returns>
|
|
|
public static async Task<Result> SalaryCalculatorAsync(
|
|
|
- List<Pm_WageSheet> pm_WageSheetDattaSources, List<UserNameView> userNames,int userId, string thisYearMonth, DateTime startDt, DateTime endDt)
|
|
|
+ List<Pm_WageSheet> pm_WageSheetDattaSources, List<UserNameView> userNames, int userId, string thisYearMonth, DateTime startDt, DateTime endDt)
|
|
|
{
|
|
|
if (pm_WageSheetDattaSources.Count <= 0)
|
|
|
{
|
|
@@ -41,7 +41,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
return _result;
|
|
|
}
|
|
|
|
|
|
- if (userNames.Count <= 0 )
|
|
|
+ if (userNames.Count <= 0)
|
|
|
{
|
|
|
var nameData = await _usersRep.GetUserNameList(1);
|
|
|
userNames = nameData.Data;
|
|
@@ -67,586 +67,541 @@ namespace OASystem.API.OAMethodLib
|
|
|
}
|
|
|
|
|
|
_result.Msg = string.Empty;
|
|
|
- foreach (var pm_wsInfo in pm_WageSheetDattaSources)
|
|
|
+
|
|
|
+ try
|
|
|
{
|
|
|
- string itemName = userNames.Where(it => it.Id == pm_wsInfo.UserId).FirstOrDefault().CnName;
|
|
|
- //补贴 金额
|
|
|
- decimal meal_subsidy = 0.00M; // 午餐(午餐10元/天) 补贴 * 计算方式:单日上午请假时长(小时)大于或者等于三小时 没有餐补
|
|
|
|
|
|
- //事假 病假 总金额
|
|
|
- decimal personalLeaveTotal = 0.00M, // 事假 日薪 *计算方式:日平均工资 = 月工资/当月应出勤天数。
|
|
|
- sickLeaveTotal = 0.00M; // 病假 日薪 *计算方式:日平均工资 = 成都市最低工资标准的80%/当月应出勤天数。 短期病假=当月15天内
|
|
|
|
|
|
- //扣款金额
|
|
|
- decimal beLate_deduction = 0.00M, // 迟到 扣款金额 *计算方式:
|
|
|
- // 一个自然月内,不足 10 分钟的迟到/早退,不超过 2 次的部分,不做处罚;3 次及以上,按50元 / 次处罚;
|
|
|
- // 超过 10 分钟(含 10 分钟),不足 60 分钟的迟到/早退,按 50 元/次处罚;
|
|
|
- // 超过 60 分钟(含 60 分钟),不足 3 小时的迟到/早退,且无请假者,按旷工半日处理;超过3 小时的迟到 / 早退,且无请假者,按旷工一日处理。
|
|
|
+ foreach (var pm_wsInfo in pm_WageSheetDattaSources)
|
|
|
+ {
|
|
|
+ string itemName = userNames.Where(it => it.Id == pm_wsInfo.UserId).FirstOrDefault().CnName;
|
|
|
+ //补贴 金额
|
|
|
+ decimal meal_subsidy = 0.00M; // 午餐(午餐10元/天) 补贴 * 计算方式:单日上午请假时长(小时)大于或者等于三小时 没有餐补
|
|
|
|
|
|
- early_deduction = 0.00M, // 早退 扣款金额
|
|
|
- absenteeism_deduction = 0.00M, // 旷工 扣款金额 *计算方式:旷工扣发当日工资
|
|
|
- unprinted_deduction = 0.00M, // 未打卡 扣款金额 *计算方式:
|
|
|
- // 试用期员工每月有 2 次 补卡机会,超过 2 次不足 5 次的部分,按 10 元 / 次处罚,5 次及以上的漏卡,按 50 元 / 次处罚;
|
|
|
- // 正式员工每月 3 次以内的补卡,按 10 元 / 次处罚,3 次及以上的漏卡,按 50 元 / 次处罚。
|
|
|
- sickLeave_deduction = 0.00M,
|
|
|
- other_deduction = 0.00M; // 其他 扣款金额
|
|
|
+ //事假 病假 总金额
|
|
|
+ decimal personalLeaveTotal = 0.00M, // 事假 日薪 *计算方式:日平均工资 = 月工资/当月应出勤天数。
|
|
|
+ sickLeaveTotal = 0.00M; // 病假 日薪 *计算方式:日平均工资 = 成都市最低工资标准的80%/当月应出勤天数。 短期病假=当月15天内
|
|
|
|
|
|
- decimal meal_deduction = 0.00M; // 餐补 扣款金额
|
|
|
- decimal reissuecard_deduction = 0.00M; // 补卡 扣款金额
|
|
|
+ //扣款金额
|
|
|
+ decimal beLate_deduction = 0.00M, // 迟到 扣款金额 *计算方式:
|
|
|
+ // 一个自然月内,不足 10 分钟的迟到/早退,不超过 2 次的部分,不做处罚;3 次及以上,按50元 / 次处罚;
|
|
|
+ // 超过 10 分钟(含 10 分钟),不足 60 分钟的迟到/早退,按 50 元/次处罚;
|
|
|
+ // 超过 60 分钟(含 60 分钟),不足 3 小时的迟到/早退,且无请假者,按旷工半日处理;超过3 小时的迟到 / 早退,且无请假者,按旷工一日处理。
|
|
|
|
|
|
- //打卡数据
|
|
|
- Data? checkInData = checkInDatas.Where(it => it.base_info.name == itemName).FirstOrDefault();
|
|
|
+ early_deduction = 0.00M, // 早退 扣款金额
|
|
|
+ absenteeism_deduction = 0.00M, // 旷工 扣款金额 *计算方式:旷工扣发当日工资
|
|
|
+ unprinted_deduction = 0.00M, // 未打卡 扣款金额 *计算方式:
|
|
|
+ // 试用期员工每月有 2 次 补卡机会,超过 2 次不足 5 次的部分,按 10 元 / 次处罚,5 次及以上的漏卡,按 50 元 / 次处罚;
|
|
|
+ // 正式员工每月 3 次以内的补卡,按 10 元 / 次处罚,3 次及以上的漏卡,按 50 元 / 次处罚。
|
|
|
+ sickLeave_deduction = 0.00M,
|
|
|
+ other_deduction = 0.00M; // 其他 扣款金额
|
|
|
|
|
|
- if (checkInData == null) { continue; }
|
|
|
- string acctid = checkInData.base_info.acctid; //用户Id
|
|
|
+ decimal meal_deduction = 0.00M; // 餐补 扣款金额
|
|
|
+ decimal reissuecard_deduction = 0.00M; // 补卡 扣款金额
|
|
|
|
|
|
- //当月总计数据
|
|
|
- Summary_Info? summary_Info = checkInData.summary_info;
|
|
|
- if (summary_Info == null) { continue; }
|
|
|
+ //打卡数据
|
|
|
+ Data? checkInData = checkInDatas.Where(it => it.base_info.name == itemName).FirstOrDefault();
|
|
|
|
|
|
- int work_days = summary_Info.work_days; //应出勤天数
|
|
|
- int regular_days = summary_Info.regular_days; //正常出勤天数
|
|
|
+ if (checkInData == null) { continue; }
|
|
|
+ string acctid = checkInData.base_info.acctid; //用户Id
|
|
|
|
|
|
- meal_subsidy = work_days * 10; //应发放餐补
|
|
|
+ //当月总计数据
|
|
|
+ Summary_Info? summary_Info = checkInData.summary_info;
|
|
|
+ if (summary_Info == null) { continue; }
|
|
|
|
|
|
- #region 计算日工资 正常日薪 事假日薪 病假日薪
|
|
|
+ int work_days = summary_Info.work_days; //应出勤天数
|
|
|
+ int regular_days = summary_Info.regular_days; //正常出勤天数
|
|
|
|
|
|
- //月 - 应发工资
|
|
|
- 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.OtherSubsidies + pm_wsInfo.GroupCost;
|
|
|
+ meal_subsidy = work_days * 10; //应发放餐补
|
|
|
|
|
|
- // 日薪 = *计算方式:日平均工资 = 月工资/当月应出勤天数。
|
|
|
- decimal dailyWage = ConvertToDecimal(amountPayable / work_days);
|
|
|
+ #region 计算日工资 正常日薪 事假日薪 病假日薪
|
|
|
|
|
|
- // 病假日薪 *计算方式:日平均工资 = 成都市最低工资标准的80%/当月应出勤天数。 短期病假=当月15天内
|
|
|
- decimal sickLeave_dailywage = ConvertToDecimal(_chengDuMinimumWage / work_days);
|
|
|
+ //月 - 应发工资
|
|
|
+ decimal amountPayable = pm_wsInfo.Basic + pm_wsInfo.Floats + pm_wsInfo.PostAllowance + pm_wsInfo.InformationSecurityFee + pm_wsInfo.OtherSubsidies;
|
|
|
|
|
|
- //病假 一天扣款
|
|
|
- sickLeave_deduction = dailyWage - sickLeave_dailywage;
|
|
|
+ // 日薪 = *计算方式:日平均工资 = 月工资/当月应出勤天数。
|
|
|
+ decimal dailyWage = ConvertToDecimal(amountPayable / work_days);
|
|
|
|
|
|
- #endregion
|
|
|
+ // 病假日薪 *计算方式:日平均工资 = 成都市最低工资标准的80%/当月应出勤天数。 短期病假=当月15天内
|
|
|
+ decimal sickLeave_dailywage = ConvertToDecimal(_chengDuMinimumWage / work_days);
|
|
|
|
|
|
- int annualLeaveNum = 0, //年假
|
|
|
- personalLeaveNum = 0, //事假
|
|
|
- sickLeaveNum = 0, //病假
|
|
|
- lieuLeaveNum = 0, //调休假
|
|
|
- marriageLeaveNum = 0, //婚嫁
|
|
|
- maternityLeaveNum = 0, //产假
|
|
|
- paternityLeaveNum = 0, //陪产假
|
|
|
- funeralLeaveNum = 0, //丧假
|
|
|
- reissueCardNum = 0, //补卡 次数
|
|
|
- evectionNum = 0, //出差 次数
|
|
|
- outIngNum = 0, //外出 次数
|
|
|
- outWorkNum = 0, //外勤 次数
|
|
|
- otherLeaveNum = 0; //其他
|
|
|
+ //病假 一天扣款
|
|
|
+ sickLeave_deduction = dailyWage - sickLeave_dailywage;
|
|
|
|
|
|
+ #endregion
|
|
|
|
|
|
- #region 假勤 处理 1-请假;2-补卡;3-出差;4-外出;100-外勤;
|
|
|
+ int annualLeaveNum = 0, //年假
|
|
|
+ personalLeaveNum = 0, //事假
|
|
|
+ sickLeaveNum = 0, //病假
|
|
|
+ lieuLeaveNum = 0, //调休假
|
|
|
+ marriageLeaveNum = 0, //婚嫁
|
|
|
+ maternityLeaveNum = 0, //产假
|
|
|
+ paternityLeaveNum = 0, //陪产假
|
|
|
+ funeralLeaveNum = 0, //丧假
|
|
|
+ reissueCardNum = 0, //补卡 次数
|
|
|
+ evectionNum = 0, //出差 次数
|
|
|
+ outIngNum = 0, //外出 次数
|
|
|
+ outWorkNum = 0, //外勤 次数
|
|
|
+ otherLeaveNum = 0; //其他
|
|
|
|
|
|
- List<Sp_Item>? sp_items = checkInData.sp_items.Where(it => it.count != 0).ToList();
|
|
|
- if (sp_items != null && sp_items.Count > 0)
|
|
|
- {
|
|
|
- annualLeaveNum = Fallibilitydispose(sp_items, 1, "年假");
|
|
|
- personalLeaveNum = Fallibilitydispose(sp_items, 1, "事假");
|
|
|
- sickLeaveNum = Fallibilitydispose(sp_items, 1, "病假");
|
|
|
- lieuLeaveNum = Fallibilitydispose(sp_items, 1, "调休假");
|
|
|
- marriageLeaveNum = Fallibilitydispose(sp_items, 1, "婚嫁");
|
|
|
- maternityLeaveNum = Fallibilitydispose(sp_items, 1, "产假");
|
|
|
- paternityLeaveNum = Fallibilitydispose(sp_items, 1, "陪产假");
|
|
|
- funeralLeaveNum = Fallibilitydispose(sp_items, 1, "丧假");
|
|
|
- otherLeaveNum = Fallibilitydispose(sp_items, 1, "其他");
|
|
|
- reissueCardNum = Fallibilitydispose(sp_items, 2, "补卡次数");
|
|
|
- evectionNum = Fallibilitydispose(sp_items, 3, "出差");
|
|
|
- outIngNum = Fallibilitydispose(sp_items, 4, "外出");
|
|
|
- outWorkNum = Fallibilitydispose(sp_items, 3, "外勤");
|
|
|
- }
|
|
|
|
|
|
- #region 请假类型金额/餐补 处理
|
|
|
-
|
|
|
- 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;
|
|
|
- }
|
|
|
+ #region 假勤 处理 1-请假;2-补卡;3-出差;4-外出;100-外勤;
|
|
|
|
|
|
+ List<Sp_Item>? sp_items = checkInData.sp_items.Where(it => it.count != 0).ToList();
|
|
|
+ if (sp_items != null && sp_items.Count > 0)
|
|
|
+ {
|
|
|
+ annualLeaveNum = Fallibilitydispose(sp_items, 1, "年假");
|
|
|
+ personalLeaveNum = Fallibilitydispose(sp_items, 1, "事假");
|
|
|
+ sickLeaveNum = Fallibilitydispose(sp_items, 1, "病假");
|
|
|
+ lieuLeaveNum = Fallibilitydispose(sp_items, 1, "调休假");
|
|
|
+ marriageLeaveNum = Fallibilitydispose(sp_items, 1, "婚嫁");
|
|
|
+ maternityLeaveNum = Fallibilitydispose(sp_items, 1, "产假");
|
|
|
+ paternityLeaveNum = Fallibilitydispose(sp_items, 1, "陪产假");
|
|
|
+ funeralLeaveNum = Fallibilitydispose(sp_items, 1, "丧假");
|
|
|
+ otherLeaveNum = Fallibilitydispose(sp_items, 1, "其他");
|
|
|
+ reissueCardNum = Fallibilitydispose(sp_items, 2, "补卡次数");
|
|
|
+ evectionNum = Fallibilitydispose(sp_items, 3, "出差");
|
|
|
+ outIngNum = Fallibilitydispose(sp_items, 4, "外出");
|
|
|
+ outWorkNum = Fallibilitydispose(sp_items, 3, "外勤");
|
|
|
+ }
|
|
|
|
|
|
- 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>();
|
|
|
+ #region 请假类型金额/餐补 处理
|
|
|
|
|
|
- foreach (Sp_Detail sp_item in sp_leave_details)
|
|
|
- {
|
|
|
- Apply_data? apply_data = sp_item.apply_data;
|
|
|
- if (apply_data != null)
|
|
|
+ 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)
|
|
|
{
|
|
|
- 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(); //多行文本
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 请假 审批数据获取未获取到!\r\n";
|
|
|
+ //continue;
|
|
|
+ }
|
|
|
|
|
|
- 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 文本描述值
|
|
|
+ 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>();
|
|
|
|
|
|
- int leaveType = int.Parse(optionsItems[0].key); //key 请假子类型 id
|
|
|
- Date_range date_Range = attendance.date_range;
|
|
|
+ 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 (startDt >= date_Range.new_begin_dt && date_Range.new_end_dt <= endDt)
|
|
|
+ if (content_Vacation != null)
|
|
|
{
|
|
|
- continue;
|
|
|
- }
|
|
|
+ Vacation vacation = content_Vacation.value.vacation;
|
|
|
+ Attendance attendance = vacation.attendance; //假勤组件
|
|
|
+ Selector selector = vacation.selector; //请假类型
|
|
|
|
|
|
- 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");
|
|
|
+ List<OptionsItem> optionsItems = selector.options; //key 请假类型 id
|
|
|
+ List<TitleItem> value = optionsItems[0].value; // value 文本描述值
|
|
|
|
|
|
- string typeName = string.Empty;
|
|
|
- int leaveTypeId = leaveType;
|
|
|
- var leaveTypeData = vacationLeaveTypes.Where(it => it.id == leaveTypeId).FirstOrDefault();
|
|
|
+ int leaveType = int.Parse(optionsItems[0].key); //key 请假子类型 id
|
|
|
+ Date_range date_Range = attendance.date_range;
|
|
|
|
|
|
- if (leaveTypeData != null) { typeName = leaveTypeData.name; }
|
|
|
- //计算请假类型扣款金额
|
|
|
+ //筛选 不在工作日内的假勤申请
|
|
|
+ if (startDt >= date_Range.new_begin_dt && date_Range.new_end_dt <= endDt)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- decimal new_duration = 0.00M;
|
|
|
- if (date_Range.type == "halfday")
|
|
|
- {
|
|
|
- new_duration = Convert.ToDecimal(date_Range.new_duration) / 86400M;
|
|
|
- }
|
|
|
- else if (date_Range.type == "hour")
|
|
|
- {
|
|
|
- new_duration = Convert.ToDecimal(date_Range.new_duration) / 3600M;
|
|
|
- }
|
|
|
- decimal leave_meals = 0.00M;
|
|
|
+ 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");
|
|
|
|
|
|
- //计算餐补 假勤类型扣款
|
|
|
- CalculateTypeFee(leaveType, date_Range.type, leave_starttime, leave_endtime, amountPayable, work_days, new_duration,
|
|
|
- out leave_meals, out thisTypeDeduction);
|
|
|
+ string typeName = string.Empty;
|
|
|
+ int leaveTypeId = leaveType;
|
|
|
+ var leaveTypeData = vacationLeaveTypes.Where(it => it.id == leaveTypeId).FirstOrDefault();
|
|
|
|
|
|
- #region 累计类型扣款
|
|
|
- //1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他;9丧假
|
|
|
+ if (leaveTypeData != null) { typeName = leaveTypeData.name; }
|
|
|
+ //计算请假类型扣款金额
|
|
|
|
|
|
- if (leaveType == 2) //事假
|
|
|
- {
|
|
|
- personalLeaveTotal += thisTypeDeduction;
|
|
|
- }
|
|
|
- else if (leaveType == 3) //病假
|
|
|
- {
|
|
|
+ decimal new_duration = 0.00M;
|
|
|
+ if (date_Range.type == "halfday")
|
|
|
+ {
|
|
|
+ new_duration = Convert.ToDecimal(date_Range.new_duration) / 86400M;
|
|
|
+ }
|
|
|
+ else if (date_Range.type == "hour")
|
|
|
+ {
|
|
|
+ new_duration = Convert.ToDecimal(date_Range.new_duration) / 3600M;
|
|
|
+ }
|
|
|
+ decimal leave_meals = 0.00M;
|
|
|
|
|
|
- sickLeaveTotal = thisTypeDeduction;
|
|
|
- }
|
|
|
+ //计算餐补 假勤类型扣款
|
|
|
+ CalculateTypeFee(leaveType, date_Range.type, leave_starttime, leave_endtime, amountPayable, work_days, new_duration,
|
|
|
+ out leave_meals, out thisTypeDeduction);
|
|
|
|
|
|
- #endregion
|
|
|
+ #region 累计类型扣款
|
|
|
+ //1年假;2事假;3病假;4调休假;5婚假;6产假;7陪产假;8其他;9丧假
|
|
|
+
|
|
|
+ if (leaveType == 2) //事假
|
|
|
+ {
|
|
|
+ personalLeaveTotal += thisTypeDeduction;
|
|
|
+ }
|
|
|
+ else if (leaveType == 3) //病假
|
|
|
+ {
|
|
|
|
|
|
- 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");
|
|
|
+ sickLeaveTotal = thisTypeDeduction;
|
|
|
+ }
|
|
|
|
|
|
- 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")),
|
|
|
- Duration = new_duration,
|
|
|
- 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);
|
|
|
+ #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")),
|
|
|
+ Duration = new_duration,
|
|
|
+ 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
|
|
|
+ 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
|
|
|
+ #endregion
|
|
|
|
|
|
+ #endregion
|
|
|
|
|
|
- Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" }; //打卡
|
|
|
- List<Ex_Item> ex_Item_Infos = new List<Ex_Item>();
|
|
|
- #region 打卡补卡 补卡次数 处理
|
|
|
+ Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" }; //打卡
|
|
|
+ List<Ex_Item> ex_reissuecard_Items = new List<Ex_Item>();
|
|
|
+ #region 打卡补卡 补卡次数 处理
|
|
|
|
|
|
- if (reissueCardNum > 0)
|
|
|
- {
|
|
|
- if (reissueCardNum <= 3)
|
|
|
- {
|
|
|
- reissuecard_deduction += 10 * reissueCardNum;
|
|
|
- }
|
|
|
- else if (reissueCardNum > 3) //补卡超过三 每补卡一次 50 CNY
|
|
|
+ if (reissueCardNum > 0)
|
|
|
{
|
|
|
- int for_reissueCardNum = reissueCardNum - 3;
|
|
|
-
|
|
|
- for (int i = 0; i < for_reissueCardNum; i++)
|
|
|
+ if (reissueCardNum <= 3)
|
|
|
+ {
|
|
|
+ reissuecard_deduction += 10 * reissueCardNum;
|
|
|
+ }
|
|
|
+ else if (reissueCardNum > 3) //补卡超过三 每补卡一次 50 CNY
|
|
|
{
|
|
|
- reissuecard_deduction += 50;
|
|
|
+ int for_reissueCardNum = reissueCardNum - 3;
|
|
|
+
|
|
|
+ for (int i = 0; i < for_reissueCardNum; i++)
|
|
|
+ {
|
|
|
+ reissuecard_deduction += 50;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ Ex_Item ex_reissueCard = new Ex_Item()
|
|
|
+ {
|
|
|
+ SubTypeId = 7,
|
|
|
+ SubType = "补卡次数",
|
|
|
+ Duration = reissueCardNum,
|
|
|
+ Deduction = reissuecard_deduction,
|
|
|
+ Reason = "补卡:员工发现自己漏打卡时,需及时提起补卡申请,并说明情况。试用期员工每月有 2 次\r\n补卡机会,超过 2 次不足 5 次的部分,按 10 元/次处罚,5 次及以上的漏卡,按 50 元/次处罚;正式员工每月 3 次以内的补卡,按 10 元/次处罚,3 次及以上的漏卡,按 50 元/次处罚。\r\n补卡路径为:企微-工作台-审批-打卡补卡。",
|
|
|
+ unit = string.Empty
|
|
|
+ };
|
|
|
+
|
|
|
+ ex_reissuecard_Items.Add(ex_reissueCard);
|
|
|
}
|
|
|
|
|
|
- Ex_Item ex_reissueCard = new Ex_Item()
|
|
|
- {
|
|
|
- SubTypeId = 7,
|
|
|
- SubType = "补卡次数",
|
|
|
- Deduction = reissuecard_deduction,
|
|
|
- Reason = "补卡:员工发现自己漏打卡时,需及时提起补卡申请,并说明情况。试用期员工每月有 2 次\r\n补卡机会,超过 2 次不足 5 次的部分,按 10 元/次处罚,5 次及以上的漏卡,按 50 元/次处罚;正式员工每月 3 次以内的补卡,按 10 元/次处罚,3 次及以上的漏卡,按 50 元/次处罚。\r\n补卡路径为:企微-工作台-审批-打卡补卡。",
|
|
|
- unit = string.Empty
|
|
|
- };
|
|
|
-
|
|
|
- ex_Item_Infos.Add(ex_reissueCard);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
|
|
|
- List<Ex_Item> ex_reissuecard_Items = new List<Ex_Item>();
|
|
|
- //List<dynamic> ex_reissuecard_Items = new List<dynamic>();
|
|
|
- List<Sp_Detail> sp_reissuecard_details = new List<Sp_Detail>();
|
|
|
+ List<Sp_Detail> sp_reissuecard_details = new List<Sp_Detail>();
|
|
|
|
|
|
- //统计迟到次数
|
|
|
- int beLateNum = 0, // 1-迟到;
|
|
|
- leaveEarlyNum = 0, // 2-早退;
|
|
|
- dummyDeckNum = 0, // 3-缺卡;
|
|
|
- minerNum = 0, // 4-旷工;
|
|
|
- locationAnomalyNum = 0, // 5-地点异常;
|
|
|
- unitExNum = 0; // 6-设备异常;
|
|
|
+ //统计迟到次数
|
|
|
+ int beLateNum = 0, // 1-迟到;
|
|
|
+ leaveEarlyNum = 0, // 2-早退;
|
|
|
+ dummyDeckNum = 0, // 3-缺卡;
|
|
|
+ minerNum = 0, // 4-旷工;
|
|
|
+ locationAnomalyNum = 0, // 5-地点异常;
|
|
|
+ unitExNum = 0; // 6-设备异常;
|
|
|
|
|
|
- if (summary_Info.except_days > 0)
|
|
|
- {
|
|
|
- List<Exception_Info>? ex_infos = checkInData.exception_infos;
|
|
|
- if (ex_infos != null && ex_infos.Count >= 0)
|
|
|
+ if (summary_Info.except_days > 0)
|
|
|
{
|
|
|
- beLateNum = ExceptionStatistics(ex_infos, 1);
|
|
|
- leaveEarlyNum = ExceptionStatistics(ex_infos, 2);
|
|
|
- dummyDeckNum = ExceptionStatistics(ex_infos, 3);
|
|
|
- minerNum = ExceptionStatistics(ex_infos, 4);
|
|
|
- locationAnomalyNum = ExceptionStatistics(ex_infos, 5);
|
|
|
- unitExNum = ExceptionStatistics(ex_infos, 6);
|
|
|
+ List<Exception_Info>? ex_infos = checkInData.exception_infos;
|
|
|
+ if (ex_infos != null && ex_infos.Count >= 0)
|
|
|
+ {
|
|
|
+ beLateNum = ExceptionStatistics(ex_infos, 1);
|
|
|
+ leaveEarlyNum = ExceptionStatistics(ex_infos, 2);
|
|
|
+ dummyDeckNum = ExceptionStatistics(ex_infos, 3);
|
|
|
+ minerNum = ExceptionStatistics(ex_infos, 4);
|
|
|
+ locationAnomalyNum = ExceptionStatistics(ex_infos, 5);
|
|
|
+ unitExNum = ExceptionStatistics(ex_infos, 6);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- //打卡记录
|
|
|
- CheckInDataView checkInDataView = new CheckInDataView();
|
|
|
- checkInDataView = await _qiYeWeChatApiService.GetCheckinDataAsync(new List<string>() { acctid },3,startDt,endDt);
|
|
|
+ //打卡记录
|
|
|
+ CheckInDataView checkInDataView = new CheckInDataView();
|
|
|
+ checkInDataView = await _qiYeWeChatApiService.GetCheckinDataAsync(new List<string>() { acctid }, 3, startDt, endDt);
|
|
|
|
|
|
- if (checkInDataView.errcode != 0)
|
|
|
- {
|
|
|
- _result.Msg += startDt + " - " + endDt + " " + itemName + " 打卡记录 "+ checkInDataView.errmsg + " \r\n";
|
|
|
- }
|
|
|
+ if (checkInDataView.errcode != 0)
|
|
|
+ {
|
|
|
+ _result.Msg += startDt + " - " + endDt + " " + itemName + " 打卡记录 " + checkInDataView.errmsg + " \r\n";
|
|
|
+ }
|
|
|
|
|
|
- //筛选时间异常的打卡记录
|
|
|
- List<CheckInDataInfo> checkInDataInfos = checkInDataView.checkindata.Where(it => !string.IsNullOrEmpty(it.exception_type)).ToList();
|
|
|
+ //筛选时间异常的打卡记录
|
|
|
+ List<CheckInDataInfo> checkInDataInfos = checkInDataView.checkindata.Where(it => !string.IsNullOrEmpty(it.exception_type)).ToList();
|
|
|
|
|
|
- //处理 未打卡的记录是否已经通过假勤审批
|
|
|
- List<CheckInDataInfo> leave_checkInDataInfos = new List<CheckInDataInfo>();
|
|
|
- if (checkInDataInfos.Count > 0)
|
|
|
- {
|
|
|
- foreach (var leaveItem in ex_ItemInfos)
|
|
|
+ //处理 未打卡的记录是否已经通过假勤审批
|
|
|
+ List<CheckInDataInfo> leave_checkInDataInfos = new List<CheckInDataInfo>();
|
|
|
+ if (checkInDataInfos.Count > 0)
|
|
|
{
|
|
|
- if (leaveItem.StartTimeDt.ToString("yyyy-MM-dd").Equals(leaveItem.EndTimeDt.ToString("yyyy-MM-dd"))) //单天
|
|
|
- {
|
|
|
- leave_checkInDataInfos.AddRange(checkInDataInfos.Where(it => it.checkin_time_dt.ToString("yyyy-MM-dd") == leaveItem.StartTimeDt.ToString("yyyy-MM-dd")).ToList());
|
|
|
- }
|
|
|
- else //多天
|
|
|
+ foreach (var leaveItem in ex_ItemInfos)
|
|
|
{
|
|
|
- leave_checkInDataInfos.AddRange(checkInDataInfos.Where(it => it.checkin_time_dt >= leaveItem.StartTimeDt && it.checkin_time_dt <=leaveItem.EndTimeDt ).ToList());
|
|
|
+ if (leaveItem.StartTimeDt.ToString("yyyy-MM-dd").Equals(leaveItem.EndTimeDt.ToString("yyyy-MM-dd"))) //单天
|
|
|
+ {
|
|
|
+ leave_checkInDataInfos.AddRange(checkInDataInfos.Where(it => it.checkin_time_dt.ToString("yyyy-MM-dd") == leaveItem.StartTimeDt.ToString("yyyy-MM-dd")).ToList());
|
|
|
+ }
|
|
|
+ else //多天
|
|
|
+ {
|
|
|
+ leave_checkInDataInfos.AddRange(checkInDataInfos.Where(it => it.checkin_time_dt >= leaveItem.StartTimeDt && it.checkin_time_dt <= leaveItem.EndTimeDt).ToList());
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- //处理 时间异常的记录是否已经通过补卡审批
|
|
|
- List<CheckInDataInfo> pullcard_checkInDataInfos = new List<CheckInDataInfo>();
|
|
|
- if (leave_checkInDataInfos.Count > 0)
|
|
|
- {
|
|
|
- //获取异常打卡数据 并且 未通过假勤审批
|
|
|
- pullcard_checkInDataInfos = checkInDataInfos.Except(leave_checkInDataInfos).ToList();
|
|
|
|
|
|
- if (pullcard_checkInDataInfos.Count > 0)
|
|
|
+ //处理 时间异常的记录是否已经通过补卡审批
|
|
|
+ List<CheckInDataInfo> pullcard_checkInDataInfos = new List<CheckInDataInfo>();
|
|
|
+ if (leave_checkInDataInfos.Count > 0)
|
|
|
{
|
|
|
+ //获取异常打卡数据 并且 未通过假勤审批
|
|
|
+ pullcard_checkInDataInfos = checkInDataInfos.Except(leave_checkInDataInfos).ToList();
|
|
|
|
|
|
-
|
|
|
- #region 打卡异常处理 统计 1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常;
|
|
|
-
|
|
|
- //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;
|
|
|
- //}
|
|
|
-
|
|
|
- //#region 打卡补卡
|
|
|
-
|
|
|
- //foreach (var pullcardItem in sp_reissuecard_details)
|
|
|
- //{
|
|
|
- // Apply_data? apply_data = pullcardItem.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;
|
|
|
-
|
|
|
- // 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");
|
|
|
-
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- foreach (var pc_ex_item in pullcard_checkInDataInfos)
|
|
|
+ if (pullcard_checkInDataInfos.Count > 0)
|
|
|
{
|
|
|
-
|
|
|
- CheckInDayDataView checkInDayDataView = await _qiYeWeChatApiService.GetCheckInDayDataAsync(new List<string>() { acctid },startDt,endDt);
|
|
|
+ CheckInDayDataView checkInDayDataView = await _qiYeWeChatApiService.GetCheckInDayDataAsync(new List<string>() { acctid }, startDt, endDt);
|
|
|
|
|
|
if (checkInDayDataView.errcode != 0)
|
|
|
{
|
|
|
_result.Msg += startDt + " - " + endDt + " " + itemName + " 异常信息数据获取未获取到!\r\n";
|
|
|
- continue;
|
|
|
+
|
|
|
}
|
|
|
- List<Root> roots_words= checkInDayDataView.datas.Where(it => it.base_info.day_type == 0).ToList(); //获取工作日日报信息
|
|
|
+ List<Root> roots_words = checkInDayDataView.datas.Where(it => it.base_info.day_type == 0).ToList(); //获取工作日日报信息
|
|
|
List<Root> roots_exs = checkInDayDataView.datas.Where(it => it.exception_infos.Count > 0).ToList();
|
|
|
- Root roots_ex = roots_exs.Where(it => it.base_info.dateDt == pc_ex_item.sch_checkin_time_dt).FirstOrDefault();
|
|
|
- if (roots_ex != null) {
|
|
|
- List<Exception_infos> exception_infos = roots_ex.exception_infos;
|
|
|
|
|
|
- List<Exception_infos> exception_infos1 = checkInDayDataView.datas[29].exception_infos;
|
|
|
- string exc_type = pc_ex_item.exception_type;
|
|
|
|
|
|
- if (exc_type.Contains("时间异常") || exc_type.Contains("未打卡")) // 时间异常 未打卡
|
|
|
+ foreach (var roots_ex in roots_exs)
|
|
|
{
|
|
|
- int day_time_minute = (60 * 7) + 30;
|
|
|
+ foreach (var exception_info in roots_ex.exception_infos)
|
|
|
+ {
|
|
|
+ decimal timelength = (Convert.ToDecimal(exception_info.duration) / 3600.00M) * 60.00M; //时长 分钟
|
|
|
+ int exception = exception_info.exception; //异常类型
|
|
|
+ decimal day_miner_unit = dailyWage / 15; //以0.5小时为单位
|
|
|
|
|
|
- Exception_infos beLate_ex = exception_infos.Where(it => it.exception == 1).FirstOrDefault(); //迟到
|
|
|
- decimal day_miner_unit = dailyWage / 15; //以0.5小时为单位
|
|
|
+ //1:一个自然月内,不足 10 分钟的迟到/早退,不超过 2 次的部分,不做处罚;3 次及以上,按50 元 / 次处罚;
|
|
|
+ //2:超过 10 分钟(含 10 分钟),不足 60 分钟的迟到 / 早退,按 50 元 / 次处罚;
|
|
|
+ //3:超过 60 分钟(含 60 分钟),不足 3 小时的迟到 / 早退,且无请假者,按旷工半日处理;超过 3 小时的迟到 / 早退,且无请假者,按旷工一日处理。
|
|
|
|
|
|
- if (beLate_ex != null)
|
|
|
- {
|
|
|
- if (beLateNum > 0) //迟到次数
|
|
|
+
|
|
|
+ Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
{
|
|
|
- //1:一个自然月内,不足 10 分钟的迟到/早退,不超过 2 次的部分,不做处罚;3 次及以上,按50 元 / 次处罚;
|
|
|
- //2:超过 10 分钟(含 10 分钟),不足 60 分钟的迟到 / 早退,按 50 元 / 次处罚;
|
|
|
- //3:超过 60 分钟(含 60 分钟),不足 3 小时的迟到 / 早退,且无请假者,按旷工半日处理;超过 3 小时的迟到 / 早退,且无请假者,按旷工一日处理。
|
|
|
+ SubTypeId = 4,
|
|
|
+ SubType = "旷工",
|
|
|
+ Duration = timelength,
|
|
|
+ StartTimeDt = roots_ex.base_info.dateDt,
|
|
|
+ unit = "分钟",
|
|
|
+ };
|
|
|
|
|
|
- Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+
|
|
|
+ decimal day_beLate_deduction = 0.00M;
|
|
|
+ //1 - 迟到;2 - 早退;3 - 缺卡;4 - 旷工;5 - 地点异常;6 - 设备异常
|
|
|
+ if (exception == 1) //迟到
|
|
|
+ {
|
|
|
+ if (timelength < 10)
|
|
|
{
|
|
|
- SubTypeId = 4,
|
|
|
- SubType = "旷工",
|
|
|
- unit = "分钟",
|
|
|
- };
|
|
|
- decimal day_beLate_deduction = 0.00M;
|
|
|
- if (beLate_ex.duration >= 10 && beLate_ex.duration <= 60)
|
|
|
+ reissueCardNum++;
|
|
|
+ beLate_belate_ex.SubTypeId = 1;
|
|
|
+ beLate_belate_ex.SubType = "迟到";
|
|
|
+
|
|
|
+ if (reissueCardNum >= 3)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = 50.00M;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (timelength >= 10 && timelength <= 60)
|
|
|
{
|
|
|
- day_beLate_deduction = beLateNum * 50;
|
|
|
+ day_beLate_deduction = 50.00M;
|
|
|
beLate_belate_ex.SubTypeId = 1;
|
|
|
beLate_belate_ex.SubType = "迟到";
|
|
|
}
|
|
|
- else if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ else if (timelength > 60 && timelength <= 180)
|
|
|
{
|
|
|
day_beLate_deduction = day_miner_unit * 6; //3小时
|
|
|
|
|
|
}
|
|
|
- else day_beLate_deduction = dailyWage;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_beLate_deduction = dailyWage;
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ }
|
|
|
|
|
|
beLate_deduction += day_beLate_deduction;
|
|
|
-
|
|
|
-
|
|
|
- beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- if (leaveEarlyNum > 0) // 早退次数
|
|
|
+ else if (exception == 2) //早退
|
|
|
{
|
|
|
- //1:一个自然月内,不足 10 分钟的迟到/早退,不超过 2 次的部分,不做处罚;3 次及以上,按50 元 / 次处罚;
|
|
|
- //2:超过 10 分钟(含 10 分钟),不足 60 分钟的迟到 / 早退,按 50 元 / 次处罚;
|
|
|
- //3:超过 60 分钟(含 60 分钟),不足 3 小时的迟到 / 早退,且无请假者,按旷工半日处理;超过 3 小时的迟到 / 早退,且无请假者,按旷工一日处理。
|
|
|
-
|
|
|
- Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ if (timelength < 10)
|
|
|
{
|
|
|
- SubTypeId = 4,
|
|
|
- SubType = "旷工",
|
|
|
- unit = "分钟",
|
|
|
- };
|
|
|
- decimal day_beLate_deduction = 0.00M;
|
|
|
- if (beLate_ex.duration >= 10 && beLate_ex.duration <= 60)
|
|
|
+ reissueCardNum++;
|
|
|
+ beLate_belate_ex.SubTypeId = 2;
|
|
|
+ beLate_belate_ex.SubType = "早退";
|
|
|
+
|
|
|
+ if (reissueCardNum >= 3)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = 50.00M;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (timelength >= 10 && timelength <= 60)
|
|
|
{
|
|
|
- day_beLate_deduction = beLateNum * 50;
|
|
|
- beLate_belate_ex.SubTypeId = 3;
|
|
|
- beLate_belate_ex.SubType = "未打卡/漏卡";
|
|
|
+ day_beLate_deduction = 50.00M;
|
|
|
+ beLate_belate_ex.SubTypeId = 2;
|
|
|
+ beLate_belate_ex.SubType = "早退";
|
|
|
}
|
|
|
- else if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ else if (timelength > 60 && timelength <= 180)
|
|
|
{
|
|
|
day_beLate_deduction = day_miner_unit * 6; //3小时
|
|
|
|
|
|
}
|
|
|
- else day_beLate_deduction = dailyWage;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_beLate_deduction = dailyWage;
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ }
|
|
|
|
|
|
beLate_deduction += day_beLate_deduction;
|
|
|
-
|
|
|
- beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
}
|
|
|
-
|
|
|
- if (dummyDeckNum > 0) //缺卡
|
|
|
+ else if (exception == 3) //缺卡
|
|
|
{
|
|
|
- Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
+ if (timelength < 10)
|
|
|
{
|
|
|
- SubTypeId = 4,
|
|
|
- SubType = "旷工",
|
|
|
- unit = "分钟",
|
|
|
- };
|
|
|
- decimal day_beLate_deduction = 0.00M;
|
|
|
- if (beLate_ex.duration >= 10 && beLate_ex.duration <= 60)
|
|
|
+ reissueCardNum++;
|
|
|
+ beLate_belate_ex.SubTypeId = 3;
|
|
|
+ beLate_belate_ex.SubType = "缺卡";
|
|
|
+
|
|
|
+ if (reissueCardNum >= 3)
|
|
|
+ {
|
|
|
+ day_beLate_deduction = 50.00M;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (timelength >= 10 && timelength <= 60)
|
|
|
{
|
|
|
- day_beLate_deduction = beLateNum * 50;
|
|
|
- beLate_belate_ex.SubTypeId = 2;
|
|
|
- beLate_belate_ex.SubType = "早退";
|
|
|
+ day_beLate_deduction = 50.00M;
|
|
|
+ beLate_belate_ex.SubTypeId = 3;
|
|
|
+ beLate_belate_ex.SubType = "缺卡";
|
|
|
}
|
|
|
- else if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ else if (timelength > 60 && timelength <= 180)
|
|
|
{
|
|
|
day_beLate_deduction = day_miner_unit * 6; //3小时
|
|
|
|
|
|
}
|
|
|
- else day_beLate_deduction = dailyWage;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_beLate_deduction = dailyWage;
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ }
|
|
|
|
|
|
beLate_deduction += day_beLate_deduction;
|
|
|
-
|
|
|
- beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
}
|
|
|
-
|
|
|
- if (minerNum > 0) //矿工
|
|
|
+ else if (exception == 4) //旷工
|
|
|
{
|
|
|
- Ex_Item beLate_belate_ex = new Ex_Item()
|
|
|
- {
|
|
|
- SubTypeId = 4,
|
|
|
- SubType = "旷工",
|
|
|
- unit = "分钟",
|
|
|
- };
|
|
|
- decimal day_beLate_deduction = 0.00M;
|
|
|
-
|
|
|
- if (beLate_ex.duration > 60 && beLate_ex.duration <= 180)
|
|
|
+ if (timelength > 60 && timelength <= 180)
|
|
|
{
|
|
|
day_beLate_deduction = day_miner_unit * 6; //3小时
|
|
|
|
|
|
}
|
|
|
- else day_beLate_deduction = dailyWage;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ day_beLate_deduction = dailyWage;
|
|
|
+ meal_deduction += 10.00M;
|
|
|
+ }
|
|
|
|
|
|
beLate_deduction += day_beLate_deduction;
|
|
|
-
|
|
|
- beLate_belate_ex.Duration = beLate_ex.duration;
|
|
|
beLate_belate_ex.Deduction = day_beLate_deduction;
|
|
|
ex_reissuecard_Items.Add(beLate_belate_ex);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (ex_reissuecard_Items.Count > 0)
|
|
|
- {
|
|
|
- ex_Items_dk.Ex_ItemInfo = ex_reissuecard_Items;
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 应发合计 实发合计 扣款合计(假勤扣款,其他扣款,社保扣款,公积金代扣,个税扣款)
|
|
|
+
|
|
|
+ decimal mealTotal = meal_subsidy - meal_deduction; //餐补
|
|
|
+ decimal salaryTotal = amountPayable + mealTotal; //应发合计
|
|
|
+
|
|
|
+ //扣款合计 不含个税
|
|
|
+ decimal eductionTotal = sickLeaveTotal + personalLeaveTotal + beLate_deduction + early_deduction + absenteeism_deduction + unprinted_deduction + other_deduction +
|
|
|
+ pm_wsInfo.WithholdingInsurance + pm_wsInfo.ReservedFunds + pm_wsInfo.OtherDeductions;
|
|
|
+ decimal actualReleaseTotal = salaryTotal - eductionTotal; //实发合计 * 不含个税
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 处理当月工资数据
|
|
|
+ pm_wsInfo.YearMonth = thisYearMonth;
|
|
|
+ pm_wsInfo.StartDate = startDt.ToString("yyyy-MM-dd");
|
|
|
+ pm_wsInfo.EndDate = endDt.ToString("yyyy-MM-dd");
|
|
|
+ pm_wsInfo.WorkDays = work_days; //当月应出勤天数
|
|
|
+ pm_wsInfo.RegularDays = regular_days; //当月正常出勤天数
|
|
|
+
|
|
|
+ pm_wsInfo.SickLeave = sickLeaveTotal; //病假
|
|
|
+ pm_wsInfo.SomethingFalse = personalLeaveTotal; //事假
|
|
|
+ pm_wsInfo.LateTo = beLate_deduction; //迟到
|
|
|
+ pm_wsInfo.LeaveEarly = early_deduction; //早退
|
|
|
+ pm_wsInfo.Absenteeism = absenteeism_deduction; //旷工
|
|
|
+ pm_wsInfo.NotPunch = unprinted_deduction; //未打卡
|
|
|
+ pm_wsInfo.OtherDeductions = other_deduction; //其他
|
|
|
+ pm_wsInfo.Ex_ItemsRemark = JsonConvert.SerializeObject(ex_Items); //
|
|
|
+ pm_wsInfo.Mealsupplement = mealTotal; //餐补
|
|
|
+
|
|
|
+ pm_wsInfo.Should = salaryTotal; //应发合计
|
|
|
+ pm_wsInfo.TotalDeductions = eductionTotal; //扣款合计
|
|
|
+ pm_wsInfo.TotalRealHair = actualReleaseTotal; //实发合计
|
|
|
+ pm_wsInfo.AfterTax = actualReleaseTotal - pm_wsInfo.WithholdingTax; //税后工资
|
|
|
+
|
|
|
+ pm_wsInfo.LastUpdateUserId = userId;
|
|
|
+ pm_wsInfo.LastUpdateDt = DateTime.Now;
|
|
|
+ pm_wsInfo.CreateUserId = userId;
|
|
|
+ pm_wsInfo.CreateTime = DateTime.Now;
|
|
|
+ pm_wsInfo.DeleteUserId = null;
|
|
|
+ pm_wsInfo.DeleteTime = null;
|
|
|
+ #endregion
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- #region 应发合计 实发合计 扣款合计(假勤扣款,其他扣款,社保扣款,公积金代扣,个税扣款)
|
|
|
-
|
|
|
- decimal mealTotal = meal_subsidy - meal_deduction; //餐补
|
|
|
- decimal salaryTotal = amountPayable + mealTotal + pm_wsInfo.SpecialAllowance; //应发合计
|
|
|
-
|
|
|
- //扣款合计 不含个税
|
|
|
- decimal eductionTotal = sickLeaveTotal + personalLeaveTotal + beLate_deduction + early_deduction + absenteeism_deduction + unprinted_deduction + other_deduction +
|
|
|
- pm_wsInfo.WithholdingInsurance + pm_wsInfo.ReservedFunds + pm_wsInfo.OtherDeductions;
|
|
|
- decimal actualReleaseTotal = salaryTotal - eductionTotal; //实发合计 * 不含个税
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 处理当月工资数据
|
|
|
- pm_wsInfo.YearMonth = thisYearMonth;
|
|
|
- pm_wsInfo.StartDate = startDt.ToString("yyyy-MM-dd");
|
|
|
- pm_wsInfo.EndDate = endDt.ToString("yyyy-MM-dd");
|
|
|
-
|
|
|
- pm_wsInfo.SickLeave = sickLeaveTotal; //病假
|
|
|
- pm_wsInfo.SomethingFalse = personalLeaveTotal; //事假
|
|
|
- pm_wsInfo.LateTo = beLate_deduction; //迟到
|
|
|
- pm_wsInfo.LeaveEarly = early_deduction; //早退
|
|
|
- pm_wsInfo.Absenteeism = absenteeism_deduction; //旷工
|
|
|
- pm_wsInfo.NotPunch = unprinted_deduction; //未打卡
|
|
|
- pm_wsInfo.OtherDeductions = other_deduction; //其他
|
|
|
- pm_wsInfo.Ex_ItemsRemark = JsonConvert.SerializeObject(ex_Items); //
|
|
|
- pm_wsInfo.Mealsupplement = mealTotal; //餐补
|
|
|
-
|
|
|
- pm_wsInfo.Should = salaryTotal; //应发合计
|
|
|
- pm_wsInfo.TotalDeductions = eductionTotal; //扣款合计
|
|
|
- pm_wsInfo.TotalRealHair = actualReleaseTotal; //实发合计
|
|
|
- pm_wsInfo.AfterTax = actualReleaseTotal - pm_wsInfo.WithholdingTax; //税后工资
|
|
|
-
|
|
|
- pm_wsInfo.LastUpdateUserId = userId;
|
|
|
- pm_wsInfo.LastUpdateDt = DateTime.Now;
|
|
|
- pm_wsInfo.CreateUserId = userId;
|
|
|
- pm_wsInfo.CreateTime = DateTime.Now;
|
|
|
- pm_wsInfo.DeleteUserId = null;
|
|
|
- pm_wsInfo.DeleteTime = null;
|
|
|
- #endregion
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+
|
|
|
+ _result.Msg = ex.Message;
|
|
|
|
|
|
+ return _result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
_result.Code = 0;
|
|
|
_result.Data = pm_WageSheetDattaSources;
|
|
|
|