Exemplo n.º 1
0
        public void GeneratePostSalary(string postID, string year, string month)
        {
            EmployeePostBLL         bll    = new EmployeePostBLL();
            EmployeeSalaryRecordBLL bllemp = new EmployeeSalaryRecordBLL();
            List <SMT_HRM_EFModel.T_HR_EMPLOYEEPOST> emplist = bll.GetEmployeePostByPostID(postID);

            foreach (var emp in emplist)
            {
                employes.Add(bllemp.GetEmployeeInfor(emp.T_HR_EMPLOYEE.EMPLOYEEID));
                employeIDs.Add(emp.T_HR_EMPLOYEE.EMPLOYEEID);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增员工加扣款批量审核
        /// </summary>
        /// <param name="entity">员工加扣款批量审核实体</param>
        /// <returns></returns>
        public bool EmployeeAddSumBatchAdd(T_HR_EMPLOYEEADDSUMBATCH entity, string[] addsumids)
        {
            int i = 0;

            try
            {
                i = dal.Add(entity);
                if (i > 0)
                {
                    foreach (var id in addsumids)
                    {
                        var ents = from a in dal.GetObjects <T_HR_EMPLOYEEADDSUM>()
                                   where a.ADDSUMID == id
                                   select a;
                        if (ents.Count() > 0)
                        {
                            T_HR_EMPLOYEEADDSUM ent = ents.FirstOrDefault();
                            ent.CHECKSTATE = entity.CHECKSTATE;
                            string sql = "UPDATE T_HR_EMPLOYEEADDSUM T SET T.MONTHLYBATCHID = '" + entity.MONTHLYBATCHID + "'";
                            sql += " , T.CHECKSTATE = '" + entity.CHECKSTATE + "' WHERE T.ADDSUMID = '" + ent.ADDSUMID + "'";
                            EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL();
                            bll.ExecuteSql(sql, "T_HR_EMPLOYEEADDSUM");
                            //EmployeeAddSumBLL bll = new EmployeeAddSumBLL();
                            //ent.T_HR_EMPLOYEEADDSUMBATCH = new T_HR_EMPLOYEEADDSUMBATCH();
                            //ent.T_HR_EMPLOYEEADDSUMBATCH.EntityKey =
                            //    new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_EMPLOYEEADDSUMBATCH", "MONTHLYBATCHID", entity.MONTHLYBATCHID);
                            //bll.Update(ent);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SMT.Foundation.Log.Tracer.Debug(ex.Message);
                ex.Message.ToString();
            }
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 public bool UndoRepaymentMass(int objectType, string objectID, string year, string month)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         return bll.UndoRepayment(objectType, objectID, year, month);
     }
 }
Exemplo n.º 4
0
 public bool UndoRepayment(string employeeid, string year, string month)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         return bll.UndoRepayment(employeeid, year, month);
     }
 }
Exemplo n.º 5
0
 public List<string> FilterStandard(string year, string month)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         return bll.FilterStandard(year, month);
     }
 }
