This commit is contained in:
Antonio Gonzalez
2020-06-08 10:28:28 -07:00
5 changed files with 2031 additions and 65 deletions

View File

@@ -43,7 +43,10 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
ActualizaPrePoliza(context)
Case "getpersonal"
getpersonal(context)
Case "GettingCURP"
context.Response.Write(GettingCURP(context.Request("Curp").ToString(), context.Request("year").ToString().ToEntero()))
Case "ValidaCURP"
context.Response.Write(ValidaCURP(context.Request("Curp").ToString()))
End Select
Catch ex As Exception
ex.GuardaLog(ex.Message)
@@ -181,6 +184,225 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
End Sub
#End Region
Private Shared Function sendURL(ByVal URL As String, Optional Methodo As String = "POST", Optional Cookie As String = "", Optional maxTimeMilliseconds As Integer = 120000) As String
Dim resultado As String = ""
Try
Dim request As Net.HttpWebRequest = CType(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
request.Timeout = maxTimeMilliseconds
request.Method = Methodo
request.ContentType = "text/html; charset=utf-8" '"text/xml; charset=utf-8"
If Not String.IsNullOrEmpty(Cookie) Then
request.Headers.Add("Cookie", Cookie)
End If
'Using stream As IO.Stream = request.GetRequestStream()
' Using stmw As IO.StreamWriter = New IO.StreamWriter(stream)
' stmw.Write("")
' End Using
'End Using
Dim response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse)
Dim sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream())
resultado = sr.ReadToEnd()
sr.Close()
Catch ex As Exception
ex.ToString().GuardaLog()
'Extenciones.ApplicationParameter.GuardaLogEx(ex, $"SOAPAction : {SOAPAction} XML : {xml}")
End Try
Return resultado
End Function
Public Shared Function GettingCURP(ByVal Curp As String, year As Integer) As String
Dim abc As String() = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
Dim numeric01 As String() = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
Dim rule1 As String() = If(year < 2000, numeric01, abc)
Dim curpresult As String = ""
Dim i As Integer = 0
While curpresult.Length = 0 AndAlso i < rule1.Length
Dim z As Integer = 0
While curpresult.Length = 0 AndAlso z < numeric01.Length
curpresult = String.Format("{0}{1}{2}", Curp, rule1(i), numeric01(z))
Dim respuesta As String = sendURL(String.Format("http://www.renapo.sep.gob.mx/wsrenapo/MainControllerParam?curp={0}", curpresult), "GET")
Dim trlines As New List(Of String)
Dim keydict As New System.Collections.Concurrent.ConcurrentDictionary(Of String, String)
Dim indexttr As Integer = 0
Dim indexttrB As Integer = 0
Dim indexttd As Integer = 0
Dim indextdiv As Integer = 0
Dim indexinittext As Integer = 0
While Not IsNothing(respuesta) AndAlso respuesta.Length > 0
indexttr = respuesta.IndexOf("<tr")
If indexttr >= 0 Then
indexttrB = respuesta.Substring(indexttr + 3).IndexOf("<tr")
If indexttrB >= 0 Then
trlines.Add(respuesta.Substring(indexttr, indexttrB))
Else
trlines.Add(respuesta.Substring(indexttr))
End If
respuesta = respuesta.Substring(indexttr + 3)
Else
respuesta = ""
End If
End While
Dim key As String = ""
Dim keyvalue As String = ""
For Each item As String In trlines
key = ""
keyvalue = ""
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
key = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttrB + 3)
Else
item = ""
End If
If item.Length > 0 Then
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
keyvalue = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttr + 3)
Else
item = ""
End If
End If
If key.Length > 0 Then
keydict.TryAdd(key.Replace(":", "").Trim(), keyvalue.Trim().ToLower())
End If
Next
Dim Apellido1 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Apellido2 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Nombres As String = "" : keydict.TryGetValue("Nombres", Nombres)
If Nombres Is Nothing OrElse Nombres.Length = 0 Then
curpresult = ""
End If
System.Threading.Thread.Sleep(100)
z = z + 1
End While
i = i + 1
End While
Return curpresult
End Function
Public Shared Function ValidaCURP(ByVal Curp As String) As String
Dim respuesta As String = sendURL(String.Format("http://www.renapo.sep.gob.mx/wsrenapo/MainControllerParam?curp={0}", Curp), "GET")
Dim trlines As New List(Of String)
Dim keydict As New System.Collections.Concurrent.ConcurrentDictionary(Of String, String)
Dim indexttr As Integer = 0
Dim indexttrB As Integer = 0
Dim indexttd As Integer = 0
Dim indextdiv As Integer = 0
Dim indexinittext As Integer = 0
While Not IsNothing(respuesta) AndAlso respuesta.Length > 0
indexttr = respuesta.IndexOf("<tr")
If indexttr >= 0 Then
indexttrB = respuesta.Substring(indexttr + 3).IndexOf("<tr")
If indexttrB >= 0 Then
trlines.Add(respuesta.Substring(indexttr, indexttrB))
Else
trlines.Add(respuesta.Substring(indexttr))
End If
respuesta = respuesta.Substring(indexttr + 3)
Else
respuesta = ""
End If
End While
Dim key As String = ""
Dim keyvalue As String = ""
For Each item As String In trlines
key = ""
keyvalue = ""
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
key = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttrB + 3)
Else
item = ""
End If
If item.Length > 0 Then
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
keyvalue = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttr + 3)
Else
item = ""
End If
End If
If key.Length > 0 Then
keydict.TryAdd(key.Replace(":", "").Trim(), keyvalue.Trim().ToLower())
End If
Next
Dim Apellido1 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Apellido2 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Nombres As String = "" : keydict.TryGetValue("Nombres", Nombres)
If Nombres Is Nothing OrElse Nombres.Length = 0 Then
Curp = ""
End If
Return Curp
End Function
#Region "Get Cliente"
Private Function GetClientes(ByVal context As HttpContext) As String
Dim retorno As String = ""

