public static List <PayChangedItem> GetChangedItems(int year, int month, string payGroup)
        {
            List <PayChangedItem> list = new List <PayChangedItem>();

            DateTime currMonth = new DateTime(year, month, 1);
            DateTime prevMonth = currMonth.AddMonths(-1);

            List <PrivateSalary> prevList = PrivateSalary.GetPrivateSalarys(prevMonth.Year, prevMonth.Month, null, payGroup);
            List <PrivateSalary> currList = PrivateSalary.GetPrivateSalarys(year, month, null, payGroup);

            foreach (PrivateSalary currSalary in currList)
            {
                PrivateSalary prevSal = prevList.Find(a => a.员工编号 == currSalary.员工编号);
                if (prevSal == null || prevSal.本次发放工资 != currSalary.本次发放工资)
                {
                    //2018-3-23 如果薪资组变动,需另外获取
                    if (prevSal == null)
                    {
                        prevSal = PrivateSalary.GetPrivateSalary(currSalary.员工编号, prevMonth.Year, prevMonth.Month);
                    }
                    //如果工资相同,不显示
                    if (prevSal != null && prevSal.本次发放工资 == currSalary.本次发放工资)
                    {
                        continue;
                    }

                    PayChangedItem item = new PayChangedItem(prevSal, currSalary)
                    {
                        薪资组 = currSalary.薪资组
                    };
                    list.Add(item);
                }
            }
            return(list);
        }
        public static PrivateSalary AddPrivateSalary(string empNo, int year, int month, string payGroup, string calRunId)
        {
            PrivateSalary result = GetPrivateSalary(empNo, year, month);

            if (result == null)
            {
                result = new PrivateSalary();

                result.标识   = Guid.NewGuid();
                result.员工编号 = empNo;
                result.年度   = year;
                result.月份   = month;
                if (payGroup != null)
                {
                    result.薪资组 = payGroup.Trim();
                }
                result.日历组 = calRunId.Trim();

                result.创建时间 = DateTime.Now;

                result.Save();
            }

            return(result);
        }
        public static List <SalaryAdjustItem> GetAdjustItems(int year, int month, string payGroup)
        {
            List <SalaryAdjustItem> list = new List <SalaryAdjustItem>();

            DateTime currMonth = new DateTime(year, month, 1);
            DateTime prevMonth = currMonth.AddMonths(-1);

            //获取应调整人员名单
            List <EmployeeInfo>  empList  = GetEmployeeListToAdjust(year, month, payGroup);
            List <PrivateSalary> currList = PrivateSalary.GetPrivateSalarys(year, month, null, payGroup);

            foreach (EmployeeInfo emp in empList)
            {
                PrivateSalary    currSalary = currList.Find(a => a.员工编号 == emp.员工编号);
                SalaryAdjustItem item       = new SalaryAdjustItem(emp, currSalary);
                //工资调整幅度超过 2% 才认为有调整
                if (currSalary != null && currSalary.工资调整幅度 > (decimal)0.02)
                {
                    item.薪资组   = currSalary.薪资组;
                    item.已调整工资 = true;
                }
                list.Add(item);
            }

            return(list);
        }
예제 #4
0
        private PrivateSalary GetPrivateSalary(string emplid, DateTime date)
        {
            PrivateSalary salary = PrivateSalary.GetPrivateSalary(emplid, date.Year, date.Month);

            if (salary != null)
            {
                PrivateSalaryCache.Set(emplid, salary, TimeSpan.FromHours(4));
            }
            return(salary);
        }
 public SalaryAdjustItem(EmployeeInfo emp, PrivateSalary salary)
 {
     empInfo = emp;
     if (salary != null)
     {
         DateTime currMonth = new DateTime(salary.年度, salary.月份, 1);
         DateTime prevMonth = currMonth.AddMonths(-1);
         prevMonthSalary = PrivateSalary.GetPrivateSalary(salary.员工编号, prevMonth.Year, prevMonth.Month);
         currMonthSalary = salary;
     }
 }
예제 #6
0
        public EmployeeSalary(SalaryResult sr, PrivateSalary ps)
        {
            表工资  = sr;
            封闭工资 = ps;

            //处理,获取相关数据
            this.员工编号 = sr.员工编号;
            this.姓名   = sr.姓名;
            this.职务   = PsHelper.GetValue(PsHelper.职务代码, 表工资.职务代码);
            this.年度   = sr.年度.ToString() + " 年";
            this.月份   = sr.月份.ToString() + " 月";
            this.季度   = (Convert.ToInt32(sr.月份 / 3) + 1).ToString() + " 季度";
            //this.金额 = 封闭工资 == null ? 上表工资.上表工资 : 封闭工资.职级工资;
            this.金额 = 封闭工资 == null ?  表工资.表工资总额 : 封闭工资.工资发放总额;
            this.职等 = sr.职等;

            this.发放单位 = sr.财务公司;
            DeptInfo dept = DeptInfo.Get(sr.机构编号);

            if (dept != null)
            {
                this.本部 = dept.本部;
                this.体系 = dept.体系;

                this.公司 = dept.公司.部门名称;
                if (dept.部门 != null)
                {
                    this.部门 = dept.部门.部门名称;
                }
                if (dept.区域 != null)
                {
                    this.区域 = dept.区域.部门名称;
                }
                if (dept.省办 != null)
                {
                    this.省办 = dept.省办.部门名称.Replace("省办", "");
                }
                if (dept.城市 != null)
                {
                    this.城市 = dept.城市.部门名称.Replace("市办", "");
                }
            }
            else
            {
                CompanyInfo company = CompanyInfo.Get(sr.公司编号);
                if (company != null)
                {
                    this.公司 = company.公司简称;
                }
            }
        }
