Se Agrego los end point para trabajar con el relog checador.

master
Luis Rendon 3 weeks ago
parent a10e4bb992
commit 9e9c6b53df
  1. 19
      BookPrectaBackend/Contracts/Reportes/IRpRepository.cs
  2. 6
      BookPrectaBackend/Contracts/Reportes/IRptBookPrectacs.cs
  3. 25
      BookPrectaBackend/Controllers/Reportes/ReportesController.cs
  4. 3
      BookPrectaBackend/DTO/ExelServices/Book.cs
  5. 17
      BookPrectaBackend/DTO/Reportes/TotalHoursWorking.cs
  6. 8
      BookPrectaBackend/Models/Reportes/WorkingHours.cs
  7. 16
      BookPrectaBackend/Program.cs
  8. 13
      BookPrectaBackend/Repository/ExelServices/ExelHourWorking/ExelHours.cs
  9. 3
      BookPrectaBackend/Repository/ExelServices/ExelRepository.cs
  10. 36
      BookPrectaBackend/Repository/Reportes/ReportesRepository.cs

@ -0,0 +1,19 @@
using BookPrectaBackend.DTO.Reportes;
using BookPrectaBackend.Models.Reportes;
namespace BookPrectaBackend.Contracts.Reportes
{
public interface IRptRepository
{
public Task<IEnumerable<WorkingHours>> GetWorkingHours(string Inicio, string Fin);
public Task<IEnumerable<RelacionBookPrecta>> GetRelacionesTrafico();
/*public Task<IEnumerable<RelacionBookPrecta>>GetNoRelaciones();*/
public Task<IEnumerable<RelacionBookPrecta>> GetNoRelaciones();
public Task<IEnumerable<TotalHoursWorking>> GetTotalHoursWorkings(string Inicio, string Fin );
}
}

@ -5,11 +5,11 @@ namespace BookPrectaBackend.Contracts.Reportes
public interface IRptBookPrectacs public interface IRptBookPrectacs
{ {
public Task<IEnumerable<RelacionBookPrecta>> GetRelacionesTrafico( ); /* public Task<IEnumerable<RelacionBookPrecta>> GetRelacionesTrafico( );
/*public Task<IEnumerable<RelacionBookPrecta>>GetNoRelaciones();*/ *//*public Task<IEnumerable<RelacionBookPrecta>>GetNoRelaciones();*//*
public Task<IEnumerable<RelacionBookPrecta>> GetNoRelaciones(); public Task<IEnumerable<RelacionBookPrecta>> GetNoRelaciones();
*/
} }

@ -1,5 +1,6 @@
using BookPrectaBackend.Contracts.Catalogos; using BookPrectaBackend.Contracts.Catalogos;
using BookPrectaBackend.Contracts.Reportes; using BookPrectaBackend.Contracts.Reportes;
using BookPrectaBackend.DTO.Reportes;
using BookPrectaBackend.Models.Reportes; using BookPrectaBackend.Models.Reportes;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NPOI.Util; using NPOI.Util;
@ -14,10 +15,10 @@ namespace BookPrectaBackend.Controllers.Reportes
public IConfiguration _Configuration; public IConfiguration _Configuration;
private readonly IRptBookPrectacs _Repo; private readonly IRptRepository _Repo;
public ReportesController(IConfiguration config, IRptBookPrectacs Repo) public ReportesController(IConfiguration config, IRptRepository Repo)
{ {
_Configuration = config; _Configuration = config;
_Repo = Repo; _Repo = Repo;
@ -42,6 +43,26 @@ namespace BookPrectaBackend.Controllers.Reportes
return result; return result;
} }
[Route("GetAllWorkingHours")]
[HttpGet]
public async Task<IEnumerable<WorkingHours>> GetWorkingHours(string Inicio, string Fin)
{
var result = await _Repo.GetWorkingHours(Inicio, Fin);
return result;
}
[Route("TotalHours")]
[HttpGet]
public async Task<IEnumerable<TotalHoursWorking>> GetTotalHoursWorkings(string Inicio, string Fin)
{
var result = await _Repo.GetTotalHoursWorkings(Inicio, Fin);
return result;
}

