fix เพิ่มเติมรายงานแสดงวันลงเวลา

This commit is contained in:
Suphonchai Phoonsawat 2024-01-22 13:00:45 +07:00
parent 34da86653f
commit 47c1f7dac0
2 changed files with 49 additions and 12 deletions

View file

@ -1,3 +1,5 @@
using System.Data.Common;
using System.Globalization;
using System.IO.Pipelines;
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.Commands;
@ -27,6 +29,8 @@ namespace BMA.EHR.Leave.Service.Controllers
public class LeaveReportController : BaseController
{
#region " Fields "
private static CultureInfo _culture = new CultureInfo("th-TH");
private readonly LeaveRequestRepository _leaveRequestRepository;
private readonly UserProfileRepository _userProfileRepository;
private readonly CommandRepository _commandRepository;
@ -1178,22 +1182,40 @@ namespace BMA.EHR.Leave.Service.Controllers
{
if (timeStamps == null)
{
remarkStr = "ขาดราชการ";
if (dd <= DateTime.Now.Date)
remarkStr = "ขาดราชการ";
else remarkStr = "";
}
else
{
// check status ของการลงเวลา
if (timeStamps.CheckOutStatus == "ABSENT")
remarkStr = "ขาดราชการ";
else if (timeStamps.CheckInStatus == "ABSENT")
remarkStr = "ขาดราชการ";
else if (timeStamps.CheckInStatus == "LATE")
if (timeStamps.CheckOut != null)
{
remarkStr = "สาย";
lateTotal += 1;
if (timeStamps.CheckOutStatus == "ABSENT")
remarkStr = "ขาดราชการ";
else if (timeStamps.CheckInStatus == "ABSENT")
remarkStr = "ขาดราชการ";
else if (timeStamps.CheckInStatus == "LATE")
{
remarkStr = "สาย";
lateTotal += 1;
}
else
remarkStr = "";
}
else
remarkStr = "";
{
if (timeStamps.CheckInStatus == "ABSENT")
remarkStr = "ขาดราชการ";
else if (timeStamps.CheckInStatus == "LATE")
{
remarkStr = "สาย";
lateTotal += 1;
}
else
remarkStr = "";
}
}
}
@ -1214,8 +1236,8 @@ namespace BMA.EHR.Leave.Service.Controllers
//remark = timeStamps == null ? "ขาดราชการ" : "",
remark = remarkStr,
checkInDate = timeStamps == null ? "" : timeStamps.CheckIn.Date.ToThaiFullDate2().ToThaiNumber(),
checkedOutDate = timeStamps == null ? "" :
checkInDate = timeStamps == null ? dd.Date.ToThaiFullDate2().ToThaiNumber() : timeStamps.CheckIn.Date.ToThaiFullDate2().ToThaiNumber(),
checkedOutDate = timeStamps == null ? dd.Date.ToThaiFullDate2().ToThaiNumber() :
timeStamps.CheckOut != null ?
timeStamps.CheckOut.Value.ToThaiFullDate2().ToThaiNumber() :
"",
@ -1255,9 +1277,23 @@ namespace BMA.EHR.Leave.Service.Controllers
}
var dateStamp = "";
switch (req.Type.ToUpper())
{
case "MONTH":
{
var dd = req.StartDate.Date;
dateStamp = $"เดือน {dd.ToString("MMMM", _culture.DateTimeFormat)} พ.ศ. {dd.Year.ToThaiYear()}".ToThaiNumber();
break;
}
default:
dateStamp = req.StartDate.Date.ToThaiFullDate().ToThaiNumber();
break;
}
var item = new
{
DateTimeStamp = date.Date.ToThaiFullDate(),
DateTimeStamp = dateStamp,
officerTotal = profile.Count,
workTotal = (count - 1),
restTotal = restTotal,

View file

@ -6,5 +6,6 @@ namespace BMA.EHR.Leave.Service.DTOs.Reports
public DateTime EndDate { get; set; } = DateTime.MinValue;
public string Type { get; set; } = string.Empty;
}
}