Exemplo n.º 6
0
        public decimal AutoCalItem(string itemid, string employeeID)
        {
            using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
            {

                return bll.AutoCalItem(itemid, employeeID);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 批量生成薪资标准
        /// </summary>
        /// <param name="solution"></param>
        /// <param name="postLevels"></param>
        /// <param name="standModel"></param>
        /// <returns></returns>
        public string CreateSalaryStandBatch(T_HR_SALARYSOLUTION solution, Dictionary <string, string> postLevels, T_HR_SALARYSTANDARD standModel)
        {
            try
            {
                //T_HR_SalaryStandard->T_HR_SalarySolution
                //T_HR_SalaryStandard->T_HR_SalaryLevel->T_HR_PostLevelDistinction->T_HR_SalarySystem
                Tracer.Debug("通过薪资方案生成薪资标准:方案名:" + solution.SALARYSOLUTIONNAME);
                #region 获取薪资级别信息
                EmployeeSalaryRecordBLL bll     = new EmployeeSalaryRecordBLL();
                SalaryStandardItemBLL   itemBLL = new SalaryStandardItemBLL();
                // 薪资方案的体系ID
                string salarySystemID = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMID;
                //薪资体系名
                string salarySystemName = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMNAME;
                // 岗位级别名
                string postLevelName = "";
                //薪资方案所属的薪资体系
                List <T_HR_SALARYLEVEL> salarylevelList = new List <T_HR_SALARYLEVEL>();
                //薪资体系薪资级别
                salarylevelList = (from c in dal.GetObjects <T_HR_SALARYLEVEL>().Include("T_HR_POSTLEVELDISTINCTION")
                                   where c.T_HR_POSTLEVELDISTINCTION.T_HR_SALARYSYSTEM.SALARYSYSTEMID == salarySystemID
                                   select c).OrderBy(m => m.SALARYLEVEL).OrderBy(x => x.T_HR_POSTLEVELDISTINCTION.POSTLEVEL).ToList();
                if (salarylevelList.Count < 1)
                {
                    Tracer.Debug("生产薪资标准,未获取到薪资等级 T_HR_SALARYLEVEL 信息");
                }
                //薪资方案的薪资项集合
                List <V_SALARYITEM> salaryItems = new List <V_SALARYITEM>();
                salaryItems = (from n in dal.GetObjects <T_HR_SALARYITEM>()
                               join m in dal.GetObjects <T_HR_SALARYSOLUTIONITEM>() on n.SALARYITEMID equals m.T_HR_SALARYITEM.SALARYITEMID
                               where m.T_HR_SALARYSOLUTION.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                               select new V_SALARYITEM
                {
                    T_HR_SALARYITEM = n,
                    ORDERNUMBER = m.ORDERNUMBER
                }
                               ).ToList();
                if (salaryItems.Count < 1)
                {
                    Tracer.Debug("生产薪资标准,未获取到薪资方案关联的薪资项目 T_HR_SALARYITEM 信息");
                }
                //方案所属地区差异补贴
                List <T_HR_AREAALLOWANCE> areaAllowance = new List <T_HR_AREAALLOWANCE>();
                areaAllowance = (from c in dal.GetObjects <T_HR_AREAALLOWANCE>()
                                 join b in dal.GetObjects <T_HR_SALARYSOLUTION>().Include("T_HR_AREADIFFERENCE")
                                 on c.T_HR_AREADIFFERENCE.AREADIFFERENCEID equals b.T_HR_AREADIFFERENCE.AREADIFFERENCEID
                                 where b.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                 select c).ToList();
                if (salaryItems.Count < 1)
                {
                    Tracer.Debug("生产薪资标准,未获取到薪资方案关联的地区差异补贴 T_HR_AREAALLOWANCE 信息");
                }
                //薪资方案薪资标准
                List <T_HR_SALARYSTANDARD> standAll = (from a in dal.GetObjects <T_HR_SALARYSTANDARD>().Include("T_HR_SALARYLEVEL").Include("T_HR_SALARYSTANDARDITEM")
                                                       where a.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                                       select a).ToList();
                #endregion
                int num = 0;
                foreach (var sl in salarylevelList)
                {
                    #region 获取薪资标准基本信息
                    //1.获取岗位级别名
                    var ent = from c in postLevels
                              join b in salarylevelList on c.Value equals b.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                  where b.SALARYLEVELID == sl.SALARYLEVELID
                              select c.Key;

                    if (ent.Count() > 0)
                    {
                        postLevelName = ent.FirstOrDefault().ToString();
                    }
                    //2.标准对应的地区差异补贴(和岗位级别有关)
                    decimal?allowance = 0;
                    if (areaAllowance != null)
                    {
                        allowance = (from al in areaAllowance
                                     where al.POSTLEVEL == sl.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                     select al.ALLOWANCE).FirstOrDefault();
                    }
                    //3.计算标准的基础数据
                    decimal?BasicData = sl.SALARYSUM;
                    #endregion

                    var checkEntity = (from a in standAll
                                       where a.T_HR_SALARYLEVEL.SALARYLEVELID == sl.SALARYLEVELID
                                       select a).FirstOrDefault();
                    #region 更新薪资标准
                    if (checkEntity != null)
                    {
                        try
                        {
                            Tracer.Debug("已存在薪资标准,开始更新:" + checkEntity.SALARYSTANDARDNAME);
                            //已存在,需要更新
                            //薪资标准名= 薪资体系名+岗位级别名+"-"+薪资级别名
                            var entity = (from sent in dal.GetObjects <T_HR_SALARYSTANDARD>().Include("T_HR_SALARYSTANDARDITEM")
                                          where sent.SALARYSTANDARDID == checkEntity.SALARYSTANDARDID
                                          select sent).FirstOrDefault();
                            entity.SALARYSTANDARDNAME = salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString();
                            entity.BASESALARY         = sl.SALARYSUM;
                            dal.UpdateFromContext(entity);
                            List <T_HR_SALARYSTANDARDITEM> listItem = entity.T_HR_SALARYSTANDARDITEM.ToList();
                            foreach (var standItem in listItem)
                            {
                                if (!standItem.T_HR_SALARYITEMReference.IsLoaded)
                                {
                                    standItem.T_HR_SALARYITEMReference.Load();
                                }
                                var q = from item in salaryItems
                                        where item.T_HR_SALARYITEM.SALARYITEMID == standItem.T_HR_SALARYITEMReference.EntityKey.EntityKeyValues[0].Value
                                        select item;
                                if (q.Count() > 0)
                                {
                                    var salaryitem = q.FirstOrDefault();
                                    if (salaryitem.T_HR_SALARYITEM.CALCULATORTYPE == "1" || (salaryitem.T_HR_SALARYITEM.CALCULATORTYPE == "4" && salaryitem.T_HR_SALARYITEM.GUERDONSUM != null))
                                    {
                                        standItem.SUM = salaryitem.T_HR_SALARYITEM.GUERDONSUM.ToString();
                                    }//计算类型是公式计算 而且不是在生成薪资时计算
                                    else if (salaryitem.T_HR_SALARYITEM.CALCULATORTYPE == "3" && salaryitem.T_HR_SALARYITEM.ISAUTOGENERATE == "0")
                                    {
                                        standItem.SUM = bll.AutoCalculateItem(salaryitem.T_HR_SALARYITEM.SALARYITEMID, Convert.ToDecimal(BasicData), allowance.ToString()).ToString();
                                    }
                                    //地区差异补贴
                                    else if (salaryitem.T_HR_SALARYITEM.ENTITYCOLUMNCODE == "AREADIFALLOWANCE")
                                    {
                                        standItem.SUM = allowance.ToString();
                                    }
                                }
                                dal.UpdateFromContext(standItem);
                            }
                            dal.SaveContextChanges();
                            Tracer.Debug("更新薪资标准成功!" + entity.SALARYSTANDARDNAME);
                        }
                        catch (Exception ex)
                        {
                            Tracer.Debug("更新薪资标准异常:" + ex.ToString());
                        }
                        continue;
                    }
                    #endregion

                    #region 新增薪资标准
                    try
                    {
                        Tracer.Debug("未找到薪资标准,开始新增薪资标准信息:" + salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString());
                        // 薪资体系的每条记录都对应一个标准 根据sl生成薪资标准
                        T_HR_SALARYSTANDARD stand = new T_HR_SALARYSTANDARD();
                        //薪资标准名= 薪资体系名+岗位级别名+"-"+薪资级别名
                        stand.SALARYSTANDARDNAME = salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString();
                        stand.SALARYSTANDARDID   = Guid.NewGuid().ToString();
                        stand.T_HR_SALARYLEVELReference.EntityKey
                            = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYLEVEL", "SALARYLEVELID", sl.SALARYLEVELID);
                        stand.SALARYSOLUTIONID = solution.SALARYSOLUTIONID;
                        stand.CHECKSTATE       = Convert.ToInt32(CheckStates.Approved).ToString();
                        stand.BASESALARY       = sl.SALARYSUM;
                        stand.CREATEDATE       = System.DateTime.Now;

                        //有关权限的字段
                        stand.CREATECOMPANYID    = standModel.CREATECOMPANYID;
                        stand.CREATEDEPARTMENTID = standModel.CREATEDEPARTMENTID;
                        stand.CREATEPOSTID       = standModel.CREATEPOSTID;
                        stand.CREATEUSERID       = standModel.CREATEUSERID;
                        stand.OWNERCOMPANYID     = standModel.OWNERCOMPANYID;
                        stand.OWNERDEPARTMENTID  = standModel.OWNERDEPARTMENTID;
                        stand.OWNERID            = standModel.OWNERID;
                        stand.OWNERPOSTID        = standModel.OWNERPOSTID;


                        //增加排序号
                        stand.PERSONALSIRATIO = num;
                        num++;

                        //按照方案的薪资项集合生成薪资标准的薪资项
                        //薪资标准的薪资项集合
                        List <T_HR_SALARYSTANDARDITEM> standSalaryitems = new List <T_HR_SALARYSTANDARDITEM>();
                        foreach (var item in salaryItems)
                        {
                            T_HR_SALARYSTANDARDITEM standItem = new T_HR_SALARYSTANDARDITEM();
                            standItem.STANDRECORDITEMID = Guid.NewGuid().ToString();
                            standItem.T_HR_SALARYITEMReference.EntityKey
                                = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYITEM", "SALARYITEMID", item.T_HR_SALARYITEM.SALARYITEMID);
                            // standItem.T_HR_SALARYITEM.SALARYITEMID = item.T_HR_SALARYITEM.SALARYITEMID;
                            standItem.CREATEUSERID = solution.CREATEUSERID;
                            standItem.T_HR_SALARYSTANDARDReference.EntityKey
                                = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYSTANDARD", "SALARYSTANDARDID", stand.SALARYSTANDARDID);
                            // standItem.T_HR_SALARYSTANDARD.SALARYSTANDARDID = stand.SALARYSTANDARDID;
                            standItem.CREATEDATE  = System.DateTime.Now;
                            standItem.ORDERNUMBER = item.ORDERNUMBER;
                            //计算类型是手动输入的 金额是薪资项设置是输入的值
                            if (item.T_HR_SALARYITEM.CALCULATORTYPE == "1" || (item.T_HR_SALARYITEM.CALCULATORTYPE == "4" && item.T_HR_SALARYITEM.GUERDONSUM != null))
                            {
                                standItem.SUM = item.T_HR_SALARYITEM.GUERDONSUM.ToString();
                            }
                            //计算类型是公式计算 而且不是在生成薪资时计算
                            else if (item.T_HR_SALARYITEM.CALCULATORTYPE == "3" && item.T_HR_SALARYITEM.ISAUTOGENERATE == "0")
                            {
                                standItem.SUM = bll.AutoCalculateItem(item.T_HR_SALARYITEM.SALARYITEMID, Convert.ToDecimal(BasicData), allowance.ToString()).ToString();
                            }
                            //地区差异补贴
                            else if (item.T_HR_SALARYITEM.ENTITYCOLUMNCODE == "AREADIFALLOWANCE")
                            {
                                standItem.SUM = allowance.ToString();
                            }
                            standSalaryitems.Add(standItem);
                        }
                        AddSalaryStanderAndItems(stand, standSalaryitems);
                        Tracer.Debug("未找到薪资标准,新增薪资标准成功!" + salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString());
                    }
                    catch (Exception ex)
                    {
                        Tracer.Debug("未找到薪资标准,新增薪资标准异常:" + ex.ToString());
                    }
                    #endregion
                }
                return("SAVESUCCESSED");
            }
            catch (Exception ex)
            {
                Tracer.Debug("生成薪资标准异常:" + ex.Message);
                return(ex.Message);
            }
        }
Exemplo n.º 8
0
        public void CreateSalaryStandBatch()
        {
            try
            {

                EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL();
                SalaryStandardItemBLL itemBLL = new SalaryStandardItemBLL();

                string strsolutionall = @"上海神达物流有限公司薪资方案(A类城市)
                                上海酷武供应链管理服务有限公司薪资方案(A类)
                                北京市神通物流有限公司薪资方案(A类城市)
                                南京红之衣物流有限公司薪资方案(B类城市)
                                南宁市神州通货运代理有限公司薪资方案(D类城市)
                                南昌神州通物流有限公司薪资方案(E类城市)
                                合肥神州通物流有限公司薪资方案(D类城市)
                                哈尔滨神达通运输有限责任公司薪资方案(D类城市)
                                天津神州通物流有限公司薪资方案(C类城市)
                                太原市神通物流有限公司薪资方案(E类城市)
                                广州市神通物流有限公司薪资方案(A类城市)
                                成都通神州物流有限公司薪资方案(D类城市)
                                昆明神州通物流有限公司薪资方案(D类城市)
                                杭州新神州通货物运输有限公司薪资方案(B类城市)
                                武汉通神州仓储服务有限责任公司薪资方案(C类城市)
                                沈阳神州通物流有限公司薪资方案(C类城市)
                                济南神州通物流有限公司薪资方案(C类城市)
                                深圳市神州通物流有限公司薪资方案(A类城市)
                                深圳市神州通物流有限公司薪资方案(B类城市)
                                深圳市神州通物流有限公司薪资方案(C类城市)
                                深圳市神州通物流有限公司薪资方案(D类城市)
                                深圳市神州通物流有限公司薪资方案(E类城市)
                                深圳市神州通物流有限公司贵阳分公司(E类城市)
                                深圳市通神州物流公司薪资方案(A类城市)
                                石家庄神州通物流有限公司薪资方案(D类城市)
                                福州市神州通货运代理有限公司薪资方案(C类城市)
                                西安市神之通物流有限公司薪资方案(D类城市)
                                贵阳市神州通物流有限公司(E类城市)
                                郑州市神州通物流有限公司薪资方案(D类城市)
                                重庆新神州通物流有限公司薪资方案(D类城市)
                                长春市神之通物流有限公司薪资方案(D类城市)
                                长沙市神通物流服务有限公司薪资方案(C类城市)
                                青海神之通电子商务有限公司薪资方案(E类)";
                var solutionAll = (from ent in dal.GetObjects<T_HR_SALARYSOLUTION>().Include("T_HR_SALARYSYSTEM")
                                   where ent.SALARYSOLUTIONNAME.Contains(strsolutionall)
                                   && ent.CHECKSTATE == "2"
                                   select ent).ToList();

                foreach (var solutionItem in solutionAll)
                {
                    solution = solutionItem;


                    standtmp = new T_HR_SALARYSTANDARD();
                    standtmp.SALARYSTANDARDID = Guid.NewGuid().ToString();
                    standtmp.CREATECOMPANYID = solution.CREATECOMPANYID;
                    standtmp.CREATEDEPARTMENTID = solution.CREATEDEPARTMENTID;
                    standtmp.CREATEPOSTID = solution.CREATEPOSTID;
                    standtmp.CREATEUSERID = solution.CREATEUSERID;

                    standtmp.OWNERCOMPANYID = solution.OWNERCOMPANYID;
                    standtmp.OWNERDEPARTMENTID = solution.OWNERDEPARTMENTID;
                    standtmp.OWNERID = solution.OWNERID;
                    standtmp.OWNERPOSTID = solution.OWNERPOSTID;
                    //loadbar.Start();

                    // 薪资方案的体系ID
                    string salarySystemID = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMID;
                    //薪资体系名
                    string salarySystemName = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMNAME;
                    // 岗位级别名
                    string postLevelName = "";

                    //薪资方案所属的薪资体系
                    List<T_HR_SALARYLEVEL> salarylevelList = new List<T_HR_SALARYLEVEL>();
                    //薪资方案的薪资项集合
                    List<V_SALARYITEM> salaryItems = new List<V_SALARYITEM>();

                    salarylevelList = (from c in dal.GetObjects<T_HR_SALARYLEVEL>().Include("T_HR_POSTLEVELDISTINCTION")
                                       where c.T_HR_POSTLEVELDISTINCTION.T_HR_SALARYSYSTEM.SALARYSYSTEMID == salarySystemID
                                       select c).ToList().OrderBy(m => m.SALARYLEVEL).OrderBy(x => x.T_HR_POSTLEVELDISTINCTION.POSTLEVEL).ToList();

                    salaryItems = (from n in dal.GetObjects<T_HR_SALARYITEM>()
                                   join m in dal.GetObjects<T_HR_SALARYSOLUTIONITEM>() on n.SALARYITEMID equals m.T_HR_SALARYITEM.SALARYITEMID
                                   where m.T_HR_SALARYSOLUTION.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                   select new V_SALARYITEM
                                   {
                                       T_HR_SALARYITEM = n,
                                       ORDERNUMBER = m.ORDERNUMBER
                                   }
                                   ).ToList();

                    //方案所属地区差异补贴
                    List<T_HR_AREAALLOWANCE> areaAllowance = new List<T_HR_AREAALLOWANCE>();
                    areaAllowance = (from c in dal.GetObjects<T_HR_AREAALLOWANCE>()
                                     join b in dal.GetObjects<T_HR_SALARYSOLUTION>().Include("T_HR_AREADIFFERENCE") on c.T_HR_AREADIFFERENCE.AREADIFFERENCEID equals b.T_HR_AREADIFFERENCE.AREADIFFERENCEID
                                     where b.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                     select c).ToList();

                    int num = 0;

                    //dal.BeginTransaction();
                    foreach (var sl in salarylevelList)
                    {
                        var ent = from c in postlevels
                                  join b in salarylevelList on c.Value equals b.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                  where b.SALARYLEVELID == sl.SALARYLEVELID
                                  select c.Key;
                        if (ent.Count() > 0)
                        {
                            postLevelName = ent.FirstOrDefault().ToString();
                        }
                        var ents = (from a in dal.GetObjects<T_HR_SALARYSTANDARD>()
                                    where a.T_HR_SALARYLEVEL.SALARYLEVELID == sl.SALARYLEVELID
                                    && a.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                    select new
                                    {
                                        a.SALARYSTANDARDID,
                                        a.SALARYSTANDARDNAME,
                                        a.T_HR_SALARYLEVEL.SALARYLEVEL
                                    });
                        if (ents.Count() > 0)
                        {
                           

                            var checkEntity = ents.FirstOrDefault();
                            ShowMessage(txtMsg, "薪资标准已存在,跳过:" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //已存在,跳过生成
                            continue;
                            //if (int.Parse(checkEntity.SALARYLEVEL) > 40)
                            //{
                            //    try { 
                            //    var delentity = (from a in dal.GetObjects<T_HR_SALARYSTANDARD>().Include("T_HR_SALARYSTANDARDITEM")
                            //                     where a.SALARYSTANDARDID
                            //                     == checkEntity.SALARYSTANDARDID
                            //                     select a).FirstOrDefault();
                            //    foreach (var entity in delentity.T_HR_SALARYSTANDARDITEM)
                            //    {
                            //        dal.Delete(entity);
                            //    }
                            //    dal.Delete(delentity);
                            //    ShowMessage(txtMsg, "删除薪资标准成功!" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //        }catch(Exception ex)
                            //    {
                            //        ShowMessage(txtMsg, "薪资标准已被使用,跳过:" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //        continue;
                            //    }
                            //}
                            //else
                            //{
                            //    ShowMessage(txtMsg, "薪资标准已存在,跳过:" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //    //已存在,跳过生成
                            //    continue;
                            //}
                        }
                        // 薪资体系的每条记录都对应一个标准 根据sl生成薪资标准
                        T_HR_SALARYSTANDARD stand = new T_HR_SALARYSTANDARD();
                        //薪资标准的薪资项集合
                        List<T_HR_SALARYSTANDARDITEM> standSalaryitems = new List<T_HR_SALARYSTANDARDITEM>();
                        //获取岗位级别名


                        //薪资标准名= 薪资体系名+岗位级别名+"-"+薪资级别名
                        stand.SALARYSTANDARDNAME = salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString();
                        stand.SALARYSTANDARDID = Guid.NewGuid().ToString();
                        // stand.T_HR_SALARYLEVEL = new T_HR_SALARYLEVEL();
                        stand.T_HR_SALARYLEVELReference.EntityKey
                              = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYLEVEL", "SALARYLEVELID", sl.SALARYLEVELID);
                        //  stand.T_HR_SALARYLEVEL.SALARYLEVELID = sl.SALARYLEVELID;
                        stand.SALARYSOLUTIONID = solution.SALARYSOLUTIONID;
                        stand.CHECKSTATE = "2";
                        stand.BASESALARY = sl.SALARYSUM;
                        stand.CREATEDATE = System.DateTime.Now;

                        //有关权限的字段
                        stand.CREATECOMPANYID = standtmp.CREATECOMPANYID;
                        stand.CREATEDEPARTMENTID = standtmp.CREATEDEPARTMENTID;
                        stand.CREATEPOSTID = standtmp.CREATEPOSTID;
                        stand.CREATEUSERID = standtmp.CREATEUSERID;
                        stand.OWNERCOMPANYID = standtmp.OWNERCOMPANYID;
                        stand.OWNERDEPARTMENTID = standtmp.OWNERDEPARTMENTID;
                        stand.OWNERID = standtmp.OWNERID;
                        stand.OWNERPOSTID = standtmp.OWNERPOSTID;


                        //增加排序号
                        stand.PERSONALSIRATIO = num;
                        num++;


                        //标准对应的地区差异补贴(和岗位级别有关)
                        decimal? allowance = 0;
                        if (areaAllowance != null)
                        {
                            allowance = (from al in areaAllowance
                                         where al.POSTLEVEL == sl.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                         select al.ALLOWANCE).FirstOrDefault();
                        }
                        //计算标准的基础数据
                        decimal? BasicData = sl.SALARYSUM;

                        //按照方案的薪资项集合生成薪资标准的薪资项
                        foreach (var item in salaryItems)
                        {
                            T_HR_SALARYSTANDARDITEM standItem = new T_HR_SALARYSTANDARDITEM();
                            standItem.STANDRECORDITEMID = Guid.NewGuid().ToString();
                            standItem.T_HR_SALARYITEMReference.EntityKey
                                = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYITEM", "SALARYITEMID", item.T_HR_SALARYITEM.SALARYITEMID);
                            // standItem.T_HR_SALARYITEM.SALARYITEMID = item.T_HR_SALARYITEM.SALARYITEMID;
                            standItem.CREATEUSERID = solution.CREATEUSERID;
                            standItem.T_HR_SALARYSTANDARDReference.EntityKey
                                = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYSTANDARD", "SALARYSTANDARDID", stand.SALARYSTANDARDID);
                            // standItem.T_HR_SALARYSTANDARD.SALARYSTANDARDID = stand.SALARYSTANDARDID;
                            standItem.CREATEDATE = System.DateTime.Now;
                            standItem.ORDERNUMBER = item.ORDERNUMBER;
                            //计算类型是手动输入的 金额是薪资项设置是输入的值
                            if (item.T_HR_SALARYITEM.CALCULATORTYPE == "1" || (item.T_HR_SALARYITEM.CALCULATORTYPE == "4" && item.T_HR_SALARYITEM.GUERDONSUM != null))
                            {
                                standItem.SUM = item.T_HR_SALARYITEM.GUERDONSUM.ToString();
                            }
                            //计算类型是公式计算 而且不是在生成薪资时计算  
                            else if (item.T_HR_SALARYITEM.CALCULATORTYPE == "3" && item.T_HR_SALARYITEM.ISAUTOGENERATE == "0")
                            {
                                standItem.SUM = bll.AutoCalculateItem(item.T_HR_SALARYITEM.SALARYITEMID, Convert.ToDecimal(BasicData), allowance.ToString()).ToString();
                            }
                            //地区差异补贴
                            else if (item.T_HR_SALARYITEM.ENTITYCOLUMNCODE == "AREADIFALLOWANCE")
                            {
                                standItem.SUM = allowance.ToString();
                            }
                            standSalaryitems.Add(standItem);
                        }
                        //SalaryStandardAdd(stand);
                        //itemBLL.SalaryStandardItemsAdd(standSalaryitems);
                        AddSalaryStanderAndItems(stand, standSalaryitems);
                        ShowMessage(txtMsg, "生成薪资标准:" + solution.SALARYSOLUTIONNAME + " " + stand.SALARYSTANDARDNAME + "成功!" + System.Environment.NewLine);
                    }
                }
                //dal.CommitTransaction();
                ShowMessage(txtMsg, "生成所有薪资标准成功!" + System.Environment.NewLine);
                MessageBox.Show("生成所有薪资标准成功!");
            }
            catch (Exception ex)
            {
                //dal.RollbackTransaction();
                MessageBox.Show("生成失败,错误信息:" + ex.ToString());
                SMT.Foundation.Log.Tracer.Debug(ex.Message);
            }
        }
Exemplo n.º 9
0
 public void EmployeeSalaryRecordUpdate(T_HR_EMPLOYEESALARYRECORD entity)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         bll.EmployeeSalaryRecordUpdate(entity);
     }
 }
Exemplo n.º 10
0
        public Dictionary<object, object> SalaryRecordAccountCheck(Dictionary<string,string> GeneratePrameter,int objectType, string objectID, int year, int month, string construes)
        {
            int GernerateType=int.Parse(GeneratePrameter["GernerateType"]);
            string GenerateEmployeePostid = GeneratePrameter["GenerateEmployeePostid"];
            string GenerateCompanyid = GeneratePrameter["GenerateCompanyid"];

            if (string.IsNullOrEmpty(GernerateType.ToString())
                      || string.IsNullOrEmpty(GenerateEmployeePostid)
                      || string.IsNullOrEmpty(GenerateCompanyid))
            {
                string message = "结算薪资参数异常,请联系管理员,GernerateType" + GeneratePrameter["GernerateType"]
                    + "GenerateEmployeePostid" + GeneratePrameter["GenerateEmployeePostid"]
                + "GenerateCompanyid" + GeneratePrameter["GenerateCompanyid"];
                Dictionary<object, object> GetInfor = new Dictionary<object, object>();
                GetInfor.Add("结算薪资错误", message);
                Tracer.Debug(message);

                return GetInfor;
            }

            using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
            {
                return bll.SalaryRecordAccount(GernerateType, GenerateEmployeePostid, GenerateCompanyid,objectType, objectID, year, month, construes, false);
            }
        }
Exemplo n.º 11
0
 public List<T_HR_EMPLOYEESALARYRECORD> GetEmployeeSalaryRecordPaging(int pageIndex, int pageSize, string sort, string filterString, string[] paras, ref int pageCount, DateTime starttime, DateTime endtime, string strCheckState, string userID)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         IQueryable<T_HR_EMPLOYEESALARYRECORD> q = bll.QueryWithPaging(pageIndex, pageSize, sort, filterString, paras, ref  pageCount, starttime, endtime, strCheckState, userID);
         if (q != null)
         {
             return q.Count() > 0 ? q.ToList() : null;
         }
         else
         {
             return null;
         }
     }
 }
