1
This commit is contained in:
@@ -332,7 +332,7 @@
|
||||
</Tab>
|
||||
<Tab Title="Diferencia Pago Delegado" Name="tabDiferencia">
|
||||
<Content>
|
||||
<MaternidadesGrid Persona="persona"></MaternidadesGrid>
|
||||
<DiferenciaGrid Persona="persona"></DiferenciaGrid>
|
||||
</Content>
|
||||
</Tab>
|
||||
<Tab Title="Permisos sin Retribución" Name="tabPermSinRet">
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
@inject UserState UserState
|
||||
|
||||
<div class="tablaTabLateral">
|
||||
@* <input type="button" value="Nueva maternidad/riesgo de embarazo" @onclick="@(() => abrirPopupModificacion(new MATERNIDADES(), true))" class="mb-2 btnOAAFBlack" /> *@
|
||||
|
||||
<div style="overflow-x:auto;" class="tablaDesk">
|
||||
<Grid TItem="DIFERENCIAPAGODELEGADO"
|
||||
@@ -49,6 +50,56 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* <Modal @ref="popupGestionDatos" IsVerticallyCentered="true" UseStaticBackdrop="true" CloseOnEscape="false">
|
||||
<BodyTemplate>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 mb-2">
|
||||
<label class="fw-bold">Fecha inicio</label>
|
||||
<input class="form-control" type="date" @bind-value="ItemEnEdicion.FECHAINICIO" />
|
||||
</div>
|
||||
<div class="col-md-6 mb-2">
|
||||
<label class="fw-bold">Fecha fin</label>
|
||||
<input class="form-control" type="date" @bind-value="ItemEnEdicion.FECHAFIN" />
|
||||
</div>
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="txtEDesc" class="fw-bold">Base cotización seguridad social: </label>
|
||||
<input class="form-control" type="number" @bind-value="@ItemEnEdicion.BASECOTIZACIONSEGURIDADSOCIAL" />
|
||||
</div>
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="txtEDesc" class="fw-bold">Porcentaje reducción jornada: </label>
|
||||
<input class="form-control" type="number" @bind-value="@ItemEnEdicion.PORCENTAJEREDUCCIONJORNADA" />
|
||||
</div>
|
||||
<div class="col-md-12" style="display:flex; justify-content:space-between">
|
||||
<label for="txtEDesc" class="fw-bold">Riesgo embarazo: </label>
|
||||
<input class="" type="checkbox" id="chbRiesgoEmbarazo" checked="@ItemEnEdicion.RIESGOEMBARAZO" />
|
||||
|
||||
<label for="txtEDesc" class="fw-bold">Nomina normal: </label>
|
||||
<input class="" type="checkbox" id="chbNominaNormal" checked="@ItemEnEdicion.NOMINANORMAL" />
|
||||
|
||||
<label for="txtEDesc" class="fw-bold">Nomina seguridad social: </label>
|
||||
<input class="" type="checkbox" id="chbNominaSS" checked="@ItemEnEdicion.NOMINASEGURIDADSOCIAL" />
|
||||
</div>
|
||||
</div>
|
||||
</BodyTemplate>
|
||||
<FooterTemplate>
|
||||
<Button Color="ButtonColor.Secondary" @onclick="cerrarPopupModificacion">Cerrar</Button>
|
||||
@if (ItemEnEdicion.IDMATERNIDADES != 0)
|
||||
{
|
||||
<Button Type="ButtonType.Submit" Color="ButtonColor.Primary" @onclick="@(() => GestionarDatos(false))">Modificar</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button Type="ButtonType.Submit" Color="ButtonColor.Primary" @onclick="@(() => GestionarDatos(true))">Crear</Button>
|
||||
}
|
||||
</FooterTemplate>
|
||||
</Modal>
|
||||
*@
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public PERSONAS Persona { get; set; } = new PERSONAS();
|
||||
@@ -57,8 +108,17 @@
|
||||
public EventCallback OnPersonaActualizada { get; set; }
|
||||
// private List<int?> meses = new List<int?>();
|
||||
private List<DIFERENCIAPAGODELEGADO> itmList = new List<DIFERENCIAPAGODELEGADO>();
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory);
|
||||
await CargarListas();
|
||||
}
|
||||
private async Task CargarListas()
|
||||
{
|
||||
|
||||
itmList.Clear();
|
||||
try
|
||||
{
|
||||
var listnom = Persona.DIFERENCIAPAGODELEGADO;
|
||||
@@ -69,4 +129,5 @@
|
||||
Console.WriteLine($"Error al obtener los datos: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
@context.FECHAINICIO?.ToString("dd/MM/yyyy")
|
||||
</GridColumn>
|
||||
<GridColumn TItem="MATERNIDADES" HeaderText="Fecha Fin">
|
||||
@context.FECHAINICIO?.ToString("dd/MM/yyyy")
|
||||
@context.FECHAFIN?.ToString("dd/MM/yyyy")
|
||||
</GridColumn>
|
||||
<GridColumn TItem="MATERNIDADES" HeaderText="Base Cotización Seguridad Social">
|
||||
@context.BASECOTIZACIONSEGURIDADSOCIAL
|
||||
@@ -130,23 +130,16 @@
|
||||
private List<MATERNIDADES> itmList = new List<MATERNIDADES>();
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var listnom = Persona.MATERNIDADES;
|
||||
foreach (MATERNIDADES i in listnom){itmList.Add(i);}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"Error al obtener los datos: {e.Message}");
|
||||
}
|
||||
cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory);
|
||||
await CargarListas();
|
||||
}
|
||||
private async Task CargarListas()
|
||||
{
|
||||
|
||||
itmList.Clear();
|
||||
try
|
||||
{
|
||||
foreach (MATERNIDADES enf in Persona.MATERNIDADES)
|
||||
|
||||
{
|
||||
itmList.Add(enf);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,18 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (mostrarMensajeEliminarLinea == true)
|
||||
{
|
||||
<div class="loadingFrameVida">
|
||||
<div class="popupRPCard row">
|
||||
<p>¿Esta seguro de eliminar esta linea de vida administrativa?</p>
|
||||
<div class="col-12 d-flex gap-2 justify-content-end">
|
||||
<input type="button" class="btnGris" value="Continuar" @onclick="BorrarLineaVida" />
|
||||
<input type="button" class="btnOAAFAzul" value="Cancelar" @onclick="cerrarEliminarLineaVida" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (mostrarAnadirLineaVida == true)
|
||||
{
|
||||
<div class="loadingFrameVida">
|
||||
@@ -385,9 +397,9 @@
|
||||
<span @onclick="@(() => abrirEditarLineaVida(context))" style="cursor: pointer;">
|
||||
<Icon CustomIconName="fas fa-edit"></Icon>
|
||||
</span>
|
||||
@* <span @onclick="@(() => abrirPopupConfirmarBorrado(@context))" style="cursor: pointer;">
|
||||
<span @onclick="@(() => mostrarAvisoEliminarLinea(context))" style="cursor: pointer;">
|
||||
<Icon CustomIconName="fas fa-trash"></Icon>
|
||||
</span> *@
|
||||
</span>
|
||||
</GridColumn>
|
||||
</GridColumns>
|
||||
|
||||
@@ -408,6 +420,7 @@
|
||||
private bool nueva = false;
|
||||
private bool mostrarMensajeCuerpo = false;
|
||||
private bool mostrarMensajeEliminar = false;
|
||||
private bool mostrarMensajeEliminarLinea = false;
|
||||
private bool mostrarAnadirLineaVida = false;
|
||||
private bool mostrarEditarLineaVida = false;
|
||||
private string usuarioVida { get; set; } = "";
|
||||
@@ -862,9 +875,11 @@
|
||||
protected void OcultarMenCuer() { mostrarMensajeCuerpo = false; }
|
||||
protected void OcultarMenElim() { mostrarMensajeEliminar = false; }
|
||||
protected void mostrarAvisoEliminar() { mostrarMensajeEliminar = true; }
|
||||
protected void mostrarAvisoEliminarLinea(LINEASVIDAADMINISTRATIVA linea){lineaEditada = linea;mostrarMensajeEliminarLinea = true; }
|
||||
protected void abrirAnadirLineaVida() { mostrarAnadirLineaVida = true; }
|
||||
protected void abrirEditarLineaVida(LINEASVIDAADMINISTRATIVA linea) { mostrarEditarLineaVida = true; lineaEditada = linea; DESCRIPCIONLINEAVIDAED = linea.DESCRIPCION; IDTIPODOCUED = linea.IDTIPO; }
|
||||
protected void cerrarAnadirLineaVida() { mostrarAnadirLineaVida = false; }
|
||||
protected void cerrarEliminarLineaVida() { lineaEditada = null; mostrarAnadirLineaVida = false; }
|
||||
protected void cerrarEditarLineaVida() { mostrarEditarLineaVida = false; }
|
||||
protected void volver() { Navigation.NavigateTo(LINKPERSONA, forceLoad: true); }
|
||||
protected string urlFich(int id)
|
||||
@@ -1346,6 +1361,28 @@
|
||||
if (dot.IsSuccessStatusCode) { Navigation.NavigateTo(LINKPERSONA, forceLoad: true); }
|
||||
|
||||
}
|
||||
protected async void BorrarLineaVida()
|
||||
{
|
||||
var idlinea = lineaEditada.IDLINEAVIDAADMIN;
|
||||
var dot = await client.DeleteAsync("/api/LINEASVIDAADMINISTRATIVA/" + idlinea);
|
||||
var dotContent = await dot.Content.ReadAsStringAsync();
|
||||
if (dot.IsSuccessStatusCode)
|
||||
{
|
||||
|
||||
var fichTrans = new AlmacenaFicheroAtransmitir();
|
||||
fichTrans.IdRegistro = idlinea;
|
||||
fichTrans.Tabla = "LINEAVIDAADMINISTRATIVA";
|
||||
var jsonConsulta = JsonConvert.SerializeObject(fichTrans);
|
||||
var content = new StringContent(jsonConsulta, Encoding.UTF8, "application/json");
|
||||
var ficherotrans = await client.PostAsync("/api/Almacenamiento/eliminar-fichero", content);
|
||||
var fichContent = await ficherotrans.Content.ReadAsStringAsync();
|
||||
|
||||
}
|
||||
cargarGridLineas();
|
||||
cerrarEliminarLineaVida();
|
||||
mostrar = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
private void abrirPopupGestionLinea(LINEASVIDAADMINISTRATIVA objeto)
|
||||
{
|
||||
DESCRIPCIONLINEAVIDAED = objeto.DESCRIPCION!;
|
||||
|
||||
@@ -46,6 +46,23 @@ namespace SwaggerAntifraude.Controllers
|
||||
return Ok(resultado);
|
||||
}
|
||||
|
||||
return StatusCode(500, resultado);
|
||||
}
|
||||
[Authorize(Policy = "SupervisorPolicy")]
|
||||
[HttpPost("eliminar-fichero")]
|
||||
public IActionResult EliminarFichero(PeticionFichero solicitud)
|
||||
{
|
||||
if (string.IsNullOrEmpty(solicitud.Tabla) || solicitud.IdRegistro <= 0)
|
||||
return BadRequest("Solicitud inválida. Asegúrese de enviar los parámetros requeridos.");
|
||||
|
||||
var resultado = _servicio.EliminarFicheroAtransmitir(solicitud.IdRegistro, solicitud.Tabla, solicitud.Nif);
|
||||
|
||||
if (resultado.Resultado == 0)
|
||||
{
|
||||
// Devolver el archivo como un PDF descargable
|
||||
return Ok(resultado);
|
||||
}
|
||||
|
||||
return StatusCode(500, resultado);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using bdAntifraude.db;
|
||||
using bdAntifraude.dbcontext;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Serialize.Linq.Serializers;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace SwaggerAntifraude.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class MATERNIDADESController : GenericoController<MATERNIDADES, int>
|
||||
{
|
||||
public MATERNIDADESController()
|
||||
: base()
|
||||
{
|
||||
Debug.WriteLine("aqui");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -91,9 +91,6 @@ namespace SwaggerAntifraude.Servicios
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ResultadoObtenFicheroAtransmitir DevolverObtenFicheroAtransmitir(int idRegistro, string tabla, string nif)
|
||||
{
|
||||
var resultado = new ResultadoObtenFicheroAtransmitir();
|
||||
@@ -181,11 +178,99 @@ namespace SwaggerAntifraude.Servicios
|
||||
resultado.Mensaje += $" {ex.InnerException.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
public ResultadoObtenFicheroAtransmitir EliminarFicheroAtransmitir(int idRegistro, string tabla, string nif)
|
||||
{
|
||||
var resultado = new ResultadoObtenFicheroAtransmitir();
|
||||
|
||||
try
|
||||
{
|
||||
// Obtener el nombre de la base de datos utilizando el contexto
|
||||
string baseDeDatos;
|
||||
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
baseDeDatos = context.Database.GetDbConnection().Database;
|
||||
}
|
||||
|
||||
Conf = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.Build();
|
||||
baseDeDatos = Conf.GetSection("BaseDatos").Value; ;
|
||||
|
||||
//if (string.IsNullOrEmpty(baseDeDatos))
|
||||
//{
|
||||
// baseDeDatos = "preproduccion";
|
||||
//}
|
||||
|
||||
// Generar la ruta base
|
||||
string ruta = $"{baseDeDatos.ToLower()}/registrodepersonal";
|
||||
|
||||
switch (tabla.ToUpper())
|
||||
{
|
||||
case "LINEAVIDAADMINISTRATIVA":
|
||||
ruta += "/lineavidaadministrativa/";
|
||||
break;
|
||||
case "FORMACION":
|
||||
ruta += "/formacion/";
|
||||
break;
|
||||
case "TITULACION":
|
||||
ruta += "/titulacion/";
|
||||
break;
|
||||
case "DOCENCIA":
|
||||
ruta += "/docencia/";
|
||||
break;
|
||||
case "INCIDENCIA":
|
||||
ruta = $"{baseDeDatos.ToLower()}/control_horario/";
|
||||
break;
|
||||
case "CSV":
|
||||
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true))
|
||||
{
|
||||
//ruta += context.VALIDACIONDOCUMENTOS.First(x => x.CSV == nif).RUTAFICHERO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = "Tabla no contemplada entre las posibles para tener ficheros";
|
||||
return resultado;
|
||||
}
|
||||
|
||||
if (tabla.ToUpper() != "CSV")
|
||||
{
|
||||
ruta += $"{idRegistro}.pdf";
|
||||
}
|
||||
|
||||
resultado.Mensaje = $"Ruta: {ruta}";
|
||||
|
||||
// Descargar el archivo desde el servidor SFTP
|
||||
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true))
|
||||
using (var clienteSftp = ConectarServidorSftp(context))
|
||||
{
|
||||
clienteSftp.Connect();
|
||||
|
||||
//using var memoryStream = new MemoryStream();
|
||||
clienteSftp.DeleteFile(ruta);
|
||||
clienteSftp.Disconnect();
|
||||
|
||||
//resultado.Pdf = memoryStream.ToArray();
|
||||
}
|
||||
|
||||
resultado.Resultado = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
resultado.Resultado = 1;
|
||||
resultado.Mensaje = $"ERROR de generación: {ex.Message}";
|
||||
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
resultado.Mensaje += $" {ex.InnerException.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
|
||||
private SftpClient ConectarServidorSftp(tsGestionAntifraude context)
|
||||
{
|
||||
var configuraciones = context.ENUMERACIONES
|
||||
|
||||
Reference in New Issue
Block a user