Beispiel #1
0
        public List <EmployeeAttendanceBLL> GetAllEmployeesByRole(Guid WarehouseId, Guid RoleId)
        {
            List <EmployeeAttendanceBLL> list = new List <EmployeeAttendanceBLL>();

            list = EmployeeAttendanceDAL.GetAllEmployees(WarehouseId, RoleId);
            return(list);
        }
        public List <EmployeeMonthlyAttendanceSummaryReportModel> GetReport(DateTime DateFrom, DateTime DateTo, int EmployeeID)
        {
            using (dbVisionEntities db = new dbVisionEntities())
            {
                EmployeeAttendanceDAL EmployeeAttendanceDALObj = new EmployeeAttendanceDAL();
                var resAtt = EmployeeAttendanceDALObj.GetEmployeeAttendanceData(new DateTime(DateFrom.Year, DateFrom.Month, 1), (new DateTime(DateTo.Year, DateTo.Month + 1, 1)).AddDays(-1), EmployeeID);

                return((from r in resAtt
                        group r by new { Month = r.Day.Month, Year = r.Day.Year } into gr
                        select new EmployeeMonthlyAttendanceSummaryReportModel()
                {
                    Month = gr.Key.Month,
                    Year = gr.Key.Year,

                    Present = gr.Sum(r => r.PresentCount),
                    Absent = gr.Sum(r => r.AbsentCount),
                    Weekend = gr.Sum(r => r.WeekendCount),
                    WeekendWorked = gr.Sum(r => r.WeekendWorkedCount),
                    Leave = gr.Sum(r => r.LeaveCount),
                    Holiday = gr.Sum(r => r.HolidayCount),
                    HolidayWorked = gr.Sum(r => r.HolidayWorkedCount),
                    Safari = gr.Sum(r => r.SafariCount),
                    TotalDays = gr.Sum(r => 1),
                    EarlyGoing = gr.Sum(r => r.EarlyGoing ? 1 : 0),
                    LateIn = gr.Sum(r => r.LateIn ? 1 : 0),
                    MissedPunch = gr.Sum(r => r.MissedPunch ? 1 : 0),
                }).ToList());
            }
        }
Beispiel #3
0
        public bool InsertEmployeeAttendance()
        {
            bool isSaved = false;

            try
            {
                isSaved = EmployeeAttendanceDAL.Insert(this);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isSaved);
        }
Beispiel #4
0
        public List <EmployeeAttendancePerformanceReportModel> GetReport(DateTime DateFrom, DateTime DateTo, int EmployeeID)
        {
            using (dbVisionEntities db = new dbVisionEntities())
            {
                EmployeeAttendanceDAL EmployeeAttendanceDALObj = new EmployeeAttendanceDAL();
                var resAtt = EmployeeAttendanceDALObj.GetEmployeeAttendanceData(DateFrom, DateTo, EmployeeID);

                return((from r in resAtt
                        orderby r.Day
                        select new EmployeeAttendancePerformanceReportModel()
                {
                    Day = r.Day,
                    Absent = (r.Absent == Model.Payroll.eEmployeeAttendanceDayType.FullDay ? "Full Day" : (r.Absent == Model.Payroll.eEmployeeAttendanceDayType.HalfDay ? "Half Day" : null)),
                    LateIn = (r.LateIn ? r.InTime : null),
                    EarlyGoing = (r.EarlyGoing ? r.OutTime : null),
                    MissedPunch = (r.MissedPunch ? "Yes" : null),
                }).ToList());
            }
        }
