CartaPorteTimbrada Ajustes v 3.0

This commit is contained in:
rakcsle
2023-12-27 20:09:57 -07:00
parent 17eed88c31
commit 0e89a5cab6
9 changed files with 9144 additions and 8441 deletions

View File

@@ -2145,6 +2145,7 @@ Partial Class PopUpVerFactura
'EMISOR
Dim LugarExpedicion As String = ""
Dim ImgCBB As String = ""
Dim ImgCCP As String = ""
'COMPROBANTE
Dim SerieFolio As String = ""
Dim Telefono As String = ""
@@ -2175,6 +2176,7 @@ Partial Class PopUpVerFactura
Dim PlacaVM As String = ""
Dim AnioModeloVM As String = ""
Dim PesoBrutoVehicular As String = ""
'TIMBRADO
Dim FolioFiscal As String = ""
Dim NoCertificadoSAT As String = ""
@@ -2270,23 +2272,62 @@ Partial Class PopUpVerFactura
Dim RutaCBB As String = String.Format("{0}\CBB\{1}.jpg", UsuarioActual.Empresa.Ruta, SerieFolio)
Dim ImagenCBB As New System.IO.FileInfo(RutaCBB)
Dim RutaCCP As String = String.Format("{0}\CBB\{1}_CCP.jpg", UsuarioActual.Empresa.Ruta, SerieFolio)
Dim ImagenCCP As New System.IO.FileInfo(RutaCCP)
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3"
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
Dim Version As String = ValorXML(XMLDoc.DocumentElement, "version")
Dim VersionCCP As String = ""
Dim PrefijoCCP As String = ""
'Try
' 'XDocument doc = XDocument.Parse(Xml);
' 'String Version = doc.Descendants("cartaporte30:CartaPorte").First().Attribute("version").Value;
' Dim NodoVersionCCP As XmlNode = XMLDoc.Descendants("cartaporte30:CartaPorte")
' If NodoVersionCCP IsNot Nothing Then
' VersionCCP = ValorXML(NodoVersionCCP, "version")
' Else
' VersionCCP = "2.0"
' End If
'Catch ex As Exception
'End Try
If Version = "3.3" Then
cfdVer = "http://www.sat.gob.mx/cfd/3"
Else ' se considera que es la version 4.0
cfdVer = "http://www.sat.gob.mx/cfd/4"
End If
params.Add(New ReportParameter("CFDIVersion", Version))
namespaces.AddNamespace(Prefijo, cfdVer)
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal")
namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal")
namespaces.AddNamespace("cartaporte", "http://www.sat.gob.mx/CartaPorte")
namespaces.AddNamespace("cartaporte20", "http://www.sat.gob.mx/CartaPorte20")
namespaces.AddNamespace("cartaporte30", "http://www.sat.gob.mx/CartaPorte30")
Dim Nodos30 = XMLDoc.SelectSingleNode("//cartaporte30:CartaPorte", namespaces)
Dim Nodos20 = XMLDoc.SelectSingleNode("//cartaporte20:CartaPorte", namespaces)
If Nodos30 IsNot Nothing Then
VersionCCP = "3.0"
PrefijoCCP = "cartaporte30"
End If
If Nodos20 IsNot Nothing Then
VersionCCP = "2.0"
PrefijoCCP = "cartaporte20"
End If
params.Add(New ReportParameter("CartaPorteVersion", VersionCCP))
Dim nodeComprobante As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante", Prefijo), namespaces)
If nodeComprobante IsNot Nothing Then
@@ -2320,24 +2361,25 @@ Partial Class PopUpVerFactura
End If
Dim nodeComp As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante/{0}:Complemento", Prefijo), namespaces)
Dim nodeCartaPorte As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:CartaPorte", "cartaporte20"), namespaces)
Dim nodeCartaPorte As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:CartaPorte", PrefijoCCP), namespaces)
If nodeCartaPorte IsNot Nothing Then
TransporteInternacional = ValorXML(nodeCartaPorte, "TranspInternac", "")
End If
Dim nodeAutotransporteFederal As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Autotransporte", "cartaporte20"), namespaces)
Dim nodeAutotransporteFederal As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Autotransporte", PrefijoCCP), namespaces)
If nodeAutotransporteFederal IsNot Nothing Then
PermisoSTCC = ValorXML(nodeAutotransporteFederal, "PermSCT", "")
NumPermiso = ValorXML(nodeAutotransporteFederal, "NumPermisoSCT", "")
End If
Dim nodeIdentificacionVehicular As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:IdentificacionVehicular", "cartaporte20"), namespaces)
Dim nodeIdentificacionVehicular As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:IdentificacionVehicular", PrefijoCCP), namespaces)
If nodeIdentificacionVehicular IsNot Nothing Then
PlacaVM = ValorXML(nodeIdentificacionVehicular, "PlacaVM", "")
AnioModeloVM = ValorXML(nodeIdentificacionVehicular, "AnioModeloVM", "")
PesoBrutoVehicular = ValorXML(nodeIdentificacionVehicular, "PesoBrutoVehicular", "")
End If
Dim nodeSeguros As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Seguros", "cartaporte20"), namespaces)
Dim nodeSeguros As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Seguros", PrefijoCCP), namespaces)
If nodeIdentificacionVehicular IsNot Nothing Then
AseguradoraRespCivil = ValorXML(nodeSeguros, "AseguraRespCivil", "")
NumPolizaSeguroRespCivil = ValorXML(nodeSeguros, "PolizaRespCivil", "")
@@ -2350,7 +2392,7 @@ Partial Class PopUpVerFactura
End If
Dim nodeRemolques As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Remolques", "cartaporte20"), namespaces)
Dim nodeRemolques As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Remolques", PrefijoCCP), namespaces)
If nodeRemolques IsNot Nothing Then
If nodeRemolques.ChildNodes.Count = 1 Then
@@ -2370,7 +2412,7 @@ Partial Class PopUpVerFactura
' MedioTransporte = String.Format("{0} - {1}", CveTransporte, HtTransporte(CveTransporte).ToString())
'End If
Dim nodeMercancias As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Mercancia", "cartaporte20"), namespaces)
Dim nodeMercancias As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Mercancia", PrefijoCCP), namespaces)
For Each node As XmlNode In nodeMercancias
Dim Row As DataRow = DtMercancias.NewRow
@@ -2385,7 +2427,7 @@ Partial Class PopUpVerFactura
DtMercancias.Rows.Add(Row)
Next
Dim nodeMercanciaPadre As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Mercancias", "cartaporte20"), namespaces)
Dim nodeMercanciaPadre As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Mercancias", PrefijoCCP), namespaces)
If UsuarioActual.CveEmpresa = 13 AndAlso nodeMercanciaPadre IsNot Nothing Then
Dim PesoNetoTotal As String = ValorXML(nodeMercanciaPadre(0), "PesoNetoTotal", "")
Dim UnidadPeso As String = ValorXML(nodeMercanciaPadre(0), "UnidadPeso", "")
@@ -2396,7 +2438,7 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("NumTotalMercancias", NumTotalMercancias))
End If
Dim nodeOperadores As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:TiposFigura", "cartaporte20"), namespaces)
Dim nodeOperadores As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:TiposFigura", PrefijoCCP), namespaces)
For Each node As XmlNode In nodeOperadores
Dim Row As DataRow = DtOperadores.NewRow
@@ -2408,7 +2450,7 @@ Partial Class PopUpVerFactura
Next
Dim DistanciaTotal As Decimal = 0
Dim nodeUbicaciones As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Ubicacion", "cartaporte20"), namespaces)
Dim nodeUbicaciones As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Ubicacion", PrefijoCCP), namespaces)
For Each node As XmlNode In nodeUbicaciones
Dim Row As DataRow = DtUbicaciones.NewRow
@@ -2419,7 +2461,7 @@ Partial Class PopUpVerFactura
Row("RFC") = ValorXML(node, "RFCRemitenteDestinatario", "")
Row("Nombre") = ValorXML(node, "NombreRemitenteDestinatario", "")
Dim nodeDomicilio As XmlNode = node.ChildNodes.Cast(Of XmlNode).FirstOrDefault(Function(x) x.Name = "cartaporte20:Domicilio") 'node.SelectSingleNode(String.Format("//{0}:Domicilio", "cartaporte"), namespaces)
Dim nodeDomicilio As XmlNode = node.ChildNodes.Cast(Of XmlNode).FirstOrDefault(Function(x) x.Name = $"{PrefijoCCP}:Domicilio") 'node.SelectSingleNode(String.Format("//{0}:Domicilio", "cartaporte"), namespaces)
If nodeDomicilio IsNot Nothing Then
Dim Estado As String = ""
@@ -2515,6 +2557,23 @@ Partial Class PopUpVerFactura
ImgCBB = ""
End If
'FIXME OICCHECAR DESPUES DE SINCRONIZAR TIMBRADO
'If Not ImagenCCP.Exists Then
' Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar()
' CBB.GenerarCBB(UsuarioActual.Empresa.RFC, ClienteRFC, Total, FolioFiscal, RutaCBB)
'End If
ImagenCCP = New System.IO.FileInfo(RutaCCP)
If ImagenCCP.Exists Then
ImgCCP = String.Format("file://{0}", ImagenCCP.FullName)
Else
ImgCCP = ""
End If
End If
If DtConceptos.Rows.Count > 0 Then
@@ -2550,9 +2609,12 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("PlacaVM", PlacaVM))
params.Add(New ReportParameter("AnioVM", AnioModeloVM))
params.Add(New ReportParameter("PesoBrutoVehicular", PesoBrutoVehicular))
'TIMBRADO
params.Add(New ReportParameter("FolioFiscal", FolioFiscal))
params.Add(New ReportParameter("QR", ImgCBB))
params.Add(New ReportParameter("QRCCP", ImgCCP))
params.Add(New ReportParameter("SelloCFDI", SelloCFDi))
params.Add(New ReportParameter("CertificadoContribuyente", NoCertificadoSAT))
params.Add(New ReportParameter("CadenaOriginal", CadenaOriginal))