예제 #1
0
        public double GetLimit(PrCalculationStore store, string _ltcd)
        {
            lvlealmtDal limitDal   = new lvlealmtDal();
            double      monthLimit = limitDal.GetMonthlmbyEmp(store.CurrentEmployment, _ltcd, HRMS_Limit_Type.LeaveHours);

            if (monthLimit == null)
            {
                monthLimit = 1000;
            }
            if ((monthLimit == -1) || (monthLimit < 0))
            {
                monthLimit = 10000;
            }

            return(monthLimit);
        }
예제 #2
0
파일: lvanalevBll.cs 프로젝트: zxlnet/hrms
        public LvSettingInfo GetEmpLeaveSettings(string _emno, string _ltcd, DateTime _leavedate)
        {
            LvSettingInfo settingInfo  = new LvSettingInfo();
            double        leaveBalance = 0;

            settingInfo.emp = GetSelectedObject <vw_employment>(new List <ColumnInfo>()
            {
                new ColumnInfo()
                {
                    ColumnName = "emno", ColumnValue = _emno
                }
            });

            //根据员工个人设定
            lvdfbyempDal empDal = new lvdfbyempDal();

            settingInfo.dfbyEmployment = empDal.getLeaveSettingsByEmp(_emno, _ltcd, DateTime.Now);
            leaveBalance = settingInfo.dfbyEmployment;
            if (settingInfo.dfbyEmployment > 0)
            {
                settingInfo.SummaryText.Add("By Employment: " + settingInfo.dfbyEmployment.ToString());
            }

            //根据服务年数设定
            lvdfbyyearsDal yearDal = new lvdfbyyearsDal();

            settingInfo.dfbyYear = yearDal.getLeaveSettingsByYear(_ltcd, Convert.ToDouble(DateTime.Now.Year));
            leaveBalance        += settingInfo.dfbyYear;
            if (settingInfo.dfbyYear > 0)
            {
                settingInfo.SummaryText.Add("By Year: " + settingInfo.dfbyYear.ToString());
            }

            //根据其他设定
            lvdfbyotDal      otherDay          = new lvdfbyotDal();
            List <tlvdfbyod> lstSettingByOther = otherDay.getLeaveSettingsByOther(settingInfo.emp, _ltcd);

            var q1 = (from p in lstSettingByOther
                      where p.tlvdfbyot.dfva == settingInfo.emp.GetType().GetProperty(p.tlvdfbyot.tstdefcfg.finm).GetValue(settingInfo.emp, null).ToString().Trim()
                      where p.fryr <= settingInfo.emp.yearservice &&
                      p.toyr >= (settingInfo.emp.yearservice - 1)
                      select p).ToList();

            for (int i = 0; i < q1.Count; i++)
            {
                settingInfo.dfbyOthers += lstSettingByOther[i].days;
                leaveBalance           += lstSettingByOther[i].days;
                if (lstSettingByOther[i].days > 0)
                {
                    settingInfo.SummaryText.Add("By " + lstSettingByOther[i].tlvdfbyot.dftx + ": " + lstSettingByOther[i].days.ToString());
                }
            }

            //取得上年结转
            lvcryfwdDal carryDal = new lvcryfwdDal();

            settingInfo.DaysCarry = carryDal.getCarryDaysByEmp(settingInfo.emp, _ltcd, Convert.ToDouble(DateTime.Now.Year));
            leaveBalance         += settingInfo.DaysCarry;
            if (settingInfo.DaysCarry > 0)
            {
                settingInfo.SummaryText.Add("From Carryforward: " + settingInfo.DaysCarry.ToString());
            }

            //取得最大限制
            lvlealmtDal limitDal = new lvlealmtDal();

            settingInfo.WeekLimit  = limitDal.GetWeeklmbyEmp(settingInfo.emp, _ltcd, HRMS_Limit_Type.LeaveHours);
            settingInfo.MonthLimit = limitDal.GetMonthlmbyEmp(settingInfo.emp, _ltcd, HRMS_Limit_Type.LeaveHours);
            settingInfo.YearLimit  = limitDal.GetYearlmbyEmp(settingInfo.emp, _ltcd, HRMS_Limit_Type.LeaveHours);

            if (settingInfo.WeekLimit != -1)
            {
                settingInfo.SummaryText.Add("Limit in Week: " + settingInfo.WeekLimit.ToString());
            }
            if (settingInfo.MonthLimit != -1)
            {
                settingInfo.SummaryText.Add("Limit in Month: " + settingInfo.MonthLimit.ToString());
            }
            if (settingInfo.YearLimit != -1)
            {
                settingInfo.SummaryText.Add("Limit in Year: " + settingInfo.YearLimit.ToString());
            }


            //取得已经休假天数
            lvleaappDal appDal = new lvleaappDal();

            settingInfo.WeekConsume  = appDal.getWeekConsumedByEmp(settingInfo.emp, _ltcd, _leavedate);
            settingInfo.MonthConsume = appDal.getMonthConsumedByEmp(settingInfo.emp, _ltcd, _leavedate);
            settingInfo.YearConsume  = appDal.getYearConsumedByEmp(settingInfo.emp, _ltcd, _leavedate);

            if (settingInfo.WeekLimit != -1)
            {
                settingInfo.SummaryText.Add("Consume in Week: " + (Math.Round(settingInfo.WeekConsume, 2)).ToString());
            }
            if (settingInfo.MonthLimit != -1)
            {
                settingInfo.SummaryText.Add("Consume in Month: " + (Math.Round(settingInfo.MonthConsume, 2)).ToString());
            }
            if (settingInfo.YearLimit != -1)
            {
                settingInfo.SummaryText.Add("Consume in Year: " + (Math.Round(settingInfo.YearConsume, 2)).ToString());
            }


            if (settingInfo.WeekLimit != -1)
            {
                settingInfo.WeekBalance = Math.Round(settingInfo.WeekLimit - settingInfo.WeekConsume, 2);
                settingInfo.SummaryText.Add("Balance in Week: " + settingInfo.WeekBalance.ToString());
            }
            if (settingInfo.MonthLimit != -1)
            {
                settingInfo.MonthBalance = Math.Round(settingInfo.MonthLimit - settingInfo.MonthConsume, 2);
                settingInfo.SummaryText.Add("Balance in Month: " + settingInfo.MonthBalance.ToString());
            }
            if (settingInfo.YearLimit != -1)
            {
                settingInfo.YearBalance = Math.Round(settingInfo.YearLimit - settingInfo.YearConsume, 2);
                settingInfo.SummaryText.Add("Balance in Year: " + settingInfo.YearBalance.ToString());
            }

            return(settingInfo);
        }