This commit is contained in:
138
Ashx/SIGWeb.ashx
138
Ashx/SIGWeb.ashx
@@ -1529,6 +1529,144 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
xfile.SetAttributeValue("EXT", Path.GetExtension(urfile))
|
||||
xfile.SetAttributeValue("urlfile", urfile)
|
||||
xfolder.Add(xfile)
|
||||
Dim fecha As String = ""
|
||||
Dim uuid As String = ""
|
||||
If Path.GetExtension(urfile).ToUpper() = ".XML" Then
|
||||
fecha = ""
|
||||
uuid = ""
|
||||
Dim settings As System.Xml.XmlReaderSettings = New System.Xml.XmlReaderSettings()
|
||||
settings.ConformanceLevel = System.Xml.ConformanceLevel.Fragment
|
||||
settings.IgnoreWhitespace = True
|
||||
settings.IgnoreComments = True
|
||||
Using xtr As System.Xml.XmlReader = System.Xml.XmlReader.Create(urfile, settings)
|
||||
Dim canread As Boolean = True
|
||||
Dim keyComprobante As String = "cfdi:Comprobante"
|
||||
Dim keyCfdiRelacionados As String = "cfdi:CfdiRelacionados"
|
||||
Dim keyEmisor As String = "cfdi:Emisor"
|
||||
Dim keyReceptor As String = "cfdi:Receptor"
|
||||
Dim keyConceptos As String = "cfdi:Conceptos"
|
||||
Dim keyImpuestos As String = "cfdi:Impuestos"
|
||||
Dim keyComplemento As String = "cfdi:Complemento"
|
||||
xtr.Read()
|
||||
|
||||
While xtr.Read()
|
||||
If xtr.NodeType = System.Xml.XmlNodeType.Element AndAlso xtr.Name = keyComprobante Then
|
||||
|
||||
Dim Nivel As Integer = xtr.Depth
|
||||
Dim cont As Boolean = xtr.MoveToFirstAttribute()
|
||||
While cont
|
||||
|
||||
Select Case xtr.Name.ToUpper()
|
||||
Case "XMLNS:CFDI"
|
||||
'xmlCFDI.comprobante.xmlns_cfdi = xtr.Value
|
||||
Case "XMLNS:XSI"
|
||||
'xmlCFDI.comprobante.xmlns_xsi = xtr.Value
|
||||
'Case "XSI:SCHEMALOCATION"
|
||||
' xmlCFDI.comprobante.xsi_schemaLocation = xtr.Value
|
||||
'Case "VERSION"
|
||||
' xmlCFDI.comprobante.Version = xtr.Value
|
||||
'Case "SERIE"
|
||||
' xmlCFDI.comprobante.Serie = xtr.Value
|
||||
'Case "FOLIO"
|
||||
' xmlCFDI.comprobante.Folio = xtr.Value
|
||||
Case "FECHA"
|
||||
fecha = xtr.Value
|
||||
'Case "MONEDA"
|
||||
' xmlCFDI.comprobante.Moneda = xtr.Value
|
||||
'Case "SUBTOTAL"
|
||||
' Dim SubTotal As Decimal = 0
|
||||
' Decimal.TryParse(xtr.Value, SubTotal)
|
||||
' xmlCFDI.comprobante.SubTotal = SubTotal
|
||||
'Case "TOTAL"
|
||||
' Dim Total As Decimal = 0
|
||||
' Decimal.TryParse(xtr.Value, Total)
|
||||
' xmlCFDI.comprobante.Total = Total
|
||||
'Case "DESCUENTO"
|
||||
' Dim Descuento As Decimal = 0
|
||||
' Decimal.TryParse(xtr.Value, Descuento)
|
||||
' xmlCFDI.comprobante.Descuento = Descuento
|
||||
'Case "TIPOCAMBIO"
|
||||
' Dim TipoCambio As Decimal = 0
|
||||
' Decimal.TryParse(xtr.Value, TipoCambio)
|
||||
' xmlCFDI.comprobante.TipoCambio = TipoCambio
|
||||
'Case "TIPODECOMPROBANTE"
|
||||
' xmlCFDI.comprobante.TipoDeComprobante = xtr.Value
|
||||
'Case "FORMAPAGO"
|
||||
' xmlCFDI.comprobante.FormaPago = xtr.Value
|
||||
'Case "FORMADEPAGO"
|
||||
' xmlCFDI.comprobante.FormaPago = xtr.Value
|
||||
'Case "METODOPAGO"
|
||||
' xmlCFDI.comprobante.MetodoPago = xtr.Value
|
||||
'Case "METODODEPAGO"
|
||||
' xmlCFDI.comprobante.MetodoPago = xtr.Value
|
||||
'Case "CONDICIONESDEPAGO"
|
||||
' xmlCFDI.comprobante.CondicionesDePago = xtr.Value
|
||||
'Case "LUGAREXPEDICION"
|
||||
' xmlCFDI.comprobante.LugarExpedicion = xtr.Value
|
||||
'Case "CONFIRMACION"
|
||||
' xmlCFDI.comprobante.Confirmacion = xtr.Value
|
||||
'Case "NOCERTIFICADO"
|
||||
' xmlCFDI.comprobante.NoCertificado = xtr.Value
|
||||
'Case "SELLO"
|
||||
' xmlCFDI.comprobante.Sello = xtr.Value
|
||||
'Case "CERTIFICADO"
|
||||
' xmlCFDI.comprobante.Certificado = xtr.Value
|
||||
End Select
|
||||
|
||||
cont = xtr.MoveToNextAttribute()
|
||||
End While
|
||||
|
||||
cont = xtr.MoveToFirstAttribute()
|
||||
While xtr.Read() AndAlso xtr.NodeType <> System.Xml.XmlNodeType.Element
|
||||
End While
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If xtr.NodeType = System.Xml.XmlNodeType.Element AndAlso xtr.Name = keyComplemento Then
|
||||
Dim cDepth As Integer = xtr.Depth
|
||||
While xtr.Read() AndAlso xtr.NodeType <> System.Xml.XmlNodeType.Element
|
||||
End While
|
||||
|
||||
While xtr.Read() AndAlso xtr.Depth > cDepth
|
||||
|
||||
If xtr.NodeType = System.Xml.XmlNodeType.Element AndAlso xtr.LocalName = "TimbreFiscalDigital" Then
|
||||
'xmlCFDI.complemento.xmlns_tfd = xtr.GetAttribute("xmlns:tfd")
|
||||
'xmlCFDI.complemento.xsi_schemaLocation = xtr.GetAttribute("xsi:schemaLocation")
|
||||
'xmlCFDI.complemento.Version = xtr.GetAttribute("Version")
|
||||
uuid = xtr.GetAttribute("UUID")
|
||||
'xmlCFDI.complemento.FechaTimbrado = xtr.GetAttribute("FechaTimbrado")
|
||||
'xmlCFDI.complemento.RfcProvCertif = xtr.GetAttribute("RfcProvCertif")
|
||||
'xmlCFDI.complemento.SelloCFD = If((xmlCFDI.comprobante.Version = "3.3" OrElse xmlCFDI.comprobante.Version = "4.0"), xtr.GetAttribute("SelloCFD"), xtr.GetAttribute("selloCFD"))
|
||||
'xmlCFDI.complemento.NoCertificadoSAT = If(xmlCFDI.comprobante.Version = "3.3", xtr.GetAttribute("NoCertificadoSAT"), xtr.GetAttribute("noCertificadoSAT"))
|
||||
'xmlCFDI.complemento.SelloSAT = If((xmlCFDI.comprobante.Version = "3.3" OrElse xmlCFDI.comprobante.Version = "4.0"), xtr.GetAttribute("SelloSAT"), xtr.GetAttribute("selloSAT"))
|
||||
End If
|
||||
|
||||
|
||||
End While
|
||||
End If
|
||||
End While
|
||||
xtr.Close()
|
||||
xtr.
|
||||
End Using
|
||||
If (System.IO.File.Exists(urfile)) Then
|
||||
Dim fechita As DateTime = fecha.ToDateTime()
|
||||
|
||||
Dim direct As String = $"C:\Users\caudi\Desktop\Nueva carpeta\APH20210302\{fechita:yyyyMMdd}\"
|
||||
|
||||
If Not System.IO.Directory.Exists(direct) Then
|
||||
System.IO.Directory.CreateDirectory(direct)
|
||||
End If
|
||||
Dim fileurl As String = $"{direct}{Path.GetFileName(urfile)}"
|
||||
If uuid.Length Then
|
||||
fileurl = $"{direct}{uuid}{Path.GetExtension(urfile)}"
|
||||
End If
|
||||
System.IO.File.Move(urfile, fileurl)
|
||||
Dim x = ""
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
xmlarchivos.Add(xfolder)
|
||||
|
||||
Reference in New Issue
Block a user