/// <summary> /// 服务年限奖励金额修正 /// </summary> private void DoEditMoney() { string prefix = FileModule.FindFirstByProperties("Name", "Portal").RootPath + "\\Default\\"; string FilePath = RequestData.Get("FileId") + ""; FilePath = prefix + FilePath; DataTable Dt = ExcelToDataTable(FilePath, 4); CommPowerSplit Ps = new CommPowerSplit(); bool IsPower = false; if (Ps.IsHR(UserInfo.UserID, UserInfo.LoginName) || Ps.IsAdmin(UserInfo.LoginName) || Ps.IsInAdminsRole(UserInfo.LoginName)) { IsPower = true; } for (int i = 0; i < Dt.Rows.Count; i++) { try { string workno = Dt.Rows[i]["工号"] + ""; SysUser UserEnt = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, Dt.Rows[i]["工号"]); SysGroup Group = SysGroup.TryFind(UserEnt.Pk_corp); TravelMoneyConfig TM = new TravelMoneyConfig(); decimal Money = 0.0m; if (!string.IsNullOrEmpty(Dt.Rows[i]["服务年限奖励金"] + "")) { decimal M = 0.0m; if (decimal.TryParse(Dt.Rows[i]["服务年限奖励金"] + "", out M)) { Money = M; } } string HasUsed = string.Empty; if (!string.IsNullOrEmpty(Dt.Rows[i]["是否已用"] + "")) { HasUsed = ((Dt.Rows[i]["是否已用"] + "") == "是" || (Dt.Rows[i]["是否已用"] + "") == "Y") ? "Y" : "N"; } string UpdateSQL = @"declare @id varchar(36) select top 1 @id=Id from FL_Culture..TravelMoneyConfig where WorkNo='{0}' and {3} order by CreateTime desc ; update FL_Culture..TravelMoneyConfig set Money={1}, HaveUsed='{2}' where Id=@id"; //权限 string Condition = string.Empty; Condition = IsPower ? " 1=1 " : " Corp ='" + Group.GroupID + "' "; UpdateSQL = string.Format(UpdateSQL, workno, Money, HasUsed, Condition); DataHelper.ExecSql(UpdateSQL); } catch (Exception e) { //throw new Exception(e.Message); } } this.PageState.Add("State", "1"); }
/// <summary> /// 查询 /// </summary> private void DoSelect() { string where = string.Empty; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { case "CreateTime": where += " year(CreateTime)=" + item.Value + " "; break; } } } SearchCriterion.RemoveSearch("CreateTime"); SearchCriterion.SetOrder(TravelMoneyConfig.Prop_Corp); //公司 SearchCriterion.SetOrder(TravelMoneyConfig.Prop_Indutydate, true); //日期 CommPowerSplit PS = new CommPowerSplit(); SysUser UsrEnt = SysUser.Find(UserInfo.UserID); if (PS.TraveMoneyConfig(UserInfo.UserID, UserInfo.LoginName)) //总部HR权限 HR1 { if (!string.IsNullOrEmpty(where)) { ents = TravelMoneyConfig.FindAll(SearchCriterion, Expression.Sql(where)); this.PageState.Add("TravelMoneyConfigList", ents); } else { ents = TravelMoneyConfig.FindAll(SearchCriterion); this.PageState.Add("TravelMoneyConfigList", ents); } } else { //公司权限 UserContextInfo UC = new UserContextInfo(); SearchCriterion.SetSearch(TravelMoneyConfig.Prop_Corp, UC.GetUserCurrentCorpId(UserInfo.UserID)); if (!string.IsNullOrEmpty(where)) { ents = TravelMoneyConfig.FindAll(SearchCriterion, Expression.Sql(where)); this.PageState.Add("TravelMoneyConfigList", ents); } else { ents = TravelMoneyConfig.FindAll(SearchCriterion); this.PageState.Add("TravelMoneyConfigList", ents); } } }
/// <summary> /// 查询 /// </summary> private void DoSelect() { var UserEnt = SysUser.Find(UserInfo.UserID); string CorpIds = string.Empty; CommPowerSplit ps = new CommPowerSplit(); if (ps.IsNoticeRole(UserInfo.UserID, UserInfo.LoginName)) { ents = UseWelfareNote.FindAll(SearchCriterion); } else { // 判断公司登陆 UserContextInfo UC = new UserContextInfo(); CorpIds = UC.GetUserCurrentCorpId(UserInfo.UserID); SearchCriterion.SetSearch("CreateCorp", CorpIds); ents = UseWelfareNote.FindAll(SearchCriterion); } this.PageState.Add("UseWelfareNoteList", ents); }
/// <summary> /// 查询 /// </summary> private void DoSelect() { string SurveyId = this.RequestData.Get("surveyId") + ""; string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!String.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { case "StartTime": where += " and CreateTime>='" + item.Value + "' "; break; case "EndTime": where += " and CreateTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' "; break; default: where += " and " + item.PropertyName + " like '%" + item.Value + "%' "; break; } } } //权限过滤 CommPowerSplit PS = new CommPowerSplit(); if (PS.IsHR(UserInfo.UserID, UserInfo.LoginName) || PS.IsAdmin(UserInfo.LoginName) || PS.IsInAdminsRole(UserInfo.UserID)) { } else { UserContextInfo UC = new UserContextInfo(); where += " and C.GroupId='" + UC.GetUserCurrentCorpId(UserInfo.UserID) + "' "; } string sql = @"select A.Id,A.SurveyId,A.SurveyName,A.WorkNo,A.SurveyedUserId,A.SurveyedUserName,A.CreateTime, A.TotalScore,A.ScoreInfo, B.WorkNo As WorkNo1 , C.GroupID As CropId ,C.Name As CropName,D.GroupID As DeptId,D.Name AS DeptName, E.IsNoName from FL_Culture..SurveyCommitHistory As A left join FL_PortalHR..SysUser As B on A.SurveyedUserId=B.UserID or A.WorkNo=B.WorkNo left join FL_PortalHR..SysGroup As C on C.GroupID=B.Pk_corp left join FL_PortalHR..SysGroup As D on D.GroupID =B.Pk_deptdoc left join FL_Culture..SurveyQuestion As E on A.SurveyId=E.Id where A.SurveyId='{0}' "; sql = sql.Replace("FL_PortalHR", Global.AimPortalDB); sql += where; sql = string.Format(sql, SurveyId); //SearchCriterion.SetSearch("SurveyId", SurveyId); //ents = SurveyCommitHistory.FindAll(SearchCriterion); //this.PageState.Add("SurveyCommitHistoryList", ents); this.PageState.Add("DataList", GetPageData(sql, SearchCriterion)); }
/// <summary> /// 生成旅游金额 /// </summary> private void CreateMoney() { string CorpId = string.Empty; UserContextInfo UC = new UserContextInfo(); CorpId = UC.GetUserCurrentCorpId(UserInfo.UserID); EasyDictionary LimitDate = SysEnumeration.GetEnumDict("TravelLimitDate"); string limitDateStr = string.Empty; if ((LimitDate["LimitDate"] + "").ToUpper() == "2L") //2 月最后一天 { limitDateStr = "'" + GetLastDayOfMonth(DateTime.Now.Year, 2).ToString("yyyy-MM-dd") + "'"; } else { string prefix = LimitDate["LimitDate"] + ""; limitDateStr = "'" + DateTime.Now.Year + "-" + prefix + "'"; } EasyDictionary Dic = SysEnumeration.GetEnumDict("BaseMoney"); string One = Dic[">1<5"] + ""; string Two = Dic[">=5<10"] + ""; string Three = Dic[">=10<15"] + ""; string Four = Dic[">=15<20"] + ""; EasyDictionary DicBase = SysEnumeration.GetEnumDict("WorkYearMoney"); string BaseMoney_One = DicBase["<1年"] + ""; string BaseMoney_two = DicBase[">1年"] + ""; string SQL = @"select A.* , case when 1<datediff(year, Indutydate,getdate())and datediff(year,Indutydate,getdate())<5 then {0} when 5<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<10 then {1} when 10<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<15 then {2} when 15<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<20 then {3} else 0 end As YearMoney, case when charindex('正式工',B.psnclassname)>0 and year(Indutydate)>1 then {5} else {4} end As BaseMoney ,C.GroupID as CorpId,C.Name As CorpName,D.GroupID As DeptId,D.Name As DeptName from FL_PortalHR..sysuser As A left join HR_OA_MiddleDB..fld_rylb As B on B.pk_fld_rylb=A.Pk_rylb left join FL_PortalHR..SysGroup As C on C.GroupID=A.PK_Corp left join FL_PortalHR..SysGroup As D on D.GroupID=A.Pk_deptdoc where (OutdutyDate='' or OutdutyDate is null) and A.Status=1 and A.Indutydate<>'' ##QUERY## "; SQL = string.Format(SQL, One, Two, Three, Four, BaseMoney_One, BaseMoney_two); SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB); SQL = SQL.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB); SQL = SQL.Replace("getdate()", limitDateStr); string where = string.Empty; CommPowerSplit PS = new CommPowerSplit(); if (PS.IsAdmin(UserInfo.LoginName) || PS.IsHR(UserInfo.UserID, UserInfo.LoginName)) { } else { where += " and A.Pk_corp='" + CorpId + "' "; } SQL = SQL.Replace("##QUERY##", where); DataTable UDt = DataHelper.QueryDataTable(SQL); for (int i = 0; i < UDt.Rows.Count; i++) { try { TravelMoneyConfig TM = new TravelMoneyConfig(); string YearMoney = UDt.Rows[i]["YearMoney"] + "", BaseMoney = UDt.Rows[i]["BaseMoney"] + ""; if (!string.IsNullOrEmpty(YearMoney)) { decimal M = 0.0m; if (decimal.TryParse(YearMoney, out M)) { TM.Money = M; } } else { TM.Money = 0; } //基本津贴 if (!string.IsNullOrEmpty(BaseMoney)) { decimal M = 0.0m; if (decimal.TryParse(BaseMoney, out M)) { TM.BaseMoney = M; } } else { TM.BaseMoney = 0; } TM.UserId = UDt.Rows[i]["UserID"] + ""; TM.UserName = UDt.Rows[i]["Name"] + ""; TM.WorkNo = UDt.Rows[i]["WorkNo"] + ""; DateTime DTime = new DateTime(); if (DateTime.TryParse(UDt.Rows[i]["Indutydate"] + "", out DTime)) { TM.Indutydate = DTime; } TM.HaveUsed = "N"; TM.Corp = UDt.Rows[i]["CorpId"] + ""; TM.CorpName = UDt.Rows[i]["CorpName"] + ""; TM.DeptId = UDt.Rows[i]["DeptId"] + ""; TM.DeptName = UDt.Rows[i]["DeptName"] + ""; TM.CreateTime = DateTime.Now; TM.Ext1 = "C|" + CorpId + "_" + UserInfo.UserID + ""; //生成标志 TM.Create(); } catch { } } this.PageState.Add("State", "1"); }