Exemplo n.º 12
0
 public bool EmployeeSalaryRecordDelete(string[] IDs)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         int rslt = bll.EmployeeSalaryRecordDelete(IDs);
         return (rslt > 0);
     }
 }
Exemplo n.º 13
0
 public int EmployeeSalaryRecordOrItemDelete(string[] EmployeeSalaryRecordIDs)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         return bll.EmployeeSalaryRecordOrItemDelete(EmployeeSalaryRecordIDs);
     }
 }
Exemplo n.º 14
0
        /// <summary>
        /// 批量生成薪资标准
        /// </summary>
        /// <param name="solution"></param>
        /// <param name="postLevels"></param>
        /// <param name="standModel"></param>
        /// <returns></returns>
        public string CreateSalaryStandBatch(T_HR_SALARYSOLUTION solution, Dictionary <string, string> postLevels, T_HR_SALARYSTANDARD standModel)
        {
            try
            {
                // 检查方案是否已经使用
                var tmpArchives = from ac in dal.GetObjects <T_HR_SALARYARCHIVE>()
                                  where ac.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                  select ac;
                if (tmpArchives.Count() > 0)
                {
                    Tracer.Debug("方案已经在使用中,无法重新生成薪资标准");
                    return("SALARYSOLUTIONINUSED");
                }

                // 薪资方案的体系ID
                string salarySystemID = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMID;
                //薪资体系名
                string salarySystemName = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMNAME;
                // 岗位级别名
                string postLevelName            = "";
                EmployeeSalaryRecordBLL bll     = new EmployeeSalaryRecordBLL();
                SalaryStandardItemBLL   itemBLL = new SalaryStandardItemBLL();

                //薪资方案所属的薪资体系
                List <T_HR_SALARYLEVEL> salarylevelList = new List <T_HR_SALARYLEVEL>();
                //薪资方案的薪资项集合
                List <V_SALARYITEM> salaryItems = new List <V_SALARYITEM>();

                salarylevelList = (from c in dal.GetObjects <T_HR_SALARYLEVEL>().Include("T_HR_POSTLEVELDISTINCTION")
                                   where c.T_HR_POSTLEVELDISTINCTION.T_HR_SALARYSYSTEM.SALARYSYSTEMID == salarySystemID
                                   select c).OrderBy(m => m.SALARYLEVEL).OrderBy(x => x.T_HR_POSTLEVELDISTINCTION.POSTLEVEL).ToList();


                //salaryItems = (from n in DataContext.T_HR_SALARYITEM
                //               join m in DataContext.T_HR_SALARYSOLUTIONITEM on n.SALARYITEMID equals m.T_HR_SALARYITEM.SALARYITEMID
                //               where m.T_HR_SALARYSOLUTION.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                //               select n).ToList();
                salaryItems = (from n in dal.GetObjects <T_HR_SALARYITEM>()
                               join m in dal.GetObjects <T_HR_SALARYSOLUTIONITEM>() on n.SALARYITEMID equals m.T_HR_SALARYITEM.SALARYITEMID
                               where m.T_HR_SALARYSOLUTION.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                               select new V_SALARYITEM
                {
                    T_HR_SALARYITEM = n,
                    ORDERNUMBER = m.ORDERNUMBER
                }
                               ).ToList();

                //方案所属地区差异补贴
                List <T_HR_AREAALLOWANCE> areaAllowance = new List <T_HR_AREAALLOWANCE>();
                areaAllowance = (from c in dal.GetObjects <T_HR_AREAALLOWANCE>()
                                 join b in dal.GetObjects <T_HR_SALARYSOLUTION>().Include("T_HR_AREADIFFERENCE") on c.T_HR_AREADIFFERENCE.AREADIFFERENCEID equals b.T_HR_AREADIFFERENCE.AREADIFFERENCEID
                                 where b.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                 select c).ToList();

                //新增前删除原有的标准
                SalaryStandardBLL standBLL = new SalaryStandardBLL();
                standBLL.SalaryStandardDeleteBySolutionID(solution.SALARYSOLUTIONID);
                //var enttt = from ccc in salarylevelList where ccc.SALARYSUM>0 select ccc;
                int num = 0;
                #region   薪资标准排序算法
                int numsign    = 0;
                int recordsign = 0;
                for (int x = 0; x < salarylevelList.Count; x++)
                {
                    if (numsign == 0)
                    {
                        recordsign = x;
                    }
                    if ((x + 1 < salarylevelList.Count && salarylevelList[x].T_HR_POSTLEVELDISTINCTION.POSTLEVEL != salarylevelList[x + 1].T_HR_POSTLEVELDISTINCTION.POSTLEVEL) || x == salarylevelList.Count - 1)
                    {
                        numsign++;
                        for (int i = recordsign; i < recordsign + numsign; i++)
                        {
                            for (int j = i + 1; j < recordsign + numsign; j++)
                            {
                                //if (salarylevelList[i].T_HR_POSTLEVELDISTINCTION.POSTLEVEL > 0) break;
                                if (Convert.ToDecimal(salarylevelList[i].SALARYLEVEL) > Convert.ToDecimal(salarylevelList[j].SALARYLEVEL))
                                {
                                    T_HR_SALARYLEVEL t = null;
                                    t = salarylevelList[i];
                                    salarylevelList[i] = salarylevelList[j];
                                    salarylevelList[j] = t;
                                }
                            }
                        }
                        numsign = 0;
                    }
                    else
                    {
                        numsign++;
                    }
                }
                #endregion
                //dal.BeginTransaction();
                foreach (var sl in salarylevelList)
                {
                    // 薪资体系的每条记录都对应一个标准 根据sl生成薪资标准
                    T_HR_SALARYSTANDARD stand = new T_HR_SALARYSTANDARD();
                    //薪资标准的薪资项集合
                    List <T_HR_SALARYSTANDARDITEM> standSalaryitems = new List <T_HR_SALARYSTANDARDITEM>();
                    //获取岗位级别名
                    var ent = from c in postLevels
                              join b in salarylevelList on c.Value equals b.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                  where b.SALARYLEVELID == sl.SALARYLEVELID
                              select c.Key;

                    if (ent.Count() > 0)
                    {
                        postLevelName = ent.FirstOrDefault().ToString();
                    }

                    //薪资标准名= 薪资体系名+岗位级别名+"-"+薪资级别名
                    stand.SALARYSTANDARDNAME = salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString();
                    stand.SALARYSTANDARDID   = Guid.NewGuid().ToString();
                    // stand.T_HR_SALARYLEVEL = new T_HR_SALARYLEVEL();
                    stand.T_HR_SALARYLEVELReference.EntityKey
                        = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYLEVEL", "SALARYLEVELID", sl.SALARYLEVELID);
                    //  stand.T_HR_SALARYLEVEL.SALARYLEVELID = sl.SALARYLEVELID;
                    stand.SALARYSOLUTIONID = solution.SALARYSOLUTIONID;
                    stand.CHECKSTATE       = Convert.ToInt32(CheckStates.Approved).ToString();
                    stand.BASESALARY       = sl.SALARYSUM;
                    stand.CREATEDATE       = System.DateTime.Now;

                    //有关权限的字段
                    stand.CREATECOMPANYID    = standModel.CREATECOMPANYID;
                    stand.CREATEDEPARTMENTID = standModel.CREATEDEPARTMENTID;
                    stand.CREATEPOSTID       = standModel.CREATEPOSTID;
                    stand.CREATEUSERID       = standModel.CREATEUSERID;
                    stand.OWNERCOMPANYID     = standModel.OWNERCOMPANYID;
                    stand.OWNERDEPARTMENTID  = standModel.OWNERDEPARTMENTID;
                    stand.OWNERID            = standModel.OWNERID;
                    stand.OWNERPOSTID        = standModel.OWNERPOSTID;


                    //增加排序号
                    stand.PERSONALSIRATIO = num;
                    num++;


                    //标准对应的地区差异补贴(和岗位级别有关)
                    decimal?allowance = 0;
                    if (areaAllowance != null)
                    {
                        allowance = (from al in areaAllowance
                                     where al.POSTLEVEL == sl.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                     select al.ALLOWANCE).FirstOrDefault();
                    }
                    //计算标准的基础数据
                    decimal?BasicData = sl.SALARYSUM;

                    //按照方案的薪资项集合生成薪资标准的薪资项
                    foreach (var item in salaryItems)
                    {
                        T_HR_SALARYSTANDARDITEM standItem = new T_HR_SALARYSTANDARDITEM();
                        standItem.STANDRECORDITEMID = Guid.NewGuid().ToString();
                        standItem.T_HR_SALARYITEMReference.EntityKey
                            = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYITEM", "SALARYITEMID", item.T_HR_SALARYITEM.SALARYITEMID);
                        // standItem.T_HR_SALARYITEM.SALARYITEMID = item.T_HR_SALARYITEM.SALARYITEMID;
                        standItem.CREATEUSERID = solution.CREATEUSERID;
                        standItem.T_HR_SALARYSTANDARDReference.EntityKey
                            = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYSTANDARD", "SALARYSTANDARDID", stand.SALARYSTANDARDID);
                        // standItem.T_HR_SALARYSTANDARD.SALARYSTANDARDID = stand.SALARYSTANDARDID;
                        standItem.CREATEDATE  = System.DateTime.Now;
                        standItem.ORDERNUMBER = item.ORDERNUMBER;
                        //计算类型是手动输入的 金额是薪资项设置是输入的值
                        if (item.T_HR_SALARYITEM.CALCULATORTYPE == "1" || (item.T_HR_SALARYITEM.CALCULATORTYPE == "4" && item.T_HR_SALARYITEM.GUERDONSUM != null))
                        {
                            standItem.SUM = item.T_HR_SALARYITEM.GUERDONSUM.ToString();
                        }
                        //计算类型是公式计算 而且不是在生成薪资时计算
                        else if (item.T_HR_SALARYITEM.CALCULATORTYPE == "3" && item.T_HR_SALARYITEM.ISAUTOGENERATE == "0")
                        {
                            standItem.SUM = bll.AutoCalculateItem(item.T_HR_SALARYITEM.SALARYITEMID, Convert.ToDecimal(BasicData), allowance.ToString()).ToString();
                        }
                        //地区差异补贴
                        else if (item.T_HR_SALARYITEM.ENTITYCOLUMNCODE == "AREADIFALLOWANCE")
                        {
                            standItem.SUM = allowance.ToString();
                        }
                        standSalaryitems.Add(standItem);
                    }
                    //SalaryStandardAdd(stand);
                    //itemBLL.SalaryStandardItemsAdd(standSalaryitems);
                    AddSalaryStanderAndItems(stand, standSalaryitems);
                }
                //dal.CommitTransaction();
                return("SAVESUCCESSED");
            }
            catch (Exception ex)
            {
                //dal.RollbackTransaction();
                SMT.Foundation.Log.Tracer.Debug(ex.Message);
                return(ex.Message);
            }
        }