Beispiel #5
0
        public List <EmployeeAttendanceSummaryReportModel> GetReportData(DateTime DateFrom, DateTime DateTo, int?DepartmentID, int?DesignationID, int?LocationID, int?EmployementTypeID)
        {
            DateFrom = DateFrom.Date;
            DateTo   = DateTo.Date.Add(new TimeSpan(23, 59, 59));

            using (dbVisionEntities db = new dbVisionEntities())
            {
                byte     AttendanceType_IntegratedID = (byte)Model.Employee.eTAAttendanceType.Integrated;
                byte     RecordStatus_Deleted        = (byte)eRecordState.Deleted;
                DateTime TodaysDate = DateTime.Now.Date;

                DAL.Payroll.EmployeeAttendanceDAL EmployeeAttendanceDALObj = new EmployeeAttendanceDAL();
                var EmployeeAttendanceDayDetails = EmployeeAttendanceDALObj.GetEmployeeAttendanceData(DateFrom, DateTo, DepartmentID, DesignationID, LocationID, EmployementTypeID);

                var res = (from e in db.tblEmployees
                           join jsd in db.tblEmployeeServiceDetails on e.EmployeeLastServiceDetailID equals jsd.EmployeeServiceDetailID into gsd
                           from sd in gsd.DefaultIfEmpty()
                           join jloc in db.tblLocations on sd.LocationID equals jloc.LocationID into gloc
                           from loc in gloc.DefaultIfEmpty()
                           join jep in db.tblEmployeeNoPrefixes on e.EmployeeNoPrefixID equals jep.EmployeeNoPrefixID into gep
                           from ep in gep.DefaultIfEmpty()

                           where e.CompanyID == Model.CommonProperties.LoginInfo.LoggedInCompany.CompanyID &&
                           e.TAAttendanceType == AttendanceType_IntegratedID &&
                           e.rstate != RecordStatus_Deleted &&

                           (sd != null &&
                            ((Model.Employee.eEmployementStatus)sd.EmployeementStatus) == Model.Employee.eEmployementStatus.Active &&
                            (((Model.Employee.eEmploymentType)sd.EmploymentType) != Model.Employee.eEmploymentType.Contract ||
                             (sd.ContractExpiryDate == null || sd.ContractExpiryDate >= TodaysDate))) &&

                           (DepartmentID == null || (sd != null && sd.EmployeeDepartmentID == DepartmentID.Value)) &&
                           (DesignationID == null || (sd != null && sd.EmployeeDesignationID == DesignationID.Value)) &&
                           (LocationID == null || (sd != null && sd.LocationID == LocationID)) &&
                           (EmployementTypeID == null ||
                            (sd != null &&
                             (sd.EmploymentType == EmployementTypeID ||
                              (EmployementTypeID == 3 && (sd.EmploymentType == 1 || sd.EmploymentType == 2)))))
                           orderby e.EmployeeNo
                           select new EmployeeAttendanceSummaryReportModel()
                {
                    EmployeeID = e.EmployeeID,
                    EmployeeNoPrefix = ep.EmployeeNoPrefixName,
                    EmployeeNo = e.EmployeeNo,
                    EmployeeName = e.EmployeeFirstName + " " + e.EmployeeLastName,
                }).ToList();

                foreach (var r in res)
                {
                    var filteredRecords = EmployeeAttendanceDayDetails.Where(rr => rr.EmployeeID == r.EmployeeID);

                    r.Present        = filteredRecords.Sum(sr => sr.PresentCount);
                    r.Weekends       = filteredRecords.Sum(sr => sr.WeekendCount);
                    r.WeekendsWorked = filteredRecords.Sum(sr => sr.WeekendWorkedCount);
                    r.RestDay        = filteredRecords.Sum(sr => sr.RestDayCount);
                    r.RestDayWorked  = filteredRecords.Sum(sr => sr.RestDayWorkedCount);
                    r.Holidays       = filteredRecords.Sum(sr => sr.HolidayCount);
                    r.HolidaysWorked = filteredRecords.Sum(sr => sr.HolidayWorkedCount);
                    r.Leave          = filteredRecords.Sum(sr => sr.LeaveCount);
                    r.Safari         = filteredRecords.Sum(sr => sr.SafariCount);
                    r.Absent         = filteredRecords.Sum(sr => sr.AbsentCount);
                }

                return(res);
            }
        }
Beispiel #6
0
 public EmployeeAttendanceBLL GetEmployee(Guid Id)
 {
     return(EmployeeAttendanceDAL.GetEmployeeById(Id));
 }
