Professional Documents
Culture Documents
Ruc
Ruc
txtruc.Focus()
Exit Sub
End If
xDat
xDat
xDat
xDat
xDat
", "Direccion:")
xDat
xDat
xDat
xDat
xDat
xDat
=
=
=
=
=
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
=
=
=
=
=
=
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
"
", " ")
"
", " ")
" ", " ")
" ", " ")
"( ", "(")
" )", ")")
xRazSocX = InStr(1,
xRazSocY = InStr(1,
", vbTextCompare)
xRazSocX = xRazSocX
xRazSoc = Mid(xDat,
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
xDir
xDir
xDir
xDir
=
=
=
=
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
"",
"",
"",
"",
"")
"")
"")
"")
Txtrazsoc.Text = xRazSoc
txtest.Text = xEst
txtcon.Text = xCon
txtdir.Text = xDir
Else
Limpiar()
MsgBox("No responde el servicio de la SUNAT", vbInformation, "Softae
- Software de Administracion Empresarial")
End If
xWml = Nothing
End Sub
Private Sub OTRO(ByVal xNum As String)
On Error Resume Next
Dim xWml As New XMLHTTPRequest
xWml.open("POST", "http://http://www.sunat.gob.pe/cl-ti-itmrconsruc/jcrS
00Alias?ruc=" & xNum, False)
xWml.send()
If xWml.Status = 200 Then
Limpiar()
xDat = xWml.responseText
If Len(xDat)
MsgBox("El numero Ruc ingresado no existe en la Base de datos de
la SUNAT", vbInformation, "Softae - Software de Administracion Empresarial")
xWml = Nothing
txtruc.Focus()
Exit Sub
End If
Dim xTabla() As String
xDat
xDat
xDat
xDat
xDat
xDat
=
=
=
=
=
=
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
Replace(xDat,
"
", " ")
"
", " ")
" ", " ")
" ", " ")
"( ", "(")
" )", ")")
=
=
=
=
=
=
=
=
=
=
=
=
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
Replace(xRazSoc,
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
=
=
=
=
=
=
=
=
=
=
=
=
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
Replace(xDir,
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
"")
txtcon.Text = ""
txtdir.Text = ""
End Sub
Function Verificar_ruc(ByVal xNum As String) As Boolean
Dim li_suma, li_residuo, li_diferencia, li_compara As Integer
li_suma = (CInt(Mid(xNum, 1, 1)) * 5) + (CInt(Mid(xNum, 2, 1)) * 4) + (C
Int(Mid(xNum, 3, 1)) * 3) + (CInt(Mid(xNum, 4, 1)) * 2) + (CInt(Mid(xNum, 5, 1))
* 7) + (CInt(Mid(xNum, 6, 1)) * 6) + (CInt(Mid(xNum, 7, 1)) * 5) + (CInt(Mid(xN
um, 8, 1)) * 4) + (CInt(Mid(xNum, 9, 1)) * 3) + (CInt(Mid(xNum, 10, 1)) * 2)
li_compara = CInt(Mid(xNum, 11, 1))
li_residuo = li_suma Mod 11
li_diferencia = Int(11 - li_residuo)
If li_diferencia > 9 Then li_diferencia = li_diferencia - 10
If li_diferencia li_compara Then
Verificar_ruc = False
Else
Verificar_ruc = True
End If
End Function
Private Sub txtruc_KeyPress(sender As Object, e As System.Windows.Forms.KeyP
ressEventArgs) Handles txtruc.KeyPress
Dim Cadena = "0123456789"
If InStr(Cadena, e.KeyChar) Then
e.Handled = False
ElseIf Char.IsControl(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
If e.KeyChar = ChrW(Keys.Enter) Then
e.Handled = True
SendKeys.Send("{TAB}")
End If
End Sub