Option Explicit On Option Strict On Imports System.Data Imports CFDI_GenCodigo Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class RH_CatPersonal Inherits ClsPaginas Private Property ISChange As Boolean Get If ViewState("ISChange") Is Nothing Then Return False Else Return DirectCast(ViewState("ISChange"), Boolean) End If End Get Set(value As Boolean) ViewState("ISChange") = value End Set End Property Private Property DTDatos As DataTable Get If ViewState("DTDatos") Is Nothing Then Return New DataTable Else Return DirectCast(ViewState("DTDatos"), DataTable) End If End Get Set(value As DataTable) ViewState("DTDatos") = value End Set End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then If UsuarioActual.CveEmpresa.Contiene(1, 119, 158, 172, 173, 174) Then HplAddVenta.Visible = False End If LnkAddPersonalSimplificado.Visible = Not HplAddVenta.Visible TxtFechaIngreso.Text = String.Format("{0:dd/MM/yyyy}", NowADS()) ViewState("Orden") = "" CargaEscolaridad() CargaEstadoCivil() CargaDepartamento() CargaPuestos() CargaEstatusPersonal() CargaGenero() CargaMotivoBaja() CargaRuta() CargaTiposContrato() CargaTipoPeriodo() CargaTurno() CargaProyecto() CargaSupervisores() CargaMetodosPago() CargaDatos() CargaTipoRegimen() CargaJornada() CargaEstados() CargaSatRiesgoPuesto() CargaMedioTransporte() LoadDefaultValues() Dim ObjRH As New ClsRH If ObjRH.GetRegistrosPatronales(-1, UsuarioActual.CveEmpresa, 1) Then DdlRegistroPatronal.DataSource = ObjRH.DtResultados Else DdlRegistroPatronal.DataSource = Nothing End If DdlRegistroPatronal.DataBind() DdlRegistroPatronal.SelectedValueExist("21") 'empresa 158 ObjRH.Dispose() ' GvDatos.Rows(0).FCLabel("LtlSubProyectoConfigurado").Text = LblSubProyectoAsignado.Text If Not IsNothing(GvDatos.HeaderRow) AndAlso Not IsNothing(GvDatos.HeaderRow.Cells) AndAlso GvDatos.HeaderRow.Cells.Count > 0 Then GvDatos.HeaderRow.Cells(20).Text = LblSubProyectoAsignado.Text End If 'GvDatos.Columns(21).HeaderText = LblSubProyectoAsignado.Text UPDatos.Update() End If ltlContador.Text = String.Format("...{1}", If(GvDatos.Rows.Count > 0, "", " class='hidden' "), If(GvDatos.Rows.Count > 0, "", "0")) End Sub Public Sub CargaDatos() Dim ObjPersonal As New ClsRH 'Dim Codigo As String 'Dim Nombre As String 'Dim NSS As String 'Dim RFC As String Dim CveTurno As Integer = DdlTurno.SelectedValue.ToEntero Dim CvePuesto As Integer = DdlPuesto.SelectedValue.ToEntero Dim CveDepartamento As Integer = DdlDepartamento.SelectedValue.ToEntero Dim CveRuta As Integer = DdlRuta.SelectedValue.ToEntero Dim CveEscolaridad As Integer = DdlEscolaridad.SelectedValue.ToEntero Dim CveEstadoCivil As Integer = DdlEstadoCivil.SelectedValue.ToEntero Dim CveGenero As Integer = DdlGenero.SelectedValue.ToEntero Dim CveEstatusPersonal As Integer = DdlEstatusPersonal.SelectedValue.ToEntero Dim CveSubProyecto As Integer = DdlSubProyectoAsignado.SelectedValue.ToEntero Dim CveClienteAsignado As Integer = -1 '----- Dim HorarioTrabajo As String = "-1" '----- Dim CveSupervisor As Integer = DdlSupervisor.SelectedValue.ToEntero Dim CveTipoPeriodo As Integer = DdlTipoPeriodo.SelectedValue.ToEntero Dim CveMetodoPago As Integer = DdlMetodoPago.SelectedValue.ToEntero Dim CveTipoContrato As Integer = DdlTipoContrato.SelectedValue.ToEntero Dim CveMotivoBaja As Integer = DdlMotivoBaja.SelectedValue.ToEntero Dim CveProyecto As Integer = DdlProyectoAsignado.SelectedValue.ToEntero Dim FechaIFinContrato As String = TxtFechaIFinContrato.Text.Trim Dim FechaFFinContrato As String = TxtFechaFFinContrato.Text.Trim Dim FechaIIngreso As String = TxtFechaIIngreso.Text.Trim Dim FechaFIngreso As String = TxtFechaFIngreso.Text.Trim If FechaIFinContrato = Nothing Then FechaIFinContrato = "-1" End If If FechaFFinContrato = Nothing Then FechaFFinContrato = "-1" End If If FechaIIngreso = Nothing Then FechaIIngreso = "-1" End If If FechaFIngreso = Nothing Then FechaFIngreso = "-1" End If If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", CveTurno, CvePuesto, CveDepartamento, CveRuta, CveEscolaridad, CveEstadoCivil, CveGenero, CveEstatusPersonal, CveSubProyecto, CveClienteAsignado, HorarioTrabajo, CveSupervisor, CveTipoPeriodo, CveMetodoPago, CveTipoContrato, CveMotivoBaja, CveProyecto, FechaIFinContrato, FechaFFinContrato, FechaIIngreso, FechaFIngreso, UsuarioActual.CveEmpresa, ddlclasificacion.SelectedValue.ToEntero()) Then DTDatos = ObjPersonal.DtResultados 'filtro por usuario subproyecto/sucursal vsh If UsuarioActual.CveEmpresa = 7 Then If UsuarioActual.TienePermisoProceso(197) Then GvDatos.DataSource = ObjPersonal.DtResultados Else GvDatos.DataSource = ObjPersonal.DtResultados.FiltraParametros($"CveSubProyecto = { UsuarioActual.CveSubProyecto }") End If Else GvDatos.DataSource = ObjPersonal.DtResultados End If Else DTDatos = Nothing GvDatos.DataSource = Nothing End If ObjPersonal.Dispose() GvDatos.DataBind() 'If (GvDatos.Rows.Count > 0) Then ' GvDatos.UseAccessibleHeader = True ' GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader ' RegistraScript("OrdenarGV();") 'End If UPDatos.Update() 'If ViewState("Orden").ToString() <> String.Empty Then ' CargaGrid(ViewState("Orden").ToString()) 'Else ' CargaGrid("") 'End If End Sub Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click CargaDatos() UPDatos.Update() End Sub #Region " C O M B O S " Private Sub LoadDefaultValues() DdlDepartamentoAdd.SelectedIndex = 1 DdlRegimenContratacion.SelectedValueExist(1) DdlMetodoPagoAdd.SelectedValueExist(1) DdlTipoPeriodoAdd.SelectedValueExist(1) DdlTipoContratoAdd.SelectedValueExist(4) DdlJornada.SelectedValueExist(8) DdlPuestoAdd.SelectedIndex = 1 DdlRiesgoPuesto.SelectedIndex = 3 End Sub Private Sub CargaSatRiesgoPuesto() DdlRiesgoPuesto.DataSource = GlobalDTNomSatRiesgoPuesto DdlRiesgoPuesto.DataBind() End Sub Private Sub CargaJornada() DdlJornada.DataSource = GlobalDTJornadas DdlJornada.DataBind() End Sub Private Sub CargaEstados() DdlEstados.DataSource = GlobalDTGralEstados("MEX") DdlEstados.DataBind() End Sub Private Sub CargaTipoRegimen() Dim dt As DataTable = GlobalDTNomSatRegimenContratacion.Copy() For Each item As DataRow In dt.Rows item("RegimenContratacion") = String.Format("{1}{0} {2}", item("CveSATRegimenContratacion"), If(item("CveSATRegimenContratacion").ToString().Length > 1, "", "0"), item("RegimenContratacion")) Next dt.AcceptChanges() DdlRegimenContratacion.DataSource = dt.FiltraParametros("", "RegimenContratacion") DdlRegimenContratacion.DataBind() End Sub Private Sub CargaEscolaridad() DdlEscolaridad.DataSource = GlobalDTEscolaridad DdlEscolaridad.DataBind() End Sub Private Sub CargaGenero() DdlGenero.DataSource = GlobalDTGenero DdlGeneroAdd.DataSource = GlobalDTGenero DdlGenero.DataBind() DdlGeneroAdd.DataBind() End Sub Private Sub CargaEstadoCivil() DdlEstadoCivil.DataSource = GlobalDTEstadoCivil DdlEstadoCivil.DataBind() End Sub Private Sub CargaTipoPeriodo() DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo DdlTipoPeriodo.DataBind() DdlTipoPeriodoAdd.DataSource = GlobalDTTipoPeriodo DdlTipoPeriodoAdd.DataBind() End Sub Private Sub CargaTiposContrato() DdlTipoContrato.DataSource = GlobalDTTiposContrato DdlTipoContrato.DataBind() DdlTipoContratoAdd.DataSource = GlobalDTTiposContrato DdlTipoContratoAdd.DataBind() End Sub Private Sub CargaTurno() DdlTurno.DataSource = GlobalDTTurno(UsuarioActual.CveEmpresa) DdlTurno2.DataSource = GlobalDTTurno(UsuarioActual.CveEmpresa) DdlTurno2.DataBind() DdlTurno.DataBind() End Sub Private Sub CargaDepartamento() DdlDepartamento.DataSource = GlobalDTDepartamentos(UsuarioActual.CveEmpresa) DdlDepartamentoAdd.DataSource = DdlDepartamento.DataSource DdlDepartamentoAdd.DataBind() DdlDepartamento.DataBind() End Sub Private Sub CargaPuestos() DdlPuesto.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa) DdlPuestoAdd.DataSource = DdlPuesto.DataSource DdlPuesto.DataBind() DdlPuestoAdd.DataBind() End Sub Private Sub CargaRuta() DdlRuta.DataSource = GlobalDTRutas(UsuarioActual.CveEmpresa) DdlRuta.DataBind() End Sub Private Sub CargaMotivoBaja() DdlMotivoBaja.DataSource = GlobalDTMotivoBaja(UsuarioActual.CveEmpresa) DdlMotivoBaja.DataBind() End Sub Private Sub CargaEstatusPersonal() DdlEstatusPersonal.DataSource = GlobalDTEstatusPersonal DdlEstatusPersonal.DataBind() End Sub Private Sub CargaProyecto() 'DdlProyectoAsignado.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1) 'DdlProyectoAsignado.DataBind() CargaTipoCentroCosto() 'If DivProyecto.Visible Then ' CargaSubProyectos() 'End If End Sub Private Sub CargaSubProyectos() DdlSubProyectoAsignado.Items.Clear() If DdlProyectoAsignado.SelectedValue <> "-1" Then DdlSubProyectoAsignado.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyectoAsignado.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1) DdlSubProyectoAsignado.DataBind() End If DdlSubProyectoAsignado.Items.Insert(0, New ListItem("Todos", "-1")) 'filtro por usuario subproyecto/sucursal vsh 'If UsuarioActual.CveEmpresa = 7 Then ' DdlSubProyectoAsignado.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1).FiltraParametros($"CveSubProyecto = { UsuarioActual.CveSubProyecto }") 'End If UpSubProyecto.Update() End Sub Private Sub CargaMedioTransporte() Dim objgenerales As New ClsGenerales() objgenerales.GetMediosTransporte(-1, True, UsuarioActual.CveEmpresa, -1, -1, -1, -1) DdlMedioTransporte.Items.Clear() DdlMedioTransporte.DataSource = objgenerales.DtResultados DdlMedioTransporte.DataBind() 'filtro por usuario subproyecto/sucursal vsh 'If UsuarioActual.CveEmpresa = 7 Then ' DdlSubProyectoAsignado.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1).FiltraParametros($"CveSubProyecto = { UsuarioActual.CveSubProyecto }") 'End If 'UpSubProyecto.Update() End Sub Private Sub CargaTipoCentroCosto() CargarCentrosDeCosto(DdlProyectoAsignadoAdd, DdlSubProyectoAsignadoAdd, LblProyectoAsignado, LblSubProyectoAsignado) DivProyectosAsignado.Visible = LblProyectoAsignado.Visible CargarCentrosDeCosto(DdlProyectoAsignado, DdlSubProyectoAsignado, LblProyecto, LblSubProyecto) DivProyecto.Visible = LblProyecto.Visible ChkSubProyecto.Text = LblSubProyecto.Text GvDatos.Columns(12).HeaderText = LblSubProyecto.Text End Sub Private Sub CargaSupervisores() DdlSupervisor.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND EsSupervisorRH = 1 ") DdlSupervisor.DataBind() End Sub Private Sub CargaMetodosPago() DdlMetodoPago.DataSource = GlobalDTMetodosPago DdlMetodoPago.DataBind() DdlMetodoPagoAdd.DataSource = GlobalDTMetodosPago DdlMetodoPagoAdd.DataBind() End Sub #End Region #Region "P E R Z O N A L I Z A R" Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click If ChkCodigo.Checked Then GvDatos.Columns(0).Visible = True Else GvDatos.Columns(0).Visible = False End If If ChkNombre.Checked Then GvDatos.Columns(1).Visible = True Else GvDatos.Columns(1).Visible = False End If If ChkNSS.Checked Then GvDatos.Columns(2).Visible = True Else GvDatos.Columns(2).Visible = False End If If ChlRFC.Checked Then GvDatos.Columns(3).Visible = True Else GvDatos.Columns(3).Visible = False End If If ChkTurno.Checked Then GvDatos.Columns(4).Visible = True Else GvDatos.Columns(4).Visible = False End If If ChkPuesto.Checked Then GvDatos.Columns(5).Visible = True Else GvDatos.Columns(5).Visible = False End If If ChkDepartamento.Checked Then GvDatos.Columns(6).Visible = True Else GvDatos.Columns(6).Visible = False End If If ChkRuta.Checked Then GvDatos.Columns(7).Visible = True Else GvDatos.Columns(7).Visible = False End If If ChkEscolaridad.Checked Then GvDatos.Columns(8).Visible = True Else GvDatos.Columns(8).Visible = False End If If ChkEstadoCivil.Checked Then GvDatos.Columns(9).Visible = True Else GvDatos.Columns(9).Visible = False End If If ChkGenero.Checked Then GvDatos.Columns(10).Visible = True Else GvDatos.Columns(10).Visible = False End If If ChkEstatusPersonal.Checked Then GvDatos.Columns(11).Visible = True Else GvDatos.Columns(11).Visible = False End If If ChkSubProyecto.Checked Then GvDatos.Columns(12).Visible = True Else GvDatos.Columns(12).Visible = False End If If ChkSupervisor.Checked Then GvDatos.Columns(13).Visible = True Else GvDatos.Columns(13).Visible = False End If If ChkTipoPeriodo.Checked Then GvDatos.Columns(14).Visible = True Else GvDatos.Columns(14).Visible = False End If If ChkMetodoPago.Checked Then GvDatos.Columns(15).Visible = True Else GvDatos.Columns(15).Visible = False End If If ChkTipoContrato.Checked Then GvDatos.Columns(16).Visible = True Else GvDatos.Columns(16).Visible = False End If If ChkMotivoBaja.Checked Then GvDatos.Columns(17).Visible = True Else GvDatos.Columns(17).Visible = False End If If ChkProyecto.Checked Then GvDatos.Columns(18).Visible = True Else GvDatos.Columns(18).Visible = False End If If ChkFechaIngreso.Checked Then GvDatos.Columns(19).Visible = True Else GvDatos.Columns(19).Visible = False End If If ChkSeInscribioSS.Checked Then GvDatos.Columns(20).Visible = True Else GvDatos.Columns(20).Visible = False End If If ChkSalarioDiarioPago.Checked Then GvDatos.Columns(21).Visible = True Else GvDatos.Columns(21).Visible = False End If If ChkSalarioDiario.Checked Then GvDatos.Columns(22).Visible = True Else GvDatos.Columns(22).Visible = False End If If ChkSDI.Checked Then GvDatos.Columns(23).Visible = True Else GvDatos.Columns(23).Visible = False End If If ChkSalarioDiarioSS.Checked Then GvDatos.Columns(24).Visible = True Else GvDatos.Columns(24).Visible = False End If If ChkBono.Checked Then GvDatos.Columns(25).Visible = True Else GvDatos.Columns(25).Visible = False End If If ChkNumDiasAguinaldo.Checked Then GvDatos.Columns(26).Visible = True Else GvDatos.Columns(26).Visible = False End If If ChkPorPrimaVacacional.Checked Then GvDatos.Columns(27).Visible = True Else GvDatos.Columns(27).Visible = False End If If ChkUbicacion.Checked Then GvDatos.Columns(28).Visible = True Else GvDatos.Columns(28).Visible = False End If If ChkFechaNacimiento.Checked Then GvDatos.Columns(29).Visible = True Else GvDatos.Columns(29).Visible = False End If If ChkLugarNacimiento.Checked Then GvDatos.Columns(30).Visible = True Else GvDatos.Columns(30).Visible = False End If If ChkDireccion.Checked Then GvDatos.Columns(31).Visible = True Else GvDatos.Columns(31).Visible = False End If If ChkCP.Checked Then GvDatos.Columns(32).Visible = True Else GvDatos.Columns(32).Visible = False End If If ChkCiudad.Checked Then GvDatos.Columns(33).Visible = True Else GvDatos.Columns(33).Visible = False End If If ChkEstado.Checked Then GvDatos.Columns(34).Visible = True Else GvDatos.Columns(34).Visible = False End If If ChkTelefono.Checked Then GvDatos.Columns(35).Visible = True Else GvDatos.Columns(35).Visible = False End If If ChkCelular.Checked Then GvDatos.Columns(36).Visible = True Else GvDatos.Columns(36).Visible = False End If If ChkCURP.Checked Then GvDatos.Columns(37).Visible = True Else GvDatos.Columns(37).Visible = False End If If ChkNombrePadre.Checked Then GvDatos.Columns(38).Visible = True Else GvDatos.Columns(38).Visible = False End If If ChkNombreMadre.Checked Then GvDatos.Columns(39).Visible = True Else GvDatos.Columns(39).Visible = False End If If ChkClienteAsignado.Checked Then GvDatos.Columns(40).Visible = True Else GvDatos.Columns(40).Visible = False End If If ChkUsuario.Checked Then GvDatos.Columns(42).Visible = True Else GvDatos.Columns(42).Visible = False End If If ChkRiesgoPuesto.Checked Then GvDatos.Columns(43).Visible = True Else GvDatos.Columns(43).Visible = False End If If ChkRegistroPatronal.Checked Then GvDatos.Columns(44).Visible = True Else GvDatos.Columns(44).Visible = False End If If ChkTipodeSalario.Checked Then GvDatos.Columns(45).Visible = True Else GvDatos.Columns(45).Visible = False End If GvDatos.Columns(46).Visible = ChkBanco.Checked GvDatos.Columns(47).Visible = ChkCuentaBancaria.Checked GvDatos.Columns(48).Visible = ChkClaBE.Checked If (GvDatos.Rows.Count > 0) Then GvDatos.UseAccessibleHeader = True GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader RegistraScript("OrdenarGV();") End If RegistraScript("SavePersonalizar();") liLnkDescarPersonalizado.Visible = True UpPersonalizado.Update() UPDatos.Update() End Sub #End Region #Region "G V D A T O S" Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowIndex = 0 Then e.Row.Cells(0).Width = Unit.Pixel(60) e.Row.Cells(1).Width = Unit.Pixel(250) e.Row.Cells(2).Width = Unit.Pixel(80) e.Row.Cells(3).Width = Unit.Pixel(80) e.Row.Cells(4).Width = Unit.Pixel(100) e.Row.Cells(5).Width = Unit.Pixel(100) e.Row.Cells(6).Width = Unit.Pixel(60) e.Row.Cells(7).Width = Unit.Pixel(110) e.Row.Cells(8).Width = Unit.Pixel(90) End If 'If UsuarioActual.Empresa.CveEmpresa = 4 Or UsuarioActual.Empresa.CveEmpresa = 11 Or UsuarioActual.Empresa.CveEmpresa = 7 Or UsuarioActual.Empresa.CveEmpresa = 12 Or UsuarioActual.Empresa.CveEmpresa = 2 Then ' e.Row.FCLiteral("LtlNombre").Text = "" & e.Row.FCLiteral("LtlNombre").Text & "" 'Else ' e.Row.FCLiteral("LtlNombre").Text = "" & e.Row.FCLiteral("LtlNombre").Text & "" 'End If 'e.Row.FCLiteral("LtlCodigo").Text = "" & e.Row.FCLiteral("LtlCodigo").Text & "" End If End Sub #End Region #Region "I M P R I M I R P D F/Excel" Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click GenerarPDF("Excel") End Sub Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click GenerarPDF() End Sub Private Sub GenerarPDF(Optional Formato As String = "PDF") Dim ObjTareas As New ClsOIEventos Dim params As New List(Of ReportParameter) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) ' params.Add(New ReportParameter("AgrupadoPor", Filtros)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) 'params.Add(New ReportParameter("FechaInicio", FechaI)) 'params.Add(New ReportParameter("FechaFin", FechaF)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString)) params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) ImprimirPDF("Empresas\Grales\Formatos\RepPersonal.rdlc", DTDatos, params, "ReporteTareas", Formato:=Formato) End Sub #End Region Protected Sub DdlProyectoAsignado_SelectedIndexChanged(sender As Object, e As EventArgs) CargaSubProyectos() End Sub Protected Sub LnkDescarPersonalizados_Click(sender As Object, e As EventArgs) Dim htmlFuente As String = txtDatos.Text Dim RutaLogo As String = $"{Server.MapPath("~")}\Empresas\{UsuarioActual.CveEmpresa}\logo.png" 'Dim Logo As String = "" 'If IO.File.Exists(RutaLogo) Then ' Dim fs = New IO.MemoryStream(IO.File.ReadAllBytes(RutaLogo)) ' Dim br As New System.IO.BinaryReader(fs) ' Dim bytes As Byte() = br.ReadBytes(CType(fs.Length, Integer)) ' Logo = Convert.ToBase64String(bytes, 0, bytes.Length) ' fs.Dispose() 'End If ' Dim Cabera = $"
Logo