Exemplo n.º 15
0
        public void CreateSalaryStandBatch()
        {
            try
            {
                EmployeeSalaryRecordBLL bll     = new EmployeeSalaryRecordBLL();
                SalaryStandardItemBLL   itemBLL = new SalaryStandardItemBLL();

                string strsolutionall = @"上海神达物流有限公司薪资方案(A类城市)
                                上海酷武供应链管理服务有限公司薪资方案(A类)
                                北京市神通物流有限公司薪资方案(A类城市)
                                南京红之衣物流有限公司薪资方案(B类城市)
                                南宁市神州通货运代理有限公司薪资方案(D类城市)
                                南昌神州通物流有限公司薪资方案(E类城市)
                                合肥神州通物流有限公司薪资方案(D类城市)
                                哈尔滨神达通运输有限责任公司薪资方案(D类城市)
                                天津神州通物流有限公司薪资方案(C类城市)
                                太原市神通物流有限公司薪资方案(E类城市)
                                广州市神通物流有限公司薪资方案(A类城市)
                                成都通神州物流有限公司薪资方案(D类城市)
                                昆明神州通物流有限公司薪资方案(D类城市)
                                杭州新神州通货物运输有限公司薪资方案(B类城市)
                                武汉通神州仓储服务有限责任公司薪资方案(C类城市)
                                沈阳神州通物流有限公司薪资方案(C类城市)
                                济南神州通物流有限公司薪资方案(C类城市)
                                深圳市神州通物流有限公司薪资方案(A类城市)
                                深圳市神州通物流有限公司薪资方案(B类城市)
                                深圳市神州通物流有限公司薪资方案(C类城市)
                                深圳市神州通物流有限公司薪资方案(D类城市)
                                深圳市神州通物流有限公司薪资方案(E类城市)
                                深圳市神州通物流有限公司贵阳分公司(E类城市)
                                深圳市通神州物流公司薪资方案(A类城市)
                                石家庄神州通物流有限公司薪资方案(D类城市)
                                福州市神州通货运代理有限公司薪资方案(C类城市)
                                西安市神之通物流有限公司薪资方案(D类城市)
                                贵阳市神州通物流有限公司(E类城市)
                                郑州市神州通物流有限公司薪资方案(D类城市)
                                重庆新神州通物流有限公司薪资方案(D类城市)
                                长春市神之通物流有限公司薪资方案(D类城市)
                                长沙市神通物流服务有限公司薪资方案(C类城市)
                                青海神之通电子商务有限公司薪资方案(E类)";
                var    solutionAll    = (from ent in dal.GetObjects <T_HR_SALARYSOLUTION>().Include("T_HR_SALARYSYSTEM")
                                         where ent.SALARYSOLUTIONNAME.Contains(strsolutionall) &&
                                         ent.CHECKSTATE == "2"
                                         select ent).ToList();

                foreach (var solutionItem in solutionAll)
                {
                    solution = solutionItem;


                    standtmp = new T_HR_SALARYSTANDARD();
                    standtmp.SALARYSTANDARDID   = Guid.NewGuid().ToString();
                    standtmp.CREATECOMPANYID    = solution.CREATECOMPANYID;
                    standtmp.CREATEDEPARTMENTID = solution.CREATEDEPARTMENTID;
                    standtmp.CREATEPOSTID       = solution.CREATEPOSTID;
                    standtmp.CREATEUSERID       = solution.CREATEUSERID;

                    standtmp.OWNERCOMPANYID    = solution.OWNERCOMPANYID;
                    standtmp.OWNERDEPARTMENTID = solution.OWNERDEPARTMENTID;
                    standtmp.OWNERID           = solution.OWNERID;
                    standtmp.OWNERPOSTID       = solution.OWNERPOSTID;
                    //loadbar.Start();

                    // 薪资方案的体系ID
                    string salarySystemID = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMID;
                    //薪资体系名
                    string salarySystemName = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMNAME;
                    // 岗位级别名
                    string postLevelName = "";

                    //薪资方案所属的薪资体系
                    List <T_HR_SALARYLEVEL> salarylevelList = new List <T_HR_SALARYLEVEL>();
                    //薪资方案的薪资项集合
                    List <V_SALARYITEM> salaryItems = new List <V_SALARYITEM>();

                    salarylevelList = (from c in dal.GetObjects <T_HR_SALARYLEVEL>().Include("T_HR_POSTLEVELDISTINCTION")
                                       where c.T_HR_POSTLEVELDISTINCTION.T_HR_SALARYSYSTEM.SALARYSYSTEMID == salarySystemID
                                       select c).ToList().OrderBy(m => m.SALARYLEVEL).OrderBy(x => x.T_HR_POSTLEVELDISTINCTION.POSTLEVEL).ToList();

                    salaryItems = (from n in dal.GetObjects <T_HR_SALARYITEM>()
                                   join m in dal.GetObjects <T_HR_SALARYSOLUTIONITEM>() on n.SALARYITEMID equals m.T_HR_SALARYITEM.SALARYITEMID
                                   where m.T_HR_SALARYSOLUTION.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                   select new V_SALARYITEM
                    {
                        T_HR_SALARYITEM = n,
                        ORDERNUMBER = m.ORDERNUMBER
                    }
                                   ).ToList();

                    //方案所属地区差异补贴
                    List <T_HR_AREAALLOWANCE> areaAllowance = new List <T_HR_AREAALLOWANCE>();
                    areaAllowance = (from c in dal.GetObjects <T_HR_AREAALLOWANCE>()
                                     join b in dal.GetObjects <T_HR_SALARYSOLUTION>().Include("T_HR_AREADIFFERENCE") on c.T_HR_AREADIFFERENCE.AREADIFFERENCEID equals b.T_HR_AREADIFFERENCE.AREADIFFERENCEID
                                     where b.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                     select c).ToList();

                    int num = 0;

                    //dal.BeginTransaction();
                    foreach (var sl in salarylevelList)
                    {
                        var ent = from c in postlevels
                                  join b in salarylevelList on c.Value equals b.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                      where b.SALARYLEVELID == sl.SALARYLEVELID
                                  select c.Key;

                        if (ent.Count() > 0)
                        {
                            postLevelName = ent.FirstOrDefault().ToString();
                        }
                        var ents = (from a in dal.GetObjects <T_HR_SALARYSTANDARD>()
                                    where a.T_HR_SALARYLEVEL.SALARYLEVELID == sl.SALARYLEVELID &&
                                    a.SALARYSOLUTIONID == solution.SALARYSOLUTIONID
                                    select new
                        {
                            a.SALARYSTANDARDID,
                            a.SALARYSTANDARDNAME,
                            a.T_HR_SALARYLEVEL.SALARYLEVEL
                        });
                        if (ents.Count() > 0)
                        {
                            var checkEntity = ents.FirstOrDefault();
                            ShowMessage(txtMsg, "薪资标准已存在,跳过:" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //已存在,跳过生成
                            continue;
                            //if (int.Parse(checkEntity.SALARYLEVEL) > 40)
                            //{
                            //    try {
                            //    var delentity = (from a in dal.GetObjects<T_HR_SALARYSTANDARD>().Include("T_HR_SALARYSTANDARDITEM")
                            //                     where a.SALARYSTANDARDID
                            //                     == checkEntity.SALARYSTANDARDID
                            //                     select a).FirstOrDefault();
                            //    foreach (var entity in delentity.T_HR_SALARYSTANDARDITEM)
                            //    {
                            //        dal.Delete(entity);
                            //    }
                            //    dal.Delete(delentity);
                            //    ShowMessage(txtMsg, "删除薪资标准成功!" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //        }catch(Exception ex)
                            //    {
                            //        ShowMessage(txtMsg, "薪资标准已被使用,跳过:" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //        continue;
                            //    }
                            //}
                            //else
                            //{
                            //    ShowMessage(txtMsg, "薪资标准已存在,跳过:" + solution.SALARYSOLUTIONNAME + " " + checkEntity.SALARYSTANDARDNAME + System.Environment.NewLine);
                            //    //已存在,跳过生成
                            //    continue;
                            //}
                        }
                        // 薪资体系的每条记录都对应一个标准 根据sl生成薪资标准
                        T_HR_SALARYSTANDARD stand = new T_HR_SALARYSTANDARD();
                        //薪资标准的薪资项集合
                        List <T_HR_SALARYSTANDARDITEM> standSalaryitems = new List <T_HR_SALARYSTANDARDITEM>();
                        //获取岗位级别名


                        //薪资标准名= 薪资体系名+岗位级别名+"-"+薪资级别名
                        stand.SALARYSTANDARDNAME = salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString();
                        stand.SALARYSTANDARDID   = Guid.NewGuid().ToString();
                        // stand.T_HR_SALARYLEVEL = new T_HR_SALARYLEVEL();
                        stand.T_HR_SALARYLEVELReference.EntityKey
                            = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYLEVEL", "SALARYLEVELID", sl.SALARYLEVELID);
                        //  stand.T_HR_SALARYLEVEL.SALARYLEVELID = sl.SALARYLEVELID;
                        stand.SALARYSOLUTIONID = solution.SALARYSOLUTIONID;
                        stand.CHECKSTATE       = "2";
                        stand.BASESALARY       = sl.SALARYSUM;
                        stand.CREATEDATE       = System.DateTime.Now;

                        //有关权限的字段
                        stand.CREATECOMPANYID    = standtmp.CREATECOMPANYID;
                        stand.CREATEDEPARTMENTID = standtmp.CREATEDEPARTMENTID;
                        stand.CREATEPOSTID       = standtmp.CREATEPOSTID;
                        stand.CREATEUSERID       = standtmp.CREATEUSERID;
                        stand.OWNERCOMPANYID     = standtmp.OWNERCOMPANYID;
                        stand.OWNERDEPARTMENTID  = standtmp.OWNERDEPARTMENTID;
                        stand.OWNERID            = standtmp.OWNERID;
                        stand.OWNERPOSTID        = standtmp.OWNERPOSTID;


                        //增加排序号
                        stand.PERSONALSIRATIO = num;
                        num++;


                        //标准对应的地区差异补贴(和岗位级别有关)
                        decimal?allowance = 0;
                        if (areaAllowance != null)
                        {
                            allowance = (from al in areaAllowance
                                         where al.POSTLEVEL == sl.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString()
                                         select al.ALLOWANCE).FirstOrDefault();
                        }
                        //计算标准的基础数据
                        decimal?BasicData = sl.SALARYSUM;

                        //按照方案的薪资项集合生成薪资标准的薪资项
                        foreach (var item in salaryItems)
                        {
                            T_HR_SALARYSTANDARDITEM standItem = new T_HR_SALARYSTANDARDITEM();
                            standItem.STANDRECORDITEMID = Guid.NewGuid().ToString();
                            standItem.T_HR_SALARYITEMReference.EntityKey
                                = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYITEM", "SALARYITEMID", item.T_HR_SALARYITEM.SALARYITEMID);
                            // standItem.T_HR_SALARYITEM.SALARYITEMID = item.T_HR_SALARYITEM.SALARYITEMID;
                            standItem.CREATEUSERID = solution.CREATEUSERID;
                            standItem.T_HR_SALARYSTANDARDReference.EntityKey
                                = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYSTANDARD", "SALARYSTANDARDID", stand.SALARYSTANDARDID);
                            // standItem.T_HR_SALARYSTANDARD.SALARYSTANDARDID = stand.SALARYSTANDARDID;
                            standItem.CREATEDATE  = System.DateTime.Now;
                            standItem.ORDERNUMBER = item.ORDERNUMBER;
                            //计算类型是手动输入的 金额是薪资项设置是输入的值
                            if (item.T_HR_SALARYITEM.CALCULATORTYPE == "1" || (item.T_HR_SALARYITEM.CALCULATORTYPE == "4" && item.T_HR_SALARYITEM.GUERDONSUM != null))
                            {
                                standItem.SUM = item.T_HR_SALARYITEM.GUERDONSUM.ToString();
                            }
                            //计算类型是公式计算 而且不是在生成薪资时计算
                            else if (item.T_HR_SALARYITEM.CALCULATORTYPE == "3" && item.T_HR_SALARYITEM.ISAUTOGENERATE == "0")
                            {
                                standItem.SUM = bll.AutoCalculateItem(item.T_HR_SALARYITEM.SALARYITEMID, Convert.ToDecimal(BasicData), allowance.ToString()).ToString();
                            }
                            //地区差异补贴
                            else if (item.T_HR_SALARYITEM.ENTITYCOLUMNCODE == "AREADIFALLOWANCE")
                            {
                                standItem.SUM = allowance.ToString();
                            }
                            standSalaryitems.Add(standItem);
                        }
                        //SalaryStandardAdd(stand);
                        //itemBLL.SalaryStandardItemsAdd(standSalaryitems);
                        AddSalaryStanderAndItems(stand, standSalaryitems);
                        ShowMessage(txtMsg, "生成薪资标准:" + solution.SALARYSOLUTIONNAME + " " + stand.SALARYSTANDARDNAME + "成功!" + System.Environment.NewLine);
                    }
                }
                //dal.CommitTransaction();
                ShowMessage(txtMsg, "生成所有薪资标准成功!" + System.Environment.NewLine);
                MessageBox.Show("生成所有薪资标准成功!");
            }
            catch (Exception ex)
            {
                //dal.RollbackTransaction();
                MessageBox.Show("生成失败,错误信息:" + ex.ToString());
                SMT.Foundation.Log.Tracer.Debug(ex.Message);
            }
        }
Exemplo n.º 16
0
 public List<T_HR_EMPLOYEESALARYRECORD> SalaryContrast(string SentEmployeeSalaryRecordID)
 {
     List<T_HR_EMPLOYEESALARYRECORD> temp = new List<T_HR_EMPLOYEESALARYRECORD>();
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         temp = bll.SalaryContrast(SentEmployeeSalaryRecordID);
         if (temp.Count > 0)
         {
             return temp;
         }
     }
     return null;
 }