Beispiel #7
0
        void GetPaySlipData(int EmployeeID)
        {
            ClearPayrollValues();
            //--
            EmployeeSaveModel = EmployeeDALObj.FindSaveModelByPrimeKey(EmployeeID);
            if (EmployeeSaveModel == null)
            {
                return;
            }

            ServiceSaveModel = EmployeeSaveModel.tblEmployeeServiceDetail;
            if (ServiceSaveModel == null)
            {
                return;
            }

            BasicIncome        = ServiceSaveModel.BasicSalary;
            txtIncomeType.Text = (EmployeeSaveModel.IncomeType ? "Primary" : "Secondry") + " Income";
            HRA = ServiceSaveModel.HousingAllowance;

            NormalOvertimeRatio = CommonProperties.LoginInfo.SoftwareSettings.OvertimeRate;
            DoubleOvertimeRatio = CommonProperties.LoginInfo.SoftwareSettings.DoubleOvertimeRate;

            decimal GrossPay             = BasicIncome + HRA;
            decimal WorkingHoursPerMonth = ((CommonProperties.LoginInfo.SoftwareSettings.WorkingHoursPerWeek * 52) / 12);

            BasicPayRatePerHour = Math.Round(BasicIncome / WorkingHoursPerMonth, 2);
            BasicPayRatePerDay  = Math.Round((BasicIncome / WorkingHoursPerMonth) * CommonProperties.LoginInfo.SoftwareSettings.WorkingHoursPerDay, 2);

            GrossPayRatePerHour = Math.Round(GrossPay / WorkingHoursPerMonth, 2);
            GrossPayRatePerDay  = Math.Round((GrossPay / WorkingHoursPerMonth) * CommonProperties.LoginInfo.SoftwareSettings.WorkingHoursPerDay, 2);

            LatenessRatePerDay = Model.CommonProperties.LoginInfo.SoftwareSettings.LatenessPenaltyAmount;

            EditingEmployeeDetail = DALObj.FindPayrollEmployeeDetail(DateFrom.Month, DateFrom.Year, EmployeeSaveModel.EmployeeID);
            if (EditingEmployeeDetail != null)
            {
                #region Fill saved data in form
                NormalOvertimeHours = EditingEmployeeDetail.NormalOvertimeHours;
                DoubleOvertimeHours = EditingEmployeeDetail.DoubleOvertimeHours;
                AbsentDays          = EditingEmployeeDetail.AbsentDays;

                AbsentDays += EditingEmployeeDetail.MissedPunchDays;

                WeekendWorkedDays   = EditingEmployeeDetail.WeekendWorkedDays;
                LeaveEncashmentDays = EditingEmployeeDetail.LeaveEncashmentDays;
                NoticePayDay        = EditingEmployeeDetail.NoticePayDays;

                LatenessDays       = EditingEmployeeDetail.LateDays;
                LoanInstallmentAmt = EditingEmployeeDetail.LoanInstallmentAmount;
                lookUpVehicle_NonCashBenefit.EditValue = EditingEmployeeDetail.Vehicle_NoncashBenefitID;

                foreach (var r in EditingEmployeeDetail.tblPayrollEmployeeEarningsDeductions)
                {
                    var ViewModel = dsEarningAndDeduction.FirstOrDefault(rr => rr.EarningAndDeductionID == r.EarningsDeductionID && r.Value != 0);
                    if (ViewModel != null)
                    {
                        ViewModel.Value = r.Value;
                    }
                }
                gvEarnings.RefreshData();
                gvDeductions.RefreshData();

                foreach (var r in EditingEmployeeDetail.tblPayrollEmployeeNonCashBenefits)
                {
                    var ViewModel = dsNonCashBenefit.FirstOrDefault(rr => rr.NonCashBenefitID == r.NonCashBenefitID);
                    if (ViewModel != null)
                    {
                        ViewModel.Selected           = true;
                        ViewModel.CostValue          = r.CostValue;
                        ViewModel.KRAValuePercentage = r.KRAPerc;
                        ViewModel.KRAValue           = r.KRAValue;
                        ViewModel.Recurrning         = r.Recurring;
                    }
                }
                gvNonCashBenefit.RefreshData();

                foreach (var r in EditingEmployeeDetail.tblPayrollEmployePAYEReliefs)
                {
                    var ViewModel = dsPAYERelief.FirstOrDefault(rr => rr.PAYEReliefID == r.PAYEReliefID && r.PAYEReliefAmt != 0);
                    if (ViewModel != null)
                    {
                        ViewModel.Selected      = true;
                        ViewModel.PAYEReliefAmt = r.PAYEReliefAmt;
                    }
                }
                #endregion
            }
            else if (((eTAAttendanceType)EmployeeSaveModel.TAAttendanceType) == eTAAttendanceType.Integrated)
            {
                #region Processing Attendance Data
                Model.Employee.eTAAttendanceType AttendanceType = ((Model.Employee.eTAAttendanceType)EmployeeSaveModel.TAAttendanceType);

                if (AttendanceType == eTAAttendanceType.Integrated)
                {
                    EmployeeAttendanceDAL AttendanceDALObj = new EmployeeAttendanceDAL();
                    var dsAttendance = AttendanceDALObj.GetEmployeeAttendanceData(DateFrom, DateTo, EmployeeSaveModel.EmployeeID);

                    #region Earnings
                    NormalOvertimeHours = Math.Round(dsAttendance.Sum(r => r.NormalOvertimeHour), 2);

                    if (((Model.Employee.eTAWeekEndAttendance)EmployeeSaveModel.TAWeekEndAttendance) == Model.Employee.eTAWeekEndAttendance.Overtime)
                    {
                        DoubleOvertimeHours = Math.Round(dsAttendance.Sum(r => r.DoubleOvertimeHour), 2);
                    }

                    if (((Model.Employee.eTAWeekEndAttendance)EmployeeSaveModel.TAWeekEndAttendance) == Model.Employee.eTAWeekEndAttendance.Allowance)
                    {
                        // Round off not required, if weekend worked then whole day will be counted as worked.
                        WeekendWorkedDays = dsAttendance.Count(r =>
                                                               ((r.Weekend == eEmployeeWeekendDayType.WeekendWorked && r.WeekendWorkedApproved) ||
                                                                (r.RestDay == eEmployeeRestDayDayType.RestDayWorked || r.RestDayWorkedApproved)) && (((eTAMissPunch)EmployeeSaveModel.TAMissPunch) == eTAMissPunch.Present || !r.MissedPunch));
                    }

                    LeaveEncashmentDays = DALObj.CountLeaveEncashmentDays(EmployeeSaveModel.EmployeeID, DateFrom, DateTo);
                    #endregion

                    #region Deductions
                    AbsentDays = dsAttendance.Sum(r => r.AbsentCount);

                    if (((eTAMissPunch)EmployeeSaveModel.TAMissPunch) == eTAMissPunch.Abscent)
                    {
                        AbsentDays += dsAttendance.Count(r => r.MissedPunch);
                    }

                    if (((Model.Employee.eTALatenessCharges)EmployeeSaveModel.TALatenessCharges) == Model.Employee.eTALatenessCharges.Applicable)
                    {
                        LatenessDays = dsAttendance.Count(r => r.LateIn && !r.LatenessApproved);
                    }

                    LoanInstallmentAmt = DALObj.GetLoanInstallmentAmt(EmployeeSaveModel.EmployeeID, DateFrom, DateTo);
                    #endregion
                }
                #endregion
            }
            CalculatePAYE();
            CalculatePayslipTab();
        }
