1997 lines
83 KiB
VB.net
1997 lines
83 KiB
VB.net
Option Explicit On
|
|
|
|
Imports Extensiones
|
|
Imports System.IO
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class RH_MiPerfil
|
|
Inherits ClsPaginas
|
|
|
|
#Region "PROPIEDADES"
|
|
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 DTConsumos As DataTable
|
|
Get
|
|
Return CType(ViewState("DTConsumos"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTConsumos") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property DTOrganigrama As DataTable
|
|
Get
|
|
Return CType(ViewState("DTOrganigrama"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTOrganigrama") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub CargaEstados(pCvePais As Integer)
|
|
DdlEstados.DataSource = GlobalDTGralEstados("-1", pCvePais)
|
|
DdlEstados.DataBind()
|
|
End Sub
|
|
|
|
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 JefeInmediato As String
|
|
Get
|
|
If ViewState("JefeInmediato") Is Nothing Then
|
|
Return "No asignado"
|
|
Else
|
|
Return ViewState("JefeInmediato").ToString
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("JefeInmediato") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property FechaIngreso As String
|
|
Get
|
|
If ViewState("FechaIngreso") Is Nothing Then
|
|
Return "No asignado"
|
|
Else
|
|
Return ViewState("FechaIngreso").ToString
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("FechaIngreso") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property puestoProp As String
|
|
Get
|
|
If ViewState("puestoProp") Is Nothing Then
|
|
Return "No asignado"
|
|
Else
|
|
Return ViewState("puestoProp").ToString
|
|
End If
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("puestoProp") = 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
|
|
|
|
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
|
|
|
|
#End Region
|
|
|
|
#Region "SOLICITUD VIATICOS"
|
|
Public Property CveSolicitudViatico As Integer
|
|
Get
|
|
Return ViewState("CveSolicitudViatico").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveSolicitudViatico") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveIE As Integer
|
|
Get
|
|
Return ViewState("CveIE").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveIE") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property TotalDepositar As Double
|
|
Get
|
|
Return ViewState("TotalDepositar").ToString.ToDouble
|
|
End Get
|
|
Set(value As Double)
|
|
ViewState("TotalDepositar") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property DTConceptosDetalles As DataTable
|
|
Get
|
|
Return CType(ViewState("DTConceptosDetalles"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTConceptosDetalles") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property ImporteTotal As Double
|
|
Get
|
|
Return ViewState("ImporteTotal").ToString.ToDouble
|
|
End Get
|
|
Set(value As Double)
|
|
ViewState("ImporteTotal") = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
CveSolicitudViatico = -1
|
|
|
|
If Not IsPostBack Then
|
|
ViewState("Orden") = ""
|
|
ViewState("Orden1") = ""
|
|
Session("FileUpload") = ""
|
|
ViewState("Archivo") = ""
|
|
DTConsumos = Nothing
|
|
CargaEstados(1)
|
|
CargaSuperioresOrganigrama()
|
|
CargaPermisosReemplazos()
|
|
CargaConceptos()
|
|
CargaDatosPersonal()
|
|
|
|
Dim clave As Integer = UsuarioActual.CvePersonal
|
|
If clave > 0 Then
|
|
ViewState("CvePersonal") = clave
|
|
CargaDatos()
|
|
CargaPermisos()
|
|
LtlTitulo.Text = "Consulta de Personal:"
|
|
If UsuarioActual.CveRol = 1 Then
|
|
ImgImprimirExpediente.Visible = True
|
|
End If
|
|
|
|
If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then Tab.ActiveTabIndex = Request("Opt").ToEntero - 1
|
|
|
|
Else
|
|
|
|
ViewState("CvePersonal") = -1
|
|
Alert("No se encontro el empleado")
|
|
Response.Redirect("/")
|
|
End If
|
|
|
|
End If
|
|
|
|
If (DdlEstatus.SelectedValue = "1") Then
|
|
GVConceptosImportes.Columns(2).Visible = True
|
|
Else
|
|
GVConceptosImportes.Columns(2).Visible = False
|
|
End If
|
|
UpConceptos.Update()
|
|
AgregarEventosAsincronosGvVacaciones()
|
|
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
|
|
|
|
LtlPersonal.Text = ObjPersonal.NombreCompleto
|
|
TxtAPaterno.Text = ObjPersonal.APaterno
|
|
TxtAMaterno.Text = ObjPersonal.AMaterno
|
|
TxtNombres.Text = ObjPersonal.Nombres
|
|
TxtCorreo.Text = ObjPersonal.Correo
|
|
TxtCodigo.Text = ObjPersonal.Codigo
|
|
TxtFechaNacimiento.Text = ObjPersonal.FechaNacimiento.ToShortDateString
|
|
TxtRFC.Text = ObjPersonal.RFC
|
|
TxtCURP.Text = ObjPersonal.CURP
|
|
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
|
|
FechaIngreso = ObjPersonal.FechaIngreso.ToShortDateString
|
|
|
|
Dim jefeCve As Integer = If(ObjPersonal.CvePersonalPadre = ObjPersonal.CvePersonal, "0", If(ObjPersonal.CvePersonalPadre.ToString = "0", "-1", ObjPersonal.CvePersonalPadre.ToString)).ToEntero
|
|
Dim expressionJefe As String = String.Format("CvePersonal = {0}", jefeCve)
|
|
Dim resultad As DataRow = DTOrganigrama.FiltroPrimero(expressionJefe)
|
|
If (Not IsNothing(resultad)) Then
|
|
JefeInmediato = resultad.Item("NombreCompleto").ToString()
|
|
Else
|
|
JefeInmediato = ""
|
|
End If
|
|
|
|
Dim puestosAux As DataTable = GlobalDTRHPuestos(UsuarioActual.CveEmpresa)
|
|
Dim expressionPuesto As String = String.Format("CvePuesto = {0}", ObjPersonal.CvePuesto.ToString)
|
|
Dim resultadoPuesto As DataRow = puestosAux.FiltroPrimero(expressionPuesto)
|
|
|
|
If (Not IsNothing(resultad)) Then
|
|
puestoProp = resultadoPuesto.Item("Puesto").ToString
|
|
Else
|
|
puestoProp = ""
|
|
End If
|
|
|
|
If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.URL) Then
|
|
ImgPersonal.ImageUrl = $"/Empresas/{UsuarioActual.CveEmpresa}/RH/Personal/{ObjPersonal.URL}"
|
|
End If
|
|
|
|
ViewState("CveEstatusOriginal") = ObjPersonal.CveEstatusPersonal.ToString
|
|
|
|
CargaCastosSinComprobar()
|
|
CargaGastosPorCheque()
|
|
CargaPagoFactura()
|
|
TabVacaciones.Visible = True
|
|
CargaVacacionesResumenPeriodoActual()
|
|
CargaVacaciones()
|
|
|
|
|
|
'If UsuarioActual.CveEmpresa = 7 Or UsuarioActual.CveEmpresa = 72 Then
|
|
|
|
' 'If UsuarioActual.CveEmpresa = 72 Then
|
|
|
|
' ' GvVacacionesResumen.Visible = False
|
|
' ' DvHistorialVacaiones.Visible = False
|
|
' ' FvPerimososVacaciones.Visible = False
|
|
' ' BtnSolicitarVacaciones.Text = "Solicitar"
|
|
' ' DvPermisosMotivos1.Visible = True
|
|
' ' DvPermisosMotivos2.Visible = True
|
|
|
|
' 'End If
|
|
|
|
'Else
|
|
' TabVacaciones.Visible = False
|
|
'End If
|
|
|
|
Else
|
|
Alert("El Personal Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ObjPersonal.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargaSuperioresOrganigrama()
|
|
Dim ObjRH As New ClsRH
|
|
|
|
If ObjRH.GetPersonal(-1, UsuarioActual.CveEmpresa) Then
|
|
DTOrganigrama = ObjRH.DtResultados
|
|
Else
|
|
DTOrganigrama = Nothing
|
|
Alert("Ocurrió un error al cargar el catálogo de Jefes Inmediatos")
|
|
End If
|
|
ObjRH.Dispose()
|
|
|
|
'If DTOrganigrama IsNot Nothing Then
|
|
' DTOrganigrama
|
|
'End If
|
|
|
|
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
|
|
|
|
|
|
Public Sub CargaPermisos()
|
|
|
|
Dim ObjRH As New ClsRH
|
|
|
|
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 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 CargaPermisosReemplazos()
|
|
|
|
Dim ObjRH As New ClsRH
|
|
|
|
If ObjRH.GetPersonal(-1, UsuarioActual.CveEmpresa) Then
|
|
DdlPermisosReemplazo.DataSource = ObjRH.DtResultados
|
|
Else
|
|
DdlPermisosReemplazo.DataSource = Nothing
|
|
End If
|
|
ObjRH.Dispose()
|
|
DdlPermisosReemplazo.DataBind()
|
|
|
|
End Sub
|
|
|
|
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
|
|
|
|
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
|
|
|
|
Private Sub GenerarPDFGastosXComp(Optional Formato As String = "PDF")
|
|
|
|
If RBLTipoGastos.SelectedValue = "1" Then
|
|
|
|
If DTGastosSinComp.Rows.Count > 0 Then
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("Empleado", LtlPersonal.Text.ToString))
|
|
params.Add(New ReportParameter("Saldo", LblSaldoGxC.Text.ToString))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
|
|
ImprimirPDF("Empresas/Grales/Formatos/GastosXComprobarGral.rdlc", DTGastosSinComp, params, "GastosSinComprobarGral", Formato)
|
|
Else
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
ElseIf RBLTipoGastos.SelectedValue = "2" Then
|
|
|
|
If DTGastosPorCheque.Rows.Count > 0 Then
|
|
|
|
For Each Row As DataRow In DTGastosPorCheque.Rows
|
|
Dim FolioPago As String = Row("FolioPago").ToString
|
|
Row("FolioPago") = ""
|
|
If Row("CveCompra").ToString = "" And Row("CveIE").ToString <> "" Then
|
|
Row("FechaVencimiento") = Row("FechaDocumento")
|
|
Row("FolioPago") = FolioPago
|
|
End If
|
|
|
|
If Row("FolioPago").ToString <> "" Then
|
|
Row("SerieFolio") = ""
|
|
End If
|
|
Next
|
|
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("Empleado", LtlPersonal.Text.ToString))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
|
|
ImprimirPDF("Empresas/Grales/Formatos/GastosXComprobarCheque.rdlc", DTGastosPorCheque, params, "GastosPorCheque", Formato)
|
|
Else
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaCastosSinComprobar()
|
|
|
|
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 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
|
|
|
|
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 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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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 JefeInmediatoNombre As String = JefeInmediato
|
|
Dim fechaIngreso As Date = Me.FechaIngreso.ToDate
|
|
Dim Periodoingreso As Integer = Me.FechaIngreso.ToDate().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 = puestoProp
|
|
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()
|
|
|
|
End If
|
|
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))
|
|
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
|
|
|
|
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 JefeInmediatoAux As String = JefeInmediato
|
|
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
|
|
|
|
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
|
|
UpGvPermisos.Update()
|
|
End If
|
|
|
|
ObjRH.Dispose()
|
|
|
|
CargaPermisos()
|
|
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)
|
|
'Alert(VacCveSupervisor.ToString + "aquí esta el cero que aparece")
|
|
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
|
|
Dim CorreoSupervisor As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa, DdlSupervisor.SelectedValue.ToEntero).FiltroPrimeroValor("Correo")
|
|
objRH.Dispose()
|
|
If continuar Then
|
|
CargaVacaciones()
|
|
CargaVacacionesResumenPeriodoActual()
|
|
VacacionesMandaCorreoSupervisor("Vacaciones " & UsuarioActual.Nombre, CorreoSupervisor, VacSupervisorNombre, NombreCompleto, fInicio, fFin, "vacaciones")
|
|
RegistraScript("$('#ModalAddVacaciones').modal('hide');")
|
|
End If
|
|
Else
|
|
|
|
Alert("La fecha Inicial debe ser inferior a la fecha final.", TipoMensaje.MsgAdvertencia)
|
|
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, VacacionServicio As String)
|
|
|
|
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 = String.Format("el presente correo es para informarle que el <a href='localhost/RH/Personal.aspx?CvePersonal={0}'>empleado {1}</a> realizo una solicitud de {2} para los dias del '{3}' al '{4}'.", UsuarioActual.CvePersonal, NombreSolicitante, VacacionServicio, _FechaInicio.ToString("dd/mm/yy"), _FechaFin.ToString("dd/mm/yy"))
|
|
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
|
|
|
|
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
|
|
|
|
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)
|
|
Dim Motivo As String = TxtMotivoPermiso.Text
|
|
|
|
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, Motivo:=Motivo) Then
|
|
If CvePermiso = -1 Then
|
|
Alert("Permiso agregado correctamente")
|
|
Else
|
|
Alert("Permiso agregado Actualizado correctamente")
|
|
End If
|
|
Dim CorreoSupervisor As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa, DdlSupervisor.SelectedValue.ToEntero).FiltroPrimeroValor("Correo")
|
|
VacacionesMandaCorreoSupervisor("Permiso para " & UsuarioActual.Nombre, CorreoSupervisor, VacSupervisorNombre, NombreCompleto, TxtFechaInicioPer.Text.ToDate, TxtFechaFinPer.Text.ToDate, "permiso")
|
|
RegistraScript("$('#DvPermisos').modal('hide');")
|
|
|
|
End If
|
|
|
|
ObjRH.Dispose()
|
|
CargaPermisos()
|
|
|
|
End Sub
|
|
|
|
#Region "Solicitud Viaticos"
|
|
Protected Sub CargaDatosPersonal()
|
|
Dim PuedeSolicitar As Boolean = True
|
|
'CARGA DDLS
|
|
DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
|
|
DdlPersonal.DataBind()
|
|
|
|
DdlDepartamento.DataSource = GlobalDTDepartamentos(UsuarioActual.CveEmpresa)
|
|
DdlDepartamento.DataBind()
|
|
|
|
DdlSupervisor.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
|
|
DdlSupervisor.DataBind()
|
|
|
|
'SELECCIONA PERSONAL, DEPARTAMETO Y SUPERVISOR SI ESTAN ASIGNADOS
|
|
If (UsuarioActual.CvePersonal > 0) Then
|
|
|
|
DdlPersonal.SelectedValueExist(UsuarioActual.CvePersonal)
|
|
|
|
Else
|
|
|
|
PuedeSolicitar = False
|
|
End If
|
|
|
|
If (GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonalPadre", String.Format("CvePersonal={0}", UsuarioActual.CvePersonal)).ToEntero() > 0) Then
|
|
|
|
DdlSupervisor.SelectedValueExist(GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePersonalPadre", String.Format("CvePersonal={0}", UsuarioActual.CvePersonal)).ToEntero())
|
|
|
|
Else
|
|
|
|
PuedeSolicitar = False
|
|
End If
|
|
|
|
If (GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveDepartamento", String.Format("CvePersonal={0}", UsuarioActual.CvePersonal)).ToEntero() > 0) Then
|
|
|
|
DdlDepartamento.SelectedValueExist(GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveDepartamento", String.Format("CvePersonal={0}", UsuarioActual.CvePersonal)).ToEntero())
|
|
End If
|
|
|
|
DdlPersonal.Enabled = False
|
|
DdlSupervisor.Enabled = False
|
|
DdlDepartamento.Enabled = False
|
|
DdlEstatus.Enabled = False
|
|
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
CargaDatosSV()
|
|
|
|
Else
|
|
|
|
If ((UsuarioActual.CveEmpresa = 72 Or UsuarioActual.CveEmpresa = 1 Or UsuarioActual.CveEmpresa = 2) And UsuarioActual.CvePersonal > 0) Then
|
|
|
|
CargaFolio()
|
|
End If
|
|
|
|
BtnGuardar.Text = "Guardar"
|
|
'LnkImprimirExcel.Visible = False
|
|
'LnkImprimirPDF.Visible = False
|
|
'LnkIE.Visible = False
|
|
LblFecha.InnerText = ""
|
|
CreaDTConceptosDetalles()
|
|
End If
|
|
|
|
If (Not PuedeSolicitar And CveSolicitudViatico = -1) Then
|
|
|
|
Alert("No puede realizar una Solicitud de Viaticos ya que no esta registrado como Personal, no se le ha asigando un Supervisor o un Departamento. Pongase en contacto con Soporte Técnico.", ModExtensiones.TipoMensaje.MsgError)
|
|
DdlPersonal.SelectedValue = "-1"
|
|
DdlSupervisor.SelectedValue = "-1"
|
|
DdlDepartamento.SelectedValue = "-1"
|
|
'LbAgregar.Enabled = False;
|
|
BtnGuardar.Enabled = False
|
|
BtnNuevo.Enabled = False
|
|
End If
|
|
|
|
'UpAcciones.Update();
|
|
UpSolicitud.Update()
|
|
End Sub
|
|
|
|
Protected Sub LnkImprimirPDF_Click(ByVal sender As Object, ByVal e As EventArgs)
|
|
GenerarPDF("PDF")
|
|
End Sub
|
|
|
|
Protected Sub CargaDatosSV()
|
|
Dim ObjBancos As New ClsBancos()
|
|
|
|
If (ObjBancos.GetSolicitudesViaticos(CveSolicitudViatico, UsuarioActual.CveEmpresa)) Then
|
|
|
|
If (ObjBancos.DtResultados.Rows.Count > 0) Then
|
|
|
|
If (UsuarioActual.TienePermisoProceso(241) Or UsuarioActual.CvePersonal = ObjBancos.DtResultados.FiltroPrimeroValor("CvePersonal").ToEntero()) Then
|
|
CveIE = If(ObjBancos.DtResultados.FiltroPrimeroValor("CveIE").ToEntero() > 0, ObjBancos.DtResultados.FiltroPrimeroValor("CveIE").ToEntero(), -1)
|
|
TotalDepositar = If(ObjBancos.DtResultados.FiltroPrimeroValor("TotalADepositar").ToDouble() > 0, ObjBancos.DtResultados.FiltroPrimeroValor("TotalADepositar").ToDouble(), -1)
|
|
|
|
'LnkImprimirPDF.Visible = True
|
|
'LnkImprimirExcel.Visible = False;
|
|
'LnkIE.Visible = True;
|
|
|
|
'If (CveIE > 0) Then
|
|
' LnkIE.Text = "<i class=\"fa fa-money\"></i> <span style=\"padding - left:5px; \">Ver Total a Depositar</span>";
|
|
'End If
|
|
|
|
TxtFolio.Enabled = False
|
|
TxtFolio.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Folio")
|
|
|
|
DdlPersonal.SelectedValueExist(ObjBancos.DtResultados.FiltroPrimeroValor("CvePersonal"))
|
|
DdlDepartamento.SelectedValueExist(ObjBancos.DtResultados.FiltroPrimeroValor("CveDepartamento"))
|
|
DdlSupervisor.SelectedValueExist(ObjBancos.DtResultados.FiltroPrimeroValor("CveSupervisor"))
|
|
|
|
TxtDestino.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Destino")
|
|
TxtAsunto.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Asunto")
|
|
TxtFechaSalida.Text = ObjBancos.DtResultados.FiltroPrimeroValor("FechaSalida")
|
|
TxtFechaRegreso.Text = ObjBancos.DtResultados.FiltroPrimeroValor("FechaRegreso")
|
|
TxtTipoCarro.Text = ObjBancos.DtResultados.FiltroPrimeroValor("TipoCarro")
|
|
TxtKM.Text = ObjBancos.DtResultados.FiltroPrimeroValor("KM")
|
|
|
|
DdlEstatus.SelectedValueExist(ObjBancos.DtResultados.FiltroPrimeroValor("CveEstatus"))
|
|
|
|
TxtMotivo.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Observaciones")
|
|
|
|
If (DdlEstatus.SelectedValue.Contiene("2", "4")) Then
|
|
DivMotivo.Visible = True
|
|
TxtMotivo.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Observaciones")
|
|
End If
|
|
|
|
LblFecha.InnerHtml = String.Format("<b>Fecha Registro:</b> {0:g}", ObjBancos.DtResultados.FiltroPrimeroValor("FechaIng"))
|
|
|
|
BtnEliminar.Visible = True
|
|
BtnGuardar.Text = "Actualizar"
|
|
|
|
CargaDetalles(ObjBancos)
|
|
|
|
Else
|
|
CveSolicitudViatico = -1
|
|
Alert("No tiene permisos para acceder a esta Solicitud.", ModExtensiones.TipoMensaje.MsgError)
|
|
CreaDTConceptosDetalles()
|
|
CargaFolio()
|
|
End If
|
|
|
|
Else
|
|
CveSolicitudViatico = -1
|
|
Alert("La Solicitud de Viáticos solicitada no existe.", ModExtensiones.TipoMensaje.MsgError)
|
|
CreaDTConceptosDetalles()
|
|
End If
|
|
End If
|
|
ObjBancos.Dispose()
|
|
End Sub
|
|
|
|
Protected Sub CargaConceptos()
|
|
Dim ObjBancos As New ClsBancos()
|
|
If (ObjBancos.GetConceptosViaticos(UsuarioActual.CveEmpresa, 1)) Then
|
|
|
|
DdlConceptoViatico.DataSource = ObjBancos.DtResultados
|
|
DdlConceptoViatico.DataBind()
|
|
End If
|
|
ObjBancos.Dispose()
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Protected Sub CargaFolio()
|
|
Dim CveSubProyectoPersonal As Integer = GetCveSubproyecto()
|
|
|
|
If (CveSubProyectoPersonal > 0) Then
|
|
Dim ObjBancos As New ClsBancos()
|
|
|
|
Dim Serie As String = GlobalDTSubProyectos(-1, CveSubProyectoPersonal, UsuarioActual.CveEmpresa).FiltroPrimeroValor("Serie")
|
|
|
|
If (ObjBancos.GetNextFolioSolicitudViaticos(UsuarioActual.CveEmpresa, String.Format("{0}-", Serie))) Then
|
|
TxtFolio.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Folio")
|
|
TxtFolio.Enabled = False
|
|
End If
|
|
ObjBancos.Dispose()
|
|
End If
|
|
End Sub
|
|
Protected Sub DdlEstatus_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
If (DdlEstatus.SelectedValue.Contiene("2", "4")) Then
|
|
DivMotivo.Visible = True
|
|
Else
|
|
DivMotivo.Visible = False
|
|
TxtMotivo.Text = ""
|
|
End If
|
|
UpSolicitud.Update()
|
|
End Sub
|
|
|
|
Protected Function GetCveSubproyecto() As Integer
|
|
Dim ObjRH As New ClsRH()
|
|
|
|
Dim CveSubProyecto As Integer = -1
|
|
|
|
If (ObjRH.GetPersonal(UsuarioActual.CvePersonal, UsuarioActual.CveEmpresa)) Then
|
|
CveSubProyecto = ObjRH.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToEntero()
|
|
End If
|
|
|
|
|
|
ObjRH.Dispose()
|
|
Return CveSubProyecto
|
|
End Function
|
|
|
|
Protected Sub CargaDetalles(ObjBancos As ClsBancos)
|
|
If (ObjBancos.GetSolicitudesViaticosDetalle(CveSolicitudViatico, -1)) Then
|
|
|
|
DTConceptosDetalles = ObjBancos.DtResultados
|
|
CargaGVConceptosImportes(DTConceptosDetalles)
|
|
|
|
ImporteTotal = DTConceptosDetalles.SUM("Importe")
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub CargaGVConceptosImportes(DtTemp As DataTable)
|
|
GVConceptosImportes.DataSource = DtTemp
|
|
GVConceptosImportes.DataBind()
|
|
End Sub
|
|
|
|
Protected Sub CreaDTConceptosDetalles()
|
|
Dim dt As New DataTable()
|
|
|
|
'USAMOS CveSolicitudViaticoDetalle COMO CVETEMPORAL
|
|
Dim Column As New DataColumn("CveSolicitudViaticoDetalle")
|
|
Column.DataType = Type.GetType("System.Int32")
|
|
With Column
|
|
.AutoIncrement = True
|
|
.AutoIncrementSeed = 1
|
|
.AutoIncrementStep = 1
|
|
End With
|
|
|
|
dt.Columns.Add(Column)
|
|
|
|
dt.Columns.Add("CveSolicitudViatico", Type.GetType("System.Int32"))
|
|
dt.Columns.Add("CveConceptoViatico", Type.GetType("System.Int32"))
|
|
|
|
dt.Columns.Add("ConceptoViatico")
|
|
|
|
dt.Columns.Add("Importe", Type.GetType("System.Double"))
|
|
|
|
CargaGVConceptosImportes(dt)
|
|
|
|
DTConceptosDetalles = dt
|
|
End Sub
|
|
|
|
Protected Sub GVConceptosImportes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If (e.Row.RowType = DataControlRowType.Footer) Then
|
|
e.Row.FCLiteral("LtTotalImporte").Text = DTConceptosDetalles.SUM("Importe").FormatoNumero()
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GVConceptosImportes_RowEditing(sender As Object, e As GridViewEditEventArgs)
|
|
GVConceptosImportes.EditIndex = e.NewEditIndex
|
|
CargaGVConceptosImportes(DTConceptosDetalles)
|
|
End Sub
|
|
|
|
Protected Sub GVConceptosImportes_RowDeleting(sender As Object, e As GridViewDeleteEventArgs)
|
|
Dim ErrorEliminar As Boolean = True
|
|
|
|
Dim CveSolicitudViaticoDetalle As Integer = GVConceptosImportes.Rows(e.RowIndex).DataKey("CveSolicitudViaticoDetalle").ToEntero()
|
|
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
Dim ObjBancos As New ClsBancos()
|
|
If (ObjBancos.RemoveSolicitudesViaticosDetalle(CveSolicitudViaticoDetalle, -1)) Then
|
|
Alert("El Detalle del Viático fue Eliminido Correctamente.", ModExtensiones.TipoMensaje.MsgInformacion)
|
|
CargaDetalles(ObjBancos)
|
|
|
|
ObjBancos.Dispose()
|
|
End If
|
|
Else
|
|
|
|
For Each RowConcepto As DataRow In DTConceptosDetalles.Rows
|
|
Dim CveSolicitudVD As Integer = RowConcepto("CveSolicitudViaticoDetalle").ToString.ToEntero
|
|
If (RowConcepto("CveSolicitudViaticoDetalle").ToString.ToEntero() = CveSolicitudViaticoDetalle) Then
|
|
|
|
DTConceptosDetalles.Rows.Remove(RowConcepto)
|
|
ErrorEliminar = False
|
|
Alert("El Detalle del Viático fue Eliminido Correctamente.", ModExtensiones.TipoMensaje.MsgInformacion)
|
|
CargaGVConceptosImportes(DTConceptosDetalles)
|
|
GoTo end_of_for
|
|
End If
|
|
Next
|
|
end_of_for:
|
|
If (ErrorEliminar) Then
|
|
Alert("Ocurrio un error al eliminar el Detalle del Viático.", ModExtensiones.TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GVConceptosImportes_RowUpdating(sender As Object, e As GridViewUpdateEventArgs)
|
|
Dim Importe As Double = GVConceptosImportes.Rows(e.RowIndex).FCTextBox("TxtImporteE").Text.ToDouble()
|
|
Dim CveDetalle As Integer = GVConceptosImportes.Rows(e.RowIndex).DataKey("CveSolicitudViaticoDetalle").ToEntero()
|
|
Dim CveConcepto As Integer = GVConceptosImportes.Rows(e.RowIndex).DataKey("CveConceptoViatico").ToEntero()
|
|
|
|
GVConceptosImportes.EditIndex = -1
|
|
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
Dim ObjBancos As New ClsBancos()
|
|
If (ObjBancos.UpdateSolicitudesViaticosDetalle(CveDetalle, CveConcepto, Importe)) Then
|
|
|
|
Alert("El Detalle del Viático fue Actualizado Correctamente.", ModExtensiones.TipoMensaje.MsgInformacion)
|
|
CargaDetalles(ObjBancos)
|
|
End If
|
|
ObjBancos.Dispose()
|
|
|
|
Else
|
|
Dim RowUpp As DataRow = DTConceptosDetalles.Select(String.Format("CveSolicitudViaticoDetalle = {0}", CveDetalle))(0)
|
|
|
|
If (RowUpp.Table.Rows.Count > 0) Then
|
|
RowUpp("Importe") = Importe
|
|
DTConceptosDetalles.AcceptChanges()
|
|
End If
|
|
CargaGVConceptosImportes(DTConceptosDetalles)
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GVConceptosImportes_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs)
|
|
GVConceptosImportes.EditIndex = -1
|
|
CargaGVConceptosImportes(DTConceptosDetalles)
|
|
End Sub
|
|
|
|
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
|
Dim ErrorGuardar As Boolean = False
|
|
Dim ErrorEditar As Boolean = False
|
|
Dim EsEditar As Boolean = False
|
|
|
|
If (DTConceptosDetalles.Rows.Count > 0) Then
|
|
|
|
If (TxtFolio.Text = "") Then
|
|
|
|
Alert("El Campo Folio es necesario.", ModExtensiones.TipoMensaje.MsgAdvertencia)
|
|
Return
|
|
End If
|
|
|
|
Dim ObjBancos As New ClsBancos()
|
|
|
|
ObjBancos.IniciaTransacSQL()
|
|
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
'EDITA SOLICITUDES
|
|
EsEditar = True
|
|
ErrorEditar = ObjBancos.UpdateSolicitudesViaticos(CveSolicitudViatico, DdlEstatus.SelectedValue.ToEntero(), TxtDestino.Text, TxtAsunto.Text, TxtFechaSalida.Text, TxtFechaRegreso.Text, If(TxtMotivo.Text = "", "-1", TxtMotivo.Text), TipoCarro:=TxtTipoCarro.Text, KM:=TxtKM.Text)
|
|
|
|
Else
|
|
|
|
'GUARDA SOLICITUDES NUEVAS
|
|
CveSolicitudViatico = ObjBancos.AddSolicitudesViaticos(TxtFolio.Text, DdlEstatus.SelectedValue.ToEntero(), DdlPersonal.SelectedValue.ToEntero(), TxtDestino.Text, TxtAsunto.Text, TxtFechaSalida.Text, TxtFechaRegreso.Text, DateTime.Now, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TipoCarro:=TxtTipoCarro.Text, KM:=TxtKM.Text)
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
For Each RowConcepto As DataRow In DTConceptosDetalles.Rows
|
|
|
|
If (Not ObjBancos.AddSolicitudesViaticosDetalle(CveSolicitudViatico, RowConcepto("CveConceptoViatico").ToString().ToEntero(), RowConcepto("Importe").ToString().ToEntero())) Then
|
|
|
|
ErrorGuardar = True
|
|
End If
|
|
Next
|
|
If (Not ErrorGuardar) Then
|
|
Dim Mensaje As New StringBuilder()
|
|
Mensaje.AppendLine(String.Format("La Solicitud de Viáticos con Folio <b>{0}</b> se guardo correctamente.", TxtFolio.Text))
|
|
|
|
BtnEliminar.Visible = True
|
|
|
|
Dim Destinatario As String = ""
|
|
If (UsuarioActual.CveEmpresa.Contiene(72)) Then
|
|
|
|
Destinatario = "recursoshumanos@compuproveedores.com"
|
|
End If
|
|
If Destinatario.Length > 0 AndAlso (EnviarCorreoNuevaSolicitud(Destinatario)) Then
|
|
|
|
Mensaje.AppendLine(String.Format("<br /><br />Se ha notificado al correo <b>{0}</b>", Destinatario))
|
|
End If
|
|
Alert(Mensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
Else
|
|
|
|
ErrorGuardar = True
|
|
End If
|
|
End If
|
|
|
|
If (ErrorGuardar) Then
|
|
|
|
ObjBancos.RollBack()
|
|
|
|
Else
|
|
|
|
ObjBancos.Commit()
|
|
End If
|
|
|
|
ObjBancos.Dispose()
|
|
|
|
'NOTIFICACION Y CORREO DEL UPDATE
|
|
If (EsEditar And ErrorEditar) Then
|
|
|
|
Dim Mensaje As New StringBuilder()
|
|
|
|
Mensaje.AppendLine("La Solicitud de Viáticos fue Actualizada Correctamente.")
|
|
|
|
If (DdlEstatus.SelectedValue.Contiene("2", "3", "4")) Then
|
|
|
|
If (EnviarCorreoSolicitante()) Then
|
|
|
|
Dim DestinatarioCorreo As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Correo", String.Format("CvePersonal={0}", DdlPersonal.SelectedValue.ToEntero()))
|
|
Mensaje.AppendLine(String.Format("<br /><br />Se ha notificado al correo <b>{0}</b>", DestinatarioCorreo))
|
|
|
|
Else
|
|
|
|
Mensaje.AppendLine(String.Format("<br /><br />Ocurrio un error al notificar al Solicitante."))
|
|
End If
|
|
End If
|
|
|
|
Alert(Mensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
If (Not ErrorGuardar) Then
|
|
|
|
CargaDatosPersonal()
|
|
End If
|
|
|
|
Else
|
|
|
|
Alert("No hay ningun registro de Concepto Viático para generar la solicitud. Por favor rectifique y vuelva a intentar.", ModExtensiones.TipoMensaje.MsgError)
|
|
End If
|
|
End Sub
|
|
|
|
Protected Function EnviarCorreoNuevaSolicitud(Destinatario As String) As Boolean
|
|
Dim Correo As New ClsSisMail()
|
|
Dim Asunto As String = String.Format("{0} Nueva Solicitud de Viáticos: {1}", UsuarioActual.Empresa.NombreCorto, TxtFolio.Text)
|
|
Dim Cuerpo As New StringBuilder()
|
|
|
|
Dim MensajeEnviado As Boolean = False
|
|
|
|
' CORREO A USUARIO DENNISE CRUZ - RH
|
|
Cuerpo.AppendLine(String.Format("Se le informa que ha recibido una nueva Solicitud de Viáticos con folio <b>{2}</b> por parte del Personal {0} del Departamento de {1}.<br><br> Para mayor informacion consulte el módulo de <a href=""http: //sig.adssistemas.mx/RH/ReporteViaticos.aspx"">Solicitud de Viáticos</a>.", UsuarioActual.Nombre.ToUpper(), DdlDepartamento.SelectedItem, TxtFolio.Text))
|
|
|
|
If (UsuarioActual.CveEmpresa.Contiene(72, 1, 2)) Then
|
|
|
|
|
|
If Destinatario.Length > 0 AndAlso (Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString())) Then
|
|
|
|
MensajeEnviado = True
|
|
|
|
Else
|
|
|
|
MensajeEnviado = False
|
|
End If
|
|
End If
|
|
|
|
Return MensajeEnviado
|
|
End Function
|
|
|
|
Protected Function EnviarCorreoSolicitante() As Boolean
|
|
Dim Correo As New ClsSisMail()
|
|
Dim Asunto As String = String.Format("{0} Actualización de Solicitud de Viaticos {1}", UsuarioActual.Empresa.NombreCorto, TxtFolio.Text)
|
|
Dim Cuerpo As New StringBuilder()
|
|
'List<ClsSisMail.ArchivoMail> LSRutasMail = new List<ClsSisMail.ArchivoMail>();
|
|
Dim LSRutasMail = New List(Of ClsSisMail.ArchivoMail)
|
|
|
|
Dim MensajeEnviado As Boolean = False
|
|
|
|
Dim ErrorArchivo As Boolean = False
|
|
|
|
' CORREO A SOLICITANTE
|
|
Dim DestinatarioNombre As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Nombre", String.Format("CvePersonal={0}", DdlPersonal.SelectedValue.ToEntero())).ToUpper()
|
|
Cuerpo.AppendLine(String.Format("Estimado {0},<br><br> se le informa que la Solicitud de Viáticos con folio <b>{1}</b> ha sido {2}", DestinatarioNombre, TxtFolio.Text, DdlEstatus.SelectedItem))
|
|
|
|
If (DdlEstatus.SelectedValue.Contiene("2", "4")) Then
|
|
|
|
Cuerpo.AppendLine(String.Format(" con motivo: {0}.", TxtMotivo.Text))
|
|
|
|
ElseIf (DdlEstatus.SelectedValue.Contiene("3")) Then
|
|
|
|
Cuerpo.AppendLine(String.Format(". Descargue el siguiente archivo para continuar con el proceso.<br><br>"))
|
|
|
|
Dim Archivo As New ClsSisMail.ArchivoMail()
|
|
Archivo.ArchivoBinario = GenerarPDF("PDF", False)
|
|
Archivo.NombreArchivo = String.Format("Solicitud de Viaticos - {0} - {1}.pdf", TxtFolio.Text, DdlPersonal.SelectedItem)
|
|
LSRutasMail.Add(Archivo)
|
|
|
|
If (Archivo.ArchivoBinario Is Nothing) Then
|
|
|
|
ErrorArchivo = True
|
|
End If
|
|
End If
|
|
|
|
If (UsuarioActual.CveEmpresa.Contiene(72, 1, 2)) Then
|
|
|
|
Dim DestinatarioCorreo As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Correo", String.Format("CvePersonal={0}", DdlPersonal.SelectedValue.ToEntero()))
|
|
|
|
If (Not ErrorArchivo And Correo.SendMail(UsuarioActual.Empresa, DestinatarioCorreo, Asunto, Cuerpo.ToString(), Archivos:=LSRutasMail)) Then
|
|
|
|
MensajeEnviado = True
|
|
|
|
Else
|
|
|
|
MensajeEnviado = False
|
|
End If
|
|
End If
|
|
|
|
Return MensajeEnviado
|
|
End Function
|
|
|
|
Private Function GenerarPDF(Optional Formato As String = "PDF", Optional DesgargaArchivo As Boolean = True) As Byte()
|
|
Dim retorno As Byte() = Nothing
|
|
If (UsuarioActual.CveEmpresa = 1 And UsuarioActual.CveEmpresa = 2 And UsuarioActual.CveEmpresa = 72) Then
|
|
|
|
'List<ReportParameter> @params = new List<ReportParameter>();
|
|
Dim params As New List(Of ReportParameter)
|
|
Dim ObjBancos As New ClsBancos()
|
|
|
|
If (ObjBancos.GetSolicitudesViaticos(CveSolicitudViatico, UsuarioActual.CveEmpresa) And ObjBancos.DtResultados.Rows.Count > 0) Then
|
|
|
|
params.Add(New ReportParameter("FolioViatico", ObjBancos.DtResultados.FiltroPrimeroValor("Folio")))
|
|
params.Add(New ReportParameter("FechaRegistro", ObjBancos.DtResultados.FiltroPrimeroValor("FechaIng")))
|
|
|
|
params.Add(New ReportParameter("FechaSalida", Convert.ToDateTime(ObjBancos.DtResultados.FiltroPrimeroValor("FechaSalida")).ToShortDateString()))
|
|
params.Add(New ReportParameter("FechaRegreso", Convert.ToDateTime(ObjBancos.DtResultados.FiltroPrimeroValor("FechaRegreso")).ToShortDateString()))
|
|
params.Add(New ReportParameter("NombreSolicitante", ObjBancos.DtResultados.FiltroPrimeroValor("NombrePersonal")))
|
|
params.Add(New ReportParameter("Departamento", ObjBancos.DtResultados.FiltroPrimeroValor("DepartamentoSolicitante")))
|
|
params.Add(New ReportParameter("SupervisorDirecto", ObjBancos.DtResultados.FiltroPrimeroValor("NombreSupervisor")))
|
|
params.Add(New ReportParameter("Destino", ObjBancos.DtResultados.FiltroPrimeroValor("Destino")))
|
|
params.Add(New ReportParameter("Asunto", ObjBancos.DtResultados.FiltroPrimeroValor("Asunto")))
|
|
params.Add(New ReportParameter("TipoCarro", ObjBancos.DtResultados.FiltroPrimeroValor("TipoCarro")))
|
|
params.Add(New ReportParameter("KM", ObjBancos.DtResultados.FiltroPrimeroValor("KM")))
|
|
params.Add(New ReportParameter("FirmaRH", ""))
|
|
params.Add(New ReportParameter("FirmaFinanzas", ""))
|
|
|
|
params.Add(New ReportParameter("ImporteTotal", ImporteTotal.ToString()))
|
|
params.Add(New ReportParameter("ImporteLetra", ImporteTotal.Texto2Letras()))
|
|
|
|
params.Add(New ReportParameter("DireccionSolicitante", ObjBancos.DtResultados.FiltroPrimeroValor("DireccionPersonal")))
|
|
params.Add(New ReportParameter("CiudadSolicitante", ObjBancos.DtResultados.FiltroPrimeroValor("CiudadPersonal")))
|
|
params.Add(New ReportParameter("TelefonoSolicitante", ObjBancos.DtResultados.FiltroPrimeroValor("TelefonoPersonal")))
|
|
|
|
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString()))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
|
|
params.Add(New ReportParameter("TotalADepositar", If(ObjBancos.DtResultados.FiltroPrimeroValor("TotalADepositar").ToDouble() > 0, ObjBancos.DtResultados.FiltroPrimeroValor("TotalADepositar"), "0").ToString()))
|
|
|
|
Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
|
|
If (Imagen.Exists) Then
|
|
|
|
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
|
|
|
|
Else
|
|
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
|
|
|
|
If (DesgargaArchivo) Then
|
|
|
|
ImprimirPDF("Empresas/72/Formatos/SolicitudViaticos.rdlc", DTConceptosDetalles, params, String.Format("Solicitud de Viáticos - {0} - {1}", TxtFolio.Text, DdlPersonal.SelectedItem), Formato)
|
|
|
|
Else
|
|
|
|
retorno = StreamPDF("Empresas/72/Formatos/SolicitudViaticos.rdlc", DTConceptosDetalles, params, String.Format("Solicitud de Viáticos - {0} - {1}", TxtFolio.Text, DdlPersonal.SelectedItem), Formato)
|
|
End If
|
|
|
|
Else
|
|
|
|
Alert("Ocurrio un error al gerneral el reporte.", ModExtensiones.TipoMensaje.MsgError)
|
|
End If
|
|
ObjBancos.Dispose()
|
|
End If
|
|
|
|
Return retorno
|
|
End Function
|
|
|
|
Protected Sub BtnGuardar_ClickSV(sender As Object, e As EventArgs)
|
|
Dim ErrorGuardar As Boolean = False
|
|
Dim ErrorEditar As Boolean = False
|
|
Dim EsEditar As Boolean = False
|
|
|
|
If (DTConceptosDetalles.Rows.Count > 0) Then
|
|
|
|
If (TxtFolio.Text = "") Then
|
|
|
|
Alert("El Campo Folio es necesario.", ModExtensiones.TipoMensaje.MsgAdvertencia)
|
|
Return
|
|
End If
|
|
|
|
Dim ObjBancos As New ClsBancos()
|
|
|
|
ObjBancos.IniciaTransacSQL()
|
|
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
'EDITA SOLICITUDES
|
|
EsEditar = True
|
|
ErrorEditar = ObjBancos.UpdateSolicitudesViaticos(CveSolicitudViatico, DdlEstatus.SelectedValue.ToEntero(), TxtDestino.Text, TxtAsunto.Text, TxtFechaSalida.Text, TxtFechaRegreso.Text, If(TxtMotivo.Text = "", "-1", TxtMotivo.Text), TipoCarro:=TxtTipoCarro.Text, KM:=TxtKM.Text)
|
|
|
|
Else
|
|
|
|
'GUARDA SOLICITUDES NUEVAS
|
|
CveSolicitudViatico = ObjBancos.AddSolicitudesViaticos(TxtFolio.Text, DdlEstatus.SelectedValue.ToEntero(), DdlPersonal.SelectedValue.ToEntero(), TxtDestino.Text, TxtAsunto.Text, TxtFechaSalida.Text, TxtFechaRegreso.Text, DateTime.Now, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TipoCarro:=TxtTipoCarro.Text, KM:=TxtKM.Text)
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
For Each RowConcepto As DataRow In DTConceptosDetalles.Rows
|
|
|
|
If (Not ObjBancos.AddSolicitudesViaticosDetalle(CveSolicitudViatico, RowConcepto("CveConceptoViatico").ToString().ToEntero(), RowConcepto("Importe").ToString().ToEntero())) Then
|
|
|
|
ErrorGuardar = True
|
|
End If
|
|
Next
|
|
If (Not ErrorGuardar) Then
|
|
|
|
Dim Mensaje As New StringBuilder()
|
|
Mensaje.AppendLine(String.Format("La Solicitud de Viáticos con Folio <b>{0}</b> se guardo correctamente.", TxtFolio.Text))
|
|
|
|
BtnEliminar.Visible = True
|
|
|
|
Dim Destinatario As String = ""
|
|
If (UsuarioActual.CveEmpresa.Contiene(72)) Then
|
|
|
|
Destinatario = "recursoshumanos@compuproveedores.com"
|
|
End If
|
|
If Destinatario.Length > 0 AndAlso (EnviarCorreoNuevaSolicitud(Destinatario)) Then
|
|
Mensaje.AppendLine(String.Format("<br /><br />Se ha notificado al correo <b>{0}</b>", Destinatario))
|
|
End If
|
|
Alert(Mensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
Else
|
|
|
|
ErrorGuardar = True
|
|
End If
|
|
End If
|
|
|
|
If (ErrorGuardar) Then
|
|
|
|
ObjBancos.RollBack()
|
|
|
|
Else
|
|
|
|
ObjBancos.Commit()
|
|
End If
|
|
|
|
ObjBancos.Dispose()
|
|
|
|
'NOTIFICACION Y CORREO DEL UPDATE
|
|
If (EsEditar And ErrorEditar) Then
|
|
|
|
Dim Mensaje As New StringBuilder()
|
|
|
|
Mensaje.AppendLine("La Solicitud de Viáticos fue Actualizada Correctamente.")
|
|
|
|
If (DdlEstatus.SelectedValue.Contiene("2", "3", "4")) Then
|
|
|
|
If (EnviarCorreoSolicitante()) Then
|
|
|
|
Dim DestinatarioCorreo As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Correo", String.Format("CvePersonal={0}", DdlPersonal.SelectedValue.ToEntero()))
|
|
Mensaje.AppendLine(String.Format("<br /><br />Se ha notificado al correo <b>{0}</b>", DestinatarioCorreo))
|
|
|
|
Else
|
|
|
|
Mensaje.AppendLine(String.Format("<br /><br />Ocurrio un error al notificar al Solicitante."))
|
|
End If
|
|
End If
|
|
|
|
Alert(Mensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
If (Not ErrorGuardar) Then
|
|
|
|
CargaDatosPersonal()
|
|
End If
|
|
|
|
Else
|
|
|
|
Alert("No hay ningun registro de Concepto Viático para generar la solicitud. Por favor rectifique y vuelva a intentar.", ModExtensiones.TipoMensaje.MsgError)
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs)
|
|
Dim ObjBancos As New ClsBancos()
|
|
|
|
ObjBancos.IniciaTransacSQL()
|
|
|
|
If (CveSolicitudViatico > 0 And ObjBancos.RemoveSolicitudesViaticosDetalle(-1, CveSolicitudViatico)) Then
|
|
|
|
If (ObjBancos.RemoveSolicitudesViaticos(CveSolicitudViatico)) Then
|
|
|
|
Alert("La Solicitud de Viáticos fue Eliminada.", ModExtensiones.TipoMensaje.MsgInformacion)
|
|
ObjBancos.Commit()
|
|
CveSolicitudViatico = -1
|
|
|
|
Else
|
|
|
|
ObjBancos.RollBack()
|
|
End If
|
|
|
|
Else
|
|
|
|
ObjBancos.RollBack()
|
|
End If
|
|
ObjBancos.Dispose()
|
|
|
|
If (CveSolicitudViatico = -1) Then
|
|
|
|
CargaDatosPersonal()
|
|
LimpiaSolicitud()
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub LimpiaSolicitud()
|
|
TxtFolio.Text = ""
|
|
TxtDestino.Text = ""
|
|
TxtAsunto.Text = ""
|
|
TxtFechaSalida.Text = ""
|
|
TxtFechaRegreso.Text = ""
|
|
|
|
TxtFolio.Enabled = True
|
|
BtnEliminar.Visible = False
|
|
|
|
DdlEstatus.SelectedValue = "1"
|
|
|
|
CargaDatosPersonal()
|
|
LimpiaAgregarConceptos()
|
|
End Sub
|
|
|
|
Protected Sub LimpiaAgregarConceptos()
|
|
DdlConceptoViatico.SelectedValue = "-1"
|
|
TxtImporte.Text = "0.0"
|
|
End Sub
|
|
|
|
Protected Sub BtnNuevo_Click(sender As Object, e As EventArgs)
|
|
CveSolicitudViatico = -1
|
|
|
|
DTConceptosDetalles = New DataTable()
|
|
|
|
LimpiaSolicitud()
|
|
End Sub
|
|
|
|
Protected Sub LbAgregar_Click(sender As Object, e As EventArgs)
|
|
If (CveSolicitudViatico > 0) Then
|
|
|
|
Dim ObjBancos As New ClsBancos()
|
|
If (ObjBancos.AddSolicitudesViaticosDetalle(CveSolicitudViatico, DdlConceptoViatico.SelectedValue.ToEntero(), TxtImporte.Text.ToDouble())) Then
|
|
|
|
Alert("El Detalle del Viático fue Agregado Correctamente.", ModExtensiones.TipoMensaje.MsgInformacion)
|
|
CargaDetalles(ObjBancos)
|
|
End If
|
|
ObjBancos.Dispose()
|
|
|
|
Else
|
|
|
|
Dim registro As DataRow = DTConceptosDetalles.NewRow()
|
|
|
|
registro("CveSolicitudViatico") = -1
|
|
registro("CveConceptoViatico") = DdlConceptoViatico.SelectedValue.ToEntero()
|
|
registro("ConceptoViatico") = DdlConceptoViatico.SelectedItem
|
|
registro("Importe") = TxtImporte.Text.ToDouble()
|
|
|
|
DTConceptosDetalles.Rows.Add(registro)
|
|
|
|
End If
|
|
CargaGVConceptosImportes(DTConceptosDetalles)
|
|
LimpiaAgregarConceptos()
|
|
End Sub
|
|
|
|
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
|
|
#End Region
|
|
End Class
|