View File

@@ -1759,7 +1759,7 @@ Partial Class RegPoliza
End Sub
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
Dim dt As New DataTable
Dim Conexion As Odbc.OdbcConnection = Nothing
'Dim Conexion As Odbc.OdbcConnection = Nothing
Dim ErrorArchivo = False
Dim n As Integer = 0
Try
@@ -1772,7 +1772,7 @@ Partial Class RegPoliza
'cmd.CommandText = "Select * FROM [Hoja1$]"
'Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
'DataAdapter.Fill(dt)
dt = Extensiones.ModExtensiones.ReadExcelFile(String.Format("{0}{1}", Ruta, FileName), True)
dt = Extensiones.ModExtensiones.ReadExcelFile(String.Format("{1}", Ruta, FileName), True)
Case Else
Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError)
Exit Sub
@@ -1781,7 +1781,7 @@ Partial Class RegPoliza
ErrorArchivo = True
OnError("Ocurrio un Error al leer el archivo <br/>" & ex.Message, ex)
End Try
Conexion.Close()
'Conexion.Close()
If Not ErrorArchivo Then
If Not dt.Columns(0).ColumnName = "Referencia" Then
Alert("El nombre de la primera columna debe ser 'Referencia'.Favor de corregirlo", TipoMensaje.MsgError)
@@ -1881,7 +1881,7 @@ Partial Class RegPoliza
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch
Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb", "xls"), "EXCEL", "CSV")
CargarArchivo(Directorio, file.filename, Tipo)
CargarArchivo(Directorio, file.FileUrl, Tipo)
Else
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
End If

View File

@@ -654,7 +654,7 @@
<div class="">
<asp:Label AssociatedControlID="DdlFonTipoAplicacion" CssClass="ddlInfolabel" runat="server" Text="Tipo Aplicación"></asp:Label>
<asp:DropDownList ID="DdlFonTipoAplicacion" AutoPostBack="true" runat="server" Class="form-control select2me" Width="100%">
<asp:DropDownList ID="DdlFonTipoAplicacion" runat="server" Class="form-control select2me" Width="100%">
<asp:ListItem Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Text="Fonacot(Importe fijo)" Value="3001"></asp:ListItem>
<asp:ListItem Text="Fonacot(Por días Labarados)" Value="3002"></asp:ListItem>

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,8 @@ Imports System.IO
Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports System.Globalization
Imports System.Xml
Imports System.Web.Script.Services
Partial Class RH_Personal
Inherits ClsPaginas
@@ -615,6 +617,136 @@ Partial Class RH_Personal
#End Region
Private Shared Function sendURL(ByVal URL As String, Optional Methodo As String = "POST", Optional Cookie As String = "", Optional maxTimeMilliseconds As Integer = 120000) As String
Dim resultado As String = ""
Try
Dim request As Net.HttpWebRequest = CType(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
request.Timeout = maxTimeMilliseconds
request.Method = Methodo
request.ContentType = "text/html; charset=utf-8" '"text/xml; charset=utf-8"
If Not String.IsNullOrEmpty(Cookie) Then
request.Headers.Add("Cookie", Cookie)
End If
'Using stream As IO.Stream = request.GetRequestStream()
' Using stmw As IO.StreamWriter = New IO.StreamWriter(stream)
' stmw.Write("")
' End Using
'End Using
Dim response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse)
Dim sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream())
resultado = sr.ReadToEnd()
sr.Close()
Catch ex As Exception
ex.ToString().GuardaLog()
'Extenciones.ApplicationParameter.GuardaLogEx(ex, $"SOAPAction : {SOAPAction} XML : {xml}")
End Try
Return resultado
End Function
'<ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Json)>
<System.Web.Services.WebMethod()>
Public Shared Function gettingCURP(ByVal Curp As String, year As Integer) As String
Dim abc As String() = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
Dim numeric01 As String() = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
Dim rule1 As String() = If(year < 2000, numeric01, abc)
Dim curpresult As String = ""
Dim i As Integer = 0
While Curp.Length = 0 AndAlso i < rule1.Length
Dim z As Integer = 0
While Curp.Length = 0 AndAlso z < numeric01.Length
curpresult = String.Format("{0}{1}{2}", Curp, rule1(i), numeric01(z))
Dim respuesta As String = sendURL(String.Format("http://www.renapo.sep.gob.mx/wsrenapo/MainControllerParam?curp={0}", curpresult), "GET")
Dim trlines As New List(Of String)
Dim keydict As New System.Collections.Concurrent.ConcurrentDictionary(Of String, String)
Dim indexttr As Integer = 0
Dim indexttrB As Integer = 0
Dim indexttd As Integer = 0
Dim indextdiv As Integer = 0
Dim indexinittext As Integer = 0
While Not IsNothing(respuesta) AndAlso respuesta.Length > 0
indexttr = respuesta.IndexOf("<tr")
If indexttr >= 0 Then
indexttrB = respuesta.Substring(indexttr + 3).IndexOf("<tr")
If indexttrB >= 0 Then
trlines.Add(respuesta.Substring(indexttr, indexttrB))
Else
trlines.Add(respuesta.Substring(indexttr))
End If
respuesta = respuesta.Substring(indexttr + 3)
Else
respuesta = ""
End If
End While
Dim key As String = ""
Dim keyvalue As String = ""
For Each item As String In trlines
key = ""
keyvalue = ""
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
key = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttrB + 3)
Else
item = ""
End If
If item.Length > 0 Then
indexttd = item.IndexOf("<td")
indextdiv = item.IndexOf("<div")
If indextdiv >= 0 Then
indexttr = indextdiv
indexttrB = item.IndexOf("</div")
Else
indexttr = indexttd
indexttrB = item.IndexOf("</td")
End If
If indexttr >= 0 Then
indexinittext = item.Substring(indexttr + 3).IndexOf(">")
keyvalue = item.Substring(indexinittext + indexttr + 4, (indexttrB - (indexinittext + indexttr + 4)))
item = item.Substring(indexttr + 3)
Else
item = ""
End If
End If
If key.Length > 0 Then
keydict.TryAdd(key.Replace(":", "").Trim(), keyvalue.Trim().ToLower())
End If
Next
Dim Apellido1 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Apellido2 As String = "" : keydict.TryGetValue("Apellido1", Apellido1)
Dim Nombres As String = "" : keydict.TryGetValue("Nombres", Nombres)
If Nombres Is Nothing OrElse Nombres.Length = 0 Then
curpresult = ""
End If
z = z + 1
End While
i = i + 1
End While
Return curpresult
End Function
Const wdPageBreak As Integer = 7
Const wdCharacter As Integer = 1
@@ -624,6 +756,8 @@ Partial Class RH_Personal
If UsuarioActual.CveEmpresa = 72 OrElse UsuarioActual.CveEmpresa = 80 Then
pnlSalarioIMSS.Visible = False
End If
'
ViewState("Orden") = ""
ViewState("Orden1") = ""
@@ -2151,7 +2285,7 @@ Partial Class RH_Personal
Private Sub CarcaConceptosNomina()
Dim ObjPersonal As New ClsRH
If ObjPersonal.GetPersonalConceptos(CvePersonal, UsuarioActual.CveEmpresa) Then
GVConceptos.DataSource = ObjPersonal.DtResultados
GVConceptos.DataSource = ObjPersonal.DtResultados.FiltraParametros("(CveSistema <>3 AND CveSistema <>4) OR CveSistema IS NULL")
Dim frow As DataRow = ObjPersonal.DtResultados.FiltroPrimero("CveSistema =3")
If Not IsNothing(frow) Then
TxtInfoValor.Text = String.Format("{0:###,###.##}", frow("Importe"))
@@ -2163,6 +2297,24 @@ Partial Class RH_Personal
TxtInfoFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow("FInicioAplicacion"))
ChkInfo.Checked = frow("estatus").ToString().ToUpper().Contiene("1", "TRUE")
End If
frow = ObjPersonal.DtResultados.FiltroPrimero("CveSistema =4")
TxtFonValor.Text = ""
DdlFonTipoAplicacion.SelectedValueExist("-1")
TxtFonDescripcion.Text = ""
TxtFonNumCredito.Text = ""
TxtFonFechaInicio.Text = ""
ChkFonacot.Checked = False
If Not IsNothing(frow) Then
TxtFonValor.Text = String.Format("{0:###,###.##}", frow("Importe"))
DdlFonTipoAplicacion.SelectedValueExist(frow("TipoAplicacion").ToString())
TxtFonDescripcion.Text = String.Format("{0}", frow("Descripcion02"))
TxtFonNumCredito.Text = String.Format("{0}", frow("Descripcion01"))
TxtFonFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow("FInicioAplicacion"))
ChkFonacot.Checked = frow("estatus").ToString().ToUpper().Contiene("1", "TRUE")
End If
Else
GVConceptos.DataSource = Nothing
End If
@@ -5930,4 +6082,30 @@ Partial Class RH_Personal
gvrow.FCTextBox("TxtPorPago").Text = "87.5"
End If
End Sub
Protected Sub LnkGuardarFonacot_Click(sender As Object, e As EventArgs)
Dim importe As Double = TxtFonValor.Text.ToDouble()
Dim TipoAplicacion As Integer = DdlFonTipoAplicacion.SelectedValue.ToEntero()
Dim NoPagos As Integer = 0
Dim SaldoIni As Double = 0
Dim descripcion02 As String = TxtFonDescripcion.Text
Dim descripcion01 As String = TxtFonNumCredito.Text
Dim fecha As String = TxtFonFechaInicio.Text.Replace("_", "")
Dim estatus As Integer = If(ChkFonacot.Checked, 1, 0)
If fecha.Length > 8 Then
fecha = fecha.ToDateTime().ToString("yyyy/MM/dd")
Else
fecha = ""
End If
Dim continuar As Boolean = True
Using ObjPersonal As ClsRH = New ClsRH()
If Not ObjPersonal.AddConcepto(CvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 4, descripcion01, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa) Then continuar = False
End Using
If continuar Then
Alert("Se actualizo el calculo de fonacot")
End If
End Sub
End Class