diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 72acf9130..8a780eaf9 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -3749,7 +3749,7 @@ Public Class ClsGenerales End Function Public Function UpdateTimbreTimbrado(CveTimbre As Integer, FolioFiscal As String, Fecha As DateTime, CveUsuario As Integer, CveEmpresa As Integer, - CvePAC As Integer) As Boolean + CvePAC As Integer, CFDIVersion As String) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_TimbreTimbrado") @@ -3759,6 +3759,7 @@ Public Class ClsGenerales .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal .Add("@Fecha", SqlDbType.DateTime).Value = Fecha .Add("@CvePAC", SqlDbType.Int).Value = CvePAC + .Add("@CDFIVersion", SqlDbType.VarChar).Value = CFDIVersion .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index e5e7ab30e..b766012f0 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -8802,9 +8802,17 @@ Public Class ClsPaginas #End Region #Region "PDF PAGOS" + + Private Function ValorXML(n As XmlNode, Campo As String, Optional Retorno As String = "") As String + Dim o As XmlNode = n.Attributes.Cast(Of XmlAttribute)().SingleOrDefault(Function(a) String.Compare(a.Name, Campo, True) = 0) + If o Is Nothing Then + Return Retorno + Else + Return o.Value + End If + End Function + Public Sub PDFReciboDePagos(CveVenta As Integer, CveIE As Integer, CveComplementoPago As Integer, Optional imprimir As Boolean = True) - - Dim ObjBancos As New ClsBancos Dim ObjClientes As New ClsClientes Dim params As New List(Of ReportParameter) @@ -8855,6 +8863,7 @@ Public Class ClsPaginas DTConceptosPagoRelacionado.Columns.Add("MetodoDePagoDR", GetType(String)) DTConceptosPagoRelacionado.Columns.Add("MonedaDR", GetType(String)) DTConceptosPagoRelacionado.Columns.Add("TipoCambioDR", GetType(String)) + DTConceptosPagoRelacionado.Columns.Add("ObjetoImpDR", GetType(String)) If ObjBancos.GetComplementoPagos(CveComplementoPago, CveIE, CveVenta, UsuarioActual.CveEmpresa) Then @@ -8901,13 +8910,29 @@ Public Class ClsPaginas Dim ImagenCBB As String = $"file://{Ruta}CBB\{Serie}-{Folio}.jpg" + If File.Exists(PathXML) Then Dim XmlDoc As New System.Xml.XmlDocument XmlDoc.Load(PathXML) + Dim Version = ValorXML(XmlDoc.DocumentElement, "version") + Dim namespaces As New XmlNamespaceManager(XmlDoc.NameTable) + Dim Prefijo As String = If(XmlDoc.DocumentElement.Prefix = "", "cfd", XmlDoc.DocumentElement.Prefix) + Dim cfdVer As String = "" Dim validaElemento = XmlDoc.DocumentElement("cfdi:Complemento") Dim validaElementoPago = XmlDoc.DocumentElement("cfdi:Conceptos") + 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 + + namespaces.AddNamespace(Prefijo, cfdVer) + namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") + namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") + namespaces.AddNamespace("pago20", "http://www.sat.gob.mx/Pagos20") + 'Datos Fiscales If Not IsNothing(validaElemento) Then For i As Integer = 0 To XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Count - 1 @@ -8924,46 +8949,60 @@ Public Class ClsPaginas 'Pago If Not IsNothing(validaElemento) Then Dim PagosChild = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Cast(Of XmlNode).Where(Function(a) a.LocalName.Equals("Pagos", StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault() + Dim nodePagos As XmlNodeList + If Version = "3.3" Then + nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago10:Pago", Prefijo), namespaces) + Else + nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago20:Pagos/pago20:Pago", Prefijo), namespaces) + End If - For Each Pagos As XmlNode In PagosChild.ChildNodes - Dim Dr As DataRow = DTConceptosPago.NewRow - - If Not Pagos.Attributes("CtaOrdenante") Is Nothing Then Dr("CtaOrdenante") = Pagos.Attributes("CtaOrdenante").Value Else Dr("CtaOrdenante") = "" - If Not Pagos.Attributes("TipoCambioP") Is Nothing Then Dr("TipoCambioP") = Pagos.Attributes("TipoCambioP").Value Else Dr("TipoCambioP") = "" - - If Not Pagos.Attributes("RfcEmisorCtaOrd") Is Nothing Then - Dr("RfcEmisorCtaOrd") = Pagos.Attributes("RfcEmisorCtaOrd").Value - RFCOrdenante = Pagos.Attributes("RfcEmisorCtaOrd").Value + For Each Pagos As XmlNode In nodePagos + If Version = "4.0" AndAlso Pagos.Name = "pago20:Totales" Then + Dim a As String = "a" Else - Dr("RfcEmisorCtaOrd") = "" + + Dim Dr As DataRow = DTConceptosPago.NewRow + + If Not Pagos.Attributes("CtaOrdenante") Is Nothing Then Dr("CtaOrdenante") = Pagos.Attributes("CtaOrdenante").Value Else Dr("CtaOrdenante") = "" + If Not Pagos.Attributes("TipoCambioP") Is Nothing Then Dr("TipoCambioP") = Pagos.Attributes("TipoCambioP").Value Else Dr("TipoCambioP") = "" + + If Not Pagos.Attributes("RfcEmisorCtaOrd") Is Nothing Then + Dr("RfcEmisorCtaOrd") = Pagos.Attributes("RfcEmisorCtaOrd").Value + RFCOrdenante = Pagos.Attributes("RfcEmisorCtaOrd").Value + Else + Dr("RfcEmisorCtaOrd") = "" + End If + + Dr("Monto") = Pagos.Attributes("Monto").Value + Dr("MonedaP") = Pagos.Attributes("MonedaP").Value + Dr("FormaDePagoP") = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPagoSAT", $"ClaveFormaPagoSAT= '{Pagos.Attributes("FormaDePagoP").Value}'") + Dr("FechaPago") = Pagos.Attributes("FechaPago").Value + + FechaRecibo = Pagos.Attributes("FechaPago").Value + TotalLetra = Pagos.Attributes("Monto").Value.ToString.ToDouble.Texto2Letras(CveMoneda) + + DTConceptosPago.Rows.Add(Dr) + + For Each Relacionado As XmlNode In Pagos.SelectNodes("//pago20:DoctoRelacionado", namespaces) + Dim DrRelacionado As DataRow = DTConceptosPagoRelacionado.NewRow + + If Not Relacionado.Attributes("Folio") Is Nothing Then DrRelacionado("Folio") = Relacionado.Attributes("Folio").Value Else DrRelacionado("Folio") = "" + If Not Relacionado.Attributes("Serie") Is Nothing Then DrRelacionado("Serie") = Relacionado.Attributes("Serie").Value Else DrRelacionado("Serie") = "" + If Not Relacionado.Attributes("TipoCambioDR") Is Nothing Then DrRelacionado("TipoCambioDR") = Relacionado.Attributes("TipoCambioDR").Value Else DrRelacionado("TipoCambioDR") = "" + + DrRelacionado("IdDocumento") = Relacionado.Attributes("IdDocumento").Value + DrRelacionado("ImpPagado") = Relacionado.Attributes("ImpPagado").Value + DrRelacionado("ImpSaldoAnt") = Relacionado.Attributes("ImpSaldoAnt").Value + DrRelacionado("NumParcialidad") = Relacionado.Attributes("NumParcialidad").Value + If Version = "3.3" Then DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value + If Version = "4.0" Then DrRelacionado("ObjetoImpDR") = Relacionado.Attributes("ObjetoImpDR").Value + + DrRelacionado("MonedaDR") = Relacionado.Attributes("MonedaDR").Value + + DTConceptosPagoRelacionado.Rows.Add(DrRelacionado) + Next + End If - - Dr("Monto") = Pagos.Attributes("Monto").Value - Dr("MonedaP") = Pagos.Attributes("MonedaP").Value - Dr("FormaDePagoP") = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPagoSAT", $"ClaveFormaPagoSAT= '{Pagos.Attributes("FormaDePagoP").Value}'") - Dr("FechaPago") = Pagos.Attributes("FechaPago").Value - - FechaRecibo = Pagos.Attributes("FechaPago").Value - TotalLetra = Pagos.Attributes("Monto").Value.ToString.ToDouble.Texto2Letras(CveMoneda) - - DTConceptosPago.Rows.Add(Dr) - - For Each Relacionado As XmlNode In Pagos.ChildNodes - Dim DrRelacionado As DataRow = DTConceptosPagoRelacionado.NewRow - - If Not Relacionado.Attributes("Folio") Is Nothing Then DrRelacionado("Folio") = Relacionado.Attributes("Folio").Value Else DrRelacionado("Folio") = "" - If Not Relacionado.Attributes("Serie") Is Nothing Then DrRelacionado("Serie") = Relacionado.Attributes("Serie").Value Else DrRelacionado("Serie") = "" - If Not Relacionado.Attributes("TipoCambioDR") Is Nothing Then DrRelacionado("TipoCambioDR") = Relacionado.Attributes("TipoCambioDR").Value Else DrRelacionado("TipoCambioDR") = "" - - DrRelacionado("IdDocumento") = Relacionado.Attributes("IdDocumento").Value - DrRelacionado("ImpPagado") = Relacionado.Attributes("ImpPagado").Value - DrRelacionado("ImpSaldoAnt") = Relacionado.Attributes("ImpSaldoAnt").Value - DrRelacionado("NumParcialidad") = Relacionado.Attributes("NumParcialidad").Value - DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value - DrRelacionado("MonedaDR") = Relacionado.Attributes("MonedaDR").Value - - DTConceptosPagoRelacionado.Rows.Add(DrRelacionado) - Next Next End If diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 560863804..288dad8eb 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4854,14 +4854,14 @@ Public Class ClsVentas End Try Return retorno End Function - Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, CveClasificacion As Integer, CveClasificacionSup As Integer, CveEmpresa As Integer) As Boolean + Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Decimal, MetaImporte As Decimal, CveClasificacion As Integer, CveClasificacionSup As Integer, CveEmpresa As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_MetasVendedoresAdd", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor .Add("@MesAño", SqlDbType.DateTime).Value = MesAño .Add("@CveMarca", SqlDbType.Int).Value = CveMarca - .Add("@MetaCantidad", SqlDbType.Int).Value = MetaCantidad + .Add("@MetaCantidad", SqlDbType.SmallMoney).Value = MetaCantidad .Add("@MetaImporte", SqlDbType.Decimal).Value = MetaImporte .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveClasificacionSup", SqlDbType.Int).Value = CveClasificacionSup diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 5e3693e62..14d3d2488 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3891,7 +3891,7 @@ Namespace Modelos Dim PU As Decimal = RowGarantia("Importe").ToString().ToDecimal() ' / RowGarantia("Cantidad").ToString().ToDouble() Dim Serie As String = RowGarantia("Comprobante").ToString - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, Serie:=Serie, CveVentaDetalle:=RowGarantia("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, Serie:=Serie, CveVentaDetalle:=IIf(RowGarantia("MismoCvePS").ToString = "1", RowGarantia("CveVentaDetalle"), -1).ToString.ToEntero) Then OcurrioError = True Exit For End If diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 68f338ac6..d09c9bc2b 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -2832,7 +2832,7 @@ Public Class Timbrado Case "T" Dim objGrales As New ClsGenerales - If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC) Then + If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC, "3.3") Then Retorno = "" Else Retorno = "Error" @@ -5658,7 +5658,7 @@ Public Class Timbrado Case "T" Dim objGrales As New ClsGenerales - If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC) Then + If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC, "4.0") Then Retorno = "" Else Retorno = "Error" diff --git a/App_Code/Timbres.vb b/App_Code/Timbres.vb index 23070a859..adcec6a90 100644 --- a/App_Code/Timbres.vb +++ b/App_Code/Timbres.vb @@ -41,8 +41,10 @@ Public Class Timbres Private Sub CreaObjetosTraslados(TipoDocto As String, CveTimbre As Integer) - ObjFactura = New Modelos.Factura + ObjFactura = New Modelos.Factura ObjFactura.Version = "3.3" + If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then ObjFactura.Version = "4.0" + ObjFactura.CveUsuario = UsuarioActual.CveUsuario ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa ObjFactura.UsuarioActual = UsuarioActual @@ -84,8 +86,10 @@ Public Class Timbres Timbre.Comprobante.SubTotal = Obj.SubTotal Timbre.Comprobante.Descuentos = Obj.Descuento Timbre.Comprobante.Moneda = "XXX" - Timbre.Comprobante.TipoCambio = "" ' CONDICIÓN SI LA MONEDA ES 'XXX' - Timbre.Receptor.UsoCFDI = "P01" + Timbre.Comprobante.TipoCambio = "" ' CONDICIÓN SI LA MONEDA ES 'XXX' + + Timbre.Receptor.UsoCFDI = "S01" + If ObjFactura.Version = "3.3" Then Timbre.Receptor.UsoCFDI = "P01" Dim totSubTotal As Decimal = Obj.SubTotal Dim totIVA As Decimal = Obj.IVA @@ -124,7 +128,7 @@ Public Class Timbres Timbre.Receptor.RFC = drT("EmpresaRFC").ToString Timbre.Receptor.Nombre = drT("EmpresaNombre").ToString - Timbre.Receptor.DomicilioFiscalReceptor = drT("DirDesCP").ToString + Timbre.Receptor.DomicilioFiscalReceptor = drT("DomicilioFiscalReceptor").ToString Timbre.Receptor.RegimenFiscalReceptor = drT("CodigoRegimenFiscalReceptor").ToString CveMovimiento = drT("CveMovimientoAlmacen").ToString.ToEntero @@ -216,8 +220,8 @@ Public Class Timbres End If Dim Ubica As New CFDICartaPorteUbicacion - Ubica.TipoEstacion = "" - Ubica = New CFDICartaPorteUbicacion With {.TipoUbicacion = "Origen", .IDUbicacion = "OR000001", .RFCRemitenteDestinatario = drT("RemitenteRFC").ToString, + Ubica.TipoEstacion = "" + Ubica = New CFDICartaPorteUbicacion With {.TipoUbicacion = "Origen", .IDUbicacion = "OR000001", .RFCRemitenteDestinatario = drT("RemitenteRFC").ToString, .FechaHoraSalidaLlegada = FechaSalida.ToString("yyyy-MM-ddTHH:mm:ss"),' "2021-08-23T11:13:01", .NombreRemitenteDestinatario = drT("RemitenteNombre").ToString, .Domicilio = DomOrigen} @@ -230,9 +234,9 @@ Public Class Timbres .NumRegIdTrib = NumRegIdTrib} CartaPorte.Ubicaciones.Add(Ubica) - CartaPorte.FiguraTransporte.ClaveTransporte = "01" + CartaPorte.FiguraTransporte.ClaveTransporte = "01" - Dim DomicilioOperador As New CFDICartaPorteDomicilio With {.Calle = drT("FiguraDomicilio").ToString, + Dim DomicilioOperador As New CFDICartaPorteDomicilio With {.Calle = drT("FiguraDomicilio").ToString, .NumeroExterior = drT("FiguraNumeroExterior").ToString, .NumeroInterior = drT("FiguraNumeroInterior").ToString, .Colonia = drT("FiguraClaveSATColonia").ToString, @@ -242,7 +246,7 @@ Public Class Timbres - CartaPorte.FiguraTransporte.Operadores.Add(New CFDICartaPorteOperador With { + CartaPorte.FiguraTransporte.Operadores.Add(New CFDICartaPorteOperador With { .RFCFigura = drT("FiguraRFC").ToString, .NombreFigura = drT("FiguraChofer").ToString, .NumLicencia = drT("FiguraLicencia").ToString, @@ -251,8 +255,8 @@ Public Class Timbres .Domicilio = DomicilioOperador}) - 'concepto único - Dim concepto As New CFDIConceptos With {.Cantidad = 1, + 'concepto único + Dim concepto As New CFDIConceptos With {.Cantidad = 1, .Descripcion = "Traslado", .ValorUnitario = 0, .Importe = 0, @@ -261,22 +265,23 @@ Public Class Timbres .ClaveUnidad = "E48", .ClaveProdServ = "78101802", .Noidentificacion = "", - .CuentaPredial = ""} + .CuentaPredial = "", + .ObjetoImpuesto = "01"} - Timbre.Conceptos.Add(concepto) + Timbre.Conceptos.Add(concepto) - For Each drr As DataRow In Obj.DtDetalle.Rows + For Each drr As DataRow In Obj.DtDetalle.Rows - If drr("PS").ToString.Length = 1 Then - tPS = drr("Obs").ToString + If drr("PS").ToString.Length = 1 Then + tPS = drr("Obs").ToString + Else + If drr("PS").ToString.Length = 0 Then + tPS = "" Else - If drr("PS").ToString.Length = 0 Then - tPS = "" - Else - tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) - End If + tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) End If - Dim conceptoCarta As New CFDICartaPorteMercancia With { + End If + Dim conceptoCarta As New CFDICartaPorteMercancia With { .BienesTransp = drr("SATClaveProdServ").ToString, .ClaveSTCC = "", 'para metodo ferroviario .Cantidad = drr("Cantidad").ToString.ToDecimal, @@ -290,29 +295,29 @@ Public Class Timbres .Embalaje = drr("ClaveEmbalaje").ToString, .DescripEmbalaje = drr("Embalaje").ToString, .ValorMercancia = drr("PU").ToString.ToDecimal, - .Moneda = "MXN", 'temporal + .Moneda = IIf(drr("PU").ToString.ToDecimal > 0, "MXN", ""), 'temporal .FraccionArrancelaria = "", .UUIDComercioExt = "" } - Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal * drr("Cantidad").ToString.ToDecimal, .NumPiezas = drr("Cantidad").ToString.ToDecimal} - conceptoCarta.DetalleMercancia = DetalleMercancia + Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal * drr("Cantidad").ToString.ToDecimal, .NumPiezas = drr("Cantidad").ToString.ToDecimal} + conceptoCarta.DetalleMercancia = DetalleMercancia - Dim MercanciaTransporta As New CFDICartaPorteMercanciaTransporta With {.Cantidad = drr("Cantidad").ToString.ToDecimal, .IDOrigen = "OR000001", .IDDestino = "DE000001"} - conceptoCarta.MercanciasCantidadTransporta.Add(MercanciaTransporta) + Dim MercanciaTransporta As New CFDICartaPorteMercanciaTransporta With {.Cantidad = drr("Cantidad").ToString.ToDecimal, .IDOrigen = "OR000001", .IDDestino = "DE000001"} + conceptoCarta.MercanciasCantidadTransporta.Add(MercanciaTransporta) - totSubTotal = totSubTotal - concepto.Importe - CartaPorte.Mercancias.Mercancias.Add(conceptoCarta) + totSubTotal = totSubTotal - concepto.Importe + CartaPorte.Mercancias.Mercancias.Add(conceptoCarta) - i += 1 - Next - Timbre.Complementos.CartaPorte = CartaPorte + i += 1 + Next + Timbre.Complementos.CartaPorte = CartaPorte - Else - '' T R A S L A D O S + Else + '' T R A S L A D O S - 'DETALLES - If Obj.DtDetalle IsNot Nothing Then + 'DETALLES + If Obj.DtDetalle IsNot Nothing Then For Each drr As DataRow In Obj.DtDetalle.Rows If drr("PS").ToString.Length = 1 Then @@ -337,7 +342,8 @@ Public Class Timbres .ClaveUnidad = drr("SATClaveUM").ToString, .ClaveProdServ = drr("SATClaveProdServ").ToString, .Noidentificacion = drr("Noidentificacion").ToString, - .CuentaPredial = ""} + .CuentaPredial = "", + .ObjetoImpuesto = "01"} 'VERIFICA SUMA SUBTOTALES If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES concepto.Importe = totSubTotal diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 9c6fc4e0e..c730a91a5 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -1370,7 +1370,7 @@ Partial Class Bancos_ProveedoresAbonar IdCtaContable = IdCuenta End If - Dim Importe42 As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal + Dim Importe42 As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal + gvr.FCTextBox("TxtComision").Text.ToDecimal ImporteMovimiento = Importe42 importeMX = If(CveMoneda = 2, If(DivTC.Visible, Importe42 / TxtTC.Text.ToDecimal * TipoCambioPago, Importe42 * TipoCambioPago), Importe42) TipoCambioGeneral = TipoCambioPago diff --git a/Bin/GoCfdi.dll b/Bin/GoCfdi.dll index c94459330..ef9ad67ca 100644 Binary files a/Bin/GoCfdi.dll and b/Bin/GoCfdi.dll differ diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 887f721e6..7d4e9f6fd 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1692,12 +1692,17 @@ Partial Class PopUpVerFactura Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) 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 namespaces As New XmlNamespaceManager(XMLDoc.NameTable) + 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 - 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") @@ -1737,7 +1742,6 @@ Partial Class PopUpVerFactura Next End If - Dim nodeComp As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", Prefijo), namespaces) Dim nodeCartaPorte As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:CartaPorte", "cartaporte20"), namespaces) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index eac0461d1..b8584eae2 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1268,8 +1268,6 @@ Partial Class Clientes CargaCombosComercioExterior() - - End Sub Private Sub CargaSubProyectoss() @@ -2480,18 +2478,37 @@ Partial Class Clientes End If - 'CargaSucursal() - 'If UsuarioActual.TienePermisoProceso(170) AndAlso TxtCodigo.Text.Trim = "" Then - ' Alert("Es necesario ingresar un Código", TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If + If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then - 'Dim rowcodigo As DataTable = GlobalDTCliente.FiltraParametros(String.Format("Codigo='{0}' AND CveEmpresa={1} ", TxtCodigo.Text.Trim, UsuarioActual.CveEmpresa)) - 'If (Not IsNothing(rowcodigo)) AndAlso (rowcodigo.Rows.Count > 0) AndAlso (rowcodigo.Rows(0)("CveCliente").ToString().Toentero() <> CveCliente) Then - ' Alert(String.Format("ya existe un Cliente Con este Codigo '{0}'", TxtCodigo.Text.Trim), TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If - Dim ObjClientes As New ClsClientes() + If TxtRFC.Text.ToUpper.Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscal.SelectedValue <> "11" Then + + Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + + End If + + If TxtRFC.Text.ToUpper.Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDI.SelectedValue <> "23" Then + + Alert("El Regimen fiscal del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + + End If + + + End If + + 'CargaSucursal() + 'If UsuarioActual.TienePermisoProceso(170) AndAlso TxtCodigo.Text.Trim = "" Then + ' Alert("Es necesario ingresar un Código", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + + 'Dim rowcodigo As DataTable = GlobalDTCliente.FiltraParametros(String.Format("Codigo='{0}' AND CveEmpresa={1} ", TxtCodigo.Text.Trim, UsuarioActual.CveEmpresa)) + 'If (Not IsNothing(rowcodigo)) AndAlso (rowcodigo.Rows.Count > 0) AndAlso (rowcodigo.Rows(0)("CveCliente").ToString().Toentero() <> CveCliente) Then + ' Alert(String.Format("ya existe un Cliente Con este Codigo '{0}'", TxtCodigo.Text.Trim), TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + Dim ObjClientes As New ClsClientes() Dim objDoc As New ClsEdocumentacion(ObjClientes.IniciaTransacSQL()) Dim MsgCuentaContable As String = "" Dim ErrorProceso As Boolean = False