{UsuarioActual.Empresa.Empresa}

Reporte Personal
" htmlFuente = htmlFuente.Replace(" 0 Then contador = contador + 1 RFCs.AppendLine(String.Format("{0}|{1}", contador, rfc)) End If Next End If End Using Response.Clear() Response.ContentType = "text/plain" Response.AppendHeader("content-disposition", "attachment;filename=RFCs_Validacion_Masiva.txt") 'Response.Write(contador.ToString()) Response.Write(RFCs.ToString()) Response.End() End Sub Protected Sub LnkCargarValidacion_Click(sender As Object, e As EventArgs) Dim fileurl As String Dim archivos As Files = TxtValidacionMasivaRFC.getfiles() If archivos.Archivos.Count > 0 Then fileurl = archivos.Archivos(0).FileUrl Dim linestxt As String() = IO.File.ReadAllLines(fileurl, Encoding.GetEncoding("iso-8859-1")) Dim contadorok As Integer = 0 Dim contadorfail As Integer = 0 Using ObjPersonal As ClsRH = New ClsRH() For Each item As String In linestxt Dim splitstr As String() = item.Split("|"c) Dim Cve As String = "" Dim rfc As String = "" Dim msg As String = "" If splitstr.Length > 0 Then Cve = splitstr(0) End If If splitstr.Length > 1 Then rfc = splitstr(1) End If If splitstr.Length > 2 Then msg = splitstr(2) End If If msg = txtStringValido.Text Then contadorok = contadorok + 1 Else contadorfail = contadorfail + 1 End If If ObjPersonal.UpdateRFCValidado(rfc.ToUpper(), UsuarioActual.CveEmpresa, (msg = txtStringValido.Text)) Then End If Next End Using Alert(String.Format("Se encontraron {0} rfc correctos y {1} rfc incorrectos", contadorok, contadorfail)) Else Alert("Favor de agregar un archivo", TipoMensaje.MsgAdvertencia) End If End Sub Protected Sub LnkCargaMasiva_Click(sender As Object, e As EventArgs) Dim wb As ClosedXML.Excel.XLWorkbook = New ClosedXML.Excel.XLWorkbook() Dim libro = wb.AddWorksheet("Personal") Dim crow As Integer = 1 Dim ccol As Integer = 1 Dim colLugarNacimiento As Integer = 1 Dim rowLugarNacimiento As Integer = 1 #Region "Regimen de contratación" Dim Catalogos = wb.AddWorksheet("Catalogos") crow = 1 ccol = 1 Dim colRegimenContratacion As Integer = 1 Dim rowRegimenContratacion As Integer = 1 Catalogos.Cell(crow, ccol).Value = "Regimen de contratación" For Each row As DataRow In GlobalDTNomSatRegimenContratacion.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSATRegimenContratacion"), row("RegimenContratacion")) Next colRegimenContratacion = ccol rowRegimenContratacion = crow #End Region #Region "Estado civil" Dim colEstadoCivil As Integer = 1 Dim rowEstadoCivil As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Estado civil" For Each row As DataRow In GlobalDTEstadoCivil.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstadoCivil"), row("EstadoCivil")) Next colEstadoCivil = ccol rowEstadoCivil = crow #End Region #Region "Escolaridad" Dim colEscolaridad As Integer = 1 Dim rowEscolaridad As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Escolaridad" For Each row As DataRow In GlobalDTEscolaridad.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEscolaridad"), row("Escolaridad")) Next colEscolaridad = ccol rowEscolaridad = crow #End Region #Region "Tipo Periodo" Dim colTipoPeriodo As Integer = 1 Dim rowTipoPeriodo As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Tipo Periodo" For Each row As DataRow In GlobalDTTipoPeriodo.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTipoPeriodo"), row("TipoPeriodo")) Next colTipoPeriodo = ccol rowTipoPeriodo = crow #End Region #Region "Estatus" Dim colEstatusPersonal As Integer = 1 Dim rowEstatusPersonal As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Estatus" For Each row As DataRow In GlobalDTEstatusPersonal.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstatusPersonal"), row("EstatusPersonal")) Next colEstatusPersonal = ccol rowEstatusPersonal = crow #End Region #Region "Tipo Contratro" Dim colTipoContrato As Integer = 1 Dim rowTipoContrato As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Tipo Contratro" For Each row As DataRow In GlobalDTTiposContrato.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}", row("TipoContrato")) Next colTipoContrato = ccol rowTipoContrato = crow #End Region #Region "Departamento" Dim colDepartamento As Integer = 1 Dim rowDepartamento As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Departamento" For Each row As DataRow In GlobalDTDepartamentos(UsuarioActual.CveEmpresa).Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveDepartamento"), row("Departamento")) Next colDepartamento = ccol rowDepartamento = crow #End Region #Region "Turno" Dim colTurno As Integer = 1 Dim rowTurno As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Turno" For Each row As DataRow In GlobalDTTurno(UsuarioActual.CveEmpresa).Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTurno"), row("Turno")) Next colTurno = ccol rowTurno = crow #End Region #Region "Puesto" Dim colPuesto As Integer = 1 Dim rowPuesto As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Puesto" For Each row As DataRow In GlobalDTRHPuestos(UsuarioActual.CveEmpresa).Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CvePuesto"), row("Puesto")) Next colPuesto = ccol rowPuesto = crow #End Region #Region "Estado" Dim colEstado As Integer = 1 Dim rowEstado As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Estado" For Each row As DataRow In GlobalDTGralEstados("MEX").Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstado"), row("NombreEstado")) Next colEstado = ccol rowEstado = crow #End Region #Region "Tipo salario" Dim colTipoSalario As Integer = 1 Dim rowTipoSalario As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Tipo salario" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "1: Salario fijo" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "2: Salario variable" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "3: Salario mixto" colTipoSalario = ccol rowTipoSalario = crow #End Region #Region "Genero" Dim colSexo As Integer = 1 Dim rowSexo As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Genero" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "1: Masculino" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "2: Femenino" colSexo = ccol rowSexo = crow #End Region #Region "Sindicalizado" Dim colsindicalizado As Integer = 1 Dim rowsindicalizado As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Sindicalizado" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "1: Sí" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "0: No" colsindicalizado = ccol rowsindicalizado = crow #End Region #Region "Area geografica" Dim colAreaGeografica As Integer = 1 Dim rowAreaGeografica As Integer = 1 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Area geografica" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "A" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "B" crow = crow + 1 Catalogos.Cell(crow, ccol).Value = "C" colAreaGeografica = ccol rowAreaGeografica = crow #End Region #Region "Metodo pago" Dim colmetodopago = 0 Dim rowmetodopago = 0 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "Metodo pago" For Each row As DataRow In GlobalDTMetodosPago.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveMetodoPago"), row("MetodoPago")) Next colmetodopago = ccol rowmetodopago = crow #End Region #Region "subproyecto" Dim colsubproyecto = 0 Dim rowsubproyecto = 0 crow = 1 ccol = ccol + 1 Catalogos.Cell(crow, ccol).Value = "subproyecto" Dim dtsubproyecto = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1)) For Each row As DataRow In dtsubproyecto.Rows crow = crow + 1 Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSubProyecto"), row("SubProyecto")) Next colsubproyecto = ccol rowsubproyecto = crow #End Region Catalogos.Range(1, 1, 1, ccol).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) Catalogos.Range(1, 1, 1, ccol).Style.Font.FontColor = ClosedXML.Excel.XLColor.White crow = 1 ccol = 1 libro.Cell(crow, ccol).Value = "Código" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Apellido Paterno" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Apellido Materno" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Nombre" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Correo Electronico" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Fecha Nacimiento" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Sexo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colSexo, rowSexo, colSexo), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Lugar Nacimiento" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Dirección" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Ciudad" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Estado Civil" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstadoCivil, rowEstadoCivil, colEstadoCivil), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Teléfono" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Celular" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "RFC" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "CURP" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Numero SS" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "CLABE" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Fecha Ingreso" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Fecha Baja" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Alta IMSS" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Código Postal" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Estatus Personal" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstatusPersonal, rowEstatusPersonal, colEstatusPersonal), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Estado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstado, rowEstado, colEstado), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Nombre Padre" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Nombre Madre" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Puesto" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colPuesto, rowPuesto, colPuesto), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Turno" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTurno, rowTurno, colTurno), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Tipo Contrato" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoContrato, rowTipoContrato, colTipoContrato), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Departamento" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colDepartamento, rowDepartamento, colDepartamento), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Tipo Periodo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoPeriodo, rowTipoPeriodo, colTipoPeriodo), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Escolaridad" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEscolaridad, rowEscolaridad, colEscolaridad), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Salario Diario" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Tipo Salario" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoSalario, rowTipoSalario, colTipoSalario), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Salario variable" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Sindicalizado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsindicalizado, rowsindicalizado, colsindicalizado), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "SubProyecto" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsubproyecto, rowsubproyecto, colsubproyecto), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "RegimenContratacion" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colRegimenContratacion, rowRegimenContratacion, colRegimenContratacion), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Area Geografica" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colAreaGeografica, rowAreaGeografica, colAreaGeografica), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Prima vacacional" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Dias aguinaldo" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Metodo Pago" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colmetodopago, rowmetodopago, colmetodopago), True) : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "SDI" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Nominista" : ccol = ccol + 1 libro.Cell(crow, ccol).Value = "Registro Patronal" : ccol = ccol + 1 libro.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) libro.Range(crow, 1, crow, ccol - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White Catalogos.ColumnsUsed().AdjustToContents() libro.ColumnsUsed().AdjustToContents() 'AreaGeografica ABC 'GlobalDTMetodosPago MetodoPago" DataValueField="CveMetodoPago Dim fs As System.IO.Stream = New System.IO.MemoryStream() wb.SaveAs(fs) fs.Position = 0 Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream() Using input As System.IO.Stream = fs input.CopyTo(memoryStream) End Using memoryStream.Position = 0 Response.Clear() Response.Buffer = True Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Response.AddHeader("content-disposition", String.Format("attachment;filename=SaldosInicialesRH.xlsx", "")) Response.BinaryWrite(memoryStream.ToArray()) Response.[End]() 'Using nom As ClsNominas = New ClsNominas() ' If nom.ReportedePercepcionesDeduccionesGet(UsuarioActual.CveEmpresa, fechai, fechaf, 4) Then ' Dim dt As DataTable = nom.DTSetResultados.Tables(0) ' Dim libro = wb.AddWorksheet(nom.DTSetResultados.Tables(0), "Percepciones y deducciones") ' libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None ' Dim crow As Integer = 1 ' For Each item As DataRow In dt.Rows ' crow += 1 ' Select Case item("Grupoid").ToString() ' Case "10" ' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228)) ' Case "8", "11" ' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)) ' libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White ' Case "6" ' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188)) ' Case "5", "7" ' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 187, 89)) ' libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White ' Case "2" ' Case "1", "3" ' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(75, 172, 198)) ' libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White ' End Select ' Next ' libro.Range(2, 4, crow, 9).Style.NumberFormat.Format = "$##,###,###,0.00" ' libro.Range(2, 4, crow, 9).DataType = ClosedXML.Excel.XLDataType.Number ' libro.Column(1).Delete() ' libro.ColumnsUsed().AdjustToContents() ' libro.Row(1).InsertRowsAbove(4) ' libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa ' libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de percepciones y deducciones del {fechai} al {fechaf}" ' libro.Range(1, 2, 2, 6).Style.Font.SetBold(True) ' libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16) ' libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14) ' libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center ' libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{NowADS()}" ' libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{NowADS()}" ' End If 'End Using End Sub Protected Sub LnkGuardar_Click(sender As Object, e As EventArgs) DdlTurno.SelectedIndex = 1 Dim CveEtadoCivil = 1 Dim CveEstatusPersonal = 1 Dim CveEscolaridad As Integer = 0 Dim isSindicalizado As Boolean = (DDlSindicalizado.SelectedValue = "1") Dim CvePuesto As Integer = DdlPuestoAdd.SelectedValue.ToEntero() Dim CveSATRiesgoPuesto As Integer = DdlRiesgoPuesto.SelectedValue.ToEntero() Dim SalarioDiario As Decimal = TxtSalarioDiario.Text.ToDecimal() Dim continuar As Boolean = False Dim CvePersonal As Integer = 0 Using ObjPersonal As New ClsRH() ObjPersonal.IniciaTransacSQL() If ObjPersonal.AddPersonal(TxtCodigo.Text, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, "", TxtFechaIngreso.Text.ToDate, DdlTipoPeriodoAdd.SelectedValue.ToEntero, TxtNumeroSS.Text.Trim, True, SalarioDiario, SalarioDiario, 0, 0, 0, 15, 25, DdlMetodoPagoAdd.SelectedValue.ToEntero, TxtFechaIngreso.Text.Trim.ToDate, "-1", DdlTipoContratoAdd.SelectedValue.ToEntero, "", DdlTurno2.SelectedValue.ToEntero, CvePuesto, DdlDepartamentoAdd.SelectedValue.ToEntero, -1, CveEscolaridad, CveEtadoCivil, DdlGeneroAdd.SelectedValue.ToEntero(), -1, "-1", CveEstatusPersonal, TxtFechaNacimiento.Text.ToDate, "", "", "", "", "", "", "", DdlEstados.SelectedValue.ToEntero, "", "", "", TxtRFC.Text.Trim, TxtCURP.Text.Trim, "", "", "", -1, CveSATRiesgoPuesto, DdlRegimenContratacion.SelectedValue.ToEntero, -1, DdlSubProyectoAsignadoAdd.SelectedValue.ToEntero, "", DdlSupervisor.SelectedValue.ToEntero, "", "", DdlJornada.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, "", -1, CveUniforme:=-1, TelefonoExtension:="", CelularPersonal:="", TelefonoMarcadoRapido:="", ContactoAlterno:="", CveTipodeSalario:=DDlTipoSalario.SelectedValue.ToEntero(), Sindicalizado:=isSindicalizado, CvePais:=151, CveMedioTransporte:=DdlMedioTransporte.SelectedValue.ToEntero(), CveRegistroPatronal:=DdlRegistroPatronal.SelectedValue.ToEntero(), AreaGeografica:=DdlAreageografica.SelectedValue ) Then Dim filesgral As List(Of Archivo) = TxtFoto.getfiles().Archivos Dim filemove As String = "" If ObjPersonal.CvePersonal > 0 Then For Each fileItem As Archivo In filesgral Dim extension = fileItem.Extension.Replace(".", "") If (extension.Contiene("jpg", "png", "bmp")) Then Dim dir As String = String.Format("{0}RH\Personal\", UsuarioActual.Empresa.Ruta) System.IO.Directory.CreateDirectory(dir) Dim file As String = String.Format("{0}{1}.{2}", dir, ObjPersonal.CvePersonal, extension) If (System.IO.File.Exists(file)) Then System.IO.File.Delete(file) End If System.IO.File.Move(fileItem.FileUrl, file) End If Next Alert(String.Format("El empleado a sido agregado satisfactoriamente Ver empleado", ObjPersonal.CvePersonal), TipoMensaje.ToastInformacion, "", 0) End If If ObjPersonal.Updateestemporal(ObjPersonal.CvePersonal, UsuarioActual.CveEmpresa, ChkEstemporal.Checked) Then End If ObjPersonal.AgroDepartamentoPersonalUp(UsuarioActual.CveEmpresa, DDlAgroDepartamento.SelectedValue.ToEntero(), ObjPersonal.CvePersonal, If(ChkCharolaForanea.Checked, 1, 0)) TxtFoto.Text = "[]" continuar = True ISChange = True ObjPersonal.Commit() Else ObjPersonal.RollBack() 'Alert("El empleado a sido agregado satisfactoriamente", TipoMensaje.ToastInformacion, "", 0) End If End Using DdlTurno.SelectedValueExist(-1) If continuar Then LimpiarCampos() If chkcontinuarAgregando.Checked Then Else RegistraScript("$('#DmodalAddPersonal').modal('hide');") End If End If End Sub Protected Sub LimpiarCampos() TxtAPaterno.Text = "" TxtAMaterno.Text = "" TxtNombres.Text = "" TxtFechaNacimiento.Text = "" TxtNumeroSS.Text = "" TxtCURP.Text = "" TxtRFC.Text = "" TxtCodigo.Text = "-1" Using objrh = New ClsRH() TxtCodigo.Text = objrh.PersonalUitimoCodigoGET(UsuarioActual.CveEmpresa, "") End Using End Sub Protected Sub LnkAddPersonalSimplificado_Click(sender As Object, e As EventArgs) ISChange = False UpAddPerSimplificado.Update() LimpiarCampos() RegistraScript("$('#DmodalAddPersonal').modal();") End Sub Protected Sub ClickOnHideModal_Click(sender As Object, e As EventArgs) If ISChange Then CargaDatos() End If End Sub Protected Sub DdlSubProyectoAsignadoAdd_SelectedIndexChanged(sender As Object, e As EventArgs) Using objrh As New ClsRH() If (objrh.AgroDepartamentosGet(UsuarioActual.CveEmpresa, -1, -1)) Then Dim dt As DataTable = objrh.DtResultados.FiltraParametros(String.Format("CveSubProyecto ={0}", DdlSubProyectoAsignadoAdd.SelectedValue), "", {"CveTipoTrabajador", "TipoTrabajadorB"}) Dim drow As DataRow = dt.NewRow() drow("CveTipoTrabajador") = "-1" drow("TipoTrabajadorB") = "Seleccione" dt.Rows.InsertAt(drow, 0) If DdlTipoTrabajador.Items.Count() > 0 Then DdlTipoTrabajador.SelectedValueExist("-1") End If DdlTipoTrabajador.DataSource = dt DdlTipoTrabajador.DataBind() End If RfvTxtCURP.Visible = Not DdlSubProyectoAsignadoAdd.SelectedValue.ToEntero().Contiene(11881, 11882) If DdlSubProyectoAsignadoAdd.SelectedValue.ToEntero().Contiene(11954, 11884, 11883) Then Dim objgenerales As New ClsGenerales() objgenerales.GetMediosTransporte(-1, True, UsuarioActual.CveEmpresa, 1, -1, -1, -1) DdlMedioTransporte.Items.Clear() DdlMedioTransporte.DataSource = objgenerales.DtResultados DdlMedioTransporte.DataBind() Else Dim objgenerales As New ClsGenerales() objgenerales.GetMediosTransporte(-1, True, UsuarioActual.CveEmpresa, -1, DdlSubProyectoAsignadoAdd.SelectedValue.ToEntero(), -1, -1) DdlMedioTransporte.Items.Clear() DdlMedioTransporte.DataSource = objgenerales.DtResultados DdlMedioTransporte.DataBind() End If End Using End Sub Protected Sub DdlTipoTrabajador_SelectedIndexChanged(sender As Object, e As EventArgs) Using objrh As New ClsRH() If (objrh.AgroDepartamentosGet(UsuarioActual.CveEmpresa, -1, -1)) Then Dim dt As DataTable = objrh.DtResultados.FiltraParametros(String.Format("CveTipoTrabajador ={0}", DdlTipoTrabajador.SelectedValue)) Dim drow As DataRow = dt.NewRow() drow("CveDepartamento") = "-1" drow("Departamento") = "Seleccione" dt.Rows.InsertAt(drow, 0) If DDlAgroDepartamento.Items.Count() > 0 Then DDlAgroDepartamento.SelectedValueExist("-1") End If DDlAgroDepartamento.DataSource = dt DDlAgroDepartamento.DataBind() End If End Using End Sub End Class