@ -12,7 +12,8 @@
public string? Num { get; set; } public string? Num { get; set; }
public string? Name { get; set; } public string? Name { get; set; }
public string? Memo { get; set; } public string? Memo { get; set; }
public float Amount { get; set; } /*public float Amount { get; set; }*/
public decimal? Amount { get; set; }
public string? Trafico { get; set; } public string? Trafico { get; set; }

@ -0,0 +1,17 @@
namespace BookPrectaBackend.DTO.Reportes
{
public class TotalHoursWorking
{
public string? EmpNo { get; set; }
public string? AcNo { get; set;}
public string? Name { get; set;}
public string? TotalHoursAccumulated { get; set;}
public string? TotalHoursWithMilitaryMinutes { get; set;}
}
}

@ -9,8 +9,8 @@ namespace BookPrectaBackend.Models.Reportes
public string No { get; set; } public string No { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Date { get; set; } // Almacenando la fecha como string public string Date { get; set; } // Almacenando la fecha como string
/*public TimeSpan? ClockIn1 { get; set; }*/ /* public TimeSpan? ClockIn1 { get; set; }
/*public TimeSpan? ClockOut1 { get; set; } public TimeSpan? ClockOut1 { get; set; }
public TimeSpan? ClockIn2 { get; set; } public TimeSpan? ClockIn2 { get; set; }
public TimeSpan? ClockOut2 { get; set; } public TimeSpan? ClockOut2 { get; set; }
public TimeSpan? ClockIn3 { get; set; } public TimeSpan? ClockIn3 { get; set; }
@ -22,7 +22,7 @@ namespace BookPrectaBackend.Models.Reportes
public TimeSpan? TotalInTime { get; set; }*/ public TimeSpan? TotalInTime { get; set; }*/
public string? ClockIn1 { get; set; } public string? ClockIn1 { get; set; }
public string? ClockOut1 { get; set;} public string? ClockOut1 { get; set; }
public string? ClockIn2 { get; set; } public string? ClockIn2 { get; set; }
public string? ClockOut2 { get; set; } public string? ClockOut2 { get; set; }
@ -36,6 +36,8 @@ namespace BookPrectaBackend.Models.Reportes
public string? ClockOut5 { get; set; } public string? ClockOut5 { get; set; }
public string? TotalInTime { get; set; } public string? TotalInTime { get; set; }
public string? TotalHoursWorked { get; set; }

@ -37,7 +37,7 @@ internal class Program
// Reportes // Reportes
builder.Services.AddScoped<IRptBookPrectacs , ReportesRepository>(); builder.Services.AddScoped<IRptRepository, ReportesRepository>();
// Servivios Exel // Servivios Exel
builder.Services.AddScoped<ExcelRepository>(); builder.Services.AddScoped<ExcelRepository>();
@ -51,19 +51,7 @@ internal class Program
builder.Services.AddControllers(); builder.Services.AddControllers();
/* builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>
{
options.RequireHttpsMetadata = false;
options.SaveToken = true;
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = true,
ValidateAudience = true,
ValidAudience = builder.Configuration["Jwt:Audience"],
ValidIssuer = builder.Configuration["Jwt:Issuer"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Key"]))
};
});*/
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)