예제 #7
0
        public static List <SalaryChangedItem> GetChangedItems(int year, int month, string payGroup)
        {
            List <SalaryChangedItem> list = new List <SalaryChangedItem>();

            DateTime currMonth = new DateTime(year, month, 1);
            DateTime prevMonth = currMonth.AddMonths(-1);

            List <PrivateSalary> prevList = PrivateSalary.GetPrivateSalarys(prevMonth.Year, prevMonth.Month, null, payGroup);
            List <PrivateSalary> currList = PrivateSalary.GetPrivateSalarys(year, month, null, payGroup);

            foreach (PrivateSalary currSalary in currList)
            {
                PrivateSalary prevSal = prevList.Find(a => a.员工编号 == currSalary.员工编号);
                if (prevSal == null || prevSal.总工资 != currSalary.总工资)
                {
                    string type = prevSal == null ? "新增人员" : "工资变动";
                    //2018-3-23 如果薪资组变动,需另外获取
                    if (prevSal == null)
                    {
                        prevSal = PrivateSalary.GetPrivateSalary(currSalary.员工编号, prevMonth.Year, prevMonth.Month);
                    }
                    SalaryChangedItem item = new SalaryChangedItem(prevSal, currSalary)
                    {
                        变动类型 = type, 薪资组 = currSalary.薪资组
                    };
                    list.Add(item);
                }
            }
            //找出减少的
            foreach (PrivateSalary prevSalary in prevList)
            {
                if (currList.Find(a => a.员工编号 == prevSalary.员工编号) == null)
                {
                    SalaryChangedItem item = new SalaryChangedItem(prevSalary, null)
                    {
                        变动类型 = "减少人员", 薪资组 = prevSalary.薪资组
                    };
                    list.Add(item);
                }
            }

            return(list);
        }
예제 #8
0
        public PersonalTax(SalaryResult salary)
        {
            表工资  = salary;
            封闭工资 = PrivateSalary.GetPrivateSalary(salary.员工编号, salary.年度, salary.月份);

            CalRunInfo cal = CalRunInfo.Get(salary.日历组);

            年     = cal.年度;
            月     = cal.月份;
            期间_开始 = cal.开始日期;
            期间_结束 = cal.结束日期;
            期间    = String.Format("{0}年{1}", 年, 月) + "月";
            发放单位  = salary.财务公司;

            员工编号        = salary.员工编号;
            姓名          = salary.姓名;
            身份证号        = salary.身份证号;
            养老保险个人缴纳金额  = salary.养老保险个人缴纳;
            医疗保险个人缴纳金额  = salary.基本医疗个人缴纳 + salary.大病医疗个人缴纳金额;
            失业保险个人缴纳金额  = salary.失业保险个人缴纳;
            住房公积金个人缴纳金额 = salary.住房公积金个人缴纳;

            应税工资额  = 表工资.应税工资额;
            个人所得税  = 封闭工资 == null ?  表工资.个人所得税金额 : 封闭工资.个人所得税;
            工资发放总额 = 表工资.表工资总额 + 表工资.未休年休假工资;
            //如果有封闭工资
            if (封闭工资 != null)
            {
                应税工资额  = 封闭工资.总应税工资;
                工资发放总额 = 封闭工资.工资发放总额;
            }
            个税起征点 = PsHelper.GetPersonTaxPoint(期间_开始);


            decimal taxIncome = 应税工资额 - 个税起征点;

            if (taxIncome > 0)
            {
                TaxInfo tax = TaxInfo.Get(taxIncome);
                税率    = tax.税率;
                速算扣除数 = tax.速算扣除数;
            }
        }
예제 #9
0
        public static List <EmployeeSalary> GetEmployeeSalarys(DateTime start, DateTime end, string companyCode)
        {
            List <EmployeeSalary> list = new List <EmployeeSalary>();

            DateTime currMonth = start;

            while (currMonth <= end)
            {
                //取出当前月份的工资明细
                List <SalaryResult> srList = SalaryResult.GetSalaryResults(currMonth.Year, currMonth.Month, companyCode);
                //遍历
                foreach (SalaryResult sr in srList)
                {
                    PrivateSalary  ps = PrivateSalary.GetPrivateSalary(sr.员工编号, sr.年度, sr.月份);
                    EmployeeSalary es = new EmployeeSalary(sr, ps);
                    list.Add(es);
                }

                currMonth = currMonth.AddMonths(1);
            }
            return(list);
        }
