332 lines
14 KiB
C#
332 lines
14 KiB
C#
using Exferia_Aplicacion.General;
|
|
using Exferia_Aplicacion.Visualizacion;
|
|
using Exferia_Controles;
|
|
using Exferia_Controles.ControlesAuxiliares;
|
|
using Exferia_EntityFramework;
|
|
using Exferia_General;
|
|
using Exferia_KairosPRO._4_Vistas.Controladoras;
|
|
using Exferia_KairosPRO._4_Vistas.ControlesPersonalizados_DentroPaneles;
|
|
using Exferia_KairosPRO.General;
|
|
using Exferia_KairosPRO_EF;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using static Exferia_Aplicacion.General.Enumerados;
|
|
|
|
namespace Exferia_KairosPRO._4_Vistas
|
|
{
|
|
public partial class P_Fichajes_Detalle : Exferia_Formularios.P_Base_Mantenimientos
|
|
{
|
|
#region Variables Generales
|
|
private P_Fichajes_Detalle_Controladora g_obj_Controladora;
|
|
|
|
public bool g_bol_ConstructorPantalla_Terminado_Correctamente = true;
|
|
public PRV_OpcionesDetalle g_mdl_PRV_OpcionesDetalle = null;
|
|
|
|
internal List<INTERNO_Permisos_Modelo> g_lst_INTERNO_Permisos_Modelo = null;
|
|
|
|
//Variables paginador
|
|
public Funciones_Paginador g_obj_Funciones_Paginador;
|
|
private Timer g_timer_Paginar = new Timer();
|
|
|
|
|
|
#endregion
|
|
|
|
#region Objetos en Pantalla
|
|
//Exferia_comboBox
|
|
internal Exferia_ComboBox Exferia_comboBox_EntradaSalida { get { return ex_cbo_P_Fichajes_EntradaSalida; } }
|
|
internal Exferia_ComboBox Exferia_comboBox_TipoDispositivo { get { return ex_cbo_P_Fichajes_TipoDispositivo; } }
|
|
|
|
//Exferia_checkBox
|
|
internal Exferia_CheckBox Exferia_checkBox_Anulado { get{ return ex_chk_P_Fichajes_Anulado; } }
|
|
|
|
//Exferia_FechaSeleccion
|
|
internal Exferia_FechaSeleccion Exferia_FechaSeleccion_Fichaje { get { return ex_usc_P_Fichajes_Detalle_FechaHora; } }
|
|
|
|
//Exferia_F3
|
|
internal Exferia_F3 Exferia_F3_Terminal { get { return ex_usc_P_Fichajes_Detalle_Terminal; } }
|
|
internal Exferia_F3_SoloSeleccion Exferia_F3_DispositivoModelo { get { return ex_usc_P_Fichajes_Detalle_DispositivoModelo; } }
|
|
|
|
//Exferia_Label
|
|
internal Exferia_Label Exferia_Label_Jornada { get { return ex_lbl_P_Fichajes_Detalle_Jornada; } }
|
|
internal Exferia_Label Exferia_Label_Hora { get { return ex_lbl_P_Fichajes_Detalle_Hora; }}
|
|
|
|
//Mapa
|
|
internal CTU_Mapa CTU_Mapa { get { return ctu_P_Fichajes_Mapa; } }
|
|
|
|
//PicturaBox
|
|
internal PictureBox PictureBox_FotoFichaje { get { return pcb_P_Fichajes_Detalle_FotoFichaje; } }
|
|
|
|
//Exferia_Panel_degradado
|
|
internal Exferia_Panel_Degradado Exferia_Panel_Degradado_Lineas { get { return ex_pnl_P_Fichajes_Detalle_JornadaLinea; } }
|
|
|
|
//Exferia_TextBox
|
|
internal Exferia_TextBox Exferia_TextBox_Observaciones { get { return ex_txt_P_Fichajes_Detalle_Observaciones; } }
|
|
internal Exferia_TextBox_ConMascara Exferia_TextBox_Hora { get { return ex_txt_P_Fichajes_Detalle_Hora; } }
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public P_Fichajes_Detalle(INTERNO_ValoresGenerales_Modelo _mdl_INTERNO_ValoresGenerales_Modelo,
|
|
DateTime _dtt_FechaTrabajo,
|
|
PRV_OpcionesDetalle _mdl_PRV_OpcionesDetalle,
|
|
KRSS_Fichajes _mdl_KRSS_Fichajes,
|
|
KRS_JornadasCabecera _mdl_KRS_JornadasCabecera,
|
|
DateTime _dtt_Dia_De_Hoy,
|
|
long _lng_idEmpleado,
|
|
bool _bol_HorasExtrasAutorizadas)
|
|
{
|
|
InitializeComponent();
|
|
|
|
Repintar.Empezar(this);
|
|
Repintar.Empezar(CTU_Mapa);
|
|
|
|
CheckForIllegalCrossThreadCalls = false;
|
|
|
|
//Empresa Seleccionada y Fecha de Trabajo
|
|
P_Base_ValoresGenerales = _mdl_INTERNO_ValoresGenerales_Modelo;
|
|
P_Base_FechaTrabajo = _dtt_FechaTrabajo;
|
|
|
|
//Instanciar Controladora
|
|
g_obj_Controladora = new P_Fichajes_Detalle_Controladora(this, _dtt_Dia_De_Hoy, _mdl_KRS_JornadasCabecera, _lng_idEmpleado, _bol_HorasExtrasAutorizadas);
|
|
|
|
//relleno el modelo con el fichaje
|
|
g_obj_Controladora.g_mdl_KRSS_Fichajes = _mdl_KRSS_Fichajes;
|
|
|
|
//Datos de Opciones Detalle
|
|
g_mdl_PRV_OpcionesDetalle = _mdl_PRV_OpcionesDetalle;
|
|
|
|
//Buscar los Permisos
|
|
g_lst_INTERNO_Permisos_Modelo = Datos_Generales.Permisos_Buscar(g_mdl_PRV_OpcionesDetalle.opcion);
|
|
|
|
//Poner los botones que no se pueden bloquear o de slol lectura
|
|
ex_btn_P_Fichajes_Detalle_Guardar.Exferia_Button_Bloqueable = false;
|
|
|
|
//Mirar si hay que bloquear los controles, si solo puede ver los datos
|
|
if (_bol_HorasExtrasAutorizadas || (P_Base_TipoAperturaPantalla != 0 && Datos_Generales.Permisos_Comprobar(g_mdl_PRV_OpcionesDetalle.opcion, g_lst_INTERNO_Permisos_Modelo, (int)G_ENUM_PERMISOS.Modificar, false)) == false)
|
|
{
|
|
//Bloqueo los Controles
|
|
SoloLectura.Empezar(this, true);
|
|
}
|
|
//Mirar si no se puede Borrar entonces se bloquea de CheckBox de anular
|
|
if ((P_Base_TipoAperturaPantalla != 0 && Datos_Generales.Permisos_Comprobar(g_mdl_PRV_OpcionesDetalle.opcion, g_lst_INTERNO_Permisos_Modelo, (int)G_ENUM_PERMISOS.Borrar, false)) == false)
|
|
{
|
|
//Bloqueo el CheckBox de anular
|
|
ex_chk_P_Fichajes_Anulado.Enabled = false;
|
|
}
|
|
|
|
//Titulo de la Pantalla .............................................................................
|
|
P_Base_TituloPantalla = g_mdl_PRV_OpcionesDetalle.descripcion_TituloMantenimiento;
|
|
|
|
try
|
|
{
|
|
// Label con Empresa Seleccionada
|
|
if (P_Base_ValoresGenerales != null)
|
|
{
|
|
try
|
|
{
|
|
P_Base_Mantenimientos_InformacionEmpresaSeleccionada = P_Base_ValoresGenerales.str_Empresa_Descripcion + " - " +
|
|
"(" + P_Base_FechaTrabajo.ToString("dd/MM/yyyy") + ")";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//No se muestra mensaje pero se guarda en el log
|
|
Control_Errores.Errores_Log("", ex, nameof(P_Fichajes_Detalle) + "/" + nameof(P_Fichajes_Detalle));
|
|
}
|
|
}
|
|
//....................................................................................................
|
|
|
|
//Bloquear pantalla hasta que termine la carga por defecto .....
|
|
Enabled = false;
|
|
//.............................................................
|
|
|
|
//Rellenar los F3 ..............................................
|
|
|
|
//Terminal
|
|
ex_usc_P_Fichajes_Detalle_Terminal.Exferia_F3_PRINCIPAL_Opcion_BuscarDatos = Variables.G_STR_OPCION_KRS_TERMINALES;
|
|
ex_usc_P_Fichajes_Detalle_Terminal.Exferia_F3_PRINCIPAL_BUSCARTITULO = false;
|
|
ex_usc_P_Fichajes_Detalle_Terminal.Exferia_F3_PRINCIPAL_Obligatorio = false;
|
|
ex_usc_P_Fichajes_Detalle_Terminal.Exferia_F3_PantallaContenedora = this;
|
|
|
|
//Dispositivo
|
|
ex_usc_P_Fichajes_Detalle_DispositivoModelo.Exferia_F3_SoloSeleccion_PRINCIPAL_Opcion_BuscarDatos = Variables.G_STR_OPCION_KRSS_DISPOSITIVOSMODELO;
|
|
ex_usc_P_Fichajes_Detalle_DispositivoModelo.Exferia_F3_SoloSeleccion_PRINCIPAL_Obligatorio = true;
|
|
ex_usc_P_Fichajes_Detalle_DispositivoModelo.Exferia_F3_SoloSeleccion_PRINCIPAL_BUSCARTITULO = false;
|
|
ex_usc_P_Fichajes_Detalle_DispositivoModelo.Exferia_F3_SoloSeleccion_PantallaContenedora = this;
|
|
|
|
ex_usc_P_Fichajes_Detalle_FechaHora.Exferia_FechaSeleccion_Fecha = _dtt_Dia_De_Hoy.ToString();
|
|
}
|
|
catch (Control_Errores)
|
|
{ }
|
|
catch (Exception ex)
|
|
{
|
|
//No se muestra mensaje pero se guarda en el log
|
|
Control_Errores.Errores_Log("", ex, nameof(P_Fichajes_Detalle) + "/" + nameof(P_Fichajes_Detalle));
|
|
}
|
|
finally
|
|
{
|
|
//Bloquear pantalla hasta que termine la carga por defecto .....
|
|
this.Enabled = true;
|
|
//.............................................................
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Inicio de Pantalla
|
|
private void P_Fichajes_Detalle_shown(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (g_bol_ConstructorPantalla_Terminado_Correctamente)
|
|
{
|
|
//Si el Tipo de Apertira de Pantalla es Añair(g_int_tipoAperturaPantalla = 0), se desactivan los botones correcpondientes
|
|
//Añadir
|
|
if (this.P_Base_TipoAperturaPantalla == 0)
|
|
{
|
|
P_Base_TituloPantalla = P_Base_TituloPantalla + " - Añadir";
|
|
|
|
g_obj_Controladora.g_bol_Termino_CargaDatos_Inicial = true;
|
|
|
|
//Poner Teto predeterminado y foco
|
|
ex_txt_P_Fichajes_Detalle_Hora.Focus();
|
|
|
|
g_obj_Controladora.RecargarDatos(-1);
|
|
|
|
g_obj_Controladora.g_bol_Termino_CargaDatos_Inicial = false;
|
|
}
|
|
//Modificar
|
|
else
|
|
{
|
|
g_obj_Controladora.RecargarDatos(g_obj_Controladora.g_mdl_KRSS_Fichajes.id);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
|
Salir_P_Base();
|
|
}
|
|
}
|
|
catch (Control_Errores)
|
|
{
|
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
|
Salir_P_Base();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//No se muestra mensaje pero se guarda en el log
|
|
Control_Errores.Errores_Log("", ex, nameof(P_Fichajes_Detalle) + "/" + nameof(P_Fichajes_Detalle_shown));
|
|
|
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
|
Salir_P_Base();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Botones Grabar, Borrar, BorrarImagen , BuscarImagen y Eventos
|
|
private void ex_btn_P_Fichajes_Detalle_Guardar_Click(object sender, EventArgs e)
|
|
{
|
|
Grabar();
|
|
}
|
|
private void Grabar()
|
|
{
|
|
if (Datos_Generales.Permisos_Comprobar(g_mdl_PRV_OpcionesDetalle.opcion, g_lst_INTERNO_Permisos_Modelo, (int)G_ENUM_PERMISOS.Modificar, true))
|
|
{
|
|
if (g_obj_Controladora.g_bol_HorasExtrasAutorizadas)
|
|
{
|
|
Mensajes.MostrarMensaje(Mensajes.G_STR_KAIROSPRO_FICHAJES_HORASEXTRAS_TIENEHORASEXTRASGRABADAS());
|
|
}
|
|
else
|
|
{
|
|
g_obj_Controladora.GrabarDatos(true);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void ex_btn_P_Fichajes_BorrarImagen_Click(object sender, EventArgs e)
|
|
{
|
|
pcb_P_Fichajes_Detalle_FotoFichaje.Image = null;
|
|
pcb_P_Fichajes_Detalle_FotoFichaje.Tag = "";
|
|
g_obj_Controladora.g_img_Foto_Fichaje = null;
|
|
}
|
|
#endregion
|
|
|
|
private void ex_cbo_P_Fichajes_TipoDispositivo_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (ex_cbo_P_Fichajes_TipoDispositivo.SelectedItem!=null)
|
|
{
|
|
if (((INTERNO_ComboBox_Modelo)ex_cbo_P_Fichajes_TipoDispositivo.SelectedItem).Identificador==Variables.G_INT_TIPODISPOSITIVO_OFICINA_CODIGO.ToString())
|
|
{
|
|
ex_usc_P_Fichajes_Detalle_Terminal.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
ex_usc_P_Fichajes_Detalle_Terminal.Visible = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
#region Teclas de acceso rapido
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
{
|
|
// Salir sin Seleccionar
|
|
if (keyData == Keys.F10)
|
|
{
|
|
Salir_P_Base();
|
|
return true;
|
|
}
|
|
// Grabar
|
|
else if (keyData == Keys.F2)
|
|
{
|
|
Grabar();
|
|
return true;
|
|
}
|
|
return base.ProcessCmdKey(ref msg, keyData);
|
|
}
|
|
#endregion
|
|
|
|
#region Controlar si se modifica algo
|
|
private void Controlar_Modificaciones_TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
Controlar_Modificaciones();
|
|
}
|
|
|
|
private void Controlar_Modificaciones_CheckBox_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
Controlar_Modificaciones();
|
|
}
|
|
|
|
private void Controlar_Modificaciones_ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Controlar_Modificaciones();
|
|
}
|
|
|
|
private void Controlar_Modificaciones()
|
|
{
|
|
if (Enabled && g_obj_Controladora != null && g_obj_Controladora.g_bol_Termino_CargaDatos_Inicial)
|
|
{
|
|
P_Base_SeModificoDatosPantalla = true;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Eventos de TabPage
|
|
private void ex_tbc_P_Fichajes_Detalle_Selected(object sender, TabControlEventArgs e)
|
|
{
|
|
if (e != null)
|
|
{
|
|
//Cargar el Mapa solo si se selecciona en la pestaña
|
|
if (e.TabPage.Text.Equals("Mapa"))
|
|
{
|
|
g_obj_Controladora.RecargarMapa();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|