internal List <VirtualUser> GetVirtualUser(List <string> userIDs) { List <VirtualUser> listUser = new List <VirtualUser>(); if (userIDs.Count == 0) { return(listUser); } try { PersonnelWS.PersonnelServiceClient personService = new PersonnelWS.PersonnelServiceClient(); List <PersonnelWS.T_HR_EMPLOYEE> employeeList = personService.GetEmployeeByIDs(userIDs.ToArray()).ToList(); employeeList.ForEach(employeeHR => { VirtualUser vu = new VirtualUser(); vu.ID = employeeHR.EMPLOYEEID; vu.Name = employeeHR.EMPLOYEECNAME + "(" + employeeHR.EMPLOYEECODE + ")"; listUser.Add(vu); }); } catch (Exception ex) { SystemBLL.Debug(ex.ToString()); } return(listUser); }
//处理岗位信息一栏 public List <T_FB_PERSONMONEYASSIGNDETAIL> UpdatePostInfo(List <T_FB_PERSONMONEYASSIGNDETAIL> listperson) { PersonnelWS.PersonnelServiceClient pe = new PersonnelWS.PersonnelServiceClient(); PersonnelWS.V_EMPLOYEEPOSTFORFB[] vlistpostinfo = new PersonnelWS.V_EMPLOYEEPOSTFORFB[listperson.Count]; int i = 0; listperson.ForEach(item => { PersonnelWS.V_EMPLOYEEPOSTFORFB vpostinfo = new PersonnelWS.V_EMPLOYEEPOSTFORFB(); vpostinfo.PERSONBUDGETAPPLYDETAILID = item.PERSONBUDGETAPPLYDETAILID; vpostinfo.OWNERID = item.OWNERID; vpostinfo.OWNERPOSTID = item.OWNERPOSTID; vlistpostinfo[i] = vpostinfo; i++; }); try { vlistpostinfo = pe.GetEmployeeListForFB(vlistpostinfo) as PersonnelWS.V_EMPLOYEEPOSTFORFB[]; } catch (Exception ex) { SystemBLL.Debug("调用HR服务异常 GetEmployeeListForFB " + ex.ToString()); } listperson.ForEach(item => { var person = vlistpostinfo.Where(p => p.PERSONBUDGETAPPLYDETAILID == item.PERSONBUDGETAPPLYDETAILID).FirstOrDefault(); if (person != null) { item.SUGGESTBUDGETMONEY = person.SUM; switch (person.EMPLOYEESTATE) { case "0": //试用期 item.POSTINFO = "试用期,请注意"; break; case "1": //在职 item.POSTINFO = string.Empty; break; case "2": //已离职 item.POSTINFO = "已离职,请删除"; break; case "3": //离职中 item.POSTINFO = "离职中,请注意"; break; case "4": //未入职 item.POSTINFO = "未入职,请删除"; break; case "10": //异动中 item.POSTINFO = "异动中,请异动后再处理"; break; case "11": //异动过 item.POSTINFO = "异动过,已转换成新岗位"; item.OWNERPOSTID = person.NEWPOSTID; item.OWNERPOSTNAME = person.NEWPOSTNAME; item.OWNERDEPARTMENTID = person.NEWDEPARTMENTID; item.OWNERDEPARTMENTNAME = person.NEWDEPARTMENTNAME; item.OWNERCOMPANYID = person.NEWCOMPANYID; item.OWNERCOMPANYNAME = person.NEWCOMPANYNAME; break; case "12": //岗位异常 item.POSTINFO = "岗位异常,请删除后再选择"; break; default: item.POSTINFO = string.Empty; break; } switch (person.ISAGENCY) { case "0": //主岗位 // item.POSTINFO += string.Empty; break; case "1": //赚职 if (item.POSTINFO != string.Empty && person.EMPLOYEESTATE != "1") { item.POSTINFO = item.POSTINFO.Insert(0, "兼职,"); } else { item.POSTINFO = "兼职"; } break; default: // item.POSTINFO += string.Empty; break; } } }); return(listperson); }
/// <summary> /// 根据传回的XML,添加出差申请信息 /// </summary> /// <param name="xele"></param> public static string TravelmanagementAddFromEngine(string strXml,string newTravelreimbursementID) { try { string strEmployeeID = string.Empty; string strOwnerID = string.Empty; string strOwnerPostID = string.Empty; string strOwnerDepartmentID = string.Empty; string strOwnerCompanyID = string.Empty; string strClaimsWereName = string.Empty; string strCheckState = string.Empty; string strTEL = string.Empty; string strBusinesStripId = string.Empty; string strTravelreimbursementId = string.Empty; StringReader strRdr = new StringReader(strXml); XmlReader xr = XmlReader.Create(strRdr); while (xr.Read()) { if (xr.NodeType == XmlNodeType.Element) { string elementName = xr.Name; if (elementName == "Paras" || elementName == "System") { while (xr.Read()) { string type = xr.NodeType.ToString(); #region if (xr["Name"] != null) { if (xr["Name"].ToUpper() == "OWNERPOSTID") { strOwnerPostID = xr["Value"]; } if (xr["Name"].ToUpper() == "OWNERID") { strOwnerID = xr["Value"]; } if (xr["Name"].ToUpper() == "OWNERDEPARTMENTID") { strOwnerDepartmentID = xr["Value"]; } if (xr["Name"].ToUpper() == "OWNERCOMPANYID") { strOwnerCompanyID = xr["Value"]; } if (xr["Name"].ToUpper() == "BUSINESSTRIPID") { strBusinesStripId = xr["Value"]; } if (xr["Name"].ToUpper() == "TRAVELREIMBURSEMENTID") { strTravelreimbursementId = xr["Value"]; } } #endregion } } } } doc = new SmtOAPersonOffice(); //string employeeid = strEmployeeID.Replace("{", "").Replace("}", ""); T_OA_BUSINESSTRIP buip = doc.GetTravelmanagementById(strBusinesStripId); T_OA_TRAVELREIMBURSEMENT entity = new T_OA_TRAVELREIMBURSEMENT(); entity.TRAVELREIMBURSEMENTID = newTravelreimbursementID;//Guid.NewGuid().ToString(); entity.T_OA_BUSINESSTRIP = buip; entity.T_OA_BUSINESSTRIP.BUSINESSTRIPID = buip.BUSINESSTRIPID; entity.CLAIMSWERE = buip.OWNERID; entity.CLAIMSWERENAME = buip.OWNERNAME; entity.REIMBURSEMENTTIME = DateTime.Now; entity.CHECKSTATE = "0"; entity.TEL = buip.TEL; entity.CREATEDATE = buip.UPDATEDATE; entity.OWNERID = buip.OWNERID; entity.OWNERNAME = buip.OWNERNAME; entity.OWNERPOSTID = buip.OWNERPOSTID; entity.OWNERDEPARTMENTID = buip.OWNERDEPARTMENTID; entity.OWNERCOMPANYID = buip.OWNERCOMPANYID; entity.CREATEUSERID = buip.CREATEUSERID; entity.CREATEUSERNAME = buip.CREATEUSERNAME; entity.CREATEPOSTID = buip.CREATEPOSTID; entity.CREATEDEPARTMENTID = buip.CREATEDEPARTMENTID; entity.CREATECOMPANYID = buip.CREATECOMPANYID; entity.OWNERPOSTNAME = buip.OWNERPOSTNAME; entity.OWNERDEPARTMENTNAME = buip.OWNERDEPARTMENTNAME; entity.OWNERCOMPANYNAME = buip.OWNERCOMPANYNAME; entity.POSTLEVEL = buip.POSTLEVEL; entity.STARTCITYNAME = buip.STARTCITYNAME; entity.ENDCITYNAME = buip.ENDCITYNAME; if (buip.REMARKS == "工作计划生成" || buip.ISFROMWP=="1") { entity.ISFROMWP = "1"; } Tracer.Debug("出差终审自动生成出差报销:" + entity.OWNERNAME + "-" + entity.OWNERPOSTNAME + "-" + entity.OWNERDEPARTMENTNAME + "-" + entity.OWNERCOMPANYNAME + "-岗位级别:" + entity.POSTLEVEL + "-开始城市:" + entity.STARTCITYNAME + "-结束城市:" + entity.ENDCITYNAME); //添加子表数据 EmployeeWS.V_EMPLOYEEDETAIL emp = new EmployeeWS.V_EMPLOYEEDETAIL(); EmployeeWS.PersonnelServiceClient cinet = new EmployeeWS.PersonnelServiceClient();//人事服务(查询员工岗位级别用) List<T_OA_CANTAKETHEPLANELINE> PlaneObj = new List<T_OA_CANTAKETHEPLANELINE>(); List<T_OA_TAKETHESTANDARDTRANSPORT> StandardObj = new List<T_OA_TAKETHESTANDARDTRANSPORT>(); emp = cinet.GetEmployeeDetailViewByID(entity.OWNERID);//根据员工ID查询出岗位级别 postLevel = emp.EMPLOYEEPOSTS.Where(s => s.POSTID == buip.OWNERPOSTID).FirstOrDefault().POSTLEVEL.ToString();//获取出差人的岗位级别 var companyId = emp.EMPLOYEEPOSTS.Where(s => s.CompanyID == buip.OWNERCOMPANYID).FirstOrDefault().CompanyID.ToString();//获取出差人的所属公司 T_OA_TRAVELSOLUTIONS travelsolutions = doc.GetTravelSolutionByCompanyID(entity.OWNERCOMPANYID, ref PlaneObj, ref StandardObj);//出差方案 if (travelsolutions != null) { solutionID = travelsolutions.TRAVELSOLUTIONSID;//出差方案ID } List<T_OA_BUSINESSTRIPDETAIL> TravelDetail = doc.GetBusinesstripDetail(strBusinesStripId); List<T_OA_REIMBURSEMENTDETAIL> TrDetail = new List<T_OA_REIMBURSEMENTDETAIL>();//出差报销子表 List<string> cityscode = new List<string>(); double BusinessDays = 0; int i = 0; double total = 0; #region //foreach (var detail in TravelDetail) for (int j = 0; j < TravelDetail.Count();j++ ) { var detail = TravelDetail[i]; i++; double toodays = 0; //计算本次出差的时间 List<string> list = new List<string> { detail.BUSINESSDAYS }; if (detail.BUSINESSDAYS != null) { double totalHours = System.Convert.ToDouble(list[0]); BusinessDays += totalHours;//总天数 toodays = totalHours;//单条数据的天数 } double tresult = toodays;//计算本次出差的总天数 T_OA_REIMBURSEMENTDETAIL TrListInfo = new T_OA_REIMBURSEMENTDETAIL(); TrListInfo.REIMBURSEMENTDETAILID = Guid.NewGuid().ToString(); TrListInfo.STARTDATE = detail.STARTDATE;//开始时间 TrListInfo.ENDDATE = detail.ENDDATE;//结束时间 TrListInfo.BUSINESSDAYS = detail.BUSINESSDAYS;//出差天数 TrListInfo.DEPCITY = detail.DEPCITY;//出发城市 TrListInfo.DESTCITY = detail.DESTCITY;//目标城市 TrListInfo.PRIVATEAFFAIR = detail.PRIVATEAFFAIR;//是否私事 TrListInfo.GOOUTTOMEET = detail.GOOUTTOMEET;//外出开会 TrListInfo.COMPANYCAR = detail.COMPANYCAR;//公司派车 TrListInfo.TYPEOFTRAVELTOOLS = detail.TYPEOFTRAVELTOOLS;//交通工具类型 TrListInfo.TAKETHETOOLLEVEL = detail.TAKETHETOOLLEVEL;//交通工具级别 TrListInfo.CREATEDATE = Convert.ToDateTime(buip.UPDATEDATE);//创建时间 TrListInfo.CREATEUSERNAME = buip.CREATEUSERNAME;//创建人 cityscode.Add(TrListInfo.DESTCITY); T_OA_AREAALLOWANCE entareaallowance = new T_OA_AREAALLOWANCE(); string cityValue = cityscode[i - 1];//目标城市值 entareaallowance = GetAllowanceByCityValue(cityValue); #region 根据本次出差的总天数,根据天数获取相应的补贴 if (travelsolutions != null) { if (tresult <= int.Parse(travelsolutions.MINIMUMINTERVALDAYS))//本次出差总时间小于等于设定天数的报销标准 { if (entareaallowance != null) { if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0;//交通补贴 } else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { if (entareaallowance.TRANSPORTATIONSUBSIDIES != null) { TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * toodays).ToString()); } } else { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } } } if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//餐费补贴 { TrListInfo.MEALSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1")//如果是开会 { TrListInfo.MEALSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.MEALSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * toodays).ToString()); } else { TrListInfo.MEALSUBSIDIES = 0; } } } } } else { if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; TrListInfo.MEALSUBSIDIES = 0; } } } #endregion #region 如果出差天数大于设定的最大天数,按驻外标准获取补贴 if (travelsolutions != null) { if (tresult > int.Parse(travelsolutions.MAXIMUMRANGEDAYS)) { if (entareaallowance != null) { double DbTranceport = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES); double DbMeal = Convert.ToDouble(entareaallowance.MEALSUBSIDIES); double tfSubsidies = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport; double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies; double lastmoney = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES); TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString()); } else { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } } } if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.MEALSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1")//如果是开会 { TrListInfo.MEALSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal; double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies; double lastmoney = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES); TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString()); } else { TrListInfo.MEALSUBSIDIES = 0; } } } } } else { if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; TrListInfo.MEALSUBSIDIES = 0; } } } #endregion #region 如果出差时间大于设定的最小天数并且小于设定的最大天数的报销标准 if (travelsolutions != null) { if (tresult >= Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) && tresult <= Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) { if (entareaallowance != null) { double DbTranceport = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES); double DbMeal = Convert.ToDouble(entareaallowance.MEALSUBSIDIES); double tfSubsidies = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport; double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies; TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString()); } else { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } } } if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.MEALSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1")//如果是开会 { TrListInfo.MEALSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { //最小区间段金额 double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal; //中间区间段金额 double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies; TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString()); } else { TrListInfo.MEALSUBSIDIES = 0; } } } } } else { if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; TrListInfo.MEALSUBSIDIES = 0; } } } total += Convert.ToDouble(TrListInfo.TRANSPORTATIONSUBSIDIES + TrListInfo.MEALSUBSIDIES); entity.THETOTALCOST = decimal.Parse(total.ToString());//差旅费用总和 entity.REIMBURSEMENTOFCOSTS = decimal.Parse(total.ToString());//报销费用总和 #endregion TrDetail.Add(TrListInfo); } #endregion string result = BusinessDays.ToString(); //计算本次出差的总时间,超过24小时天数加1 entity.COMPUTINGTIME = result;//总时间 //doc.TravelReimbursementAdd(entity, TrDetail); doc.TravelReimbursementAddSimple(entity, TrDetail,strBusinesStripId); return null;//entity.TRAVELREIMBURSEMENTID; } catch (Exception e) { string abc = "<OA>Message=[" + e.Message + "]" + "<OA>Source=[" + e.Source + "]<OA>StackTrace=[" + e.StackTrace + "]<OA>TargetSite=[" + e.TargetSite + "]"; Tracer.Debug(abc); return abc; } }
/// <summary> /// 根据传回的XML,添加出差申请信息 /// </summary> /// <param name="xele"></param> public static string TravelmanagementAddFromEngine(string strXml, string newTravelreimbursementID) { try { string strEmployeeID = string.Empty; string strOwnerID = string.Empty; string strOwnerPostID = string.Empty; string strOwnerDepartmentID = string.Empty; string strOwnerCompanyID = string.Empty; string strClaimsWereName = string.Empty; string strCheckState = string.Empty; string strTEL = string.Empty; string strBusinesStripId = string.Empty; string strTravelreimbursementId = string.Empty; StringReader strRdr = new StringReader(strXml); XmlReader xr = XmlReader.Create(strRdr); while (xr.Read()) { if (xr.NodeType == XmlNodeType.Element) { string elementName = xr.Name; if (elementName == "Paras" || elementName == "System") { while (xr.Read()) { string type = xr.NodeType.ToString(); #region if (xr["Name"] != null) { if (xr["Name"].ToUpper() == "OWNERPOSTID") { strOwnerPostID = xr["Value"]; } if (xr["Name"].ToUpper() == "OWNERID") { strOwnerID = xr["Value"]; } if (xr["Name"].ToUpper() == "OWNERDEPARTMENTID") { strOwnerDepartmentID = xr["Value"]; } if (xr["Name"].ToUpper() == "OWNERCOMPANYID") { strOwnerCompanyID = xr["Value"]; } if (xr["Name"].ToUpper() == "BUSINESSTRIPID") { strBusinesStripId = xr["Value"]; } if (xr["Name"].ToUpper() == "TRAVELREIMBURSEMENTID") { strTravelreimbursementId = xr["Value"]; } } #endregion } } } } doc = new SmtOAPersonOffice(); //string employeeid = strEmployeeID.Replace("{", "").Replace("}", ""); T_OA_BUSINESSTRIP buip = doc.GetTravelmanagementById(strBusinesStripId); T_OA_TRAVELREIMBURSEMENT entity = new T_OA_TRAVELREIMBURSEMENT(); entity.TRAVELREIMBURSEMENTID = newTravelreimbursementID;//Guid.NewGuid().ToString(); entity.T_OA_BUSINESSTRIP = buip; entity.T_OA_BUSINESSTRIP.BUSINESSTRIPID = buip.BUSINESSTRIPID; entity.CLAIMSWERE = buip.OWNERID; entity.CLAIMSWERENAME = buip.OWNERNAME; entity.REIMBURSEMENTTIME = DateTime.Now; entity.CHECKSTATE = "0"; entity.TEL = buip.TEL; entity.CREATEDATE = buip.UPDATEDATE; entity.OWNERID = buip.OWNERID; entity.OWNERNAME = buip.OWNERNAME; entity.OWNERPOSTID = buip.OWNERPOSTID; entity.OWNERDEPARTMENTID = buip.OWNERDEPARTMENTID; entity.OWNERCOMPANYID = buip.OWNERCOMPANYID; entity.CREATEUSERID = buip.CREATEUSERID; entity.CREATEUSERNAME = buip.CREATEUSERNAME; entity.CREATEPOSTID = buip.CREATEPOSTID; entity.CREATEDEPARTMENTID = buip.CREATEDEPARTMENTID; entity.CREATECOMPANYID = buip.CREATECOMPANYID; entity.OWNERPOSTNAME = buip.OWNERPOSTNAME; entity.OWNERDEPARTMENTNAME = buip.OWNERDEPARTMENTNAME; entity.OWNERCOMPANYNAME = buip.OWNERCOMPANYNAME; entity.POSTLEVEL = buip.POSTLEVEL; entity.STARTCITYNAME = buip.STARTCITYNAME; entity.ENDCITYNAME = buip.ENDCITYNAME; Tracer.Debug("出差终审自动生成出差报销:" + entity.OWNERNAME + "-" + entity.OWNERPOSTNAME + "-" + entity.OWNERDEPARTMENTNAME + "-" + entity.OWNERCOMPANYNAME + "-岗位级别:" + entity.POSTLEVEL + "-开始城市:" + entity.STARTCITYNAME + "-结束城市:" + entity.ENDCITYNAME); //添加子表数据 EmployeeWS.V_EMPLOYEEDETAIL emp = new EmployeeWS.V_EMPLOYEEDETAIL(); EmployeeWS.PersonnelServiceClient cinet = new EmployeeWS.PersonnelServiceClient();//人事服务(查询员工岗位级别用) List <T_OA_CANTAKETHEPLANELINE> PlaneObj = new List <T_OA_CANTAKETHEPLANELINE>(); List <T_OA_TAKETHESTANDARDTRANSPORT> StandardObj = new List <T_OA_TAKETHESTANDARDTRANSPORT>(); emp = cinet.GetEmployeeDetailViewByID(entity.OWNERID); //根据员工ID查询出岗位级别 postLevel = emp.EMPLOYEEPOSTS.Where(s => s.POSTID == buip.OWNERPOSTID).FirstOrDefault().POSTLEVEL.ToString(); //获取出差人的岗位级别 var companyId = emp.EMPLOYEEPOSTS.Where(s => s.CompanyID == buip.OWNERCOMPANYID).FirstOrDefault().CompanyID.ToString(); //获取出差人的所属公司 T_OA_TRAVELSOLUTIONS travelsolutions = doc.GetTravelSolutionByCompanyID(entity.OWNERCOMPANYID, ref PlaneObj, ref StandardObj); //出差方案 if (travelsolutions != null) { solutionID = travelsolutions.TRAVELSOLUTIONSID;//出差方案ID } List <T_OA_BUSINESSTRIPDETAIL> TravelDetail = doc.GetBusinesstripDetail(strBusinesStripId); List <T_OA_REIMBURSEMENTDETAIL> TrDetail = new List <T_OA_REIMBURSEMENTDETAIL>();//出差报销子表 List <string> cityscode = new List <string>(); double BusinessDays = 0; int i = 0; double total = 0; #region //foreach (var detail in TravelDetail) for (int j = 0; j < TravelDetail.Count(); j++) { var detail = TravelDetail[i]; i++; double toodays = 0; //计算本次出差的时间 List <string> list = new List <string> { detail.BUSINESSDAYS }; if (detail.BUSINESSDAYS != null) { double totalHours = System.Convert.ToDouble(list[0]); BusinessDays += totalHours; //总天数 toodays = totalHours; //单条数据的天数 } double tresult = toodays; //计算本次出差的总天数 T_OA_REIMBURSEMENTDETAIL TrListInfo = new T_OA_REIMBURSEMENTDETAIL(); TrListInfo.REIMBURSEMENTDETAILID = Guid.NewGuid().ToString(); TrListInfo.STARTDATE = detail.STARTDATE; //开始时间 TrListInfo.ENDDATE = detail.ENDDATE; //结束时间 TrListInfo.BUSINESSDAYS = detail.BUSINESSDAYS; //出差天数 TrListInfo.DEPCITY = detail.DEPCITY; //出发城市 TrListInfo.DESTCITY = detail.DESTCITY; //目标城市 TrListInfo.PRIVATEAFFAIR = detail.PRIVATEAFFAIR; //是否私事 TrListInfo.GOOUTTOMEET = detail.GOOUTTOMEET; //外出开会 TrListInfo.COMPANYCAR = detail.COMPANYCAR; //公司派车 TrListInfo.TYPEOFTRAVELTOOLS = detail.TYPEOFTRAVELTOOLS; //交通工具类型 TrListInfo.TAKETHETOOLLEVEL = detail.TAKETHETOOLLEVEL; //交通工具级别 TrListInfo.CREATEDATE = Convert.ToDateTime(buip.UPDATEDATE); //创建时间 TrListInfo.CREATEUSERNAME = buip.CREATEUSERNAME; //创建人 cityscode.Add(TrListInfo.DESTCITY); T_OA_AREAALLOWANCE entareaallowance = new T_OA_AREAALLOWANCE(); string cityValue = cityscode[i - 1];//目标城市值 entareaallowance = GetAllowanceByCityValue(cityValue); #region 根据本次出差的总天数,根据天数获取相应的补贴 if (travelsolutions != null) { if (tresult <= int.Parse(travelsolutions.MINIMUMINTERVALDAYS))//本次出差总时间小于等于设定天数的报销标准 { if (entareaallowance != null) { if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1") //如果是私事不予报销 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; //交通补贴 } else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1") //如果是开会或者是公司派车,交通费没有 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { if (entareaallowance.TRANSPORTATIONSUBSIDIES != null) { TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * toodays).ToString()); } } else { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } } } if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//餐费补贴 { TrListInfo.MEALSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1")//如果是开会 { TrListInfo.MEALSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.MEALSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * toodays).ToString()); } else { TrListInfo.MEALSUBSIDIES = 0; } } } } } else { if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; TrListInfo.MEALSUBSIDIES = 0; } } } #endregion #region 如果出差天数大于设定的最大天数,按驻外标准获取补贴 if (travelsolutions != null) { if (tresult > int.Parse(travelsolutions.MAXIMUMRANGEDAYS)) { if (entareaallowance != null) { double DbTranceport = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES); double DbMeal = Convert.ToDouble(entareaallowance.MEALSUBSIDIES); double tfSubsidies = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport; double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies; double lastmoney = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES); TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString()); } else { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } } } if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.MEALSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1")//如果是开会 { TrListInfo.MEALSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal; double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies; double lastmoney = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES); TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString()); } else { TrListInfo.MEALSUBSIDIES = 0; } } } } } else { if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; TrListInfo.MEALSUBSIDIES = 0; } } } #endregion #region 如果出差时间大于设定的最小天数并且小于设定的最大天数的报销标准 if (travelsolutions != null) { if (tresult >= Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) && tresult <= Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) { if (entareaallowance != null) { double DbTranceport = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES); double DbMeal = Convert.ToDouble(entareaallowance.MEALSUBSIDIES); double tfSubsidies = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100); if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport; double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies; TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString()); } else { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; } } } if (detail.BUSINESSDAYS != null) { if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销 { TrListInfo.MEALSUBSIDIES = 0; } else if (detail.GOOUTTOMEET == "1")//如果是开会 { TrListInfo.MEALSUBSIDIES = 0; } else { if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { //最小区间段金额 double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal; //中间区间段金额 double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies; TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString()); } else { TrListInfo.MEALSUBSIDIES = 0; } } } } } else { if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准 { TrListInfo.TRANSPORTATIONSUBSIDIES = 0; TrListInfo.MEALSUBSIDIES = 0; } } } total += Convert.ToDouble(TrListInfo.TRANSPORTATIONSUBSIDIES + TrListInfo.MEALSUBSIDIES); entity.THETOTALCOST = decimal.Parse(total.ToString()); //差旅费用总和 entity.REIMBURSEMENTOFCOSTS = decimal.Parse(total.ToString()); //报销费用总和 #endregion TrDetail.Add(TrListInfo); } #endregion string result = BusinessDays.ToString(); //计算本次出差的总时间,超过24小时天数加1 entity.COMPUTINGTIME = result; //总时间 //doc.TravelReimbursementAdd(entity, TrDetail); doc.TravelReimbursementAddSimple(entity, TrDetail, strBusinesStripId); return(null);//entity.TRAVELREIMBURSEMENTID; } catch (Exception e) { string abc = "<OA>Message=[" + e.Message + "]" + "<OA>Source=[" + e.Source + "]<OA>StackTrace=[" + e.StackTrace + "]<OA>TargetSite=[" + e.TargetSite + "]"; Tracer.Debug(abc); return(abc); } }
//处理岗位信息一栏 public List<T_FB_PERSONMONEYASSIGNDETAIL> UpdatePostInfo(List<T_FB_PERSONMONEYASSIGNDETAIL> listperson) { PersonnelWS.PersonnelServiceClient pe=new PersonnelWS.PersonnelServiceClient (); PersonnelWS.V_EMPLOYEEPOSTFORFB[] vlistpostinfo = new PersonnelWS.V_EMPLOYEEPOSTFORFB[listperson.Count]; int i = 0; listperson.ForEach(item => { PersonnelWS.V_EMPLOYEEPOSTFORFB vpostinfo = new PersonnelWS.V_EMPLOYEEPOSTFORFB(); vpostinfo.PERSONBUDGETAPPLYDETAILID = item.PERSONBUDGETAPPLYDETAILID; vpostinfo.OWNERID = item.OWNERID; vpostinfo.OWNERPOSTID = item.OWNERPOSTID; vlistpostinfo[i]=vpostinfo; i++; }); try { vlistpostinfo = pe.GetEmployeeListForFB(vlistpostinfo) as PersonnelWS.V_EMPLOYEEPOSTFORFB[]; } catch (Exception ex) { SystemBLL.Debug("调用HR服务异常 GetEmployeeListForFB " + ex.ToString()); } listperson.ForEach(item => { var person = vlistpostinfo.Where(p => p.PERSONBUDGETAPPLYDETAILID == item.PERSONBUDGETAPPLYDETAILID ).FirstOrDefault(); if (person != null) { item.SUGGESTBUDGETMONEY = person.SUM; switch (person.EMPLOYEESTATE) { case "0"://试用期 item.POSTINFO = "试用期,请注意"; break; case "1"://在职 item.POSTINFO = string.Empty; break; case "2"://已离职 item.POSTINFO = "已离职,请删除"; break; case "3"://离职中 item.POSTINFO = "离职中,请注意"; break; case "4"://未入职 item.POSTINFO = "未入职,请删除"; break; case "10"://异动中 item.POSTINFO = "异动中,请异动后再处理"; break; case "11"://异动过 item.POSTINFO = "异动过,已转换成新岗位"; item.OWNERPOSTID = person.NEWPOSTID; item.OWNERPOSTNAME = person.NEWPOSTNAME; item.OWNERDEPARTMENTID = person.NEWDEPARTMENTID; item.OWNERDEPARTMENTNAME = person.NEWDEPARTMENTNAME; item.OWNERCOMPANYID = person.NEWCOMPANYID; item.OWNERCOMPANYNAME = person.NEWCOMPANYNAME; break; case "12"://岗位异常 item.POSTINFO = "岗位异常,请删除后再选择"; break; default: item.POSTINFO = string.Empty; break; } switch (person.ISAGENCY) { case "0"://主岗位 // item.POSTINFO += string.Empty; break; case "1"://赚职 if (item.POSTINFO != string.Empty && person.EMPLOYEESTATE!="1") item.POSTINFO = item.POSTINFO.Insert(0, "兼职,"); else item.POSTINFO = "兼职"; break; default: // item.POSTINFO += string.Empty; break; } } }); return listperson; }
internal List<VirtualUser> GetVirtualUser(List<string> userIDs) { List<VirtualUser> listUser = new List<VirtualUser>(); if (userIDs.Count == 0) { return listUser; } try { PersonnelWS.PersonnelServiceClient personService = new PersonnelWS.PersonnelServiceClient(); List<PersonnelWS.T_HR_EMPLOYEE> employeeList = personService.GetEmployeeByIDs(userIDs.ToArray()).ToList(); employeeList.ForEach(employeeHR => { VirtualUser vu = new VirtualUser(); vu.ID = employeeHR.EMPLOYEEID; vu.Name = employeeHR.EMPLOYEECNAME + "(" + employeeHR.EMPLOYEECODE + ")"; listUser.Add(vu); }); } catch ( Exception ex) { SystemBLL.Debug(ex.ToString()); } return listUser; }