Files
SIG/RH/Personal.aspx.vb

8014 lines
365 KiB
VB.net

Option Explicit On
Option Strict On
Imports Extensiones
'Imports System.Runtime.InteropServices
Imports System.IO
'Imports Word = Microsoft.Office.Interop.Word
Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports System.Globalization
Imports System.Xml
Imports System.Web.Script.Services
Partial Class RH_Personal
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Property salarioVariable As Decimal
Get
If ViewState("salarioVariable") Is Nothing Then
Return 0
Else
Return DirectCast(ViewState("salarioVariable"), Decimal)
End If
End Get
Set(value As Decimal)
ViewState("salarioVariable") = value
End Set
End Property
Property CcveMovtoPermanente As Integer
Get
If ViewState("CcveMovtoPermanente") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CcveMovtoPermanente"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CcveMovtoPermanente") = value
End Set
End Property
Property CveFonacot As Integer
Get
If ViewState("CveFonacot") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveFonacot"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveFonacot") = value
End Set
End Property
Private Property DTCuentasBancos As DataTable
Get
Return CType(ViewState("DTCuentasBancos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTCuentasBancos") = value
End Set
End Property
Private Property DTLicencias As DataTable
Get
Return CType(ViewState("DTLicencias"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTLicencias") = value
End Set
End Property
Private Property TempDTCuentasBancos As DataTable
Get
Return CType(ViewState("TempDTCuentasBancos"), DataTable)
End Get
Set(value As DataTable)
ViewState("TempDTCuentasBancos") = value
End Set
End Property
Private Property DTDocumentacion As DataTable
Get
If ViewState("DTDocumentacion") Is Nothing Then
Return New DataTable
Else
Return DirectCast(ViewState("DTDocumentacion"), DataTable)
End If
End Get
Set(value As DataTable)
ViewState("DTDocumentacion") = value
End Set
End Property
Private Property DTDocumentacionFiscal As DataTable
Get
If ViewState("DTDocumentacionFiscal") Is Nothing Then
Return New DataTable
Else
Return DirectCast(ViewState("DTDocumentacionFiscal"), DataTable)
End If
End Get
Set(value As DataTable)
ViewState("DTDocumentacionFiscal") = value
End Set
End Property
Property NombreCompleto As String
Get
If ViewState("NombreCompleto") Is Nothing Then
Return ""
Else
Return ViewState("NombreCompleto").ToString()
End If
End Get
Set(value As String)
ViewState("NombreCompleto") = value
End Set
End Property
Property CredencialElector As String
Get
If ViewState("CredencialElector") Is Nothing Then
Return "-1"
Else
Return ViewState("CredencialElector").ToString()
End If
End Get
Set(value As String)
ViewState("CredencialElector") = value
End Set
End Property
Property Documentacion As String
Get
If ViewState("Documentacion") Is Nothing Then
Return "-1"
Else
Return ViewState("Documentacion").ToString()
End If
End Get
Set(value As String)
ViewState("Documentacion") = value
End Set
End Property
Property CveCuentaDeposito As Integer
Get
If ViewState("CveCuentaDeposito") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveCuentaDeposito"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveCuentaDeposito") = value
End Set
End Property
Property CveDocumentacion As Integer
Get
If ViewState("CveDocumentacion") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveDocumentacion"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveDocumentacion") = value
End Set
End Property
Property CveDocumentacionElectronica As Integer
Get
If ViewState("CvePersonalClienteDocumentacion") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CvePersonalClienteDocumentacion"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CvePersonalClienteDocumentacion") = value
End Set
End Property
Property ActualizarDocumentacion As Boolean
Get
If ViewState("ActualizarDocumentacion") Is Nothing Then
Return True
Else
Return DirectCast(ViewState("ActualizarDocumentacion"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("ActualizarDocumentacion") = value
End Set
End Property
Private Property FechaLimite As Date
Get
If ViewState("FechaLimite") Is Nothing Then
Return Date.Now.AddDays(15)
Else
Return ViewState("FechaLimite").ToString().ToDate
End If
End Get
Set(value As Date)
ViewState("FechaLimite") = value
End Set
End Property
Property Estatus As Integer
Get
If ViewState("Estatus") Is Nothing Then
Return 0
Else
Return DirectCast(ViewState("Estatus"), Integer)
End If
End Get
Set(value As Integer)
ViewState("Estatus") = value
End Set
End Property
Property ObservacionDocumentacion As String
Get
If ViewState("ObservacionDocumentacion") Is Nothing Then
Return ""
Else
Return ViewState("ObservacionDocumentacion").ToString()
End If
End Get
Set(value As String)
ViewState("ObservacionDocumentacion") = value
End Set
End Property
Property AdjuntoDocumentacion As String
Get
If ViewState("AdjuntoDocumentacion") Is Nothing Then
Return ""
Else
Return ViewState("AdjuntoDocumentacion").ToString()
End If
End Get
Set(value As String)
ViewState("AdjuntoDocumentacion") = value
End Set
End Property
Private ReadOnly Property CvePersonal As Integer
Get
If ViewState("CvePersonal") Is Nothing Then
Return -1
Else
Return ViewState("CvePersonal").ToString().ToEntero()
End If
End Get
End Property
Private Property dtNomConceptos As Data.DataTable
Get
Return CType(ViewState("dtNomConceptos"), DataTable)
End Get
Set(value As Data.DataTable)
ViewState("dtNomConceptos") = value
End Set
End Property
Private Property DtCuentasContables As Data.DataTable
Get
Return CType(ViewState("DtCuentasContables"), DataTable)
End Get
Set(value As Data.DataTable)
ViewState("DtCuentasContables") = value
End Set
End Property
Private ReadOnly Property SendMail As String
Get
Return ViewState("SendMail").ToString()
End Get
End Property
Private ReadOnly Property SendMailPassword As String
Get
Return ViewState("SendMailPassword").ToString()
End Get
End Property
Private ReadOnly Property CveUniforme As Integer
Get
If ViewState("CveUniforme") Is Nothing Then
Return -1
Else
Return ViewState("CveUniforme").ToString().ToEntero()
End If
End Get
End Property
Private Property DTConsumos As DataTable
Get
Return CType(ViewState("DTConsumos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTConsumos") = value
End Set
End Property
Private Property DTViaticosDetalle As DataTable
Get
Return CType(ViewState("DTViaticosDetalle"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTViaticosDetalle") = value
End Set
End Property
Private Property DTGastosSinComp As DataTable
Get
Return CType(ViewState("DTGastosSinComp"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTGastosSinComp") = value
End Set
End Property
Private Property DTGastosPorCheque As DataTable
Get
Return CType(ViewState("DTGastosPorCheque"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTGastosPorCheque") = value
End Set
End Property
Private Property CvePersonalEstatusInicial As Integer
Get
If ViewState("CvePersonalEstatusInicial") Is Nothing Then
Return -1
Else
Return ViewState("CvePersonalEstatusInicial").ToString().ToEntero()
End If
End Get
Set(value As Integer)
ViewState("CvePersonalEstatusInicial") = value
End Set
End Property
Private Property UniformesInfo As DataTable
Get
Return CType(ViewState("UniformesInfo"), DataTable)
End Get
Set(value As DataTable)
ViewState("UniformesInfo") = value
End Set
End Property
Private Property CveAlmacenUniforme As Integer
Get
Return CInt(ViewState("CveAlmacenUniforme"))
End Get
Set(value As Integer)
ViewState("CveAlmacenUniforme") = value
End Set
End Property
Private Property CveSeccionAlmacenUniforme As Integer
Get
Return CInt(ViewState("CveSeccionAlmacenUniforme"))
End Get
Set(value As Integer)
ViewState("CveSeccionAlmacenUniforme") = value
End Set
End Property
Private Property DescripcionUniforme As String
Get
Return CStr(ViewState("DescripcionUniforme"))
End Get
Set(value As String)
ViewState("DescripcionUniforme") = value
End Set
End Property
Private Property CveUM As Integer
Get
Return CInt(ViewState("CveUM"))
End Get
Set(value As Integer)
ViewState("CveUM") = value
End Set
End Property
Private Property CvePS As Integer
Get
Return CInt(ViewState("CvePS"))
End Get
Set(value As Integer)
ViewState("CvePS") = value
End Set
End Property
Private Property PU As Decimal
Get
Return ViewState("PU").ToString.ToDecimal
End Get
Set(value As Decimal)
ViewState("PU") = value
End Set
End Property
Private Property CveMovimientoUniforme As Integer
Get
Return CInt(ViewState("CveMovimientoUniforme"))
End Get
Set(value As Integer)
ViewState("CveMovimientoUniforme") = value
End Set
End Property
Private Property CveMovimientoDetalleUniforme As Integer
Get
Return CInt(ViewState("CveMovimientoDetalleUniforme"))
End Get
Set(value As Integer)
ViewState("CveMovimientoDetalleUniforme") = value
End Set
End Property
#End Region
#Region "V A C A C I O N E S - P E R M I S O S"
Private Property VacInicioPeriodo As Date
Get
If ViewState("VacInicioPeriodo") Is Nothing Then
Return Now
Else
Return DirectCast(ViewState("VacInicioPeriodo"), Date)
End If
End Get
Set(value As Date)
ViewState("VacInicioPeriodo") = value
End Set
End Property
Private Property VacFinPeriodo As Date
Get
If ViewState("VacFinPeriodo") Is Nothing Then
Return Now
Else
Return DirectCast(ViewState("VacFinPeriodo"), Date)
End If
End Get
Set(value As Date)
ViewState("VacFinPeriodo") = value
End Set
End Property
Private Property VacAnios As Integer
Get
If ViewState("VacAnios") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("VacAnios"), Integer)
End If
End Get
Set(value As Integer)
ViewState("VacAnios") = value
End Set
End Property
Private Property VacDias As Integer
Get
If ViewState("VacDias") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("VacDias"), Integer)
End If
End Get
Set(value As Integer)
ViewState("VacDias") = value
End Set
End Property
Private Property VacDiasUsados As Integer
Get
If ViewState("VacDiasUsados") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("VacDiasUsados"), Integer)
End If
End Get
Set(value As Integer)
ViewState("VacDiasUsados") = value
End Set
End Property
Private Property VacDiasCancelados As Integer
Get
If ViewState("VacDiasCancelados") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("VacDiasCancelados"), Integer)
End If
End Get
Set(value As Integer)
ViewState("VacDiasCancelados") = value
End Set
End Property
Private Property VacDiasDisponibles As Integer
Get
If ViewState("VacDiasDisponibles") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("VacDiasDisponibles"), Integer)
End If
End Get
Set(value As Integer)
ViewState("VacDiasDisponibles") = value
End Set
End Property
Private Property VacSupervisorNombre As String
Get
If ViewState("VacSupervisorNombre") Is Nothing Then
Return ""
Else
Return ViewState("VacSupervisorNombre").ToString()
End If
End Get
Set(value As String)
ViewState("VacSupervisorNombre") = value
End Set
End Property
Private Property VacSupervisorCorreo As String
Get
If ViewState("VacSupervisorCorreo") Is Nothing Then
Return ""
Else
Return ViewState("VacSupervisorCorreo").ToString()
End If
End Get
Set(value As String)
ViewState("VacSupervisorCorreo") = value
End Set
End Property
Private Property VacCveSupervisor As Integer
Get
If ViewState("VacCveSupervisor") Is Nothing Then
Return -1
Else
Return ViewState("VacCveSupervisor").ToString().ToEntero()
End If
End Get
Set(value As Integer)
ViewState("VacCveSupervisor") = value
End Set
End Property
Private Property VacFolioActual As Integer
Get
If ViewState("VacFolioActual") Is Nothing Then
Return 0
Else
Return DirectCast(ViewState("VacFolioActual"), Integer)
End If
End Get
Set(value As Integer)
ViewState("VacFolioActual") = value
End Set
End Property
Private Property CvePersonalVacaciones As Integer
Get
If ViewState("CvePersonalVacaciones") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CvePersonalVacaciones"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CvePersonalVacaciones") = value
End Set
End Property
Private Property VacDiaActivo As Boolean
Get
If ViewState("VacDiaActivo") Is Nothing Then
Return False
Else
Return DirectCast(ViewState("VacDiaActivo"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("VacDiaActivo") = value
End Set
End Property
Private Property VacFolio As Integer
Get
If ViewState("VacFolio") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("VacFolio"), Integer)
End If
End Get
Set(value As Integer)
ViewState("VacFolio") = value
End Set
End Property
Private Property CvePermiso As Integer
Get
If ViewState("CvePermiso") Is Nothing Then
Return -1
Else
Return ViewState("CvePermiso").ToString().ToEntero()
End If
End Get
Set(value As Integer)
ViewState("CvePermiso") = value
End Set
End Property
#End Region
#Region "PROPIEDADES FAMILIARES"
Private Property ActualizarFamiliar As Boolean
Get
If ViewState("ActualizarFamiliar") Is Nothing Then
Return True
Else
Return DirectCast(ViewState("ActualizarFamiliar"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("ActualizarFamiliar") = value
End Set
End Property
Private Property CveFamiliar As Integer
Get
If ViewState("CveFamiliar") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("CveFamiliar"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CveFamiliar") = value
End Set
End Property
Private Property IndexActual As Integer
Get
If ViewState("IndexActual") Is Nothing Then
Return -1
Else
Return DirectCast(ViewState("IndexActual"), Integer)
End If
End Get
Set(value As Integer)
ViewState("IndexActual") = value
End Set
End Property
Property DTFamiliares As DataTable
Get
Return DirectCast(ViewState("DTFamiliares"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTFamiliares") = value
End Set
End Property
Private Property ValPadre As Boolean
Get
If ViewState("ValPadre") Is Nothing Then
Return False
Else
Return DirectCast(ViewState("ValPadre"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("ValPadre") = value
End Set
End Property
Private Property ValMadre As Boolean
Get
If ViewState("ValMadre") Is Nothing Then
Return False
Else
Return DirectCast(ViewState("ValMadre"), Boolean)
End If
End Get
Set(value As Boolean)
ViewState("ValMadre") = value
End Set
End Property
Private Property DocumentoParametros As String
Get
If ViewState("DocumentoParametros") Is Nothing Then
Return ""
Else
Return ViewState("DocumentoParametros").ToString
End If
End Get
Set(value As String)
ViewState("DocumentoParametros") = value
End Set
End Property
#End Region
Private Shared Function sendURL(ByVal URL As String, Optional Methodo As String = "POST", Optional Cookie As String = "", Optional maxTimeMilliseconds As Integer = 120000) As String
Dim resultado As String = ""
Try
Dim request As Net.HttpWebRequest = CType(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
request.Timeout = maxTimeMilliseconds
request.Method = Methodo
request.ContentType = "text/html; charset=utf-8" '"text/xml; charset=utf-8"
If Not String.IsNullOrEmpty(Cookie) Then
request.Headers.Add("Cookie", Cookie)
End If
'Using stream As IO.Stream = request.GetRequestStream()
' Using stmw As IO.StreamWriter = New IO.StreamWriter(stream)
' stmw.Write("")
' End Using
'End Using
Dim response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse)
Dim sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream())
resultado = sr.ReadToEnd()
sr.Close()
Catch ex As Exception
ex.ToString().GuardaLog()
'Extenciones.ApplicationParameter.GuardaLogEx(ex, $"SOAPAction : {SOAPAction} XML : {xml}")
End Try
Return resultado
End Function
'<ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Json)>
<System.Web.Services.WebMethod()>
Public Shared Function gettingCURP(ByVal Curp As String, year As Integer) As String
Dim abc As String() = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
Dim numeric01 As String() = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
Dim rule1 As String() = If(year < 2000, numeric01, abc)
Dim curpresult As String = ""
Dim i As Integer = 0
While Curp.Length = 0 AndAlso i < rule1.Length
Dim z As Integer = 0
While Curp.Length = 0 AndAlso z < numeric01.Length
curpresult = String.Format("{0}{1}{2}", Curp, rule1(i), numeric01(z))
Dim respuesta As String = sendURL(String.Format("http://www.renapo.sep.gob.mx/wsrenapo/MainControllerParam?curp={0}", curpresult), "GET")
Dim trlines As New List(Of String)
Dim keydict As New System.Collections.Concurrent.ConcurrentDictionary(Of String, String)
Dim indexttr As Integer = 0
Dim indexttrB As Integer = 0
Dim indexttd As Integer = 0
Dim indextdiv As Integer = 0
Dim indexinittext As Integer = 0
While Not IsNothing(respuesta) AndAlso respuesta.Length > 0
indexttr = respuesta.IndexOf("<tr")
If indexttr >= 0 Then
indexttrB = respuesta.Substring(indexttr + 3).IndexOf("<tr")
If indexttrB >= 0 Then
trlines.Add(respuesta.Substring(indexttr, indexttrB))
Else
trlines.Add(respuesta.Substring(indexttr))
End If
respuesta = respuesta.Substring(indexttr + 3)
Else
respuesta = ""
End If
End While
Dim key As String = ""
Dim keyvalue As String = ""
For Each item As String In trlines
key = ""
keyvalue = ""
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
key = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttrB + 3)
Else
item = ""
End If
If item.Length > 0 Then
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
keyvalue = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttr + 3)
Else
item = ""
End If
End If
If key.Length > 0 Then
keydict.TryAdd(key.Replace(":", "").Trim(), keyvalue.Trim().ToLower())
End If
Next
Dim Apellido1 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Apellido2 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Nombres As String = "" : keydict.TryGetValue("Nombres", Nombres)
If Nombres Is Nothing OrElse Nombres.Length = 0 Then
curpresult = ""
End If
z = z + 1
End While
i = i + 1
End While
Return curpresult
End Function
Const wdPageBreak As Integer = 7
Const wdCharacter As Integer = 1
Public ReadOnly Property showsalarios As Boolean
Get
Return UsuarioActual.Empresa.Funcionalidad(701) = "1"
End Get
End Property
'Configuración
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If UsuarioActual.CveEmpresa = 72 OrElse UsuarioActual.CveEmpresa = 80 Then
pnlSalarioIMSS.Visible = False
End If
LnkContratoAgropecuaria.Visible = (UsuarioActual.CveEmpresa.Contiene(1, 158))
Using objno = New ClsNominas
objno.GetConceptos()
dtNomConceptos = objno.DtResultados
End Using
PnlSalarios.Visible = showsalarios
ViewState("Orden") = ""
ViewState("Orden1") = ""
Session("FileUpload") = ""
ViewState("Archivo") = ""
DTConsumos = Nothing
SetValues()
'SetPermisos()
CargaEscolaridad()
CargaEstadoCivil()
CargaDepartamento()
CargaPuestos()
CargaEstatusPersonal(1)
CargaGenero()
CargaMotivoBaja()
CargaRuta()
CargaTiposContrato()
CargaTipoPeriodo()
CargaTurno()
CargaJornadas()
CargaProyecto()
CargaTiposAsistencia()
CargaMotivoHoraExtra()
CargaMotivosHorasExtras()
CargaSupervisores()
CargaMetodosPago()
CargaTipoRegimen()
CargaRiesgoPuesto()
CargaBancos()
CargaSubProyectosZona()
CargaEstados(151)
CargaMonedas()
CargaSuperioresOrganigrama()
CargaUsuariosNomina()
CargaComboUniformes()
CargaPermisos()
CargaCombosBuzon()
CargaPermisosReemplazos()
CargaPaises()
CargaRegistroPatronal()
CargaOutSourcing()
If Request("CvePersonal") IsNot Nothing AndAlso IsNumeric(Request("CvePersonal")) AndAlso Request("CvePersonal").ToEntero() > 0 Then
ViewState("CvePersonal") = Request("CvePersonal")
DdlFormapagovacaciones_SelectedIndexChanged(Nothing, Nothing)
'CvePersonal = ViewState("CvePersonal").ToString().ToEntero()
If CargaDatos() Then
CargaDocumentacionFirmaDecontratos()
CargaPersonalIncapacidad()
CargaMovtoPermanente()
'LnkAddLicencias.Visible = True
'TabLicencias.Visible = True
'Configuración de Modalidad Update
BtnGuardar.Text = "Guardar Cambios"
LtlTitulo.Text = "Consulta de Personal:"
If UsuarioActual.CveRol = 1 Then
'ImgImprimir.Visible = True
ImgImprimirExpediente.Visible = True
End If
'ImgAddObs.Attributes.Add("onclick", "javascript: PosicionaObjeto(this.id,'DivEventoBitacora',null,-250,-250); $('#DivEventoBitacora').show(1000); ")
If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then Tab.ActiveTabIndex = Request("Opt").ToEntero() - 1
'Inicia Permisos
If UsuarioActual.TienePermisoProceso(228) Then
GVAsistencia.Columns(10).Visible = True
End If
'Fin Permisos
HlEvento.Visible = True
HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CvePersonal=" & CvePersonal & "&TB_iframe=true&height=370&width=600;"
CargaViaticosPersonal()
divBitacora.Visible = True
CargaGvBitacora()
CargaCuentasBancarias()
CarcaConceptosNomina()
CargaFonacot()
End If
Else
cargatipoTrabajador()
MostrarOcultarFechasEstatus()
LoadDefaultValues()
ImgAddObs.Visible = False
LblFechaCaptura.Text = Now.ToShortDateString()
LblUsuarioCapturo.Text = UsuarioActual.Usuario
ViewState("CvePersonal") = -1
BtnEliminar.Visible = False
End If
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
CrearEstructuraFamiliares()
CargaFamiliares()
LIFamiliaresAcciones.Visible = True
DivFamiliares.Visible = True
DivPadres.Visible = False
End If
'If UsuarioActual.TienePermisoProceso(84) Then 'abonar pago
' HplAbonarMasivo.Visible = True
' GvGxC.Columns(7).Visible = True
'End If
If Not CvePersonal > 0 Then
DivSuperiorInmediato.Visible = False
End If
If UsuarioActual.CveEmpresa = 7 Then
DivSuperiorInmediato.Visible = True
DVSupervisorAsignado.Visible = False
End If
'09/05/2018 - Si el Personal tiene consumos, muestra boton para generar reporte
If DTConsumos IsNot Nothing Then
If DTConsumos.Rows.Count > 0 Then
UpDescargaConsumos.Visible = True
End If
End If
CargaLicencias()
LtlTareaNueva.Text = String.Format("<a class=""caption-subject bold font-green"" onclick=""OpenModalNewTareaUserControl(1,-1,{{CvePersonal:{0}}});""> <i class=""fa fa-plus""'></i> Tarea</a>", CvePersonal)
If UsuarioActual.CveRol = 1 Or UsuarioActual.CveUsuario = 100 Then
DVNetoPeriodo.Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(712) = "1" Then
DvRuta.Visible = True
End If
End If
AgregarEventosAsincronosGvVacaciones()
End Sub
Private Sub LoadDefaultValues()
DdlDepartamento.SelectedIndex = 1
DdlRegimenContratacion.SelectedValueExist(1)
DdlMetodoPago.SelectedValueExist(1)
DdlTipoPeriodo.SelectedValueExist(1)
DdlTipoContrato.SelectedValueExist(2)
DdlJornada.SelectedValueExist(6)
DdlPuesto.SelectedIndex = 1
DdlTurno.SelectedIndex = 1
DdlEstatusPersonal.SelectedValue = "1"
DdlRiesgoPuesto.SelectedIndex = 1
End Sub
Private Sub CargaCuentasContables()
Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa)
If ObjContabilidad.GetCuentas(-1, "-1", -1) Then
DtCuentasContables = ObjContabilidad.DtResultados
Else
DtCuentasContables = Nothing
End If
ObjContabilidad.Dispose()
End Sub
Private Sub SetValues()
ViewState("Orden") = String.Empty
CargaClientes()
Dim fechainicioasistencia As String
Dim fechaFinasistencia As String
If Now.Day >= 15 Then
fechainicioasistencia = String.Format("{0:16/MM/yyyy}", Now)
Dim dateendasis As DateTime = String.Format("{0:01/MM/yyyy}", Now).ToDateTime().AddMonths(1).AddDays(-1)
fechaFinasistencia = String.Format("{0:dd/MM/yyyy}", dateendasis)
Else
fechainicioasistencia = String.Format("{0:01/MM/yyyy}", Now)
fechaFinasistencia = String.Format("{0:15/MM/yyyy}", Now)
End If
If Request("FechaI") IsNot Nothing AndAlso IsDate(Request("FechaI")) Then
txtFechaI.Text = Request("FechaI")
Else
txtFechaI.Text = fechainicioasistencia
End If
If Request("FechaF") IsNot Nothing AndAlso IsDate(Request("FechaF")) Then
txtFechaF.Text = Request("FechaF")
Else
txtFechaF.Text = fechaFinasistencia
End If
If Request("CveSubProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveSubProyecto")) Then
Dim DTSub As DataTable = GlobalDTSubProyectos(-1, Request("CveSubProyecto").ToEntero()) 'Cambiame
If DTSub.Rows.Count > 0 Then
Dim DTProy As DataTable = GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa).FiltraParametros("CveProyecto = " & DTSub.Rows(0)("CveProyecto").ToString())
If DTProy.Rows.Count > 0 Then
DdlProyectoAsistenciaC.SelectedValue = DTProy.Rows(0)("CveProyecto").ToString()
DdlProyectoAsistenciaA_SelectedIndexChanged(Me, New EventArgs)
DdlSubProyectoAsistenciasC.SelectedValue = Request("CveSubProyecto")
End If
End If
End If
TxtFechaICredito.Text = $"01/01/{Now.Year}"
TxtFechaFCredito.Text = Now.ToShortDateString
If UsuarioActual.Empresa.Funcionalidad(509) = "1" Then
divCliente.Visible = True
tdCliente1.Visible = True
tdCliente2.Visible = True
GVAsistencia.Columns(1).Visible = True
End If
End Sub
Private Sub SetPermisos()
'Permisos
End Sub
#Region "Carga Combos"
Public Sub cargatipoTrabajador()
Using objrh As New ClsRH()
If UsuarioActual.CveEmpresa <> 158 Then
If (objrh.TiposTrabajadorGet(-1, UsuarioActual.CveEmpresa)) Then
Dim dt As DataTable = objrh.DtResultados
Dim drow As DataRow = dt.NewRow()
drow("CveTipoTrabajador") = "-1"
drow("TipoTrabajadorB") = "Seleccione"
dt.Rows.InsertAt(drow, 0)
DdlTipoTrabajador.DataSource = dt
DdlTipoTrabajador.DataBind()
End If
Else
If (objrh.AgroDepartamentosGet(UsuarioActual.CveEmpresa, -1, -1)) Then
Dim dt As DataTable = objrh.DtResultados.FiltraParametros(String.Format("CveSubProyecto ={0}", DdlSubProyectoAsignado.SelectedValue), "", {"CveTipoTrabajador", "TipoTrabajadorB"})
Dim drow As DataRow = dt.NewRow()
If UsuarioActual.CveEmpresa <> 158 Then
drow = dt.NewRow()
drow("CveTipoTrabajador") = "2"
drow("TipoTrabajadorB") = "Operativo"
dt.Rows.InsertAt(drow, 0)
drow = dt.NewRow()
drow("CveTipoTrabajador") = "3"
drow("TipoTrabajadorB") = "Administrativo"
dt.Rows.InsertAt(drow, 0)
End If
drow = dt.NewRow()
drow("CveTipoTrabajador") = "-1"
drow("TipoTrabajadorB") = "Seleccione"
dt.Rows.InsertAt(drow, 0)
If DdlTipoTrabajador.Items.Count() > 0 Then
DdlTipoTrabajador.SelectedValueExist("-1")
End If
DdlTipoTrabajador.DataSource = dt
DdlTipoTrabajador.DataBind()
End If
End If
End Using
End Sub
Protected Sub cargaagrodeptos()
If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then 'empresa agricola
Using objrh As New ClsRH()
divAgroTipoTrabajador.Visible = True
divAgroDepto.Visible = True
divMedioTransporte.Visible = True
divAgro1.Visible = True
divAgro2.Visible = True
If (objrh.AgroDepartamentosGet(UsuarioActual.CveEmpresa, -1, -1)) Then
Dim dt As DataTable = objrh.DtResultados.FiltraParametros(String.Format("CveTipoTrabajador ={0}", DdlTipoTrabajador.SelectedValue.ToEntero()))
Dim drow As DataRow = dt.NewRow()
drow("CveDepartamento") = "-1"
drow("Departamento") = "Seleccione"
dt.Rows.InsertAt(drow, 0)
If DDlAgroDepartamento.Items.Count() > 0 Then
DDlAgroDepartamento.SelectedValueExist("-1")
End If
DDlAgroDepartamento.DataSource = dt
DDlAgroDepartamento.DataBind()
End If
End Using
End If
End Sub
Private Sub CargaEscolaridad()
DdlEscolaridad.DataSource = GlobalDTEscolaridad
DdlEscolaridad.DataBind()
End Sub
Private Sub CargaGenero()
DdlGenero.DataSource = GlobalDTGenero
DdlGenero.DataBind()
End Sub
Private Sub CargaEstadoCivil()
DdlEstadoCivil.DataSource = GlobalDTEstadoCivil
DdlEstadoCivil.DataBind()
End Sub
Private Sub CargaTipoPeriodo()
DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo
DdlTipoPeriodo.DataBind()
End Sub
Private Sub CargaTiposContrato()
Dim dt As DataTable = GlobalDTTiposContrato
DdlTipoContrato.DataSource = dt
DdlTipoContrato.DataBind()
End Sub
Private Sub CargaTurno()
DdlTurno.DataSource = GlobalDTTurno(UsuarioActual.CveEmpresa)
DdlTurno.DataBind()
End Sub
Private Sub CargaJornadas()
DdlJornada.DataSource = GlobalDTJornadas
DdlJornada.DataBind()
End Sub
Private Sub CargaMotivoHoraExtra()
DdlMotivoHoraExtra.DataSource = GlobalDTMotivosHorasExtras(UsuarioActual.CveEmpresa)
DdlMotivoHoraExtra.DataBind()
End Sub
Private Sub CargaDepartamento()
DdlDepartamento.DataSource = GlobalDTDepartamentos(UsuarioActual.CveEmpresa)
DdlDepartamento.DataBind()
End Sub
Private Sub CargaPuestos()
DdlPuesto.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa)
DdlPuesto.DataBind()
End Sub
Private Sub CargaRuta()
DdlRuta.DataSource = GlobalDTRutas(UsuarioActual.CveEmpresa)
DdlRuta.DataBind()
End Sub
Private Sub CargaMotivoBaja()
DdlMotivoBaja.DataSource = GlobalDTMotivoBaja(UsuarioActual.CveEmpresa)
DdlMotivoBaja.DataBind()
End Sub
Private Sub CargaEstatusPersonal(CveEstatus As Integer)
Dim filtro As String = ""
Select Case CveEstatus
Case 1 'ingreso
filtro = " CveEstatusPersonal IN(1,2) "
Case 5 'reingreso
filtro = " CveEstatusPersonal IN(2,5) "
Case 2 'baja
filtro = " CveEstatusPersonal IN(2,5) "
Case 3 'reclutamiento
filtro = " CveEstatusPersonal IN(1,3,4,6) "
Case 4 'descartado reclutamiento
filtro = " CveEstatusPersonal IN(4) "
Case 6 'reclutamiento prealta
filtro = " CveEstatusPersonal IN(1,3,4,6) "
End Select
DdlEstatusPersonal.DataSource = GlobalDTEstatusPersonal.FiltraParametros(filtro)
DdlEstatusPersonal.DataBind()
End Sub
Private Sub CargaUsuariosNomina()
Dim dttemp As DataTable
Dim FiltroAD() As String = {"CveUsuario", "Usuario", "Nombre", "Contraseña", "CveEmpresa", "Rol", "Correo", "Empresa", "CveRol"}
dttemp = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa)
DDLUsuarioNomina.DataSource = dttemp.FiltraParametros(String.Format("CveEmpresa = {0} AND Estatus =1 and CveRol <> 1", UsuarioActual.CveEmpresa), "Rol ASC", FiltroAD)
DDLUsuarioNomina.DataBind()
DDLUsuarioNomina.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
End Sub
Private Sub CargaClientes()
'Dim ObjClientes As New ClsClientes
'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
' DdlClienteAsignado.DataSource = ObjClientes.DtResultados
' DdlClienteAsistenciaC.DataSource = ObjClientes.DtResultados
' DdlClienteAsistenciaA.DataSource = ObjClientes.DtResultados
'Else
' DdlClienteAsignado.DataSource = Nothing
' DdlClienteAsistenciaC.DataSource = Nothing
' DdlClienteAsistenciaA.DataSource = Nothing
'End If
'ObjClientes.Dispose()
'DdlClienteAsignado.DataBind()
'DdlClienteAsistenciaC.DataBind()
'DdlClienteAsistenciaA.DataBind()
DdlClienteAsignado.setEsWebService(True)
DdlClienteAsistenciaC.setEsWebService(True)
DdlClienteAsistenciaA.setEsWebService(True)
DdlClienteBuzon.setEsWebService(True)
End Sub
Private Sub CargaProyecto()
CargarCentrosDeCosto(DdlProyectoAsignado, DdlSubProyectoAsignado, LblProyectoAsignado, LblSubProyectoAsignado)
DivProyectosAsignado.Visible = LblProyectoAsignado.Visible
'DdlProyectoAsignado.Items.Clear()
'DdlProyectoAsignado.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, 1)
'DdlProyectoAsignado.DataBind()
'DdlProyectoAsignado.Items.Insert(0, New ListItem("Sin Proyecto asignado", "-1"))
DdlProyectoAsistenciaC.DataSource = GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa).FiltraParametros("", "", {"CveProyecto", "Proyecto"})
DdlProyectoAsistenciaC.DataBind()
DdlProyectoAsistenciaA.DataSource = GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa).FiltraParametros("", "", {"CveProyecto", "Proyecto"})
DdlProyectoAsistenciaA.DataBind()
End Sub
Private Sub CargaSubProyectoAsignado()
If DivProyectosAsignado.Visible Then
DdlSubProyectoAsignado.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1))
DdlSubProyectoAsignado.DataBind()
DdlSubProyectoAsignado.Items.Insert(0, New ListItem("Todos", "-1"))
'old
'DdlSubProyectoAsignado.Items.Clear()
'DdlSubProyectoAsignado.DataSource = GlobalDTSubProyectos(DdlProyectoAsignado.SelectedValue.ToEntero())
'DdlSubProyectoAsignado.DataBind()
'DdlSubProyectoAsignado.Items.Insert(0, New ListItem("Sin SubProyecto asignado", "-1"))
End If
End Sub
Private Sub CargaSubProyectoAsistenciaC()
DdlSubProyectoAsistenciasC.Items.Clear()
DdlSubProyectoAsistenciasC.DataSource = GlobalDTSubProyectos(DdlProyectoAsistenciaC.SelectedValue.ToEntero())
DdlSubProyectoAsistenciasC.DataBind()
DdlSubProyectoAsistenciasC.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Private Sub CargaSubProyectoAsistenciaA()
DdlSubProyectoAsistenciasA.Items.Clear()
DdlSubProyectoAsistenciasA.DataSource = GlobalDTSubProyectos(DdlProyectoAsistenciaA.SelectedValue.ToEntero())
DdlSubProyectoAsistenciasA.DataBind()
DdlSubProyectoAsistenciasA.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Private Sub CargaTiposAsistencia()
DdlTipoAsistencias.DataSource = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa)
DdlTipoAsistencias.DataBind()
End Sub
Private Sub CargaMotivosHorasExtras()
DdlMotivoHoraExtra.DataSource = GlobalDTMotivosHorasExtras(UsuarioActual.CveEmpresa)
DdlMotivoHoraExtra.DataBind()
End Sub
Private Sub CargaSupervisores()
DdlSupervisor.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND EsSupervisorRH = 1 ")
DdlSupervisor.DataBind()
End Sub
Private Sub CargaPermisosReemplazos()
Dim ObjRH As New ClsRH
If ObjRH.GetPersonal(-1, UsuarioActual.CveEmpresa) Then
DdlPermisosReemplazo.DataSource = ObjRH.DtResultados
Else
DdlPermisosReemplazo.DataSource = Nothing
' Alert("Ocurrió un error al cargar el catálogo de Jefes Inmediatos")
End If
ObjRH.Dispose()
DdlPermisosReemplazo.DataBind()
' DdlPermisosReemplazo.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
'DdlPermisosReemplazo.DataBind()
End Sub
Private Sub CargaMetodosPago()
DdlMetodoPago.DataSource = GlobalDTMetodosPago
DdlMetodoPago.DataBind()
End Sub
Private Sub CargaTipoRegimen()
Dim dt As DataTable = GlobalDTNomSatRegimenContratacion.Copy()
For Each item As DataRow In dt.Rows
item("RegimenContratacion") = String.Format("{1}{0} {2}", item("CveSATRegimenContratacion"), If(item("CveSATRegimenContratacion").ToString().Length > 1, "", "0"), item("RegimenContratacion"))
Next
dt.AcceptChanges()
DdlRegimenContratacion.DataSource = dt.FiltraParametros("", "RegimenContratacion")
DdlRegimenContratacion.DataBind()
End Sub
Private Sub CargaRiesgoPuesto()
DdlRiesgoPuesto.DataSource = GlobalDTNomSatRiesgoPuesto
DdlRiesgoPuesto.DataBind()
End Sub
Private Sub CargaBancos()
DdlBanco.DataSource = GlobalDTNomSatBancos
DdlBancoSat.DataSource = GlobalDTNomSatBancos
DdlBanco.DataBind()
DdlBancoSat.DataBind()
End Sub
Private Sub CargaEstados(pCvePais As Integer)
DdlEstados.DataSource = GlobalDTGralEstados("-1", pCvePais)
DdlEstados.DataBind()
DdlEstadosDomicilio.DataSource = GlobalDTGralEstados("-1", pCvePais)
DdlEstadosDomicilio.DataBind()
End Sub
'Private Sub CargaSucursales()
' DdlSucursal.DataSource = GlobalDTSucursales.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
' DdlSucursal.DataBind()
' If UsuarioActual.CveSucursal = -1 Then
' DdlSucursal.Items.Insert(0, New ListItem("Seleccione", "-1"))
' Else
' DdlSucursal.SelectedValue = UsuarioActual.CveSucursal.ToString()
' End If
'End Sub
Private Sub CargaSubProyectosZona()
Dim objRH As New ClsRH
If objRH.SubproyectoZonaGet(-1, -1, UsuarioActual.Empresa.CveEmpresa) Then
DdlSubproyectoZona.DataSource = objRH.DtResultados.FiltraParametros("Estatus=1")
Else
DdlSubproyectoZona.DataSource = Nothing
End If
objRH.Dispose()
DdlSubproyectoZona.DataBind()
End Sub
Private Sub CargaNominas()
Dim Nom As New ClsRH
If Nom.GetNominas(CvePersonal, UsuarioActual.CveEmpresa) Then
GvNominas.DataSource = Nom.DtResultados
End If
If UsuarioActual.CveRol = 1 Then GvNominas.Columns(10).Visible = True
Nom.Dispose()
GvNominas.DataBind()
End Sub
Private Sub CargaPaises()
Dim ObjGral As New ClsGenerales
If ObjGral.GetSATPais() Then
DdlPais.DataSource = ObjGral.DtResultados
Else
DdlPais.DataSource = Nothing
End If
ObjGral.Dispose()
DdlPais.DataBind()
DdlPais.Items.Insert(0, New ListItem("Seleccione una", "-1"))
End Sub
Private Sub CargaRegistroPatronal()
Dim ObjRH As New ClsRH
If ObjRH.GetRegistrosPatronales(-1, UsuarioActual.CveEmpresa, 1) Then
DdlRegistroPatronal.DataSource = ObjRH.DtResultados
Else
DdlRegistroPatronal.DataSource = Nothing
End If
ObjRH.Dispose()
DdlRegistroPatronal.DataBind()
DdlRegistroPatronal.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
End Sub
Private Sub CargaOutSourcing()
If UsuarioActual.CveEmpresa = 7 Then
DdlEmpresaAsignada.DataSource = GlobalDTEmpresas.FiltraParametros("CveEmpresa in (7,11,12,122,145,113)")
DdlEmpresaAsignada.DataBind()
DvOutsourcing.Visible = True
End If
DdlEmpresaAsignada.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
End Sub
#End Region
#Region "Asistencias"
Protected Sub LnkEliminarAsistencia_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim ObjRH As New ClsRH
If ObjRH.RemovePersonalAsistencias(GvRow.DataKey("CveAsistencia").ToEntero()) Then
Alert("La asistencia ha sido eliminada correctamente.")
CargaGvAsistencias()
End If
ObjRH.Dispose()
End Sub
Protected Sub BtnConsultarAsistencia_Click(sender As Object, e As System.EventArgs) Handles BtnConsultarAsistencia.Click
CargaGvAsistencias()
'Dim FechaI, FechaF As Date
'Dim CveTurno, CveSubProyecto As Integer
End Sub
Protected Sub CargaGvAsistencias(Optional Orden As String = "")
Using objpersonal As New ClsRH
Dim CveCliente As Integer = DdlClienteAsistenciaC.SelectedValue.ToEntero()
If CveCliente <= 0 Then
CveCliente = -1
End If
If objpersonal.GetAsistencias(CvePersonal, CveCliente, -1, DdlSubProyectoAsistenciasC.SelectedValue.ToEntero(), DdlTurno.SelectedValue.ToEntero(), -1, -1, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, UsuarioActual.CveEmpresa) Then
GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL")
Else
GVAsistencia.DataSource = Nothing
End If
End Using
GVAsistencia.DataBind()
UpDatos.Update()
End Sub
Protected Sub LbGuardarAsistencia_Click(sender As Object, e As System.EventArgs) Handles LbGuardarAsistencia.Click
Using ObjPersonal As New ClsRH()
If ObjPersonal.AddAsistencia(CvePersonal, DdlClienteAsistenciaA.SelectedValue.ToEntero(), DdlSubProyectoAsistenciasA.SelectedValue.ToEntero(), TxtFechaAsistencia.Text.Trim.ToDate,
DdlTipoAsistencias.SelectedValue.ToEntero(), TxtPorPago.Text.Trim.ToDouble, TxtHorasDobles.Text.Trim.ToDouble,
TxtHorasTriples.Text.Trim.ToDouble, DdlMotivoHoraExtra.SelectedValue.ToEntero(), TxtObservaciones.Text.Trim,
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("Las Asistencias se guardaron correctamente.", TipoMensaje.MsgInformacion)
BtnConsultarAsistencia_Click(sender, e)
End If
End Using
End Sub
Protected Sub GVAsistencia_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAsistencia.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
If IsDate(e.Row.DBCampo("Fecha")) Then e.Row.FCLiteral("LtlFecha").Text = e.Row.DBCampo("Fecha").ToDate.ToShortDateString
If e.Row.FCLiteral("LtlCliente").Text <> "N/A" Then e.Row.FCLiteral("LtlCliente").Text = "<a class=""Texto"" href=""/Ventas/Clientes.aspx?CveCliente=" & e.Row.DBCampo("CveCliente") & """>" & e.Row.DBCampo("Cliente") & "</a>"
e.Row.FCTextBox("TxtPorPago").Text = e.Row.DBCampo("PorcentajePago")
e.Row.FCTextBox("TxtHorasDobles").Text = e.Row.DBCampo("HorasDobles")
e.Row.FCTextBox("TxtHorasTriples").Text = e.Row.DBCampo("HorasTriples")
'Carga Tipos de Asistencia
e.Row.FCDropDownList("DdlTipoAsistencias").DataSource = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlTipoAsistencias").DataBind()
If e.Row.DBCampo("CveAsistenciasInasistencias") <> "-1" Then e.Row.FCDropDownList("DdlTipoAsistencias").SelectedValue = e.Row.DBCampo("CveAsistenciasInasistencias")
'Carga Motivos Horas Extras
e.Row.FCDropDownList("DdlMotivoHoraExtra").DataSource = GlobalDTMotivosHorasExtras(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlMotivoHoraExtra").DataBind()
If e.Row.DBCampo("CveMotivoHoraExtra") <> "-1" Then e.Row.FCDropDownList("DdlMotivoHoraExtra").SelectedValue = e.Row.DBCampo("CveMotivoHoraExtra")
e.Row.FCTextBox("TxtObservaciones").Text = e.Row.DBCampo("Observacion")
If e.Row.DBCampo("SeModifico") = "0" Then
e.Row.Cells(0).BackColor = Drawing.Color.LightBlue
e.Row.Cells(1).BackColor = Drawing.Color.LightBlue
e.Row.Cells(2).BackColor = Drawing.Color.LightBlue
e.Row.Cells(3).BackColor = Drawing.Color.LightBlue
ElseIf e.Row.DBCampo("SeModifico") = "1" Then
e.Row.Cells(0).ForeColor = Drawing.Color.Red
e.Row.Cells(1).ForeColor = Drawing.Color.Red
e.Row.Cells(2).ForeColor = Drawing.Color.Red
e.Row.Cells(3).ForeColor = Drawing.Color.Red
End If
End If
End Sub
Protected Sub BtnGuardarAsistenciaCambios_Click(sender As Object, e As System.EventArgs) Handles BtnGuardarAsistenciaCambios.Click
Using ObjPersonal As New ClsRH()
ObjPersonal.IniciaTransacSQL()
Dim OcurrioError As Boolean = False
For Each Row As GridViewRow In GVAsistencia.Rows
If Not ObjPersonal.AddAsistencia(Row.DataKey("CvePersonal").ToEntero(), -2, -2, Row.FCLiteral("LtlFecha").Text.Trim.ToDate,
Row.FCDropDownList("DdlTipoAsistencias").SelectedValue.ToEntero(), Row.FCTextBox("TxtPorPago").Text.Trim.ToDouble, Row.FCTextBox("TxtHorasDobles").Text.Trim.ToDouble,
Row.FCTextBox("TxtHorasTriples").Text.Trim.ToDouble, Row.FCDropDownList("DdlMotivoHoraExtra").SelectedValue.ToEntero(), Row.FCTextBox("TxtObservaciones").Text.Trim,
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
OcurrioError = True
Exit For
End If
Next
If OcurrioError Then
ObjPersonal.RollBack()
Alert("Ocurrió un error al guardar las Asistencias.", TipoMensaje.MsgError)
Else
ObjPersonal.Commit()
Alert("Las Asistencias se guardaron correctamente.", TipoMensaje.MsgInformacion)
End If
End Using
BtnConsultarAsistencia_Click(sender, e)
End Sub
#End Region
Private Sub CargaConsignacion()
Dim ObjInventario As New ClsInventarios
If ObjInventario.GetConsignaciones(UsuarioActual.CveEmpresa, CvePersonal) Then
GvConsignacion.DataSource = ObjInventario.DtResultados
GvConsignacion.DataBind()
End If
ObjInventario.Dispose()
End Sub
Private Function CargaDatos() As Boolean
Dim Retorno As Boolean = False
Dim ObjPersonal As New ClsRH()
If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
If ObjPersonal.DtResultados.Rows.Count > 0 Then
Dim drow As DataRow = ObjPersonal.DtResultados.Rows(0)
Retorno = True
ChkEstemporal.Checked = drow("esTemporal").ToString() = "1"
CHKRFCValidado.Checked = drow("RFCValidado").ToString() = "1"
'ChkPensionado.Checked = drow("Pensionado").ToString().ToUpper().Contiene("1", "TRUE")
ChkSindicalizado.Checked = drow("Sindicalizado").ToString().ToUpper().Contiene("1", "TRUE")
'TxtMailrecibonomina.Text = drow("Correo").ToString()
'Carga Datos Personales
LtlPersonal.Text = ObjPersonal.NombreCompleto
NombreCompleto = ObjPersonal.NombreCompleto
'TxtNombre.Text = ObjPersonal.Nombre
TxtAPaterno.Text = ObjPersonal.APaterno
TxtAMaterno.Text = ObjPersonal.AMaterno
TxtNombres.Text = ObjPersonal.Nombres
TxtCorreo.Text = ObjPersonal.Correo
TxtCodigo.Text = ObjPersonal.Codigo
DdlEscolaridad.SelectedValue = ObjPersonal.CveEscolaridad.ToString()
DdlEstadoCivil.SelectedValueExist(ObjPersonal.CveEstadoCivil.ToString())
DdlGenero.SelectedValue = ObjPersonal.CveGenero.ToString()
TxtFechaNacimiento.Text = ObjPersonal.FechaNacimiento.ToShortDateString
TxtRFC.Text = ObjPersonal.RFC
TxtCURP.Text = ObjPersonal.CURP
'Localización
'TxtDireccion.Text = ObjPersonal.Direccion
TxtCalle.Text = ObjPersonal.Calle
TxtNumExt.Text = ObjPersonal.NumExt
TxtNumInt.Text = ObjPersonal.NumInt
TxtColonia.Text = ObjPersonal.Colonia
'DdlEstados.SelectedValueExist(ObjPersonal.CveEstado.ToString())
DdlEstados.SelectedValueExistInsert(ObjPersonal.CveEstado.ToString(), drow("EstadoText").ToString())
DdlEstadosDomicilio.SelectedValueExistInsert(drow("CveEstadoDomicilio").ToString(), drow("EstadoDomicilioText").ToString())
TxtCiudadOrigen.Text = drow("CiudadOrigen").ToString()
TxtCP.Text = ObjPersonal.CP
TxtColonia.Text = ObjPersonal.Colonia
TxtCiudad.Text = ObjPersonal.Ciudad
TxtEstado.Text = ObjPersonal.Estado
TxtTelefono.Text = ObjPersonal.Telefono
TxtTelefonoEmergencia.Text = ObjPersonal.TelefonoEmergencia
TxtBeneficiario.Text = ObjPersonal.Beneficiario
TxtCelular.Text = ObjPersonal.Celular
TxtLugarNacimiento.Text = ObjPersonal.LugarNacimiento.ToString()
TxtCredencialElector.Text = ObjPersonal.CredencialElector
TxtNombrePadre.Text = ObjPersonal.NombrePadre
TxtNombreMadre.Text = ObjPersonal.NombreMadre
Session("FileUpload") = ObjPersonal.URL
ViewState("Archivo") = ObjPersonal.URL
TxtTelefonoExtension.Text = ObjPersonal.TelefonoExtension
TxtCelularPersonal.Text = ObjPersonal.CelularPersonal
TxtTelefonoMarcadoRapido.Text = ObjPersonal.TelefonoMarcadoRapido
'TxtContactoAlterno.Text = ObjPersonal.ContactoAlterno
If ObjPersonal.CveUniforme > 0 Then
LnkSurtir.Visible = True
ViewState("CveUniforme") = ObjPersonal.CveUniforme
DdlUniforme.SelectedValueExist(CveUniforme)
LnkSurtir.PostBackUrl = $"../Inventarios/ResguardoMaterial.aspx?CvePersonal={CvePersonal}"
CargaUniformesPersonal()
End If
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 153, 154, 140) Then
LnkSurtir.Visible = True
DdlUniforme.Visible = False
LnkSurtir.PostBackUrl = $"../Inventarios/ResguardoMaterial.aspx?CvePersonal={CvePersonal}&EsSurtidoUniforme=1"
CargaUniformesPersonal()
End If
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpg") Then
'Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.jpg", UsuarioActual.CveEmpresa, CvePersonal)
Dim LogoRutaFisica As String = String.Format("{0}RH\Personal\{1}.jpg", UsuarioActual.Empresa.Ruta, CvePersonal)
Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?Ru={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica))
ImgPersonal.ImageUrl = logouri
ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png") Then
'Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.png", UsuarioActual.CveEmpresa, CvePersonal)
Dim LogoRutaFisica As String = String.Format("{0}RH\Personal\{1}.png", UsuarioActual.Empresa.Ruta, CvePersonal)
Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?Ru={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica))
ImgPersonal.ImageUrl = logouri
ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".bmp") Then
'Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.bmp", UsuarioActual.CveEmpresa, CvePersonal)
Dim LogoRutaFisica As String = String.Format("{0}RH\Personal\{1}.bmp", UsuarioActual.Empresa.Ruta, CvePersonal)
Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?Ru={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica))
ImgPersonal.ImageUrl = logouri
End If
'BtnCargarArchivo_Click(Me, New EventArgs)
'Carga RH
TxtFechaInicioContrato.Text = ObjPersonal.FechaInicioContrato.ToShortDateString
TxtFechaFinContrato.Text = If(ObjPersonal.FechaFinContrato.ToShortDateString = "01/01/0001", "", ObjPersonal.FechaFinContrato.ToShortDateString)
DDlTipoSalario.SelectedValue = drow("CveTipodeSalario").ToString()
DdlTipoContrato.SelectedValue = ObjPersonal.CveTipoContrato.ToString()
DdlTurno.SelectedValue = ObjPersonal.CveTurno.ToString()
DdlJornada.SelectedValue = ObjPersonal.CveJornada.ToString()
DdlDepartamento.SelectedValue = ObjPersonal.CveDepartamento.ToString()
DdlSubproyectoZona.SelectedValueExist(ObjPersonal.CveSubproyectoZona)
DDLUsuarioNomina.SelectedValueExist(ObjPersonal.CveUsuarioNomina)
'DdlViaticos.SelectedValue = ObjPersonal.IdCtaContViaticos.ToString()
'For i As Integer = DdlDepartamento.Items.Count - 1 To 1 Step -1
' If DdlDepartamento.Items(i).Value.Contains(ObjPersonal.CveDepartamento.ToString()) Then
' DdlDepartamento.Items(i).Selected = True
' Exit For
' End If
'Next
DdlPuesto.SelectedValue = ObjPersonal.CvePuesto.ToString()
DdlRuta.SelectedValue = ObjPersonal.CveRuta.ToString()
DdlMotivoBaja.SelectedValue = ObjPersonal.CveMotivoBaja.ToString()
TxtFechaBaja.Text = If(ObjPersonal.FechaBaja.ToShortDateString = "01/01/0001", "", ObjPersonal.FechaBaja.ToShortDateString)
'If ObjPersonal.DtResultados IsNot Nothing AndAlso ObjPersonal.DtResultados.Rows.Count > 0 Then
' TxtFechaActivo.Text = If(drow("FechaActivo").ToString().Length > 0, drow("FechaActivo").ToString().ToDate.ToString("dd/MM/yyyy"), drow("FechaIng").ToString().ToDate.ToString("dd/MM/yyyy"))
' TxtFechaReingreso.Text = If(drow("FechaReingreso").ToString().Length > 0, drow("FechaReingreso").ToString().ToDate.ToString("dd/MM/yyyy"), "")
'End If
DdlEstatusPersonal.SelectedValue = ObjPersonal.CveEstatusPersonal.ToString()
LnkActivar.Visible = (ObjPersonal.CveEstatusPersonal = 2)
LnkDesactivar.Visible = Not LnkActivar.Visible
CargaEstatusPersonal(DdlEstatusPersonal.SelectedValue.ToEntero())
MostrarOcultarFechasEstatus()
CvePersonalEstatusInicial = ObjPersonal.CveEstatusPersonal
ViewState("CveEstatusOriginal") = ObjPersonal.CveEstatusPersonal.ToString()
'Asignación
If ObjPersonal.CveCliente <> -1 Then
'DdlClienteAsignado.Items.Insert(1, New ListItem(ObjPersonal.Cliente, ObjPersonal.CveCliente.ToString()))
DdlClienteAsignado.SelectedValue = ObjPersonal.CveCliente.ToString()
Else
DdlClienteAsignado.SelectedValue = ObjPersonal.CveCliente.ToString()
End If
DdlProyectoAsignado.SelectedValue = ObjPersonal.CveProyecto.ToString()
If ObjPersonal.CveProyecto <> -1 Then DdlProyectoAsignado_SelectedIndexChanged(Me, New System.EventArgs())
DdlSubProyectoAsignado.SelectedValue = ObjPersonal.CveSubProyecto.ToString()
DdlSubProyectoAsignado_SelectedIndexChanged1(Nothing, Nothing)
DdlMedioTransporte.SelectedValueExist(drow("CveMedioTransporte").ToString())
chkEsReserva.Checked = (drow("EsReserva").ToString().ToUpper().Contiene("1", "TRUE"))
chkNoFiscalizar.Checked = Not (drow("Fiscalizable").ToString().ToUpper().Contiene("1", "TRUE"))
cargatipoTrabajador()
DdlTipoTrabajador.SelectedValueExist(drow("CveTipoTrabajador").ToString())
cargaagrodeptos()
DDlAgroDepartamento.SelectedValueExist(drow("CveDepartamentoAgropecuaria").ToString())
ChkCharolaForanea.Checked = (drow("CharolaForanea").ToString().ToUpper().Contiene("1", "TRUE"))
ChkPensionado.Checked = (drow("Pensionado").ToString().ToUpper().Contiene("1", "TRUE"))
DdlSupervisor.SelectedValue = ObjPersonal.CveSupervisor.ToString()
'Carga Nómina
TxtFechaIngreso.Text = ObjPersonal.FechaIngreso.ToShortDateString
DdlTipoPeriodo.SelectedValue = ObjPersonal.CveTipoPeriodo.ToString()
TxtNumeroSS.Text = ObjPersonal.NumeroSS
ChkSeInscribioSS.Checked = ObjPersonal.SeInscribioSS
TxtSalarioDiarioPago.Text = ObjPersonal.SalarioDiarioPago.ToString()
TxtNetoPeriodo.Text = ObjPersonal.NetoPeriodo.ToString()
TxtSalarioDiario.Text = ObjPersonal.SalarioDiario.ToString()
TxtSDI.Text = ObjPersonal.SDI.ToString()
salarioVariable = drow("SalarioVariable").ToString().ToDecimal() 'ObjPersonal.SalarioDiarioSS.ToString().ToDecimal() - ObjPersonal.SDI.ToString().ToDecimal()
salarioVariable = If(salarioVariable > 0, salarioVariable, 0)
TxtSalarioCotizado.Text = ObjPersonal.SalarioDiarioSS.ToString()
TxtFISalariodiario.Text = ObjPersonal.SalarioDiario.ToString()
'TxtBono.Text = ObjPersonal.Bono.ToString()
TxtNumDiasAguinaldo.Text = ObjPersonal.NumDiasAguinaldo.ToString()
TxtFIAguinaldo.Text = ObjPersonal.NumDiasAguinaldo.ToString()
TxtPorPrimaVacacional.Text = ObjPersonal.PorPrimaVacacional.ToString()
TxtFIPrimaVacacional.Text = ObjPersonal.PorPrimaVacacional.ToString()
DdlMetodoPago.SelectedValue = ObjPersonal.CveMetodoPago.ToString()
TxtBancoNumCuenta.Text = ObjPersonal.BancoNumCuenta
TxtCLABE.Text = ObjPersonal.CLABE
DdlSupervisorOrganigrama.SelectedValueExist(If(ObjPersonal.CvePersonalPadre = ObjPersonal.CvePersonal, "0", If(ObjPersonal.CvePersonalPadre.ToString() = "0", "-1", ObjPersonal.CvePersonalPadre.ToString())))
DdlRegimenContratacion.SelectedValue = ObjPersonal.CveSATRegimenContratacion.ToString()
DdlBanco.SelectedValue = If(ObjPersonal.CveSATBanco = 0, "-1", ObjPersonal.CveSATBanco.ToString())
DdlRiesgoPuesto.SelectedValue = ObjPersonal.CveSATRiesgoPuesto.ToString()
DdlPais.SelectedValueExist(ObjPersonal.DtResultados.Rows(0)("CvePais").ToString)
DdlRegistroPatronal.SelectedValueExist(ObjPersonal.DtResultados.Rows(0)("CveRegistroPatronal").ToString)
DdlEmpresaAsignada.SelectedValueExist(ObjPersonal.DtResultados.Rows(0)("CveEmpresaAsignado").ToString)
'Carga Incidencias
BtnConsultarAsistencia_Click(Me, New System.EventArgs)
'Carga Buzón de Calidad
If ObjPersonal.GetBuzonCalidad(CvePersonal, UsuarioActual.CveEmpresa) Then
ViewState("DTBuzonCalidad") = ObjPersonal.DtResultados
GvBuzonCalidad.DataSource = ObjPersonal.DtResultados
Else
GvBuzonCalidad.DataSource = Nothing
ViewState("DTBuzonCalidad") = Nothing
End If
GvBuzonCalidad.DataBind()
'Carga Conceptos de Nómina
CarcaConceptosNomina()
CargaFonacot()
'Carga Pagos no Bancarios
CargarPagosNoBancarios()
'Carga Resguardos
Dim ObjResguardos As New ClsAF
If ObjResguardos.GetActivosFijosResguardos(-1, -1, CvePersonal, -1) Then
GvResguardos.DataSource = ObjResguardos.DtResultados
Else
GvResguardos.DataSource = Nothing
End If
ObjResguardos.Dispose()
GvResguardos.DataBind()
If UsuarioActual.Empresa.UsaContabilidad Then
DdlViaticos.AutoPostBack = True
DdlPrestamos.AutoPostBack = True
DdlViaticos.Attributes.Add("onclick", "CargaCuentas(1);")
DdlPrestamos.Attributes.Add("onclick", "CargaCuentas(2);")
End If
LblFechaCaptura.Text = ObjPersonal.FechaIngreso.ToShortDateString
LblUsuarioCapturo.Text = ObjPersonal.Usuario
CargaNominas()
CargaCastosSinComprobar()
CargaGastosPorCheque()
CargaEventoBitacora()
CargaConsignacion()
CargaCursos()
CargaVacaciones()
CargaVacacionesResumenPeriodoActual()
Consumos()
CargaPagoFactura()
'DescarSolicitudVacaciones(-1)
TabVacaciones.Visible = True
If UsuarioActual.CveEmpresa = 7 Or UsuarioActual.CveEmpresa = 72 Then
'If UsuarioActual.CveEmpresa = 72 Then
' GvVacacionesResumen.Visible = False
' DvHistorialVacaiones.Visible = False
' FvPerimososVacaciones.Visible = False
' 'DVSolicitudVacaiones.Attributes.Add("class", "col-md-12")
' BtnSolicitarVacaciones.Text = "Solicitar"
' DvPermisosMotivos1.Visible = True
' DvPermisosMotivos2.Visible = True
'End If
Else
'TabVacaciones.Visible = False
End If
If VacDiasDisponibles > 0 Then
TxtFechaInicioVac.Text = Now.AddDays(1).ToString("dd/MM/yyyy")
Else
TxtFechaInicioVac.Text = Now.ToString("dd/MM/yyyy")
End If
TxtFechaFinVac.Text = Now.AddDays(VacDiasDisponibles).ToString("dd/MM/yyyy")
'PERSONAL ALTAS
If ObjPersonal.GetPersonalAltas(CvePersonal) Then
GvPersonalAltas.DataSource = ObjPersonal.DtResultados
GvPersonalAltas.DataBind()
End If
'Cargar Almacenes en DropDown GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 8)
DdlAlmacenDestinoLiberarUniforme.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen = 19")
DdlAlmacenDestinoLiberarUniforme.DataBind()
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
CargaCuentasConceptos()
divCuentas.Visible = True
divCuentasContp.Visible = False
ElseIf UsuarioActual.Empresa.TipoContabilidad = 2 Then
divCuentas.Visible = False
divCuentasContp.Visible = True
End If
Else
Alert("El Personal Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
BtnGuardar.Enabled = False
End If
End If
ObjPersonal.Dispose()
Return Retorno
End Function
Private Sub CargaCuentasConceptos()
Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentasConceptos(6, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal) Then
GvCta.DataSource = ObjConta.DtResultados
End If
ObjConta.Dispose()
GvCta.DataBind()
UpCuentaConceptos.Update()
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
Dim EnviarCorreoNomina As Boolean = False
'System.Threading.Thread.Sleep(3000)
Using ObjPersonal As New ClsRH()
Using ObjCuentasDeposito As New ClsGenerales(ObjPersonal.IniciaTransacSQL())
Using ObjAF As New ClsAF(ObjPersonal.IniciaTransacSQL())
Dim Extension As String = Path.GetExtension(UsuarioActual.Empresa.Ruta & "Temp\RH\" & ViewState("Archivo").ToString())
Dim URL As String = If(Extension.Trim().Length > 0, CvePersonal & Extension, "")
Dim Ruta = String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, ViewState("Archivo").ToString())
Dim Archivo As New System.IO.FileInfo(Ruta)
Dim TieneError = False
Dim Mensaje = ""
Dim Accion = ""
'Dim FechaBaja As Date = MinFecha
'Dim FechaActivo As Date = MinFecha
'Dim FechaReingreso As Date = MinFecha
'If DdlEstatusPersonal.SelectedValue.ToEntero() <> CvePersonalEstatusInicial Then
' If DdlEstatusPersonal.SelectedValue.ToEntero() = 1 Then
' FechaActivo = TxtFechaActivo.Text.ToDate
' ElseIf DdlEstatusPersonal.SelectedValue.ToEntero() = 2 Then
' ElseIf DdlEstatusPersonal.SelectedValue.ToEntero() = 5 Then
' FechaReingreso = TxtFechaReingreso.Text.ToDate
' End If
'End If
If UsuarioActual.CveEmpresa = 72 OrElse UsuarioActual.CveEmpresa = 80 Then
TxtSalarioCotizado.Text = TxtSDI.Text
End If
If CvePersonal = -1 Then
URL = ""
If ObjPersonal.AddPersonal(TxtCodigo.Text.Trim, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, TxtCorreo.Text.Trim, TxtFechaIngreso.Text.ToDate,
DdlTipoPeriodo.SelectedValue.ToEntero(), TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked, TxtSalarioDiarioPago.Text.Trim.ToDouble,
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioCotizado.Text.Trim.ToDouble, TxtBono.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero(),
TxtPorPrimaVacacional.Text.Trim.ToDouble, DdlMetodoPago.SelectedValue.ToEntero(), TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
DdlTipoContrato.SelectedValue.ToEntero(), TxtUbicacion.Text.Trim,
DdlTurno.SelectedValue.ToEntero(), DdlPuesto.SelectedValue.ToEntero(),
DdlDepartamento.SelectedValue.ToEntero(),
DdlRuta.SelectedValue.ToEntero(),
DdlEscolaridad.SelectedValue.ToEntero(),
DdlEstadoCivil.SelectedValue.ToEntero(),
DdlGenero.SelectedValue.ToEntero(),
-1, "-1",
DdlEstatusPersonal.SelectedValue.ToEntero(), TxtFechaNacimiento.Text.ToDate,
TxtLugarNacimiento.Text.Trim, TxtCalle.Text.Trim, TxtNumExt.Text.Trim, TxtNumInt.Text.Trim, TxtColonia.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
DdlEstados.SelectedValue.ToEntero(), TxtTelefono.Text.Trim, TxtTelefonoEmergencia.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim, TxtCURP.Text.Trim, TxtCredencialElector.Text.Trim,
TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim, DdlBanco.SelectedValue.ToEntero(), DdlRiesgoPuesto.SelectedValue.ToEntero(), DdlRegimenContratacion.SelectedValue.ToEntero(),
DdlClienteAsignado.SelectedValue.ToEntero(), DdlSubProyectoAsignado.SelectedValue.ToEntero(), URL,
DdlSupervisor.SelectedValue.ToEntero(), TxtCLABE.Text.Trim, TxtBancoNumCuenta.Text.Trim, DdlJornada.SelectedValue.ToEntero(), DdlViaticos.SelectedValue.ToEntero(), DdlViaticos.SelectedItem.Text,
DdlPrestamos.SelectedValue.ToEntero(), DdlPrestamos.SelectedItem.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLUsuarioNomina.SelectedValue.ToEntero(), TxtBeneficiario.Text.Trim, DdlSubproyectoZona.SelectedValue.ToEntero(), CveUniforme:=DdlUniforme.SelectedValue.ToEntero(),
TelefonoExtension:=TxtTelefonoExtension.Text, CelularPersonal:=TxtCelularPersonal.Text, TelefonoMarcadoRapido:=TxtTelefonoMarcadoRapido.Text, ContactoAlterno:="", CveTipodeSalario:=DDlTipoSalario.SelectedValue.ToEntero(),
Sindicalizado:=ChkSindicalizado.Checked, Pensionado:=ChkPensionado.Checked, CvePais:=DdlPais.SelectedValue.ToEntero(), CveRegistroPatronal:=DdlRegistroPatronal.SelectedValue.ToEntero(),
CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero, CveTipoTrabajador:=DdlTipoTrabajador.SelectedValue.ToEntero(), NetoPeriodo:=TxtNetoPeriodo.Text.ToDecimal) Then
If Archivo.Exists Then
If Not IsNothing(ViewState("FilesMoveimgNew")) Then
Dim filemove As String = ViewState("FilesMoveimgNew").ToString()
If Not String.IsNullOrWhiteSpace(filemove) Then
filemove.FilesMove(ObjPersonal.CvePersonal.ToString(), String.Format("{0}RH\Personal\", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
End If
End If
If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then
File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), ObjPersonal.CvePersonal, If(ChkCharolaForanea.Checked, 1, 0))
'Agregar Cuentas Bancarias
ViewState("CvePersonal") = ObjPersonal.CvePersonal
'Funsion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
If TempDTCuentasBancos IsNot Nothing AndAlso TempDTCuentasBancos.Rows.Count > 0 Then
For Each row As DataRow In TempDTCuentasBancos.Rows
If Not ObjCuentasDeposito.AddCuentasDepositos(row("BancoNombre").ToString(), row("Plaza").ToString(), row("Sucursal").ToString(), row("Cuenta").ToString(), row("CLABE").ToString(), row("CIE").ToString(), row("SWIFT").ToString(), row("Referencia").ToString(), "", UsuarioActual.CveUsuario, row("CveMoneda").ToString().ToEntero(), UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=row("BBVAAlias").ToString()) Then
TieneError = True
Exit For
End If
Next
End If
If DTLicencias IsNot Nothing AndAlso DTLicencias.Rows.Count > 0 Then
For Each Dr As DataRow In DTLicencias.Rows
If Not ObjAF.AddLicencia(-1, Dr("Licencia").ToString(), Dr("FechaExpedicion").ToString().ToDateTime(), Dr("FechaVencimiento").ToString().ToDateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePersonal:=ObjPersonal.CvePersonal) Then
TieneError = True
Exit For
End If
Next
End If
'If ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) Then
' GlobalDTGralColectivas(-1) = ObjPersonal.DtResultados
'Else
' TieneError = True
'End If
Mensaje = "El Personal se guardó correctamente."
Accion = If(Request("CveFactura") Is Nothing, "document.location.href=""/RH/CatPersonal.aspx""", "window.opener.location.href = window.opener.location.href; window.close();")
'Alert("El Personal se guardó correctamente.", TipoMensaje.MsgInformacion, "window.location.href=""/RH/CatPersonal.aspx"";")
EnviarCorreoNomina = True
Else
TieneError = True
End If
Else
'If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension) Then
If ObjPersonal.UpdatePersonal(TxtCodigo.Text.Trim, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, TxtCorreo.Text.Trim, TxtFechaIngreso.Text.ToDate,
DdlTipoPeriodo.SelectedValue.ToEntero(), TxtNumeroSS.Text.Trim, ChkSeInscribioSS.Checked, TxtSalarioDiarioPago.Text.Trim.ToDouble,
TxtSalarioDiario.Text.Trim.ToDouble, TxtSDI.Text.Trim.ToDouble, TxtSalarioCotizado.Text.Trim.ToDouble, TxtBono.Text.Trim.ToDouble, TxtNumDiasAguinaldo.Text.Trim.ToEntero(),
TxtPorPrimaVacacional.Text.Trim.ToDouble, DdlMetodoPago.SelectedValue.ToEntero(), TxtFechaInicioContrato.Text.Trim.ToDate, If(IsDate(TxtFechaFinContrato.Text.Trim()), TxtFechaFinContrato.Text.Trim(), "-1"),
DdlTipoContrato.SelectedValue.ToEntero(), TxtUbicacion.Text.Trim,
DdlTurno.SelectedValue.ToEntero(), DdlPuesto.SelectedValue.ToEntero(),
DdlDepartamento.SelectedValue.ToEntero(),
DdlRuta.SelectedValue.ToEntero(),
DdlEscolaridad.SelectedValue.ToEntero(),
DdlEstadoCivil.SelectedValue.ToEntero(),
DdlGenero.SelectedValue.ToEntero(),
DdlMotivoBaja.SelectedValue.ToEntero(), If(DdlEstatusPersonal.SelectedValue = "2", TxtFechaBaja.Text.Trim, "-1"),
DdlEstatusPersonal.SelectedValue.ToEntero(), TxtFechaNacimiento.Text.ToDate,
TxtLugarNacimiento.Text.Trim, TxtCalle.Text.Trim, TxtNumExt.Text.Trim, TxtNumInt.Text.Trim, TxtColonia.Text.Trim, TxtCP.Text.Trim, TxtCiudad.Text.Trim,
DdlEstados.SelectedValue.ToEntero(), TxtTelefono.Text.Trim, TxtTelefonoEmergencia.Text.Trim, TxtCelular.Text.Trim, TxtRFC.Text.Trim,
TxtCURP.Text.Trim, TxtCredencialElector.Text.Trim, TxtNombrePadre.Text.Trim, TxtNombreMadre.Text.Trim,
DdlBanco.SelectedValue.ToEntero(), DdlRiesgoPuesto.SelectedValue.ToEntero(), DdlRegimenContratacion.SelectedValue.ToEntero(),
DdlClienteAsignado.SelectedValue.ToEntero(), DdlSubProyectoAsignado.SelectedValue.ToEntero(), CvePersonal,
URL, DdlSupervisor.SelectedValue.ToEntero(), TxtCLABE.Text.Trim, TxtBancoNumCuenta.Text.Trim, DdlJornada.SelectedValue.ToEntero(), DdlViaticos.SelectedValue.ToEntero(), DdlViaticos.SelectedItem.Text,
DdlPrestamos.SelectedValue.ToEntero(), DdlPrestamos.SelectedItem.Text, UsuarioActual.CveEmpresa, DDLUsuarioNomina.SelectedValue.ToEntero(), TxtBeneficiario.Text.Trim, DdlSubproyectoZona.SelectedValue.ToEntero(), CveUniforme:=DdlUniforme.SelectedValue.ToEntero(),
TelefonoExtension:=TxtTelefonoExtension.Text, CelularPersonal:=TxtCelularPersonal.Text, TelefonoMarcadoRapido:=TxtTelefonoMarcadoRapido.Text, ContactoAlterno:="", CveUsuarioModifico:=UsuarioActual.CveUsuario,
CveTipodeSalario:=DDlTipoSalario.SelectedValue.ToEntero(), Sindicalizado:=If(ChkSindicalizado.Checked, 1, 0), Pensionado:=ChkPensionado.Checked, CvePais:=DdlPais.SelectedValue.ToEntero(),
CveRegistroPatronal:=DdlRegistroPatronal.SelectedValue.ToEntero(), CveEmpresaAsignado:=DdlEmpresaAsignada.SelectedValue.ToEntero(), EsReserva:=If(chkEsReserva.Checked, 1, 0),
Fiscalizable:=If(chkNoFiscalizar.Checked, 0, 1), CveTipoTrabajador:=DdlTipoTrabajador.SelectedValue.ToEntero(), NetoPeriodo:=TxtNetoPeriodo.Text.ToDecimal) Then
'Funcion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), CvePersonal, If(ChkCharolaForanea.Checked, 1, 0))
If Archivo.Exists Then
If Not Directory.Exists(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta)) Then Directory.CreateDirectory(String.Format("{0}\RH\Personal", UsuarioActual.Empresa.Ruta))
If File.Exists(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL)) Then
File.Delete(String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
System.IO.File.Move(String.Format("{0}Temp\RH\{1}", UsuarioActual.Empresa.Ruta, URL), String.Format("{0}RH\Personal\{1}", UsuarioActual.Empresa.Ruta, URL))
End If
Mensaje = "Los cambios se guardaron correctamente."
'If ViewState("CveEstatusOriginal").ToString() <> DdlEstatusPersonal.SelectedValue Then
' 'Manda Mail con bajas
'End If
Else
TieneError = True
End If
'GUARDA ORGANIGRAMA
If Not TieneError Then
If Not ObjPersonal.AddUpdatePersonalOrganigrama(CvePersonal, If(DdlSupervisorOrganigrama.SelectedValue.ToEntero() = 0, CvePersonal, DdlSupervisorOrganigrama.SelectedValue.ToEntero())) Then
TieneError = True
End If
End If
End If
If TieneError Then
ObjPersonal.RollBack()
Alert("Ocurrio un error guardar el Personal. Por favor vuelva a intentar.", TipoMensaje.ToastAdventencia)
Else
ObjPersonal.Commit()
Alert(Mensaje, TipoMensaje.MsgInformacion, Accion)
CargaEstatusPersonal(DdlEstatusPersonal.SelectedValue.ToEntero())
'If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.URL) Then
' ImgPersonal.ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL
'End If
GlobalDTRHPersonal(UsuarioActual.CveEmpresa) = Nothing
GlobalDTCuentasDepositosPersonales(UsuarioActual.CveEmpresa) = Nothing
If CvePersonal > 0 Then
Using objbase As New ClsRH
If (objbase.PersonalDomUp(DdlEstadosDomicilio.SelectedValue.ToEntero(), TxtCiudadOrigen.Text, CvePersonal, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then
End If
End Using
CargaDatos()
End If
End If
GuardarDocumentosFirmaContrato()
Session("FileUpload") = ""
ViewState("Archivo") = ""
End Using
End Using
End Using
UpDatos.Update()
CargaGvBitacora()
If EnviarCorreoNomina AndAlso DDLUsuarioNomina.SelectedValue.ToEntero > 0 Then
'EnviarCorreoNominista()
EnviarCorreoBajaReingresoNomista(TipoMovimientoRH.Alta)
End If
End Sub
'Private Sub EnviarCorreoNominista()
' If UsuarioActual.CveEmpresa.Contiene(7) Then
' Dim CorreoNominista As String = GlobalDTUsuarios(CveUsuario:=DDLUsuarioNomina.SelectedValue.ToEntero).Rows(0)("Correo").ToString
' If CorreoNominista = "" Then
' Alert($"No se envio el correo de notificación a nominas, el nominista no tiene {DDLUsuarioNomina.SelectedItem.Text} correo electronico", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
' Dim correo As New ClsSisMail
' Dim Cuerpo As New StringBuilder
' Dim Puesto As String = ""
' Dim Padre As String = ""
' Dim Madre As String = ""
' Dim FechaIngreso As String = ""
' Dim EmpresaDestino As String = If(DdlEmpresaAsignada.SelectedValue.ToEntero > 0, GlobalDTEmpresas(DdlEmpresaAsignada.SelectedValue.ToEntero).Rows(0)("Empresa").ToString, UsuarioActual.Empresa.Empresa)
' Dim objRH As New ClsRH
' If objRH.PersonalFamiliaresGet(-1, CvePersonal) Then
' Dim DtFamiliares As DataTable = objRH.DtResultados.FiltraParametros(" CveParentesco = 1 ")
' If DtFamiliares.Rows.Count > 0 Then
' Padre = DtFamiliares.Rows(0)("Nombre").ToString
' End If
' DtFamiliares = objRH.DtResultados.FiltraParametros(" CveParentesco = 2 ")
' If DtFamiliares.Rows.Count > 0 Then
' Madre = DtFamiliares.Rows(0)("Nombre").ToString
' End If
' End If
' objRH.Dispose()
' Cuerpo.AppendLine("<table border='0' style='width:100%'>")
' Cuerpo.AppendLine($"<tr><td style=' font-size:large;'>{ EmpresaDestino }<br/></td><td style='width:20%'> </td><td style='text-align: right;'>{ Now.ToShortDateString } { Now.ToShortTimeString } <br/></td> </tr>")
' Cuerpo.AppendLine($"<tr><td style=' font-size:large; text-align: left;' colspan='3'>Notificacion por Alta de Nomina</td></tr>")
' Cuerpo.AppendLine("</table>")
' Cuerpo.AppendLine("<br/>")
' Cuerpo.AppendLine("<br/>")
' Cuerpo.AppendLine("<table border='0'>")
' Cuerpo.AppendLine($"<tr><td style='text-align: center; font-weight:bold; font-size:medium;' colspan='2'>Datos del Candidato</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Puesto:</td><td style=' text-align: left; font-weight:bold;'>{If(DdlPuesto.SelectedIndex > 0, DdlPuesto.SelectedItem.Text, "") }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Ruta/Servicio:</td><td style=' text-align: left; font-weight:bold;'>{ If(DdlRuta.SelectedValue.ToEntero > 0, DdlRuta.SelectedItem.Text, "") }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Fecha de ingreso:</td><td style=' text-align: left; font-weight:bold;'>{TxtFechaIngreso.Text}</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Nombre:</td><td style=' text-align: left; font-weight:bold;'>{ NombreCompleto }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Fecha y Lugar de Nacimiento:</td><td style=' text-align: left; font-weight:bold;'>{TxtFechaNacimiento.Text} {TxtLugarNacimiento.Text}</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Numero IMSS:</td><td style=' text-align: left; font-weight:bold;'>{ TxtNumeroSS.Text }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Numero Infonavit:</td><td style=' text-align: left; font-weight:bold;'>{ If(TxtInfoNumCredito.Text.Trim = "", "NO CUENTA CON CREDITO", TxtInfoNumCredito.Text) }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Sexo:</td><td style=' text-align: left; font-weight:bold;'>{ If(DdlGenero.SelectedValue = "1", "Masculino", "Femenino") }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>R.F.C.:</td><td style=' text-align: left; font-weight:bold;'>{ TxtRFC.Text }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>CURP:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCURP.Text }</td></tr>")
' If Padre.Length > 0 Then
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Nombre del Padre:</td><td style=' text-align: left; font-weight:bold;'>{ Padre }</td></tr>")
' End If
' If Madre.Length > 0 Then
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Nombre de la Madre:</td><td style=' text-align: left; font-weight:bold;'>{ Madre }</td></tr>")
' End If
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Dirección:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCalle.Text }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Escolaridad:</td><td style=' text-align: left; font-weight:bold;'>{ If(DdlEscolaridad.SelectedIndex > 0, DdlEscolaridad.SelectedItem.Text, "") }</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Telefono:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCelular.Text},{TxtTelefono.Text}</td></tr>")
' Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Correo:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCorreo.Text }</td></tr>")
' Cuerpo.AppendLine("</table>")
' correo.SendMail(EmpresaNotificaciones, CorreoNominista, "Notificacion por Alta de Nomina: " & NombreCompleto, Cuerpo.ToString)
' End If
'End Sub
'Private Sub MandaMails(Rutas As Object)
' Try
' Dim ObjMail As New ClsSisMail()
' Dim ResultadoMail As Integer = 0
' If ObjMail.Mandacorreo(SendMail, SendMailPassword, "valfredo@ford.com", "Notificación", "Notificación de empleado nuevo.<br />Nombre: " & TxtNombre.Text & "<br />Turno: " & DdlTurno.SelectedItem.Text & "<br />Proyecto: " & DdlSubProyectoAsignado.SelectedItem.Text) Then
' ResultadoMail = 1
' Else
' ResultadoMail = 3
' End If
' Catch ex As Exception
' OnError("Ocurrió error al mandar MAIL", ex)
' End Try
'End Sub
Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click
Dim ObjPersonal As New ClsRH()
If ObjPersonal.RemovePersonal(CvePersonal, UsuarioActual.CveEmpresa) Then
Alert("El Personal se Eliminó correctamente.", TipoMensaje.MsgInformacion, "window.location.href=""/RH/CatPersonal.aspx""")
End If
ObjPersonal.Dispose()
End Sub
Protected Sub DdlProyectoAsignado_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyectoAsignado.SelectedIndexChanged
CargaSubProyectoAsignado()
End Sub
Protected Sub DdlSubProyectoAsignado_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlSubProyectoAsignado.SelectedIndexChanged
cargatipoTrabajador()
UpDatos.Update()
End Sub
Protected Sub DdlTipoTrabajador_SelectedIndexChanged(sender As Object, e As EventArgs)
cargaagrodeptos()
UpDatos.Update()
End Sub
Protected Sub DdlProyectoAsistenciaC_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyectoAsistenciaC.SelectedIndexChanged
CargaSubProyectoAsistenciaC()
End Sub
Protected Sub DdlProyectoAsistenciaA_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyectoAsistenciaA.SelectedIndexChanged
CargaSubProyectoAsistenciaA()
End Sub
Protected Sub LbContrato_Click(sender As Object, e As System.EventArgs) Handles LbContrato.Click
'Dim oWordApp As Word.Application = Nothing
'Dim oWordDoc As Word.Document = Nothing
'Dim objSelection As Word.Selection = Nothing
'Dim ArchivoPath As String = ""
'Try
' 'GuardaLog("Inicia Petición de Aplicación")
' oWordApp = New Word.Application
' oWordApp.Visible = True
' oWordDoc = oWordApp.Documents.Open(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Contratos\" & "SOGO.doc")
' 'GuardaLog("Inicia Petición de Documento")
' If oWordDoc IsNot Nothing Then
' 'GuardaLog("Creación de Documento")
' oWordDoc.Activate()
' objSelection = oWordApp.Selection
' objSelection.WholeStory()
' objSelection.Copy()
' objSelection.Delete(Unit:=wdCharacter, Count:=1)
' 'GuardaLog("Recorrer de reemplazo de variables")
' objSelection.PasteAndFormat(Word.WdRecoveryType.wdPasteDefault)
' 'ReemplazaTexto(objSelection, "{NOMBRE_PERSONAL}", String.Format("{0} {1} {2}", TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim))
' 'ReemplazaTexto(objSelection, "{DIRECCION}", String.Format("{0} {1} {2}", TxtCalle.Text.Trim, TxtNumExt.Text.Trim, TxtNumInt.Text.Trim))
' 'ReemplazaTexto(objSelection, "{CP}", TxtCP.Text.Trim)
' 'ReemplazaTexto(objSelection, "{CIUDAD}", TxtCiudad.Text.Trim)
' 'ReemplazaTexto(objSelection, "{ESTADO}", TxtEstado.Text.Trim)
' 'ReemplazaTexto(objSelection, "{DIA_INICIA_CONTRATO}", TxtFechaInicioContrato.Text.ToDate.Day.ToString())
' 'ReemplazaTexto(objSelection, "{MES_INICIA_CONTRATO}", MonthName(TxtFechaInicioContrato.Text.ToDate.Month).ToUpper)
' 'ReemplazaTexto(objSelection, "{ANIO_INICIA_CONTRATO}", TxtFechaInicioContrato.Text.ToDate.Year.ToString())
' 'ReemplazaTexto(objSelection, "{DIA_FIN_CONTRATO}", TxtFechaFinContrato.Text.ToDate.Day.ToString())
' 'ReemplazaTexto(objSelection, "{MES_FIN_CONTRATO}", MonthName(TxtFechaFinContrato.Text.ToDate.Month).ToUpper)
' 'ReemplazaTexto(objSelection, "{ANIO_FIN_CONTRATO}", TxtFechaFinContrato.Text.ToDate.Year.ToString())
' 'objSelection.InsertBreak(Type:=wdPageBreak)
' 'GuardaLog("Termina de reemplazo de variables")
' objSelection.TypeBackspace()
' objSelection.TypeBackspace()
' If Not System.IO.Directory.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\") Then
' System.IO.Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\")
' End If
' ArchivoPath = ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & UsuarioActual.CveUsuario & ".doc"
' oWordDoc.SaveAs(ArchivoPath.ToString())
' oWordDoc.Close()
' Else
' Alert("No se pudo generar el archivo", TipoMensaje.MsgError)
' End If
'Catch ex As Exception
' Alert(ex.Message, TipoMensaje.MsgError)
' OnError("", ex)
' ArchivoPath = ""
'Finally
' If oWordDoc IsNot Nothing Then
' 'GuardaLog("Documento Destruido")
' While (Marshal.ReleaseComObject(oWordDoc) > 0)
' End While
' 'GuardaLog("Documento Destruido")
' oWordDoc = Nothing
' End If
' If oWordApp IsNot Nothing Then
' oWordApp.Quit(False)
' While (Marshal.ReleaseComObject(oWordApp) > 0)
' End While
' 'GuardaLog("Aplicación Destruida")
' oWordApp = Nothing
' End If
' System.GC.Collect()
' objSelection = Nothing
'End Try
'If ArchivoPath <> "" Then
' Dim Archivo As New System.IO.FileInfo(ArchivoPath)
' 'If Archivo.Exists Then
' 'HttpContext.Current.Response.Clear()
' 'HttpContext.Current.Response.ClearContent()
' ''HttpContext.Current.Response.ContentType = "application/msword"
' 'HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
' 'HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name)
' 'HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
' 'HttpContext.Current.Response.TransmitFile(ArchivoPath)
' 'HttpContext.Current.Response.Flush()
' 'HttpContext.Current.Response.End()
' RegistraScript("AbrirVentana('/Ventas/PopUpImprimir.aspx?RH=True&Ext=" & Archivo.Extension & "', 700, 400, 'N', 'ImpRH')")
' 'End If
' Archivo = Nothing
'End If
End Sub
'Private Sub ReemplazaTexto(ByRef ObjSelection As Word.Selection, ByVal Texto As String, ByVal Reemplazar As String)
' With ObjSelection.Find
' .Text = Texto
' .Replacement.Text = Reemplazar
' .Forward = True
' .Wrap = Word.WdFindWrap.wdFindContinue
' .Format = False
' .MatchCase = True
' .MatchWholeWord = False
' .MatchWildcards = False
' .MatchSoundsLike = False
' .MatchAllWordForms = False
' End With
' ObjSelection.Find.Execute(Replace:=Word.WdReplace.wdReplaceAll)
'End Sub
Protected Sub BtnCargarClientes_Click(sender As Object, e As System.EventArgs) Handles BtnCargarClientes.Click
CargaClientes()
DdlClienteAsignado.Attributes.Remove("onclick")
DdlClienteAsistenciaC.Attributes.Remove("onclick")
DdlClienteAsistenciaA.Attributes.Remove("onclick")
End Sub
#Region "Buzón de Calidad"
Private Sub CargaBuzonCalidad()
Dim ObjPersonal As New ClsRH
If ObjPersonal.GetBuzonCalidad(CvePersonal, UsuarioActual.CveEmpresa) Then
ViewState("DTBuzonCalidad") = ObjPersonal.DtResultados
GvBuzonCalidad.DataSource = ObjPersonal.DtResultados
Else
GvBuzonCalidad.DataSource = Nothing
ViewState("DTBuzonCalidad") = Nothing
End If
ObjPersonal.Dispose()
GvBuzonCalidad.DataBind()
UpBuzonCalidad.Update()
End Sub
Private Sub LnkBuzonDeCalidad_Click(sender As Object, e As EventArgs) Handles LnkBuzonDeCalidad.Click
ChkSeAtendio.Visible = False
DvSeguimiento.Visible = False
BuzonCalidadLimpiaModal(True)
RegistraScript("$('#ModalBuzonCalidad').modal({ backdrop: 'static', keyboard: false});")
End Sub
Private Sub LnkSaldoI_Click(sender As Object, e As EventArgs) Handles LnkSaldoI.Click
RegistraScript("$('#ModalSaldoInicial').modal({ backdrop: 'static', keyboard: false});")
End Sub
Private Sub BuzonCalidadLimpiaModal(ControlesActivos As Boolean)
DdlClienteBuzon.SelectedValue = "0"
DdlClienteBuzon.Enabled = ControlesActivos
DdlSucursalClienteBuzon.SelectedIndex = 0
DdlSucursalClienteBuzon.Enabled = ControlesActivos
DdlTipoBuzonCalidad.SelectedIndex = 0
DdlTipoBuzonCalidad.Enabled = ControlesActivos
TxtFechaBuzonCalidad.Text = ""
TxtFechaBuzonCalidad.Enabled = ControlesActivos
TxtBuzonDescriptcion.Text = ""
TxtBuzonDescriptcion.Enabled = ControlesActivos
TxtNombreClienteBuzonCalidad.Text = ""
TxtNombreClienteBuzonCalidad.Enabled = ControlesActivos
TxtTelefonoBuzonCalidad.Text = ""
TxtTelefonoBuzonCalidad.Enabled = ControlesActivos
TxtMailBuzonCalidad.Text = ""
TxtMailBuzonCalidad.Enabled = ControlesActivos
LnkFechaBuzonCalidad.Visible = ControlesActivos
BtnModalGuardarBuzonCalidad.Visible = ControlesActivos
TxtObservacionesBuzon.Text = ""
TxtObservacionesBuzon.Visible = ControlesActivos
UpModalBuzonCalidad.Update()
RegistraScript("$('#ModalBuzonCalidad').modal({ backdrop: 'static', keyboard: false});")
End Sub
Public Sub BuzonCalidadVerInfo_Click(sender As Object, e As EventArgs)
BuzonCalidadLimpiaModal(True)
DvSeguimiento.Visible = True
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CvePersonalBuzon = GvRow.DataKey("CvePersonalBuzon").ToEntero()
CargaBuzonCalidadSeguimiento()
DdlClienteBuzon.SelectedValue = GvRow.DataKey("CveCliente")
' DdlClienteBuzon.Enabled = False
If GvRow.DataKey("CveClienteSucursal").ToEntero() > 0 Then
CargaClienteSucursal()
DdlSucursalClienteBuzon.SelectedValueExist(GvRow.DataKey("CveClienteSucursal"))
Else
DdlSucursalClienteBuzon.DataSource = Nothing
DdlSucursalClienteBuzon.DataBind()
DdlSucursalClienteBuzon.SelectedIndex = 0
' DdlSucursalCliente.Enabled = False
End If
DdlTipoBuzonCalidad.SelectedValueExist(GvRow.DataKey("CveTipoBuzon"))
ChkSeAtendio.Visible = True
ChkSeAtendio.Checked = If(GvRow.DataKey("SeAtendioChk").ToString().ToEntero() = 1, True, False)
TxtFechaBuzonCalidad.Text = GvRow.DataKey("FechaQueja").ToDate.ToString("dd/MM/yyyy")
TxtBuzonDescriptcion.Text = GvRow.DataKey("Descripcion")
TxtNombreClienteBuzonCalidad.Text = GvRow.DataKey("NombreReporto")
TxtTelefonoBuzonCalidad.Text = GvRow.DataKey("TelefonoReporto")
TxtMailBuzonCalidad.Text = GvRow.DataKey("MailReporto")
TxtObservacionesBuzon.Text = GvRow.DataKey("Observaciones")
UpModalBuzonCalidad.Update()
RegistraScript("$('#ModalBuzonCalidad').modal({ backdrop: 'static', keyboard: false});")
End Sub
Public Sub BuzonCalidadSeguimiento_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
'CvePersonalBuzon,CveCliente,Cliente,TipoBuzon,FechaQueja,Descripcion,NombreReporto,TelefonoReporto,MailReporto,FechaIng,SeAtendio,Observaciones,SucursalCliente
End Sub
Public Sub BuzonCalidadFinalizar_Cllick(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
End Sub
Property CvePersonalBuzon As Integer
Get
If ViewState("CvePersonalBuzon") Is Nothing Then
Return -1
Else
Return ViewState("CvePersonalBuzon").ToString().ToEntero()
End If
End Get
Set(value As Integer)
ViewState("CvePersonalBuzon") = value
End Set
End Property
Private Sub BtnModalGuardarBuzonCalidad_Click(sender As Object, e As EventArgs) Handles BtnModalGuardarBuzonCalidad.Click
Dim objRH As New ClsRH
If CvePersonalBuzon = -1 Then
objRH.AddBuzonCalidad(CvePersonal, DdlClienteBuzon.SelectedValue.ToEntero(), DdlSucursalClienteBuzon.SelectedValue.ToEntero(), DdlTipoBuzonCalidad.SelectedValue.ToEntero(), TxtFechaBuzonCalidad.Text.ToDate, TxtBuzonDescriptcion.Text.Trim, TxtNombreClienteBuzonCalidad.Text.Trim, TxtTelefono.Text.Trim, TxtMailBuzonCalidad.Text.Trim, TxtObservacionesBuzon.Text, UsuarioActual.Empresa.CveEmpresa, UsuarioActual.CveUsuario)
RegistraScript(" $('#ModalBuzonCalidad').modal('hide')", "HideModalCalidadAgregar")
Else
objRH.UpdateBuzonCalidad(CvePersonalBuzon, If(ChkSeAtendio.Checked, 1, 0), DdlClienteBuzon.SelectedValue.ToEntero(), DdlSucursalClienteBuzon.SelectedValue.ToEntero(), DdlTipoBuzonCalidad.SelectedValue.ToEntero(), TxtBuzonDescriptcion.Text.Trim, TxtNombreClienteBuzonCalidad.Text.Trim, TxtTelefono.Text.Trim, TxtMailBuzonCalidad.Text.Trim, TxtObservacionesBuzon.Text, UsuarioActual.CveUsuario)
RegistraScript(" $('#ModalBuzonCalidad').modal('hide')", "HideModalCalidadAgregar")
End If
CargaBuzonCalidad()
CargaGridBC(ViewState("Orden").ToString())
objRH.Dispose()
End Sub
Private Sub BtnModalGuardarBuzonDetalleCalidad_Click(sender As Object, e As EventArgs) Handles BtnModalGuardarBuzonDetalleCalidad.Click
Dim objRH As New ClsRH
If objRH.AddBuzonCalidadDetalle(CvePersonalBuzon, TxtObserbacionBuzonDetalle.Text.Trim, If(chkBuzonDetalleNotiificar.Checked, 1, 0), TxtMailBuzonCalidad.Text.Trim, UsuarioActual.CveUsuario) Then
If chkBuzonDetalleNotiificar.Checked Then
Dim Correo As New ClsSisMail
Dim Asunto As String = $"{UsuarioActual.Empresa.Empresa} Seguimiento {DdlTipoBuzonCalidad.SelectedItem.Text} Empleado {NombreCompleto}"
Dim Cuerpo As New StringBuilder
Cuerpo.AppendLine($"Seguimiento {DdlTipoBuzonCalidad.SelectedItem.Text} <br>")
Cuerpo.AppendLine($" {UsuarioActual.Nombre}<br>")
Cuerpo.AppendLine($"Actualización: {TxtObserbacionBuzonDetalle.Text}<br>")
Cuerpo.AppendLine($"<br>")
Correo.SendMail(EmpresaNotificaciones, TxtMailBuzonCalidad.Text.Trim, Asunto, Body:=Cuerpo.ToString())
End If
TxtObserbacionBuzonDetalle.Text = ""
chkBuzonDetalleNotiificar.Checked = False
End If
objRH.Dispose()
CargaBuzonCalidadSeguimiento()
End Sub
Private Sub CargaBuzonCalidadSeguimiento()
If CvePersonalBuzon > 0 Then
Dim objRH As New ClsRH
If objRH.GetBuzonCalidadDetalle(CvePersonalBuzon) Then
GvBuzonDetalles.DataSource = objRH.DtResultados
Else
GvBuzonDetalles.DataSource = Nothing
End If
objRH.Dispose()
GvBuzonDetalles.DataBind()
UpModalBuzonCalidad.Update()
End If
End Sub
Private Sub CargaCombosBuzon()
'Dim ObjClientes As New ClsClientes
'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
' DdlClienteBuzon.DataSource = ObjClientes.DtResultados
' DdlClienteBuzon.DataSource = ObjClientes.DtResultados
' DdlClienteBuzon.DataSource = ObjClientes.DtResultados
'Else
' DdlClienteBuzon.DataSource = Nothing
' DdlClienteBuzon.DataSource = Nothing
' DdlClienteBuzon.DataSource = Nothing
'End If
'ObjClientes.Dispose()
'DdlClienteBuzon.DataBind()
Dim objRH As New ClsRH
If objRH.GetBuzonCalidadTipo(1) Then
DdlTipoBuzonCalidad.DataSource = objRH.DtResultados
Else
DdlTipoBuzonCalidad.DataSource = Nothing
End If
objRH.Dispose()
DdlTipoBuzonCalidad.DataBind()
UpModalBuzonCalidad.Update()
End Sub
Private Sub DdlClienteBuzon_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClienteBuzon.selectedindexchange
CargaClienteSucursal()
End Sub
Private Sub CargaClienteSucursal()
Dim ObjCliente As New ClsClientes()
If ObjCliente.GetSucursales(DdlClienteBuzon.SelectedValue.ToEntero()) Then
DdlSucursalClienteBuzon.DataSource = ObjCliente.DtResultados
If ObjCliente.DtResultados.Rows.Count > 0 Then
Divsucursalciente.Visible = True
Else
Divsucursalciente.Visible = False
End If
Else
Divsucursalciente.Visible = False
DdlSucursalClienteBuzon.DataSource = Nothing
End If
DdlSucursalClienteBuzon.DataBind()
UpModalBuzonCalidad.Update()
End Sub
Protected Sub GvBuzonCalidad_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBuzonCalidad.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCLiteral("LtlCliente").Text = "<a class=""Texto"" href=""/Ventas/Clientes.aspx?CveCliente=" & e.Row.DBCampo("CveCliente") & """>" & e.Row.DBCampo("Cliente") & "</a>"
If e.Row.DBCampo("SeAtendio") = "Si" Then
e.Row.BackColor = Drawing.Color.LightBlue
End If
End If
End Sub
Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvBuzonCalidad.RowCancelingEdit
GvBuzonCalidad.EditIndex = -1
If ViewState("Orden").ToString() <> String.Empty Then
CargaGridBC(ViewState("Orden").ToString())
Else
CargaGridBC("")
End If
End Sub
'Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvBuzonCalidad.RowUpdating
' Dim ObjBuzonCalidad As New ClsRH
' Dim Observaciones As String = DirectCast(GvBuzonCalidad.Rows(e.RowIndex).FindControl("TxtObs"), TextBox).Text.Trim
' Dim SeAtendio As Boolean = GvBuzonCalidad.Rows(e.RowIndex).FCCheckBox("ChkEstado").Checked
' Dim CveBuzonCalidad As Integer = GvBuzonCalidad.DataKeys(e.RowIndex).Value.ToString().ToEntero()
' If ObjBuzonCalidad.UpdateBuzonCalidad(SeAtendio, Observaciones, CveBuzonCalidad, UsuarioActual.CveUsuario) Then
' GvBuzonCalidad.EditIndex = -1
' ViewState("DTBuzonCalidad") = ObjBuzonCalidad.DtResultados
' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
' End If
' ObjBuzonCalidad.Dispose()
' If ViewState("Orden").ToString() <> String.Empty Then
' CargaGridBC(ViewState("Orden").ToString())
' Else
' CargaGridBC("")
' End If
'End Sub
Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvBuzonCalidad.RowEditing
GvBuzonCalidad.EditIndex = e.NewEditIndex
If ViewState("Orden").ToString() <> String.Empty Then
CargaGridBC(ViewState("Orden").ToString())
Else
CargaGridBC("")
End If
End Sub
Private Sub CargaGridBC(Orden As String)
If Orden <> String.Empty Then
Dim DV As New DataView(CType(ViewState("DTBuzonCalidad"), DataTable), "", Orden, DataViewRowState.CurrentRows)
GvBuzonCalidad.DataSource = DV.ToTable()
DV.Dispose()
Else
GvBuzonCalidad.DataSource = CType(ViewState("DTBuzonCalidad"), DataTable)
End If
GvBuzonCalidad.DataBind()
UpDatos.Update()
End Sub
#End Region
#Region "Resguardos"
Protected Sub GvResguardos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvResguardos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(50) 'Código
e.Row.Cells(1).Width = Unit.Pixel(250) 'AF
e.Row.Cells(2).Width = Unit.Pixel(150) 'Tipo AF
e.Row.Cells(3).Width = Unit.Pixel(65) 'Inició
e.Row.Cells(4).Width = Unit.Pixel(65) 'Finalizó
e.Row.Cells(5).Width = Unit.Pixel(80) 'Estado
e.Row.Cells(6).Width = Unit.Pixel(280) 'Observaciones
End If
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Left
Dim Liga As String = "<a class=""Texto"" href=""/AF/AF.aspx?CveActivoFijo=" & e.Row.DBCampo("CveActivoFijo") & """>"
e.Row.FCLiteral("LtlCodigo").Text = Liga & e.Row.FCLiteral("LtlCodigo").Text & "</a>"
e.Row.FCLiteral("LtlAF").Text = Liga & e.Row.FCLiteral("LtlAF").Text & "</a>"
End If
End Sub
#End Region
#Region "Nómina"
Private Sub CarcaConceptosNomina()
Dim ObjPersonal As New ClsRH
If ObjPersonal.GetPersonalConceptos(CvePersonal, UsuarioActual.CveEmpresa) Then
'GVConceptos.DataSource = ObjPersonal.DtResultados.FiltraParametros("(CveSistema <>3 AND CveSistema <>4) OR CveSistema IS NULL")
Dim frow As DataRow = ObjPersonal.DtResultados.FiltroPrimero("CveSistema =3")
If Not IsNothing(frow) Then
TxtInfoValor.Text = String.Format("{0:###,###.##}", frow("Importe"))
DdlInfoTipoAplicacion.SelectedValueExist(frow("TipoAplicacion").ToString())
Dim TipoAplicacion As Integer = DdlInfoTipoAplicacion.SelectedValue.ToEntero()
TxtInfoDescripcion.Text = String.Format("{0}", frow("Descripcion02"))
TxtInfoNumCredito.Text = String.Format("{0}", frow("Descripcion01"))
TxtInfoFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow("FInicioAplicacion"))
ChkInfo.Checked = frow("estatus").ToString().ToUpper().Contiene("1", "TRUE")
End If
'frow = ObjPersonal.DtResultados.FiltroPrimero("CveSistema =4")
'TxtFonValor.Text = ""
'DdlFonTipoAplicacion.SelectedValueExist("-1")
'TxtFonDescripcion.Text = ""
'TxtFonNumCredito.Text = ""
'TxtFonFechaInicio.Text = ""
'ChkFonacot.Checked = False
'If Not IsNothing(frow) Then
' TxtFonValor.Text = String.Format("{0:###,###.##}", frow("Importe"))
' DdlFonTipoAplicacion.SelectedValueExist(frow("TipoAplicacion").ToString())
' TxtFonDescripcion.Text = String.Format("{0}", frow("Descripcion02"))
' TxtFonNumCredito.Text = String.Format("{0}", frow("Descripcion01"))
' TxtFonFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow("FInicioAplicacion"))
' ChkFonacot.Checked = frow("estatus").ToString().ToUpper().Contiene("1", "TRUE")
'End If
Else
'Conceptos.DataSource = Nothing
End If
ObjPersonal.Dispose()
'GVConceptos.DataBind()
'For Each Row As GridViewRow In GVConceptos.Rows
' Dim Ddl As DropDownList = DirectCast(GVConceptos.Rows(Row.RowIndex).FCDropDownList("DdlTipoAplicacion"), DropDownList)
' DdlTipoAplicacion_SelectedIndexChanged(Ddl, Nothing)
'Next
End Sub
'Protected Sub GVConceptos_RowCreated(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVConceptos.RowDataBound
' If e.Row.RowType = DataControlRowType.DataRow Then
' e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
' e.Row.Cells(0).Width = Unit.Pixel(50)
' e.Row.Cells(1).Width = Unit.Pixel(50)
' e.Row.Cells(3).Width = Unit.Pixel(70)
' e.Row.Cells(4).Width = Unit.Pixel(70)
' e.Row.Cells(5).Width = Unit.Pixel(160)
' If e.Row.DBCampo("Aplica").ToEntero() = 1 Then e.Row.FCCheckBox("ChkAplica").Checked = True
' If e.Row.DBCampo("Formula") = "S" Then
' e.Row.FCDropDownList("DdlTipoAplicacion").Visible = False : e.Row.Cells(3).Text = "Calculado"
' e.Row.FCDropDownList("DdlTipoAplicacion").Visible = False : e.Row.Cells(4).Text = "Permanente"
' Else
' Dim TipoAplicacion As String = e.Row.DBCampo("TipoAplicacion").ToString()
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Clear()
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Seleccione", "-1"))
' If (e.Row.DBCampo("CveSistema").ToString() = "3") Then
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Infonavit(Movto Permanente)", "5000"))
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Infonavit(Porcentaje)", "5001"))
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Infonavit(Factor Descuento)", "5002"))
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Infonavit(Cuota Fija)", "5003"))
' ElseIf (e.Row.DBCampo("CveSistema").ToString() = "4") Then
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Fonacot(Importe fijo)", "3001"))
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Fonacot(Por días Labarados)", "3002"))
' Else
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Saldo", "1"))
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("No. Pagos", "2"))
' e.Row.FCDropDownList("DdlTipoAplicacion").Items.Add(New ListItem("Permanente", "2600"))
' End If
' If e.Row.DBCampo("TipoAplicacion").ToEntero() > 5 Then
' TipoAplicacion = "2600"
' End If
' e.Row.FCDropDownList("DdlTipoAplicacion").SelectedValueExist(TipoAplicacion)
' End If
' 'If e.Row.DBCampo("TipoCalculo") = "False" Then
' ' e.Row.FCTextBox("TxtImporte").Visible = False
' ' e.Row.FCDropDownList("DdlTipoAplicacion").Visible = False
' 'Else
' ' Select Case e.Row.DBCampo("TipoAplicacion").ToEntero()
' ' Case 1
' ' 'Saldo
' ' e.Row.FCLiteral("LtlSaldo").Visible = True
' ' e.Row.FCTextBox("TxtSaldoIni").Visible = True
' ' Case 2
' ' 'Numero de Pagos
' ' e.Row.FCLiteral("LtlNoPago").Visible = True
' ' e.Row.FCTextBox("TxtNoPagos").Visible = True
' ' Case 2600
' ' 'Permanente
' ' End Select
' 'End If
' End If
'End Sub
Protected Sub BtnGuardarInfornavit_Click(sender As Object, e As EventArgs)
Dim importe As Decimal = TxtInfoValor.Text.ToDecimal()
Dim TipoAplicacion As Integer = DdlInfoTipoAplicacion.SelectedValue.ToEntero()
Dim NoPagos As Integer = 0
Dim SaldoIni As Decimal = 0
Dim descripcion02 As String = TxtInfoDescripcion.Text
Dim descripcion01 As String = TxtInfoNumCredito.Text
Dim fecha As String = TxtInfoFechaInicio.Text.Replace("_", "")
Dim estatus As Integer = If(ChkInfo.Checked, 1, 0)
If fecha.Length > 8 Then
fecha = fecha.ToDateTime().ToString("yyyy/MM/dd")
Else
fecha = ""
End If
Dim OcurrioError As Boolean = False
Using ObjPersonal As New ClsRH
If Not ObjPersonal.AddConcepto(CvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 3, descripcion01, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa) Then
OcurrioError = True
End If
End Using
If Not OcurrioError Then
Alert("Se actualizo el calculo de infonavit")
CarcaConceptosNomina()
End If
End Sub
'Protected Sub BtnGuardarConceptos_Click(sender As Object, e As System.EventArgs) Handles BtnGuardarConceptos.Click
' If CvePersonal > 0 Then
' Dim ObjPersonal As New ClsRH
' ObjPersonal.IniciaTransacSQL()
' Dim OcurrioError As Boolean = False
' For Each Row As GridViewRow In GVConceptos.Rows
' If Row.FCCheckBox("ChkAplica").Checked = True Then
' Dim CveConcepto As Integer = Row.DataKey("CveConcepto").ToEntero()
' Dim Importe As Double = Row.FCTextBox("TxtImporte").Text.ToDouble
' Dim TipoAplicacion As Integer = Row.FCDropDownList("DdlTipoAplicacion").SelectedValue.ToEntero()
' Dim NoPagos As Integer = If(Row.FCTextBox("TxtNoPagos").Text.ToEntero() = 0, -1, Row.FCTextBox("TxtNoPagos").Text.ToEntero())
' Dim SaldoIni As Double = If(Row.FCTextBox("TxtSaldoIni").Text.ToDouble = 0, -1, Row.FCTextBox("TxtSaldoIni").Text.ToDouble)
' Select Case TipoAplicacion
' Case 1
' 'Saldo
' NoPagos = -1
' Case 2
' 'Numero de Pagos
' SaldoIni = -1
' Case 2600
' 'Permanente
' NoPagos = -1
' SaldoIni = -1
' End Select
' 'Insertarlo o Actualizarlo
' If Not ObjPersonal.AddConcepto(CvePersonal, CveConcepto, Importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario) Then
' OcurrioError = True
' ObjPersonal.RollBack()
' Exit For
' End If
' Else
' 'Borrarlo
' If Row.DataKey("CvePersonalConcepto") <> "" Then
' If Not ObjPersonal.RemoveConcepto(Row.DataKey("CvePersonalConcepto").ToEntero()) Then
' OcurrioError = True
' ObjPersonal.RollBack()
' Exit For
' End If
' End If
' End If
' Next
' If Not OcurrioError Then
' ObjPersonal.Commit()
' Alert("La información se guardó correctamente.", TipoMensaje.MsgInformacion)
' Else
' Alert("Ocurrió un error al guardar la información.", TipoMensaje.MsgError)
' End If
' ObjPersonal.Dispose()
' End If
'End Sub
#End Region
Protected Sub DdlEstatusPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEstatusPersonal.SelectedIndexChanged
MostrarOcultarFechasEstatus()
End Sub
Private Sub MostrarOcultarFechasEstatus()
'DivFechaReingreso.Visible = False
'DivFechaActivo.Visible = False
If DdlEstatusPersonal.SelectedValue.ToEntero().Contiene(1, 2, 5) Then
'DivFechaActivo.Visible = If(DdlEstatusPersonal.SelectedValue.ToEntero() = 1, True, False)
DivFechaBaja.Visible = If(DdlEstatusPersonal.SelectedValue.ToEntero() = 2, True, False)
'DivFechaReingreso.Visible = If(DdlEstatusPersonal.SelectedValue.ToEntero() = 5, True, False)
Else
'DivFechaActivo.Visible = False
DivFechaBaja.Visible = False
'DivFechaReingreso.Visible = False
End If
DivMotivoBaja.Visible = DivFechaBaja.Visible
End Sub
Protected Sub GvNominas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvNominas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(35)
e.Row.Cells(1).Width = Unit.Pixel(75)
e.Row.Cells(2).Width = Unit.Pixel(75)
e.Row.Cells(3).Width = Unit.Pixel(95)
e.Row.Cells(4).Width = Unit.Pixel(95)
e.Row.Cells(5).Width = Unit.Pixel(95)
e.Row.Cells(6).Width = Unit.Pixel(95)
End If
e.Row.FCLinkButton("LBCancelar").Visible = True
e.Row.FCLinkButton("LBCancelar").CommandArgument = e.Row.DBCampo("FolioFiscal")
If e.Row.DBCampo("SeTimbro") = "True" Then
e.Row.FCLinkButton("LbMail").CommandArgument = e.Row.DBCampo("FolioFiscal")
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LbMail"))
e.Row.FCLinkButton("LbMail").Visible = True
e.Row.FCLinkButton("LbPDF").CommandArgument = e.Row.DataKey("CvePeriodo")
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LbPDF")) ' registro el evento postback
'e.Row.FCHyperLink("HplPDF").NavigateUrl = String.Format("/Empresas/{0}/PDF/Nomina/{1}.pdf", e.Row.DBCampo("CveEmpresa"), e.Row.DBCampo("SerieFolio"))
'e.Row.FCHyperLink("HplSeTimbro").NavigateUrl = String.Format("/Empresas/{0}/XML/Nomina/{1}.xml", e.Row.DBCampo("CveEmpresa"), e.Row.DBCampo("SerieFolio"))
e.Row.FCLinkButton("LbPDF").Visible = True
e.Row.FCLinkButton("LBCancelar").Visible = True
e.Row.FCLinkButton("LBCancelar").CommandArgument = e.Row.DBCampo("FolioFiscal")
End If
End If
End Sub
#Region "G A S T O S X C O M P R O B A R"
Protected Sub RBLTipoGastos_SelectedIndexChanged(sender As Object, e As EventArgs)
If RBLTipoGastos.SelectedValue = "1" Then
PnlGastoGeneral.Visible = True
PnlGastoCheque.Visible = False
Else
PnlGastoGeneral.Visible = False
PnlGastoCheque.Visible = True
End If
End Sub
Private Sub CargaCastosSinComprobar()
'Dim objGXC As New ClsMovimientos
'If objGXC.GetEgresosSinComprobar("-1", "-1", -1, CvePersonal, -1, -1, -1, -1, 0, UsuarioActual.CveEmpresa) Then
' GvGxC.DataSource = objGXC.DtResultados.FiltraParametros("Saldo > 0")
' GvGxCHistorial.DataSource = objGXC.DtResultados.FiltraParametros("Saldo = 0")
'End If
'objGXC.Dispose()
'GvGxC.DataBind()
'GvGxCHistorial.DataBind()
Dim Conta As New ClsContabilidad
If Conta.GetPersonalAuxiliar(CvePersonal, UsuarioActual.CveEmpresa) Then
DTGastosSinComp = Conta.DtResultados
GvGxC.DataSource = DTGastosSinComp
LblSaldoGxC.Text = (Conta.DtResultados.SUM("Cargo", "CveMovimiento Is NULL") - Conta.DtResultados.SUM("Abono", "CveMovimiento Is NULL")).FormatoNumero()
End If
Conta.Dispose()
GvGxC.DataBind()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetPersonalPrestamoAuxiliar(CvePersonal, "-1", "-1", UsuarioActual.CveEmpresa) Then
GvAuxiliar.DataSource = ObjBancos.DtResultados
End If
ObjBancos.Dispose()
GvAuxiliar.DataBind()
End Sub
Private Sub CargaGastosPorCheque()
Dim RH As New ClsRH
If RH.GetRepPersonalBancos(CvePersonal, "-1", "-1", -1) Then
DTGastosPorCheque = RH.DtResultados
GvGastosCheque.DataSource = DTGastosPorCheque
Else
GvGastosCheque.DataSource = Nothing
Alert("Ocurrió un error al consultar los Gastos X Comprobar agrupados por cheque.", TipoMensaje.MsgError)
End If
RH.Dispose()
GvGastosCheque.DataBind()
End Sub
Protected Sub GvGastosCheque_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvGastosCheque.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(120)
e.Row.Cells(1).Width = Unit.Pixel(70)
e.Row.Cells(2).Width = Unit.Pixel(80)
e.Row.Cells(3).Width = Unit.Pixel(80)
e.Row.Cells(4).Width = Unit.Pixel(90)
e.Row.Cells(5).Width = Unit.Pixel(90)
e.Row.Cells(6).Width = Unit.Pixel(105)
e.Row.Cells(7).Width = Unit.Pixel(90)
End If
If e.Row.DBCampo("CveCompra") = "" Then
If e.Row.DBCampo("CveIE") <> "" Then
e.Row.Cells(0).Text = String.Format("{0} - {1} - {2}", e.Row.DBCampo("Banco"), e.Row.DBCampo("NumCuenta"), e.Row.DBCampo("Moneda"))
e.Row.FCLiteral("LtlFechaVenci").Text = e.Row.DBCampo("FechaDocumento").ToDate.ToShortDateString
e.Row.FCHyperLink("HplCheque").Visible = True
End If
e.Row.BackColor = Drawing.Color.LightGray
End If
End If
End Sub
#End Region
#Region "E V E N T O - B I T A C O R A"
Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(200)
e.Row.Cells(1).Width = Unit.Pixel(200)
e.Row.Cells(2).Width = Unit.Pixel(100)
e.Row.Cells(3).Width = Unit.Pixel(500)
End If
If e.Row.DBCampo("Archivo").ToString() <> "" Then
e.Row.FCLinkButton("LinkArchivo").Visible = True
e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString())
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione
End If
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
End If
End Sub
Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click
Dim ObjEventoBitacora As New ClsOIEventos
Dim FileExtension As String = "-1"
Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos
Dim filemove As String = ""
For Each fileItem As Archivo In filesgral
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
filemove = fileItem.filename
Next
If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal) Then
If filemove <> "" Then
filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
End If
GvEB.DataSource = ObjEventoBitacora.DtResultados
TxtEventoDescripcion.Text = ""
Anexo.Text = "[]"
Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion)
RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal")
End If
ObjEventoBitacora.Dispose()
GvEB.DataBind()
UPEventoBitacora.Update()
CargaEventoBitacora()
UPAddEventoBitacora.Update()
End Sub
Private Sub CargaEventoBitacora()
Dim ObjEventoBitacora As New ClsOIEventos()
If ObjEventoBitacora.GetAgendaBitacora(-1, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal) Then
GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2")
Else
GvEB.DataSource = Nothing
End If
GvEB.DataBind()
End Sub
Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument)
Dim Archivo As New System.IO.FileInfo(filePath)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath))
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
HttpContext.Current.Response.TransmitFile(filePath)
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
Archivo = Nothing
End Sub
#End Region
Protected Sub GvGxC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvGxC.RowDataBound, GvGxCHistorial.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 1 Then
e.Row.Cells(0).Width = Unit.Pixel(100)
e.Row.Cells(1).Width = Unit.Pixel(200)
e.Row.Cells(2).Width = Unit.Pixel(350)
e.Row.Cells(3).Width = Unit.Pixel(100)
e.Row.Cells(4).Width = Unit.Pixel(100)
'e.Row.Cells(5).Width = Unit.Pixel(100)
'e.Row.Cells(6).Width = Unit.Pixel(80)
'e.Row.Cells(7).Width = Unit.Pixel(100)
End If
If e.Row.DBCampo("FechaDocumento") = "" Then e.Row.BackColor = Drawing.Color.LightGray
If e.Row.DBCampo("CveIE").ToEntero() > 0 Then
e.Row.FCHyperLink("HplRef").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
e.Row.FCLabel("LtlC").CssClass = "label label-sm label-success"
e.Row.FCLabel("LtlC").ForeColor = Drawing.Color.White
End If
If e.Row.DBCampo("CveCompra").ToEntero() > 0 Then
e.Row.FCHyperLink("HplRef").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra"))
e.Row.FCLabel("LtlC").CssClass = "label label-sm label-warning"
e.Row.FCLabel("LtlC").ForeColor = Drawing.Color.White
End If
End If
End Sub
Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click
If DtCuentasContables Is Nothing Then
CargaCuentasContables()
End If
Dim SeleccionadoContViaticos As String
Dim SeleccionadoContPrestamos As String
Select Case HdnCuenta.Value
Case "1"
SeleccionadoContViaticos = DdlViaticos.SelectedValue
DdlViaticos.Items.Clear() : DdlViaticos.Items.Add(New ListItem("Seleccione", "0"))
DdlViaticos.DataSource = DtCuentasContables : DdlViaticos.DataBind() : DdlViaticos.SelectedValueExist(SeleccionadoContViaticos)
DdlViaticos.AutoPostBack = False : DdlViaticos.Attributes.Remove("onclick") : DdlViaticos.CssClass &= " select2me"
Case "2"
SeleccionadoContPrestamos = DdlPrestamos.SelectedValue
DdlPrestamos.Items.Clear() : DdlPrestamos.Items.Add(New ListItem("Seleccione", "0"))
DdlPrestamos.DataSource = DtCuentasContables : DdlPrestamos.DataBind() : DdlPrestamos.SelectedValueExist(SeleccionadoContPrestamos)
DdlPrestamos.AutoPostBack = False : DdlPrestamos.Attributes.Remove("onclick") : DdlPrestamos.CssClass &= " select2me"
End Select
End Sub
#Region "TAB BANCOS"
Private Sub CargaMonedas()
DdlMoneda.DataSource = GlobalDTMonedas
DdlMoneda.DataBind()
DdlMoneda.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Protected Sub Lnkopenaddcuentabancaria_Click(sender As Object, e As EventArgs)
BtnActualizarCuentaBanco.Visible = False
BtnAgregarCuentaBanco.Visible = True
RegistraScript("$('#DivCuentasVancarias').modal();")
End Sub
Protected Sub LbActualizarCuentaBanco_Click(sender As Object, e As EventArgs)
Using ObjCuentasBancos As New ClsGenerales
Dim nombrebanco As String = DdlBancoSat.SelectedItem.Text
If ObjCuentasBancos.UpdateCuentasDepositosPersonal(CveCuentaDeposito, nombrebanco, TxtNumeroCuenta.Text, TxtCLABECB.Text, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, ChkEstatusPagoE.Checked, ChkEstatuscuenta.Checked, DdlBancoSat.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then
'UpdateCuentasDepositosPersonal(CveCuentaDeposito As Integer, BancoNombre As String, Cuenta As String, CLABE As String, CveMoneda As Integer, CveUsuarioModifico As Integer, EstatusPagoElectronico As Boolean, Estatus As Boolean, CveSATBanco As Integer) As Boolean
Alert("Cuenta actualizada")
End If
End Using
CargaCuentasBancarias()
RegistraScript("$('#DivCuentasVancarias').modal('hide');")
End Sub
Protected Sub LbAgregarCuentaBanco_Click(sender As Object, e As EventArgs)
Dim EsBancomer = False
Dim nombrebanco As String = DdlBancoSat.SelectedItem.Text
If nombrebanco.ToUpper.Contains("BBVA") Or nombrebanco.ToUpper.Contains("BANCOMER") Or (TxtCLABECB.Text.Length = 18 AndAlso TxtCLABECB.Text.Substring(0, 3) = "012") Then
EsBancomer = True
End If
If EsBancomer AndAlso (TxtCLABECB.Text.Length = 18 AndAlso Not TxtCLABECB.Text.Substring(0, 3) = "012") Then
Alert("La CLABE ingresada no pertenece a BANCOMER.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
''CLABE SIEMPRE OBLIGATORIA CUANDO NO ES BANCOMER CON CIE
'If (TxtCLABECB.Text.Trim.Length <> 18 And Not EsBancomer) Or (EsBancomer And TxtConvenioCIE.Text.Trim.Length <> 6 And TxtCLABECB.Text.Trim.Length <> 18) Then
' Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
If ChkEstatusPagoE.Checked Then
'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
'If TxtCLABECB.Text.Trim.Length <> 18 AndAlso TxtCLABECB.Text.Trim.Length = 0 AndAlso Not EsBancomer Then
' Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
'If TxtCLABECB.Text.Trim.Length <> 0 AndAlso TxtCLABECB.Text.Trim.Length <> 18 Then
' Alert("La CLABE debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
End If
'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
If TxtNumeroCuenta.Text.Trim.Length <> 0 AndAlso TxtNumeroCuenta.Text.Trim.Length <> 10 AndAlso EsBancomer Then
Alert("El número de cuenta debe tener una longitud de 10 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
''CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
'If EsBancomer AndAlso Not (TxtNumeroCuenta.Text.Trim.Length = 10 Or TxtConvenioCIE.Text.Trim.Length = 6) Then
' Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
AgregarCuentaBanco(nombrebanco, "", TxtCLABECB.Text.Trim, "", "", TxtNumeroCuenta.Text.Trim, "", "", DdlMoneda.SelectedValue.ToEntero(), DdlMoneda.SelectedItem.Text, "", DdlBancoSat.SelectedValue.ToEntero(), ChkEstatusPagoE.Checked)
RegistraScript("$('#DivCuentasVancarias').modal('hide');")
End Sub
Private Sub CargaGridCuentasBancos(Orden As String)
If CvePersonal > 0 Then
If Not String.IsNullOrEmpty(Orden) Then
Dim DV As New DataView(DTCuentasBancos, "", Orden, DataViewRowState.CurrentRows)
GvBancosCuentas.DataSource = DV.ToTable()
DV.Dispose()
Else
GvBancosCuentas.DataSource = DTCuentasBancos
End If
Else
If Not String.IsNullOrEmpty(Orden) Then
Dim DV As New DataView(TempDTCuentasBancos, "", Orden, DataViewRowState.CurrentRows)
GvBancosCuentas.DataSource = DV.ToTable()
DV.Dispose()
Else
GvBancosCuentas.DataSource = TempDTCuentasBancos
End If
End If
GvBancosCuentas.DataBind()
UpCuentasBancos.Update()
End Sub
Private Sub AgregarCuentaBanco(NombreBanco As String, NumeroSucursal As String, CLABE As String, SWIFT As String, Plaza As String, NumeroCuenta As String, ConvenioCIE As String, Referencia As String, CveMoneda As Integer, Moneda As String, BBVAAlias As String, CveSATBanco As Integer, EstatusPagoElectronico As Boolean)
Dim Row As DataRow
If CvePersonal > 0 Then
Dim ObjCuentasBancos As New ClsGenerales
If ObjCuentasBancos.AddCuentasDepositos(NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, "", UsuarioActual.CveUsuario, CveMoneda, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=BBVAAlias, CveSATBanco:=CveSATBanco, EstatusPagoElectronico:=EstatusPagoElectronico) Then
DTCuentasBancos.Clear()
DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CvePersonal = {0}", CvePersonal)))
Alert("Cuenta Bancaria agregada con éxito.", TipoMensaje.MsgInformacion)
End If
ObjCuentasBancos.Dispose()
Else
Row = TempDTCuentasBancos.NewRow
Row("BancoNombre") = NombreBanco
Row("Sucursal") = NumeroSucursal
Row("CLABE") = CLABE
Row("SWIFT") = SWIFT
Row("Plaza") = Plaza
Row("Cuenta") = NumeroCuenta
Row("CIE") = ConvenioCIE
Row("Referencia") = Referencia
Row("CveMoneda") = CveMoneda
Row("Moneda") = Moneda
Row("EstatusPagoElectronico") = EstatusPagoElectronico
TempDTCuentasBancos.Rows.Add(Row)
End If
LimpiaCuentasBancarias()
CargaGridCuentasBancos("")
If CvePersonal > 0 Then
CargaGvBitacora()
End If
End Sub
Private Sub LimpiaCuentasBancarias()
TxtCLABECB.Text = ""
TxtNumeroCuenta.Text = ""
End Sub
Private Sub CargaCuentasBancarias()
Dim ObjCuentasBancos As New ClsGenerales
DTCuentasBancos = New DataTable
TempDTCuentasBancos = New DataTable
If ObjCuentasBancos.GetCuentasDepositos(CvePersonal:=CvePersonal, CveEmpresa:=UsuarioActual.CveEmpresa) Then
DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados)
Else
Alert("No se pudieron cargar las cuentas bancarias. Por favor intente nuevamente.", TipoMensaje.MsgError)
End If
If CvePersonal < 0 Then
TempDTCuentasBancos = DTCuentasBancos.Clone
End If
ObjCuentasBancos.Dispose()
CargaGridCuentasBancos("")
End Sub
#Region "GRIDVIEW - CUENTAS BANCARIAS"
Protected Sub GvBancosCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowState = DataControlRowState.Edit Then
e.Row.FCDropDownList("DdlMoneda").DataSource = GlobalDTMonedas
e.Row.FCDropDownList("DdlMoneda").DataBind()
e.Row.FCDropDownList("DdlMoneda").Items.Insert(0, New ListItem("Seleccione", "-1"))
e.Row.FCDropDownList("DdlMoneda").SelectedValue = e.Row.DBCampo("CveMoneda")
'SI TIENE PERMISO PUEDE EDITAR ESTATUS
If UsuarioActual.TienePermisoProceso(155) Then
'Alert("usuario no tiene permiso", TipoMensaje.MsgInformacion)
e.Row.FCCheckBox("ChkEstatus").Visible = True
Else
e.Row.FCCheckBox("ChkEstatus").Visible = False
End If
If CBool(e.Row.DBCampo("EstatusPagoElectronico")) Then
e.Row.FCDropDownList("DdlMoneda").Enabled = False
End If
End If
If CvePersonal < 0 Then
For index = 1 To TempDTCuentasBancos.Rows.Count
TempDTCuentasBancos.Rows(index - 1)("CveCuentaDeposito") = index
Next
TempDTCuentasBancos.AcceptChanges()
End If
End If
End Sub
Protected Sub LnkshowEditcuentasbancarias_Click(sender As Object, e As EventArgs)
Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
BtnActualizarCuentaBanco.Visible = True
BtnAgregarCuentaBanco.Visible = False
'CveCuentaDeposito,CveSATBanco,Cuenta,CLABE,EstatusPagoElectronico,CveMoneda
CveCuentaDeposito = gvrow.DataKey("CveCuentaDeposito").ToEntero()
DdlBancoSat.SelectedValueExist(gvrow.DataKey("CveSATBanco"))
DdlMoneda.SelectedValueExist(gvrow.DataKey("CveMoneda"))
TxtNumeroCuenta.Text = gvrow.DataKey("Cuenta")
TxtCLABECB.Text = gvrow.DataKey("CLABE")
ChkEstatusPagoE.Checked = gvrow.DataKey("EstatusPagoElectronico").ToUpper().Contiene("TRUE", "1")
ChkEstatuscuenta.Checked = gvrow.DataKey("EstatusTexto").ToUpper().Contiene("TRUE", "1", "ACTIVO")
UpCuentasVancarias.Update()
RegistraScript("$('#DivCuentasVancarias').modal();")
End Sub
Protected Sub GvBancosCuentas_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvBancosCuentas.RowEditing
GvBancosCuentas.EditIndex = e.NewEditIndex
CargaGridCuentasBancos("")
End Sub
Protected Sub GvBancosCuentas_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvBancosCuentas.RowCancelingEdit
GvBancosCuentas.EditIndex = -1
CargaGridCuentasBancos("")
End Sub
Protected Sub GvBancosCuentas_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvBancosCuentas.RowUpdating
Dim NombreBanco = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNombreBanco").Text.Trim
Dim NumeroSucursal = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNumeroSucursal").Text.Trim
Dim CLABE = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtCLABE").Text.Trim
Dim SWIFT = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtSWIFT").Text.Trim
Dim Plaza = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtPlaza").Text.Trim
Dim NumeroCuenta = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNumeroCuenta").Text.Trim
Dim ConvenioCIE = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtConvenioCIE").Text.Trim
Dim Referencia = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtReferencia").Text.Trim
Dim CveMoneda = GvBancosCuentas.Rows(e.RowIndex).FCDropDownList("DdlMoneda").SelectedValue.ToString().ToEntero()
Dim Estatus = GvBancosCuentas.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked
Dim EstatusPagoElectronico = GvBancosCuentas.Rows(e.RowIndex).FCCheckBox("ChkEstatusPagoE").Checked
Dim Moneda = GvBancosCuentas.Rows(e.RowIndex).FCDropDownList("DdlMoneda").SelectedItem.Text
Dim BBVAAlias As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtBBVAAlias").Text
Dim RefCrediProveedor = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtRefCrediProveedor").Text.Trim
Dim EsBancomer = False
If NombreBanco.ToUpper.Contains("BBVA") Or NombreBanco.ToUpper.Contains("BANCOMER") Or (CLABE.Length = 18 AndAlso CLABE.Substring(0, 3) = "012") Then
EsBancomer = True
End If
If EsBancomer AndAlso (CLABE.Length = 18 AndAlso Not CLABE.Substring(0, 3) = "012") Then
Alert("La CLABE ingresada no pertenece a BANCOMER.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
''CLABE SIEMPRE OBLIGATORIA CUANDO NO ES BANCOMER CON CIE
'If (CLABE.Trim.Length <> 18 And Not EsBancomer) Or (EsBancomer And ConvenioCIE.Trim.Length <> 6 And CLABE.Trim.Length <> 18) Then
' Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
If CLABE.Trim.Length <> 18 And CLABE.Trim.Length = 0 And Not EsBancomer Then
Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
If NumeroCuenta.Trim.Length <> 0 AndAlso NumeroCuenta.Trim.Length <> 10 AndAlso EsBancomer Then
Alert("El número de cuenta debe tener una longitud de 10 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
If CLABE.Trim.Length <> 0 AndAlso CLABE.Trim.Length <> 18 Then
Alert("La CLABE debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'SI CIE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 6 Y REFERENCIA OBLIGATORIA
If (ConvenioCIE.Trim.Length <> 0 And ConvenioCIE.Trim.Length <> 6) Or (ConvenioCIE.Trim.Length = 6 And Referencia.Trim.Length < 3) Then
Alert("El Convenio CIE debe tener una longitud de 6 dígitos y se debe especificar una referencia. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
If EsBancomer AndAlso Not (NumeroCuenta.Trim.Length = 10 Or ConvenioCIE.Trim.Length = 6) Then
Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim ObjCuentasBancos As New ClsGenerales
If CvePersonal > 0 Then
If ObjCuentasBancos.UpdateCuentasDepositos(GvBancosCuentas.DataKeys(e.RowIndex)("CveCuentaDeposito").ToString().ToEntero(), NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, RefCrediProveedor, False, Estatus, CveMoneda, UsuarioActual.CveEmpresa, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=BBVAAlias, EstatusPagoElectronico:=EstatusPagoElectronico) Then
DTCuentasBancos.Clear()
DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CvePersonal = {0}", CvePersonal)))
Alert("Cuenta actualizada con exito.", TipoMensaje.MsgInformacion)
End If
Else
Dim index = GvBancosCuentas.Rows(e.RowIndex).DataKey("CveCuentaDeposito").ToString().ToEntero() - 1
Dim Row As DataRow = TempDTCuentasBancos.Rows(index)
Row("BancoNombre") = NombreBanco
Row("Sucursal") = NumeroSucursal
Row("CLABE") = CLABE
Row("SWIFT") = SWIFT
Row("Plaza") = Plaza
Row("Cuenta") = NumeroCuenta
Row("CIE") = ConvenioCIE
Row("Referencia") = Referencia
Row("CveMoneda") = CveMoneda
Row("Moneda") = Moneda
TempDTCuentasBancos.AcceptChanges()
End If
ObjCuentasBancos.Dispose()
GvBancosCuentas.EditIndex = -1
CargaGridCuentasBancos("")
CargaGvBitacora()
End Sub
Protected Sub GvBancosCuentas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvBancosCuentas.RowDeleting
Dim ObjCuentasBancos As New ClsGenerales
If CvePersonal > 0 Then
If ObjCuentasBancos.RemoveCuentasDepositos(GvBancosCuentas.DataKeys(e.RowIndex)("CveCuentaDeposito").ToString().ToEntero(), UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
DTCuentasBancos.Clear()
DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CvePersonal = {0}", CvePersonal)))
Alert("Cuenta Bancaria borrada con exito.", TipoMensaje.MsgInformacion)
End If
Else
Dim index = GvBancosCuentas.Rows(e.RowIndex).DataKey("CveCuentaDeposito").ToString().ToEntero() - 1
TempDTCuentasBancos.Rows.RemoveAt(index)
End If
CargaGridCuentasBancos("")
ObjCuentasBancos.Dispose()
CargaGvBitacora()
End Sub
#End Region
#End Region
#Region "O R D E N A M I E N T O"
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = ""
Dim Campo As String = ""
Dim gvi As Integer = 0
Dim Literal As Literal = Nothing
Const OrdenInicial As String = ""
Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString().Split(";"c)
Campo = Arg(0)
gvi = Arg(1).ToEntero()
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
Campo = Campo.Substring(0, Campo.Length - 1)
If ViewState(String.Format("O{0}", Campo, gvi)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo, gvi)).ToString() = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else
ViewState(String.Format("O{0}", Campo, gvi)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo, gvi)).ToString()
ViewState("Orden") = Orden
CargaGrid(Orden, gvi)
End Sub
Private Sub CargaGrid(Orden As String, gvi As Integer)
If gvi = 0 Then
ViewState("Orden") = Orden
CargaGridCuentasBancos(Orden)
ElseIf gvi = 1 Then
ViewState("Orden1") = Orden
CargaGvAsistencias()
End If
End Sub
#End Region
#Region "I M P R I M I R N O M I N A"
Private Function ValorNodoXML(n As System.Xml.XmlNode, Campo As String, Optional Retorno As String = "") As String
Dim o As System.Xml.XmlNode = n.Attributes.Cast(Of System.Xml.XmlAttribute)().SingleOrDefault(Function(a) String.Compare(a.Name, Campo, True) = 0)
If o Is Nothing Then
Return Retorno
Else
Return o.Value
End If
End Function
Protected Sub LbPDF_Click(sender As Object, e As EventArgs)
Dim LB = CType(sender, LinkButton)
ImprimirbytesPDF(GeneraPDFNomina(CvePersonal, LB.CommandArgument.ToEntero(), UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta), "recibo")
ImprimirbytesPDF(GeneraPDFNomina(CvePersonal, LB.CommandArgument.ToEntero(), UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta), "recibo")
End Sub
#End Region
#Region " ORGANIGRAMA "
Private Sub CargaSuperioresOrganigrama()
Dim ObjRH As New ClsRH
If ObjRH.GetPersonal(-1, UsuarioActual.CveEmpresa) Then
DdlSupervisorOrganigrama.DataSource = ObjRH.DtResultados
Else
DdlSupervisorOrganigrama.DataSource = Nothing
Alert("Ocurrió un error al cargar el catálogo de Jefes Inmediatos")
End If
ObjRH.Dispose()
If DdlSupervisorOrganigrama.DataSource IsNot Nothing Then
DdlSupervisorOrganigrama.DataBind()
End If
End Sub
#End Region
#Region "I M P R I M I R "
Private Sub GenerarPDF(Optional Formato As String = "PDF")
Dim ObjPersonal As New ClsRH()
If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
If ObjPersonal.DtResultados.Rows.Count > 0 Then
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("ApellidoP", ObjPersonal.APaterno))
params.Add(New ReportParameter("ApellidoM", ObjPersonal.AMaterno))
params.Add(New ReportParameter("Nombres", ObjPersonal.Nombres))
params.Add(New ReportParameter("Codigo", ObjPersonal.Codigo))
params.Add(New ReportParameter("Escolaridad", If(DdlEscolaridad.SelectedValue = "-1", "", DdlEscolaridad.SelectedItem.Text)))
params.Add(New ReportParameter("EstadoCivil", If(DdlEstadoCivil.SelectedValue = "-1", "", DdlEstadoCivil.SelectedItem.Text)))
params.Add(New ReportParameter("Genero", If(DdlGenero.SelectedValue = "-1", "", DdlGenero.SelectedItem.Text)))
params.Add(New ReportParameter("FechaNacimiento", ObjPersonal.FechaNacimiento.ToShortDateString))
params.Add(New ReportParameter("RFC", ObjPersonal.RFC))
params.Add(New ReportParameter("CURP", ObjPersonal.CURP))
params.Add(New ReportParameter("Calle", ObjPersonal.Calle))
params.Add(New ReportParameter("Numero", ObjPersonal.NumExt))
params.Add(New ReportParameter("Interior", ObjPersonal.NumInt))
params.Add(New ReportParameter("Colonia", ObjPersonal.Colonia))
params.Add(New ReportParameter("CP", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Ciudad", ObjPersonal.CP))
params.Add(New ReportParameter("Estado", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Telefono", ObjPersonal.Telefono))
params.Add(New ReportParameter("TelefonoEmergencia", ObjPersonal.TelefonoEmergencia))
params.Add(New ReportParameter("Beneficiario", ObjPersonal.Beneficiario))
params.Add(New ReportParameter("Celular", ObjPersonal.Celular))
params.Add(New ReportParameter("Correo", ObjPersonal.Correo))
params.Add(New ReportParameter("LugarNacimiento", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("CredencialElector", ObjPersonal.CredencialElector))
params.Add(New ReportParameter("NombrePadre", ObjPersonal.NombrePadre))
params.Add(New ReportParameter("NombreMadre", ObjPersonal.NombreMadre))
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Correo", ObjPersonal.Correo))
params.Add(New ReportParameter("FechaIContrato", ObjPersonal.FechaInicioContrato.ToShortDateString))
params.Add(New ReportParameter("FechaFContrato", ObjPersonal.FechaFinContrato.ToShortDateString))
params.Add(New ReportParameter("TipoContrato", If(DdlTipoContrato.SelectedValue = "-1", "", DdlTipoContrato.SelectedItem.Text)))
params.Add(New ReportParameter("Turno", If(DdlTurno.SelectedValue = "-1", "", DdlTurno.SelectedItem.Text)))
params.Add(New ReportParameter("Jornada", If(DdlJornada.SelectedValue = "-1", "", DdlJornada.SelectedItem.Text)))
params.Add(New ReportParameter("Ruta", If(DdlRuta.SelectedValue = "-1", "", DdlRuta.SelectedItem.Text)))
params.Add(New ReportParameter("Departamento", If(DdlDepartamento.SelectedValue = "-1", "", DdlDepartamento.SelectedItem.Text)))
params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue = "-1", "", DdlPuesto.SelectedItem.Text)))
params.Add(New ReportParameter("SupervisorRH", If(DdlSupervisor.SelectedValue = "-1", "", DdlSupervisor.SelectedItem.Text)))
params.Add(New ReportParameter("SupervisorInmediato", If(DdlSupervisorOrganigrama.SelectedValue = "-1", "", DdlSupervisorOrganigrama.SelectedItem.Text)))
params.Add(New ReportParameter("Cliente", DdlClienteAsignado.SelectedText))
params.Add(New ReportParameter("Proyecto", DdlProyectoAsignado.SelectedItem.Text))
params.Add(New ReportParameter("SubProyecto", DdlSubProyectoAsignado.SelectedItem.Text))
params.Add(New ReportParameter("Estatus", If(DdlEstatusPersonal.SelectedValue = "-1", "", DdlEstatusPersonal.SelectedItem.Text)))
params.Add(New ReportParameter("MotivoBaja", ""))
params.Add(New ReportParameter("FechaInicio", ObjPersonal.FechaIng.ToShortDateString))
params.Add(New ReportParameter("FechaFin", If(ObjPersonal.FechaBaja.ToShortDateString = "01/01/0001", "", ObjPersonal.FechaBaja.ToShortDateString)))
params.Add(New ReportParameter("CuentaContable", DdlViaticos.SelectedItem.Text))
params.Add(New ReportParameter("FechaIngreso", ObjPersonal.FechaIngreso.ToShortDateString))
params.Add(New ReportParameter("TipoPeriodo", ObjPersonal.CveTipoPeriodo.ToString()))
params.Add(New ReportParameter("RegimenContratacion", ObjPersonal.RegimenContratacion))
params.Add(New ReportParameter("RiesgoPuesto", DdlRiesgoPuesto.SelectedItem.Text))
params.Add(New ReportParameter("NoSeguroSocial", ObjPersonal.NumeroSS))
params.Add(New ReportParameter("InscribioSeguro", If(ObjPersonal.SeInscribioSS, "Si", "No")))
params.Add(New ReportParameter("SDD", ObjPersonal.SalarioDiario.ToString()))
params.Add(New ReportParameter("SDI", ObjPersonal.SDI.ToString()))
params.Add(New ReportParameter("SalarioIMSS", ObjPersonal.SalarioDiarioSS.ToString()))
params.Add(New ReportParameter("Bono", ""))
params.Add(New ReportParameter("DiasAguinaldo", ObjPersonal.NumDiasAguinaldo.ToString()))
params.Add(New ReportParameter("PrimaVacacional", ObjPersonal.PorPrimaVacacional.ToString()))
params.Add(New ReportParameter("MetodoPago", If(DdlMetodoPago.SelectedValue = "-1", "", DdlMetodoPago.SelectedItem.Text)))
params.Add(New ReportParameter("Banco", If(DdlBanco.SelectedValue = "-1", "", DdlBanco.SelectedItem.Text)))
params.Add(New ReportParameter("NoCuenta", ObjPersonal.BancoNumCuenta))
params.Add(New ReportParameter("CLABE", ObjPersonal.CLABE))
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.URL & ".png") Then
params.Add(New ReportParameter("LogoUri", "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL & ".png"))
Else
params.Add(New ReportParameter("LogoUri", ""))
End If
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
ImprimirPDF("Empresas/Grales/Formatos/Personal.rdlc", New DataTable, params, "ReportePersonal", Formato)
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
End If
ObjPersonal.Dispose()
End Sub
'Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
' GenerarPDF("PDF")
'End Sub
Protected Sub ImgImprimirExpediente_Click(sender As Object, e As EventArgs) Handles ImgImprimirExpediente.Click
Dim ObjPersonal As New ClsRH()
If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
If ObjPersonal.DtResultados.Rows.Count > 0 Then
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("ApellidoP", ObjPersonal.APaterno))
params.Add(New ReportParameter("ApellidoM", ObjPersonal.AMaterno))
params.Add(New ReportParameter("Nombres", ObjPersonal.Nombres))
params.Add(New ReportParameter("Codigo", ObjPersonal.Codigo))
params.Add(New ReportParameter("Escolaridad", If(DdlEscolaridad.SelectedValue = "-1", "", DdlEscolaridad.SelectedItem.Text)))
params.Add(New ReportParameter("EstadoCivil", If(DdlEstadoCivil.SelectedValue = "-1", "", DdlEstadoCivil.SelectedItem.Text)))
params.Add(New ReportParameter("Genero", If(DdlGenero.SelectedValue = "-1", "", DdlGenero.SelectedItem.Text)))
params.Add(New ReportParameter("FechaNacimiento", ObjPersonal.FechaNacimiento.ToShortDateString))
params.Add(New ReportParameter("RFC", ObjPersonal.RFC))
params.Add(New ReportParameter("CURP", ObjPersonal.CURP))
params.Add(New ReportParameter("Calle", ObjPersonal.Calle))
params.Add(New ReportParameter("Numero", ObjPersonal.NumExt))
params.Add(New ReportParameter("Interior", ObjPersonal.NumInt))
params.Add(New ReportParameter("Colonia", ObjPersonal.Colonia))
params.Add(New ReportParameter("CP", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Ciudad", ObjPersonal.CP))
params.Add(New ReportParameter("Estado", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Telefono", ObjPersonal.Telefono))
params.Add(New ReportParameter("Celular", ObjPersonal.Celular))
params.Add(New ReportParameter("Correo", ObjPersonal.Correo))
params.Add(New ReportParameter("LugarNacimiento", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("NombrePadre", ObjPersonal.NombrePadre))
params.Add(New ReportParameter("NombreMadre", ObjPersonal.NombreMadre))
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Correo", ObjPersonal.Correo))
params.Add(New ReportParameter("FechaIContrato", ObjPersonal.FechaInicioContrato.ToShortDateString))
params.Add(New ReportParameter("FechaFContrato", ObjPersonal.FechaFinContrato.ToShortDateString))
params.Add(New ReportParameter("TipoContrato", If(DdlTipoContrato.SelectedValue = "-1", "", DdlTipoContrato.SelectedItem.Text)))
params.Add(New ReportParameter("Turno", If(DdlTurno.SelectedValue = "-1", "", DdlTurno.SelectedItem.Text)))
params.Add(New ReportParameter("Jornada", If(DdlJornada.SelectedValue = "-1", "", DdlJornada.SelectedItem.Text)))
params.Add(New ReportParameter("Ruta", If(DdlRuta.SelectedValue = "-1", "", DdlRuta.SelectedItem.Text)))
params.Add(New ReportParameter("Departamento", If(DdlDepartamento.SelectedValue = "-1", "", DdlDepartamento.SelectedItem.Text)))
params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue = "-1", "", DdlPuesto.SelectedItem.Text)))
params.Add(New ReportParameter("SupervisorRH", If(DdlSupervisor.SelectedValue = "-1", "", DdlSupervisor.SelectedItem.Text)))
params.Add(New ReportParameter("SupervisorInmediato", If(DdlSupervisorOrganigrama.SelectedValue = "-1", "", DdlSupervisorOrganigrama.SelectedItem.Text)))
params.Add(New ReportParameter("Cliente", DdlClienteAsignado.SelectedText))
params.Add(New ReportParameter("Proyecto", DdlProyectoAsignado.SelectedItem.Text))
params.Add(New ReportParameter("SubProyecto", DdlSubProyectoAsignado.SelectedItem.Text))
params.Add(New ReportParameter("Estatus", If(DdlEstatusPersonal.SelectedValue = "-1", "", DdlEstatusPersonal.SelectedItem.Text)))
params.Add(New ReportParameter("MotivoBaja", ""))
params.Add(New ReportParameter("FechaInicio", ObjPersonal.FechaIng.ToShortDateString))
params.Add(New ReportParameter("FechaFin", If(ObjPersonal.FechaBaja.ToShortDateString = "01/01/0001", "", ObjPersonal.FechaBaja.ToShortDateString)))
params.Add(New ReportParameter("CuentaContable", DdlViaticos.SelectedItem.Text))
params.Add(New ReportParameter("FechaIngreso", ObjPersonal.FechaIngreso.ToShortDateString))
params.Add(New ReportParameter("TipoPeriodo", ObjPersonal.CveTipoPeriodo.ToString()))
params.Add(New ReportParameter("RegimenContratacion", ObjPersonal.RegimenContratacion))
params.Add(New ReportParameter("RiesgoPuesto", DdlRiesgoPuesto.SelectedItem.Text))
params.Add(New ReportParameter("NoSeguroSocial", ObjPersonal.NumeroSS))
params.Add(New ReportParameter("InscribioSeguro", If(ObjPersonal.SeInscribioSS, "Si", "No")))
params.Add(New ReportParameter("SDD", ObjPersonal.SalarioDiario.ToString()))
params.Add(New ReportParameter("SDI", ObjPersonal.SDI.ToString()))
params.Add(New ReportParameter("SalarioIMSS", ObjPersonal.SalarioDiarioSS.ToString()))
params.Add(New ReportParameter("Bono", ""))
params.Add(New ReportParameter("DiasAguinaldo", ObjPersonal.NumDiasAguinaldo.ToString()))
params.Add(New ReportParameter("PrimaVacacional", ObjPersonal.PorPrimaVacacional.ToString()))
params.Add(New ReportParameter("MetodoPago", If(DdlMetodoPago.SelectedValue = "-1", "", DdlMetodoPago.SelectedItem.Text)))
params.Add(New ReportParameter("Banco", If(DdlBanco.SelectedValue = "-1", "", DdlBanco.SelectedItem.Text)))
params.Add(New ReportParameter("NoCuenta", ObjPersonal.BancoNumCuenta))
params.Add(New ReportParameter("CLABE", ObjPersonal.CLABE))
params.Add(New ReportParameter("Fecha", DateTime.Now.ToShortDateString))
Dim edad As Integer
edad = Now.Year - ObjPersonal.FechaNacimiento.Year
If Now.Month < ObjPersonal.FechaNacimiento.Month OrElse (Now.Month = ObjPersonal.FechaNacimiento.Month AndAlso Now.Day < ObjPersonal.FechaNacimiento.Day) Then
edad = edad - 1
End If
params.Add(New ReportParameter("Edad", edad.ToString()))
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.URL & ".png") Then
params.Add(New ReportParameter("LogoUri", "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL & ".png"))
Else
params.Add(New ReportParameter("LogoUri", ""))
End If
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
ImprimirPDF("Empresas/Grales/Formatos/ExpedientePersonal.rdlc", New DataTable, params, "ExpedientePersonal")
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
End If
ObjPersonal.Dispose()
End Sub
Private Sub LbGafete_Click(sender As Object, e As EventArgs) Handles LbGafete.Click
Dim params As New List(Of ReportParameter)
Dim ObjPersonal As New ClsRH()
If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
If ObjPersonal.DtResultados.Rows.Count > 0 Then
params.Add(New ReportParameter("Nombre", String.Format("{0} {1} {2}", TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim)))
params.Add(New ReportParameter("Vigencia", TxtFechaFinContrato.Text))
params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue.ToEntero() > 0, DdlPuesto.SelectedItem.Text, "")))
params.Add(New ReportParameter("CURP", TxtCURP.Text))
params.Add(New ReportParameter("NoRegistro", ""))
params.Add(New ReportParameter("RegIMSS", TxtNumeroSS.Text))
params.Add(New ReportParameter("FechaIngreso", TxtFechaIngreso.Text))
params.Add(New ReportParameter("DomPart", String.Format("{0} NoExt:{1} NoInt:{2} {3}", TxtCalle.Text, TxtNumExt.Text, TxtNumInt.Text, TxtColonia.Text)))
params.Add(New ReportParameter("Emergencia", ""))
params.Add(New ReportParameter("CUIP", ""))
params.Add(New ReportParameter("TipoSangre", ""))
params.Add(New ReportParameter("RFC", TxtRFC.Text))
params.Add(New ReportParameter("Denominacion", TxtRFC.Text))
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.CvePersonal & ".png") Then
params.Add(New ReportParameter("LogoUri", String.Format("{0}://{1}:{2}/Empresas/{3}/RH/Personal/{4}.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, ObjPersonal.CvePersonal)))
Else
params.Add(New ReportParameter("LogoUri", ""))
End If
ImprimirPDF("Empresas/Grales/Formatos/RHGafete.rdlc", New DataTable, params, String.Format("Gafete_{0}", ObjPersonal.CvePersonal), "PDF")
End If
End If
ObjPersonal.Dispose()
End Sub
Private Sub GenerarPDFGastosXComp(Optional Formato As String = "PDF")
If CvePersonal > 0 Then
If RBLTipoGastos.SelectedValue = "1" Then
If DTGastosSinComp.Rows.Count > 0 Then
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Empleado", LtlPersonal.Text.ToString()))
params.Add(New ReportParameter("Saldo", LblSaldoGxC.Text.ToString()))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
ImprimirPDF("Empresas/Grales/Formatos/GastosXComprobarGral.rdlc", DTGastosSinComp, params, "GastosSinComprobarGral", Formato)
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
ElseIf RBLTipoGastos.SelectedValue = "2" Then
If DTGastosPorCheque.Rows.Count > 0 Then
For Each Row As DataRow In DTGastosPorCheque.Rows
Dim FolioPago As String = Row("FolioPago").ToString()
Row("FolioPago") = ""
If Row("CveCompra").ToString() = "" And Row("CveIE").ToString() <> "" Then
Row("FechaVencimiento") = Row("FechaDocumento")
Row("FolioPago") = FolioPago
End If
If Row("FolioPago").ToString() <> "" Then
Row("SerieFolio") = ""
End If
Next
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Empleado", LtlPersonal.Text.ToString()))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
ImprimirPDF("Empresas/Grales/Formatos/GastosXComprobarCheque.rdlc", DTGastosPorCheque, params, "GastosPorCheque", Formato)
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
End If
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
End Sub
Protected Sub BtnPDFHistorial_Click(sender As Object, e As EventArgs)
GenerarPDFGastosXComp("PDF")
End Sub
Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs)
GenerarPDFGastosXComp("Excel")
End Sub
#End Region
#Region "D O C U M E N T A C I O N C O N T R A T O S"
Private Sub CargaDocumentacionFirmaDecontratos()
If CvePersonal > 0 Then
Dim objRH As New ClsEdocumentacion()
If objRH.DocumentacionElectronicaGet(CvePersonal, -1, -1, UsuarioActual.Empresa.CveEmpresa, -1) Then
DTDocumentacion = objRH.DtResultados
End If
If DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ").Rows.Count > 0 Then
GvDocumentosFirma.DataSource = DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ")
Else
GvDocumentosFirma.DataSource = Nothing
End If
If DTDocumentacion.FiltraParametros(" Modulo = 7 ").Rows.Count > 0 Then
GVMaterialidad.DataSource = DTDocumentacion.FiltraParametros(" Modulo = 7 ")
Else
GVMaterialidad.DataSource = Nothing
End If
GVMaterialidad.DataBind()
GvDocumentosFirma.DataBind()
UpMaterialidad.Update()
UPGvDocumentosFirma.Update()
UpGvDocumentosFirma2.Update()
End If
End Sub
Public Sub UploadModal_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim chkEstatus As CheckBox
CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString().ToEntero()
CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString().ToEntero()
Documentacion = GvRow.DataKey("Documentacion")
AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString()
chkEstatus = GvRow.FCCheckBox("chkEstatus")
ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper
FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate
AdjuntoDocumentacion = GvRow.DataKey("Adjunto")
LtlTitulofirmaContrato.Text = "Subir " & Documentacion
UpTituloFirma.Update()
RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal({ backdrop: 'static', keyboard: false});")
End Sub
Private Sub GuardarDocumentosFirmaContrato(Optional _CveDocumentacionExcluir As Integer = -1)
Dim hasError As Boolean = True
Dim objDocumentos As New ClsEdocumentacion
For Each dRow As GridViewRow In GvDocumentosFirma.Rows
Dim _CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToString().ToEntero()
Dim _Adjunto As String = dRow.DataKey("Adjunto")
'Dim _Documentacion As String = dRow.DataKey("Documentacion")
Dim _CveDocumentacionElectronica As Integer = dRow.DataKey("CveDocumentacionElectronica").ToString().ToEntero()
Dim _txtObservaciones As TextBox = dRow.FCTextBox("TxtObservaciones")
Dim _TxtFechaLimite As TextBox = dRow.FCTextBox("TxtFechaLimite")
Dim _TxtFechaVigencia As TextBox = dRow.FCTextBox("TxtFechaVigencia")
Dim chkEstatus As CheckBox = dRow.FCCheckBox("chkEstatus")
Dim _estatus As Integer
_estatus = If(dRow.DataKey("Estatus").ToString().ToUpper = "TRUE", 1, 0)
Dim _FechaVigencia As Date
Dim _FechaLimite As Date
Dim DiasLimite As Integer = dRow.DataKey("DiasLimite").ToString().ToEntero()
Dim AplicaDiasLimite As Boolean = If(dRow.DataKey("AplicaDiasLimite").ToString() = "1", True, False)
Dim AplicaFechaVencimiento As Boolean = If(dRow.DataKey("AplicaFechaVencimiento").ToString() = "1", True, False)
If _TxtFechaVigencia.Text.Length = 10 Then
_FechaVigencia = _TxtFechaVigencia.Text.ToDate
Else
_FechaVigencia = Nothing
End If
If Not AplicaDiasLimite Then
_FechaLimite = MinFecha
Else
_FechaLimite = _TxtFechaLimite.Text.ToDate
End If
If Not AplicaFechaVencimiento Then
_FechaVigencia = MinFecha
End If
If Not _CveDocumentacionExcluir = _CveDocumentacion Then
Try
If _CveDocumentacionElectronica = -1 Then
If objDocumentos.DocumentacionElectronicaAdd(_CveDocumentacion, CvePersonal, -1, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) > 0 Then
Else
hasError = True
Exit For
End If
Else
If objDocumentos.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, CvePersonal, -1, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) Then
Else
hasError = True
Exit For
End If
End If
hasError = False
Catch ex As Exception
hasError = True
Exit For
End Try
End If
Next
'refrescar grid datos investigacion
CargaDocumentacionFirmaDecontratos()
End Sub
Protected Sub BtnModalFirmaContratoDocumentoUpload_Click(sender As Object, e As EventArgs) Handles BtnModalFirmaContratoDocumentoUpload.Click
Dim FileExtension As String = "-1"
Dim Filesgral As List(Of Archivo) = TxtFileFirmaContrato.getfiles().Archivos
Dim Filename As String = ""
For Each fileItem As Archivo In Filesgral
Try
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
Dim tempArray() As String
tempArray = fileItem.filename.ToString().Split("-".ToCharArray())
Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\" & Documentacion & "." & FileExtension
Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\" & AdjuntoDocumentacion
If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\") Then
System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\")
End If
If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then
File.Delete(rutaAdjuntoAnterior)
End If
If System.IO.File.Exists(rutaDestino) Then
System.IO.File.Delete(rutaDestino)
End If
System.IO.File.Move(fileItem.FileUrl, rutaDestino)
Dim objRH As New ClsEdocumentacion
If CveDocumentacionElectronica = -1 Then
If objRH.DocumentacionElectronicaAdd(CveDocumentacion, CvePersonal, -1, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) > 0 Then
End If
Else
If objRH.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, CvePersonal, -1, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) Then
End If
End If
objRH.Dispose()
GuardarDocumentosFirmaContrato(CveDocumentacion)
CargaDocumentacionFirmaDecontratos()
TxtFileFirmaContrato.Text = ""
UpModalFirmaContratoDocumento.Update()
Catch ex As Exception
OnError("Error al cargar archivo", ex)
End Try
Next
RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal('hide')", "hidemodal7")
End Sub
Public Sub Update_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim activo As Boolean = False
Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString().ToEntero()
Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString().ToEntero()
Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString()
Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate
Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text
'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList)
Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox)
If chkCompleto.Checked Then
Estatus = 1
Else
Estatus = 0
End If
Dim objRH As New ClsEdocumentacion
If Not _CveDocumentacionElectronica = -1 Then
If objRH.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, CvePersonal, -1, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) Then
Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion)
End If
Else
If objRH.DocumentacionElectronicaAdd(_CveDocumentacion, CvePersonal, -1, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) > 0 Then
Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion)
End If
End If
CargaDocumentacionFirmaDecontratos()
objRH.Dispose()
End Sub
Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosFirma.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString()
Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato")
Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad")
Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired")
Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite")
Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False)
Dim chkEstatus As CheckBox = e.Row.FCCheckBox("chkEstatus")
Dim documentacionFormato As String = e.Row.DBCampo("DocumentacionFormato").ToString()
Dim Documentacion As String = e.Row.DBCampo("Documentacion").ToString()
Dim _CveDocumentacion As Integer = e.Row.DBCampo("CveDocumentacion").ToString().ToEntero()
Dim separado As Char() = ".".ToString().ToCharArray
Dim array() As String = Adjunto.Split(separado)
Dim extencion As String = ""
Dim existeAdjunto As Boolean = False
Dim TxtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia")
' FechaVigencia
Dim DiasLimite As Integer = e.Row.DataKey("DiasLimite").ToString().ToEntero()
Dim AplicaDiasLimite As Boolean = If(e.Row.DataKey("AplicaDiasLimite").ToString() = "1", True, False)
Dim AplicaFechaVencimiento As Boolean = If(e.Row.DataKey("AplicaFechaVencimiento").ToString() = "1", True, False)
txtFechaLimite.Visible = If(AplicaDiasLimite, True, False)
TxtFechaVigencia.Visible = If(AplicaFechaVencimiento, True, False)
Dim scripMascara = " $('#" & TxtFechaVigencia.ClientID & "').mask('00/00/0000');"
RegistraScript(scripMascara)
If array.Length > 0 Then
extencion = array(array.Length - 1)
End If
If e.Row.DBCampo("Estatus").ToString().ToEntero() = 1 Then
chkEstatus.Checked = True
Else
chkEstatus.Checked = False
End If
If documentacionFormato = "" Then
ImgDownLoadFormato.Visible = False
Else
Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato
ImgDownLoadFormato.Visible = True
End If
txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString().ToDate.ToString("dd/MM/yyyy")
If Adjunto.Trim.Length > 0 Then
Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Personal/" & CvePersonal & "/" & Adjunto
Dim linkDescargaArchivo = UsuarioActual.Empresa.Ruta & "Personal/" & CvePersonal & "/" & Adjunto
If File.Exists(linkDescargaArchivo) Then
ImgDownLoad.Visible = True
If extencion.Length > 0 Then
ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CvePersonal & Documentacion & "." & extencion)
Else
ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CvePersonal & Documentacion)
End If
Else
ImgDownLoad.Visible = False
End If
Else
ImgDownLoad.Visible = False
End If
If requerido Then
ImgRequired.Text = " <a class='btn btn-circle btn-sm yelow' href='#' data-toggle='tooltip' title=' Requerido!' ><i class='fa fa-asterisk '></i></a>"
Else
' ImgRequired.Text = " <a class='btn btn-circle btn-sm grey-salt' href='#' data-toggle='tooltip' title='No obligatorio' ><i class='fa fa-asterisk '></i></a>"
End If
End If
End Sub
Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString().ToEntero()
Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato")
Dim ObjEdoc As New ClsEdocumentacion
If ObjEdoc.GetDocumentacionParametros(-1, CveDocumentacion, UsuarioActual.CveEmpresa) Then
If ObjEdoc.DtResultados.Rows.Count > 0 Then
GvParametros.DataSource = ObjEdoc.DtResultados
ObjEdoc.Dispose()
GvParametros.DataBind()
UpGvParametros.Update()
DocumentoParametros = DocumentacionFormato
RegistraScript("$('#DVDescargaDocumentoParametrosModal').modal('show')")
Else
ObjEdoc.Dispose()
DescarFormato(DocumentacionFormato)
End If
Else
ObjEdoc.Dispose()
End If
End Sub
Public Sub DescarFormato(documento As String)
Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory
Dim PathSource As String
Dim pathDesti As String
PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento
pathDesti = PathRoot & "Temp\" & CvePersonal & documento
If File.Exists(pathDesti) Then
File.Delete(pathDesti)
End If
File.Copy(PathSource, pathDesti)
Dim objDoc As New clsGemBoxDocument(pathDesti)
Dim objRH As New ClsRH
Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString() & " del " & Now.Year.ToString()
objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa))
objRH.Dispose()
objDoc.Guardar(pathDesti)
Dim fileinfo As New FileInfo(pathDesti)
Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)
baseUrl = baseUrl & "/temp/" & fileinfo.Name
RegistraDescargaJavaScript(baseUrl)
End Sub
Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos)
Dim ListaTagsDocumentost = New List(Of TagsDocumentos)
If CvePersonal <> -1 Then
Dim objRH As New ClsRH
If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then
ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{RFC}", objRH.DtResultados(0)("RFC").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", NombreCompleto))
ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString().ToDecimal.ToString("###,###,###.00")))
ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString()))
'If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text))
'End If
ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{FechaIngreso}", objRH.DtResultados(0)("FechaIngreso").ToString().ToDate.ToShortDateString))
ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString().ToDate.ToShortDateString))
ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString()))
ListaTagsDocumentost.Add(New TagsDocumentos("{CUIP}", ""))
ListaTagsDocumentost.Add(New TagsDocumentos("{Denominacion}", ""))
ListaTagsDocumentost.Add(New TagsDocumentos("{FechaNacimiento}", objRH.DtResultados(0)("FechaNacimiento").ToString().ToDate.ToString("dd/MM/yyyy")))
Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year
Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy")
ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual))
ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF))
End If
objRH.Dispose()
End If
Return ListaTagsDocumentost
End Function
'Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos)
' Dim ListaTagsDocumentost = New List(Of TagsDocumentos)
' If CvePersonal <> -1 Then
' Dim objRH As New ClsRH
' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then
' If Not IsDBNull(objRH.DtResultados(0)("Nombres")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString()))
' End If
' If Not objRH.DtResultados(0)("APaterno") Is Nothing Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString()))
' End If
' If Not objRH.DtResultados(0)("AMaterno") Is Nothing Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString()))
' End If
' If Not objRH.DtResultados(0)("NombreCompleto") Is Nothing Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", objRH.DtResultados(0)("NombreCompleto").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("Estatura")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("Peso")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("LugarNacimiento")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("Edad")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("NombreTelEmergencia")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("TipoSangre")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("Vivienda")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("ViviendaDueno")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("CreditoInfonavit")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("RentaMensual")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString().ToDecimal.ToString("###,###,###.00")))
' If Not IsDBNull(objRH.DtResultados(0)("TransportePublico")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormente")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("ParientesEmpresa")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelito")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelitoObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Direccion")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Calle")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Colonia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("CP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Telefono")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Celular")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Correo")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then
' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("NumeroSS")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Licencia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("CartillaMilitar")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("CURP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("AutorizaAntidoping")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Observaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("CredencialElector")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CredencialElector}", objRH.DtResultados(0)("CredencialElector").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Sucursal")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Sucursal}", objRH.DtResultados(0)("Sucursal").ToString()))
' If Not IsDBNull(objRH.DtResultados(0)("Puesto")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString()))
' 'If Not IsDBNull(objRH.DtResultados(0)("InformacionFidedigno")) Then chkFidedigna4.Checked = objRH.DtResultados(0)("InformacionFidedigno")
' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("InformacionFidedigno").ToString()))
' End If
' If Not IsDBNull(objRH.DtResultados(0)("FechaNacimiento")) Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("FechaNacimiento").ToString().ToDate.ToString("dd/MM/yyyy")))
' End If
' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year
' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy")
' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual))
' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF))
' objRH.Dispose()
' End If
' Return ListaTagsDocumentost
'End Function
Private Sub RegistraDescargaJavaScript(baseUrl As String)
RegistraScript("Download('" & baseUrl & "')")
End Sub
#End Region
Protected Sub LBCancelar_Click(sender As Object, e As EventArgs)
'Dim FolioFiscal = CType(sender, LinkButton).CommandArgument.ToString()
'Dim gvr As GridViewRow = CType(CType(sender, LinkButton).BindingContainer, GridViewRow)
'Dim CveNomina As Integer = gvr.DataKey("CveNomina").ToString().ToEntero()
'Dim Total As Decimal = gvr.DataKey("Total").ToString().ToDecimal
'Dim RFCReceptor As String = gvr.DataKey("RFC").ToString()
'Dim Obj As New Timbrado
'If Obj.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC) Then
' Dim ObjNomina As New ClsNominas()
' ObjNomina.UpdateEstatusNomNominas(2, -1, "", "", Now, CveNomina)
' ObjNomina.Dispose()
' Alert("La nómina se canceló correctamente.", TipoMensaje.MsgInformacion)
'End If
'Obj = Nothing
End Sub
#Region "VACACIONES"
Private Sub CargaVacaciones()
Dim objRH As New ClsRH
If objRH.VacacionesGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then
GvVacaciones.DataSource = objRH.DtResultados
If objRH.DtResultados.Rows.Count > 0 Then
VacFolioActual = objRH.DtResultados.Compute("Max(Folio)", String.Empty).ToString().ToEntero()
Else
VacFolioActual = 0
End If
Else
GvVacaciones.DataSource = Nothing
End If
objRH.Dispose()
GvVacaciones.DataBind()
UpGvVacaciones.Update()
End Sub
Protected Sub GvVacaciones_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvVacaciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim _Estatus As Boolean = Boolean.Parse(e.Row.DBCampo("Estatus").ToString())
Dim _Documento As String = e.Row.DataKey("Documento")
Dim _CveAutoriza As Integer = e.Row.DataKey("CveAutoriza").ToEntero()
Dim RutaDocuemntoAutorizacion As String = String.Format("{0}Personal\{1}\Vacaciones\{2}", UsuarioActual.Empresa.Ruta, CvePersonal, _Documento)
Dim lnkDescargaFormato As LinkButton = e.Row.FCLinkButton("ImgDescargaFormato")
Dim lnkDescargaAutorizacion As LinkButton = e.Row.FCLinkButton("ImgDescargaAutorizacion")
Dim lnkEditar As LinkButton = e.Row.FCLinkButton("ImgEditar")
If _CveAutoriza > 0 Or Not _Estatus Then
lnkEditar.Visible = False
End If
lnkDescargaFormato.Visible = True
'ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(lnkDescargaFormato)
If File.Exists(RutaDocuemntoAutorizacion) And _Estatus Then
lnkDescargaAutorizacion.Visible = True
'ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkDescargaAutorizacion)
Else
lnkDescargaAutorizacion.Visible = False
End If
'If _Estatus Then
' lnkDescargaFormato.Visible = True
' ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkDescargaFormato)
'Else
' lnkDescargaFormato.Visible = False
'End If
End If
End Sub
'cada vez que se hace un postback que relacione al gridview de vacaio es se tienen que generar los eventos de postback para la descarga de archivos
Private Sub AgregarEventosAsincronosGvVacaciones()
For Each GvRow As GridViewRow In GvPermisos.Rows
Dim lnkDescargaFormato As LinkButton = GvRow.FCLinkButton("ImgDescargaFormato")
If lnkDescargaFormato.Visible Then
ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkDescargaFormato)
End If
Next
For Each GvRow As GridViewRow In GvVacaciones.Rows
'Dim _Estatus As Boolean = Boolean.Parse(GvRow.DataKey("Estatus").ToString())
'Dim _Documento As String = GvRow.DataKey("Documento")
'Dim _CveAutoriza As Integer = GvRow.DataKey("CveAutoriza").ToEntero()
'Dim RutaDocuemntoAutorizacion As String = String.Format("{0}Personal\{1}\Vacaciones\{2}", UsuarioActual.Empresa.Ruta, CvePersonal, _Documento)
Dim lnkDescargaFormato As LinkButton = GvRow.FCLinkButton("ImgDescargaFormato")
Dim lnkDescargaAutorizacion As LinkButton = GvRow.FCLinkButton("ImgDescargaAutorizacion")
'Dim lnkEditar As LinkButton = GvRow.FCLinkButton("ImgEditar")
'If _CveAutoriza > 0 Or Not _Estatus Then
' lnkEditar.Visible = False
'End If
'lnkDescargaFormato.Visible = True
If lnkDescargaFormato.Visible Then
ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkDescargaFormato)
End If
If lnkDescargaAutorizacion.Visible Then
ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkDescargaAutorizacion)
End If
'If File.Exists(RutaDocuemntoAutorizacion) And _Estatus Then
' lnkDescargaAutorizacion.Visible = True
'Else
' lnkDescargaAutorizacion.Visible = False
'End If
Next
End Sub
Dim dtosvac As DataTable
Private Sub CargaVacacionesResumenPeriodoActual()
Using objnom As New ClsNominas
If objnom.GETPersonalVacResumen(UsuarioActual.Empresa.CveEmpresa, CvePersonal) Then
RPTVacacionesResumen.DataSource = objnom.DtResultados
DdlVacPeriodo.DataSource = objnom.DtResultados.FiltraParametros("DiasDisponibles > 0", "Ejercicio")
DdlVacPeriodo.DataBind()
DTVacResumen = objnom.DtResultados
Dim drow As DataRow = objnom.DtResultados.FiltroPrimero("Selected =1")
If Not IsNothing(drow) Then
DdlVacPeriodo.SelectedValueExist(drow("Ejercicio"))
DdlVacPeriodo_SelectedIndexChanged(Nothing, Nothing)
End If
End If
If objnom.GETPersonalVacaciones(UsuarioActual.Empresa.CveEmpresa, CvePersonal) Then
dtosvac = objnom.DtResultados
GvVaczxy.DataSource = dtosvac
GvVaczxy.DataBind()
End If
End Using
RPTVacacionesResumen.DataBind()
Using objRH As New ClsRH
If objRH.VacacionesResumenGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then
If objRH.DtResultados.Rows.Count > 0 Then
VacInicioPeriodo = objRH.DtResultados(0)("InicioPeriodo").ToString().ToDate
VacFinPeriodo = objRH.DtResultados(0)("FinPeriodo").ToString().ToDate
VacAnios = objRH.DtResultados(0)("Anios").ToString().ToEntero()
VacDias = objRH.DtResultados(0)("Dias").ToString().ToEntero()
VacDiasUsados = objRH.DtResultados(0)("DiasUsados").ToString().ToEntero()
VacDiasCancelados = objRH.DtResultados(0)("DiasCancelados").ToString().ToEntero()
VacDiasDisponibles = objRH.DtResultados(0)("DiasDisponibles").ToString().ToEntero()
GvVacacionesResumen.DataSource = objRH.DtResultados
VacSupervisorNombre = objRH.DtResultados(0)("SupervisorNombre").ToString()
VacSupervisorCorreo = objRH.DtResultados(0)("SupervisorCorreo").ToString()
VacCveSupervisor = objRH.DtResultados(0)("SupervisorCorreo").ToString().ToEntero()
Else
VacInicioPeriodo = Now
VacFinPeriodo = Now
VacAnios = 0
VacDias = 0
VacDiasUsados = 0
VacDiasCancelados = 0
VacDiasDisponibles = 0
End If
End If
End Using
GvVacacionesResumen.DataBind()
UpGvVacacionesResumen.Update()
End Sub
Protected Sub RPTVacacionesResumen_ItemDataBound(sender As Object, e As RepeaterItemEventArgs)
'Dim item As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
'If (item IsNot Nothing AndAlso item("CveEmpresa") IsNot Nothing) Then
' Dim CveEmpresa As Integer = item("CveEmpresa").ToString().ToEntero()
' Dim CvePersonal As Integer = item("CvePersonal").ToString().ToEntero()
' Dim Ejercicio As Integer = item("Ejercicio").ToString().ToEntero()
' Dim RptTitulo As GridView = DirectCast(e.Item.FindControl("GvVaczx"), GridView)
' If dtosvac IsNot Nothing Then
' RptTitulo.DataSource = dtosvac.FiltraParametros(String.Format("Ejercicio={0}", Ejercicio), "FechaIng")
' RptTitulo.DataBind()
' End If
'End If
End Sub
Protected Sub BtnSolicitarVacaciones_Click(sender As Object, e As EventArgs) Handles BtnSolicitarVacaciones.Click
Dim fInicio As Date = TxtFechaInicioVac.Text.ToDate()
Dim fFin As Date = TxtFechaFinVac.Text.ToDate()
Dim fechapago As String = TxtFechaPago.Text.ToDate().ToString("yyyy/MM/dd")
Dim diasinhabil As Integer = Txtdiasinabiles.Text.ToEntero()
'Dim motivoVacaciones As String = TxtMotivoVacaciones.Text
If fInicio <= fFin Then
VacFolioActual = VacFolioActual + 1
Dim objRH As New ClsRH
'Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, motivoVacaciones)
Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, FechaPago:=fechapago, diasinabiles:=diasinhabil, CveTipoPago:=DdlFormapagovacaciones.SelectedValue.ToEntero(), diasExtras:=TxtVacDiasExtra.Text.ToEntero(), Ejercicio:=DdlVacPeriodo.Text.ToEntero(), PrimaVacacional:=If(ChkVacPrimaVacacional.Checked, 1, 0), CobrarImss:=If(ChkVacCobrarIMSS.Checked, 1, 0), diasPago:=TxtVacDiasPago.Text.ToEntero())
If objRH.DtResultados.Rows.Count > 0 Then
Dim ShowError As String = objRH.DtResultados.Rows(0)("ShowError").ToString()
If ShowError.Length > 0 Then
Alert(ShowError, TipoMensaje.MsgAdvertencia)
continuar = False
End If
End If
objRH.Dispose()
If continuar Then
CargaVacaciones()
CargaVacacionesResumenPeriodoActual()
VacacionesMandaCorreoSupervisor("Solicitud Vacaciones " & NombreCompleto, VacSupervisorCorreo, VacSupervisorNombre, NombreCompleto, fInicio, fFin)
RegistraScript("$('#ModalAddVacaciones').modal('hide');")
End If
Else
Alert("La fecha Inicial debe ser inferior a la fecha final.", TipoMensaje.MsgAdvertencia)
End If
'If UsuarioActual.CveEmpresa <> 72 Then
' CargaVacaciones()
' CargaVacacionesResumenPeriodoActual()
' Dim objRH As New ClsRH
' If VacDiasDisponibles > 0 Then
' Dim fInicio As Date = TxtFechaInicioVac.Text.ToDate
' Dim fFin As Date = TxtFechaFinVac.Text.ToDate
' Dim ErrorSolicitud As Boolean = True
' Dim DiasSolicitados As Integer = (fFin - fInicio).TotalDays.ToString().ToEntero()
' If fInicio < fFin Or fInicio = fFin Then
' VacFolioActual = VacFolioActual + 1
' If fInicio = fFin Then
' If fInicio < VacFinPeriodo Then
' If objRH.VacacionesAddUpdate(-1, CvePersonal, fInicio, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual) Then
' ErrorSolicitud = False
' CargaVacaciones()
' CargaVacacionesResumenPeriodoActual()
' VacacionesMandaCorreoSupervisor("Solicitud Vacaciones " & NombreCompleto, VacSupervisorCorreo, VacSupervisorNombre, NombreCompleto, fInicio, fFin)
' 'DescarSolicitudVacaciones(VacFolioActual)
' End If
' End If
' Else
' If ((DiasSolicitados + 1) > VacDiasDisponibles) Then
' Alert("Los dias solicitados son mayores a los dias disponibles.", TipoMensaje.MsgAdvertencia)
' objRH.Dispose()
' Exit Sub
' End If
' Dim fVacacion As Date = fInicio
' For x As Integer = 0 To DiasSolicitados
' If fVacacion < VacFinPeriodo Then
' If objRH.VacacionesAddUpdate(-1, CvePersonal, fVacacion, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual) Then
' ErrorSolicitud = False
' Else
' ErrorSolicitud = True
' Exit For
' End If
' Else
' ErrorSolicitud = True
' Exit For
' End If
' fVacacion = fVacacion.AddDays(1)
' Next
' CargaVacaciones()
' CargaVacacionesResumenPeriodoActual()
' VacacionesMandaCorreoSupervisor("Solicitud Vacaciones " & NombreCompleto, VacSupervisorCorreo, VacSupervisorNombre, NombreCompleto, fInicio, fFin)
' If Not ErrorSolicitud Then
' 'DescarSolicitudVacaciones(VacFolioActual)
' End If
' End If
' Else
' Alert("La fecha Inicial debe ser inferior a la fecha final")
' End If
' Else
' Alert("No se tienen dias disponibles.")
' End If
' objRH.Dispose()
'ElseIf UsuarioActual.CveEmpresa = 72 Then
' Dim PathRoot As String = ModExtensiones.DirectorioBaseEmpresas
' Dim FormatoNombre As String = "PermisoSolicitud.docx"
' Dim RutaFormato As String = $"{PathRoot}\Empresas\{UsuarioActual.CveEmpresa}\Formatos\{FormatoNombre} "
' Dim RutaDocGral As String = $"{PathRoot}\Empresas\Grales\Formatos\{FormatoNombre} "
' Dim pathDesti As String = ""
' If Not File.Exists(RutaFormato) Then
' RutaFormato = $"{PathRoot}\Empresas\Grales\Formatos\{FormatoNombre} "
' End If
' pathDesti = PathRoot & "Temp\" & CvePersonal & "_" & FormatoNombre
' If File.Exists(pathDesti) Then
' File.Delete(pathDesti)
' End If
' File.Copy(RutaFormato, pathDesti)
' Dim objDoc As New clsGemBoxDocument(pathDesti)
' Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString() & " del " & Now.Year.ToString()
' Dim ListaTagsDocumentost = New List(Of TagsDocumentos)
' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", $"{TxtNombres.Text} {TxtAPaterno.Text} {TxtAMaterno.Text}"))
' ListaTagsDocumentost.Add(New TagsDocumentos("{Codigo}", TxtCodigo.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{Departamento}", DdlDepartamento.SelectedItem.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{JefeInmediato}", DdlSupervisorOrganigrama.SelectedItem.Text))
' For x As Integer = 1 To 8
' If DdlPermisoTipo.SelectedValue.ToEntero() = x Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{op" & x & "}", "X"))
' Else
' ListaTagsDocumentost.Add(New TagsDocumentos("{op" & x & "}", ""))
' End If
' Next
' If RblPermisoDocNecesario.SelectedValue = "1" Then
' ListaTagsDocumentost.Add(New TagsDocumentos("{op9}", "X"))
' ListaTagsDocumentost.Add(New TagsDocumentos("{op10}", ""))
' Else
' ListaTagsDocumentost.Add(New TagsDocumentos("{op9}", ""))
' ListaTagsDocumentost.Add(New TagsDocumentos("{op10}", "X"))
' End If
' ListaTagsDocumentost.Add(New TagsDocumentos("{Dias}", TxtPermisosDias.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{Horas}", TxtPermisosHoras.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaI}", TxtFechaInicioVac.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaF}", TxtFechaFinVac.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{Fecha}", Now.ToString("dd/MM/yyyy")))
' ListaTagsDocumentost.Add(New TagsDocumentos("{Reemplazo}", DdlPermisosReemplazo.SelectedItem.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{op11}", " "))
' ListaTagsDocumentost.Add(New TagsDocumentos("{op12}", " "))
' ListaTagsDocumentost.Add(New TagsDocumentos("{Motivo}", TxtPermisoMotivo.Text))
' ListaTagsDocumentost.Add(New TagsDocumentos("{Comentarios}", TxtPermisoComentarios.Text))
' objDoc.SustituirTags(ListaTagsDocumentost)
' objDoc.GuardarStreamPDF()
' Dim DocByte As Byte() = objDoc.GetBytesDocumento()
' Response.ClearHeaders()
' Response.Clear()
' Response.AddHeader("Content-Type", "application/pdf")
' Response.AddHeader("Content-Length", DocByte.Length.ToString())
' Response.AddHeader("Content-Disposition", "attachment; filename=sample.pdf")
' Response.BinaryWrite(DocByte)
' Response.Flush()
' Response.End()
'End If
End Sub
Private Sub VacacionesMandaCorreoSupervisor(Asunto As String, CorreoSupervisor As String, NombreSupervisor As String, NombreSolicitante As String, _FechaInicio As Date, _FechaFin As Date)
If CorreoSupervisor.Trim.Length > 0 Then
Dim a As String = String.Format("{0} -- {1} --- {2}", Asunto, CorreoSupervisor, "")
Dim Cuerpo As String
a.GuardaLog()
If _FechaInicio = _FechaFin Then
Cuerpo = "El empleado " & NombreCompleto & " a hecho una solicitud de vacaiones programada para el día " & _FechaInicio.ToString("dd/MM/yyyy") & " en las proximas horas se le presentara la solicitud para que se a aprovada o declinada por usted."
Else
Cuerpo = "El empleado " & NombreCompleto & " a hecho una solicitud de vacaiones programada de " & _FechaInicio.ToString("dd/MM/yyyy") & " a " & _FechaFin.ToString("dd/MM/yyyy") & " en las proximas horas se le presentara la solicitud para que se a aprovada o declinada por usted."
End If
Dim Mail As New ClsSisMail()
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
' CorreoSupervisor = "rakcsle.rakcsle@gmail.com"
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, CorreoSupervisor, Asunto, Cuerpo, "", LSRutasMail)
Mail = Nothing
Alert("Se ha enviado un correo al supervisor informandole de la solicitud.")
Else
Alert("La solicitud se a realizado correctamente.")
End If
End Sub
Protected Sub LnkEliminarSolicitud_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero()
Dim objRH As New ClsRH()
If objRH.RemoverSolicitudVacaciones(CvePersonalVacaciones) Then
CargaVacaciones()
CargaVacacionesResumenPeriodoActual()
Alert("Las vacaciones se ha eliminado")
End If
objRH.Dispose()
End Sub
Public Sub Edit_ClickVacacionDia(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero()
'ChkEstatusDiaVacacion.Checked = Boolean.Parse(GvRow.DataKey("Estatus"))
VacFolio = GvRow.DataKey("Folio").ToString().ToEntero()
TxtFechaDiaVacacion.Text = GvRow.DataKey("FechaInicio").ToString().ToDate.ToString("dd/MM/yyyy")
TxtFechaDiaVacacionFin.Text = GvRow.DataKey("FechaFin").ToString().ToDate.ToString("dd/MM/yyyy")
UpModalEditarDiaVacacion.Update()
RegistraScript("$('#divEditarDiaVacacion').modal({ backdrop: 'static', keyboard: false});")
End Sub
Protected Sub BtnEditarDiaVacacionModal_Click(sender As Object, e As EventArgs) Handles BtnEditarDiaVacacionModal.Click
Dim FileExtension As String = "-1"
Dim Filesgral As List(Of Archivo) = TxtFileFormatoVacaciones.getfiles().Archivos
Dim Filename As String = ""
Dim Documento As String = ""
For Each fileItem As Archivo In Filesgral
Try
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
Documento = $"Vacaciones_{CvePersonalVacaciones}.{FileExtension}"
Dim tempArray() As String
tempArray = fileItem.filename.ToString().Split("-".ToCharArray())
Dim rutaDestino As String = $"{UsuarioActual.Empresa.Ruta}Personal\{CvePersonal}\Vacaciones\{Documento}"
If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\Vacaciones\") Then
System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "Personal\" & CvePersonal & "\Vacaciones\")
End If
If System.IO.File.Exists(rutaDestino) Then
System.IO.File.Delete(rutaDestino)
End If
System.IO.File.Move(fileItem.FileUrl, rutaDestino)
TxtFileFormatoVacaciones.Text = ""
Catch ex As Exception
OnError("Error al cargar Formato vacaciones", ex)
End Try
Next
If Documento.Length > 0 Then
Dim objRH As New ClsRH()
If objRH.SolicitudVacacionesAddUpdate(CvePersonalVacaciones, CvePersonal, UsuarioActual.CveUsuario, Documento) Then
Alert("La fecha se actualizo correctamente")
End If
UpModalEditarDiaVacacion.Update()
objRH.Dispose()
CargaVacaciones()
CargaVacacionesResumenPeriodoActual()
RegistraScript("$('#divEditarDiaVacacion').modal('hide');")
Else
Alert("debe ingresar un documento para poder autorizar la solicitud", TipoMensaje.MsgAdvertencia)
End If
End Sub
Public Sub DownLoad_ClickSolicitudVacaciones(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
'Dim Folio As Integer = GvRow.DataKey("Folio").ToEntero()
'DescarSolicitudVacaciones(Folio)
Dim RutaFormato As String = String.Format("{0}Formatos\SolicitudVacaciones.docx", UsuarioActual.Empresa.Ruta)
Dim NombreEmpleado As String = String.Format("{0} {1} {2}", TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text)
Dim Codigo As String = TxtCodigo.Text
Dim Departamento As String = DdlDepartamento.SelectedItem.Text
Dim JefeInmediato As String = DdlSupervisorOrganigrama.SelectedItem.Text
Dim fechaIngreso As Date = TxtFechaIngreso.Text.ToDate()
Dim Periodoingreso As Integer = fechaIngreso.ToString("MMdd").ToEntero()
Dim PeriodoInicio As Integer = GvRow.DataKey("FechaInicio").ToDate().ToString("MMdd").ToEntero()
Dim FechaInicio As String = GvRow.DataKey("FechaInicio").ToDateTime().ToString("dd/MM/yyyy")
Dim FechaFin As String = GvRow.DataKey("FechaFin").ToDateTime().ToString("dd/MM/yyyy")
Dim diasPermiso As String = GvRow.DataKey("Dias")
Dim MotivoPermiso As String = GvRow.DataKey("Motivo")
Dim Puesto As String = DdlPuesto.SelectedItem.Value
Dim Fecha As String = DateTime.Now.ToString("dd/MM/yyyy")
Dim Solicitante As String = UsuarioActual.Nombre
Dim anio As Integer = GvRow.DataKey("FechaInicio").ToDate().Year
Dim FechaPeriodo As String = GvRow.DataKey("Periodo")
If Periodoingreso > PeriodoInicio Then
anio = anio - 1
End If
If File.Exists(RutaFormato) Then
Dim objGemDocument As New clsGemBoxDocument(RutaFormato)
Dim ListaTags As New List(Of TagsDocumentos)
ListaTags = GetDatosTagsDocumentos()
ListaTags.Add(New TagsDocumentos("{Solicitante}", Solicitante))
ListaTags.Add(New TagsDocumentos("{Fecha}", Fecha))
ListaTags.Add(New TagsDocumentos("{NombreEmpleado}", NombreEmpleado))
ListaTags.Add(New TagsDocumentos("{Codigo}", Codigo))
ListaTags.Add(New TagsDocumentos("{Departamento}", Departamento))
ListaTags.Add(New TagsDocumentos("{JefeInmediato}", JefeInmediato))
ListaTags.Add(New TagsDocumentos("{FechaInicio}", FechaInicio))
ListaTags.Add(New TagsDocumentos("{FechaFin}", FechaFin))
ListaTags.Add(New TagsDocumentos("{diasPermiso}", diasPermiso))
ListaTags.Add(New TagsDocumentos("{MotivoPermiso}", MotivoPermiso))
ListaTags.Add(New TagsDocumentos("{Puesto}", Puesto))
ListaTags.Add(New TagsDocumentos("{anio}", anio.ToString()))
ListaTags.Add(New TagsDocumentos("{FechaPeriodo}", FechaPeriodo))
objGemDocument.SustituirTags(ListaTags)
'objGemDocument.GuardarStream()
objGemDocument.GuardarStreamPDF()
Dim bytesInStream As Byte() = objGemDocument.GetBytesDocumento()
'Dim bytesInStream As Byte() = objGemDocument.memoryStream.ToArray
objGemDocument.Dispose()
Response.Clear()
Response.ContentType = "application/force-download"
Response.AddHeader("content-disposition", "attachment; filename=" & CvePersonal & "_Solicitud_Vacaciones_" & Now.ToString("yyyyMMddhhmmss") & ".pdf")
Response.BinaryWrite(bytesInStream)
Response.End()
Else
Alert("No se encontro el Formato, favor de revisarlo con soporte tecnico.", TipoMensaje.MsgAdvertencia)
End If
End Sub
Public Sub DownLoad_ClickSolicitudPermiso(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
'Dim Folio As Integer = GvRow.DataKey("Folio").ToEntero()
'DescarSolicitudVacaciones(Folio)
Dim RutaFormato As String = String.Format("{0}Formatos\PermisoSolicitud.docx", UsuarioActual.Empresa.Ruta)
Dim NombreEmpleado As String = String.Format("{0} {1} {2}", TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text)
Dim Codigo As String = TxtCodigo.Text
Dim Departamento As String = DdlDepartamento.SelectedItem.Text
Dim JefeInmediato As String = DdlSupervisorOrganigrama.SelectedItem.Text
Dim FechaInicio As String = GvRow.DataKey("FechaInicio").ToDateTime().ToString("dd/MM/yyyy")
Dim FechaFin As String = GvRow.DataKey("FechaFin").ToDateTime().ToString("dd/MM/yyyy")
Dim diasPermiso As String = $"{(GvRow.DataKey("FechaFin").ToDate() - GvRow.DataKey("FechaInicio").ToDate()).Days}"
Dim HorasPermiso As String = "" 'String.Format("{0}", ((GvRow.DataKey("FechaInicio").ToDateTime() - GvRow.DataKey("FechaFin").ToDateTime()).Hours))
Dim MotivoPermiso As String = String.Format("{0},{1}", GvRow.DataKey("Descripcion"), GvRow.DataKey("Motivo"))
If File.Exists(RutaFormato) Then
Dim objGemDocument As New clsGemBoxDocument(RutaFormato)
Dim ListaTags As New List(Of TagsDocumentos)
ListaTags = GetDatosTagsDocumentos()
ListaTags.Add(New TagsDocumentos("{NombreEmpleado}", NombreEmpleado))
ListaTags.Add(New TagsDocumentos("{Codigo}", Codigo))
ListaTags.Add(New TagsDocumentos("{Departamento}", Departamento))
ListaTags.Add(New TagsDocumentos("{JefeInmediato}", JefeInmediato))
ListaTags.Add(New TagsDocumentos("{FechaInicio}", FechaInicio))
ListaTags.Add(New TagsDocumentos("{FechaFin}", FechaFin))
ListaTags.Add(New TagsDocumentos("{diasPermiso}", diasPermiso))
ListaTags.Add(New TagsDocumentos("{HorasPermiso}", HorasPermiso))
ListaTags.Add(New TagsDocumentos("{MotivoPermiso}", MotivoPermiso))
objGemDocument.SustituirTags(ListaTags)
'objGemDocument.GuardarStream()
objGemDocument.GuardarStreamPDF()
Dim bytesInStream As Byte() = objGemDocument.GetBytesDocumento()
'Dim bytesInStream As Byte() = objGemDocument.memoryStream.ToArray
objGemDocument.Dispose()
Response.Clear()
Response.ContentType = "application/force-download"
Response.AddHeader("content-disposition", "attachment; filename=" & CvePersonal & "_Solicituddepermiso_" & Now.ToString("yyyyMMddhhmmss") & ".pdf")
Response.BinaryWrite(bytesInStream)
Response.End()
Else
Alert("No se encontro el formato de Permisos", TipoMensaje.ToastAdventencia)
End If
End Sub
Public Sub DownLoad_ClickSolicitudAutorizacion(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim _Documento As String = GvRow.DataKey("Documento")
Dim RutaDocuemntoAutorizacion As String = String.Format("{0}Personal\{1}\Vacaciones\{2}", UsuarioActual.Empresa.Ruta, CvePersonal, _Documento)
If File.Exists(RutaDocuemntoAutorizacion) Then
Dim bytesInStream As Byte() = File.ReadAllBytes(RutaDocuemntoAutorizacion)
Response.Clear()
Response.ContentType = "application/force-download"
Response.AddHeader("content-disposition", "attachment; filename=" & _Documento)
Response.BinaryWrite(bytesInStream)
Response.End()
Else
Alert("No se encontro el documento que intenta descargar.")
End If
End Sub
Private Sub DescarSolicitudVacaciones(_Folio As Integer)
Dim objEdoc As New ClsEdocumentacion
Dim objRH As New ClsRH
Dim DTVacaciones As DataTable
Dim _CveDocumentacion As Integer = -1
Dim _DocumentacionFormato As String = ""
Dim _PathDocumento As String
Dim DtVacacionesFolio As New DataTable
Dim FechasVacaciones As String = ""
If objEdoc.DocumentacionGet(-1, 10, -1, UsuarioActual.Empresa.CveEmpresa) Then '10 Tipo de oducmentacion hoja de vacacaciones
DTVacaciones = objEdoc.DtResultados
If objRH.VacacionesGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then
DtVacacionesFolio = objRH.DtResultados.FiltraParametros("Folio=" & _Folio)
End If
objRH.Dispose()
objEdoc.Dispose()
_CveDocumentacion = DTVacaciones(0)("CveDocumentacion").ToString().ToEntero()
_DocumentacionFormato = DTVacaciones(0)("DocumentacionFormato").ToString()
_PathDocumento = UsuarioActual.Empresa.Ruta & "Formatos\" & _CveDocumentacion & "_" & _DocumentacionFormato
If File.Exists(_PathDocumento) Then
Dim objGemDocument As New clsGemBoxDocument(_PathDocumento)
Dim ListaTags As New List(Of TagsDocumentos)
ListaTags = GetDatosTagsDocumentos()
ListaTags.AddRange(GetDatosTagsVacaciones(_Folio).ToArray)
For Each dRow As DataRow In DtVacacionesFolio.Rows
FechasVacaciones = FechasVacaciones & dRow("Fecha").ToString().ToDate.ToString("dd/MM/yyyy") & vbLf
Next
ListaTags.Add(New TagsDocumentos("{FechasVacaciones}", FechasVacaciones))
ListaTags.Add(New TagsDocumentos("{Folio}", _Folio.ToString()))
objGemDocument.SustituirTags(ListaTags)
objGemDocument.GuardarStream()
Dim bytesInStream As Byte() = objGemDocument.memoryStream.ToArray
objGemDocument.Dispose()
Response.Clear()
Response.ContentType = "application/force-download"
Response.AddHeader("content-disposition", "attachment; filename=" & CvePersonal & "_Solicitud_Vacaciones_" & _Folio & "_" & Now.ToString("yyyyMMddhhmmss") & ".docx")
Response.BinaryWrite(bytesInStream)
Response.End()
End If
Else
objRH.Dispose()
End If
End Sub
Private Function GetDatosTagsVacaciones(_VacFolio As Integer) As List(Of TagsDocumentos)
Dim ListaTags = New List(Of TagsDocumentos)
Dim objRH As New ClsRH
If objRH.VacacionesFolioGet(CvePersonal, _VacFolio) Then
If objRH.DtResultados.Rows.Count > 0 Then
ListaTags.Add(New TagsDocumentos("{Anios}", VacAnios.ToString()))
ListaTags.Add(New TagsDocumentos("{DiasUsados}", VacDiasUsados.ToString()))
ListaTags.Add(New TagsDocumentos("{DiasDisponibles}", VacDiasDisponibles.ToString()))
If Not IsDBNull(objRH.DtResultados(0)("InicioVac")) Then
ListaTags.Add(New TagsDocumentos("{InicioVac}", objRH.DtResultados(0)("InicioVac").ToString().ToDate.ToString("dd/MM/yyyy")))
End If
If Not IsDBNull(objRH.DtResultados(0)("FinVac")) Then
ListaTags.Add(New TagsDocumentos("{FinVac}", objRH.DtResultados(0)("FinVac").ToString().ToDate.ToString("dd/MM/yyyy")))
End If
If Not IsDBNull(objRH.DtResultados(0)("RegresoVac")) Then
ListaTags.Add(New TagsDocumentos("{RegresoVac}", objRH.DtResultados(0)("RegresoVac").ToString().ToDate.ToString("dd/MM/yyyy")))
End If
If Not IsDBNull(objRH.DtResultados(0)("DiasSolicitados")) Then
ListaTags.Add(New TagsDocumentos("{DiasTomados}", objRH.DtResultados(0)("DiasSolicitados").ToString()))
End If
End If
End If
objRH.Dispose()
Return ListaTags
End Function
Protected Sub DdlFormapagovacaciones_SelectedIndexChanged(sender As Object, e As EventArgs)
PnlVacfechas.Visible = False
PnlVacfechas2.Visible = False
PnlVacDias.Visible = False
'PnlVacFechapago.Visible = False
' PnlVacDiasPago.Visible = False
PnlVacChecks.Visible = False
TxtVacDiasPago.Text = "0"
PnlVacDiasFeriados.Visible = False
Select Case DdlFormapagovacaciones.SelectedValue.ToEntero()
Case 1
PnlVacfechas.Visible = True
PnlVacfechas2.Visible = True
PnlVacDias.Visible = True
PnlVacChecks.Visible = True
PnlVacDiasFeriados.Visible = True
Case 2
PnlVacfechas.Visible = True
PnlVacfechas2.Visible = True
PnlVacChecks.Visible = True
PnlVacDiasFeriados.Visible = True
Case 3
PnlVacfechas.Visible = True
PnlVacfechas2.Visible = True
PnlVacDias.Visible = True
PnlVacDiasFeriados.Visible = True
Case 4
PnlVacDias.Visible = True
PnlVacChecks.Visible = True
Case 5
PnlVacfechas.Visible = True
PnlVacfechas2.Visible = True
PnlVacDias.Visible = True
PnlVacDiasFeriados.Visible = True
Case 6
PnlVacDias.Visible = True
End Select
End Sub
#End Region
#Region "CURSOS"
Private Sub CargaCursos()
Dim objRH As New ClsRH
If objRH.PersonalCursosGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then
GvCursos.DataSource = objRH.DtResultados
Else
GvCursos.DataSource = Nothing
End If
objRH.Dispose()
GvCursos.DataBind()
End Sub
Private Sub GvCursosCreaEventoDescarga()
For Each dRow As GridViewRow In GvCursos.Rows
Dim CurAsistencia As Boolean = Boolean.Parse(dRow.DataKey("Asistencia"))
Dim lnkCursoConstancia As LinkButton = dRow.FCLinkButton("lnkCursoConstancia")
Dim ConstanciaDC3 As Boolean = Boolean.Parse(dRow.DataKey("ConstanciaDC3"))
If ConstanciaDC3 Then
If CurAsistencia And TxtRFC.Text.Trim.Length > 11 And TxtRFC.Text.Length < 14 Then
lnkCursoConstancia.Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkCursoConstancia)
Else
lnkCursoConstancia.Visible = False
End If
Else
lnkCursoConstancia.Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkCursoConstancia)
End If
Next
End Sub
Protected Sub GvCursos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCursos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim CurAsistencia As Boolean = Boolean.Parse(e.Row.DBCampo("Asistencia"))
Dim lnkCursoConstancia As LinkButton = e.Row.FCLinkButton("lnkCursoConstancia")
Dim ConstanciaDC3 As Boolean = Boolean.Parse(e.Row.DataKey("ConstanciaDC3"))
If ConstanciaDC3 Then
If CurAsistencia And TxtRFC.Text.Trim.Length > 11 And TxtRFC.Text.Length < 14 Then
lnkCursoConstancia.Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkCursoConstancia)
Else
lnkCursoConstancia.Visible = False
End If
Else
lnkCursoConstancia.Visible = True
ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnkCursoConstancia)
End If
End If
End Sub
Public Sub ImprimirConstancia_Click(sender As Object, e As EventArgs)
Dim objConstancias As New ClsConstancias
Dim DocumenBitArray As Byte() = Nothing
Dim RutaDocumento As String = DirectorioBaseEmpresas
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim _CveCurso As Integer = GvRow.DataKey("CveCurso").ToEntero()
DocumenBitArray = objConstancias.PersonalConstanciaGenera(CvePersonal, _CveCurso, UsuarioActual.CveEmpresa, RutaDocumento, UsuarioActual.Empresa)
GvCursosCreaEventoDescarga()
If Not DocumenBitArray Is Nothing Then
Response.Clear()
Response.ContentType = "application/force-download"
Response.AddHeader("content-disposition", "attachment; filename=" & CvePersonal & "_Constancia_Curso_" & _CveCurso & "_" & Now.ToString("yyyyMMddhhmmss") & ".docx")
Response.BinaryWrite(DocumenBitArray)
Response.End()
End If
End Sub
#End Region
#Region "UNIFORMES"
Private Sub CargaComboUniformes()
Dim objRH As New ClsRH
If objRH.UniformeGet(-1, 1, UsuarioActual.CveEmpresa) Then
DdlUniforme.DataSource = objRH.DtResultados
Else
DdlUniforme.DataSource = Nothing
End If
DdlUniforme.DataBind()
DdlUniforme.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
objRH.Dispose()
'UpGvUniformes.Update()
End Sub
Private Sub CargaUniformesPersonal()
If Not UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 153, 154, 140) Then
GvUniforme.Visible = True
GvUniformesResguardo.Visible = False
If DdlUniforme.SelectedIndex > 0 Then
Dim objRH As New ClsRH
If objRH.UniformeDetallePersonalGet(CvePersonal, DdlUniforme.SelectedValue.ToEntero(), 1, UsuarioActual.CveEmpresa) Then
GvUniforme.DataSource = objRH.DtResultados
If objRH.DtResultados.Rows.Count > 0 Then
LnkSurtir.Visible = True
Else
LnkSurtir.Visible = False
End If
UpBtnUniformes.Update()
Else
GvUniforme.DataSource = Nothing
LnkSurtir.Visible = False
UpBtnUniformes.Update()
End If
objRH.Dispose()
Else
GvUniforme.DataSource = Nothing
LnkSurtir.Visible = False
UpBtnUniformes.Update()
End If
Else
GvUniforme.Visible = False
GvUniformesResguardo.Visible = True
Dim ObjInv As New ClsInventarios
If ObjInv.GetResguardoUniformesRep(UsuarioActual.CveEmpresa, CvePersonal, -1, -1, Todo:=False) Then
GvUniformesResguardo.DataSource = ObjInv.DtResultados
UniformesInfo = ObjInv.DtResultados
Else
GvUniformesResguardo.DataSource = Nothing
'LnkSurtir.Visible = False
UpBtnUniformes.Update()
End If
ObjInv.Dispose()
GvUniformesResguardo.DataBind()
UpGvUniformes.Update()
End If
GvUniforme.DataBind()
GvUniformesResguardo.DataBind()
UpGvUniformes.Update()
UpUniformesResguardo.Update()
End Sub
Protected Sub LbLiberarUniforme(sender As Object, e As System.EventArgs)
Dim lb As LinkButton = CType(sender, LinkButton)
Dim row As GridViewRow = CType(lb.NamingContainer, GridViewRow)
CveAlmacenUniforme = row.DataKey("CveAlmacen").ToString().ToEntero()
DescripcionUniforme = row.DataKey("CodigoPS")
PU = row.DataKey("PU").ToString().ToDecimal
CveSeccionAlmacenUniforme = row.DataKey("CveSeccionAlmacen").ToString().ToEntero()
CveUM = row.DataKey("CveUM").ToString().ToEntero()
CvePS = row.DataKey("CvePS").ToString().ToEntero()
CveMovimientoUniforme = row.DataKey("CveMovimiento").ToString().ToEntero()
CveMovimientoDetalleUniforme = row.DataKey("CveMovimientoDetalle").ToString().ToEntero()
Dim Cantidad As Integer = row.DataKey("Cantidad").ToString().ToEntero()
TxtCantidadResguardo.Text = Cantidad.ToString
RvTxtCantidadResguardo.MaximumValue = Cantidad.ToString
If row.DataKey("AplicaSeccion").ToString = "True" Then
divSeccionAlmacen.Visible = True
DdlSeccionAlmacen.Items.Clear()
CargaSeccionesAlmacen(DdlSeccionAlmacen, DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero(), CvePS, UsuarioActual.CveEmpresa)
DdlSeccionAlmacen.DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero(), CvePS)
DdlSeccionAlmacen.DataBind()
End If
TxtLiberarSerie.Text = ""
If row.DataKey("AplicaSerie").ToString = "True" Then
divSerie.Visible = True
TxtLiberarSerie.Text = row.DataKey("Serie")
TxtLiberarSerie.Enabled = False
TxtCantidadResguardo.Enabled = False
TxtCantidadResguardo.Text = "1"
End If
UPPLiberarUniforme.Update()
RegistraScript(String.Format("$('#{0}').modal();", "ModalUniforme"))
End Sub
Private Sub DdlUniforme_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlUniforme.SelectedIndexChanged
CargaUniformesPersonal()
End Sub
Sub LiberarUniforme(sender As Object, e As EventArgs)
Dim ObjInventario As New ClsInventarios
ObjInventario.IniciaTransacSQL()
Dim Cantidad As Double = TxtCantidadResguardo.Text.ToDouble()
Dim Serie As String = TxtLiberarSerie.Text.Trim
Dim Errores As String = ""
Dim CveResultadoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenUniforme, 3, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveAlmacenDestino:=DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero(), CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme)
If CveResultadoSalida > 0 Then
Dim ResultadoDetalleSalida As Boolean = ObjInventario.AddMovimientoDetalle(CveResultadoSalida, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=-3, Serie:=Serie, CveMovimientoDetalleEntrada:=CveMovimientoDetalleUniforme)
Dim ResultadoDetalleEntrada As Boolean = False
If ResultadoDetalleSalida Then
Dim CveSeccionAlmacen As Integer = DdlSeccionAlmacen.SelectedValue.ToEntero()
Dim CveResultadoEntrada As Integer = ObjInventario.AddMovimiento(DdlAlmacenDestinoLiberarUniforme.SelectedValue.ToEntero(), 2, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme, CveMovimientoRelacionado:=CveMovimientoUniforme)
If CveResultadoEntrada > 0 Then
ResultadoDetalleEntrada = ObjInventario.AddMovimientoDetalle(CveResultadoEntrada, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie)
If Not ResultadoDetalleEntrada Then
Errores = "No se puede registrar la entrada detallada"
End If
Else
Errores = "No se puede registrar la entrada"
End If
Else
Errores = "No se puede registrar el detalle de salida"
End If
Else
Errores = "No se puede registrar la salida"
End If
If Errores = "" Then
ObjInventario.Commit()
Alert("El resguardo se liberó correctamente")
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalUniforme"))
CargaUniformesPersonal()
Else
Alert("No se pudo registrar la liberación.", TipoMensaje.MsgError)
ObjInventario.RollBack()
End If
ObjInventario.Dispose()
End Sub
#End Region
#Region "CARGAR IMAGEN"
Private Sub LnkSubirFacturas_Click(sender As Object, e As EventArgs) Handles LnkSubirFacturas.Click
RegistraScript(String.Format("$('#{0}').modal();", "ModalArchivo"))
End Sub
Private Sub BtnGuardarArchivo_Click(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click
Dim FileExtension As String = "-1"
Dim filesgral As List(Of Archivo) = TxtCargaImg.getfiles().Archivos
Dim filemove As String = ""
For Each fileItem As Archivo In filesgral
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
filemove = fileItem.filename
Dim dir As String = String.Format("{0}RH\Personal\", UsuarioActual.Empresa.Ruta)
System.IO.Directory.CreateDirectory(dir)
If CvePersonal > 0 Then
Dim yaExistente As String = String.Format("{0}RH\Personal\{1}.jpg", UsuarioActual.Empresa.Ruta, CvePersonal)
Dim yaExistentePNG As String = String.Format("{0}RH\Personal\{1}.png", UsuarioActual.Empresa.Ruta, CvePersonal)
Dim yaExistenteBMP As String = String.Format("{0}RH\Personal\{1}.bmp", UsuarioActual.Empresa.Ruta, CvePersonal)
If File.Exists(yaExistente) Then
File.Delete(yaExistente)
ElseIf File.Exists(yaExistentePNG) Then
File.Delete(yaExistentePNG)
ElseIf File.Exists(yaExistenteBMP) Then
File.Delete(yaExistenteBMP)
End If
End If
If filemove <> "" Then
If CvePersonal > 0 Then
filemove.FilesMove(CvePersonal.ToString(), String.Format("{0}RH\Personal\", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
Else
ViewState("FilesMoveimgNew") = filemove
End If
End If
ViewState("Archivo") = String.Format("{0}.{1}", CvePersonal.ToString(), FileExtension)
Next
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & "." & FileExtension) Then
Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.{2}", UsuarioActual.CveEmpresa, CvePersonal, FileExtension)
Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}&version={4}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica), Now)
ImgPersonal.ImageUrl = logouri
End If
UpImage.Update()
TxtCargaImg.Text = "[]"
UpAddArchivo.Update()
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalArchivo"))
End Sub
#Region "PERMISOS"
Public Sub CargaPermisos()
Dim ObjRH As New ClsRH
Dim CvePersonal As Integer = If(IsNumeric(Request("CvePersonal")), Request("CvePersonal").ToString().ToEntero(), -1)
If ObjRH.ChecadorPermisosGet(-1, "-1", CvePersonal, Now.AddMonths(-3), Now.AddMonths(2), -1, -1, UsuarioActual.CveEmpresa) Then
GvPermisos.DataSource = ObjRH.DtResultados
Else
GvPermisos.DataSource = Nothing
End If
ObjRH.Dispose()
GvPermisos.DataBind()
UpGvPermisos.Update()
End Sub
Private Sub BtnPermiso_Click(sender As Object, e As EventArgs) Handles BtnPermiso.Click
Dim ObjRH As New ClsRH
Dim HoraEntrada As TimeSpan
Dim HoraSalida As TimeSpan
Dim GoceSueldo As Integer = If(ChkGoceSueldo.Checked, 1, 0)
Dim EstatusPermiso As Integer = If(ChkEstatusPermiso.Checked, 1, 0)
If TxtHoraEntrada.Text.Trim.Length > 0 Then
Try
HoraEntrada = TimeSpan.Parse(TxtHoraEntrada.Text)
Catch ex As Exception
HoraEntrada = Nothing
End Try
Else
HoraEntrada = Nothing
End If
If TxtHoraSalida.Text.Trim.Length > 0 Then
Try
HoraSalida = TimeSpan.Parse(TxtHoraSalida.Text)
Catch ex As Exception
End Try
Else
HoraSalida = Nothing
End If
If ObjRH.ChecadorPermisosAddUpdate(CvePermiso, TxtPermisoDescripcion.Text.Trim, CvePersonal, TxtFechaInicioPer.Text.ToDate, TxtFechaFinPer.Text.Trim.ToDate, HoraEntrada, HoraSalida,
GoceSueldo, EstatusPermiso, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
If CvePermiso = -1 Then
Alert("Permiso agregado correctamente")
Else
Alert("Permiso agregado Actualizado correctamente")
End If
RegistraScript("$('#DvPermisos').modal('hide');")
End If
ObjRH.Dispose()
CargaPermisos()
End Sub
Private Sub LnkAgregarPermiso_Click(sender As Object, e As EventArgs) Handles LnkAgregarPermiso.Click
BtnPermiso.Text = "Agregar"
ChkEstatusPermiso.Checked = True
CvePermiso = -1
RegistraScript("$('#DvPermisos').modal({ backdrop: 'static', keyboard: false});")
End Sub
Public Sub Edit_ClickPermiso(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CvePermiso = GvRow.DataKey("CvePermiso").ToString().ToEntero()
TxtPermisoDescripcion.Text = GvRow.DataKey("Descripcion").ToString()
TxtFechaInicioPer.Text = GvRow.DataKey("FechaInicio").ToString()
TxtFechaFinPer.Text = GvRow.DataKey("FechaFin").ToString()
If GvRow.DataKey("HoraEntrada").ToString().Length > 0 Then
Try
TxtHoraEntrada.Text = TimeSpan.Parse(GvRow.DataKey("HoraEntrada").ToString()).ToString("hh:mm:ss")
Catch ex As Exception
TxtHoraEntrada.Text = ""
End Try
Else
TxtHoraEntrada.Text = ""
End If
If GvRow.DataKey("HoraSalida").ToString().Length > 0 Then
Try
TxtHoraSalida.Text = TimeSpan.Parse(GvRow.DataKey("HoraSalida").ToString()).ToString("hh:mm:ss")
Catch ex As Exception
TxtHoraSalida.Text = ""
End Try
Else
TxtHoraSalida.Text = ""
End If
BtnPermiso.Text = "Actualizar"
ChkGoceSueldo.Checked = Boolean.Parse(GvRow.DataKey("GoceSueldo").ToString())
ChkEstatusPermiso.Checked = Boolean.Parse(GvRow.DataKey("Estatus").ToString())
UpModalPermisos.Update()
RegistraScript("$('#DvPermisos').modal({ backdrop: 'static', keyboard: false});")
End Sub
Public Sub Remove_ClickPermiso(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim ObjRH As New ClsRH
Dim CvePermisoInterno As Integer = GvRow.DataKey("CvePermiso").ToEntero()
If ObjRH.ChecadorPermisosRemove(CvePermisoInterno, UsuarioActual.CveEmpresa) Then
End If
ObjRH.Dispose()
CargaPermisos()
End Sub
#End Region
#End Region
'Protected Sub BtnCargarArchivo_Click(sender As Object, e As System.EventArgs) Handles BtnCargarArchivo.Click
' Preguntar si existe en temporales
' If Session("FileUpload").ToString() <> String.Empty AndAlso File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString()) Then
' Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString())
' If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal")
' If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension) Then
' File.Delete(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension)
' File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString(), ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension)
' Else
' File.Move(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\" & Session("FileUpload").ToString(), ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension)
' End If
' Else
' Imagen Default
' If ImgPersonal.ImageUrl = "../Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" Then
' ImgPersonal.ImageUrl = "/Imagenes/SinImagen.jpg"
' End If
' End If
' Si existe mover de temporales a .../Empresas/RH/Personal, SINO Session("FileUpload") = ""
' Si existe en: .../Empresas/RH/Personal Guardar, SINO Session("FileUpload") = ""
' If Session("FileUpload").ToString() <> String.Empty AndAlso File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\" & Session("FileUpload").ToString()) Then
' Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal" & Session("FileUpload").ToString())
' If Not Directory.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal") Then Directory.CreateDirectory(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal")
' Session("FileUpload") = ""
' If File.Exists(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & Extension) Then
' ImgPersonal.ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & CvePersonal & Extension
' End If
' End If
'End Sub
#Region "Consumos"
Private Sub Consumos()
Dim ObjCompras As New ClsCompras
If ObjCompras.GetRepComprasPersonalDetalle("-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1, CvePersonal, -1, -1, -1, "-1", UsuarioActual.CveUsuario) Then
DTConsumos = ObjCompras.DtResultados
GvConsumos.DataSource = DTConsumos
Else
GvConsumos.DataSource = Nothing
End If
ObjCompras.Dispose()
GvConsumos.DataBind()
UpConsumos.Update()
End Sub
Protected Sub GvConsumos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvConsumos.RowDataBound
If e.Row.RowType = DataControlRowType.Header Then
'Cambiar Header
End If
If e.Row.RowType = DataControlRowType.DataRow Then
Dim FechaI, FechaF As String
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
Dim Liga As String = $"/Compras/Compras.aspx?CveCompra={e.Row.DBCampo("CveCompra")}"
If e.Row.DBCampo("Orden") = "1" Then
e.Row.Cells(0).Text = String.Format("<a class='{0}' target='_blank' href='{1}'>{2}</a>", "Texto", Liga, e.Row.DBCampo("SerieFolio").ToString())
Else
e.Row.BackColor = Drawing.Color.LightGray
End If
End If
End Sub
Protected Sub GenerarPDFConsumo(Optional Formato As String = "PDF")
Dim CodigoP As String = ""
Dim NombreCompletoP As String = ""
Dim Ruta As String = UsuarioActual.Empresa.Ruta
Dim RutaPDF As String = String.Format("{0}/Formatos/RepConsumoPersonal.rdlc", Ruta)
If Not File.Exists(RutaPDF) Then
RutaPDF = "Empresas/Grales/Formatos/RepConsumoPersonal.rdlc"
End If
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim params As New List(Of ReportParameter)()
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
Dim ObjPersonal As New ClsRH()
If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
If ObjPersonal.DtResultados.Rows.Count > 0 Then
CodigoP = ObjPersonal.Codigo
NombreCompletoP = ObjPersonal.NombreCompleto
params.Add(New ReportParameter("NombrePersonal", ObjPersonal.NombreCompleto))
params.Add(New ReportParameter("CodigoPersonal", ObjPersonal.Codigo))
End If
End If
ObjPersonal.Dispose()
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString()))
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
ImprimirPDF(RutaPDF, DTConsumos, params, $"RepConsumoPersonal - {CodigoP} {NombreCompletoP}", Formato)
End Sub
Protected Sub LnkImprimirPDFConsumo_Click(sender As Object, e As EventArgs)
GenerarPDFConsumo()
End Sub
#End Region
#Region ""
Protected Sub LbMail_Click(sender As Object, e As EventArgs)
Dim gvr As GridViewRow = CType(CType(sender, LinkButton).BindingContainer, GridViewRow)
If gvr.DataKey("SeTimbro") = "True" Then
Dim NombreComercial = UsuarioActual.Empresa.Empresa
Dim SerieFolio = gvr.DataKey("SerieFolio").ToString()
Dim Destinatario = gvr.DataKey("Correo").ToString()
Dim Personal = gvr.DataKey("Nombre").ToString()
Dim fechai = gvr.DataKey("FechaInicio").ToString().ToDate.ToShortDateString
Dim fechaf = gvr.DataKey("FechaFin").ToString().ToDate.ToShortDateString
Dim cvePeriodo = gvr.DataKey("CvePeriodo").ToString().ToEntero()
If UsuarioActual.CveRol = 1 Then
Alert("Parametros:" + NombreComercial + " " + SerieFolio + " " + Destinatario + " " + Personal + " " + fechai + " " + fechaf)
End If
MandaCorreo(NombreComercial, SerieFolio, Destinatario, Personal, fechai, fechaf, cvePeriodo)
End If
End Sub
Private Sub MandaCorreo(NombreComercial As String, SerieFolio As String, Destinatario As String, Optional Personal As String = "", Optional FechaI As String = "", Optional FechaF As String = "", Optional CvePeriodo As Integer = -1)
Dim RutaXml As String = String.Format("{0}XML\Nomina\{1}.xml", UsuarioActual.Empresa.Ruta, SerieFolio)
Dim RutaPdf As String = String.Format("{0}PDF\Nomina\{1}.pdf", UsuarioActual.Empresa.Ruta, SerieFolio)
If Destinatario.Length > 0 Then
Dim Correo As New ClsSisMail()
Dim Asunto As String = "Comprobante de Nómina"
Dim Cuerpo As New StringBuilder
Cuerpo.AppendFormat("Estimado <b>{0}</b> <br>Por este medio le hacemos llegar los comprobantes fiscales de su nomina, correspondiente al periodo del {1} al {2}<br><br>", Personal, FechaI, FechaF)
Cuerpo.AppendFormat("<br>{0}", NombreComercial)
Dim Xml As New ClsSisMail.ArchivoMail
Dim Pdf As New ClsSisMail.ArchivoMail
Dim ListaAdjuntos As New List(Of ClsSisMail.ArchivoMail)
If File.Exists(RutaXml) Then
'Xml.ArchivoBinario() = File.ReadAllBytes(RutaXml)
Xml.Ruta = RutaXml
Xml.NombreArchivo = New FileInfo(SerieFolio + ".Xml").Name
ListaAdjuntos.Add(Xml)
End If
If Not File.Exists(RutaPdf) Then
GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta)
End If
If File.Exists(RutaPdf) Then
'Pdf.ArchivoBinario() = File.ReadAllBytes(RutaPdf)
Pdf.Ruta = RutaPdf
Pdf.NombreArchivo = New FileInfo(SerieFolio + ".Pdf").Name
ListaAdjuntos.Add(Pdf)
End If
If ListaAdjuntos.Count > 0 Then
If Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString(), Archivos:=ListaAdjuntos) Then
Alert("Correo enviado existosamente a " & Destinatario)
Else
Alert("Se presento un error al enviar el correo a " & Destinatario)
End If
Else
If Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) Then
Alert("Correo enviado existosamente a " & Destinatario)
Else
Alert("Se presento un error al adjuntar comprobantes")
End If
End If
Else
End If
End Sub
#End Region
#Region "VIATICOS"
Protected Sub CargaViaticosPersonal()
Dim ObjBancos As ClsBancos = New ClsBancos
If ObjBancos.GetSolicitudesViaticos(-1, UsuarioActual.CveEmpresa, -1, CvePersonal) Then
GVViaticos.DataSource = ObjBancos.DtResultados
GVViaticos.DataBind()
End If
ObjBancos.Dispose()
End Sub
Protected Sub LnkViaticoDetalle_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveSolicitudViatico As Integer = GvRow.DataKey("CveSolicitudViatico").ToEntero()
CargaViaticosDetalle(CveSolicitudViatico)
RegistraScript("$('#DivViaticoDetalle').modal({ backdrop: 'static', keyboard: false});")
End Sub
Protected Sub CargaViaticosDetalle(CveSolicitudViativo As Integer)
Dim ObjBancos As ClsBancos = New ClsBancos
If ObjBancos.GetSolicitudesViaticosDetalle(CveSolicitudViativo, -1) Then
DTViaticosDetalle = ObjBancos.DtResultados
GVViaticoDetalle.DataSource = DTViaticosDetalle
GVViaticoDetalle.DataBind()
End If
ObjBancos.Dispose()
UpViaticoDetalle.Update()
End Sub
Protected Sub GVViaticoDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If (e.Row.RowType = DataControlRowType.Footer) Then
e.Row.FCLiteral("LtTotalImporte").Text = DTViaticosDetalle.SUM("Importe").FormatoNumero()
End If
End Sub
#End Region
#Region "BITACORA"
Private Sub CargaGvBitacora()
If CvePersonal > 0 Then
Dim ObjGral As New ClsGenerales()
If ObjGral.GetHistorialBitacora(-1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal) Then
GvBitacora.DataSource = ObjGral.DtResultados
End If
ObjGral.Dispose()
GvBitacora.DataBind()
UpHistorialModificacion.Update()
End If
End Sub
#End Region
#Region "PAGO DE FACTURAS"
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaPagoFactura()
UpnHistorial.Update()
End Sub
Private Sub CargaPagoFactura()
Dim ObjRH As New ClsRH
If ObjRH.GetPersonalPagoFactura(CvePersonal, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate, UsuarioActual.CveEmpresa) Then
GVPagoFactura.DataSource = ObjRH.DtResultados
End If
ObjRH.Dispose()
GVPagoFactura.DataBind()
End Sub
#End Region
Protected Sub BtnSaldoInicial_Click(sender As Object, e As EventArgs)
Dim SaldoInicial As Double = TxtSaldoInicial.Text.ToDouble()
Dim Fecha As DateTime = TxtFechaSaldo.Text.ToDateTime()
Dim ObjMov As New ClsContabilidad()
If AgregarSaldoInicial(SaldoInicial, Fecha, 1, ObjMov) > 0 Then
Alert("Se agregó el saldo inicial al personal.")
Else
Alert("Ocurrió un error al agregar el saldo inicial.", TipoMensaje.MsgError)
End If
ObjMov.Dispose()
RegistraScript("$('#ModalSaldoInicial').modal('hide');")
End Sub
Private Function AgregarSaldoInicial(SaldoInicial As Double, Fecha As DateTime, CveMoneda As Integer, ObjMov As ClsContabilidad) As Integer
Return ObjMov.AddPrePolizas("RH/Personal", 13, SaldoInicial, SaldoInicial, CveMoneda, Fecha, "Saldo Inicial", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
End Function
#Region "L I C E N C I A S"
Public Sub CargaLicencias()
If CvePersonal > 0 Then
Dim ObjAF As New ClsAF()
If ObjAF.GetLicencias(-1, -1, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal) Then
GvLicencias.DataSource = ObjAF.DtResultados
GvLicencias.DataBind()
End If
ObjAF.Dispose()
UpLicencias.Update()
Else
DTLicencias = New DataTable()
Dim PK As New DataColumn("CveLicencia", GetType(Integer))
PK.AutoIncrement = True
PK.AutoIncrementSeed = 1
PK.AutoIncrementStep = 1
DTLicencias.Columns.Add(PK)
DTLicencias.Columns.Add("Licencia", GetType(String))
DTLicencias.Columns.Add("FechaExpedicion", GetType(DateTime))
DTLicencias.Columns.Add("FechaVencimiento", GetType(DateTime))
DTLicencias.Columns.Add("Estatus", GetType(Boolean))
DTLicencias.Columns.Add("EstatusSTR", GetType(String))
GvLicencias.DataSource = DTLicencias
GvLicencias.DataBind()
End If
End Sub
Public Sub EditLicencia_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
HdnModalidadLicencia.Value = "U"
HdnIDLicencia.Value = GvRow.DataKey("CveLicencia")
BtnAgregarLicencia.Text = "Actualizar"
LabelLicencia.InnerText = "Actualizar Licencia"
TxtLicencia.Text = GvRow.DataKey("Licencia")
TxtFechaExpLicencia.Text = GvRow.DataKey("FechaExpedicion")
TxtFechaVencLicencia.Text = GvRow.DataKey("FechaVencimiento")
ChkModalLicenciaEstatus.Checked = Boolean.Parse(GvRow.DataKey("Estatus").ToString())
UpAddLicencias.Update()
UpLicencias.Update()
RegistraScript("$('#DivAddLicencias').modal('show');")
End Sub
Public Sub DeleteLicencia_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
HdnIDLicencia.Value = GvRow.DataKey("CveLicencia")
If CvePersonal > 0 Then
Dim ObjAF As New ClsAF()
If ObjAF.RemoveLicencia(HdnIDLicencia.Value.ToEntero()) Then
CargaLicencias()
Alert("La licencia se eliminó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjAF.Dispose()
Else
If DTLicencias IsNot Nothing Then
Dim Row = DTLicencias.Select($"CveLicencia = {HdnIDLicencia.Value.ToEntero()}")(0)
DTLicencias.Rows.Remove(Row)
GvLicencias.DataSource = DTLicencias
GvLicencias.DataBind()
Alert("La licencia se eliminó correctamente.", TipoMensaje.MsgInformacion)
End If
End If
UpLicencias.Update()
End Sub
Private Sub LnkAddLicencias_Click(sender As Object, e As EventArgs) Handles LnkAddLicencias.Click
HdnModalidadLicencia.Value = "A"
BtnAgregarLicencia.Text = "Agregar"
LabelLicencia.InnerText = "Agregar Licencia"
TxtLicencia.Text = ""
TxtFechaExpLicencia.Text = ""
TxtFechaVencLicencia.Text = ""
ChkModalLicenciaEstatus.Checked = False
UpLicencias.Update()
UpAddLicencias.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddLicencias"))
End Sub
Private Sub BtnAgregarLicencia_Click(sender As Object, e As EventArgs) Handles BtnAgregarLicencia.Click
If CvePersonal > 0 Then
Dim ObjAF As New ClsAF
If HdnModalidadLicencia.Value = "A" Then
If ObjAF.AddLicencia(-1, TxtLicencia.Text.Trim, TxtFechaExpLicencia.Text.ToDateTime, TxtFechaVencLicencia.Text.ToDateTime, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal, Estatus:=ChkModalLicenciaEstatus.Checked) Then
Alert("La licencia se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
ElseIf HdnModalidadLicencia.Value = "U" Then
If ObjAF.UpdateLicencia(HdnIDLicencia.Value.ToEntero(), TxtLicencia.Text.Trim, TxtFechaExpLicencia.Text.ToDateTime, TxtFechaVencLicencia.Text.ToDateTime, Estatus:=ChkModalLicenciaEstatus.Checked) Then
Alert("La licencia se actualizó correctamente.", TipoMensaje.MsgInformacion)
End If
End If
ObjAF.Dispose()
CargaLicencias()
Else
If DTLicencias IsNot Nothing Then
If HdnModalidadLicencia.Value = "A" Then
Dim Row = DTLicencias.NewRow()
Row("Licencia") = TxtLicencia.Text.Trim()
Row("FechaExpedicion") = TxtFechaExpLicencia.Text.ToDateTime()
Row("FechaVencimiento") = TxtFechaVencLicencia.Text.ToDateTime()
Row("Estatus") = ChkModalLicenciaEstatus.Checked
Row("EstatusSTR") = If(ChkModalLicenciaEstatus.Checked, "Si", "No")
DTLicencias.Rows.Add(Row)
GvLicencias.DataSource = DTLicencias
GvLicencias.DataBind()
UpLicencias.Update()
Alert("La licencia se agregó correctamente.", TipoMensaje.MsgInformacion)
ElseIf HdnModalidadLicencia.Value = "U" Then
Try
Dim Row = DTLicencias.Select($"CveLicencia = {HdnIDLicencia.Value.ToEntero()}")(0)
Row("Licencia") = TxtLicencia.Text.Trim()
Row("FechaExpedicion") = TxtFechaExpLicencia.Text.ToDateTime()
Row("FechaVencimiento") = TxtFechaVencLicencia.Text.ToDateTime()
Row("Estatus") = ChkModalLicenciaEstatus.Checked
Row("EstatusSTR") = If(ChkModalLicenciaEstatus.Checked, "Si", "No")
GvLicencias.DataSource = DTLicencias
GvLicencias.DataBind()
UpLicencias.Update()
Alert("La licencia se actualizó correctamente.", TipoMensaje.MsgInformacion)
Catch ex As Exception
Alert("Ocurrió el error al actualizar la licencia.", TipoMensaje.MsgError)
End Try
End If
End If
End If
RegistraScript("$('#DivAddLicencias').modal('hide');")
End Sub
#End Region
Protected Sub BtnPDFResguardo_Click(sender As Object, e As EventArgs)
GenerarPDFResguardosAF()
End Sub
Protected Sub BtnExcelResguardo_Click(sender As Object, e As EventArgs)
GenerarPDFResguardosAF("Excel")
End Sub
Protected Sub GenerarPDFResguardosAF(Optional Formato As String = "PDF")
Dim ObjAF As New ClsAF
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\RepResguardosAF.rdlc", UsuarioActual.Empresa.Ruta))
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim dtVC As DataTable = Nothing
Dim params As New List(Of ReportParameter)
Dim dr As DataRow = Nothing
If ObjAF.GetActivosFijosResguardos(-1, -1, CvePersonal, -1, UsuarioImprimio:=UsuarioActual.CveUsuario) Then
dtVC = ObjAF.DtResultados
End If
ObjAF.Dispose()
If dtVC.Rows.Count > 0 Then
dr = dtVC.Rows(0)
'If UsuarioActual.CveEmpresa.Contiene(72, 119) Then
'End If
Dim SBDomicilioSucursal As New StringBuilder()
Dim DRSucursal = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa, CveSubProyecto:=dr("CveSubProyecto").ToString().ToEntero(), Estatus:=1).FiltroPrimero("")
If DRSucursal IsNot Nothing Then
Dim CiudadSucursal As String = String.Format("{0},{1}", DRSucursal("Municipio"), DRSucursal("Estado"))
Dim DomicilioSucursal As String = ""
SBDomicilioSucursal.AppendFormat("{0}", DRSucursal("Calle"))
If DRSucursal("NoExt").ToString().ToEntero() > 0 Then SBDomicilioSucursal.AppendFormat(" No.Ext: {0}", DRSucursal("NoExt").ToString().ToEntero())
If DRSucursal("NoInt").ToString().ToEntero() > 0 Then SBDomicilioSucursal.AppendFormat(", No.Int: {0}", DRSucursal("NoInt").ToString().ToEntero())
If DRSucursal("Colonia").ToString().Length > 0 Then SBDomicilioSucursal.AppendFormat(", Col: {0}", DRSucursal("Colonia").ToString())
If DRSucursal("CP").ToString().ToEntero() > 0 Then SBDomicilioSucursal.AppendFormat(", CP: {0}", DRSucursal("CP").ToString())
If CiudadSucursal.Length > 0 Then SBDomicilioSucursal.AppendFormat(", {0}", CiudadSucursal)
If DRSucursal("Pais").ToString().Length > 0 Then SBDomicilioSucursal.AppendFormat(", {0}", DRSucursal("Pais").ToString())
End If
params.Add(New ReportParameter("NombreResponsable", dr("NombreCompleto").ToString()))
params.Add(New ReportParameter("RFC", dr("RFC").ToString()))
params.Add(New ReportParameter("Puesto", dr("Puesto").ToString()))
params.Add(New ReportParameter("Departamento", dr("Departamento").ToString()))
params.Add(New ReportParameter("Sucursal", dr("SubProyecto").ToString()))
params.Add(New ReportParameter("Telefono", dr("Celular").ToString()))
params.Add(New ReportParameter("DireccionSucursal", SBDomicilioSucursal.ToString()))
params.Add(New ReportParameter("PuestoUsuarioActual", dr("PuestoUsuarioImprimio").ToString()))
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
If Archivo.Exists Then
ImprimirPDF(String.Format("{0}Formatos\RepResguardosAF.rdlc", UsuarioActual.Empresa.Ruta), dtVC, params, "PersonalResguardosAF", Formato)
Else
ImprimirPDF("Empresas/Grales/Formatos/RepResguardosAF.rdlc", dtVC, params, "PersonalResguardosAF", Formato)
End If
Else
Alert("No se encontraron registros .", TipoMensaje.MsgAdvertencia)
End If
End Sub
#Region "FAMILIARES"
Private Sub CargaFamiliares()
If CvePersonal <> -1 Then
Dim objRH As New ClsRH
If objRH.PersonalFamiliaresGet(-1, CvePersonal) Then
If objRH.DtResultados.Rows.Count > 0 Then
DTFamiliares = objRH.DtResultados
DTFamiliares.Columns.Add("Accion", Type.GetType("System.String"))
DTFamiliares.AcceptChanges()
GvFamiliares.DataSource = DTFamiliares
Else
DTFamiliares.Rows.Clear()
GvFamiliares.DataSource = DTFamiliares
End If
Else
GvFamiliares.DataSource = Nothing
End If
objRH.Dispose()
GvFamiliares.DataBind()
UPTabFamiliares.Update()
End If
End Sub
Private Sub CrearEstructuraFamiliares()
Dim Familiares As New DataTable
Familiares.Columns.Add("CveFamiliar", Type.GetType("System.Int32"))
Familiares.Columns.Add("CvePersonal", Type.GetType("System.Int32"))
Familiares.Columns.Add("CveParentesco", Type.GetType("System.Int32"))
Familiares.Columns.Add("Parentesco", Type.GetType("System.String"))
Familiares.Columns.Add("Nombre", Type.GetType("System.String"))
Familiares.Columns.Add("Domicilio", Type.GetType("System.String"))
Familiares.Columns.Add("Edad", Type.GetType("System.Int32"))
Familiares.Columns.Add("Ocupacion", Type.GetType("System.String"))
Familiares.Columns.Add("Fecha", Type.GetType("System.DateTime"))
Familiares.Columns.Add("Usuario", Type.GetType("System.String"))
Familiares.Columns.Add("Telefono", Type.GetType("System.String"))
Familiares.Columns.Add("Accion", Type.GetType("System.String"))
Familiares.Columns.Add("Observaciones", Type.GetType("System.String"))
Familiares.Columns.Add("Beneficiario", Type.GetType("System.Boolean"))
DTFamiliares = Familiares
End Sub
Protected Sub BtnAgregarFamiliar_Click(sender As Object, e As EventArgs) Handles BtnAgregarFamiliar.Click
ResetFormFamiliares()
RegistraScript("$('#divAgregarFamiliar').modal({ backdrop: 'static', keyboard: false});")
End Sub
Private Sub ResetFormFamiliares()
ActualizarFamiliar = False
CveFamiliar = -1
LtlTituloModalFamiliar.Text = "Agregar Familiar"
BtnAgregarFamiliarModal.Text = "Agregar Familiar"
TxtNombreFamiliar4.Text = ""
TxtDomicilioFamiliar4.Text = ""
TxtEdadFamiliar4.Text = ""
TxtOcupacionFamiliar4.Text = ""
TxtTelefonoFamiliar.Text = ""
TxtObservacionesFamiliar.Text = ""
DDLParentescoFamiliar4.SelectedIndex = 0
ChkBeneficiario.Checked = False
UpModalFamiliar.Update()
End Sub
Protected Sub BtnAgregarFamiliarModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarFamiliarModal.Click
If ActualizarFamiliar Then
'DtRowFamiliar("CveFamiliar") = -1
DTFamiliares(IndexActual)("CvePersonal") = -1
DTFamiliares(IndexActual)("Parentesco") = DDLParentescoFamiliar4.SelectedItem.Text
DTFamiliares(IndexActual)("CveParentesco") = DDLParentescoFamiliar4.SelectedValue.ToEntero()
DTFamiliares(IndexActual)("Nombre") = TxtNombreFamiliar4.Text.Trim
DTFamiliares(IndexActual)("Domicilio") = TxtDomicilioFamiliar4.Text.Trim
DTFamiliares(IndexActual)("Edad") = TxtEdadFamiliar4.Text.ToEntero()
DTFamiliares(IndexActual)("Ocupacion") = TxtOcupacionFamiliar4.Text.Trim
DTFamiliares(IndexActual)("Telefono") = TxtTelefonoFamiliar.Text.Trim
DTFamiliares(IndexActual)("Observaciones") = TxtObservacionesFamiliar.Text.Trim
DTFamiliares(IndexActual)("Beneficiario") = ChkBeneficiario.Checked
If DTFamiliares(IndexActual)("CveFamiliar").ToString() = "-1" Then
DTFamiliares(IndexActual)("Accion") = "2"
Else
DTFamiliares(IndexActual)("Accion") = "1"
End If
DTFamiliares.AcceptChanges()
Else
Dim DtRowFamiliar As DataRow
DtRowFamiliar = DTFamiliares.NewRow
DtRowFamiliar("CveFamiliar") = -1
DtRowFamiliar("CvePersonal") = -1
DtRowFamiliar("Parentesco") = DDLParentescoFamiliar4.SelectedItem.Text
DtRowFamiliar("CveParentesco") = DDLParentescoFamiliar4.SelectedValue.ToEntero()
DtRowFamiliar("Nombre") = TxtNombreFamiliar4.Text.Trim
DtRowFamiliar("Domicilio") = TxtDomicilioFamiliar4.Text.Trim
DtRowFamiliar("Edad") = TxtEdadFamiliar4.Text.ToEntero()
DtRowFamiliar("Ocupacion") = TxtOcupacionFamiliar4.Text.Trim
DtRowFamiliar("Telefono") = TxtTelefonoFamiliar.Text.Trim
DtRowFamiliar("Observaciones") = TxtObservacionesFamiliar.Text.Trim
DtRowFamiliar("Beneficiario") = ChkBeneficiario.Checked
DtRowFamiliar("Accion") = "2"
DTFamiliares.Rows.Add(DtRowFamiliar)
DTFamiliares.AcceptChanges()
End If
IndexActual = -1
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAgregarFamiliar"))
'CargaFamiliares()
GvFamiliares.DataSource = DTFamiliares
GvFamiliares.DataBind()
UPTabFamiliares.Update()
CveFamiliar = -1
ActualizarFamiliar = False
End Sub
Public Sub Edit_ClickFamiliar(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim activo As Boolean = True
CveFamiliar = GvRow.DataKey("CveFamiliar").ToString().ToEntero()
ActualizarFamiliar = True
IndexActual = GvRow.RowIndex
LtlTituloModalFamiliar.Text = "Editar Familiar"
BtnAgregarFamiliarModal.Text = "Actualizar"
TxtNombreFamiliar4.Text = GvRow.DataKey("Nombre")
DDLParentescoFamiliar4.SelectedValueExist(GvRow.DataKey("CveParentesco"))
TxtDomicilioFamiliar4.Text = GvRow.DataKey("Domicilio")
TxtEdadFamiliar4.Text = GvRow.DataKey("Edad")
TxtOcupacionFamiliar4.Text = GvRow.DataKey("Ocupacion")
TxtTelefonoFamiliar.Text = GvRow.DataKey("Telefono")
TxtObservacionesFamiliar.Text = GvRow.DataKey("Observaciones")
ChkBeneficiario.Checked = Boolean.Parse(GvRow.DataKey("Beneficiario").ToString())
UpModalFamiliar.Update()
RegistraScript("$('#divAgregarFamiliar').modal({ backdrop: 'static', keyboard: false});")
End Sub
Public Sub Remove_ClickFamiliar(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
IndexActual = GvRow.RowIndex
Dim activo As Boolean = False
Dim CveFamiliar As Integer = GvRow.DataKey("CveFamiliar").ToString().ToEntero()
If CveFamiliar > 0 Then
DTFamiliares.Rows(IndexActual)("Accion") = "3"
Dim objRH As New ClsRH
ProcesaDTFamiliares(objRH)
objRH.Dispose()
CargaFamiliares()
Else
DTFamiliares.Rows(IndexActual).Delete()
DTFamiliares.AcceptChanges()
GvFamiliares.DataSource = DTFamiliares
GvFamiliares.DataBind()
UPTabFamiliares.Update()
End If
IndexActual = -1
End Sub
Private Sub ProcesaDTFamiliares(ByRef objRH As ClsRH)
'Dim objRH As New ClsRH
ValPadre = False
ValMadre = False
For Each dRow As DataRow In DTFamiliares.Rows
If dRow("Accion").ToString() = "1" Then 'Actualiza
Dim Beneficiario As Integer = -1
If Boolean.Parse(dRow("Beneficiario").ToString()) Then
Beneficiario = 1
Else
Beneficiario = 0
End If
objRH.PersonalFamiliaresUpdate(dRow("CveFamiliar").ToString().ToEntero(), CvePersonal, dRow("CveParentesco").ToString().ToEntero(), dRow("Nombre").ToString(), dRow("Domicilio").ToString(), dRow("Edad").ToString().ToEntero(), dRow("Ocupacion").ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, dRow("Telefono").ToString(), If(dRow("Observaciones").ToString().Trim = "", "-1", dRow("Observaciones").ToString().Trim), Beneficiario)
End If
If dRow("Accion").ToString() = "2" Then 'Inserta
Dim Beneficiario As Boolean = Boolean.Parse(dRow("Beneficiario").ToString())
objRH.PersonalFamiliaresAdd(CvePersonal, dRow("CveParentesco").ToString().ToEntero(), dRow("Nombre").ToString(), dRow("Domicilio").ToString(), dRow("Edad").ToString().ToEntero(), dRow("Ocupacion").ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, dRow("Telefono").ToString(), If(dRow("Observaciones").ToString().Trim = "", "-1", dRow("Observaciones").ToString().Trim), Beneficiario)
End If
If dRow("CveParentesco").ToString().ToEntero() = 1 Then
ValPadre = True
End If
If dRow("CveParentesco").ToString().ToEntero() = 2 Then
ValMadre = True
End If
If dRow("Accion").ToString() = "3" Then 'Borra
objRH.PersonalFamiliaresRemove(dRow("CveFamiliar").ToString().ToEntero(), -1)
End If
Next
'objRH.Dispose()
End Sub
#End Region
Protected Sub DdlTipoAsistencias_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim ddl As DropDownList = DirectCast(sender, DropDownList)
Dim gvrow As GridViewRow = DirectCast(ddl.NamingContainer, GridViewRow)
If ddl.SelectedItem.Text = "Retardo" Then
gvrow.FCTextBox("TxtPorPago").Text = "87.5"
End If
End Sub
Public Sub LimpiarFonacot()
TxtFonValor.Text = ""
TxtFonImporteCredito.Text = ""
TxtFonPagosHechos.Text = ""
DdlFonTipoAplicacion.SelectedValueExist("-1")
TxtFonDescripcion.Text = ""
TxtFonNumCredito.Text = ""
TxtFonFechaInicio.Text = ""
ChkFonacot.Checked = False
End Sub
Protected Sub CargaFonacot()
Using onom As ClsNominas = New ClsNominas()
onom.NomFonacotGet(UsuarioActual.CveEmpresa, -1, CvePersonal)
GVNomFonacot.DataSource = onom.DtResultados
GVNomFonacot.DataBind()
End Using
UpFonacotGrid.Update()
End Sub
Protected Sub LnAddFonacot_Click(sender As Object, e As EventArgs)
LimpiarFonacot()
CveFonacot = -1
RegistraScript("$('#ModalFonacot').modal();")
End Sub
Protected Sub LnkEditarNomFonacot_Click(sender As Object, e As EventArgs)
Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CveFonacot = gvrow.DataKey("CveFonacot").ToEntero()
Dim cvePersonal As Int32 = gvrow.DataKey("CvePersonal").ToEntero()
Dim numeroCredito As String = gvrow.DataKey("NumeroCredito")
Dim descripcion As String = gvrow.DataKey("Descripcion")
Dim periodo As Int32 = gvrow.DataKey("Periodo").ToEntero()
Dim cveTipoCalculo As Int32 = gvrow.DataKey("CveTipoCalculo").ToEntero()
Dim importeCredito As Decimal = gvrow.DataKey("ImporteCredito").ToDecimal()
Dim importeFijo As Decimal = gvrow.DataKey("ImporteFijo").ToDecimal()
Dim pagosHechos As Decimal = gvrow.DataKey("PagosHechos").ToDecimal()
Dim montoAcumulado As Decimal = gvrow.DataKey("MontoAcumulado").ToDecimal()
Dim saldo As Decimal = gvrow.DataKey("Saldo").ToDecimal()
Dim cveEstatus As Int32 = gvrow.DataKey("CveEstatus").ToEntero()
Dim observaciones As String = gvrow.DataKey("Observaciones")
If (periodo < 10000000) Then
periodo = 20000101
End If
LimpiarFonacot()
TxtFonValor.Text = importeFijo.ToString()
TxtFonImporteCredito.Text = importeCredito.ToString()
TxtFonPagosHechos.Text = pagosHechos.ToString()
DdlFonTipoAplicacion.SelectedValueExist(cveTipoCalculo.ToString())
TxtFonDescripcion.Text = descripcion
TxtFonNumCredito.Text = numeroCredito
TxtFonFechaInicio.Text = String.Format("{2}/{1}/{0}", periodo.ToString().Substring(0, 4), periodo.ToString().Substring(4, 2), periodo.ToString().Substring(6, 2))
ChkFonacot.Checked = (cveEstatus = 1)
UpModalFonacot.Update()
RegistraScript("$('#ModalFonacot').modal();")
End Sub
Protected Sub LnkEliminarNomFonacot_Click(sender As Object, e As EventArgs)
Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim cveFonacot As Integer = gvrow.DataKey("CveFonacot").ToEntero()
Dim Continuar As Boolean = False
Using onom As ClsNominas = New ClsNominas()
Continuar = onom.NomFonacotRemove(UsuarioActual.CveEmpresa, cveFonacot)
End Using
If (Continuar) Then
CargaFonacot()
Alert("El registro fonacot se ha eliminado")
End If
End Sub
Protected Sub LnkGuardarFonacot_Click(sender As Object, e As EventArgs)
Dim importe As Decimal = TxtFonValor.Text.ToDecimal()
Dim importeTotal As Decimal = TxtFonImporteCredito.Text.ToDecimal()
Dim importePagado As Decimal = TxtFonPagosHechos.Text.ToDecimal()
Dim TipoAplicacion As Integer = DdlFonTipoAplicacion.SelectedValue.ToEntero()
Dim NoPagos As Integer = 0
Dim SaldoIni As Double = 0
Dim descripcion02 As String = TxtFonDescripcion.Text
Dim NumCredito As String = TxtFonNumCredito.Text
Dim fecha As String = TxtFonFechaInicio.Text.Replace("_", "")
Dim estatus As Integer = If(ChkFonacot.Checked, 1, 0)
Dim periodo As Integer = 20000101
If fecha.Length > 8 Then
fecha = fecha.ToDateTime().ToString("yyyy/MM/dd")
periodo = fecha.ToDateTime().ToString("yyyyMMdd").ToEntero()
Else
fecha = ""
End If
Dim continuar As Boolean = False
Using onom As ClsNominas = New ClsNominas()
If (CveFonacot = -1) Then
continuar = onom.NomFonacotAdd(UsuarioActual.CveEmpresa, CvePersonal, NumCredito, descripcion02, periodo, TipoAplicacion, importeTotal, importe, importePagado, 0, 0, estatus, "", UsuarioActual.CveUsuario)
Else
continuar = onom.NomFonacotUp(UsuarioActual.CveEmpresa, CveFonacot, CvePersonal, NumCredito, descripcion02, periodo, TipoAplicacion, importeTotal, importe, importePagado, 0, 0, estatus, "", UsuarioActual.CveUsuario)
End If
End Using
' Old Borrar Caudillo 01/Marzo/2022
'Using ObjPersonal As ClsRH = New ClsRH()
' If Not ObjPersonal.AddConcepto(CvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 4, NumCredito, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa) Then continuar = False
'End Using
If continuar Then
Alert("Se actualizo el calculo de fonacot")
CargaFonacot()
RegistraScript("$('#ModalFonacot').modal('hide');")
End If
End Sub
Protected Sub LnkCalcularFactor_Click(sender As Object, e As EventArgs)
getdatosFI()
RegistraScript("$('#DmodalFactordeIntegraccion').modal()")
End Sub
Private Sub getdatosFI()
If TxtFIAguinaldo.Text = "0" Or TxtFIAguinaldo.Text = "" Or TxtFIAguinaldo.Text = "-1" Then
TxtFIAguinaldo.Text = "15"
End If
If TxtFIPrimaVacacional.Text = "0" Or TxtFIPrimaVacacional.Text = "" Or TxtFIAguinaldo.Text = "-1" Then
TxtFIPrimaVacacional.Text = "25"
End If
TxtFISalariodiario.Text = TxtSalarioDiario.Text
TxtFactordeIntegracion.Text = ""
TxtFISalarioDiarioIntegrado.Text = ""
If UsuarioActual.CveEmpresa.Contiene(72, 80) Then
TxtFIDiasVacaciones.Text = "12"
Else
Using objRH As New ClsRH
If objRH.VacacionesResumenGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then
If objRH.DtResultados.Rows.Count > 0 Then
If objRH.DtResultados.Rows.Count > 0 Then
Dim diasvaca As Integer = objRH.DtResultados(0)("Dias").ToString().ToEntero()
TxtFIDiasVacaciones.Text = If(diasvaca > 5, diasvaca, 6).ToString()
Else
TxtFIDiasVacaciones.Text = "12"
End If
Else
End If
End If
End Using
End If
UpFactordeintegracion.Update()
End Sub
Private Sub calcularSDI()
Dim SD As Decimal = TxtFISalariodiario.Text.ToDecimal()
Dim primav As Decimal = TxtFIPrimaVacacional.Text.ToDecimal()
Dim DiasVacaciones As Decimal = TxtFIDiasVacaciones.Text.ToDecimal()
Dim diasaguinaldo As Decimal = TxtFIAguinaldo.Text.ToDecimal()
Dim FI As Decimal = (365 + diasaguinaldo + (DiasVacaciones * (primav / 100))) / 365
Dim SDI As Decimal = (SD * FI)
TxtFactordeIntegracion.Text = FI.ToString()
TxtFISalarioDiarioIntegrado.Text = String.Format("{0:###0.########}", SDI)
UpFactordeintegracion.Update()
End Sub
Protected Sub LnkCalcularFactordeintegracion_Click(sender As Object, e As EventArgs)
calcularSDI()
Alert(String.Format(" salario diario integreado {0}", TxtFISalarioDiarioIntegrado.Text))
End Sub
Protected Sub LnkCalcularFactordeintegracionyguardar_Click(sender As Object, e As EventArgs)
calcularSDI()
Using ObjPersonal As ClsRH = New ClsRH()
If ObjPersonal.UpdateSalariointegrado(CvePersonal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtFISalarioDiarioIntegrado.Text.ToDouble(), TxtFISalariodiario.Text.ToDouble) Then
TxtSalarioDiario.Text = TxtFISalariodiario.Text
TxtSalarioDiarioM.Text = TxtFISalariodiario.Text
TxtSalarioCotizado.Text = TxtFISalarioDiarioIntegrado.Text
TxtSalarioDiarioImSS.Text = TxtFISalarioDiarioIntegrado.Text
TxtSalarioDiarioIntegrado.Text = TxtFISalarioDiarioIntegrado.Text
TxtSDI.Text = TxtFISalarioDiarioIntegrado.Text
UpDatos.Update()
Alert("Se ha actualizado el salario diario integreado")
RegistraScript("$('#DmodalFactordeIntegraccion').modal('hide')")
End If
End Using
End Sub
Protected Sub ChkEstemporal_CheckedChanged(sender As Object, e As EventArgs)
Using ObjPersonal As ClsRH = New ClsRH()
If ObjPersonal.Updateestemporal(CvePersonal, UsuarioActual.CveEmpresa, ChkEstemporal.Checked) Then
Alert("Se ha actualizado el empleado", TipoMensaje.ToastInformacion)
End If
End Using
End Sub
Protected Sub LnkModificarSalarioGuardar_Click(sender As Object, e As EventArgs)
getdatosFI()
TxtFISalariodiario.Text = TxtSalarioDiarioM.Text
calcularSDI()
TxtSalarioDiarioImSS.Text = (TxtFISalarioDiarioIntegrado.Text.ToDecimal() + salarioVariable).ToString()
TxtSalarioDiarioIntegrado.Text = TxtFISalarioDiarioIntegrado.Text
Using ObjPersonal As ClsRH = New ClsRH()
If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodSalario.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtSalarioDiarioM.Text.ToDecimal(), TxtFISalarioDiarioIntegrado.Text.ToDecimal(), TxtSalarioDiarioImSS.Text.ToDecimal(), TxtSalarioDiarioM.Text.ToDecimal()) Then
TxtSalarioDiario.Text = TxtSalarioDiarioM.Text
TxtFISalariodiario.Text = TxtSalarioDiarioM.Text
TxtSalarioCotizado.Text = TxtSalarioDiarioImSS.Text
TxtSDI.Text = TxtSalarioDiarioIntegrado.Text
TxtFISalarioDiarioIntegrado.Text = TxtSalarioDiarioIntegrado.Text
UpModSalario.Update()
UpDatos.Update()
Alert("Se ha actualizado el salario", TipoMensaje.ToastInformacion)
End If
End Using
End Sub
Protected Sub LnkModsalario_Click(sender As Object, e As EventArgs)
TxtFechamodSalario.Text = DateTime.Now.ToString("dd/MM/yyyy")
TxtSalarioDiarioM.Text = TxtSalarioDiario.Text
TxtSalarioDiarioImSS.Text = TxtSalarioCotizado.Text
TxtSalarioDiarioIntegrado.Text = TxtSDI.Text
RegistraScript("$('#Dmodamodificarsalario').modal()")
UpModSalario.Update()
End Sub
Protected Sub UpdatePersonalAlta_Click(sender As Object, e As EventArgs)
End Sub
Protected Sub DeletePersonalAlta_Click(sender As Object, e As EventArgs)
End Sub
Protected Sub LnkDescargaFormatoParametros_Click(sender As Object, e As EventArgs)
Dim ListaTagsDocumentost = New List(Of TagsDocumentos)
Dim ObjRH As New ClsRH
ListaTagsDocumentost = ObjRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa)
ObjRH.Dispose()
For Each GvRow As GridViewRow In GvParametros.Rows
If GvRow.FCTextBox("TxtParametro").Text.Trim.Length > 0 Then
ListaTagsDocumentost.Add(New TagsDocumentos(GvRow.DataKey("Parametro"), GvRow.FCTextBox("TxtParametro").Text))
End If
Next
Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory
Dim PathSource As String
Dim pathDesti As String
PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & DocumentoParametros
pathDesti = PathRoot & "Temp\" & CvePersonal & DocumentoParametros
If File.Exists(pathDesti) Then
File.Delete(pathDesti)
End If
File.Copy(PathSource, pathDesti)
Dim objDoc As New clsGemBoxDocument(pathDesti)
objDoc.SustituirTags(ListaTagsDocumentost)
objDoc.Guardar(pathDesti)
Dim fileinfo As New FileInfo(pathDesti)
Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)
baseUrl = baseUrl & "/temp/" & fileinfo.Name
RegistraScript("$('#DVDescargaDocumentoParametrosModal').modal('hide')", "500")
RegistraDescargaJavaScript(baseUrl)
End Sub
Private Sub CargarPagosNoBancarios()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetPagosNoBancarios(UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal) Then
GvPagosNoBancarios.DataSource = ObjBancos.DtResultados
GvPagosNoBancarios.DataBind()
End If
ObjBancos.Dispose()
End Sub
Property CvePersonalAltas As Integer
Get
If ViewState("CvePersonalAltas") Is Nothing Then
Return 0
Else
Return DirectCast(ViewState("CvePersonalAltas"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CvePersonalAltas") = value
End Set
End Property
Protected Sub LnkUpAltass_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CvePersonalAltas = GvRow.DataKey("CvePersonalAltas").ToEntero()
TxtFechaInicioUA.Text = String.Format("{0:dd/MM/yyyy}", GvRow.DataKey("FechaInicio").ToDateTime())
Dim fechafin As DateTime = GvRow.DataKey("FechaFin").ToDateTime()
If fechafin.Year < 1900 Then
TxtFechaFinUA.Text = ""
Else
TxtFechaFinUA.Text = String.Format("{0:dd/MM/yyyy}", fechafin)
End If
UpAltasUpdate.Update()
RegistraScript("$('#ModalUpAltas').modal();")
End Sub
Protected Sub LnkDAltas_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CvePersonalAltas = GvRow.DataKey("CvePersonalAltas").ToEntero()
Using objrh As New ClsRH()
If (objrh.PersonalAltasRemove(CvePersonalAltas, CvePersonal, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then
If objrh.GetPersonalAltas(CvePersonal) Then
GvPersonalAltas.DataSource = objrh.DtResultados
GvPersonalAltas.DataBind()
UpDatos.Update()
End If
Alert("Alta eliminada")
End If
End Using
End Sub
Protected Sub LnkUpAltas_Click(sender As Object, e As EventArgs)
Dim strfin As String = ""
Dim fechafin As DateTime = TxtFechaFinUA.Text.ToDateTime()
If fechafin.Year < 1900 Then
strfin = ",[FechaFin]=null"
Else
strfin = String.Format(",[FechaFin]='{0:yyyy-MM-dd}'", fechafin)
End If
Using objrh As New ClsRH()
If (objrh.PersonalAltasUpFechas(CvePersonalAltas, TxtFechaInicioUA.Text.ToDateTime().ToString("yyyy-MM-dd"), TxtFechaFinUA.Text.ToDateTime().ToString("yyyy-MM-dd"), CvePersonal, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then
If objrh.GetPersonalAltas(CvePersonal) Then
GvPersonalAltas.DataSource = objrh.DtResultados
GvPersonalAltas.DataBind()
UpDatos.Update()
End If
Alert("Alta actualizada")
End If
End Using
End Sub
Protected Sub GvPersonalAltas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCLinkButton("LnkUpAltass").Visible = UsuarioActual.TienePermisoProceso(327)
e.Row.FCLinkButton("LnkDAltas").Visible = e.Row.FCLinkButton("LnkUpAltass").Visible
End If
End Sub
Protected Sub DdlSubProyectoAsignado_SelectedIndexChanged1(sender As Object, e As EventArgs)
Using objrh As New ClsRH()
If DdlSubProyectoAsignado.SelectedValue.ToEntero().Contiene(11954, 11884, 11883) Then
Dim objgenerales As New ClsGenerales()
objgenerales.GetMediosTransporte(-1, True, UsuarioActual.CveEmpresa, 1, -1, -1, -1)
DdlMedioTransporte.Items.Clear()
Dim drow As DataRow = objgenerales.DtResultados.NewRow
drow("CveOrigen") = -1
drow("Nombre") = "Seleccione"
objgenerales.DtResultados.Rows.InsertAt(drow, 0)
DdlMedioTransporte.DataSource = objgenerales.DtResultados
DdlMedioTransporte.DataBind()
Else
Dim objgenerales As New ClsGenerales()
objgenerales.GetMediosTransporte(-1, True, UsuarioActual.CveEmpresa, -1, DdlSubProyectoAsignado.SelectedValue.ToEntero(), -1, -1)
DdlMedioTransporte.Items.Clear()
Dim drow As DataRow = objgenerales.DtResultados.NewRow
drow("CveOrigen") = -1
drow("Nombre") = "Seleccione"
objgenerales.DtResultados.Rows.InsertAt(drow, 0)
DdlMedioTransporte.DataSource = objgenerales.DtResultados
DdlMedioTransporte.DataBind()
End If
End Using
End Sub
#Region "movtosPermanentes"
Protected Sub CargaTipoConcepto()
CargaConcepto()
End Sub
Protected Sub CargaConcepto()
Dim dt As DataTable = dtNomConceptos.FiltraParametros(" FormulaTotal = 'FNC.[MovimientosPermanentes]'")
DdlConcepto.Items.Clear()
If DdlTipo.SelectedValue.Contiene("P", "D", "O") Then
DdlConcepto.DataSource = dt.FiltraParametros(String.Format("Tipo ='{0}'", DdlTipo.SelectedValue))
End If
Dim drow As DataRow = dt.NewRow()
drow("CveConcepto") = "-1"
drow("Concepto") = "Seleccione"
dt.Rows.InsertAt(drow, 0)
DdlConcepto.DataSource = dt
DdlConcepto.SelectedValueExist("-1")
DdlConcepto.DataBind()
End Sub
Private Sub CargaMovtoPermanente()
Using ObjMovt As ClsNominas = New ClsNominas()
ObjMovt.GetMovtoPermanente(UsuarioActual.CveEmpresa, CvePersonal)
GVMovtoPermanente.DataSource = ObjMovt.DtResultados
End Using
GVMovtoPermanente.DataBind()
UpMovtosPermanentes.Update()
End Sub
Protected Sub DdlTipo_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
CargaConcepto()
End Sub
Protected Sub LnkAddMovtoPermanente_Click(ByVal sender As Object, ByVal e As EventArgs)
CargaConcepto()
DdlTipoDescto_SelectedIndexChanged(Nothing, Nothing)
pnlAddupMovto.Visible = True
LnkAddMovto.Visible = True
LnkUpMovto.Visible = False
LtlMovtoPermanenteaddup.Text = "Agregar Movimiento"
TxtDescripcion.Text = ""
TxtValor.Text = ""
TxtVecesAplicar.Text = ""
TxtMontoLimite.Text = ""
TxtFechaAplicacion.Text = ""
ChkEstatus.Visible = True
ChkEstatus.Checked = True
UpMovtosPermanentesModal.Update()
RegistraScript("$('#ModalMovtoPermanente').modal()")
End Sub
Protected Sub LnkAddMovto_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim cveConcepto As Integer = DdlConcepto.SelectedValue.ToEntero()
Dim descripcion As String = TxtDescripcion.Text
Dim tipoDescuento As Integer = DdlTipoDescto.SelectedValue.ToEntero()
Dim valor As Double = TxtValor.Text.ToDouble()
Dim vecesAplicar As Integer = TxtVecesAplicar.Text.ToEntero()
Dim montoLimite As Decimal = TxtMontoLimite.Text.ToDecimal()
Dim fechaInicioAplicacion As String = TxtFechaAplicacion.Text.ToDate().ToString("yyyy/MM/dd")
Dim estatus As Boolean = ChkEstatus.Checked
Dim CveCuenta As Integer = DdlCtaContable.SelectedValue.ToEntero() * (If(DdlCtaContable.DataValueField = "Id", -1, 1))
Dim Continuar As Boolean
Using ObjMovt As ClsNominas = New ClsNominas()
Continuar = ObjMovt.AddMovtoPermanente(cveConcepto, CvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus, CveCuenta) > 0
End Using
If Continuar Then
RegistraScript("$('#DModalMovtoPermanente').modal('hide');")
CargaMovtoPermanente()
UpMovtosPermanentes.Update()
Alert("Se ha agregado el movimiento permanente")
End If
RegistraScript("$('#ModalMovtoPermanente').modal('hide')")
End Sub
Protected Sub LnkUpMovto_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim cveConcepto As Integer = DdlConcepto.SelectedValue.ToEntero()
Dim descripcion As String = TxtDescripcion.Text
Dim tipoDescuento As Integer = DdlTipoDescto.SelectedValue.ToEntero()
Dim valor As Double = TxtValor.Text.ToDouble()
Dim vecesAplicar As Integer = TxtVecesAplicar.Text.ToEntero()
Dim montoLimite As Decimal = TxtMontoLimite.Text.ToDecimal()
Dim fechaInicioAplicacion As String = TxtFechaAplicacion.Text.ToDate().ToString("yyyy/MM/dd")
Dim estatus As Boolean = ChkEstatus.Checked
Dim CveCuenta As Integer = DdlCtaContable.SelectedValue.ToEntero() * (If(DdlCtaContable.DataValueField = "Id", -1, 1))
Dim Continuar As Boolean
Using ObjMovt As ClsNominas = New ClsNominas()
Continuar = ObjMovt.UpMovtoPermanente(CcveMovtoPermanente, cveConcepto, CvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus, CveCuenta)
End Using
If Continuar Then
RegistraScript("$('#ModalMovtoPermanente').modal('hide');")
CargaMovtoPermanente()
UpMovtosPermanentes.Update()
Alert("Se ha actualizado el movimiento permanente")
End If
End Sub
Protected Sub DdlTipoDescto_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
pnlMonto.Visible = DdlTipoDescto.SelectedValue.ToEntero() > 2
pnlVecesAplicar.Visible = DdlTipoDescto.SelectedValue.ToEntero() < 3
End Sub
Protected Sub LnkremoveMovtoPermanente_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim gvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow)
CcveMovtoPermanente = gvRow.DataKey("CveMovtoPermanente").ToEntero()
Dim Continuar As Boolean = False
Using ObjMovt As ClsNominas = New ClsNominas()
Continuar = ObjMovt.RemoveMovtoPermanente(CcveMovtoPermanente)
End Using
If Continuar Then
RegistraScript("$('#ModalMovtoPermanente').modal('hide');")
CargaMovtoPermanente()
UpMovtosPermanentes.Update()
Alert("Se ha eliminadó el movimiento permanente")
End If
End Sub
Protected Sub LnkEditarMovtoPermanente_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim gvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow)
CcveMovtoPermanente = gvRow.DataKey("CveMovtoPermanente").ToEntero()
Dim cveConcepto As Integer = gvRow.DataKey("CveConcepto").ToEntero()
Dim cvePersonal As Integer = gvRow.DataKey("CvePersonal").ToEntero()
Dim CveCuenta As Integer = gvRow.DataKey("CveCuenta").ToEntero()
Dim IdCtaContable As Integer = gvRow.DataKey("IdCtaContable").ToEntero()
Dim descripcion As String = gvRow.DataKey("Descripcion")
Dim tipoDescuento As Integer = gvRow.DataKey("TipoDescuento").ToEntero()
Dim valor As Double = gvRow.DataKey("Valor").ToDouble()
Dim vecesAplicar As Integer = gvRow.DataKey("VecesAplicar").ToEntero()
Dim montoLimite As Decimal = gvRow.DataKey("MontoLimite").ToDecimal()
Dim fechaInicioAplicacion As DateTime = gvRow.DataKey("FechaInicioAplicacion").ToDate()
Dim estatus As Boolean = gvRow.DataKey("Estatus") = "1" OrElse gvRow.DataKey("Estatus").ToUpper() = "TRUE"
Dim fechaRegistro As DateTime = gvRow.DataKey("FechaRegistro").ToDateTime()
Dim tipo As String = "P"
Dim drow As DataRow = dtNomConceptos.FiltroPrimero(String.Format("CveConcepto ='{0}'", cveConcepto))
If drow IsNot Nothing Then
tipo = drow("Tipo").ToString()
DdlTipo.SelectedValueExist(tipo)
DdlTipo_SelectedIndexChanged(Nothing, Nothing)
End If
CargaConcepto()
DdlConcepto.SelectedValueExist(cveConcepto)
TxtDescripcion.Text = descripcion.ToString()
DdlTipoDescto.SelectedValueExist(tipoDescuento.ToString())
DdlTipoDescto_SelectedIndexChanged(Nothing, Nothing)
TxtValor.Text = valor.ToString()
TxtVecesAplicar.Text = vecesAplicar.ToString()
TxtMontoLimite.Text = montoLimite.ToString()
TxtFechaAplicacion.Text = $"{fechaInicioAplicacion}"
DdlCtaContable.SelectedValueExist("-1")
If DdlCtaContable.DataValueField = "Id" Then
DdlCtaContable.SelectedValueExist(IdCtaContable)
Else
DdlCtaContable.SelectedValueExist(CveCuenta)
End If
ChkEstatus.Checked = estatus
RegistraScript("$('#ModalMovtoPermanente').modal()")
pnlAddupMovto.Visible = True
LnkAddMovto.Visible = False
LnkUpMovto.Visible = True
UpMovtosPermanentesModal.Update()
End Sub
#End Region
#Region "incapacidad"
Private Property CcvePersonalIncapacidad As Integer
Get
Return If((ViewState("CcvePersonalIncapacidad") Is Nothing), 0, Convert.ToInt32(ViewState("CcvePersonalIncapacidad")))
End Get
Set(ByVal value As Integer)
ViewState("CcvePersonalIncapacidad") = value
End Set
End Property
Public Property DTVacResumen As DataTable
Get
If ViewState("DTVacResumen") Is Nothing Then
ViewState("DTVacResumen") = New DataTable
End If
Return DirectCast(ViewState("DTVacResumen"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTVacResumen") = value
End Set
End Property
Public Property DiasDisponibles As Integer
Get
If ViewState("DiasDisponibles") Is Nothing Then
ViewState("DiasDisponibles") = 0
End If
Return ViewState("DiasDisponibles").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("DiasDisponibles") = value
End Set
End Property
Protected Sub CargaPersonalIncapacidad()
LimpiaPersonalIncapacidad()
LnkAgregarIncapacidad.Visible = False
LnkActualizarIncapacidad.Visible = False
CcvePersonalIncapacidad = 0
Using ObjPers As ClsNominas = New ClsNominas()
ObjPers.PersonalIncapacidadGet(-1, CvePersonal, UsuarioActual.CveEmpresa)
GVNom_PersonalIncapacidad.DataSource = ObjPers.DtResultados
End Using
GVNom_PersonalIncapacidad.DataBind()
UpsrIncapacidadpersonal.Update()
End Sub
Protected Sub LimpiaPersonalIncapacidad()
TxtSRINCfolio.Text = ""
TxtSRINCfechaInicio.Text = ""
TxtSRINCdiasAutorizados.Text = ""
TxtDiasPagoEmpresa.Text = If(UsuarioActual.CveEmpresa = 141, "3", "")
DdlSRINCcveTipodeIncidencia.SelectedValue = "-1"
DdlSRINCcveRamoSeguro.SelectedValue = "-1"
DdlSRINCcveTipoRiesgo.SelectedValue = "-1"
TxtSRINCporcentajedeIncapacidad.Text = "100"
DdlSRINCcveSecuelaConsecuencia.SelectedValue = "-1"
DdlSRINCcveControlIncapacidad.SelectedValue = "-1"
TxtSRINCdescripcion.Text = ""
UpsrIncapacidadpersonal.Update()
End Sub
Protected Sub LnkPersonalIncapacidad_Click(ByVal sender As Object, ByVal e As EventArgs)
LimpiaPersonalIncapacidad()
Dim gvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow)
CcvePersonalIncapacidad = gvRow.DataKey("CvePersonalIncapacidad").ToEntero()
Dim cvePersonal As Integer = gvRow.DataKey("CvePersonal").ToEntero()
Dim folio As String = gvRow.DataKey("Folio")
Dim fechaInicio As DateTime = gvRow.DataKey("FechaInicio").ToDateTime()
Dim diasAutorizados As Integer = gvRow.DataKey("DiasAutorizados").ToEntero()
Dim diasPagoEmpresa As Integer = gvRow.DataKey("DiasPagoEmpresa").ToEntero()
Dim cveTipodeIncidencia As Integer = gvRow.DataKey("CveTipodeIncidencia").ToEntero()
Dim cveRamoSeguro As Integer = gvRow.DataKey("CveRamoSeguro").ToEntero()
Dim cveTipoRiesgo As Integer = gvRow.DataKey("CveTipoRiesgo").ToEntero()
Dim porcentajedeIncapacidad As Integer = gvRow.DataKey("PorcentajedeIncapacidad").ToEntero()
Dim cveSecuelaConsecuencia As Integer = gvRow.DataKey("CveSecuelaConsecuencia").ToEntero()
Dim cveControlIncapacidad As Integer = gvRow.DataKey("CveControlIncapacidad").ToEntero()
Dim descripcion As String = gvRow.DataKey("Descripcion")
TxtSRINCfolio.Text = folio.ToString()
TxtSRINCfechaInicio.Text = $"{fechaInicio}"
TxtSRINCdiasAutorizados.Text = diasAutorizados.ToString()
TxtDiasPagoEmpresa.Text = diasPagoEmpresa.ToString()
DdlSRINCcveTipodeIncidencia.SelectedValueExist(cveTipodeIncidencia.ToString())
DdlSRINCcveRamoSeguro.SelectedValueExist(cveRamoSeguro.ToString())
DdlSRINCcveTipoRiesgo.SelectedValueExist(cveTipoRiesgo.ToString())
TxtSRINCporcentajedeIncapacidad.Text = porcentajedeIncapacidad.ToString()
DdlSRINCcveSecuelaConsecuencia.SelectedValueExist(cveSecuelaConsecuencia.ToString())
DdlSRINCcveControlIncapacidad.SelectedValueExist(cveControlIncapacidad.ToString())
TxtSRINCdescripcion.Text = descripcion.ToString()
LnkAgregarIncapacidad.Visible = False
LnkActualizarIncapacidad.Visible = True
RegistraScript("$('#ModalSRIncapacidad').modal()")
End Sub
Protected Sub LnkshowaaddIncapacidad_Click(ByVal sender As Object, ByVal e As EventArgs)
LimpiaPersonalIncapacidad()
LnkAgregarIncapacidad.Visible = True
LnkActualizarIncapacidad.Visible = False
CcvePersonalIncapacidad = 0
RegistraScript("$('#ModalSRIncapacidad').modal()")
End Sub
Protected Sub LnkAgregarIncapacidad_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim folio As String = TxtSRINCfolio.Text
Dim fechaInicio As DateTime = TxtSRINCfechaInicio.Text.ToDateTime()
Dim diasAutorizados As Integer = TxtSRINCdiasAutorizados.Text.ToEntero()
Dim DiasPagoEmpresa As Integer = TxtDiasPagoEmpresa.Text.ToEntero()
Dim cveTipodeIncidencia As Integer = DdlSRINCcveTipodeIncidencia.Text.ToEntero()
Dim cveRamoSeguro As Integer = DdlSRINCcveRamoSeguro.Text.ToEntero()
Dim cveTipoRiesgo As Integer = DdlSRINCcveTipoRiesgo.Text.ToEntero()
Dim porcentajedeIncapacidad As Integer = TxtSRINCporcentajedeIncapacidad.Text.ToEntero()
Dim cveSecuelaConsecuencia As Integer = DdlSRINCcveSecuelaConsecuencia.Text.ToEntero()
Dim cveControlIncapacidad As Integer = DdlSRINCcveControlIncapacidad.Text.ToEntero()
Dim descripcion As String = TxtSRINCdescripcion.Text
Dim Continuar As Boolean
Using ObjPers As ClsNominas = New ClsNominas()
Continuar = ObjPers.PersonalIncapacidadAdd(UsuarioActual.CveUsuario, CvePersonal, folio, fechaInicio, diasAutorizados, cveTipodeIncidencia, cveRamoSeguro, cveTipoRiesgo, porcentajedeIncapacidad, cveSecuelaConsecuencia, cveControlIncapacidad, descripcion, DiasPagoEmpresa)
End Using
If Continuar Then
CargaPersonalIncapacidad()
UpsrIncapacidadpersonal.Update()
Alert("La incapacidad se ha agregado.", TipoMensaje.ToastInformacion)
RegistraScript("$('#ModalSRIncapacidad').modal('hide')")
End If
End Sub
Protected Sub LnkActualizarIncapacidad_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim folio As String = TxtSRINCfolio.Text
Dim fechaInicio As DateTime = TxtSRINCfechaInicio.Text.ToDateTime()
Dim diasAutorizados As Integer = TxtSRINCdiasAutorizados.Text.ToEntero()
Dim DiasPagoEmpresa As Integer = TxtDiasPagoEmpresa.Text.ToEntero()
Dim cveTipodeIncidencia As Integer = DdlSRINCcveTipodeIncidencia.Text.ToEntero()
Dim cveRamoSeguro As Integer = DdlSRINCcveRamoSeguro.Text.ToEntero()
Dim cveTipoRiesgo As Integer = DdlSRINCcveTipoRiesgo.Text.ToEntero()
Dim porcentajedeIncapacidad As Integer = TxtSRINCporcentajedeIncapacidad.Text.ToEntero()
Dim cveSecuelaConsecuencia As Integer = DdlSRINCcveSecuelaConsecuencia.Text.ToEntero()
Dim cveControlIncapacidad As Integer = DdlSRINCcveControlIncapacidad.Text.ToEntero()
Dim descripcion As String = TxtSRINCdescripcion.Text
Dim Continuar As Boolean
Using ObjPers As ClsNominas = New ClsNominas()
Continuar = ObjPers.PersonalIncapacidadUp(UsuarioActual.CveUsuario, CcvePersonalIncapacidad, folio, fechaInicio, diasAutorizados, cveTipodeIncidencia, cveRamoSeguro, cveTipoRiesgo, porcentajedeIncapacidad, cveSecuelaConsecuencia, cveControlIncapacidad, descripcion, DiasPagoEmpresa)
End Using
If Continuar Then
CargaPersonalIncapacidad()
UpsrIncapacidadpersonal.Update()
Alert("La incapacidad se ha actualizado.", TipoMensaje.ToastInformacion)
RegistraScript("$('#ModalSRIncapacidad').modal('hide')")
End If
End Sub
#End Region
Protected Sub LnkActivar_Click(sender As Object, e As EventArgs)
LblEstatus.Text = "Activar personal"
LblFechaEstatus.Text = "Fecha ingreso ó reingreso"
TxtFechaEstatus.Text = ""
DivMotivoBaja.Visible = False
RegistraScript("$('#ModalUpEstatus').modal();")
upPersonEstatus.Update()
End Sub
Protected Sub LnkDesactivar_Click(sender As Object, e As EventArgs)
LblEstatus.Text = "Desactivar personal"
LblFechaEstatus.Text = "Fecha baja"
TxtFechaEstatus.Text = ""
DivMotivoBaja.Visible = True
RegistraScript("$('#ModalUpEstatus').modal();")
upPersonEstatus.Update()
End Sub
Protected Sub LnkUpEstatus_Click(sender As Object, e As EventArgs)
Dim fini As DateTime
Dim ffin As DateTime
Dim fecha As DateTime = TxtFechaEstatus.Text.ToDateTime()
If GvPersonalAltas.Rows.Count > 0 Then
Dim gvrow As GridViewRow = GvPersonalAltas.Rows(0)
fini = gvrow.DataKey("FechaInicio").ToDateTime()
ffin = gvrow.DataKey("FechaFin").ToDateTime()
End If
Dim estatus = -1
Dim continuar = False
If (LnkActivar.Visible) Then
estatus = 1
If ffin >= fecha Then
continuar = False
Alert(String.Format("la '{0}' debe ser mayor a {1:dd/MM/yyyy}", LblFechaEstatus.Text, ffin), TipoMensaje.MsgAdvertencia)
Else
continuar = True
End If
Else
estatus = 2
If fini >= fecha Then
continuar = False
Alert(String.Format("la '{0}' debe ser mayor a {1:dd/MM/yyyy}", LblFechaEstatus.Text, fini), TipoMensaje.MsgAdvertencia)
Else
continuar = True
End If
End If
'If continuar Then
' Using onom As ClsNominas = New ClsNominas()
' onom.ValidaFechaFinPersonal(CvePersonal, UsuarioActual.CveEmpresa, fecha.ToString("yyyy/MM/dd"))
' If onom.DtResultados.Rows.Count > 0 Then
' continuar = False
' Dim strbuild As StringBuilder = New StringBuilder()
' strbuild.Append("No es posible desactivar con esta fecha ya que existen asistencias posteriores a la fecha fin con nominas autorizadas, es necesario desautorizar la siguientes nominas para reintentar el proceso.")
' For Each drow As DataRow In onom.DtResultados.Rows
' strbuild.AppendFormat("<br/> {0}", drow("PeriodoTexto"))
' Next
' Alert(strbuild.ToString(), TipoMensaje.MsgAdvertencia)
' End If
' End Using
'End If
If continuar Then
Using objrh As New ClsRH
continuar = objrh.estatusPersonalUp(fecha, CvePersonal, estatus, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, DdlMotivoBaja.SelectedValue.ToEntero(), Txobservacionesbaja.Text)
End Using
End If
If continuar Then
EnviarCorreoBajaReingresoNomista(If(estatus = 1, TipoMovimientoRH.Reingreso, TipoMovimientoRH.Baja))
End If
If continuar Then
RegistraScript("$('#ModalUpEstatus').modal('hide');")
Alert("Se guardo correctamente", TipoMensaje.MsgInformacion)
CargaDatos()
End If
End Sub
Protected Sub LnkContratoAgropecuaria_Click(sender As Object, e As EventArgs)
Dim RutaArchivo As String = "F:\Proyectos\wwwSIG\General\CONTRATO.doc"
Dim dSDTotal As Decimal = 0
Dim SDTotalText As String = ""
Dim SDTotal As String = ""
Dim SueldoDiario As String = ""
Dim septimodia As String = ""
Dim Aguinaldo As String = ""
Dim Vacaciones As String = ""
Dim Prima As String = ""
Dim vacacionesyprima As String = ""
Dim Utilidades As String = ""
Dim strquery As String = String.Format("EXEC PA_Agro_ValidacionNomGet @CveValidacionNomina=-1,@CveEmpresa ={0} ", UsuarioActual.CveEmpresa)
Using objbase As New ClsNominas()
If (objbase.AgroValidacionNomGet(-1, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) Then
Dim dbrow As DataRow
dbrow = objbase.DtResultados.FiltroPrimero("CveValidacionNomina =4")
If Not IsNothing(dbrow) Then
SueldoDiario = String.Format("{0:N2}", dbrow("Importe"))
dSDTotal = dbrow("Importe").ToString().ToDecimal()
End If
dbrow = objbase.DtResultados.FiltroPrimero("CveValidacionNomina =5")
If Not IsNothing(dbrow) Then
septimodia = String.Format("{0:N2}", dbrow("Importe"))
dSDTotal = dSDTotal + dbrow("Importe").ToString().ToDecimal()
End If
dbrow = objbase.DtResultados.FiltroPrimero("CveValidacionNomina =6")
If Not IsNothing(dbrow) Then
Aguinaldo = String.Format("{0:N2}", dbrow("Importe"))
dSDTotal = dSDTotal + dbrow("Importe").ToString().ToDecimal()
End If
dbrow = objbase.DtResultados.FiltroPrimero("CveValidacionNomina =8")
If Not IsNothing(dbrow) Then
vacacionesyprima = String.Format("{0:N2}", dbrow("Importe"))
Dim temptotal As Decimal = dbrow("Importe").ToString().ToDecimal()
Vacaciones = String.Format("{0:N2}", temptotal / 1.5)
Prima = String.Format("{0:N2}", (temptotal / 1.5) * 0.5)
dSDTotal = dSDTotal + dbrow("Importe").ToString().ToDecimal()
End If
dbrow = objbase.DtResultados.FiltroPrimero("CveValidacionNomina =7")
If Not IsNothing(dbrow) Then
Utilidades = String.Format("{0:N2}", dbrow("Importe"))
dSDTotal = dSDTotal + dbrow("Importe").ToString().ToDecimal()
End If
SDTotalText = Texto2Letras(dSDTotal.ToString().ToDouble())
SDTotal = String.Format("{0:N2}", dSDTotal)
End If
End Using
Dim Tags As New List(Of TagsDocumentos)
Dim ObjRH As New ClsRH()
If ObjRH.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) Then
If ObjRH.CveSubProyecto.Contiene(11884, 11883) Then
RutaArchivo = "F:\Proyectos\wwwSIG\General\CONTRATOINVERNADERO.doc"
End If
Tags.Add(New TagsDocumentos("{NombreCompleto}", ObjRH.NombreCompleto))
Tags.Add(New TagsDocumentos("{años}", (DateTime.Now.Year - ObjRH.FechaNacimiento.Year).ToString()))
Tags.Add(New TagsDocumentos("{SubProyecto}", DdlSubProyectoAsignado.SelectedItem.Text.ToUpper()))
Tags.Add(New TagsDocumentos("{EstadoCivil}", DdlEstadoCivil.SelectedItem.Text))
Tags.Add(New TagsDocumentos("{CiudadOrigen}", String.Format("{0},{1}", TxtCiudadOrigen.Text, DdlEstados.SelectedItem.Text).ToUpper()))
Tags.Add(New TagsDocumentos("{RFC}", ObjRH.RFC))
Tags.Add(New TagsDocumentos("{Ciudad}", String.Format("{0},{1}", TxtCiudad.Text, DdlEstadosDomicilio.SelectedItem.Text).ToUpper()))
Tags.Add(New TagsDocumentos("{CALLE}", TxtCalle.Text))
Tags.Add(New TagsDocumentos("{NO}", TxtNumExt.Text))
Tags.Add(New TagsDocumentos("{COLONIA}", TxtColonia.Text))
Tags.Add(New TagsDocumentos("{CP}", TxtCP.Text))
Tags.Add(New TagsDocumentos("{SDTotalText}", SDTotalText))
Tags.Add(New TagsDocumentos("{SDTotal}", SDTotal))
Tags.Add(New TagsDocumentos("{SueldoDiario}", SueldoDiario))
Tags.Add(New TagsDocumentos("{septimodia}", septimodia))
Tags.Add(New TagsDocumentos("{Aguinaldo}", Aguinaldo))
Tags.Add(New TagsDocumentos("{Vacaciones}", Vacaciones))
Tags.Add(New TagsDocumentos("{Prima}", Prima))
Tags.Add(New TagsDocumentos("{vacacionesyprima}", vacacionesyprima))
Tags.Add(New TagsDocumentos("{Utilidades}", Utilidades))
Tags.Add(New TagsDocumentos("{NumeroDia}", String.Format("{0:dd}", ObjRH.FechaIngreso)))
Tags.Add(New TagsDocumentos("{MesLetra}", String.Format("{0:MMMM}", ObjRH.FechaIngreso)))
Tags.Add(New TagsDocumentos("{Ejercicio}", String.Format("{0:yyyy}", ObjRH.FechaIngreso)))
End If
ObjRH.Dispose()
Dim objGemBoxDocument As New clsGemBoxDocument(RutaArchivo)
objGemBoxDocument.SustituirTags(Tags)
objGemBoxDocument.GuardarStreamPDF()
Dim objbyte = objGemBoxDocument.GetBytesDocumento
Try
Response.Buffer = True
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", String.Format("{0}; filename={1}.{2}", "attachment", "Contrato.pdf", "pdf"))
Response.BinaryWrite(objbyte) ' create the file
Response.Flush() ' send it to the client to download
objbyte = Nothing
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
'HttpContext.Current.Response.End()
Catch ex As Exception
If UsuarioActual.CveRol = 1 Then
Alert($"Error: {ex.Message} | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))}", TipoMensaje.MsgAdvertencia)
Else
Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod:'IMPDFclspag'", TipoMensaje.MsgAdvertencia)
End If
End Try
End Sub
#Region "ENVIAR CORREO NOMINISTA"
Enum TipoMovimientoRH
Alta
Baja
Reingreso
End Enum
Private Sub EnviarCorreoBajaReingresoNomista(eTipoMovimientoRH As TipoMovimientoRH)
Dim CorreoNominista As String = GlobalDTUsuarios(CveUsuario:=DDLUsuarioNomina.SelectedValue.ToEntero).FiltroPrimeroValor("Correo")
Dim correo As New ClsSisMail
Dim Cuerpo As New StringBuilder
Dim CorreoUsuario As String = GlobalDTUsuarios(CveUsuario:=UsuarioActual.CveUsuario).FiltroPrimeroValor("Correo")
Dim CCP As String = If(CorreoUsuario.Trim.Length > 0, CorreoUsuario, "")
'Para Pruebas
'CorreoNominista = "oscar.irigoyen@adssistemas.mx"
If CorreoNominista = "" Then
Alert("No se envio el correo de notificación a nominas, el nominista no tiene correo electronico", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim Puesto As String = ""
Dim Padre As String = ""
Dim Madre As String = ""
Dim FechaIngreso As String = ""
Dim objRH As New ClsRH
If objRH.PersonalFamiliaresGet(-1, CvePersonal) Then
Dim DtFamiliares As DataTable = objRH.DtResultados.FiltraParametros(" CveParentesco = 1 ")
If DtFamiliares.Rows.Count > 0 Then
Padre = DtFamiliares.Rows(0)("Nombre").ToString
End If
DtFamiliares = objRH.DtResultados.FiltraParametros(" CveParentesco = 2 ")
If DtFamiliares.Rows.Count > 0 Then
Madre = DtFamiliares.Rows(0)("Nombre").ToString
End If
End If
If Padre.Trim.Length = 0 Then
Padre = TxtNombrePadre.Text.Trim
End If
If Madre.Trim.Length = 0 Then
Madre = TxtNombreMadre.Text.Trim
End If
Dim TimpoMovimiento As String = ""
Select Case eTipoMovimientoRH
Case TipoMovimientoRH.Alta
TimpoMovimiento = "Alta"
Exit Select
Case TipoMovimientoRH.Baja
TimpoMovimiento = "Baja"
Exit Select
Case TipoMovimientoRH.Reingreso
TimpoMovimiento = "Reingreso"
Exit Select
End Select
objRH.Dispose()
Cuerpo.AppendLine("<table border='0' style='width:100%'>")
Cuerpo.AppendLine($"<tr><td style=' font-size:large;'>{ If(DdlEmpresaAsignada.SelectedValue.ToEntero > 0, DdlEmpresaAsignada.SelectedItem.Text, UsuarioActual.Empresa.Empresa) }<br/></td><td style='width:20%'> </td><td style='text-align: right;'>{ Now.ToShortDateString } { Now.ToShortTimeString } <br/></td> </tr>")
Cuerpo.AppendLine($"<tr><td style=' font-size:large; text-align: left;' colspan='3'>Notificacion por { TimpoMovimiento } de Nomina</td></tr>")
Cuerpo.AppendLine("</table>")
Cuerpo.AppendLine("<br/>")
Cuerpo.AppendLine("<br/>")
Cuerpo.AppendLine("<table border='0'>")
Cuerpo.AppendLine($"<tr><td style='text-align: center; font-weight:bold; font-size:medium;' colspan='2'>Datos del Candidato</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Puesto:</td><td style=' text-align: left; font-weight:bold;'>{IIf(DdlPuesto.SelectedIndex > 0, DdlPuesto.SelectedItem.Text, "") }</td></tr>")
If DvRuta.Visible Then
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Ruta/Servicio:</td><td style=' text-align: left; font-weight:bold;'>{ DdlRuta.SelectedItem.Text }</td></tr>")
End If
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Fecha de { TimpoMovimiento }:</td><td style=' text-align: left; font-weight:bold;'>{ If(eTipoMovimientoRH = TipoMovimientoRH.Alta, Now.ToString("dd/MM/yyyy"), TxtFechaEstatus.Text) }</td></tr>")
If eTipoMovimientoRH = TipoMovimientoRH.Baja Then
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Motivo de Baja:</td><td style=' text-align: left; font-weight:bold;'>{ DdlMotivoBaja.SelectedItem.Text }</td></tr>")
If Txobservacionesbaja.Text.Trim.Length > 0 Then
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Observaciones :</td><td style=' text-align: left; font-weight:bold;'>{ Txobservacionesbaja.Text.Trim }</td></tr>")
End If
End If
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Nombre:</td><td style=' text-align: left; font-weight:bold;'>{ NombreCompleto }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Fecha y Lugar de Nacimiento:</td><td style=' text-align: left; font-weight:bold;'>{TxtFechaNacimiento.Text} {TxtLugarNacimiento.Text}</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Numero IMSS:</td><td style=' text-align: left; font-weight:bold;'>{ TxtNumeroSS.Text }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Numero Infonavit:</td><td style=' text-align: left; font-weight:bold;'>{ If(TxtInfoNumCredito.Text.Trim = "", "NO CUENTA CON CREDITO", TxtInfoNumCredito.Text) }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Sexo:</td><td style=' text-align: left; font-weight:bold;'>{ IIf(DdlGenero.SelectedValue = "1", "Masculino", "Femenino") }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>R.F.C.:</td><td style=' text-align: left; font-weight:bold;'>{ TxtRFC.Text }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>CURP:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCURP.Text }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Nombre del Padre:</td><td style=' text-align: left; font-weight:bold;'>{ Padre }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Nombre de la Madre:</td><td style=' text-align: left; font-weight:bold;'>{ Madre }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Dirección:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCalle.Text } No Ext.{ TxtNumExt.Text} No int.{TxtNumInt.Text}</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Escolaridad:</td><td style=' text-align: left; font-weight:bold;'>{ IIf(DdlEscolaridad.SelectedIndex > 0, DdlEscolaridad.SelectedItem.Text, "") }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Telefono:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCelular.Text}, {TxtCelularPersonal.Text}, {TxtTelefono.Text}</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Tel en Caso de Emergencia:</td><td style=' text-align: left; font-weight:bold;'>{ TxtTelefonoEmergencia.Text }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Correo:</td><td style=' text-align: left; font-weight:bold;'>{ TxtCorreo.Text }</td></tr>")
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Supervisor:</td><td style=' text-align: left; font-weight:bold;'>{ DdlSupervisorOrganigrama.SelectedItem.Text }</td></tr>")
Dim SBDatosBancarios As New StringBuilder
For Each GvRow As GridViewRow In GvBancosCuentas.Rows
SBDatosBancarios.Append($"Banco: {GvRow.FCLabel("LtNombreBanco").Text}, ")
SBDatosBancarios.Append(If(GvRow.FCLabel("LtNumeroCuenta").Text.Trim.Length > 0, $"Cuenta: {GvRow.FCLabel("LtNumeroCuenta").Text}, ", ""))
SBDatosBancarios.Append(If(GvRow.FCLabel("LtCLABE").Text.Trim.Length > 0, $"CLABE: {GvRow.FCLabel("LtCLABE").Text}, ", ""))
SBDatosBancarios.Append(If(GvRow.FCLabel("LtMoneda").Text.Trim.Length > 0, $"Moneda: {GvRow.FCLabel("LtMoneda").Text}, ", ""))
SBDatosBancarios.Append(If(GvRow.FCLabel("LlbEstatusTexto").Text.Trim.Length > 0, $"Estatus: {GvRow.FCLabel("LlbEstatusTexto").Text} ", ""))
SBDatosBancarios.AppendLine($"<br>")
Next
If SBDatosBancarios.ToString.Trim.Length > 0 Then
Cuerpo.AppendLine($"<tr><td style='text-align: right;'>Datos Bancarios:</td><td style=' text-align: left; font-weight:bold;'>{ SBDatosBancarios.ToString }</td></tr>")
End If
Cuerpo.AppendLine("</table>")
correo.SendMail(EmpresaNotificaciones, CorreoNominista, $"Notificacion por { TimpoMovimiento } de Nomina: " & NombreCompleto, Cuerpo.ToString, CCP:=CCP)
End Sub
#End Region
Protected Sub LnkSolicitarVacaciones_Click(sender As Object, e As EventArgs)
TxtVacDiasPago.Text = DiasDisponibles.ToString
Dim diaDescanso As Integer = GlobalDTTurno(UsuarioActual.CveEmpresa).FiltroPrimeroValor("DiaDescanso", $" CveTurno = {DdlTurno.SelectedValue.ToEntero}").ToEntero
diaDescanso = If(diaDescanso <= 0, 1, diaDescanso)
LblModalAddVacacionesTitulo.Text = $"Agregar Vacaciones - días disponibles <b>{DiasDisponibles}</b>"
UpModalAddVacacionesTitulo.Update()
CalculaDiasVacaciones(TxtFechaInicioVac.Text.ToDate, TxtVacDiasPago.Text.ToEntero)
If Not diaDescanso > 0 Then
Alert("El turno no tiene día de descanso, provisionalmente se tomara el domingo.", TipoMensaje.MsgAdvertencia)
End If
RegistraScript("$('#ModalAddVacaciones').modal('show');")
End Sub
Private Sub CalculaDiasVacaciones(fechaInicioParametro As Date, diasVacaciones As Integer, Optional fechaFinParametro As Date = Nothing)
Dim diaDescanso As Integer = GlobalDTTurno(UsuarioActual.CveEmpresa).FiltroPrimeroValor("DiaDescanso", $" CveTurno = {DdlTurno.SelectedValue.ToEntero}").ToEntero
diaDescanso = If(diaDescanso <= 0, 1, diaDescanso)
If fechaFinParametro <> Nothing Then
If fechaInicioParametro > fechaFinParametro Then
Alert("La fecha fin no puede ser mayor a la fecha inicial", TipoMensaje.MsgAdvertencia)
fechaFinParametro = Nothing
TxtVacDiasPago.Text = DiasDisponibles.ToString
End If
End If
If fechaFinParametro <> Nothing Then
Dim DiferenciaEntreFechas As Integer = (fechaFinParametro - fechaInicioParametro).Days + 1
Dim DiasNolavorales As Integer = 0
Dim FechaTemp As Date = fechaInicioParametro
For x = 1 To DiferenciaEntreFechas
Dim day_of_week = CType(FechaTemp.DayOfWeek, Integer) + 1
If day_of_week = diaDescanso Then
DiasNolavorales = DiasNolavorales + 1
End If
FechaTemp = FechaTemp.AddDays(1)
If 1 = DiferenciaEntreFechas Then
If day_of_week = diaDescanso Then
DiasNolavorales = DiasNolavorales + 1
End If
End If
Next x
If (DiferenciaEntreFechas - DiasNolavorales) >= DiasDisponibles Then
diasVacaciones = DiasDisponibles
Else
diasVacaciones = DiferenciaEntreFechas - DiasNolavorales
End If
TxtVacDiasPago.Text = diasVacaciones.ToString
End If
If TxtVacDiasPago.Text.ToEntero > DiasDisponibles Then
TxtVacDiasPago.Text = DiasDisponibles.ToString
diasVacaciones = DiasDisponibles
End If
Dim DiasAgregados As Integer = 0
Dim FechaFin As Date = fechaInicioParametro
Dim Contador As Integer = 0
For x = 2 To diasVacaciones
Dim day_of_week = CType(FechaFin.DayOfWeek, Integer) + 1
If day_of_week = diaDescanso Then
FechaFin = FechaFin.AddDays(2)
DiasAgregados = DiasAgregados + 1
Else
FechaFin = FechaFin.AddDays(1)
day_of_week = CType(FechaFin.DayOfWeek, Integer) + 1
If (diasVacaciones = Contador + 2) AndAlso day_of_week = diaDescanso Then
FechaFin = FechaFin.AddDays(1)
DiasAgregados = DiasAgregados + 1
End If
End If
Contador = Contador + 1
Next
Dim UltimoDiamasUno As Integer = CType(FechaFin.AddDays(1).DayOfWeek, Integer) + 1
If UltimoDiamasUno = diaDescanso Then
FechaFin = FechaFin.AddDays(1)
DiasAgregados = DiasAgregados + 1
End If
TxtFechaFinVac.Text = FechaFin.ToString
Txtdiasinabiles.Text = DiasAgregados.ToString
UpSolicitarVacaciones.Update()
End Sub
Protected Sub LnkCalculaFechasVacaciones_Click(sender As Object, e As EventArgs)
CalculaDiasVacaciones(TxtFechaInicioVac.Text.ToDate, TxtVacDiasPago.Text.ToEntero)
End Sub
Protected Sub LnkCalculaFechasVacacionesFechaFin_Click(sender As Object, e As EventArgs)
If Not validaFechasVaciones() Then
Exit Sub
End If
CalculaDiasVacaciones(TxtFechaInicioVac.Text.ToDate, TxtVacDiasPago.Text.ToEntero, TxtFechaFinVac.Text.ToDate)
End Sub
Private Function validaFechasVaciones() As Boolean
If Not IsDate(TxtFechaFinVac.Text) Then
Alert("Fecha fin invalida", TipoMensaje.MsgAdvertencia)
Return False
End If
If Not IsDate(TxtFechaInicioVac.Text) Then
Alert("Fecha de inicio invalida", TipoMensaje.MsgAdvertencia)
Return False
End If
Return True
End Function
Protected Sub DdlVacPeriodo_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim Ejercicio As Integer = DdlVacPeriodo.SelectedValue.ToEntero
If Ejercicio > 0 Then
DiasDisponibles = DTVacResumen.FiltroPrimeroValor("DiasDisponibles", $"Ejercicio = {Ejercicio}").ToEntero
TxtVacDiasPago.Text = DiasDisponibles.ToString
LblModalAddVacacionesTitulo.Text = $"Agregar Vacaciones - días disponibles <b>{DiasDisponibles}</b>"
CalculaDiasVacaciones(TxtFechaInicioVac.Text.ToDate, TxtVacDiasPago.Text.ToEntero)
UpModalAddVacacionesTitulo.Update()
UpSolicitarVacaciones.Update()
End If
End Sub
End Class