Merge branch 'develop' of github.com:Frappet/hrms-api-backend into develop
Some checks failed
release-dev / release-dev (push) Failing after 12s
Some checks failed
release-dev / release-dev (push) Failing after 12s
This commit is contained in:
commit
1f3632744d
6 changed files with 70 additions and 57 deletions
|
|
@ -81,4 +81,10 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Reports/TimeStampRecords.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using BMA.EHR.Domain.Shared;
|
|||
using BMA.EHR.Leave.Service.DTOs.Reports;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing.Template;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OfficeOpenXml;
|
||||
|
|
@ -2157,12 +2158,15 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var org = _userProfileRepository.GetOc(Guid.Parse(req.nodeId), req.node, AccessToken);
|
||||
var organizationName = $"{(!string.IsNullOrEmpty(org.Child4) ? org.Child4 + "/" : "")}{(!string.IsNullOrEmpty(org.Child3) ? org.Child3 + "/" : "")}{(!string.IsNullOrEmpty(org.Child2) ? org.Child2 + "/" : "")}{(!string.IsNullOrEmpty(org.Child1) ? org.Child1 + "/" : "")}{org.Root ?? ""}";
|
||||
var dateTimeStamp = $"ประจำ ณ วัน{req.StartDate.Date.GetThaiDayOfWeek()} ที่ {req.StartDate.Date.ToThaiShortDate()}{enddate}";
|
||||
//var template = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", "TimeStampRecords.xlsx");
|
||||
//FileInfo reportFile = new FileInfo(template);
|
||||
using (var package = new ExcelPackage())
|
||||
|
||||
var templatePath = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", "TimeStampRecords.xlsx");
|
||||
byte[] templateBytes = System.IO.File.ReadAllBytes(templatePath);
|
||||
//using (var package = new ExcelPackage(fileInfo))
|
||||
using (var stream = new MemoryStream(templateBytes))
|
||||
using (var package = new ExcelPackage(stream))
|
||||
{
|
||||
//var worksheet = package.Workbook.Worksheets[0];
|
||||
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
|
||||
//var worksheet = package.Workbook.Worksheets.Add("Sheet1");
|
||||
var worksheet = package.Workbook.Worksheets["Sheet1"] ?? package.Workbook.Worksheets[0];
|
||||
|
||||
worksheet.Cells["A1:J1"].Merge = true;
|
||||
worksheet.Cells["A2:J2"].Merge = true;
|
||||
|
|
@ -2174,7 +2178,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
|
||||
range.Style.Font.Bold = true;
|
||||
}
|
||||
worksheet.Cells[1, 1].Value = "แบบการลงเวลาปฏิบัติราชการ";
|
||||
//worksheet.Cells[1, 1].Value = "แบบการลงเวลาปฏิบัติราชการ";
|
||||
worksheet.Cells[2, 1].Value = organizationName;
|
||||
worksheet.Cells[3, 1].Value = dateTimeStamp;
|
||||
|
||||
|
|
@ -2188,16 +2192,16 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
|
||||
range.Style.Font.Bold = true;
|
||||
}
|
||||
worksheet.Cells[4, 1].Value = "ลำดับที่";
|
||||
worksheet.Cells[4, 2].Value = "ชื่อ - สกุล";
|
||||
worksheet.Cells[4, 3].Value = "รอบ";
|
||||
worksheet.Cells[4, 4].Value = "วันที่เข้างาน";
|
||||
worksheet.Cells[4, 5].Value = "พิกัด";
|
||||
worksheet.Cells[4, 6].Value = "เวลามา";
|
||||
worksheet.Cells[4, 7].Value = "วันที่ออกงาน";
|
||||
worksheet.Cells[4, 8].Value = "พิกัด";
|
||||
worksheet.Cells[4, 9].Value = "เวลากลับ";
|
||||
worksheet.Cells[4, 10].Value = "หมายเหตุ";
|
||||
//worksheet.Cells[4, 1].Value = "ลำดับที่";
|
||||
//worksheet.Cells[4, 2].Value = "ชื่อ - สกุล";
|
||||
//worksheet.Cells[4, 3].Value = "รอบ";
|
||||
//worksheet.Cells[4, 4].Value = "วันที่เข้างาน";
|
||||
//worksheet.Cells[4, 5].Value = "พิกัด";
|
||||
//worksheet.Cells[4, 6].Value = "เวลามา";
|
||||
//worksheet.Cells[4, 7].Value = "วันที่ออกงาน";
|
||||
//worksheet.Cells[4, 8].Value = "พิกัด";
|
||||
//worksheet.Cells[4, 9].Value = "เวลากลับ";
|
||||
//worksheet.Cells[4, 10].Value = "หมายเหตุ";
|
||||
int startRow = 5;
|
||||
foreach (var emp in employees)
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2118,18 +2118,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
{
|
||||
var retirePeriodOfficer = await _context.RetirementPeriods
|
||||
.Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||
.Where(x => x.Year == year && x.Type.Trim().ToUpper().Contains(type))
|
||||
.Where(x => x.Year == year && (x.Type ?? "").Trim().ToUpper().Contains(type) && x.Round == 1)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (retirePeriodOfficer == null)
|
||||
return Error("ไม่พบรอบประกาศเกษียณอายุราชการ");
|
||||
|
||||
var data = retirePeriodOfficer.RetirementRawProfiles
|
||||
.Select(x => new
|
||||
{
|
||||
profileId = x.profileId
|
||||
})
|
||||
.ToList();
|
||||
var data = new
|
||||
{
|
||||
signDate = retirePeriodOfficer.SignDate ?? null,
|
||||
profiles = retirePeriodOfficer.RetirementRawProfiles
|
||||
.Select(x => new { profileId = x.profileId })
|
||||
.ToList()
|
||||
};
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3047,6 +3047,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
commandCode = r.commandCode,
|
||||
commandName = r.commandName,
|
||||
remark = r.remark,
|
||||
resignId = p.RetirementResign.Id,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -3077,23 +3078,23 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
data.ForEach(profile => profile.RetirementResign.Status = "CANCEL");
|
||||
await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
resignId = resultData.Select(x => x.resignId).ToList(),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
data.ForEach(profile => profile.RetirementResign.Status = "CANCEL");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2542,6 +2542,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
commandCode = r.commandCode,
|
||||
commandName = r.commandName,
|
||||
remark = r.remark,
|
||||
resignId = p.RetirementResignEmployee.Id
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -2573,23 +2574,23 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
// var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-employee-leave";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
// {
|
||||
// data = resultData,
|
||||
// });
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
// if (_res.IsSuccessStatusCode)
|
||||
// {
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL");
|
||||
await _context.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
resignId = resultData.Select(x => x.resignId).ToList(),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue