This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2021-05-19 10:28:31 -07:00
parent 671d7e201f
commit 6609a96e2e
32 changed files with 5049 additions and 2638 deletions

View File

@@ -680,4 +680,366 @@ Partial Class RH_CatPersonal
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.FiltraParametros("CveEmpresa = " & 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.FiltraParametros("CveEmpresa = " & 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(1).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstado"), row("Estado"))
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.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:{DateTime.Now}"
' libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now}"
' End If
'End Using
End Sub
End Class
S