1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432 |
- using Google.Protobuf.WellKnownTypes;
- using NPOI.HPSF;
- using NPOI.OpenXmlFormats.Dml.Diagram;
- using NPOI.OpenXmlFormats.Spreadsheet;
- using NPOI.SS.Formula.Functions;
- using NPOI.Util;
- 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.Collections.Generic;
- using System.Diagnostics.Eventing.Reader;
- using System.Drawing;
- using System.Linq.Expressions;
- using TencentCloud.Ocr.V20181119.Models;
- namespace OASystem.API.OAMethodLib
- {
-
-
-
- public static class PayrollComputation
- {
- private static Result _result = new Result();
- private static readonly IQiYeWeChatApiService _qiYeWeChatApiService = AutofacIocManager.Instance.GetService<IQiYeWeChatApiService>();
- private static readonly UsersRepository _usersRep = AutofacIocManager.Instance.GetService<UsersRepository>();
- private static readonly IMapper _mapper = AutofacIocManager.Instance.GetService<IMapper>();
- private static readonly decimal _chengDuMinimumWage = 2100.00M * 0.80M;
-
-
-
-
-
-
-
-
-
- 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)
- {
- _result.Msg = "计算工资传入数据为空!";
- return _result;
- }
- if (userNames.Count <= 0)
- {
- var nameData = await _usersRep.GetUserNameList(1);
- userNames = nameData.Data;
- }
-
- int work_days = await GetWorkDays(thisYearMonth);
- if (work_days <=0)
- {
- _result.Msg = thisYearMonth+" 工作日未设置,请前往《工作日管理页面》设置!";
- return _result;
- }
- UserIdListView userIdListView = await _qiYeWeChatApiService.GetUserIdListAsync();
- if (userIdListView.errcode != 0)
- {
- _result.Msg = "【企业微信】【打卡】【获取员工ID】【Msg】" + userIdListView.errmsg;
- return _result;
- }
- List<string> qyWhchatIdList = new List<string>();
- qyWhchatIdList = userIdListView.dept_user.Select(it => it.userid).ToList();
- CheckInDayDataView checkInDayDataView = await _qiYeWeChatApiService.GetCheckInDayDataAsync(qyWhchatIdList, startDt, endDt);
- if (checkInDayDataView.errcode != 0)
- {
- _result.Msg = "【企业微信】【打卡】【获取时间段内所有日打卡】【Msg】" + checkInDayDataView.errmsg;
- return _result;
- }
-
- CheckInDataView checkInDataView = new CheckInDataView();
- checkInDataView = await _qiYeWeChatApiService.GetCheckinDataAsync(qyWhchatIdList, 3,startDt, endDt);
- if (checkInDataView.errcode != 0)
- {
- _result.Msg = "【企业微信】【打卡】【获取时间段内所有日打卡记录】【Msg】" + checkInDataView.errmsg;
- return _result;
- }
-
- List<Sys_Calendar> sys_Calendars = new List<Sys_Calendar>();
- string sys_sql = string.Format("Select * From Sys_Calendar Where Isdel = 0 And Dt between '{0}' And '{1}'",
- startDt.ToString("yyyy-MM-dd"), endDt.ToString("yyyy-MM-dd"));
- sys_Calendars = await _usersRep._sqlSugar.SqlQueryable<Sys_Calendar>(sys_sql).ToListAsync();
-
- 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();
-
- string leave_template_id = "C4NzTJCh1onCUK915rRkvy7Fh5Vqz4YbiEV9jrBY1";
- List<VacationLeaveTypeView> vacationLeaveTypes = await GetVacationLeaveTypes(leave_template_id);
- if (vacationLeaveTypes.Count <= 0)
- {
- _result.Msg = "【企业微信】【审批】【获取审批类型】【Msg】" + startDt + " - " + endDt + "请假 类型数据 获取失败!";
- return _result;
- }
- try
- {
- foreach (var pm_wsInfo in pm_WageSheetDattaSources)
- {
- string itemName = userNames.Where(it => it.Id == pm_wsInfo.UserId).FirstOrDefault().CnName;
-
-
- decimal meal_subsidy = 0.00M;
-
- decimal personalLeaveTotal = 0.00M,
- sickLeaveTotal = 0.00M;
-
- decimal beLate_deduction = 0.00M,
-
-
-
- early_deduction = 0.00M,
- absenteeism_deduction = 0.00M,
- unprinted_deduction = 0.00M,
-
-
- sickLeave_deduction = 0.00M,
- other_deduction = 0.00M;
- decimal meal_deduction = 0.00M;
- decimal reissuecard_deduction = 0.00M;
- #region 计算日工资 正常日薪 事假日薪 病假日薪
-
- decimal amountPayable = pm_wsInfo.Basic + pm_wsInfo.Floats + pm_wsInfo.PostAllowance + pm_wsInfo.InformationSecurityFee +
- pm_wsInfo.OtherSubsidies + pm_wsInfo.OtherHandle;
-
- decimal dailyWage = amountPayable / work_days;
-
- decimal sickLeave_dailywage = _chengDuMinimumWage / work_days;
-
- sickLeave_deduction = dailyWage - sickLeave_dailywage;
- List<Ex_Items> ex_Items = new List<Ex_Items>();
- Ex_Items ex_Items_dk = new Ex_Items() { Type = "打卡" };
- Ex_Items ex_Items_jq = new Ex_Items() { Type = "假勤" };
- Ex_Items ex_Items_cc = new Ex_Items() { Type = "出差" };
- #endregion
- List<Root> userRoots = new List<Root>();
- if (itemName == "蔡雯")
- {
- userRoots = workday_userRoots.Where(it => it.base_info.name == "蔡蔡" || it.base_info.name == "蔡雯").ToList();
- }
- else
- {
- userRoots = workday_userRoots.Where(it => it.base_info.name == itemName).ToList();
- }
-
- userRoots = userRoots.OrderBy(it => it.base_info.date).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("张海麟"))
- {
- if (userRoots.Count <= 0)
- {
- _result.Msg = "【企业微信】【打卡】【获取打卡数据】【Msg】" + startDt + " - " + endDt + "打卡日数据 获取失败!";
- continue;
- }
- 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>();
- int user_probationary_bk_num = 0;
-
- decimal user_probationary_bk_decimal = pm_wsInfo.Floats;
-
- List<CheckInDataInfo> checkInData1 = new List<CheckInDataInfo>();
- checkInData1 = checkInDataView.checkindata;
- List<CheckInDataInfo> checkInDatas = new List<CheckInDataInfo>();
- checkInDatas = checkInData1.Where(it => it.userid == acctid).ToList();
-
- List<CheckInDataInfo> checkInData2 = new List<CheckInDataInfo>();
- checkInData2 = checkInDatas.Where(it => it.exception_type.Equals("未打卡")).ToList();
-
- #region 迟到 早退 旷工
- int user_cd_zt_num = 0;
- 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;
- 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 = dailyWage / 15;
-
-
-
- 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;
-
- 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 = ConvertToDecimal(day_miner_unit * 6);
- meal_deduction += 10.00M;
- absenteeism_deduction += day_deduction;
- beLate_belate_ex.Reason = thisDtStr + " 上午(09:00)缺卡/未打卡视为下午旷工(3小时)";
- }
- else
- {
- day_deduction = ConvertToDecimal(dailyWage);
- absenteeism_deduction += day_deduction;
- meal_deduction += 10.00M;
- 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 == 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 = ConvertToDecimal(day_miner_unit * 6);
- meal_deduction += 10.00M;
- absenteeism_deduction += day_deduction;
- }
- else
- {
- day_deduction = ConvertToDecimal(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)
- {
- if (ex_reissuecard_Items.Where(it => it.StartTimeDt.ToString("yyyy-MM-dd").Equals(thisDtStr)).Count() > 0)
- {
- if (earliest_time == lastest_time)
- {
- DateTime thisDt1 = Convert.ToDateTime(thisDtStr + " 12:00");
- if (thisDt >= thisDt1)
- {
- day_deduction = ConvertToDecimal(day_miner_unit * 9);
- meal_deduction += 10.00M;
- beLate_belate_ex.Duration = 270;
- 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 = ConvertToDecimal(day_miner_unit * 6);
- meal_deduction += 10.00M;
- absenteeism_deduction += day_deduction;
- beLate_belate_ex.Duration = 180;
- beLate_belate_ex.Reason = thisDtStr + " 上午(09:00)缺卡/未打卡视为上午旷工(3小时)";
- beLate_belate_ex.Deduction = day_deduction;
- ex_reissuecard_Items.Add(beLate_belate_ex);
- }
- else
- {
- day_deduction = ConvertToDecimal(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
- {
- 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 = ConvertToDecimal(day_miner_unit * 9);
- meal_deduction += 10.00M;
- beLate_belate_ex.Duration = 270;
- 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 = ConvertToDecimal(day_miner_unit * 6);
- meal_deduction += 10.00M;
- absenteeism_deduction += day_deduction;
- beLate_belate_ex.Duration = 180;
- beLate_belate_ex.Reason = thisDtStr + " 上午(09:00)缺卡/未打卡视为上午旷工(3小时)";
- beLate_belate_ex.Deduction = day_deduction;
- ex_reissuecard_Items.Add(beLate_belate_ex);
- }
- else
- {
- day_deduction = ConvertToDecimal(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 = ConvertToDecimal(day_miner_unit * 6);
- beLate_belate_ex.Reason = thisDtStr + " 缺卡/未打视为旷工上午(3小时)";
- meal_deduction += 10.00M;
- absenteeism_deduction += day_deduction;
- }
- else
- {
- day_deduction = ConvertToDecimal(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;
- int evectionNum = 0;
-
- leaveNum = acc_sp_items.Where(it => it.type == 1).ToList().Count();
- reissuecardNum = acc_sp_items.Where(it => it.type == 2).ToList().Count();
- List<Sp_items> acc_sp_items_evection = new List<Sp_items>();
- acc_sp_items_evection = acc_sp_items.Where(it => it.type == 3).ToList();
- evectionNum = acc_sp_items_evection.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";
-
- }
- List<Ex_Item> ex_ItemInfos = new List<Ex_Item>();
- List<LeaveDetails> leaveDetails = new List<LeaveDetails>();
- 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;
- List<TitleItem> value = optionsItems[0].value;
- int leaveType = int.Parse(optionsItems[0].key);
- 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)
- {
- continue;
- }
-
- 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;
- string startTime1 = string.Empty;
- string endTime1 = string.Empty;
-
- decimal new_duration = 0.00M;
- if (date_Range.type == "halfday")
- {
- new_duration = Convert.ToDecimal(date_Range.new_duration) / 86400.00M;
- 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";
- if (new_duration == 1)
- {
- startTime1 = "09:00:00";
- endTime1 = "18:00:00";
- }
- else
- {
- startTime1 = date_Range.new_begin_dt.ToString("HH:mm:ss");
- endTime1 = date_Range.new_end_dt.ToString("HH:mm:ss");
- }
-
- }
- else if (date_Range.type == "hour")
- {
- new_duration = Convert.ToDecimal(date_Range.new_duration) / 3600.00M;
- 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");
- startTime1 = date_Range.new_begin_dt.ToString("HH:mm:ss");
- endTime1 = date_Range.new_end_dt.ToString("HH:mm:ss");
- }
- LeaveDetails leaveDetails1 = new LeaveDetails()
- {
- TypeId = leaveType,
- TypeName = typeName,
- StartDt = Convert.ToDateTime(date_Range.new_begin_dt.ToString("yyyy-MM-dd") + " " + startTime1),
- EndDt = Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd") + " " + endTime1),
- DtType = date_Range.type,
- Unit = unit,
- New_Duration = new_duration,
- ApplyDt = Convert.ToDateTime(sp_item.apply_time_dt.ToString("yyyy-MM-dd HH:mm:ss"))
- };
- leaveDetails.Add(leaveDetails1);
- }
- }
- }
- if (leaveDetails.Count > 0)
- {
- foreach (LeaveDetails leave_item in leaveDetails)
- {
- decimal leave_meals = 0.00M;
- decimal thisTypeDeduction = 0.00M;
- int leaveType = leave_item.TypeId;
- decimal new_duration = leave_item.New_Duration;
-
- CalculateTypeFee(leaveDetails,leaveType, leave_item.DtType, leave_item.StartDt, leave_item.EndDt, amountPayable, work_days,
- new_duration,out leave_meals, out thisTypeDeduction);
- #region 累计类型扣款
-
- 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 = leave_item.TypeName,
- StartTimeDt = leave_item.StartDt,
- EndTimeDt = leave_item.EndDt,
- Duration = new_duration,
- Unit = leave_item.Unit,
- Deduction = thisTypeDeduction,
-
- Apply_time_dt = leave_item.ApplyDt,
-
- };
- ex_ItemInfos.Add(ex_Item);
- }
- }
- if (ex_ItemInfos.Count > 0)
- {
- ex_Items_jq.Ex_ItemInfo = ex_ItemInfos.OrderBy(it => it.StartTimeDt).ThenBy(it => it.Apply_time_dt).ToList();
- ex_Items.Add(ex_Items_jq);
- }
- }
-
-
-
-
- if (reissuecardNum > 0)
- {
- List<Sp_Detail> sp_buka_details = new List<Sp_Detail>();
- sp_buka_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 2);
- 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;
- DateTime bukaDt = punch_correction.time_dt;
- DateTime bukaDtJudge = Convert.ToDateTime(bukaDt.ToString("yyyy-MM-dd"));
-
- if (startDt > bukaDtJudge || bukaDtJudge > endDt)
- {
- continue;
- }
-
- decimal bukaPrice = 0.00M;
- if (user_probationary_bk_decimal == 0)
- {
- if (bukaNum <= 2) bukaPrice = 0.00M;
- else if (bukaNum <= 4 && bukaNum > 2) bukaPrice = 10.00M;
- else bukaPrice = 50.00M;
- }
- else
- {
- 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++;
- }
- }
- }
-
- List<Sp_Detail> sp_goout_details = new List<Sp_Detail>();
- sp_goout_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 4);
- if (sp_goout_details.Count > 0)
- {
-
- List<string> goOutDts = new List<string>();
- foreach (var goOutItem in sp_goout_details)
- {
- Apply_data? apply_data = goOutItem.apply_data;
- if (apply_data != null)
- {
- List<ContentsItem> contents = apply_data.contents;
- ContentsItem content_Vacation = contents.Where(it => it.control == "Attendance").FirstOrDefault();
- ContentsItem content_Textarea = contents.Where(it => it.control == "Textarea").FirstOrDefault();
- if (content_Vacation != null)
- {
- var attendance = content_Vacation.value.attendance;
- DateTime goOutDt = attendance.date_range.new_begin_dt;
- DateTime goOutDtJudge = Convert.ToDateTime(goOutDt.ToString("yyyy-MM-dd"));
-
- if (startDt >= goOutDtJudge || goOutDtJudge > endDt)
- {
- continue;
- }
- goOutDts.Add(goOutDt.ToString("yyyy-MM-dd"));
- }
- }
- }
-
- List<CheckInDataInfo> filtratePrefix_checkInData = new List<CheckInDataInfo>();
- if (goOutDts.Count > 0)
- {
- foreach (var goOutDtItem in goOutDts)
- {
- List<CheckInDataInfo> filtrate_checkInData = new List<CheckInDataInfo>();
- filtrate_checkInData = checkInData2.Where(it => it.checkin_time_dt.ToString("yyyy-MM-dd").Equals(goOutDtItem)).ToList();
- if (filtrate_checkInData.Count > 0)
- {
- filtratePrefix_checkInData.AddRange(filtrate_checkInData);
- }
- }
- }
-
- foreach (var item in filtratePrefix_checkInData)
- {
- decimal bukaPrice = 0.00M;
- if (user_probationary_bk_decimal == 0)
- {
- if (bukaNum <= 2) bukaPrice = 0.00M;
- else if (bukaNum <= 4 && bukaNum > 2) bukaPrice = 10.00M;
- else bukaPrice = 50.00M;
- }
- else
- {
- if (bukaNum <= 2) bukaPrice = 10.00M;
- else bukaPrice = 50.00M;
- }
- Ex_Item ex_reissueCard = new Ex_Item()
- {
- SubTypeId = 7,
- SubType = "打卡补卡",
- StartTimeDt = Convert.ToDateTime(item.checkin_time_dt.ToString("yyyy-MM-dd HH:mm:ss")),
- Deduction = bukaPrice,
- Reason = "[打卡记录]抓取到的未打卡数据!",
- Unit = string.Empty
- };
- unprinted_deduction += bukaPrice;
- ex_reissuecard_Items.Add(ex_reissueCard);
- bukaNum++;
- }
- }
- }
- 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);
- }
-
- if (evectionNum > 0)
- {
- List<Sp_Detail> sp_leave_details = new List<Sp_Detail>();
- sp_leave_details = await _qiYeWeChatApiService.GetApprovalDetailsAsync(startDt, endDt, acctid, 2, 3);
- if (sp_leave_details.Count <= 0)
- {
- _result.Msg += startDt + " - " + endDt + " " + itemName + " 请假 审批数据获取未获取到!\r\n";
-
- }
- List<Ex_Item> cc_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 == "Attendance").FirstOrDefault();
- ContentsItem content_Textarea = contents.Where(it => it.control == "Textarea").FirstOrDefault();
- if (content_Vacation != null)
- {
-
- Attendance attendance = content_Vacation.value.attendance;
-
-
-
- int leaveType = int.Parse("3");
- 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)
- {
- continue;
- }
- 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;
- typeName = "出差";
- string startTime = string.Empty;
- string endTime = string.Empty;
- string startTime1 = string.Empty;
- string endTime1 = string.Empty;
-
- decimal new_duration = 0.00M;
- if (date_Range.type == "halfday")
- {
- new_duration = Convert.ToDecimal(date_Range.new_duration) / 86400.00M;
- 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";
- startTime1 = "09:00:00";
- endTime1 = "18:00:00";
- }
- else if (date_Range.type == "hour")
- {
- new_duration = Convert.ToDecimal(date_Range.new_duration) / 3600.00M;
- 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");
- startTime1 = date_Range.new_begin_dt.ToString("HH:mm:ss");
- endTime1 = date_Range.new_end_dt.ToString("HH:mm:ss");
- }
-
- decimal cckk = 0.00M;
- int days = (int)(date_Range.new_end_dt - date_Range.new_begin_dt).TotalDays;
- for (int i = 0; i <= days; i++)
- {
- DateTime thisDt = date_Range.new_begin_dt.AddDays(i);
- if (thisDt > date_Range.new_end_dt)
- {
- continue;
- }
- Sys_Calendar sys_Calendar = new Sys_Calendar();
- sys_Calendar = sys_Calendars.Where(it => it.Dt == thisDt.ToString("yyyy-MM-dd")).FirstOrDefault();
- if (sys_Calendar != null) {
- if (sys_Calendar.IsWorkDay)
- {
- cckk += 10.00M;
- }
- }
- }
- meal_deduction += cckk;
- Ex_Item ex_Item = new Ex_Item()
- {
- SubTypeId = leaveType,
- SubType = typeName,
- StartTimeDt = Convert.ToDateTime(date_Range.new_begin_dt.ToString("yyyy-MM-dd") + " " + startTime1),
- EndTimeDt = Convert.ToDateTime(date_Range.new_end_dt.ToString("yyyy-MM-dd") + " " + endTime1),
- Duration = new_duration,
- Unit = unit,
- Deduction = 0.00M,
-
- Apply_time_dt = Convert.ToDateTime(sp_item.apply_time_dt.ToString("yyyy-MM-dd HH:mm:ss"))
-
- };
- cc_ex_ItemInfos.Add(ex_Item);
- }
- }
- }
- if (cc_ex_ItemInfos.Count > 0)
- {
-
-
- List<Ex_Item> ex_jq_Items = new List<Ex_Item>();
- ex_jq_Items = (List<Ex_Item>)ex_Items_jq.Ex_ItemInfo;
- ex_jq_Items.AddRange(cc_ex_ItemInfos);
- ex_Items.Remove(ex_Items_jq);
- ex_Items.Add(
- new Ex_Items()
- {
- Type = "假勤",
- Ex_ItemInfo = ex_jq_Items.OrderBy(it => it.StartTimeDt).ThenBy(it => it.Apply_time_dt).ToList()
- }
- );
- }
- }
- #endregion
- }
- else
- {
- meal_subsidy = work_days * 10.00M;
- }
- #region 应发合计 实发合计 扣款合计(假勤扣款,其他扣款,社保扣款,公积金代扣,个税扣款)
- decimal mealTotal = meal_subsidy - meal_deduction;
- decimal salaryTotal = 0.00M;
- if (dk_work_days >= work_days)
- {
- dk_work_days = work_days;
- salaryTotal = amountPayable + mealTotal;
- }
- else
- {
- if (itemName.Equals("张海麟"))
- {
- salaryTotal = amountPayable + mealTotal;
- }
- else
- {
- salaryTotal = (dk_work_days * dailyWage) + 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 = dk_work_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 = ConvertToDecimal( salaryTotal);
- pm_wsInfo.TotalDeductions = ConvertToDecimal(eductionTotal);
- pm_wsInfo.TotalRealHair = ConvertToDecimal(actualReleaseTotal - pm_wsInfo.WithholdingTax);
- pm_wsInfo.AfterTax = ConvertToDecimal(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;
- return _result;
- }
-
-
-
-
-
- public static decimal ConvertToDecimal(decimal myDecimal)
- {
- var subDecimal = Math.Floor(myDecimal * 100) / 100;
- return subDecimal;
- }
-
-
-
-
-
- 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)
- {
- Serilog.Log.Error("【企业微信】【审批】【获取假勤类型的审批】【Msg】"+ templateDetailView.errmsg);
- 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;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static void CalculateTypeFee(List<LeaveDetails> leaveDetails,int leaveType, string date_Range_type, DateTime startTime, DateTime endTime,
- decimal amountPayable,int work_days, decimal 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 = 7.50M / 0.50M;
- switch (leaveType)
- {
- case 1:
- CalculateTypeFeeSub(leaveDetails, date_Range_type, startTime, endTime, duration, out mealDeduction);
- break;
- case 2:
-
- decimal personalkLeave_dailywage_halfhour = personalkLeave_dailywage_day / halfHour;
- if (date_Range_type == "halfday")
- {
- mealDeduction = 10;
- typeDeduction = ConvertToDecimal(personalkLeave_dailywage_day);
- }
- else if (date_Range_type == "hour")
- {
- decimal leave_halfHour = Convert.ToDecimal(duration) / Convert.ToDecimal(0.5);
- typeDeduction = ConvertToDecimal(personalkLeave_dailywage_halfhour * leave_halfHour);
-
- if (duration >= 3 && duration < 7.5M)
- {
- mealDeduction = 10;
- }
- else if (duration >= 7.5M)
- {
- decimal leave_halfHour1 = Convert.ToDecimal(duration) / Convert.ToDecimal(0.5);
-
- decimal leaveDays = duration / 7.5M;
- if (leaveDays % 1 == 0)
- {
- typeDeduction = ConvertToDecimal(personalkLeave_dailywage_day * leaveDays);
- mealDeduction = 10 * leaveDays;
- }
- else
- {
- typeDeduction = personalkLeave_dailywage_day * Convert.ToInt32(leaveDays);
- decimal sy_shijiaunit = leave_halfHour1 - Convert.ToDecimal (15.00M * Convert.ToInt32(leaveDays));
- if (sy_shijiaunit > 0)
- {
- typeDeduction += ConvertToDecimal(personalkLeave_dailywage_halfhour * sy_shijiaunit);
- }
- mealDeduction = 10 * Convert.ToInt32(leaveDays);
-
- int lastHours = (Convert.ToDateTime(endTime) - Convert.ToDateTime("09:00")).Hours;
- if (lastHours >= 3)
- {
- mealDeduction += 10;
- }
- }
- }
- }
- break;
- case 3:
-
- decimal chengDuMinimumWage_halrHour = _chengDuMinimumWage / work_days / halfHour;
- decimal sickLeave_dailywage_halfhour_deduction1 = (personalkLeave_dailywage_day / halfHour) - chengDuMinimumWage_halrHour;
- if (date_Range_type == "halfday")
- {
- mealDeduction = 10;
- typeDeduction = ConvertToDecimal( sickLeave_dailywage_halfhour_deduction1 * halfHour);
- }
- else if (date_Range_type == "hour")
- {
- decimal sickLeave_halfHour = duration / 0.5M;
- typeDeduction = ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * sickLeave_halfHour);
- if (duration >= 3 && duration < 7.5M)
- {
- mealDeduction = 10;
- }
- else if (duration >= 7.5M)
- {
- decimal sickLeave_halfHour1 = duration / 0.5M;
- decimal leaveDays = Convert.ToDecimal(duration / 7.5M);
- typeDeduction = ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * sickLeave_halfHour1);
- if (leaveDays % 1 == 0)
- {
- mealDeduction = 10 * leaveDays;
- }
- else
- {
- mealDeduction = 10 * Convert.ToInt32(leaveDays);
- typeDeduction = ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * Convert.ToInt32(leaveDays));
- decimal sy_bingjiaunit = sickLeave_halfHour1 - Convert.ToDecimal(15.00M * Convert.ToInt32(leaveDays));
- if (sy_bingjiaunit > 0)
- {
- typeDeduction += ConvertToDecimal(sickLeave_dailywage_halfhour_deduction1 * sy_bingjiaunit);
- }
-
- int lastHours = (Convert.ToDateTime(endTime) - Convert.ToDateTime("09:00")).Hours;
- if (lastHours >= 3)
- {
- mealDeduction += 10;
- }
- }
- }
- }
- break;
- case 4:
- CalculateTypeFeeSub(leaveDetails,date_Range_type, startTime, endTime, duration, out mealDeduction);
- break;
- case 5:
- CalculateTypeFeeSub(leaveDetails,date_Range_type, startTime, endTime, duration, out mealDeduction);
- break;
- case 6:
- CalculateTypeFeeSub(leaveDetails,date_Range_type, startTime, endTime, duration, out mealDeduction);
- break;
- case 7:
- CalculateTypeFeeSub(leaveDetails,date_Range_type, startTime, endTime, duration, out mealDeduction);
- break;
- case 8:
- CalculateTypeFeeSub(leaveDetails,date_Range_type, startTime, endTime, duration, out mealDeduction);
- break;
- case 9:
- CalculateTypeFeeSub(leaveDetails,date_Range_type, startTime, endTime, duration, out mealDeduction);
- break;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
- public static void CalculateTypeFeeSub(List<LeaveDetails> leaveDetails,string date_Range_type, DateTime startTime1, DateTime endTime1,
- decimal duration, out decimal mealDeduction)
- {
- mealDeduction = 0;
- string am_starttime = "09:00";
- string am_endtime = "11:59";
- string startTime = startTime1.ToString("HH:mm:ss");
- string endTime = endTime1.ToString("HH:mm:ss");
- if (date_Range_type == "halfday")
- {
- mealDeduction = 10;
- }
- else if (date_Range_type == "hour")
- {
- List<LeaveDetails> leaveDetails1 = new List<LeaveDetails>();
- leaveDetails1 = leaveDetails.Where(it => it.StartDt.ToString("yyyy-MM-dd").Equals(startTime1.ToString("yyyy-MM-dd")))
- .OrderBy(it => it.StartDt).ToList();
- if (leaveDetails1.Count > 1)
- {
- decimal timelenTatoal = leaveDetails1.Sum(it => it.New_Duration);
- if (timelenTatoal >= 3.00M)
- {
- if (leaveDetails1[0].StartDt == startTime1)
- {
- mealDeduction = 10;
- }
- }
- }
- else
- {
- if (duration >= 3 && duration < 7)
- {
- mealDeduction = 10;
- }
- else if (duration >= 7 && duration <= 7.50M)
- {
- mealDeduction = 10;
- }
- else if (duration >= 7.50M)
- {
- decimal leaveDays = Convert.ToDecimal(duration / 7.50M);
- 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)
- {
- mealDeduction += 10;
-
-
-
-
-
- }
- }
- }
- }
-
- }
- }
-
-
-
-
-
- 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;
- }
-
-
-
-
-
-
-
-
-
-
-
-
- private static int Fallibilitydispose(List<Sp_Item> datas, int type, string? subTypeName)
- {
- int num = 0;
- Sp_Item _Info = datas.Where(it => it.type == type && it.name == subTypeName).FirstOrDefault();
- if (_Info != null) { num = _Info.count; }
- return num;
- }
-
-
-
-
-
- private static int ExceptionStatistics(List<Exception_Info> datas, int type)
- {
- int num = 0;
- Exception_Info _Info = datas.Where(it => it.exception == type).FirstOrDefault();
- if (_Info != null) { num = _Info.count; }
- return num;
- }
-
-
-
-
-
-
- public static async Task<int> GetWorkDays(string yearMonth)
- {
- int workdays = 0;
- string sql = string.Format(@"Select * From Pm_WageIssueWorkingDay
- Where Isdel = 0 And YearMonth = '{0}' ", yearMonth);
- var data = await _usersRep._sqlSugar.SqlQueryable<WageYearMonthView>(sql).FirstAsync();
- if (data != null)
- {
- workdays = data.Workdays;
- }
- return workdays;
- }
- }
- }
|