diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index c2bbe5fb2..fb9ffeae2 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6284,7 +6284,7 @@ Partial Class Compras_Compras Case 6 'Compra Dim AgregaMercanciaInventario As Boolean = UsuarioActual.Empresa.UsaInventarios - If UsuarioActual.CveEmpresa.Contiene(13, 83) Then AgregaMercanciaInventario = False + If UsuarioActual.CveEmpresa.Contiene(13, 83, 7, 11, 12, 122) Then AgregaMercanciaInventario = False Dim RegistraConcepto225 As Boolean = AgregaMercanciaInventario AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") @@ -6813,7 +6813,7 @@ Partial Class Compras_Compras End If Dim tTipoMovimiento As Boolean = TipoMovimiento - If DTDistinct.Rows.Count > 0 AndAlso Not UsuarioActual.CveEmpresa.Contiene(7, 11, 12, 122, 145) Then + If DTDistinct.Rows.Count > 0 Then For Each Row2 As DataRow In DTDistinct.Rows tTipoMovimiento = TipoMovimiento 'DETERMINA IMPORTE diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index aef28ee58..d6bd61c1d 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -1990,38 +1990,53 @@ Partial Class Inventarios_EntregaAlmacen Dim ValidaSeccion As Boolean = False : Dim ValidaCaducidad As Boolean = False : Dim ValidaLote As Boolean = False 'VALIDA CANTIDAD DE SALIDA - Dim Cantidad As Decimal = 0.0D + Dim Cantidad As Decimal = 0.0D + Dim NumRegistros As Integer = 0 - For Each Gvr As GridViewRow In GvDatos.Rows - If CBool(Gvr.DataKey("AplicaSeccion")) AndAlso Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero() <= 0 Then - ValidaSeccion = True - End If - If CBool(Gvr.DataKey("AplicaCaducidad")) AndAlso Gvr.FCTextBox("TxtCaducidad").Text.Trim = "" Then - ValidaCaducidad = True - End If - If CBool(Gvr.DataKey("AplicaLote")) AndAlso Gvr.FCTextBox("TxtLote").Text.Trim = "" Then - ValidaLote = True - End If - - If Gvr.FCCheckBox("cbInv").Checked AndAlso Gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then - Cantidad = Gvr.FCTextBox("TbCantidadF").Text.ToDecimal - Exit For - End If - - Next - - Dim NumRegistros As Integer = 0 - For Each Gvr As GridViewRow In GvDatos.Rows If Gvr.RowType = DataControlRowType.DataRow Then If Gvr.FCCheckBox("cbInv").Checked Then NumRegistros += 1 + + If CBool(Gvr.DataKey("AplicaSeccion")) AndAlso Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero() <= 0 Then + ValidaSeccion = True + End If + + If CBool(Gvr.DataKey("AplicaCaducidad")) Then + If GvDatos.Columns(8).Visible Then + If String.IsNullOrEmpty(Gvr.FCDropDownList("DdlCaducidadProducto").SelectedValue.Trim()) OrElse Gvr.FCDropDownList("DdlCaducidadProducto").SelectedValue.Trim() = "|" Then + ValidaCaducidad = True + End If + Else + If String.IsNullOrEmpty(Gvr.FCTextBox("TxtCaducidad").Text.Trim) Then + ValidaCaducidad = True + End If + End If + End If + + If CBool(Gvr.DataKey("AplicaLote")) Then + If GvDatos.Columns(8).Visible Then + If String.IsNullOrEmpty(Gvr.FCDropDownList("DdlCaducidadProducto").SelectedValue.Trim()) OrElse Gvr.FCDropDownList("DdlCaducidadProducto").SelectedValue.Trim() = "|" Then + ValidaLote = True + End If + Else + If String.IsNullOrEmpty(Gvr.FCTextBox("TxtLote").Text.Trim) Then + ValidaLote = True + End If + End If + End If + + If Gvr.FCCheckBox("cbInv").Checked AndAlso Gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then + Cantidad = Gvr.FCTextBox("TbCantidadF").Text.ToDecimal + End If + End If + End If - Next - - 'LIMITAR EL NUMERO DE PARTIDAS QUE SE PUEDEN ENTREGAR - If UsuarioActual.CveEmpresa = 186 Then + Next + + 'LIMITAR EL NUMERO DE PARTIDAS QUE SE PUEDEN ENTREGAR + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then 'SI EL CLIENTE ES OPERADORA DE HOSPITALES ANGELES SOLO SE PUEDEN RECIBIR MAXIMO 5 If CveCliente = 819998 Then If NumRegistros > 5 Then @@ -2034,12 +2049,12 @@ Partial Class Inventarios_EntregaAlmacen Exit Sub End If End If - End If - - ValidaSeccion = False - ValidaCaducidad = False - ValidaLote = False - + End If + + 'ValidaSeccion = False + 'ValidaCaducidad = False + 'ValidaLote = False + If ValidaSeccion Then Alert("La sección de almacen no ha sido especificada en todos los productos.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -2053,11 +2068,12 @@ Partial Class Inventarios_EntregaAlmacen Exit Sub End If - If Not Cantidad > 0 Then Alert("No se detecto ningun movimiento por hacer. Por favor verifique e intente nuevamente.", TipoMensaje.MsgAdvertencia) Exit Sub - End If + End If + + 'PROCESO , si tiene proceso "176" no lo valida If Not UsuarioActual.TienePermisoProceso(176) Then diff --git a/Nomina/ChecadorAsistencia.aspx.cs b/Nomina/ChecadorAsistencia.aspx.cs index 5d133e895..44b5ab34a 100644 --- a/Nomina/ChecadorAsistencia.aspx.cs +++ b/Nomina/ChecadorAsistencia.aspx.cs @@ -363,7 +363,7 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas } using (ClsRH objRH = new ClsRH()) { - if (objRH.PreAsistenciaRegistrosGet(fechai, fechaf, -1, UsuarioActual.Empresa.CveEmpresa)) + if (objRH.PreAsistenciaRegistrosGet(fechai, fechaf, -1, UsuarioActual.Empresa.CveEmpresa,false)) { GvDetalleDias.DataSource = objRH.DtResultados.FiltraParametros(string.Format("FechaRegistro >='{0:yyyy/MM/dd HH:mm}' AND FechaRegistro <='{1:yyyy/MM/dd HH:mm}' AND CvePersonal = {2}", fechai.AddHours(6), fechaf.AddHours(6), CvePersonal), "FechaRegistro"); GvDetalleDias.DataBind(); diff --git a/RH/RepChecadorPreAsistencia.aspx b/RH/RepChecadorPreAsistencia.aspx index 04ae68d5a..d48e4eb00 100644 --- a/RH/RepChecadorPreAsistencia.aspx +++ b/RH/RepChecadorPreAsistencia.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepChecadorPreAsistencia.aspx.vb" Inherits="RH_RepChecadorPreAsistencia" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepChecadorPreAsistencia.aspx.vb" Inherits="RH_RepChecadorPreAsistencia" EnableEventValidation="false" %> @@ -22,14 +22,21 @@
  • - -
  • + +
  • +
  • + +
  • + + + @@ -217,12 +224,22 @@ CssClass="ADSCROLLER2 table table-striped table-advance table-hover Widthall" data-rows="1" data-cols="3" data-heightmenos="100" data-heightfijo="600" Style="text-align: center;" GridLines="None"> + +
    +
    + +
    +
    + Código +
    +
    +
    -
    - +
    +
    -
    +
    @@ -245,157 +262,157 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -564,5 +581,21 @@ + + \ No newline at end of file diff --git a/RH/RepChecadorPreAsistencia.aspx.vb b/RH/RepChecadorPreAsistencia.aspx.vb index 2afd74918..45d5ddce5 100644 --- a/RH/RepChecadorPreAsistencia.aspx.vb +++ b/RH/RepChecadorPreAsistencia.aspx.vb @@ -1,12 +1,7 @@ Option Strict On - - -Imports DocumentFormat.OpenXml.Wordprocessing Imports Extensiones -Imports System Imports System.Data -Imports System.Runtime.Remoting -Imports System.ServiceModel.Security + @@ -196,7 +191,7 @@ Partial Class RH_RepChecadorPreAsistencia CargaCombos() End If - GvBind() + ' GvBind() End Sub @@ -540,12 +535,7 @@ Partial Class RH_RepChecadorPreAsistencia Dim DtTempPeriodo As DataTable = DTPeriodos.FiltraParametros("CvePeriodo = " & DdlPeriodo.SelectedValue.ToEntero) Dim FechaInicioPeriodoFiltro = DtTempPeriodo(0)("FechaInicio").ToString().ToDate - 'Dim FilasFiltradas = From fila In GlobalDTRHPersonal(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(FiltroSubProyecto).AsEnumerable() - ' Let Inicio = fila.Field(Of Date)("FechaInicio") - ' Let FechaFinOriginal = fila.Field(Of Date?)("FechaFin") - ' Let FechaFin = If(FechaFinOriginal.HasValue, FechaFinOriginal.Value, Now) - ' Where Inicio <= FechaInicioPeriodoFiltro AndAlso FechaInicioPeriodoFiltro <= FechaFin - ' Select fila + Dim FilCveDepartamento As Integer = DdlDepartamento.SelectedValue.ToEntero @@ -600,10 +590,6 @@ Partial Class RH_RepChecadorPreAsistencia DtVacaciones = objRH.DtResultados End If - 'If objRH.GetPersonalAsistenciaRegistros(FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa) Then - ' DTAsistenciasInasistencias = objRH.DtResultados - 'End If - If objRH.GetPersonalPreAsistenciaRegistros(FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa) Then DTPreAsistenciasInasistencias = objRH.DtResultados End If @@ -611,16 +597,7 @@ Partial Class RH_RepChecadorPreAsistencia If objRH.ChecadorPreAsistenciaRegistrosAsistenciasGet(CveTipoPeriodo, FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.Empresa.CveEmpresa) Then DTAsistenciasInasistenciasReg = objRH.DtResultados - 'If DTAsistenciasInasistenciasReg.Rows.Count > 0 Then - ' 'BtnAgregar.Visible = False - ' 'BtnEstusAsistenciaModal.Visible = False - ' 'DdlAsistenciaInacistencia.Enabled = False - 'Else - ' 'BtnAgregar.Visible = True - ' 'BtnEstusAsistenciaModal.Visible = True - ' 'DdlAsistenciaInacistencia.Enabled = True - 'End If - 'UpAcciones.Update() + End If objRH.Dispose() @@ -1278,10 +1255,12 @@ Partial Class RH_RepChecadorPreAsistencia LnkEnviarAsistencia.Visible = False LnkCargaMasiva.Visible = False + LnkDescargaExcel.Visible = False If DtDatosTabla.Rows.Count > 0 Then GVRegDatos.DataSource = DtDatosTabla LnkEnviarAsistencia.Visible = True + LnkDescargaExcel.Visible = True If Not Enviado Then LnkCargaMasiva.Visible = True @@ -1629,6 +1608,9 @@ Partial Class RH_RepChecadorPreAsistencia Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) CargaDatos() + If PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero) Then + Alert($"La información del periodo {DdlPeriodo.SelectedItem.Text} ya fue enviada a la pre nómina, esta información ya está bloqueda y si hay ajustes estos se deberán de hacer en pre nóminas") + End If End Sub Private Sub BtnModalFecha_Click(sender As Object, e As EventArgs) Handles BtnModalFecha.Click @@ -1940,9 +1922,9 @@ Partial Class RH_RepChecadorPreAsistencia lnkLink.Font.Bold = True End If - If Filtro.Length > 0 Then - AddHandler lnkLink.Click, AddressOf Me.DetalleDia_Click - End If + 'If Filtro.Length > 0 Then + ' AddHandler lnkLink.Click, AddressOf Me.DetalleDia_Click + 'End If CountFecha = CountFecha + 1 Fecha = Fecha.AddDays(1) Next @@ -1958,9 +1940,21 @@ Partial Class RH_RepChecadorPreAsistencia e.Row.FCCheckBox("Chk").Visible = True End If End If + + If e.Row.RowType = DataControlRowType.Header Then + If VerChkSeleccionPersonal Then + e.Row.FCCheckBox("Chk").Visible = True + End If + End If + End Sub Public Sub DetalleDia_Click(sender As Object, e As EventArgs) + BtnGuardar.Visible = True + + If PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero) Then + BtnGuardar.Visible = False + End If CvePersonalSeleccionado = -1 @@ -2125,7 +2119,7 @@ Partial Class RH_RepChecadorPreAsistencia TxtHorasDoblesModal.Text = arrayComands(2) TxtHorasTriplesModal.Text = arrayComands(3) - DdlMotivoHoraExtraModal.SelectedValueExist(TxtHorasTriplesModal.Text = arrayComands(4)) + DdlMotivoHoraExtraModal.SelectedValueExist(arrayComands(4)) TxtObsModal.Text = arrayComands(5) TxtPorcentajePagoModal.Text = arrayComands(6).ToDecimal.ToString("###.00") @@ -2158,40 +2152,6 @@ Partial Class RH_RepChecadorPreAsistencia End Function - 'Private Sub BtnEstusAsistenciaModal_Click(sender As Object, e As EventArgs) Handles BtnEstusAsistenciaModal.Click - - ' Dim myRow As DataRow() ' = DtResultados.NewRow - ' Dim temtDt As New DataTable - ' temtDt = DtResultados.FiltraParametros(FiltroAplicado) - - ' Dim fecha As String = temtDt(0)("Fecha").ToString() - ' Dim CvePersonal As Integer = temtDt(0)("CvePersonal").ToString().ToEntero - ' Dim filtro As String = String.Format(" CvePersonal = '{0}' AND Fecha = '{1}'", CvePersonal, fecha) - - ' Dim AplicaFalta As String = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltraParametros(String.Format(" CveAsistenciasInasistencias = {0} ", DdlAsistenciaInacistencia.SelectedValue))(0)("AplicaFalta").ToString() - - - ' myRow = DtResultados.Select(filtro) - - ' If AplicaFalta = "Aplica" Then - ' myRow(0)("Asistio") = "False" - ' myRow(0)("SalarioDiario") = "0" - ' Else - ' myRow(0)("Asistio") = "True" - ' myRow(0)("SalarioDiario") = "100" - ' End If - - ' myRow(0)("CveAsistenciasInasistencias") = DdlAsistenciaInacistencia.SelectedValue - - ' myRow(0)("TipoCorto") = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltraParametros(String.Format(" CveAsistenciasInasistencias = {0} ", DdlAsistenciaInacistencia.SelectedValue))(0)("TipoCorto").ToString() - - ' RegistraScript("$('#divDetallesDia').modal('hide');") - ' Alert("Actualizado correctamente.") - ' ReprocesarTabla() - ' GvBind() - - 'End Sub - Protected Sub BtnAgregar_Click(sender As Object, e As EventArgs) Handles BtnAgregar.Click Dim objRh As New ClsRH() @@ -2241,89 +2201,10 @@ Partial Class RH_RepChecadorPreAsistencia End If objRh.Dispose() - ''verificar - 'Dim Pendientes As Boolean = False - 'Dim separador() As Char = {"|"c} - 'Dim TipoCorto = "" - 'Dim TempDatos As New DataTable - 'Dim CveAsisteciaInasistencia As Integer - 'Dim DTChecadorRegistros As New DataTable - 'Dim DTAsistenciasInasistencias As New DataTable - - 'Dim objRH As New ClsRH - - 'If objRH.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then - ' DTChecadorRegistros = objRH.DtResultados - 'End If - - 'If objRH.GetPersonalAsistenciaRegistros(FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa) Then - ' DTAsistenciasInasistencias = objRH.DtResultados - 'End If - - 'objRH.Dispose() - - 'For Each Drow As DataRow In DtResultados.Rows - - ' For x As Integer = 0 To DtResultados.Columns.Count - 1 - - - ' If Drow(x).ToString().Trim = "" Then - ' Exit For - ' End If - - ' Dim arrayData As String() = Drow.ToString().Split(separador) - - ' If arrayData.Length < 2 Then - ' Exit For - ' End If - - ' TipoCorto = arrayData(0).ToString() - ' If TipoCorto = "FR" Then - ' TipoCorto = "F" - ' End If - - ' TempDatos = DTAsistenciasInasistencias.FiltraParametros(String.Format(" TipoCorto = '{0}'", TipoCorto)) - - ' If TempDatos.Rows.Count = 1 Then - ' CveAsisteciaInasistencia = DTAsistenciasInasistencias.FiltraParametros(String.Format(" TipoCorto = '{0}' ", TipoCorto))(0)("CveAsistenciasInasistencias").ToString().ToEntero - ' Else - ' CveAsisteciaInasistencia = -1 - ' Pendientes = True - ' End If - ' Next - - - 'Next - - 'If Pendientes = False Then - ' For Each Drow As DataRow In DtResultados.Rows - - ' For x As Integer = 0 To DtResultados.Columns.Count - 1 - ' If Drow(x).ToString().Trim = "" Then - ' Exit For - ' End If - - ' Dim arrayData As String() = Drow.ToString().Split(separador) - - ' If arrayData.Length < 2 Then - ' Exit For - ' End If - ' TipoCorto = arrayData(0).ToString() - ' Next - - ' Next - 'Else - ' Alert("Existen Fechas pendientes de tratar, revisar las fechas que aparecen con simbolo de advertencia en color amarillo.", TipoMensaje.MsgAdvertencia) - 'End If - - ''procesar End Sub - - - Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) If DdlAsistenciaInacistencia.SelectedValue.ToEntero > 0 Then Dim ObjPersonal As New ClsRH @@ -2346,7 +2227,7 @@ Partial Class RH_RepChecadorPreAsistencia End Sub Protected Sub LnkEnviarAsistencia_Click(sender As Object, e As EventArgs) - + EnviarPreAsistencia() 'ValidaEnvioAsistencia 'EnviarAsistencia @@ -2417,78 +2298,73 @@ Partial Class RH_RepChecadorPreAsistencia End Sub Private Sub EnviarAsistencia() - 'Dim DTChecadorRegistros As New DataTable - Dim ObjPersonal As New ClsRH + 'Dim ObjPersonal As New ClsRH - 'If ObjPersonal.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - ' DTChecadorRegistros = ObjPersonal.DtResultados + 'ObjPersonal.IniciaTransacSQL() + 'Dim TieneError As Boolean = False + + 'Dim separador() As Char = {"|"c} + + 'Try + ' For Each GvRow As GridViewRow In GVRegDatos.Rows + + ' Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero + ' Dim NombreCompleto As String = GvRow.DataKey("NombreCompleto") + + ' Dim Fecha As Date = FechaInicioPeriodo + ' For x = 3 To GVRegDatos.Columns.Count - 1 + + ' If GVRegDatos.Columns(x).Visible Then + + ' Dim lnkLinkSender As LinkButton = TryCast(GvRow.Cells(x).Controls(1), LinkButton) + + ' If lnkLinkSender IsNot Nothing Then + ' Dim arrayComands As String() = lnkLinkSender.CommandArgument.Split(separador) + ' Dim TipoCorto = arrayComands(0) + ' Dim Filtro = arrayComands(1) + + ' If TipoCorto.Contiene("_ND", "") Then + ' TieneError = True + ' Exit For + ' Else + ' Dim DTTipoAsistenciaInasistencia As DataTable = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltraParametros(" TipoCorto = '" & TipoCorto & "' ") + + ' Dim CveAsistenciasInasistencias As Integer = DTTipoAsistenciaInasistencia(0)("CveAsistenciasInasistencias").ToString.ToEntero + ' Dim PorcentajePago As Integer = If(DTTipoAsistenciaInasistencia(0)("AplicaPago").ToString = "Aplica", 100, 0) + + ' If CveAsistenciasInasistencias > 0 Then + ' If Not ObjPersonal.AddAsistencia(CvePersonal, -1, DdlSubProyecto.SelectedValue.ToEntero, Fecha, CveAsistenciasInasistencias, PorcentajePago, 0, 0, -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "C") Then + ' TieneError = True + ' Exit For + ' End If + ' Else + ' TieneError = True + ' Exit For + ' End If + ' End If + ' End If + ' End If + ' Fecha = Fecha.AddDays(1) + ' Next + ' If TieneError Then + ' Exit For + ' End If + ' Next + 'Catch ex As Exception + ' TieneError = True + 'End Try + + + 'If TieneError Then + ' ObjPersonal.RollBack() + ' Alert("Se presento un error al enviar asistencia.", TipoMensaje.MsgAdvertencia) + 'Else + ' ObjPersonal.Commit() + ' Alert("Asistencia enviada correctamente.") 'End If - ObjPersonal.IniciaTransacSQL() - Dim TieneError As Boolean = False - - Dim separador() As Char = {"|"c} - - Try - For Each GvRow As GridViewRow In GVRegDatos.Rows - - Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero - Dim NombreCompleto As String = GvRow.DataKey("NombreCompleto") - - Dim Fecha As Date = FechaInicioPeriodo - For x = 3 To GVRegDatos.Columns.Count - 1 - - If GVRegDatos.Columns(x).Visible Then - - Dim lnkLinkSender As LinkButton = TryCast(GvRow.Cells(x).Controls(1), LinkButton) - - If lnkLinkSender IsNot Nothing Then - Dim arrayComands As String() = lnkLinkSender.CommandArgument.Split(separador) - Dim TipoCorto = arrayComands(0) - Dim Filtro = arrayComands(1) - - If TipoCorto.Contiene("_ND", "") Then - TieneError = True - Exit For - Else - Dim DTTipoAsistenciaInasistencia As DataTable = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltraParametros(" TipoCorto = '" & TipoCorto & "' ") - - Dim CveAsistenciasInasistencias As Integer = DTTipoAsistenciaInasistencia(0)("CveAsistenciasInasistencias").ToString.ToEntero - Dim PorcentajePago As Integer = If(DTTipoAsistenciaInasistencia(0)("AplicaPago").ToString = "Aplica", 100, 0) - - 'If CveAsistenciasInasistencias > 0 Then - ' If Not ObjPersonal.AddAsistencia(CvePersonal, -1, DdlSubProyecto.SelectedValue.ToEntero, Fecha, CveAsistenciasInasistencias, PorcentajePago, 0, 0, -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "C") Then - ' TieneError = True - ' Exit For - ' End If - 'Else - ' TieneError = True - ' Exit For - 'End If - End If - End If - End If - Fecha = Fecha.AddDays(1) - Next - If TieneError Then - Exit For - End If - Next - Catch ex As Exception - TieneError = True - End Try - - - If TieneError Then - ObjPersonal.RollBack() - Alert("Se presento un error al enviar asistencia.", TipoMensaje.MsgAdvertencia) - Else - ObjPersonal.Commit() - Alert("Asistencia enviada correctamente.") - End If - - ObjPersonal.Dispose() + 'ObjPersonal.Dispose() End Sub Protected Sub LnkCargaMasiva_Click(sender As Object, e As EventArgs) @@ -2497,7 +2373,7 @@ Partial Class RH_RepChecadorPreAsistencia Dim Enviado As Boolean = PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero) If Enviado Then - Alert("El periodo ya ha sido enviado.", TipoMensaje.MsgAdvertencia) + Alert($"La información del periodo {DdlPeriodo.SelectedItem.Text} ya fue enviada a la pre nómina, esta información ya está bloqueda y si hay ajustes estos se deberán de hacer en pre nóminas") Else DVEnvioMasivo.Visible = True End If @@ -2505,9 +2381,6 @@ Partial Class RH_RepChecadorPreAsistencia VerChkSeleccionPersonal = True UpDatos.Update() - - - GvBind() End Sub @@ -2555,7 +2428,7 @@ Partial Class RH_RepChecadorPreAsistencia Dim Enviado As Boolean = PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero) If Enviado Then - Alert($"El periodo {DdlPeriodo.SelectedItem.Text} ya fue enviado.", TipoMensaje.MsgAdvertencia) + Alert($"La información del periodo {DdlPeriodo.SelectedItem.Text} ya fue enviada a la pre nómina, esta información ya está bloqueda y si hay ajustes estos se deberán de hacer en pre nóminas") Exit Sub End If @@ -2597,7 +2470,7 @@ Partial Class RH_RepChecadorPreAsistencia If ProcesoOK Then 'ProcesoOK = - adasd + End If If ProcesoOK Then @@ -2612,6 +2485,173 @@ Partial Class RH_RepChecadorPreAsistencia Private Sub EnviarPreAsistencia() + If Not DdlPeriodo.SelectedValue.ToEntero > 0 Then + Exit Sub + End If + + If PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero) Then + Alert($"La información del periodo {DdlPeriodo.SelectedItem.Text} ya fue enviada a la pre nómina, esta información ya está bloqueda y si hay ajustes estos se deberán de hacer en pre nóminas") + Exit Sub + End If + + + + Dim objRH As New ClsRH + Dim objGrales As New ClsGenerales + Dim DTDatos As New DataTable + Dim DtPersonal As New DataTable + Dim DTHorarioPersonal As DataTable + Dim DtVacaciones As New DataTable + + Dim RetrasosMaximos As Integer = 3 + Dim dt As New DataTable + + Dim Retardos As Integer = 0 + Dim DTPreAsistenciasInasistencias As New DataTable + Dim DTChecadorRegistros As New DataTable + Dim DTHorarios As New DataTable + Dim DTDiasInhabiles As New DataTable + Dim DTTipoPeriodo As New DataTable + Dim DTAsistenciasInasistenciasReg As New DataTable + + Dim CveChecadorHorario As Integer = -1 + Dim TolRetAcumulados As Integer = 0 + Dim TolRetEntradaMin As Integer = 0 + Dim TolFalEntradaMin As Integer = 0 + Dim RetSalidaAntes As Boolean = True + Dim TolSalidaAntesMin As Integer = 0 + + Dim CveASistenciaInasistenciaAsistio As Integer = -1 + Dim CveAsistenciaInasistenciaFalta As Integer = -1 + Dim CveAsistenciaInasistenciaRetardo As Integer = -1 + Dim CveAsistenciaInasistenciaDescanso As Integer = -1 + + Try + CveASistenciaInasistenciaAsistio = GlobalDTAsistenciasInasistencias(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(" TipoCorto = 'A'")(0)("CveAsistenciasInasistencias").ToString().ToEntero + CveAsistenciaInasistenciaFalta = GlobalDTAsistenciasInasistencias(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(" TipoCorto = 'F'")(0)("CveAsistenciasInasistencias").ToString().ToEntero + CveAsistenciaInasistenciaRetardo = GlobalDTAsistenciasInasistencias(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(" TipoCorto = 'R' ")(0)("CveAsistenciasInasistencias").ToString().ToEntero + CveAsistenciaInasistenciaDescanso = GlobalDTAsistenciasInasistencias(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(" TipoCorto = 'D' ")(0)("CveAsistenciasInasistencias").ToString().ToEntero + + Catch ex As Exception + Alert("Se presento un error al obtener las claves de asistencia.", TipoMensaje.MsgError) + Exit Sub + End Try + + GeneraFechasInicioFinPerdiodo() + + DiasPeriodo = (FechaFinPeriodo - FechaInicioPeriodo).TotalDays.ToEntero + 1 + Dim objNom As New ClsNominas + + If objNom.GetTiposPeriodos() Then + DdlTipoPeriodo.DataSource = objNom.DtResultados + DTTipoPeriodo = objNom.DtResultados + End If + + objNom.Dispose() + + If objGrales.DiasInhabiles_Get(-1, 1, UsuarioActual.CveEmpresa) Then + DTDiasInhabiles = objGrales.DtResultados + End If + + objGrales.Dispose() + + Dim Resultados As New DataTable + + Resultados.Columns.Add("CvePersonal") + Resultados.Columns.Add("NombreCompleto") + Resultados.Columns.Add("Codigo") + Resultados.Columns.Add("CveSubProyecto") + Resultados.Columns.Add("SalarioDiario") + Resultados.Columns.Add("CveAsistenciasInasistencias") + Resultados.Columns.Add("PorcentajePago") + Resultados.Columns.Add("Fecha") + Resultados.Columns.Add("Asistio") + Resultados.Columns.Add("Retraso") + Resultados.Columns.Add("Inconsistencia") + Resultados.Columns.Add("Descanso") + Resultados.Columns.Add("Entrada") + Resultados.Columns.Add("Salida") + Resultados.Columns.Add("FaltaRetraso") + Resultados.Columns.Add("DiaInhabil") + Resultados.Columns.Add("FaltaPorRetrasos") + Resultados.Columns.Add("Mensaje") + Resultados.Columns.Add("FaltaRetardosAcumulados") + Resultados.Columns.Add("DiaInhabilStr") + Resultados.Columns.Add("DiaVacacion") + Resultados.Columns.Add("TipoCorto") + Resultados.Columns.Add("Sancion") + + Resultados.Columns.Add("HorasDobles", GetType(Decimal)) + Resultados.Columns.Add("HorasTriples", GetType(Decimal)) + Resultados.Columns.Add("CveMotivoHoraExtra", GetType(Integer)) + Resultados.Columns.Add("Observacion") + + + Dim DtTempPeriodo As DataTable = DTPeriodos.FiltraParametros("CvePeriodo = " & DdlPeriodo.SelectedValue.ToEntero) + Dim FechaInicioPeriodoFiltro = DtTempPeriodo(0)("FechaInicio").ToString().ToDate + + Dim FilCveDepartamento As Integer = DdlDepartamento.SelectedValue.ToEntero + + Dim FilasFiltradas = From fila In GlobalDTRHPersonal(UsuarioActual.Empresa.CveEmpresa).AsEnumerable() + Let Inicio = fila.Field(Of Date)("FechaInicio") + Let FechaFinOriginal = fila.Field(Of Date?)("FechaFin") + Let FechaFin = If(FechaFinOriginal.HasValue, FechaFinOriginal.Value, Now) + Where Inicio <= FechaInicioPeriodoFiltro AndAlso FechaInicioPeriodoFiltro <= FechaFin + Select fila + + DtPersonal = FilasFiltradas.CopyToDataTable() + + + + If objRH.ChecadorHorariosGet(-1, 1, UsuarioActual.Empresa.CveEmpresa) Then + DTHorarios = objRH.DtResultados + + If DdlTurno.SelectedIndex > 0 Then + Dim DTTemp As DataTable = GlobalDTTurno(UsuarioActual.CveEmpresa).FiltraParametros("CveTurno = " & DdlTurno.SelectedValue) + Dim TMCveChecadorHorario As Integer = -1 + + If DTTemp.Rows.Count > 0 Then + TMCveChecadorHorario = DTTemp(0)("CveChecadorHorario").ToString().ToEntero + Dim DtHorarioTemp = DTHorarios.FiltraParametros("CveChecadorHorario = " & TMCveChecadorHorario) + + If DtHorarioTemp.Rows.Count > 0 Then + TolRetAcumulados = DtHorarioTemp(0)("TolRetAcumulados").ToString().ToEntero + TolRetEntradaMin = DtHorarioTemp(0)("TolRetEntradaMin").ToString().ToEntero + TolFalEntradaMin = DtHorarioTemp(0)("TolFalEntradaMin").ToString().ToEntero + RetSalidaAntes = Boolean.Parse(DtHorarioTemp(0)("RetSalidaAntes").ToString()) + TolSalidaAntesMin = DtHorarioTemp(0)("TolSalidaAntesMin").ToString().ToEntero + End If + End If + Else + If DTHorarios.Rows.Count > 0 Then + TolRetAcumulados = DTHorarios(0)("TolRetAcumulados").ToString().ToEntero + TolRetEntradaMin = DTHorarios(0)("TolRetEntradaMin").ToString().ToEntero + TolFalEntradaMin = DTHorarios(0)("TolFalEntradaMin").ToString().ToEntero + RetSalidaAntes = Boolean.Parse(DTHorarios(0)("RetSalidaAntes").ToString()) + TolSalidaAntesMin = DTHorarios(0)("TolSalidaAntesMin").ToString().ToEntero + End If + End If + + End If + + If objRH.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, False) Then + DTChecadorRegistros = objRH.DtResultados + End If + + If objRH.VacacionesGet(-1, UsuarioActual.Empresa.CveEmpresa, FechaInicioPeriodo, FechaFinPeriodo) Then + DtVacaciones = objRH.DtResultados + End If + + If objRH.GetPersonalPreAsistenciaRegistros(FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa) Then + DTPreAsistenciasInasistencias = objRH.DtResultados + End If + + If objRH.ChecadorPreAsistenciaRegistrosAsistenciasGet(CveTipoPeriodo, FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.Empresa.CveEmpresa) Then + DTAsistenciasInasistenciasReg = objRH.DtResultados + End If + + objRH.Dispose() + For Each dRow As DataRow In DtPersonal.Rows @@ -2710,10 +2750,8 @@ Partial Class RH_RepChecadorPreAsistencia ReRow("Observacion") = DTPreasistencia.Rows(0)("Observacion").ToString ReRow("PorcentajePago") = DTPreasistencia.Rows(0)("PorcentajePago").ToString.ToDecimal - End If - If ReRow("CveAsistenciasInasistencias").ToString.ToEntero > 0 Then Dim drowAsistenciaInasistencia As DataRow = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltroPrimero($"CveAsistenciasInasistencias={ReRow("CveAsistenciasInasistencias").ToString.ToEntero}") @@ -2862,15 +2900,8 @@ Partial Class RH_RepChecadorPreAsistencia End If - - End If - - - 'adasdasd - - Resultados.Rows.Add(ReRow) Fecha = Fecha.AddDays(1) @@ -2971,5 +3002,303 @@ Partial Class RH_RepChecadorPreAsistencia Next + + + 'DtResultados = Resultados + + dt.Columns.Add("CvePersonal") + dt.Columns.Add("Codigo") + dt.Columns.Add("NombreCompleto") + dt.Columns.Add("Fecha1") + dt.Columns.Add("Fecha2") + dt.Columns.Add("Fecha3") + dt.Columns.Add("Fecha4") + dt.Columns.Add("Fecha5") + dt.Columns.Add("Fecha6") + dt.Columns.Add("Fecha7") + dt.Columns.Add("Fecha8") + dt.Columns.Add("Fecha9") + dt.Columns.Add("Fecha10") + dt.Columns.Add("Fecha11") + dt.Columns.Add("Fecha12") + dt.Columns.Add("Fecha13") + dt.Columns.Add("Fecha14") + dt.Columns.Add("Fecha15") + dt.Columns.Add("Fecha16") + dt.Columns.Add("Fecha17") + dt.Columns.Add("Fecha18") + dt.Columns.Add("Fecha19") + dt.Columns.Add("Fecha20") + dt.Columns.Add("Fecha21") + dt.Columns.Add("Fecha22") + dt.Columns.Add("Fecha23") + dt.Columns.Add("Fecha24") + dt.Columns.Add("Fecha25") + dt.Columns.Add("Fecha26") + dt.Columns.Add("Fecha27") + dt.Columns.Add("Fecha28") + dt.Columns.Add("Fecha29") + dt.Columns.Add("Fecha30") + dt.Columns.Add("Fecha31") + + + Dim DTFechas As DataTable + Dim DTUPersonal As DataTable + + Dim DTVFechas As New DataView(Resultados) + DTFechas = DTVFechas.ToTable(True, "Fecha") + DTUPersonal = DTVFechas.ToTable(True, {"CvePersonal", "NombreCompleto"}) + + Dim ColumN As Integer = (dt.Columns.Count) - 2 + + For x As Integer = 3 To dt.Columns.Count - 1 + GVRegDatos.Columns(x).HeaderText = "" + GVRegDatos.Columns(x).Visible = False + Next + UpDatos.Update() + + ColumN = 3 + + For Each drow As DataRow In DTFechas.Rows + GVRegDatos.Columns(ColumN).HeaderText = String.Format("
    {1}
    {0}
    ", drow(0).ToString().ToDate.ToString("dd/MM/yyyy"), ObtenerDiaSemana(drow(0).ToString().ToDate)) + GVRegDatos.Columns(ColumN).Visible = True + ColumN = ColumN + 1 + Next + + Dim medida As DateTime = NowADS() + + Dim sbErrores As New StringBuilder + Dim TieneInconsistencias As Boolean = False + + For Each pRow As DataRow In DtPersonal.Rows + + Dim RRow As DataRow = dt.NewRow + RRow("CvePersonal") = pRow("CvePersonal") + RRow("NombreCompleto") = pRow("NombreCompleto") + RRow("Codigo") = pRow("Codigo") + + ColumN = 3 + + Dim ResumenDia As New DataTable + Dim DTTempAsistencias As New DataTable + Dim filtro As String + Dim TipoCorto As String = "" + + For Each drow As DataRow In DTFechas.Rows + + filtro = " CvePersonal = " & pRow("CvePersonal").ToString() & " AND Fecha ='" & drow(0).ToString() & $"'" + ResumenDia = Resultados.FiltraParametros(filtro) + filtro = filtro & $"|{ResumenDia(0)("HorasDobles").ToString}|{ResumenDia(0)("HorasTriples").ToString}|{ResumenDia(0)("CveMotivoHoraExtra").ToString}|{ResumenDia(0)("Observacion").ToString}|{ResumenDia(0)("PorcentajePago").ToString}" + + TipoCorto = "" + + 'If RdbChecador.Checked Then + + RRow(ColumN) = "-" + + If ResumenDia(0)("TipoCorto").ToString().Contiene("_ND") Then + sbErrores.Append($"{pRow("Codigo")} Fecha: {drow(0).ToString().ToDate.ToString("dd/MM/yyyy")} Incidencia no definida
    ") + TieneInconsistencias = True + End If + + If ResumenDia(0)("TipoCorto").ToString().Length > 0 Then + + RRow(ColumN) = $"{ResumenDia(0)("TipoCorto").ToString()}|" & filtro + + Else + + + If ResumenDia(0)("Asistio").ToString() = "True" Or ResumenDia(0)("TipoCorto").ToString() = "A" Then + RRow(ColumN) = "A|" & filtro + End If + + If ResumenDia(0)("DiaVacacion").ToString() = "True" Or ResumenDia(0)("TipoCorto").ToString() = "V" Then + RRow(ColumN) = "V|" & filtro + End If + + If ResumenDia(0)("Asistio").ToString() = "False" Or ResumenDia(0)("TipoCorto").ToString() = "F" Then + RRow(ColumN) = "F|" & filtro + End If + + If ResumenDia(0)("Retraso").ToString() = "True" Or ResumenDia(0)("TipoCorto").ToString() = "R" Then + RRow(ColumN) = "R|" & filtro + End If + + If ResumenDia(0)("FaltaRetraso").ToString() = "True" Or TipoCorto = "FR" Then + RRow(ColumN) = "FR|" & filtro + End If + + If ResumenDia(0)("Descanso").ToString() = "True" Or ResumenDia(0)("DiaInhabil").ToString() = "True" Then + RRow(ColumN) = "D|" & filtro + End If + + If ResumenDia(0)("Inconsistencia").ToString() = "True" Then + RRow(ColumN) = "IN|" & filtro + If ResumenDia(0)("Descanso").ToString() = "True" Then + RRow(ColumN) = "IND|" & filtro + End If + End If + + End If + + + 'Else + + ' DTTempAsistencias = DTAsistenciasInasistenciasReg.FiltraParametros(filtro) + ' If DTTempAsistencias.Rows.Count > 0 Then + ' TipoCorto = DTTempAsistencias(0)("TipoCorto").ToString() + ' Else + ' TipoCorto = "F" + ' End If + + ' RRow(ColumN) = "" & TipoCorto & "|" & filtro + + 'End If + + ColumN = ColumN + 1 + + Next + + ResumenDia.Dispose() + DTTempAsistencias.Dispose() + + dt.Rows.Add(RRow) + + Next + + + Dim SalidaTiempo As Integer = (NowADS() - medida).TotalSeconds.ToString().ToEntero + SalidaTiempo = SalidaTiempo + + + + 'DtDatosTabla = dt + + If TieneInconsistencias Then + Alert(sbErrores.ToString, TipoMensaje.MsgAdvertencia) + Exit Sub + Else + + Dim ProcesoOK As Boolean = True + Dim separador() As Char = {"|"c} + + Dim ObjPersonal As New ClsRH + ObjPersonal.IniciaTransacSQL() + + For Each dRowPersonal As DataRow In dt.Rows + + Dim CvePersonal As Integer = dRowPersonal(0).ToString.ToEntero + ColumN = 3 + + For Each drow As DataRow In DTFechas.Rows + Try + Dim Fecha As Date = drow(0).ToString.ToDate + Dim dato As String() = dRowPersonal(ColumN).ToString.Split(separador) + + Dim DTTipoAsistenciaInasistencia As DataTable = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltraParametros(" TipoCorto = '" & dato(0) & "' ") + Dim CveAsistenciasInasistencias As Integer = DTTipoAsistenciaInasistencia(0)("CveAsistenciasInasistencias").ToString.ToEntero + + Dim HorasDobles As Decimal = dato(2).ToDecimal + Dim HorasTriples As Decimal = dato(3).ToDecimal + Dim CveMotivoHoraExtra As Integer = dato(4).ToEntero + Dim Observaciones As String = dato(5) + Dim PorcentajePago As Decimal = dato(6).ToDecimal + + If CveAsistenciasInasistencias > 0 Then + If Not ObjPersonal.AddAsistencia(CvePersonal, -1, -1, Fecha, CveAsistenciasInasistencias, PorcentajePago, HorasDobles, HorasTriples, CveMotivoHoraExtra, Observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "C") Then + ProcesoOK = False + Exit For + End If + Else + ProcesoOK = False + Exit For + End If + Catch ex As Exception + ProcesoOK = False + End Try + + ColumN = ColumN + 1 + Next + If Not ProcesoOK Then + Exit For + End If + Next + + + If ProcesoOK Then + Dim ObjNomEnvio As New ClsNominas(ObjPersonal.IniciaTransacSQL) + If Not ObjNomEnvio.UpdatePeriodoEnvioPrenomina(DdlPeriodo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, True) Then + ProcesoOK = False + End If + + End If + + If ProcesoOK Then + ObjPersonal.Commit() + Alert("Asistencia enviada correctamente.") + Else + ObjPersonal.RollBack() + Alert("Se presento un error al enviar asistencia.", TipoMensaje.MsgAdvertencia) + End If + + ObjPersonal.Dispose() + + End If + + End Sub + + Protected Sub LnkDescargaExcel_Click(sender As Object, e As EventArgs) + + Dim SubProyecto As String = "" + + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + SubProyecto = DdlSubProyecto.SelectedItem.Text + End If + + Dim SbFiltros As New StringBuilder() + SbFiltros.AppendFormat("Periodo: {0}, Sub Proyecto: {1}, Departamento: {2}", DdlPeriodo.SelectedItem.Text, SubProyecto, DdlDepartamento.SelectedItem.Text) + + Dim Gv As New GridView + Gv = GVRegDatos + + For Each gvRow As GridViewRow In Gv.Rows + + Dim x As Integer = 3 + For x = 3 To Gv.Columns.Count - 1 + If Gv.Columns(x).Visible = True Then + + Dim Lnk As LinkButton = gvRow.FCLinkButton($"LnkFecha{(x - 2)}") + Dim separador() As Char = {"|"c} + Dim dato As String() = Lnk.CommandArgument.Split(separador) + + If dato(0) = "_ND" Then + gvRow.Cells(x).Text = "Inconsistencia" + Else + Dim DTTipoAsistenciaInasistencia As DataTable = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltraParametros(" TipoCorto = '" & dato(0) & "' ") + + If DTTipoAsistenciaInasistencia IsNot Nothing AndAlso DTTipoAsistenciaInasistencia.Rows.Count > 0 Then + Dim Tipo As String = DTTipoAsistenciaInasistencia(0)("Tipo").ToString + gvRow.Cells(x).Text = Tipo + End If + End If + + + + + + End If + Next + + Next + + Gv.ExportToExcelGembox("PreAsistencia", UsuarioActual, $"Pre Asistencia {DdlPeriodo.SelectedItem.Text}", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) + + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub + + End Class \ No newline at end of file