예제 #10
0
 public SalaryChangedItem(PrivateSalary prevMonth, PrivateSalary currMonth)
 {
     prevMonthSalary = prevMonth;
     currMonthSalary = currMonth;
 }
예제 #11
0
        public EmployeeSalaryData(EmployeeInfo employee, DateTime date)
        {
            PrivateSalary salary = PrivateSalaryCache.Get(employee.员工编号, () => GetPrivateSalary(employee.员工编号, date), TimeSpan.FromHours(1));

            InitData(salary);
        }
예제 #12
0
        private void InitData(PrivateSalary salary)
        {
            this.employeeInfo  = salary.员工信息;
            this.privateSalary = salary;
            this.publicSalary  = salary.基础工资表;

            期间   = salary.年度 + "年" + salary.月份 + "月";
            公司序号 = employeeInfo.公司序号;
            职务   = employeeInfo.职务名称;
            职级名称 = LvDescrCache.Get(employeeInfo.职务等级, () => GetLvDescr(employeeInfo.职务等级), TimeSpan.FromHours(18));
            工龄   = employeeInfo.工龄 / (decimal)12.0;
            年龄   = employeeInfo.年龄;
            学历   = employeeInfo.学历;
            籍贯   = employeeInfo.籍贯;
            华劲工龄 = employeeInfo.华劲工龄;
            任职时间 = employeeInfo.任职时间;
            月薪类型 = salary.月薪类型;
            岗位级别 = salary.管培生级别;
            是管培生 = employeeInfo.是管培生;
            是主管  = employeeInfo.职务名称 != null &&
                   (employeeInfo.职务名称.IndexOf("部门主管") != -1 || employeeInfo.职务名称.IndexOf("厂长") != -1 || employeeInfo.职务名称.IndexOf("场长") != -1);

            LevelInfo level = LevelInfoCache.Get(employeeInfo.职务等级, () => GetLevelInfo(employeeInfo.职务等级), TimeSpan.FromHours(18));

            if (level != null)
            {
                职等 = level.级别;
            }


            满勤奖_显示  = "—";
            年休假_显示  = "—";
            津贴补助_显示 = "—";

            公司编码 = publicSalary.公司编号;
            部门编码 = publicSalary.部门编号;
            职务等级 = publicSalary.职务等级;
            工资职等 = publicSalary.工资职等;

            if (privateSalary != null)
            {
                表工资标准 = this.publicSalary.表工资 + this.publicSalary.工资降级;
                年休假工资 = this.publicSalary.未休年休假工资;
                满勤奖金额 = this.publicSalary.应得满勤奖;
                if (privateSalary.年度 < 2018)
                {
                    职务工资 = this.privateSalary.职级工资 - 满勤奖金额;
                    职级工资 = 职务工资 + 满勤奖金额 + 年休假工资;
                }
                else
                {
                    职务工资 = this.privateSalary.职务工资;
                    职级工资 = this.privateSalary.职级工资;
                }
                总工资  = this.privateSalary.总工资;
                薪等   = this.privateSalary.薪等;
                薪级   = this.privateSalary.薪级;
                职等名称 = this.privateSalary.评定职等;
                执行职级 = this.privateSalary.执行职级;

                SalaryResult sr = publicSalary;
                公司编码 = sr == null ? employeeInfo.公司 : sr.公司编号;
                职务等级 = sr == null ? employeeInfo.职务等级 : sr.职务等级;
                工资职级 = this.privateSalary.薪等名称 + this.privateSalary.薪级名称;
                薪等名称 = this.privateSalary.薪等名称;
                薪级名称 = this.privateSalary.薪级名称;
            }

            职级 = LvDescrCache.Get(职务等级, () => GetLvDescr(职务等级), TimeSpan.FromHours(18));

            月薪_显示   = 月薪.ToString("#0.##");
            年薪_显示   = 年薪.ToString("#0.##");
            职务工资_显示 = 职务工资.ToString("#0.##");
            满勤奖_显示  = 满勤奖金额 > 0 ? 满勤奖金额.ToString("#0.##") : "—";
            年休假_显示  = 年休假工资 > 0 ? 年休假工资.ToString("#0.##") : "—";
        }
예제 #13
0
 public EmployeeSalaryData(PrivateSalary salary)
 {
     InitData(salary);
 }
예제 #14
0
        /// <summary>
        /// 通过 Id 获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static PrivateSalary GetPrivateSalary(Guid id)
        {
            PrivateSalary obj = (PrivateSalary)MyHelper.XpoSession.GetObjectByKey(typeof(PrivateSalary), id);

            return(obj);
        }