@ -7,6 +7,7 @@ using BookPrectaBackend.Context;
using OfficeOpenXml; using OfficeOpenXml;
using BookPrectaBackend.Models.Reportes; using BookPrectaBackend.Models.Reportes;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Asn1.Cms;
namespace BookPrectaBackend.Repository.EcxelServices.ExelHourWorking namespace BookPrectaBackend.Repository.EcxelServices.ExelHourWorking
{ {
@ -61,6 +62,18 @@ namespace BookPrectaBackend.Repository.EcxelServices.ExelHourWorking
ClockOut4 = worksheet.Cells[row, 13].Text, ClockOut4 = worksheet.Cells[row, 13].Text,
ClockIn5 = worksheet.Cells[row, 14].Text, ClockIn5 = worksheet.Cells[row, 14].Text,
ClockOut5 = worksheet.Cells[row, 15].Text, ClockOut5 = worksheet.Cells[row, 15].Text,
/* ClockIn1 = TimeSpan.FromHours(),
ClockOut1 = TimeSpan.FromHours(1),
ClockIn2 = TimeSpan.FromHours(1),
ClockOut2 = TimeSpan.FromHours(1),
ClockIn3 = TimeSpan.FromHours(1),
ClockOut3 = TimeSpan.FromHours(1),
ClockIn4 = TimeSpan.FromHours(1),
ClockOut4 = TimeSpan.FromHours(1),
ClockIn5 = TimeSpan.FromHours(1),
ClockOut5 = TimeSpan.FromHours(1),
TotalInTime = TimeSpan.FromHours(1)*/
TotalInTime = worksheet.Cells[row, 16].Text TotalInTime = worksheet.Cells[row, 16].Text
}; };

@ -65,7 +65,8 @@ namespace BookPrectaBackend.Repository.ExelServices
Num = worksheet.Cells[row, 3].Text, Num = worksheet.Cells[row, 3].Text,
Name = worksheet.Cells[row, 4].Text, Name = worksheet.Cells[row, 4].Text,
Memo = worksheet.Cells[row, 5].Text, Memo = worksheet.Cells[row, 5].Text,
Amount = float.TryParse(worksheet.Cells[row, 6].Text, out float amount) ? amount : 0f, /* Amount = float.TryParse(worksheet.Cells[row, 6].Text, out float amount) ? amount : 0f,*/
Amount = decimal.TryParse(worksheet.Cells[row, 6].Text, out decimal amount) ? amount : 0m ,
Trafico = worksheet.Cells[row, 5].Text.Split().FirstOrDefault() Trafico = worksheet.Cells[row, 5].Text.Split().FirstOrDefault()
}; };

@ -1,13 +1,15 @@
using BookPrectaBackend.Context; using BookPrectaBackend.Context;
using BookPrectaBackend.Contracts.Reportes; using BookPrectaBackend.Contracts.Reportes;
using BookPrectaBackend.DTO.Reportes;
using BookPrectaBackend.Models.Reportes; using BookPrectaBackend.Models.Reportes;
using Dapper; using Dapper;
using NPOI.Util;
using System.Data; using System.Data;
namespace BookPrectaBackend.Repository.Reportes namespace BookPrectaBackend.Repository.Reportes
{ {
public class ReportesRepository : IRptBookPrectacs public class ReportesRepository : IRptRepository
{ {
private readonly DapperContext _context; private readonly DapperContext _context;
@ -43,10 +45,38 @@ namespace BookPrectaBackend.Repository.Reportes
/*public async Task<IEnumerable<RelacionBookPrecta>> GetNoRelaciones() public async Task<IEnumerable<WorkingHours>> GetWorkingHours(string Inicio, string Fin)
{ {
}*/ var query = "[TotalTiempos]";
using (var con = _context.CreateConnection())
{
var result = await con.QueryAsync<WorkingHours> (query, new {@Inicio = Inicio, @Fin = Fin}, commandType: CommandType.StoredProcedure );
return result.ToList();
}
}
public async Task<IEnumerable<TotalHoursWorking>> GetTotalHoursWorkings(string Inicio, string Fin)
{
var query = "[TotalHorasWithMilitaryMinutes]";
using var con = _context.CreateConnection();
{
var result = await con.QueryAsync<TotalHoursWorking>(query, new
{ @Inicio = Inicio, @Fin = Fin }, commandType: CommandType.StoredProcedure);
return result.ToList();
}
}

Loading…
Cancel
Save