EchoTex_Payroll/HRM.UI/Controllers/MobileAPI/Controllers/AttendanceController.cs
2024-10-14 10:01:49 +06:00

685 lines
27 KiB
C#

using HRM.BO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using AutoMapper;
using HRM.DA;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Authorization;
using System.Text;
using Microsoft.AspNetCore.Http;
using HRM.UI.Components;
using HRM.UI.MODELS;
using Microsoft.Extensions.Options;
using HRM.BO.Configuration;
using Ease.Core.DataAccess;
using System.Threading;
namespace HRM.UI.Controllers
{
[ApiController]
[Route("api/Mobile/Attendance")]
[Authorize]
public class AttendanceController : ControllerBase
{
private readonly IEmployeeService _employeeService;
private readonly IDailyAttnProcessService _DailyAttnProcessService;
private readonly IAttnMobileRawDataService _AttnMobileRawDataService;
private readonly ISystemInformationService _systemInformationService;
private readonly IEmpFieldTrackService _empFieldTrackService;
private readonly ILocationService _locationService;
private readonly IShiftService _shiftService;
private readonly IOptions<EmailSettings> _emailSettings;
public AttendanceController(
IEmployeeService employeeService,
IDailyAttnProcessService DailyAttnProcessService,
IAttnMobileRawDataService attnMobileRawDataService,
ISystemInformationService systemInformationService,
IEmpFieldTrackService empFieldTrackService,
IOptions<EmailSettings> emailSettings,
ILocationService locationService,
IShiftService shiftService)
{
this._employeeService = employeeService;
this._DailyAttnProcessService = DailyAttnProcessService;
this._systemInformationService = systemInformationService;
this._empFieldTrackService = empFieldTrackService;
this._locationService = locationService;
this._shiftService = shiftService;
this._emailSettings = emailSettings;
this._AttnMobileRawDataService = attnMobileRawDataService;
}
[HttpGet]
[Route("GetAttnJobs")]
public ActionResult GetAttnJobs(int EmpID)
{
int total = 0;
List<PendingAttendanceJobTModel> oWFModels = new List<PendingAttendanceJobTModel>();
total = _DailyAttnProcessService.GetAttnDataByWFStatusCountForMobile(EmpID, EnumWFAttnStatus.EmpSubmitted);
if (total > 0)
{
oWFModels.Add(new PendingAttendanceJobTModel()
{
Description = string.Format("{0} pending Attendance Regularization", total),
});
}
return Ok(oWFModels);
}
[HttpGet]
[Route("GetDailyAttnData/{id}")]
public ActionResult GetDailyAttnData(int id)
{
try
{
DateTime currentDate = DateTime.Now;
DailyAttnProcessTModel model = new DailyAttnProcessTModel();
DailyAttnProcess todayAttnData = new DailyAttnProcessService().GetAttnDataForMobileWithNoLock(id, currentDate);
if (todayAttnData != null)
{
model = todayAttnData.ConvertToDailyAttnProcessTModelRequest();
}
else
{
model.AttnDate = DateTime.Today;
model.AttenType = EnumAttendanceType.Absent;
model.EmpAttenType = EnumAttendanceType.Present;
}
return Ok(model);
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
}
[HttpGet]
[Route("GetDailyAttnData/{empid}/{attnDate}")]
public ActionResult GetDailyAttnData(int empid, string attnDate)
{
try
{
DateTime currentDate = Convert.ToDateTime(attnDate);
DailyAttnProcessTModel model = null;
DailyAttnProcess todayAttnData = new DailyAttnProcessService().GetAttnDataForMobile(empid, currentDate);
if (todayAttnData != null)
{
model = todayAttnData.ConvertToDailyAttnProcessTModelRequest();
}
return Ok(model);
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
}
[HttpGet]
[Route("GetNotSubmittedData")]
public ActionResult GetNotSubmittedData(int EmpID, int SelectedDateRange)
{
List<DailyAttnProcessTModel> oDailyAttnProcessTModels = new List<DailyAttnProcessTModel>();
DateTime StartDate, EndDate;
if(SelectedDateRange == 1)
{
//Last 15 Days
StartDate = DateTime.Today.AddDays(-16);
EndDate = DateTime.Today.AddDays(-1);
}
else
{
//Last 30 Days
StartDate = DateTime.Today.AddDays(-31);
EndDate = DateTime.Today.AddDays(-1);
}
Employee oemp = new Employee();
oemp.ID = EmpID;
var items = _DailyAttnProcessService.GetRegularizableAttn(EmpID, StartDate, EndDate).ConvertToDailyAttnProcessTModels(oemp);
return Ok(items);
}
[HttpGet]
[Route("GetAttendanceStatement")]
public ActionResult GetAttendanceStatement(int EmpID, DateTime Month)
{
List<DailyAttnProcessTModel> oDailyAttnProcessTModels = new List<DailyAttnProcessTModel>();
DateTime startDate = GlobalFunctions.FirstDateOfMonth(Month);
DateTime endDate = GlobalFunctions.LastDateOfMonth(Month);
Employee oemp = new Employee();
oemp.ID = EmpID;
DataTable empName = new EmployeeService().GetNameAndMailWithNoLock(EmpID);
oemp.Name = empName.Rows[0]["name"].ToString();
oemp.EmployeeNo = empName.Rows[0]["employeeno"].ToString();
//oDailyAttnProcessTModels = _DailyAttnProcessService.GetAttnForStatement(EmpID, startDate, endDate).ConvertToDailyAttnProcessTModels();
var items = new DailyAttnProcessService().GetAttnForStatementWithNoLock(EmpID,startDate, endDate).ConvertToDailyAttnProcessTModels(oemp);
return Ok(items);
}
[HttpGet]
[Route("GetAttendanceStatementByLM")]
public ActionResult GetAttendanceStatementByLM(int EmpID, DateTime Month)
{
List<DailyAttnProcessTModel> oDailyAttnProcessTModels = new List<DailyAttnProcessTModel>();
oDailyAttnProcessTModels = _DailyAttnProcessService.GetByLMIDMobileWithNoLock(EmpID, Month).ConvertToDailyAttnProcessTModels(EmpID);
return Ok(oDailyAttnProcessTModels);
}
[HttpGet]
[Route("GetEmployeesForAttendanceApprove")]
public ActionResult GetEmployeesForAttendanceApprove(int EmpID)
{
List<Employee> _oEmps = _employeeService.GetFirstLMTeamMembers(EmpID);
DataSet dset = new DataSet();
if (_oEmps.Count > 0)
{
string empIDs = string.Join(",", _oEmps.Select(x => x.ID.ToString()).ToList());
DateTime nextPayProcessDate = _systemInformationService.Get().NextPayProcessDate;
dset = _DailyAttnProcessService.GetAttnSubmittedData(empIDs, nextPayProcessDate, EnumWFAttnStatus.EmpSubmitted, false);
return Ok(dset.Tables[0]);
}
return Ok();
}
[HttpGet]
[Route("GetEmployeeAttendanceDataForApprove")]
public ActionResult GetEmployeeAttendanceDataForApprove(int EmpID)
{
List<DailyAttnProcess> _daPocess = _DailyAttnProcessService.GetAttnDataByWFStatus(EmpID.ToString(), EnumWFAttnStatus.EmpSubmitted);
return Ok(MakeDataTableFromObject.MakeAttnApproveDataTable(_daPocess));
}
[HttpPost]
[Route("SaveRemoteAttendance")]
public ActionResult SaveRemoteAttendance(EmpFieldTrackTModel remoteAttendance)
{
_empFieldTrackService.Save(remoteAttendance.ConvertToTModel());
return Ok();
}
[HttpPost]
[Route("SaveNotSubmittedData")]
public ActionResult SaveNotSubmittedData(DailyAttnProcessTModel oDailyAttnProcessTmodel)
{
Employee oEmp = _employeeService.Get(oDailyAttnProcessTmodel.EmployeeID);
EnumAttendanceType attnType = oDailyAttnProcessTmodel.AttenType;
List<DailyAttnProcess> dailyAttnProcesses = _DailyAttnProcessService.RefreshObject(oEmp, oDailyAttnProcessTmodel.PKID, ((int)attnType).ToString(), oDailyAttnProcessTmodel.Comments,
(DateTime) oDailyAttnProcessTmodel.InTime, (DateTime) oDailyAttnProcessTmodel.OutTime);
_DailyAttnProcessService.Save(dailyAttnProcesses, null);
return Ok();
}
[HttpPost]
[Route("RegularizeRequest")]
public ActionResult RegularizeRequest(DailyAttnProcessTModel oDailyAttnProcessTmodel)
{
DailyAttnProcess item = new DailyAttnProcess();
item.WFStatus = EnumWFAttnStatus.EmpSubmitted;
item.EmpApplyDate = DateTime.Today;
item.ActualInTime = oDailyAttnProcessTmodel.ActualInTime;
item.ActualOutTime = oDailyAttnProcessTmodel.ActualOutTime;
item.EmpRemarks = oDailyAttnProcessTmodel.Comments;
item.AttnDate = oDailyAttnProcessTmodel.AttnDate;
item.EmployeeID = oDailyAttnProcessTmodel.EmployeeID;
new DailyAttnProcessService().RegularizationRequestbyEmp(item);
new DailyAttnProcessService().SendRegularizationApplicationMailinThread(item, _emailSettings.Value);
return Ok(true);
}
[HttpPost]
[Route("SaveLMAttendanceApprove")]
public ActionResult SaveLMAttendanceApprove(DailyAttnProcessTModel dailyAttnProcess)
{
if (dailyAttnProcess == null)
{
return StatusCode(StatusCodes.Status500InternalServerError, "No Data Found to save");
}
DailyAttnProcess item = new DailyAttnProcess();
item.AttnDate = dailyAttnProcess.AttnDate;
if((dailyAttnProcess.ShiftID != null && dailyAttnProcess.ShiftID == 0))
{
item.ShiftID = null;
} else item.ShiftID = dailyAttnProcess.ShiftID;
item.InTime = dailyAttnProcess.InTime;
if (item.InTime != null && ((DateTime)item.InTime).Hour == 0) item.InTime = null;
item.OutTime = dailyAttnProcess.OutTime;
if (item.OutTime != null && ((DateTime)item.OutTime).Hour == 0) item.OutTime = null;
item.ActualInTime = dailyAttnProcess.ActualInTime;
if (item.ActualInTime != null && ((DateTime)item.ActualInTime).Hour == 0) item.ActualInTime = null;
item.ActualOutTime = dailyAttnProcess.ActualOutTime;
if (item.ActualOutTime != null && ((DateTime)item.ActualOutTime).Hour == 0) item.ActualOutTime = null;
item.Reason = dailyAttnProcess.Reason;
item.LMRemarks = dailyAttnProcess.LMComments;
item.LineManagerID = dailyAttnProcess.LineManagerID;
item.EmployeeID = dailyAttnProcess.EmployeeID;
item.WFStatus = EnumWFAttnStatus.LMApproved;
item.AttenType = dailyAttnProcess.AttenType;
item.ID = dailyAttnProcess.ID;
item.IsManualEntry = true;
if (item.OutTime != null)
{
item.OutTime = new DateTime(item.AttnDate.Year, item.AttnDate.Month, item.AttnDate.Day,
((DateTime)item.OutTime).Hour, ((DateTime)item.OutTime).Minute, 0);
}
if (item.InTime != null && item.OutTime != null)
{
if (((DateTime)item.OutTime).Hour < ((DateTime)item.InTime).Hour)
{
DateTime tempDate = (DateTime)item.AttnDate.AddDays(1);
item.OutTime = new DateTime(tempDate.Year, tempDate.Month, tempDate.Day,
((DateTime)item.OutTime).Hour, ((DateTime)item.OutTime).Minute, 0);
}
}
if (item.ShiftID != null)
{
Shift oshift = new ShiftService().Get((int)item.ShiftID);
if (oshift != null)
{
new AttendanceProcess().CalculateLateAndDelay(item, oshift);
new AttendanceProcess().CalculateOverTime(item, oshift);
}
}
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
item.LMApproveDate = DateTime.Today;
try
{
new DailyAttnProcessService().ApproveAttnByLM(item);
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
try
{
// send mail to Applier
new DailyAttnProcessService().SendRegularizationApprovalMail(item, _emailSettings.Value);
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, "Successfully Regularized. But could not send mail.");
}
return Ok();
}
[HttpPost]
[Route("RejectLMAttendanceApprove")]
public ActionResult RejectLMAttendanceApprove(DailyAttnProcessTModel dailyAttnProcess)
{
List<DailyAttnProcess> _daPocessForSave = new List<DailyAttnProcess>();
DailyAttnProcess item = new DailyAttnProcess();
item.AttnDate = dailyAttnProcess.AttnDate;
item.ShiftID = dailyAttnProcess.ShiftID;
item.InTime = dailyAttnProcess.InTime;
item.OutTime = dailyAttnProcess.OutTime;
item.ActualInTime = dailyAttnProcess.ActualInTime;
item.ActualOutTime = dailyAttnProcess.ActualOutTime;
item.Reason = dailyAttnProcess.Reason;
item.LMRemarks = dailyAttnProcess.LMComments;
item.LineManagerID = dailyAttnProcess.LineManagerID;
item.EmployeeID = dailyAttnProcess.EmployeeID;
item.WFStatus = EnumWFAttnStatus.Reject;
item.ID = dailyAttnProcess.ID;
item.IsManualEntry = true;
_DailyAttnProcessService.RejectAttnStatusByLM(item.EmployeeID, item.AttnDate, (int)item.LineManagerID, item.LMRemarks, item.Reason);
return Ok();
}
//[HttpPost]
//[Route("SaveDailyAttendance")]
//
//public ActionResult SaveDailyAttendance(DailyAttnProcessTModel oDailyAttnProcessTmodel)
//{
// try
// {
// DataSet location = oDailyAttnProcessTmodel.OutTime != DateTime.MinValue
// ? _locationService.GetLocationFromCoord((double)oDailyAttnProcessTmodel.Location.OutTimeLatitude, (double)oDailyAttnProcessTmodel.Location.OutTimeLongitude)
// : _locationService.GetLocationFromCoord((double)oDailyAttnProcessTmodel.Location.InTimeLatitude, (double)oDailyAttnProcessTmodel.Location.InTimeLongitude);
// int LocationID = 0;
// foreach (DataRow dr in location.Tables[0].Rows)
// {
// LocationID = Convert.ToInt32(dr["LOCATIONID"].ToString());
// }
// if (LocationID == 0)
// {
// throw new CustomException(EnumExceptionType.Informational, "Your current location doesn't match with any Attendance Point.");
// }
// else
// {
// oDailyAttnProcessTmodel.LocationID = LocationID;
// }
// if (oDailyAttnProcessTmodel.ID == 0)
// {
// // For In Time
// oDailyAttnProcessTmodel.InTime = DateTime.Now;
// //oDailyAttnProcessTmodel.IsFromMobile = EnumIsFromMobile
// Thread CheckOutFixedPositionThread = new Thread(() => new DailyAttendanceProcess().ProcessAttendanceForSingleEmployeeToday(oDailyAttnProcessTmodel));
// CheckOutFixedPositionThread.Start();
// }
// else
// {
// // For Out Time
// EnumAttendanceType attnType = oDailyAttnProcessTmodel.EmpAttenType;
// List<DailyAttnProcess> _dailyAttnProcesses = null;
// oDailyAttnProcessTmodel.OutTime = DateTime.Now;
// Thread CheckOutFixedPositionThread = new Thread(() =>
// new DailyAttnProcessService().RefreshObjectDailyAttnMobile(oDailyAttnProcessTmodel.EmployeeID, oDailyAttnProcessTmodel.DailyAttnProcessID, attnType,
// oDailyAttnProcessTmodel.Comments, (DateTime) oDailyAttnProcessTmodel.InTime, (DateTime) oDailyAttnProcessTmodel.OutTime, oDailyAttnProcessTmodel.WFStatus,
// oDailyAttnProcessTmodel.Location.ZipcodeInTime, oDailyAttnProcessTmodel.Location.ZipcodeOutTime, oDailyAttnProcessTmodel.Location.InTimeLatitude,
// oDailyAttnProcessTmodel.Location.OutTimeLatitude, oDailyAttnProcessTmodel.Location.InTimeLongitude, oDailyAttnProcessTmodel.Location.OutTimeLongitude,
// oDailyAttnProcessTmodel.Location.InTimeNearestAddress, oDailyAttnProcessTmodel.Location.OutTimeNearestAddress, oDailyAttnProcessTmodel.LocationID,
// oDailyAttnProcessTmodel.IsFromMobile)
// );
// CheckOutFixedPositionThread.Start();
// //_DailyAttnProcessService.Save(_dailyAttnProcesses, null);
// }
// }
// catch (Exception ex)
// {
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
// }
// return Ok();
//}
[HttpPost]
[Route("CheckOutFixedPosition")]
public ActionResult CheckOutFixedPosition(DailyAttnProcessTModel oDailyAttnProcessTmodel)
{
try
{
DataSet location = _locationService.GetLocationFromCoord((double)oDailyAttnProcessTmodel.Location.OutTimeLatitude,
(double)oDailyAttnProcessTmodel.Location.OutTimeLongitude);
int LocationID = 0;
foreach (DataRow dr in location.Tables[0].Rows)
{
LocationID = Convert.ToInt32(dr["LOCATIONID"].ToString());
}
if (LocationID == 0)
{
throw new CustomException(EnumExceptionType.Informational, "Your current location doesn't match with any Attendance Point.");
}
else
{
oDailyAttnProcessTmodel.LocationID = LocationID;
}
oDailyAttnProcessTmodel.OutTime = DateTime.Now;
Thread CheckOutFixedPositionThread = new Thread(() => new DailyAttendanceProcess().CheckOutFixedPosition(oDailyAttnProcessTmodel.EmployeeID,
oDailyAttnProcessTmodel.AttnDate, oDailyAttnProcessTmodel.Comments,
oDailyAttnProcessTmodel.Location.OutTimeLatitude, oDailyAttnProcessTmodel.Location.OutTimeLongitude,
oDailyAttnProcessTmodel.LocationID, oDailyAttnProcessTmodel.IsFromMobile, oDailyAttnProcessTmodel.OutTimeNearestAddress));
CheckOutFixedPositionThread.Start();
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
return Ok();
}
[HttpPost]
[Route("CheckInFixedPosition")]
public ActionResult CheckInFixedPosition(DailyAttnProcessTModel oDailyAttnProcessTmodel)
{
try
{
DataSet location = _locationService.GetLocationFromCoord((double)oDailyAttnProcessTmodel.Location.InTimeLatitude,
(double)oDailyAttnProcessTmodel.Location.InTimeLongitude);
int LocationID = 0;
foreach (DataRow dr in location.Tables[0].Rows)
{
LocationID = Convert.ToInt32(dr["LOCATIONID"].ToString());
}
if (LocationID == 0)
{
throw new CustomException(EnumExceptionType.Informational, "Your current location doesn't match with any Attendance Point.");
}
else
{
oDailyAttnProcessTmodel.LocationID = LocationID;
}
// For In Time
oDailyAttnProcessTmodel.InTime = DateTime.Now;
Thread CheckInFixedPositionThread = new Thread(() => new DailyAttendanceProcess().ProcessAttendanceForSingleEmployeeToday(oDailyAttnProcessTmodel, (int)CurrentUser.GetCurrentUser(HttpContext.User).PayrollTypeID));
CheckInFixedPositionThread.Start();
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
return Ok();
}
[HttpPost]
[Route("CheckOutNearbyPosition")]
public ActionResult CheckOutNearbyPosition(DailyAttnProcessTModel oDailyAttnProcessTmodel)
{
try
{
oDailyAttnProcessTmodel.OutTime = DateTime.Now;
Thread CheckInFixedPositionThread = new Thread(() => new DailyAttendanceProcess().CheckOutFixedPosition(oDailyAttnProcessTmodel.EmployeeID,
oDailyAttnProcessTmodel.AttnDate, oDailyAttnProcessTmodel.Comments,
oDailyAttnProcessTmodel.Location.OutTimeLatitude, oDailyAttnProcessTmodel.Location.OutTimeLongitude,
oDailyAttnProcessTmodel.LocationID, oDailyAttnProcessTmodel.IsFromMobile, oDailyAttnProcessTmodel.OutTimeNearestAddress));
CheckInFixedPositionThread.Start();
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
return Ok();
}
[HttpPost]
[Route("CheckInNearbyPosition")]
public ActionResult CheckInNearbyPosition(DailyAttnProcessTModel oDailyAttnProcessTmodel)
{
try
{
oDailyAttnProcessTmodel.InTime = DateTime.Now;
Thread CheckInFixedPositionThread = new Thread(() => new DailyAttendanceProcess().ProcessAttendanceForSingleEmployeeToday(oDailyAttnProcessTmodel, (int)CurrentUser.GetCurrentUser(HttpContext.User).PayrollTypeID));
CheckInFixedPositionThread.Start();
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
return Ok();
}
[HttpGet]
[Route("GetDefinedAttendanceDateRange")]
public ActionResult GetDefinedAttendanceDateRange()
{
DateTime startDate, endDate;
AttendanceProcess.GetAttendanceDateRange(out startDate, out endDate);
var dateRangeTModel = new DateRangeTModel
{
FromDate = startDate,
ToDate = endDate
};
return Ok(dateRangeTModel);
}
[HttpGet]
[Route("GetNotSubmittedDataForLM")]
public ActionResult GetNotSubmittedDataForLM(int EmpID, DateTime FromDate, DateTime ToDate)
{
DataTable lmtable = new DailyAttnProcessService().getMyTeamNotApprovedListMobileWithNoLock(EmpID);
var oDailyAttnProcessTModels = ExtentionMethods.ConvertToDailyAttnProcessTModelsForLM(lmtable);
//AttendanceProcess.GetNotSubmittedAttnDataForLM(empIDs, FromDate, ToDate).ConvertToDailyAttnProcessTModelsForLM();
return Ok(oDailyAttnProcessTModels);
}
[HttpGet]
[Route("ValidateLocation")]
public ActionResult ValidateLocation(double Lat, double Long)
{
DataSet location = _locationService.GetLocationFromCoord(Lat, Long);
int LocationID = 0;
foreach (DataRow dr in location.Tables[0].Rows)
{
LocationID = Convert.ToInt32(dr["LOCATIONID"].ToString());
}
return Ok(LocationID);
}
[HttpGet]
[Route("ShowTimeCard")]
//[Authorize]
public ActionResult ShowTimeCard(int EmployeeID, DateTime Month)
{
FileTModel oFTModel = new FileTModel();
Employee oEmp = _employeeService.Get(EmployeeID);
byte[] bytesForPdf = GenerateDataByteForAttnReport(oEmp, Month);
if (bytesForPdf == null)
{
throw new CustomException(EnumExceptionType.Informational, "No Attendance Statement data found for this month");
}
//File.WriteAllBytes(HostingEnvironment.MapPath(string.Format("~/images/Payslip{0}-{1}.pdf",oEmp.EmployeeNo,Month.ToString("MMM-yyyy"))),bytes);
oFTModel = new FileTModel()
{
FileName = string.Format("AttendanceStatement-{0}-{1}.pdf", oEmp.EmployeeNo, Month.ToString("MMM-yyyy")),
Type = EnumFileType.PDF,
FileInBytes = bytesForPdf
};
return Ok(oFTModel);
}
private byte[] GenerateDataByteForAttnReport(Employee oEmp, DateTime Month)
{
//FileTModel oFTModel = new FileTModel();
//DataTable AttnReport = new rptDataSet.EmpDailyAttnDataTable();
//AttendanceReportModel attnReport = new AttendanceReportModel();
//DateTime fromDate = GlobalFunctions.FirstDateOfMonth(Month);
//DateTime toDate = GlobalFunctions.LastDateOfMonth(Month);
//AttnReport = attnReport.GetEmpDailyAttn(oEmp.ID, fromDate, toDate);
//string totalOT = "";// GlobalFunctions.GetHourMinutes(oTHours);
//string totalLateHour = "";//GlobalFunctions.GetHourMinutes(latehours);
//List<ReportParameter> parameters = new List<ReportParameter>();
//parameters = attnReport.GetParameters(oEmp, fromDate, toDate, totalOT, totalLateHour);
//DataSet _dSet = new DataSet();
//DataSet dsSubReport = new DataSet();
//AttnReport.TableName = "EmpDailyAttn";
//_dSet.Tables.Add(AttnReport);
//return RDLCGenerator.GetBytes("Reports\\EmpDailyAttn.rdlc", _dSet, parameters);
return new byte[0];
}
// SHIFT
[HttpGet]
[Route("getShifts")]
public ActionResult GetShifts(int EmpID, EnumStatus Status)
{
string code = null;
string name = null;
//CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
Employee oEmployee = new EmployeeService().Get(EmpID);
List<Shift> items = new List<Shift>();
try
{
items = _shiftService.Get(code, name, Status, oEmployee.PayrollTypeID);
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(items);
}
}
}