Correciones en cancelacion de facturas
This commit is contained in:
@@ -4820,24 +4820,55 @@ Namespace Modelos
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Vigencia.Estado.ToUpper().Contains("CANCELADO") Then
|
If Vigencia.Estado.ToUpper().Contains("CANCELADO") Then
|
||||||
ContinuarCancelacion = False
|
ContinuarCancelacion = False
|
||||||
ObtenerAcuse = True
|
ObtenerAcuse = True
|
||||||
Dim solicitud = New WSGF.Service1SoapClient()
|
RequiereAceptacion = False
|
||||||
Dim acuse = solicitud.GetAcuse(UsuarioActual.Empresa.RFC, "rene.molina@adsistemas.mx", "rene2018", FolioFiscal)
|
|
||||||
|
|
||||||
If acuse.Estado = 0 Then
|
'VERIFICA EN EL SERVICIO SI SE CANCELO
|
||||||
Dim xmlAcuse = New System.Xml.XmlDocument()
|
Try
|
||||||
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64))
|
Dim solicitud = New WSGF.Service1SoapClient()
|
||||||
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")(0).InnerText
|
Dim acuse = solicitud.GetAcuse(UsuarioActual.Empresa.RFC, "rene.molina@adsistemas.mx", "rene2018", FolioFiscal)
|
||||||
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate()
|
|
||||||
CveEstatus = 5
|
If acuse.Estado = 0 Then
|
||||||
Else
|
Dim xmlAcuse = New System.Xml.XmlDocument()
|
||||||
|
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64))
|
||||||
|
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")(0).InnerText
|
||||||
|
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate()
|
||||||
|
CveEstatus = 5
|
||||||
|
Else
|
||||||
|
CancelacionFecha = Now.Date
|
||||||
|
CancelacionAcuse = ""
|
||||||
|
CveEstatus = 5
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
GuardaLog(ex.ToString())
|
||||||
CancelacionFecha = Now.Date
|
CancelacionFecha = Now.Date
|
||||||
CancelacionAcuse = ""
|
CancelacionAcuse = ""
|
||||||
CveEstatus = 5
|
End Try
|
||||||
|
|
||||||
|
'SI NO SE PUDO OBTENER DEL SERVICIO, UTILIZA EL METODO DE CANCELACION PARA OBTENER EL ACUSE
|
||||||
|
If CancelacionAcuse = "" Then
|
||||||
|
If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then
|
||||||
|
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
|
||||||
|
If RequiereAceptacion Then
|
||||||
|
CancelacionFecha = Now.Date
|
||||||
|
CveEstatus = 20
|
||||||
|
Else
|
||||||
|
CancelacionFecha = ObjCancelacion.CancelacionFecha
|
||||||
|
CveEstatus = 5
|
||||||
|
End If
|
||||||
|
CancelacionAcuse = ObjCancelacion.CancelacionAcuse
|
||||||
|
Else
|
||||||
|
Retorno.Mensaje = "Los servicios de cancelación del SAT no se encuentran disponibles o presentan time out. Intente de nuevo en unos minutos.<br/>Origen del error: WebService www.sat.gob.mx"
|
||||||
|
Retorno.TipoMensaje = TipoMensaje.MsgError
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
ElseIf Vigencia.Estado.ToUpper().Contains("VIGENTE") Then
|
ElseIf Vigencia.Estado.ToUpper().Contains("VIGENTE") Then
|
||||||
|
|
||||||
If Vigencia.EstatusCancelacion.ToUpper() = "EN PROCESO" Then
|
If Vigencia.EstatusCancelacion.ToUpper() = "EN PROCESO" Then
|
||||||
@@ -9304,21 +9335,28 @@ Namespace Modelos
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Property GlobalDTContaConceptosContables(CveConceptoContable As Integer) As DataTable
|
||||||
|
|
||||||
Property GlobalDTContaConceptosContables(CvePlantillaPoliza As Integer) As DataTable
|
|
||||||
Get
|
Get
|
||||||
If CvePlantillaPoliza <> -1 Then
|
Dim AppNombre As String = String.Format("GlobalDTContaConceptosContables")
|
||||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTContaConceptosContables"), DataTable), String.Format("CvePlantillaPoliza = {0}", CvePlantillaPoliza), "", DataViewRowState.CurrentRows)
|
'sino existe, recarga los datos
|
||||||
|
If HttpContext.Current.Application(AppNombre) Is Nothing Then
|
||||||
|
Using ObjContabilidad As New ClsContabilidad
|
||||||
|
If ObjContabilidad.GetConta_ConceptosContables() Then HttpContext.Current.Application(AppNombre) = ObjContabilidad.DtResultados Else HttpContext.Current.Application(AppNombre) = Nothing
|
||||||
|
End Using
|
||||||
|
|
||||||
|
End If
|
||||||
|
If CveConceptoContable <> -1 Then
|
||||||
|
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Format("CveConceptoContable = {0}", CveConceptoContable), "", DataViewRowState.CurrentRows)
|
||||||
GlobalDTContaConceptosContables = Dv.ToTable
|
GlobalDTContaConceptosContables = Dv.ToTable
|
||||||
Dv.Dispose()
|
Dv.Dispose()
|
||||||
Else
|
Else
|
||||||
GlobalDTContaConceptosContables = DirectCast(HttpContext.Current.Application("GlobalDTContaConceptosContables"), DataTable)
|
GlobalDTContaConceptosContables = DirectCast(HttpContext.Current.Application(AppNombre), DataTable)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Get
|
End Get
|
||||||
Set(value As DataTable)
|
Set(value As DataTable)
|
||||||
HttpContext.Current.Application("GlobalDTContaConceptosContables") = value
|
Dim AppNombre As String = String.Format("GlobalDTContaConceptosContables")
|
||||||
|
HttpContext.Current.Application(AppNombre) = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
#End Region
|
#End Region
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ Public Class Timbrado
|
|||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
Dim MsgCancelacion As New StringBuilder
|
Dim MsgCancelacion As New StringBuilder
|
||||||
|
|
||||||
|
If CvePACCancelacion = 3 Then
|
||||||
|
ValidaFactura = False
|
||||||
|
End If
|
||||||
|
|
||||||
If Not (Empresa.Funcionalidad(529) = "1") Then
|
If Not (Empresa.Funcionalidad(529) = "1") Then
|
||||||
If ValidaFactura Then
|
If ValidaFactura Then
|
||||||
Dim Vigencia = VerificarVigenciaSAT(FolioFiscal, RFCEmisor, RFCReceptor, Total.ToString(), True)
|
Dim Vigencia = VerificarVigenciaSAT(FolioFiscal, RFCEmisor, RFCReceptor, Total.ToString(), True)
|
||||||
@@ -448,28 +452,42 @@ Public Class Timbrado
|
|||||||
Dim resp As Profact.TimbraCFDI.ResultadoConsulta
|
Dim resp As Profact.TimbraCFDI.ResultadoConsulta
|
||||||
resp = conector.ObtieneCFDI(RFCEmisor, FolioFiscal)
|
resp = conector.ObtieneCFDI(RFCEmisor, FolioFiscal)
|
||||||
MsgCancelacion.AppendFormat("-3.3")
|
MsgCancelacion.AppendFormat("-3.3")
|
||||||
If resultadoCancelacion.Exitoso Then
|
|
||||||
|
'VERIFICA SI SE CANCELO O FUE CANCELADO PREVIAMENTE
|
||||||
|
If resultadoCancelacion.Exitoso OrElse resultadoCancelacion.NumeroError = "202" Then
|
||||||
MsgCancelacion.AppendFormat("-3.4")
|
MsgCancelacion.AppendFormat("-3.4")
|
||||||
CancelacionMensaje = resultadoCancelacion.Descripcion
|
CancelacionMensaje = resultadoCancelacion.Descripcion
|
||||||
Dim xmlDoc As New System.Xml.XmlDocument()
|
Dim xmlDoc As New System.Xml.XmlDocument()
|
||||||
|
|
||||||
|
MsgCancelacion.AppendFormat("-3.4.1")
|
||||||
Try
|
Try
|
||||||
xmlDoc.LoadXml(Encoding.UTF8.GetString(Convert.FromBase64String(resp.Xml)))
|
xmlDoc.LoadXml(Encoding.UTF8.GetString(Convert.FromBase64String(resp.Xml)))
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
xmlDoc.LoadXml(resp.Xml)
|
If resp.NumeroError.ToEntero() > 0 Then
|
||||||
|
CancelacionMensaje = resp.Descripcion
|
||||||
|
Else
|
||||||
|
Try
|
||||||
|
xmlDoc.LoadXml(resp.Xml)
|
||||||
|
Catch ex2 As Exception
|
||||||
|
Me.OnError("Ocurrió un error al leer el xml", ex)
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
MsgCancelacion.AppendFormat("-3.4.1")
|
If xmlDoc.HasChildNodes Then
|
||||||
|
Dim xpath As String = "Acuse/Folios"
|
||||||
|
Dim nodes = xmlDoc.SelectNodes(xpath)
|
||||||
|
CancelacionState = xmlDoc.GetElementsByTagName("EstatusUUID")(0).InnerText.ToEntero
|
||||||
|
MsgCancelacion.AppendFormat("-3.4.2")
|
||||||
|
xpath = "Acuse/Signature"
|
||||||
|
nodes = xmlDoc.SelectNodes(xpath)
|
||||||
|
MsgCancelacion.AppendFormat("-3.4.3")
|
||||||
|
CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText
|
||||||
|
CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate
|
||||||
|
Else
|
||||||
|
CancelacionFecha = Now
|
||||||
|
End If
|
||||||
|
|
||||||
Dim xpath As String = "Acuse/Folios"
|
|
||||||
Dim nodes = xmlDoc.SelectNodes(xpath)
|
|
||||||
CancelacionState = xmlDoc.GetElementsByTagName("EstatusUUID")(0).InnerText.ToEntero
|
|
||||||
MsgCancelacion.AppendFormat("-3.4.2")
|
|
||||||
xpath = "Acuse/Signature"
|
|
||||||
nodes = xmlDoc.SelectNodes(xpath)
|
|
||||||
MsgCancelacion.AppendFormat("-3.4.3")
|
|
||||||
CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText
|
|
||||||
CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate
|
|
||||||
Retorno = True
|
Retorno = True
|
||||||
Else
|
Else
|
||||||
MsgCancelacion.AppendFormat("-3.5")
|
MsgCancelacion.AppendFormat("-3.5")
|
||||||
|
|||||||
Reference in New Issue
Block a user