Recepcion y vinculacion facturas 4.0
This commit is contained in:
@@ -1118,7 +1118,7 @@ Partial Class Compras_Compras
|
||||
CargaDatosAgregarPS()
|
||||
TieneAnticiposXML = False
|
||||
Modalidad = ""
|
||||
Version = "3.3"
|
||||
Version = "4.0"
|
||||
CveMetodoPago = -1
|
||||
RFCProv = ""
|
||||
CargaDdlTipoGasto()
|
||||
@@ -1638,7 +1638,7 @@ Partial Class Compras_Compras
|
||||
End Sub
|
||||
|
||||
Private Sub ValidaIVA()
|
||||
If Version <> "3.3" And CveCompra <= 0 Then
|
||||
If (Version <> "3.3" And Version <> "4.0") And CveCompra <= 0 Then
|
||||
Dim ImporteIVAXML As Double = (TxtSubTotal.Text.Trim.ToDouble - TxtDescuento.Text.Trim.ToDouble - TxtIEPS.Text.Trim.ToDouble) * 0.16
|
||||
If Math.Abs(TxtIVA.Text.Trim.ToDouble - ImporteIVAXML) >= 1 Then
|
||||
Alert("El <b>IVA</b> del <b>CFDi</b> no tiene un comportamiento normal, por favor verifique que sea correcto. <br /><br /> <b>NOTA:</b> Esta advertencia no aplica en casos de conceptos(alimentos, combustibles o servicios de comunicación) exentos de IVA o causantes de IEPS.", TipoMensaje.MsgAdvertencia)
|
||||
@@ -1743,15 +1743,29 @@ Partial Class Compras_Compras
|
||||
|
||||
CargaComprobanteXML(XMLDoc)
|
||||
|
||||
If NuevaValidacionXML = 1 Or Version = "3.3" Then
|
||||
If NuevaValidacionXML = 1 Or (Version = "3.3" Or Version = "4.0") Then
|
||||
Dim Xml As New StringBuilder
|
||||
Dim nodo As XmlNode = XMLDoc.DocumentElement
|
||||
Dim Version = ValorXML(nodo, "version")
|
||||
|
||||
|
||||
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
|
||||
Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3"
|
||||
Dim cfdVer As String = ""
|
||||
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
|
||||
|
||||
If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
|
||||
If Version = "3.2" Then
|
||||
Prefijo = "cfd"
|
||||
cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
ElseIf 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
|
||||
|
||||
'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
|
||||
namespaces.AddNamespace(Prefijo, cfdVer)
|
||||
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
|
||||
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal")
|
||||
@@ -1759,7 +1773,8 @@ Partial Class Compras_Compras
|
||||
|
||||
Dim nodeconceptos As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Conceptos", Prefijo), namespaces)
|
||||
|
||||
Xml.Append(Replace(Replace(Replace(nodeconceptos.OuterXml, "<cfdi:", "<"), "</cfdi:", "</"), "xmlns:cfdi=""http://www.sat.gob.mx/cfd/3""", ""))
|
||||
Xml.Append(Replace(Replace(Replace(Replace(nodeconceptos.OuterXml, "<cfdi:", "<"), "</cfdi:", "</"), "xmlns:cfdi=""http://www.sat.gob.mx/cfd/3""", ""), "xmlns:cfdi=""http://www.sat.gob.mx/cfd/4""", ""))
|
||||
|
||||
If ObjeFacturas.GetFacturasComparacionXML(Version, Xml.ToString, UsuarioActual.CveEmpresa) Then
|
||||
TmpDT = ObjeFacturas.DtResultados
|
||||
TmpDT.Columns.Add("CveSATPSActualizado")
|
||||
@@ -1883,7 +1898,7 @@ Partial Class Compras_Compras
|
||||
Dim Msg As String = ""
|
||||
|
||||
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
|
||||
ValidacionesTotalesXml()
|
||||
|
||||
@@ -3573,11 +3588,25 @@ Partial Class Compras_Compras
|
||||
'Dim DtPSTemp = TmpDT.Clone
|
||||
'Dim Row As DataRow = Nothing
|
||||
|
||||
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)
|
||||
|
||||
If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
Dim nodo As XmlNode = XMLDoc.DocumentElement
|
||||
Dim VersionCFDI As String = ValorXML(nodo, "version")
|
||||
|
||||
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
|
||||
Dim cfdVer As String = ""
|
||||
|
||||
If VersionCFDI = "3.2" Then
|
||||
Prefijo = "cfd"
|
||||
cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
ElseIf VersionCFDI = "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
|
||||
|
||||
namespaces.AddNamespace(Prefijo, cfdVer)
|
||||
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
|
||||
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal")
|
||||
@@ -3714,7 +3743,7 @@ Partial Class Compras_Compras
|
||||
|
||||
'Alert(ValorXML(node, "ClaveProdServ").Trim)
|
||||
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
|
||||
'OBTENER TRASLADOS POR DETALLES
|
||||
Dim ContadorTraslado = 0
|
||||
@@ -5171,7 +5200,7 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
|
||||
'ACTUALIZAR PRODUCTO/SERVICIO SAT
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
If Row("CveSATPSActualizado").ToString().ToEntero() = 1 Then
|
||||
If Not ObjProductosServicios.UpdateProductosServiciosSAT(Row("CvePS").ToString().ToEntero(), Row("CveSATPS").ToString().ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
ErrorSATPS = True
|
||||
@@ -10833,7 +10862,7 @@ Partial Class Compras_Compras
|
||||
|
||||
|
||||
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
Dim drm As DataRow = GlobalDTVtaMetodoPago.FiltroPrimero(String.Format("ClaveMetodoPagoSAT = '{0}'", ValorXML(nodo, "MetodoPago")))
|
||||
If drm IsNot Nothing Then
|
||||
CveMetodoPago = drm("CveMetodoPago").ToString.ToEntero
|
||||
@@ -10842,11 +10871,28 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
|
||||
|
||||
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)
|
||||
|
||||
If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
|
||||
|
||||
|
||||
|
||||
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
|
||||
Dim cfdVer As String = ""
|
||||
|
||||
If Version = "3.2" Then
|
||||
Prefijo = "cfd"
|
||||
cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
ElseIf 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
|
||||
|
||||
|
||||
|
||||
'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
namespaces.AddNamespace(Prefijo, cfdVer)
|
||||
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
|
||||
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal")
|
||||
@@ -10889,7 +10935,7 @@ Partial Class Compras_Compras
|
||||
|
||||
TotalRetenciones = ValorXML(node, "totalImpuestosRetenidos", "0").ToDecimal
|
||||
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
|
||||
For Each retencion As XmlNode In nodeRetenciones
|
||||
If retencion.Attributes("Impuesto").Value = "002" Then
|
||||
@@ -10920,7 +10966,7 @@ Partial Class Compras_Compras
|
||||
TotalTraslados = ValorXML(node, "totalImpuestosTrasladados", "0").ToDecimal
|
||||
Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Impuestos/{0}:Traslados/{0}:Traslado", Prefijo), namespaces)
|
||||
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
|
||||
For Each traslado As XmlNode In nodeTraslados
|
||||
If traslado.Attributes("Impuesto").Value = "002" Then
|
||||
@@ -15639,7 +15685,7 @@ Partial Class Compras_Compras
|
||||
e.Row.FCLabel("LbEstatusInv").Text = "NA"
|
||||
End If
|
||||
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
CargaPSSAT(e.Row.FCDropDownLost("DdlSATPS"))
|
||||
If e.Row.DBCampo("CveSATPS").ToEntero > 0 Then
|
||||
e.Row.FCDropDownLost("DdlSATPS").SelectedValue = e.Row.DBCampo("CveSATPS")
|
||||
@@ -18305,7 +18351,7 @@ Partial Class Compras_Compras
|
||||
Row("Consec") = TmpDT.Rows.Count + 1
|
||||
End If
|
||||
|
||||
If Version = "3.3" And CveSATPS > 0 Then
|
||||
If (Version = "3.3" Or Version = "4.0") And CveSATPS > 0 Then
|
||||
Dim DrPSSAT As DataRow = Nothing
|
||||
If CargaXml Then
|
||||
DrPSSAT = GlobalDTPSATPS("-1", CveSATPS.ToString).FiltroPrimero("")
|
||||
@@ -18362,7 +18408,7 @@ Partial Class Compras_Compras
|
||||
Row("NoDeducible") = NoDeducible
|
||||
|
||||
Row("PU") = Math.Round(PU, DecimalesPermitidos)
|
||||
If CargaXml And Version = "3.3" Then
|
||||
If CargaXml And (Version = "3.3" Or Version = "4.0") Then
|
||||
Row("IVA") = Math.Round(IVA, DecimalesPermitidos)
|
||||
Row("IVAPorcentaje") = PorcentajeIVA
|
||||
Row("RetIVA") = Math.Round(RetIVA, DecimalesPermitidos)
|
||||
|
||||
Reference in New Issue
Block a user