Files
SIG/RH/Personal.aspx.vb
Antonio Gonzalez 18f526a611 correcciones ligeras
2020-05-20 13:12:51 -07:00

5925 lines
258 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
Partial Class RH_Personal
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
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
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 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 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 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 CInt(ViewState("PU"))
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
#End Region
Const wdPageBreak As Integer = 7
Const wdCharacter As Integer = 1
'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
ViewState("Orden") = ""
ViewState("Orden1") = ""
Session("FileUpload") = ""
ViewState("Archivo") = ""
DTConsumos = Nothing
If UsuarioActual.CveRol = 1 Or UsuarioActual.CveEmpresa = 74 Then
TabGES.Visible = True
End If
SetValues()
'SetPermisos()
CargaEscolaridad()
CargaEstadoCivil()
CargaDepartamento()
CargaPuestos()
CargaEstatusPersonal()
CargaGenero()
CargaMotivoBaja()
CargaRuta()
CargaTiposContrato()
CargaTipoPeriodo()
CargaTurno()
CargaJornadas()
CargaProyecto()
CargaTiposAsistencia()
'CargaMotivoHoraExtra()
CargaMotivosHorasExtras()
CargaSupervisores()
CargaMetodosPago()
CargaTipoRegimen()
CargaRiesgoPuesto()
CargaBancos()
CargaSubProyectosZona()
CargaEstados(1)
CargaMonedas()
CargaSuperioresOrganigrama()
CargaUsuariosNomina()
CargaComboUniformes()
CargaPermisos()
CargaCombosBuzon()
CargaPermisosReemplazos()
If Request("CvePersonal") IsNot Nothing AndAlso IsNumeric(Request("CvePersonal")) AndAlso Request("CvePersonal").ToEntero > 0 Then
ViewState("CvePersonal") = Request("CvePersonal")
'CvePersonal = ViewState("CvePersonal").ToString.ToEntero
CargaDatos()
CargaDocumentacionFirmaDecontratos()
'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()
Else
'Configuración de Modalidad Insert
ImgAddObs.Visible = False
LblFechaCaptura.Text = Now.ToShortDateString()
LblUsuarioCapturo.Text = UsuarioActual.Usuario
ViewState("CvePersonal") = -1
BtnEliminar.Visible = False
CarcaConceptosNomina()
For Each Gvr As GridViewRow In GVConceptos.Rows
If CBool(Gvr.DataKey("Obligatorio")) Then
Gvr.FCCheckBox("ChkAplica").Checked = True
Else
Gvr.Visible = False
End If
Next
'Inicia Permisos
'Fin Permisos
End If
CargaCuentasBancarias()
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
'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)
End If
AgregarEventosAsincronosGvVacaciones()
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
DdlClienteAsignado.Attributes.Add("onclick", "CargaClientes();")
DdlClienteAsistenciaC.Attributes.Add("onclick", "CargaClientes();")
DdlClienteAsistenciaA.Attributes.Add("onclick", "CargaClientes();")
CargaClientes()
If Request("FechaI") IsNot Nothing AndAlso IsDate(Request("FechaI")) Then
txtFechaI.Text = Request("FechaI")
Else
txtFechaI.Text = Now.ToShortDateString
End If
If Request("FechaF") IsNot Nothing AndAlso IsDate(Request("FechaF")) Then
txtFechaF.Text = Request("FechaF")
Else
txtFechaF.Text = Now.ToShortDateString
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
'DdlProyectoAsistenciaC
'DdlSubProyectoAsistenciasC
End If
TxtFechaICredito.Text = $"01/01/{Now.Year}"
TxtFechaFCredito.Text = Now.ToShortDateString
End Sub
Private Sub SetPermisos()
'Permisos
End Sub
#Region "Carga Combos"
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()
DdlTipoContrato.DataSource = GlobalDTTiposContrato
DdlTipoContrato.DataBind()
End Sub
Private Sub CargaTurno()
DdlTurno.DataSource = GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlTurno.DataBind()
End Sub
Private Sub CargaJornadas()
DdlJornada.DataSource = GlobalDTJornadas
DdlJornada.DataBind()
End Sub
'Private Sub CargaMotivoHoraExtra()
' DdlMotivoHoraExtra.DataSource = GlobalDTMotivosHorasExtras.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
' DdlMotivoHoraExtra.DataBind()
'End Sub
Private Sub CargaDepartamento()
DdlDepartamento.DataSource = GlobalDTDepartamentos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlDepartamento.DataBind()
End Sub
Private Sub CargaPuestos()
DdlPuesto.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa)
DdlPuesto.DataBind()
End Sub
Private Sub CargaRuta()
DdlRuta.DataSource = GlobalDTRutas.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlRuta.DataBind()
End Sub
Private Sub CargaMotivoBaja()
DdlMotivoBaja.DataSource = GlobalDTMotivoBaja.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlMotivoBaja.DataBind()
End Sub
Private Sub CargaEstatusPersonal()
DdlEstatusPersonal.DataSource = GlobalDTEstatusPersonal
DdlEstatusPersonal.DataBind()
End Sub
Private Sub CargaUsuariosNomina()
DDLUsuarioNomina.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa)
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()
End Sub
Private Sub CargaProyecto()
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()
DdlSubProyectoAsignado.Items.Clear()
DdlSubProyectoAsignado.DataSource = GlobalDTSubProyectos(DdlProyectoAsignado.SelectedValue.ToEntero)
DdlSubProyectoAsignado.DataBind()
DdlSubProyectoAsignado.Items.Insert(0, New ListItem("Sin SubProyecto asignado", "-1"))
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.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlTipoAsistencias.DataBind()
End Sub
Private Sub CargaMotivosHorasExtras()
DdlMotivoHoraExtra.DataSource = GlobalDTMotivosHorasExtras.FiltraParametros("CveEmpresa = " & 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()
DdlRegimenContratacion.DataSource = GlobalDTNomSatRegimenContratacion
DdlRegimenContratacion.DataBind()
End Sub
Private Sub CargaRiesgoPuesto()
DdlRiesgoPuesto.DataSource = GlobalDTNomSatRiesgoPuesto
DdlRiesgoPuesto.DataBind()
End Sub
Private Sub CargaBancos()
DdlBanco.DataSource = GlobalDTNomSatBancos
DdlBanco.DataBind()
End Sub
Private Sub CargaEstados(pCvePais As Integer)
DdlEstados.DataSource = GlobalDTGralEstados(pCvePais)
DdlEstados.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
#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 = "")
Dim objpersonal As New ClsRH
If objpersonal.GetAsistencias(CvePersonal, DdlClienteAsistenciaC.SelectedValue.ToEntero, -1, DdlSubProyectoAsistenciasC.SelectedValue.ToEntero, DdlTurno.SelectedValue.ToEntero, -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
objpersonal.Dispose()
GVAsistencia.DataBind()
UpDatos.Update()
End Sub
Protected Sub LbGuardarAsistencia_Click(sender As Object, e As System.EventArgs) Handles LbGuardarAsistencia.Click
Dim 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
ObjPersonal.Dispose()
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.FiltraParametros("CveEmpresa = " & 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.FiltraParametros("CveEmpresa = " & 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
Dim 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, DdlClienteAsistenciaC.SelectedValue.ToEntero, DdlSubProyectoAsistenciasC.SelectedValue.ToEntero, 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
ObjPersonal.Dispose()
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 Sub CargaDatos()
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
'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)
TxtCP.Text = ObjPersonal.CP
TxtColonia.Text = ObjPersonal.Colonia
TxtCiudad.Text = ObjPersonal.Ciudad
TxtEstado.Text = ObjPersonal.Estado
TxtTelefono.Text = ObjPersonal.Telefono
TxtCelular.Text = ObjPersonal.Celular
TxtLugarNacimiento.Text = ObjPersonal.LugarNacimiento.ToString
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) Then
LnkSurtir.Visible = True
DdlUniforme.Visible = False
LnkSurtir.PostBackUrl = $"../Inventarios/ResguardoMaterial.aspx?CvePersonal={CvePersonal}&EsSurtidoUniforme=1"
CargaUniformesPersonal()
End If
If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & ".jpg") Then
Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.jpg", UsuarioActual.CveEmpresa, CvePersonal)
Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica))
ImgPersonal.ImageUrl = logouri
ElseIf File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & ".png") Then
Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.png", UsuarioActual.CveEmpresa, CvePersonal)
Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={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)
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(ObjPersonal.DtResultados.Rows(0)("FechaActivo").ToString.Length > 0, ObjPersonal.DtResultados.Rows(0)("FechaActivo").ToString.ToDate.ToString("dd/MM/yyyy"), ObjPersonal.DtResultados.Rows(0)("FechaIng").ToString.ToDate.ToString("dd/MM/yyyy"))
TxtFechaReingreso.Text = If(ObjPersonal.DtResultados.Rows(0)("FechaReingreso").ToString.Length > 0, ObjPersonal.DtResultados.Rows(0)("FechaReingreso").ToString.ToDate.ToString("dd/MM/yyyy"), "")
End If
DdlEstatusPersonal.SelectedValue = ObjPersonal.CveEstatusPersonal.ToString
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
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
TxtSalarioDiario.Text = ObjPersonal.SalarioDiario.ToString
TxtSDI.Text = ObjPersonal.SDI.ToString
TxtSalarioCotizado.Text = ObjPersonal.SalarioDiarioSS.ToString
TxtBono.Text = ObjPersonal.Bono.ToString
TxtNumDiasAguinaldo.Text = ObjPersonal.NumDiasAguinaldo.ToString
TxtPorPrimaVacacional.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
'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()
'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);")
If ObjPersonal.IdCtaContPersonal > 0 Then DdlViaticos.Items.Add(New ListItem(ObjPersonal.CtaContPersonal, ObjPersonal.IdCtaContPersonal.ToString)) : DdlViaticos.SelectedValue = ObjPersonal.IdCtaContPersonal.ToString
If ObjPersonal.IdCtaContPrestamos > 0 Then DdlPrestamos.Items.Add(New ListItem(ObjPersonal.CtaContPrestamos, ObjPersonal.IdCtaContPrestamos.ToString)) : DdlPrestamos.SelectedValue = ObjPersonal.IdCtaContPrestamos.ToString
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()
Else
Alert("El Personal Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
BtnGuardar.Enabled = False
End If
End If
ObjPersonal.Dispose()
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
'System.Threading.Thread.Sleep(3000)
Dim ObjPersonal As New ClsRH()
Dim ObjCuentasDeposito As New ClsGenerales(ObjPersonal.IniciaTransacSQL())
Dim ObjAF As New ClsAF(ObjPersonal.IniciaTransacSQL())
Dim Extension As String = Path.GetExtension(ModExtensiones.DirectorioBaseEmpresas + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\RH\" & ViewState("Archivo").ToString)
Dim URL As String = CvePersonal & Extension
Dim Ruta = String.Format("{0}Empresas\{1}\Temp\RH\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, 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
FechaBaja = TxtFechaBaja.Text.ToDate
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,
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, TxtCelular.Text.Trim, TxtRFC.Text.Trim,
TxtCURP.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, DdlSubproyectoZona.SelectedValue.ToEntero, CveUniforme:=DdlUniforme.SelectedValue.ToEntero,
TelefonoExtension:=TxtTelefonoExtension.Text, CelularPersonal:=TxtCelularPersonal.Text, TelefonoMarcadoRapido:=TxtTelefonoMarcadoRapido.Text, ContactoAlterno:="") Then
If Archivo.Exists Then
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
'Agregar Cuentas Bancarias
ViewState("CvePersonal") = ObjPersonal.CvePersonal
'Funsion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
If 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, 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"";")
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, TxtCelular.Text.Trim, TxtRFC.Text.Trim,
TxtCURP.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, DdlSubproyectoZona.SelectedValue.ToEntero, CveUniforme:=DdlUniforme.SelectedValue.ToEntero,
TelefonoExtension:=TxtTelefonoExtension.Text, CelularPersonal:=TxtCelularPersonal.Text, TelefonoMarcadoRapido:=TxtTelefonoMarcadoRapido.Text, ContactoAlterno:="", CveUsuarioModifico:=UsuarioActual.CveUsuario,
FechaActivo:=FechaActivo, FechaReingreso:=FechaReingreso) Then
'Funsion usa RH Familiares
If UsuarioActual.Empresa.Funcionalidad(568) = "1" Then
ProcesaDTFamiliares(ObjPersonal)
End If
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.MsgError)
Else
ObjPersonal.Commit()
Alert(Mensaje, TipoMensaje.MsgInformacion, Accion)
'If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & ObjPersonal.URL) Then
' ImgPersonal.ImageUrl = "/Empresas/" & UsuarioActual.CveEmpresa & "/RH/Personal/" & ObjPersonal.URL
'End If
If CvePersonal > 0 Then
CargaDatos()
End If
End If
GuardarDocumentosFirmaContrato()
Session("FileUpload") = ""
ViewState("Archivo") = ""
ObjPersonal.Dispose()
ObjCuentasDeposito.Dispose()
ObjAF.Dispose()
UpDatos.Update()
CargaGvBitacora()
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 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.SelectedIndex = 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.SelectedValueExist(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.SelectedIndexChanged
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
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
Else
GVConceptos.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 DdlTipoAplicacion_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim Ddl As DropDownList = DirectCast(sender, DropDownList)
Dim gvr As GridViewRow = DirectCast(Ddl.NamingContainer, GridViewRow)
Select Case Ddl.SelectedValue.ToEntero
Case 1
'Descontar hasta pagar el saldo prestado
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtSaldoIni").Visible = True
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtNoPagos").Visible = False
Case 2
'Descontar el numero de pagos
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtSaldoIni").Visible = False
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtNoPagos").Visible = True
Case 2600
'Permanente
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtSaldoIni").Visible = False
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtNoPagos").Visible = False
Case -1
'Seleccione
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtSaldoIni").Visible = False
GVConceptos.Rows(gvr.RowIndex).FCTextBox("TxtNoPagos").Visible = False
End Select
End Sub
Protected Sub DdlEstatusPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEstatusPersonal.SelectedIndexChanged
MostrarOcultarFechasEstatus()
End Sub
Private Sub MostrarOcultarFechasEstatus()
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
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("Empresas\{0}\OI", UsuarioActual.CveEmpresa))
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 LbAgregarCuentaBanco_Click(sender As Object, e As EventArgs)
Dim EsBancomer = False
If TxtNombreBanco.Text.ToUpper.Contains("BBVA") Or TxtNombreBanco.Text.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
'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
If TxtCLABECB.Text.Trim.Length <> 18 And TxtCLABECB.Text.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 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
'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
'SI CIE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 6 Y REFERENCIA OBLIGATORIA
If (TxtConvenioCIE.Text.Trim.Length <> 0 And TxtConvenioCIE.Text.Trim.Length <> 6) Or (TxtConvenioCIE.Text.Trim.Length = 6 And TxtReferenciaCB.Text.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 (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(TxtNombreBanco.Text.Trim, TxtNumeroSucursal.Text.Trim, TxtCLABECB.Text.Trim, TxtSWIFT.Text.Trim, TxtPlaza.Text.Trim, TxtNumeroCuenta.Text.Trim, TxtConvenioCIE.Text.Trim, TxtReferenciaCB.Text.Trim, DdlMoneda.SelectedValue.ToEntero, DdlMoneda.SelectedItem.Text, TxtBBVAAlias.Text)
End Sub
Private Sub CargaGridCuentasBancos(Orden As String)
If CvePersonal > 0 Then
If Orden <> String.Empty Then
Dim DV As New DataView(DTCuentasBancos, "", Orden, DataViewRowState.CurrentRows)
GvBancosCuentas.DataSource = DV.ToTable()
DV.Dispose()
Else
GvBancosCuentas.DataSource = DTCuentasBancos
End If
Else
If Orden <> String.Empty 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)
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, CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=BBVAAlias) 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") = False
TempDTCuentasBancos.Rows.Add(Row)
End If
LimpiaCuentasBancarias()
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString)
If CvePersonal > 0 Then
CargaGvBitacora()
End If
End Sub
Private Sub LimpiaCuentasBancarias()
TxtNombreBanco.Text = ""
TxtNumeroSucursal.Text = ""
TxtCLABECB.Text = ""
TxtSWIFT.Text = ""
TxtPlaza.Text = ""
TxtNumeroCuenta.Text = ""
TxtConvenioCIE.Text = ""
TxtReferenciaCB.Text = ""
End Sub
Private Sub CargaCuentasBancarias()
Dim ObjCuentasBancos As New ClsGenerales
ViewState("OrdenCuentasBancos") = ""
DTCuentasBancos = New DataTable
TempDTCuentasBancos = New DataTable
If ObjCuentasBancos.GetCuentasDepositos(CvePersonal:=CvePersonal) 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(ViewState("OrdenCuentasBancos").ToString)
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 GvBancosCuentas_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvBancosCuentas.RowEditing
GvBancosCuentas.EditIndex = e.NewEditIndex
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString)
End Sub
Protected Sub GvBancosCuentas_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvBancosCuentas.RowCancelingEdit
GvBancosCuentas.EditIndex = -1
CargaGridCuentasBancos(ViewState("OrdenCuentasBancos").ToString)
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 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, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=BBVAAlias) 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(ViewState("OrdenCuentasBancos").ToString)
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, CveUsuarioModifico:=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(ViewState("OrdenCuentasBancos").ToString)
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"
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")
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("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.SelectedItem.Text))
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", If(DdlMotivoBaja.SelectedValue = "-1", "", DdlMotivoBaja.SelectedItem.Text)))
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", ObjPersonal.Bono.ToString))
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(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
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.SelectedItem.Text))
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", If(DdlMotivoBaja.SelectedValue = "-1", "", DdlMotivoBaja.SelectedItem.Text)))
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", ObjPersonal.Bono.ToString))
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(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
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(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\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, "ReportePersonal", "PDF")
End If
End If
ObjPersonal.Dispose()
End Sub
Private Sub GenerarPDFGastosXComp(Optional Formato As String = "PDF")
If RBLTipoGastos.SelectedValue = "1" Then
If DTGastosSinComp.Rows.Count > 0 Then
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))
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
If Imagen.Exists Then
params.Add(New ReportParameter("pImg", logouri))
Else
params.Add(New ReportParameter("pImg", ""))
End If
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 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))
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
If Imagen.Exists Then
params.Add(New ReportParameter("pImg", logouri))
Else
params.Add(New ReportParameter("pImg", ""))
End If
ImprimirPDF("Empresas/Grales/Formatos/GastosXComprobarCheque.rdlc", DTGastosPorCheque, params, "GastosPorCheque", Formato)
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
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
GvDocumentosFirma.DataBind()
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")
DescarFormato(DocumentacionFormato)
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
Private Sub CargaVacacionesResumenPeriodoActual()
Dim 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
objRH.Dispose()
GvVacacionesResumen.DataBind()
UpGvVacacionesResumen.Update()
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 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)
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 objRH As New ClsRH()
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
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
If Periodoingreso > PeriodoInicio Then
anio = anio - 1
End If
Dim FechaPeriodo As String = String.Format("{0:dd/MM}/{1}", fechaIngreso, anio)
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
#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 = Server.MapPath("~")
'RutaDocumento = Path.Combine(RutaDocumento, "Empresas\Grales\FormatoDC3.docx")
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) 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) 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)
Dim index As Integer = row.DataItemIndex
Dim rowInfo As DataRow = UniformesInfo.Rows(index)
CveAlmacenUniforme = rowInfo.Item("CveAlmacen").ToString.ToEntero
DescripcionUniforme = rowInfo.Item("CodigoPS").ToString
PU = rowInfo.Item("PU").ToString.ToDecimal
CveUM = rowInfo.Item("CveUM").ToString.ToEntero
CvePS = rowInfo.Item("CvePS").ToString.ToEntero
CveMovimientoUniforme = rowInfo.Item("CveMovimiento").ToString.ToEntero
CveMovimientoDetalleUniforme = rowInfo.Item("CveMovimientoDetalle").ToString.ToEntero
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 ObjInv As New ClsInventarios
Dim ResultadoSalida As Integer = ObjInv.AddMovimiento(CveAlmacenUniforme, 3, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveAlmacenDestino:=CInt(DdlAlmacenDestinoLiberarUniforme.SelectedValue), CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme)
Dim ResultadoEntrada As Integer = ObjInv.AddMovimiento(CInt(DdlAlmacenDestinoLiberarUniforme.SelectedValue), 2, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CvePersonal:=CvePersonal, Observaciones:=DescripcionUniforme, CveMovimientoRelacionado:=CveMovimientoUniforme)
Dim ResultadoDetalleSalida As Boolean = ObjInv.AddMovimientoDetalle(ResultadoSalida, 1.0, CveUM, CvePS, PU, -1, CveMovimientoDetalleEntrada:=CveMovimientoDetalleUniforme)
Dim ResultadoDetalleEntrada As Boolean = ObjInv.AddMovimientoDetalle(ResultadoEntrada, 1.0, CveUM, CvePS, PU, -1)
If ResultadoDetalleSalida And ResultadoDetalleEntrada Then
Alert("Uniforme liberado")
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalUniforme"))
CargaUniformesPersonal()
End If
ObjInv.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();", "ModalArchvivo"))
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 yaExistente As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.jpg", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal)
Dim yaExistentePNG As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.png", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal)
If File.Exists(yaExistente) Then
File.Delete(yaExistente)
ElseIf File.Exists(yaExistentePNG) Then
File.Delete(yaExistentePNG)
End If
If filemove <> "" Then
filemove.FilesMove(CvePersonal.ToString, String.Format("Empresas\{0}\RH\Personal\", UsuarioActual.CveEmpresa))
End If
ViewState("Archivo") = String.Format("{0}.{1}", CvePersonal.ToString, FileExtension)
Next
If File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\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');", "ModalArchvivo"))
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 = String.Format("{0}Empresas/{1}/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)
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 System.IO.FileInfo = New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim params As List(Of ReportParameter) = New List(Of ReportParameter)()
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
'params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri))
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()))
If Imagen.Exists Then
params.Add(New ReportParameter("pImg", logouri))
Else
params.Add(New ReportParameter("pImg", ""))
End If
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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
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) Then
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))
End If
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
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
End Class