Crm hasta punto de Reportes
This commit is contained in:
@@ -2173,64 +2173,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
Return Fact
|
||||
End Function
|
||||
Private Function GuardaArchivoXML(Archivo As String) As Modelos.eFactura
|
||||
' , Destino As String, Temporal As String
|
||||
Dim Retorno As Modelos.eFactura = Nothing
|
||||
|
||||
If File.Exists(Archivo) Then
|
||||
Dim NombreArchivo As String = Path.GetFileName(Archivo)
|
||||
Dim invalidChars As Char() = Path.GetInvalidFileNameChars()
|
||||
Dim invalidString As String = Regex.Escape(New String(invalidChars))
|
||||
Dim valid As String = Regex.Replace(NombreArchivo, (Convert.ToString("[") & invalidString) + "]", "")
|
||||
|
||||
NombreArchivo = valid
|
||||
|
||||
Try
|
||||
Dim XMLDoc As New XmlDocument()
|
||||
|
||||
XMLDoc.Load(Archivo)
|
||||
Retorno = CargaDatosXML(XMLDoc)
|
||||
|
||||
Catch exx As XmlException
|
||||
Retorno = Nothing
|
||||
'Dim texto As Dynamic = File.ReadAllText(Archivo)
|
||||
Dim txt_utf8 As New UTF8Encoding()
|
||||
'REEMPLAZA CARACTERES ESPECIALES Y VUELVE A LEER EL DOCUMENTO
|
||||
|
||||
'texto = RemoveIllegalXMLCharacters(texto)
|
||||
' SE RENOMBRA EL ARCHIVO, PERO SE QUITO POR SI NO COINCIDE EL PDF CON EL NOMBRE
|
||||
'Archivo = Archivo.ToUpper.Replace(".XML", "-2.XML")
|
||||
'NombreArchivo = IO.Path.GetFileName(Archivo)
|
||||
'File.WriteAllText(Archivo, texto)
|
||||
|
||||
|
||||
' Dim xmltr As New XmlTextReader(New MemoryStream(RemoveIllegalXMLCharacters(texto)))
|
||||
Dim XMLDoc As New XmlDocument()
|
||||
|
||||
Try
|
||||
XMLDoc.Load(Archivo)
|
||||
Retorno = CargaDatosXML(XMLDoc)
|
||||
Catch ex As Exception
|
||||
Retorno = Nothing
|
||||
|
||||
|
||||
|
||||
End Try
|
||||
Catch ex As Exception
|
||||
|
||||
|
||||
Retorno = Nothing
|
||||
End Try
|
||||
|
||||
'si se cargaron todos los datos
|
||||
If Retorno IsNot Nothing AndAlso Not String.IsNullOrEmpty(Retorno.TFDUUID) Then
|
||||
'XML
|
||||
Retorno.ArchivoXML = NombreArchivo
|
||||
End If
|
||||
End If
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
Private Sub CargaImpuestosXML(XMLDoc As XmlDocument)
|
||||
Dim Prefijo As String = If(String.IsNullOrEmpty(XMLDoc.DocumentElement.Prefix), "cfd", XMLDoc.DocumentElement.Prefix)
|
||||
Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3"
|
||||
@@ -3338,7 +3281,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
|
||||
Dim SXML As String = File.ReadAllText(Archivo).Replace(vbLf, " ").Replace(vbCrLf, " ")
|
||||
|
||||
SXML = SXML.Replace("o;?", "")
|
||||
SXML = SXML.Trim((Convert.ToChar(0)))
|
||||
|
||||
XMLDoc.LoadXml(SXML)
|
||||
@@ -4508,7 +4451,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
|
||||
Dim SXML As String = File.ReadAllText(Archivo).Replace(vbLf, " ").Replace(vbCrLf, " ")
|
||||
|
||||
SXML = SXML.Replace("o;?", "")
|
||||
SXML = SXML.Trim((Convert.ToChar(0)))
|
||||
|
||||
XMLDoc.LoadXml(SXML)
|
||||
|
||||
Reference in New Issue
Block a user