Exemplo n.º 17
0
 public List<string> SalaryContrastAll(string SentEmployeeSalaryRecordID, out List<string> nowData, out List<string> lastData)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         List<string> titleData = new List<string>();
         nowData = new List<string>();
         lastData = new List<string>();
         bll.SalaryContrast(SentEmployeeSalaryRecordID, out nowData, out lastData, out titleData);
         return titleData;
     }
 }
Exemplo n.º 18
0
 public List<string> FBStatistics(string employeeID, int year, int month)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         return bll.FBStatistics(employeeID, year, month);
     }
 }
Exemplo n.º 19
0
 public T_HR_EMPLOYEESALARYRECORD GetEmployeeSalaryRecordByID(string ID)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         return bll.GetEmployeeSalaryRecordByID(ID);
     }
 }
Exemplo n.º 20
0
 public List<string> FBStatisticsMassByChoose(int objectType, string objectID, decimal dSum, int year, int month, string userID, string departmentID)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         return bll.FBStatisticsByChoose(objectType, objectID, dSum, year, month, userID, departmentID);
     }
 }
Exemplo n.º 21
0
        /// <summary>
        /// 从Excel读取数据
        /// </summary>
        /// <param name="strPhysicalPath"></param>
        /// <returns></returns>
        public string ImportEmployeeMonthlySalary(GenerateUserInfo GenerateUser, string strPhysicalPath, string year, string month, string owerCompayId, ref string UImsg)
        {
            if (DateTime.Now.Hour != Convert.ToInt32(ConfigurationManager.AppSettings["ElapsedHour"]))
            {
            }
            string msg = string.Empty;

            Microsoft.VisualBasic.FileIO.TextFieldParser TF = new Microsoft.VisualBasic.FileIO.TextFieldParser(strPhysicalPath, Encoding.GetEncoding("GB2312"));
            EmployeeBLL empBll = new EmployeeBLL();
            var         User   = empBll.GetEmployeeDetailView(GenerateUser.GenerateUserId);

            TF.Delimiters = new string[] { "," }; //设置分隔符
            string[] strLine;

            EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL();

            while (!TF.EndOfData)
            {
                try
                {
                    strLine = TF.ReadFields();
                    string strIDNUMBER       = strLine[0]; //身份证号码
                    string strEmployeeName   = strLine[1]; //员工姓名
                    string strSalaryItemName = strLine[2]; //员工薪资项目名
                    string strSalaryItemSUM  = strLine[3]; //员工薪资项目金额

                    var employee = (from ent in dal.GetObjects <T_HR_EMPLOYEE>()
                                    where ent.IDNUMBER == strIDNUMBER
                                    select ent).FirstOrDefault();
                    if (employee == null)
                    {
                        msg    = "薪资项目导入,根据身份证未找到相关员工档案,身份证号码:" + strIDNUMBER;
                        UImsg += msg + System.Environment.NewLine;
                        Tracer.Debug(msg);
                        continue;
                    }
                    else
                    {
                        Tracer.Debug("薪资项目导入,根据身份证找到相关员工档案,身份证号码:" + strIDNUMBER
                                     + " 导入的员工姓名:" + strEmployeeName + " 根据身份证号查到的员工姓名:" + employee.EMPLOYEECNAME
                                     + " 薪资项目名:" + strSalaryItemName + " 薪资项目金额:" + strSalaryItemSUM
                                     + " 导入人id:" + GenerateUser.GenerateUserId + " 名称:" + User.EMPLOYEENAME
                                     + " 导入人主岗位id(结算岗位):" + " 名称:" + GenerateUser.GeneratePostId + User.EMPLOYEEPOSTS[0].PostName
                                     + " 导入人所属公司id(发薪机构):" + GenerateUser.GenerateCompanyId + " 名称:" + User.EMPLOYEEPOSTS[0].CompanyName);
                    }
                    var salaryAchive = bll.GetEmployeeAcitiveSalaryArchive(employee.EMPLOYEEID, GenerateUser.GeneratePostId, GenerateUser.GenerateCompanyId, int.Parse(year), int.Parse(month));

                    T_HR_EMPLOYEESALARYRECORD record = (from r in dal.GetTable()
                                                        where r.EMPLOYEEID == employee.EMPLOYEEID &&
                                                        r.SALARYMONTH == month && r.SALARYYEAR == year &&
                                                        r.OWNERCOMPANYID == owerCompayId
                                                        select r).FirstOrDefault();

                    #region 新建薪资项目
                    if (record == null)
                    {
                        try
                        {
                            Tracer.Debug("导入员工薪资项目,未生成员工月薪,开始生成,员工姓名:" + employee.EMPLOYEECNAME + " " + year + "年" + month + "月"
                                         + "的月薪,record == null" + " 导入的员工姓名:" + strEmployeeName + " 根据身份证号查到的员工姓名:" + employee.EMPLOYEECNAME
                                         + " 薪资项目名:" + strSalaryItemName + " 薪资项目金额:" + strSalaryItemSUM);
                            record = new T_HR_EMPLOYEESALARYRECORD();
                            record.EMPLOYEESALARYRECORDID = Guid.NewGuid().ToString();
                            record.EMPLOYEEID             = employee.EMPLOYEEID;
                            record.CREATEUSERID           = GenerateUser.GenerateUserId;
                            record.CREATEPOSTID           = GenerateUser.GeneratePostId;
                            //  record.CREATEPOSTID = archive.CREATEPOSTID;
                            record.CREATEDEPARTMENTID = GenerateUser.GenerateDepartmentId;
                            record.CREATECOMPANYID    = GenerateUser.GenerateCompanyId;

                            record.OWNERID           = employee.EMPLOYEEID;;
                            record.OWNERPOSTID       = employee.OWNERPOSTID;
                            record.OWNERDEPARTMENTID = employee.OWNERDEPARTMENTID;
                            record.OWNERCOMPANYID    = employee.OWNERCOMPANYID;

                            record.ATTENDANCEUNUSUALTIMES = employee.OWNERCOMPANYID;      //记录薪资人的所属公司
                            record.ATTENDANCEUNUSUALTIME  = employee.OWNERPOSTID;         //记录薪资人的所属岗位
                            record.ABSENTTIMES            = salaryAchive.SALARYARCHIVEID; //记录生成薪资使用的薪资档案

                            record.PAIDTYPE     = bll.GetPaidType(employee.EMPLOYEEID);   //发放方式
                            record.REMARK       = "薪资项目导入生成";
                            record.PAIDTYPE     = bll.GetPaidType(employee.EMPLOYEEID);
                            record.EMPLOYEECODE = salaryAchive.EMPLOYEECODE;
                            record.EMPLOYEENAME = salaryAchive.EMPLOYEENAME;
                            record.PAYCONFIRM   = "0";
                            record.CHECKSTATE   = "0";
                            record.CREATEDATE   = System.DateTime.Now;
                            record.SALARYYEAR   = year;
                            record.SALARYMONTH  = month;
                            record.T_HR_EMPLOYEESALARYRECORDITEM.Clear();
                            int i = dal.Add(record);
                            if (i == 1)
                            {
                                ImportSalaryRecordItem(ref UImsg, ref msg, strIDNUMBER, strEmployeeName, strSalaryItemName, strSalaryItemSUM, employee, record, salaryAchive);
                            }
                            else
                            {
                                msg = "薪资项目导入添加员工薪资记录失败!" + " 身份证号码:" + strIDNUMBER
                                      + " 导入的员工姓名:" + strEmployeeName + " 根据身份证号查到的员工姓名:" + employee.EMPLOYEECNAME
                                      + " 薪资项目名:" + strSalaryItemName + " 薪资项目金额:" + strSalaryItemSUM;
                                UImsg += msg + System.Environment.NewLine;
                                Tracer.Debug(msg);
                            }
                        }
                        catch (Exception ex)
                        {
                            msg = "薪资项目导入添加员工薪资记录失败!" + ex.ToString() + " 身份证号码:" + strIDNUMBER
                                  + " 导入的员工姓名:" + strEmployeeName + " 根据身份证号查到的员工姓名:" + employee.EMPLOYEECNAME
                                  + " 薪资项目名:" + strSalaryItemName + " 薪资项目金额:" + strSalaryItemSUM;
                            UImsg += msg + System.Environment.NewLine;
                            Tracer.Debug(msg);
                        }
                        ;
                    }
                    #endregion
                    #region 更新薪资项目
                    else
                    {
                        var SalaryRecord = (from a in dal.GetObjects <T_HR_EMPLOYEESALARYRECORD>()
                                            join b in dal.GetObjects <T_HR_EMPLOYEESALARYRECORDITEM>() on a.EMPLOYEESALARYRECORDID equals b.T_HR_EMPLOYEESALARYRECORD.EMPLOYEESALARYRECORDID
                                            join c in dal.GetObjects <T_HR_SALARYITEM>() on b.SALARYITEMID equals c.SALARYITEMID
                                            where a.EMPLOYEEID == employee.EMPLOYEEID &&
                                            a.SALARYYEAR == year &&
                                            a.SALARYMONTH == month &&
                                            a.OWNERCOMPANYID == owerCompayId &&
                                            a.CHECKSTATE == "0" &&
                                            c.SALARYITEMNAME == strSalaryItemName
                                            select new
                        {
                            b.SALARYRECORDITEMID,
                            c.SALARYITEMNAME,
                            b.SUM
                        });
                        var item = SalaryRecord.FirstOrDefault();
                        if (item != null)
                        {
                            var q = from ent in dal.GetObjects <T_HR_EMPLOYEESALARYRECORDITEM>()
                                    where ent.SALARYRECORDITEMID == item.SALARYRECORDITEMID
                                    select ent;
                            var entsum = q.FirstOrDefault();
                            if (entsum != null)
                            {
                                entsum.SUM = AES.AESEncrypt(strSalaryItemSUM);
                                int i = dal.Update(entsum);
                                if (i >= 1)
                                {
                                    msg = "薪资项目导入成功,受影响的条数:" + i + " 身份证号码:" + strIDNUMBER
                                          + " 导入的员工姓名:" + strEmployeeName + " 根据身份证号查到的员工姓名:" + employee.EMPLOYEECNAME
                                          + " 薪资项目名:" + strSalaryItemName + " 薪资项目金额:" + strSalaryItemSUM;
                                    UImsg += msg + System.Environment.NewLine;
                                    Tracer.Debug(msg);
                                }
                                else
                                {
                                    msg = "薪资项目导入失败,受影响的条数:" + i + " 身份证号码:" + strIDNUMBER
                                          + " 导入的员工姓名:" + strEmployeeName + " 根据身份证号查到的员工姓名:" + employee.EMPLOYEECNAME
                                          + " 薪资项目名:" + strSalaryItemName + " 薪资项目金额:" + strSalaryItemSUM;
                                    UImsg += msg + System.Environment.NewLine;
                                    Tracer.Debug(msg);
                                    continue;
                                }
                            }
                            else
                            {
                                msg = "薪资项目导入失败,未找到薪资项目," + " 身份证号码:" + strIDNUMBER
                                      + " 导入的员工姓名:" + strEmployeeName + " 根据身份证号查到的员工姓名:" + employee.EMPLOYEECNAME
                                      + " 薪资项目名:" + strSalaryItemName + " 薪资项目金额:" + strSalaryItemSUM;
                                UImsg += msg + System.Environment.NewLine;
                                Tracer.Debug(msg);
                                continue;
                            }
                        }
                        else
                        {
                            ImportSalaryRecordItem(ref UImsg, ref msg, strIDNUMBER, strEmployeeName, strSalaryItemName, strSalaryItemSUM, employee, record, salaryAchive);
                        }
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    UImsg += "导入薪资项目异常:" + ex + System.Environment.NewLine;
                    Utility.SaveLog(ex.ToString());
                    continue;
                }
            }
            TF.Close();
            return(UImsg);
        }
Exemplo n.º 22
0
 public List<T_HR_EMPLOYEESALARYRECORD> GetMenuSignAutoEmployeeSalaryRecordPagings(int pageIndex, int pageSize, string sort, string filterString, string[] paras, ref int pageCount, DateTime starttime, DateTime endtime, int orgtype, string orgid, string strCheckState, string userID, string MenuSign)
 {
     using (EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL())
     {
         List<T_HR_EMPLOYEESALARYRECORD> q = bll.GetAutoEmployeeSalaryRecordPagings(pageIndex, pageSize, sort, filterString, paras, ref pageCount, starttime, endtime, orgtype, orgid, strCheckState, userID, MenuSign).ToList();
         return q.Count() > 0 ? q : null;
     }
 }