Beispiel #8
0
        public List <AttendancePerformanceReportModel> GetReport(DateTime DateFrom, DateTime DateTo, int?DepartmentID, int?DesignationID, int?LocationID, int?EmployementTypeID)
        {
            using (dbVisionEntities db = new dbVisionEntities())
            {
                EmployeeAttendanceDAL EmployeeAttendanceDALObj = new EmployeeAttendanceDAL();
                var resAtt = EmployeeAttendanceDALObj.GetEmployeeAttendanceData(DateFrom, DateTo, DepartmentID, DesignationID, LocationID, EmployementTypeID);

                var resSumm = (from r in resAtt
                               group r by r.EmployeeID into gr
                               select new AttendancePerformanceReportModel()
                {
                    EmployeeID = gr.Key,
                    Absent = gr.Count(grr => grr.Absent != Model.Payroll.eEmployeeAttendanceDayType.None),
                    LateIn = gr.Count(grr => grr.LateIn),
                    EarlyGoing = gr.Count(grr => grr.EarlyGoing),
                    MissedPunch = gr.Count(grr => grr.MissedPunch),
                }).ToList();

                byte     RecordStatus_Deleted        = (byte)eRecordState.Deleted;
                byte     AttendanceType_IntegratedID = (byte)Model.Employee.eTAAttendanceType.Integrated;
                DateTime TodaysDate = DateTime.Now.Date;

                var resEmployee = (from e in db.tblEmployees
                                   join jsd in db.tblEmployeeServiceDetails on e.EmployeeLastServiceDetailID equals jsd.EmployeeServiceDetailID into gsd
                                   from sd in gsd.DefaultIfEmpty()
                                   join jloc in db.tblLocations on sd.LocationID equals jloc.LocationID into gloc
                                   from loc in gloc.DefaultIfEmpty()
                                   join jep in db.tblEmployeeNoPrefixes on e.EmployeeNoPrefixID equals jep.EmployeeNoPrefixID into gep
                                   from ep in gep.DefaultIfEmpty()

                                   where e.CompanyID == Model.CommonProperties.LoginInfo.LoggedInCompany.CompanyID &&
                                   e.TAAttendanceType == AttendanceType_IntegratedID &&
                                   e.rstate != RecordStatus_Deleted &&

                                   (sd != null &&
                                    ((Model.Employee.eEmployementStatus)sd.EmployeementStatus) == Model.Employee.eEmployementStatus.Active &&
                                    (((Model.Employee.eEmploymentType)sd.EmploymentType) != Model.Employee.eEmploymentType.Contract ||
                                     (sd.ContractExpiryDate == null || sd.ContractExpiryDate >= TodaysDate))) &&

                                   (DepartmentID == null || (sd != null && sd.EmployeeDepartmentID == DepartmentID.Value)) &&
                                   (DesignationID == null || (sd != null && sd.EmployeeDesignationID == DesignationID.Value)) &&
                                   (LocationID == null || (sd != null && sd.LocationID == LocationID)) &&
                                   (EmployementTypeID == null ||
                                    (sd != null &&
                                     (sd.EmploymentType == EmployementTypeID ||
                                      (EmployementTypeID == 3 && (sd.EmploymentType == 1 || sd.EmploymentType == 2)))))
                                   orderby e.EmployeeNo
                                   select new EmployeeAttendanceSummaryReportModel()
                {
                    EmployeeID = e.EmployeeID,
                    EmployeeNoPrefix = ep.EmployeeNoPrefixName,
                    EmployeeNo = e.EmployeeNo,
                    EmployeeName = e.EmployeeFirstName + " " + e.EmployeeLastName,
                }).ToList();

                var DistinctEmployeeIDs = (from r in resSumm
                                           group r by r.EmployeeID into gr
                                           select gr.Key);

                foreach (var EmployeeID in DistinctEmployeeIDs)
                {
                    var Employee = resEmployee.FirstOrDefault(r => r.EmployeeID == EmployeeID);
                    if (Employee == null)
                    {
                        continue;
                    }

                    foreach (var rat in resSumm.Where(r => r.EmployeeID == EmployeeID))
                    {
                        rat.EmployeeName     = Employee.EmployeeName;
                        rat.EmployeeNo       = Employee.EmployeeNo;
                        rat.EmployeeNoPrefix = Employee.EmployeeNoPrefix;
                    }
                }

                return(resSumm.OrderBy(r => r.EmployeeNo).ToList());
            }
        }