Added the Date in get project report object API

This commit is contained in:
ashutosh.nehete 2025-11-03 12:28:50 +05:30
parent c6744f0556
commit a12e74ad00
2 changed files with 12 additions and 4 deletions

View File

@ -133,13 +133,13 @@ namespace Marco.Pms.Services.Controllers
}
[HttpGet("get/project/report/{projectId}")]
public async Task<IActionResult> GetProjectReport(Guid projectId)
public async Task<IActionResult> GetProjectReport(Guid projectId, [FromQuery] DateTime? date)
{
using var scope = _serviceScopeFactory.CreateScope();
var _reportHelper = scope.ServiceProvider.GetRequiredService<ReportHelper>();
var _logger = scope.ServiceProvider.GetRequiredService<ILoggingService>();
var resonse = await _reportHelper.GetDailyProjectReportWithOutTenant(projectId);
var resonse = await _reportHelper.GetDailyProjectReportWithOutTenant(projectId, date);
if (resonse == null)
{

View File

@ -25,10 +25,18 @@ namespace Marco.Pms.Services.Helpers
_cache = cache;
}
public async Task<ProjectStatisticReport?> GetDailyProjectReportWithOutTenant(Guid projectId)
public async Task<ProjectStatisticReport?> GetDailyProjectReportWithOutTenant(Guid projectId, DateTime? date = null)
{
// await _cache.GetBuildingAndFloorByWorkAreaId();
DateTime reportDate = DateTime.UtcNow.AddDays(-1).Date;
DateTime reportDate;
if (date.HasValue)
{
reportDate = date.Value;
}
else
{
reportDate = DateTime.UtcNow.AddDays(-1).Date;
}
var project = await _cache.GetProjectDetailsWithBuildings(projectId);
if (project == null)
{