'
'SUNAT
'
'Author : Leonardo Torres Ochoa (leonardo1626@hotmail.com)
'
'Create : 11/09/2009 23:13:07
'LastUpdate : 14/10/2009 17:08:07
'
Private Sub CommandButton1_Click()
Dim strParam1 As String
Dim strParam2 As String
Dim strParam3 As String
Dim strParam4 As String
Dim strParam5 As String
Dim strParam6 As String
Dim strXml As String
Dim strTitle As String
Dim strDescr As String
Dim strMensaje As String
Dim pathApp As String
Dim pathBamdeja As String
Dim i As Long
Dim t1 As Long
'*********************************************************** *****************
'CONSISTENCIA DE PARAMETROS
pathApp = Trim(txtRutaAPI.Text)
pathBamdeja = Trim(txtRutaBandeja.Text)
strParam1 = Trim(txtRuc.Text)
strParam2 = Trim(txtUsuario.Text)
strParam3 = Trim(txtContrasena.Text)
strParam4 = Trim(txtCodigoEnvio.Text)
strParam5 = ""
strParam6 = ""
If Len(strParam1) < 11 Then
MsgBox "Error, Numero de RUC es invalido"
Exit Sub
End If
If Len(strParam2) < 8 Then
MsgBox "Error, Usuario es invalido"
Exit Sub
End If
If Len(strParam4) < 12 Then
MsgBox "Error, Codigo de Envio es invalido"
Exit Sub
End If
If optSend1.Value = True Then
strParam5 = Trim(ActiveSheet.Cells(19, 5).Value) ' numero de transferencia
strParam6 = pathBamdeja & "" & Trim(ActiveSheet.Cells(19, 7).Value)
' archivo zip
End If
If optSend2.Value = True Then
strParam5 = Trim(ActiveSheet.Cells(20, 5).Value) ' numero de transferencia
strParam6 = pathBamdeja & "" & Trim(ActiveSheet.Cells(20, 7).Value)
' archivo zip
End If
'*********************************************************** *****************
i = 0
t1 = 0
'Creando el objeto del COM
Dim objCOM As nsigad_export.CatlTransaction
Set objCOM = New nsigad_export.CatlTransaction
'Seteando los valores de credenciales (es mandatorio)
objCOM.SetPathApplication pathApp 'Ruta donde esta instalado el
API
objCOM.SetRuc strParam1 'Numero de RUC
objCOM.SetUsuario strParam2 'Usuario del RUC
objCOM.SetPassword strParam3 'Clave SOL
objCOM.SetCodigoEnvio strParam4 'Codigo de Envio
'Inicializando el COM (la siguiente linea es mandatoria, siempre tiene
que invocarse)
objCOM.Init_t
'Invocando a la función de enviar Archivo, donde:
'strParam5 = numero de transacción
'strParam6 = ruta completa del archivo a enviar
't1 = parámetro de retorno al invocar a la función
'strXml = parámetro de retorno contiene el acuse de recepción en formato
XML
objCOM.SendFile strParam5, strParam6, t1, strXml
i = t1
'Finalizando el COM (la siguiente linea es mandatoria, siempre tiene
que invocarse)
objCOM.Final_t
'Destruyendo el objeto del COM
Set objCOM = Nothing
'*********************************************************** *****************
'ANALIZANDO LOS VALORES DE RETORNO
If i = 0 Then
MsgBox "Resultado ==> " & CStr(i) & vbNewLine, vbOKOnly, "NSIGAD"
MsgBox "Trama ==> " & strXml, vbOKOnly, "NSIGAD"
Else
strCode = ""
strDescr = ""
If InStr(strXml, "|") > 0 Then
strCode = Mid(strXml, 1, InStr(strXml, "|") - 1)
strDescr = Mid(strXml, InStr(strXml, "|") + 1)
End If
strMensaje = "Resultado ==> " & CStr(i) & vbNewLine
strMensaje = strMensaje & " Error Codigo : " & strCode & vbNewLine
strMensaje = strMensaje & " Error Descripcion : " & strDescr &
vbNewLine & vbNewLine
MsgBox strMensaje, vbOKOnly, "NSIGAD"
End If
'*********************************************************** *****************
End Sub
-----------------------
esto es la segunda parte
------------------------
'
'SUNAT
'
'Author : Leonardo Torres Ochoa (leonardo1626@hotmail.com)
'
'Create : 19/09/2009 22:49:07
'LastUpdate : 14/10/2009 17:08:07
'
Private Sub cmdRecibir_Click()
Dim strParam1 As String
Dim strParam2 As String
Dim strParam3 As String
Dim strParam4 As String
Dim strParam5 As String
Dim parametroConsulta As String
Dim respuestaConsulta As String
Dim strTitle As String
Dim strDescr As String
Dim strMensaje As String
Dim pathApp As String
Dim i As Long
Dim t1 As Long
'*********************************************************** *****************
'CONSISTENCIA DE PARAMETROS
If Len(Trim(Hoja2.txtNroTicket.Text)) = 0 Then
MsgBox "Ingrese un numero de ticket", vbExclamation, "Error"
Exit Sub
End If
txtResultado.Text = ""
pathApp = Trim(Hoja1.txtRutaAPI.Text)
strParam1 = Trim(Hoja2.c_txtRuc.Text)
strParam2 = Trim(Hoja2.c_txtUsuario.Text)
strParam3 = Trim(Hoja2.c_txtContrasena.Text)
strParam4 = Trim(Hoja2.c_txtCodigoEnvio.Text)
strParam5 = Trim(Hoja2.txtNroTicket.Text)
If Len(strParam1) < 11 Then
MsgBox "Error, Numero de RUC es invalido"
Exit Sub
End If
If Len(strParam2) < 8 Then
MsgBox "Error, Usuario es invalido"
Exit Sub
End If
If Len(strParam4) < 12 Then
MsgBox "Error, Codigo de Envio es invalido"
Exit Sub
End If
'*********************************************************** *****************
i = 0
t1 = 0
'Creando el objeto del COM
Dim objCOM As nsigad_export.CatlTransaction
Set objCOM = New nsigad_export.CatlTransaction
'Seteando los valores de credenciales (es mandatorio)
objCOM.SetPathApplication pathApp 'Ruta donde esta instalado el
API
objCOM.SetRuc strParam1 'Numero de RUC
objCOM.SetUsuario strParam2 'Usuario del RUC
objCOM.SetPassword strParam3 'Clave SOL
objCOM.SetCodigoEnvio strParam4 'Codigo de Envio
'Inicializando el COM (la siguiente linea es mandatoria, siempre tiene
que invocarse)
objCOM.Init_t
'Invocando a la función de recepcion de Archivo, donde:
'parametroConsulta = tipo de consulta de tipo 1 (este sera formateado
en formato XML
' ej:
' <consulta><tipo>1</tipo><parametros><numeroTicket></numeroTicket ></parametros></consulta>
'
't1 = parámetro de retorno al invocar a la función
'respuestaConsulta = parámetro de retorno contiene el tipo de respuesta
y el archivo recepcionado
parametroConsulta = "<consulta><tipo>1</tipo><parametros><numeroTicket>"
& strParam5 & "</numeroTicket></parametros></consulta>"
objCOM.ReceiveFile parametroConsulta, t1, respuestaConsulta
i = t1
'Finalizando el COM (la siguiente linea es mandatoria, siempre tiene
que invocarse)
objCOM.Final_t
'Destruyendo el objeto del COM
Set objCOM = Nothing
'*********************************************************** *****************
'ANALIZANDO LOS VALORES DE RETORNO
If i = 0 Then
MsgBox "Resultado ==> " & CStr(i) & vbNewLine, vbOKOnly, "NSIGAD"
Else
strCode = ""
strDescr = ""
If InStr(respuestaConsulta, "|") > 0 Then
strCode = Mid(respuestaConsulta, 1, InStr(respuestaConsulta,
"|") - 1)
strDescr = Mid(respuestaConsulta, InStr(respuestaConsulta, "|")
+ 1)
End If
strMensaje = "Resultado ==> " & CStr(i) & vbNewLine
strMensaje = strMensaje & " Error Codigo : " & strCode & vbNewLine
strMensaje = strMensaje & " Error Descripcion : " & strDescr &
vbNewLine & vbNewLine
MsgBox strMensaje, vbOKOnly, "NSIGAD"
End If
txtResultado.Text = respuestaConsulta
'*********************************************************** *****************
End Sub
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
por favor me pueden ayudar a migrar de visual basic a xharbour este codigo
-
- Mensajes: 16
- Registrado: Sab Jul 22, 2006 1:37 pm
-
- Mensajes: 56
- Registrado: Jue Ene 08, 2009 5:40 pm
por favor me pueden ayudar a migrar de visual basic a xharbour este codigo
Este codigo quieres enviarlo a xailer o a xharbour?
Saludos
Fredy Gonzales P.
Lima - Peru
"vladimir zorrilla" <cps_net@hotmail.com> escribió en el mensaje
news:4aff2aac$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
>
> '
> 'SUNAT
> '
> 'Author : Leonardo Torres Ochoa (leonardo1626@hotmail.com)
> '
> 'Create : 11/09/2009 23:13:07
> 'LastUpdate : 14/10/2009 17:08:07
> '
>
> Private Sub CommandButton1_Click()
>
> Dim strParam1 As String
> Dim strParam2 As String
> Dim strParam3 As String
> Dim strParam4 As String
> Dim strParam5 As String
> Dim strParam6 As String
> Dim strXml As String
>
> Dim strTitle As String
> Dim strDescr As String
> Dim strMensaje As String
>
>
> Dim pathApp As String
> Dim pathBamdeja As String
> Dim i As Long
> Dim t1 As Long
>
>
> '*********************************************************** *****************
> 'CONSISTENCIA DE PARAMETROS
>
> pathApp = Trim(txtRutaAPI.Text)
> pathBamdeja = Trim(txtRutaBandeja.Text)
> strParam1 = Trim(txtRuc.Text)
> strParam2 = Trim(txtUsuario.Text)
> strParam3 = Trim(txtContrasena.Text)
> strParam4 = Trim(txtCodigoEnvio.Text)
> strParam5 = ""
> strParam6 = ""
>
> If Len(strParam1) < 11 Then
> MsgBox "Error, Numero de RUC es invalido"
> Exit Sub
> End If
> If Len(strParam2) < 8 Then
> MsgBox "Error, Usuario es invalido"
> Exit Sub
> End If
> If Len(strParam4) < 12 Then
> MsgBox "Error, Codigo de Envio es invalido"
> Exit Sub
> End If
>
> If optSend1.Value = True Then
> strParam5 = Trim(ActiveSheet.Cells(19, 5).Value) ' numero de
> transferencia
> strParam6 = pathBamdeja & "" & Trim(ActiveSheet.Cells(19, 7).Value)
> ' archivo zip
> End If
> If optSend2.Value = True Then
> strParam5 = Trim(ActiveSheet.Cells(20, 5).Value) ' numero de
> transferencia
> strParam6 = pathBamdeja & "" & Trim(ActiveSheet.Cells(20, 7).Value)
> ' archivo zip
> End If
>
> '*********************************************************** *****************
>
>
> i = 0
> t1 = 0
> 'Creando el objeto del COM
> Dim objCOM As nsigad_export.CatlTransaction
> Set objCOM = New nsigad_export.CatlTransaction
>
> 'Seteando los valores de credenciales (es mandatorio)
> objCOM.SetPathApplication pathApp 'Ruta donde esta instalado el
> API
> objCOM.SetRuc strParam1 'Numero de RUC
> objCOM.SetUsuario strParam2 'Usuario del RUC
> objCOM.SetPassword strParam3 'Clave SOL
> objCOM.SetCodigoEnvio strParam4 'Codigo de Envio
>
> 'Inicializando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Init_t
>
> 'Invocando a la función de enviar Archivo, donde:
> 'strParam5 = numero de transacción
> 'strParam6 = ruta completa del archivo a enviar
> 't1 = parámetro de retorno al invocar a la función
> 'strXml = parámetro de retorno contiene el acuse de recepción en
> formato
> XML
> objCOM.SendFile strParam5, strParam6, t1, strXml
> i = t1
>
> 'Finalizando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Final_t
>
> 'Destruyendo el objeto del COM
> Set objCOM = Nothing
>
>
>
> '*********************************************************** *****************
> 'ANALIZANDO LOS VALORES DE RETORNO
>
> If i = 0 Then
> MsgBox "Resultado ==> " & CStr(i) & vbNewLine, vbOKOnly, "NSIGAD"
> MsgBox "Trama ==> " & strXml, vbOKOnly, "NSIGAD"
> Else
> strCode = ""
> strDescr = ""
> If InStr(strXml, "|") > 0 Then
> strCode = Mid(strXml, 1, InStr(strXml, "|") - 1)
> strDescr = Mid(strXml, InStr(strXml, "|") + 1)
> End If
> strMensaje = "Resultado ==> " & CStr(i) & vbNewLine
> strMensaje = strMensaje & " Error Codigo : " & strCode &
> vbNewLine
> strMensaje = strMensaje & " Error Descripcion : " & strDescr &
> vbNewLine & vbNewLine
> MsgBox strMensaje, vbOKOnly, "NSIGAD"
> End If
>
> '*********************************************************** *****************
>
>
> End Sub
>
>
> -----------------------
> esto es la segunda parte
> ------------------------
>
> '
> 'SUNAT
> '
> 'Author : Leonardo Torres Ochoa (leonardo1626@hotmail.com)
> '
> 'Create : 19/09/2009 22:49:07
> 'LastUpdate : 14/10/2009 17:08:07
> '
>
> Private Sub cmdRecibir_Click()
>
> Dim strParam1 As String
> Dim strParam2 As String
> Dim strParam3 As String
> Dim strParam4 As String
> Dim strParam5 As String
> Dim parametroConsulta As String
> Dim respuestaConsulta As String
> Dim strTitle As String
> Dim strDescr As String
> Dim strMensaje As String
> Dim pathApp As String
> Dim i As Long
> Dim t1 As Long
>
>
>
> '*********************************************************** *****************
> 'CONSISTENCIA DE PARAMETROS
>
> If Len(Trim(Hoja2.txtNroTicket.Text)) = 0 Then
> MsgBox "Ingrese un numero de ticket", vbExclamation, "Error"
> Exit Sub
> End If
>
> txtResultado.Text = ""
> pathApp = Trim(Hoja1.txtRutaAPI.Text)
> strParam1 = Trim(Hoja2.c_txtRuc.Text)
> strParam2 = Trim(Hoja2.c_txtUsuario.Text)
> strParam3 = Trim(Hoja2.c_txtContrasena.Text)
> strParam4 = Trim(Hoja2.c_txtCodigoEnvio.Text)
> strParam5 = Trim(Hoja2.txtNroTicket.Text)
>
> If Len(strParam1) < 11 Then
> MsgBox "Error, Numero de RUC es invalido"
> Exit Sub
> End If
> If Len(strParam2) < 8 Then
> MsgBox "Error, Usuario es invalido"
> Exit Sub
> End If
> If Len(strParam4) < 12 Then
> MsgBox "Error, Codigo de Envio es invalido"
> Exit Sub
> End If
>
> '*********************************************************** *****************
>
> i = 0
> t1 = 0
>
> 'Creando el objeto del COM
> Dim objCOM As nsigad_export.CatlTransaction
> Set objCOM = New nsigad_export.CatlTransaction
>
> 'Seteando los valores de credenciales (es mandatorio)
> objCOM.SetPathApplication pathApp 'Ruta donde esta instalado el
> API
> objCOM.SetRuc strParam1 'Numero de RUC
> objCOM.SetUsuario strParam2 'Usuario del RUC
> objCOM.SetPassword strParam3 'Clave SOL
> objCOM.SetCodigoEnvio strParam4 'Codigo de Envio
>
> 'Inicializando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Init_t
>
> 'Invocando a la función de recepcion de Archivo, donde:
> 'parametroConsulta = tipo de consulta de tipo 1 (este sera formateado
> en formato XML
> ' ej:
> '
> <consulta><tipo>1</tipo><parametros><numeroTicket></numeroTicket ></parametros></consulta>
> '
> 't1 = parámetro de retorno al invocar a la función
> 'respuestaConsulta = parámetro de retorno contiene el tipo de respuesta
> y el archivo recepcionado
>
> parametroConsulta =
> "<consulta><tipo>1</tipo><parametros><numeroTicket>"
> & strParam5 & "</numeroTicket></parametros></consulta>"
> objCOM.ReceiveFile parametroConsulta, t1, respuestaConsulta
> i = t1
>
> 'Finalizando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Final_t
>
> 'Destruyendo el objeto del COM
> Set objCOM = Nothing
>
>
>
> '*********************************************************** *****************
> 'ANALIZANDO LOS VALORES DE RETORNO
> If i = 0 Then
> MsgBox "Resultado ==> " & CStr(i) & vbNewLine, vbOKOnly, "NSIGAD"
> Else
> strCode = ""
> strDescr = ""
> If InStr(respuestaConsulta, "|") > 0 Then
> strCode = Mid(respuestaConsulta, 1, InStr(respuestaConsulta,
> "|") - 1)
> strDescr = Mid(respuestaConsulta, InStr(respuestaConsulta, "|")
> + 1)
> End If
> strMensaje = "Resultado ==> " & CStr(i) & vbNewLine
> strMensaje = strMensaje & " Error Codigo : " & strCode &
> vbNewLine
> strMensaje = strMensaje & " Error Descripcion : " & strDescr &
> vbNewLine & vbNewLine
> MsgBox strMensaje, vbOKOnly, "NSIGAD"
> End If
>
> txtResultado.Text = respuestaConsulta
>
> '*********************************************************** *****************
>
>
>End Sub
>
>
>
Saludos
Fredy Gonzales P.
Lima - Peru
"vladimir zorrilla" <cps_net@hotmail.com> escribió en el mensaje
news:4aff2aac$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
>
> '
> 'SUNAT
> '
> 'Author : Leonardo Torres Ochoa (leonardo1626@hotmail.com)
> '
> 'Create : 11/09/2009 23:13:07
> 'LastUpdate : 14/10/2009 17:08:07
> '
>
> Private Sub CommandButton1_Click()
>
> Dim strParam1 As String
> Dim strParam2 As String
> Dim strParam3 As String
> Dim strParam4 As String
> Dim strParam5 As String
> Dim strParam6 As String
> Dim strXml As String
>
> Dim strTitle As String
> Dim strDescr As String
> Dim strMensaje As String
>
>
> Dim pathApp As String
> Dim pathBamdeja As String
> Dim i As Long
> Dim t1 As Long
>
>
> '*********************************************************** *****************
> 'CONSISTENCIA DE PARAMETROS
>
> pathApp = Trim(txtRutaAPI.Text)
> pathBamdeja = Trim(txtRutaBandeja.Text)
> strParam1 = Trim(txtRuc.Text)
> strParam2 = Trim(txtUsuario.Text)
> strParam3 = Trim(txtContrasena.Text)
> strParam4 = Trim(txtCodigoEnvio.Text)
> strParam5 = ""
> strParam6 = ""
>
> If Len(strParam1) < 11 Then
> MsgBox "Error, Numero de RUC es invalido"
> Exit Sub
> End If
> If Len(strParam2) < 8 Then
> MsgBox "Error, Usuario es invalido"
> Exit Sub
> End If
> If Len(strParam4) < 12 Then
> MsgBox "Error, Codigo de Envio es invalido"
> Exit Sub
> End If
>
> If optSend1.Value = True Then
> strParam5 = Trim(ActiveSheet.Cells(19, 5).Value) ' numero de
> transferencia
> strParam6 = pathBamdeja & "" & Trim(ActiveSheet.Cells(19, 7).Value)
> ' archivo zip
> End If
> If optSend2.Value = True Then
> strParam5 = Trim(ActiveSheet.Cells(20, 5).Value) ' numero de
> transferencia
> strParam6 = pathBamdeja & "" & Trim(ActiveSheet.Cells(20, 7).Value)
> ' archivo zip
> End If
>
> '*********************************************************** *****************
>
>
> i = 0
> t1 = 0
> 'Creando el objeto del COM
> Dim objCOM As nsigad_export.CatlTransaction
> Set objCOM = New nsigad_export.CatlTransaction
>
> 'Seteando los valores de credenciales (es mandatorio)
> objCOM.SetPathApplication pathApp 'Ruta donde esta instalado el
> API
> objCOM.SetRuc strParam1 'Numero de RUC
> objCOM.SetUsuario strParam2 'Usuario del RUC
> objCOM.SetPassword strParam3 'Clave SOL
> objCOM.SetCodigoEnvio strParam4 'Codigo de Envio
>
> 'Inicializando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Init_t
>
> 'Invocando a la función de enviar Archivo, donde:
> 'strParam5 = numero de transacción
> 'strParam6 = ruta completa del archivo a enviar
> 't1 = parámetro de retorno al invocar a la función
> 'strXml = parámetro de retorno contiene el acuse de recepción en
> formato
> XML
> objCOM.SendFile strParam5, strParam6, t1, strXml
> i = t1
>
> 'Finalizando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Final_t
>
> 'Destruyendo el objeto del COM
> Set objCOM = Nothing
>
>
>
> '*********************************************************** *****************
> 'ANALIZANDO LOS VALORES DE RETORNO
>
> If i = 0 Then
> MsgBox "Resultado ==> " & CStr(i) & vbNewLine, vbOKOnly, "NSIGAD"
> MsgBox "Trama ==> " & strXml, vbOKOnly, "NSIGAD"
> Else
> strCode = ""
> strDescr = ""
> If InStr(strXml, "|") > 0 Then
> strCode = Mid(strXml, 1, InStr(strXml, "|") - 1)
> strDescr = Mid(strXml, InStr(strXml, "|") + 1)
> End If
> strMensaje = "Resultado ==> " & CStr(i) & vbNewLine
> strMensaje = strMensaje & " Error Codigo : " & strCode &
> vbNewLine
> strMensaje = strMensaje & " Error Descripcion : " & strDescr &
> vbNewLine & vbNewLine
> MsgBox strMensaje, vbOKOnly, "NSIGAD"
> End If
>
> '*********************************************************** *****************
>
>
> End Sub
>
>
> -----------------------
> esto es la segunda parte
> ------------------------
>
> '
> 'SUNAT
> '
> 'Author : Leonardo Torres Ochoa (leonardo1626@hotmail.com)
> '
> 'Create : 19/09/2009 22:49:07
> 'LastUpdate : 14/10/2009 17:08:07
> '
>
> Private Sub cmdRecibir_Click()
>
> Dim strParam1 As String
> Dim strParam2 As String
> Dim strParam3 As String
> Dim strParam4 As String
> Dim strParam5 As String
> Dim parametroConsulta As String
> Dim respuestaConsulta As String
> Dim strTitle As String
> Dim strDescr As String
> Dim strMensaje As String
> Dim pathApp As String
> Dim i As Long
> Dim t1 As Long
>
>
>
> '*********************************************************** *****************
> 'CONSISTENCIA DE PARAMETROS
>
> If Len(Trim(Hoja2.txtNroTicket.Text)) = 0 Then
> MsgBox "Ingrese un numero de ticket", vbExclamation, "Error"
> Exit Sub
> End If
>
> txtResultado.Text = ""
> pathApp = Trim(Hoja1.txtRutaAPI.Text)
> strParam1 = Trim(Hoja2.c_txtRuc.Text)
> strParam2 = Trim(Hoja2.c_txtUsuario.Text)
> strParam3 = Trim(Hoja2.c_txtContrasena.Text)
> strParam4 = Trim(Hoja2.c_txtCodigoEnvio.Text)
> strParam5 = Trim(Hoja2.txtNroTicket.Text)
>
> If Len(strParam1) < 11 Then
> MsgBox "Error, Numero de RUC es invalido"
> Exit Sub
> End If
> If Len(strParam2) < 8 Then
> MsgBox "Error, Usuario es invalido"
> Exit Sub
> End If
> If Len(strParam4) < 12 Then
> MsgBox "Error, Codigo de Envio es invalido"
> Exit Sub
> End If
>
> '*********************************************************** *****************
>
> i = 0
> t1 = 0
>
> 'Creando el objeto del COM
> Dim objCOM As nsigad_export.CatlTransaction
> Set objCOM = New nsigad_export.CatlTransaction
>
> 'Seteando los valores de credenciales (es mandatorio)
> objCOM.SetPathApplication pathApp 'Ruta donde esta instalado el
> API
> objCOM.SetRuc strParam1 'Numero de RUC
> objCOM.SetUsuario strParam2 'Usuario del RUC
> objCOM.SetPassword strParam3 'Clave SOL
> objCOM.SetCodigoEnvio strParam4 'Codigo de Envio
>
> 'Inicializando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Init_t
>
> 'Invocando a la función de recepcion de Archivo, donde:
> 'parametroConsulta = tipo de consulta de tipo 1 (este sera formateado
> en formato XML
> ' ej:
> '
> <consulta><tipo>1</tipo><parametros><numeroTicket></numeroTicket ></parametros></consulta>
> '
> 't1 = parámetro de retorno al invocar a la función
> 'respuestaConsulta = parámetro de retorno contiene el tipo de respuesta
> y el archivo recepcionado
>
> parametroConsulta =
> "<consulta><tipo>1</tipo><parametros><numeroTicket>"
> & strParam5 & "</numeroTicket></parametros></consulta>"
> objCOM.ReceiveFile parametroConsulta, t1, respuestaConsulta
> i = t1
>
> 'Finalizando el COM (la siguiente linea es mandatoria, siempre tiene
> que invocarse)
> objCOM.Final_t
>
> 'Destruyendo el objeto del COM
> Set objCOM = Nothing
>
>
>
> '*********************************************************** *****************
> 'ANALIZANDO LOS VALORES DE RETORNO
> If i = 0 Then
> MsgBox "Resultado ==> " & CStr(i) & vbNewLine, vbOKOnly, "NSIGAD"
> Else
> strCode = ""
> strDescr = ""
> If InStr(respuestaConsulta, "|") > 0 Then
> strCode = Mid(respuestaConsulta, 1, InStr(respuestaConsulta,
> "|") - 1)
> strDescr = Mid(respuestaConsulta, InStr(respuestaConsulta, "|")
> + 1)
> End If
> strMensaje = "Resultado ==> " & CStr(i) & vbNewLine
> strMensaje = strMensaje & " Error Codigo : " & strCode &
> vbNewLine
> strMensaje = strMensaje & " Error Descripcion : " & strDescr &
> vbNewLine & vbNewLine
> MsgBox strMensaje, vbOKOnly, "NSIGAD"
> End If
>
> txtResultado.Text = respuestaConsulta
>
> '*********************************************************** *****************
>
>
>End Sub
>
>
>