281 lines
12 KiB
C#
281 lines
12 KiB
C#
//using Ease.Core.Model;
|
|
//using System;
|
|
//using System.Collections.Generic;
|
|
//using System.Data;
|
|
//using System.IO;
|
|
//using System.Linq;
|
|
//using System.Net;
|
|
//using System.Net.Http;
|
|
//using HRM.BO;
|
|
|
|
//namespace HRM.UI.MODELS
|
|
//{
|
|
// public class AttendanceReportModel
|
|
// {
|
|
// public DataTable GetEmpDailyAttn(int EmpID, DateTime dFromDate, DateTime dToDate)
|
|
// {
|
|
// List<EmployeeUnAuthorizeLeave> _unAuthorizedLeaves = EmployeeUnAuthorizeLeave.GetByEmployeeID(EmpID);
|
|
// _unAuthorizedLeaves = _unAuthorizedLeaves.Where(o => o.IsLateAttendanceRelated == false).ToList();
|
|
// EmployeeUnAuthorizeLeave unAuthorizedLeave = null;
|
|
// EmployeeUnAuthorizeLeave unAuthorizedLeaveHalfDay = null;
|
|
// string workingHour = string.Empty;
|
|
// List<Leave> oLeaves = Leave.Get(EnumStatus.Active);
|
|
// DateTime fromSalaryMonth = DateTime.MinValue;
|
|
// DateTime toSalaryMonth = DateTime.MinValue;
|
|
// fromSalaryMonth = AttnMonthlyBenefit.GetAttandaceSalaryMonth(dFromDate);
|
|
// toSalaryMonth = AttnMonthlyBenefit.GetAttandaceSalaryMonth(dToDate);
|
|
// List<DailyAttnProcess> dAttnProcessess = new List<DailyAttnProcess>();
|
|
// dAttnProcessess = DailyAttnProcess.Get(EmpID, dFromDate, dToDate);
|
|
// DataTable dTable = new rptDataSet.EmpDailyAttnDataTable();
|
|
|
|
// List<Shift> oShifts = Shift.Get();
|
|
// if (!(dAttnProcessess == null || dAttnProcessess.Count <= 0))
|
|
// {
|
|
// foreach (DailyAttnProcess dAttnProcess in dAttnProcessess)
|
|
// {
|
|
// DataRow Rowbody = dTable.NewRow();
|
|
// Rowbody["Date"] = dAttnProcess.AttnDate.ToString("dd MMM yyyy");
|
|
// Rowbody["Day"] = dAttnProcess.AttnDate.ToString("dddd");
|
|
|
|
// if (dAttnProcess.ActualInTime == DateTime.MinValue)
|
|
// {
|
|
// if (dAttnProcess.InTime == DateTime.MinValue)
|
|
// {
|
|
// Rowbody["InTime"] = "00:00";
|
|
// }
|
|
// else Rowbody["InTime"] = dAttnProcess.InTime.ToString("HH:mm"); ;
|
|
// }
|
|
// else
|
|
// {
|
|
// Rowbody["InTime"] = dAttnProcess.ActualInTime.ToString("HH:mm");
|
|
// }
|
|
// if (dAttnProcess.ActualOutTime == DateTime.MinValue)
|
|
// {
|
|
// if (dAttnProcess.OutTime == DateTime.MinValue)
|
|
// {
|
|
// Rowbody["OutTime"] = "00:00";
|
|
// }
|
|
// else Rowbody["OutTime"] = dAttnProcess.OutTime.ToString("HH:mm");
|
|
// }
|
|
// else
|
|
// {
|
|
// Rowbody["OutTime"] = dAttnProcess.ActualOutTime.ToString("HH:mm");
|
|
// }
|
|
// if (dAttnProcess.InTime == DateTime.MinValue)
|
|
// {
|
|
// Rowbody["CinTime"] = "00:00";
|
|
// }
|
|
// else
|
|
// {
|
|
// Rowbody["CinTime"] = dAttnProcess.InTime.ToString("HH:mm");
|
|
// }
|
|
// if (dAttnProcess.OutTime == DateTime.MinValue)
|
|
// {
|
|
// Rowbody["COutTime"] = "00:00";
|
|
// }
|
|
// else
|
|
// {
|
|
// Rowbody["COutTime"] = dAttnProcess.OutTime.ToString("HH:mm");
|
|
// }
|
|
|
|
// if (dAttnProcess.InTime != null && dAttnProcess.OutTime != null)
|
|
// {
|
|
// workingHour = dAttnProcess.OutTime.Subtract(dAttnProcess.InTime).ToString("hh\\:mm");
|
|
// Rowbody["WorkingHour"] = workingHour;
|
|
// }
|
|
|
|
// string LateBy = dAttnProcess.LateHour.ToString("f");
|
|
// decimal lHour = LateBy == string.Empty ? 0 : Convert.ToDecimal(LateBy);
|
|
// TimeSpan ts = TimeSpan.FromHours((double)lHour);
|
|
// int H = ts.Hours + (ts.Days * 24);
|
|
// int M = ts.Minutes;
|
|
// string latehour = H.ToString() + ":" + M.ToString();
|
|
// Rowbody["LateBy"] = latehour;
|
|
|
|
// string OTHr = dAttnProcess.OTHour.ToString("f");
|
|
// Rowbody["OTHr"] = OTHr;
|
|
// if (dAttnProcess.EarlyHour > 0)
|
|
// {
|
|
// dAttnProcess.AttenType = EnumAttendanceType.Early;
|
|
// }
|
|
// if (dAttnProcess.AttenType == EnumAttendanceType.Leave)
|
|
// {
|
|
// Rowbody["Status"] = GetLeaveType(dAttnProcess.ReferenceID, oLeaves);
|
|
// }
|
|
// else
|
|
// {
|
|
// Rowbody["Status"] = GetShortAttnType(dAttnProcess.AttenType, dAttnProcess.LateAttendanceType);
|
|
// }
|
|
// unAuthorizedLeaveHalfDay = _unAuthorizedLeaves.Where(o => o.LeaveDays == 0.5 && o.FromDate.Date == dAttnProcess.AttnDate && o.ToDate.Date == dAttnProcess.AttnDate).FirstOrDefault();
|
|
// unAuthorizedLeave = _unAuthorizedLeaves.Where(o => dAttnProcess.AttnDate >= o.FromDate && dAttnProcess.AttnDate <= o.ToDate).FirstOrDefault();
|
|
// //oAttNHoliday = attNHolidays.Where(o => dDate.Date >= o.FromDate.Date && dDate.Date <= o.ToDate.Date).FirstOrDefault();
|
|
// Rowbody["Remarks"] = unAuthorizedLeaveHalfDay == null ? dAttnProcess.Comments : "1/2 day";
|
|
// if (unAuthorizedLeave != null)
|
|
// Rowbody["Status"] = "LWP";
|
|
// if (dAttnProcess.ShiftID != null)
|
|
// {
|
|
// Shift oSft = oShifts.Where(o => o.ID.Integer == dAttnProcess.ShiftID.Integer).FirstOrDefault();
|
|
// if (oSft != null)
|
|
// {
|
|
// Rowbody["Shift"] = oSft.ShortName;
|
|
// }
|
|
// else
|
|
// {
|
|
// Rowbody["Shift"] = string.Empty;
|
|
// }
|
|
// }
|
|
// dTable.Rows.Add(Rowbody);
|
|
// }
|
|
// }
|
|
|
|
|
|
// return dTable;
|
|
// }
|
|
|
|
// private string GetLeaveType(ID ReferenceID, List<Leave> _leaves)
|
|
// {
|
|
// string leaveType = "Lv";
|
|
// Leave leave = null;
|
|
// if (ReferenceID != null && ReferenceID.Integer != 0)
|
|
// {
|
|
// leave = new Leave();
|
|
// leave = _leaves.Where(o => o.ID == ReferenceID).FirstOrDefault();
|
|
// if (leave != null)
|
|
// {
|
|
// leaveType = leave.Code;
|
|
// }
|
|
// }
|
|
|
|
// return leaveType;
|
|
// }
|
|
|
|
// private string GetShortAttnType(EnumAttendanceType attnType, EnumLateAttendanceType lateType)
|
|
// {
|
|
// string type = string.Empty;
|
|
// switch (lateType)
|
|
// {
|
|
// case EnumLateAttendanceType.NotApplicable:
|
|
// switch (attnType)
|
|
// {
|
|
// case EnumAttendanceType.Absent:
|
|
// type = "AB";
|
|
// break;
|
|
|
|
// case EnumAttendanceType.Delay:
|
|
// type = "LP";
|
|
// break;
|
|
// case EnumAttendanceType.Tour:
|
|
// type = "Tour";
|
|
// break;
|
|
|
|
// case EnumAttendanceType.Holiday:
|
|
// type = "FH";
|
|
// break;
|
|
|
|
// case EnumAttendanceType.Late:
|
|
// type = "LP";
|
|
// break;
|
|
|
|
// case EnumAttendanceType.Leave:
|
|
// type = "Lv";
|
|
// break;
|
|
|
|
// case EnumAttendanceType.Present:
|
|
// type = "PR";
|
|
// break;
|
|
|
|
|
|
// case EnumAttendanceType.OutSideDuty:
|
|
// type = "OD";
|
|
// break;
|
|
|
|
// case EnumAttendanceType.Early:
|
|
// type = "ED";
|
|
// break;
|
|
|
|
// case EnumAttendanceType.WeeklyHoliday:
|
|
// type = "WD";
|
|
// break;
|
|
// }
|
|
// break;
|
|
// case EnumLateAttendanceType.Nine_0am_to_Nine_14am:
|
|
// type = "LP";
|
|
// break;
|
|
// case EnumLateAttendanceType.Nine_15am_to_Nine_29am:
|
|
// type = "LP";
|
|
// break;
|
|
// case EnumLateAttendanceType.Nine_30am_to_Ten_59am:
|
|
// type = "LP";
|
|
// break;
|
|
// case EnumLateAttendanceType.Eleven_0am_to_One_30pm:
|
|
// type = "LP";
|
|
// break;
|
|
// }
|
|
|
|
// return type;
|
|
// }
|
|
|
|
// public List<ReportParameter> GetParameters(Employee emp, DateTime fromDate, DateTime toDate, string totalOT, string totalLateHour)
|
|
// {
|
|
// List<ReportParameter> parameters = new List<ReportParameter>();
|
|
// ReportParameter _parameter;
|
|
|
|
// _parameter = new ReportParameter("FromDate", fromDate.ToString("dd MMM yyyy"));
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("ToDate", toDate.ToString("dd MMM yyyy"));
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("EmpNo", emp.EmployeeNo);
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("EmpName", emp.Name);
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("EmpDesignation", emp.Designation.Name);
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("EmpJoinDate", emp.JoiningDate.ToString("dd MMM yyyy"));
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("EmpDepartment", emp.Department.Name);
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("EmpSection", "");
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("TotalOT", totalOT);
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("TotalLateHour", totalLateHour);
|
|
// parameters.Add(_parameter);
|
|
|
|
// Payroll.BO.SystemInformation systemInfo = Payroll.BO.SystemInformation.Get();
|
|
// string logoPath1 = HostingEnvironment.MapPath("~/images/logo2.png");
|
|
|
|
// if (File.Exists(logoPath1))
|
|
// {
|
|
// _parameter = new ReportParameter("Logo", logoPath1);
|
|
// parameters.Add(_parameter);
|
|
// }
|
|
|
|
// _parameter = new ReportParameter("CompanyInfo", systemInfo.name.ToString());
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("Address", systemInfo.corporateAddress);
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("Phone", systemInfo.TelephoneNo);
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("Fax", "");
|
|
// parameters.Add(_parameter);
|
|
|
|
// _parameter = new ReportParameter("Email", systemInfo.email);
|
|
// parameters.Add(_parameter);
|
|
|
|
// return parameters;
|
|
// }
|
|
|
|
// }
|
|
//} |