diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb
index 8aec07c6d..040ab10ab 100644
--- a/Compras/PopUpVerFactura.aspx.vb
+++ b/Compras/PopUpVerFactura.aspx.vb
@@ -2949,6 +2949,10 @@ Partial Class PopUpVerFactura
End If
End If
+ If Vta.Version.ToEntero() = 4 AndAlso dr1("CodigoObjetoImpuesto").ToString() = "02" AndAlso Now.Date >= New DateTime(2022, 11, 1) AndAlso dr1("Descuento").ToString().ToDecimal().RoundSQL(2) = dr1("Total").ToString().ToDecimal().RoundSQL(2) Then
+ dr1("CodigoObjetoImpuesto") = "04"
+ End If
+
Next
Vta.DtDesgloseImpuestos = TmpDTImpuestosIVAIEPS.FiltraParametros("", Orderby:="Orden ASC")
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 226640fd6..66a291ca6 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -7635,7 +7635,6 @@ Partial Class Ventas
#End Region
#Region "G R I D V I E W S"
-
#Region "GvPS"
Protected Sub GvPS_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvPS.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -8572,6 +8571,43 @@ Partial Class Ventas
Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
+
+ If DdlUsoCFDI.SelectedValue.ToEntero() <= 0 Then
+ Alert("No se ha seleccionado el Uso CFDI o el cliente no tiene asignado el correcto.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+
+ If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs", "Dev") Then
+
+ If LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso RegimenFiscalCliente <> "616" 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 LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDI.SelectedValue <> "23" Then
+ Alert("El uso cfdi del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso RegimenFiscalCliente = "616" Then
+ Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDI.SelectedValue = "23" Then
+ Alert("El uso cfdi del cliente no puede ser 'S01 - Sin efectos fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ Dim EsPersonaMoral As Boolean = Me.TipoPersona
+ Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
+
+ If DtUsosCFDI.Rows.Count = 0 Then
+ Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
End If
If (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then
@@ -12125,7 +12161,7 @@ Partial Class Ventas
' If drr("ImporteIVA").ToString().ToDouble > 0 Then
'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos, y si la BASE de calculo es mayor a cero
- If Timbre.Comprobante.Total > 0 AndAlso concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0 Then
+ If Timbre.Comprobante.Total > 0 AndAlso (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0) Then
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(6), .TasaOCuota = drr("PorcentajeIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString().ToDecimal})
End If
@@ -12141,6 +12177,11 @@ Partial Class Ventas
concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeRetISR").ToString().ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString().ToDecimal})
End If
+ 'si el codigo objeto impuesto es 02 y no tiene desglose de impuestos por el descuento, debe asignar el valor 04 - Si objeto de impuesto y no causa impuesto
+ If concepto.Impuestos.Count = 0 AndAlso concepto.ObjetoImpuesto = "02" AndAlso (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(2) = 0.00D Then
+ concepto.ObjetoImpuesto = "04"
+ End If
+
Timbre.Conceptos.Add(concepto)
i += 1
Next
@@ -12161,7 +12202,11 @@ Partial Class Ventas
Timbre.Complementos.ComercioExterior11.Incoterm = GlobalDTIncoterm.FiltroPrimeroValor("ClaveSATIncoterm", $"CveIncoterm={DdlIncoterm.SelectedValue}")
Timbre.Complementos.ComercioExterior11.Subdivision = "0"
Timbre.Complementos.ComercioExterior11.TipoCambioUSD = If(Obj.CveMoneda = 1, 1, Obj.TipoCambio.ToString().ToDecimal)
- Timbre.Complementos.ComercioExterior11.MotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("ClaveSATMotivoTraslado", $"CveMotivoTraslado={DdlSATMotivoTraslado.SelectedValue}")
+ If Timbre.Comprobante.TipoComprobante = "T" Then
+ Timbre.Complementos.ComercioExterior11.MotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("ClaveSATMotivoTraslado", $"CveMotivoTraslado={DdlSATMotivoTraslado.SelectedValue}")
+ Else
+ Timbre.Complementos.ComercioExterior11.MotivoTraslado = ""
+ End If
@@ -15075,7 +15120,7 @@ Partial Class Ventas
Dim DtProductos As DataTable = TmpDTDetalle.FiltraParametros("CveTipoPS = 2")
Dim MovDetalle As DataTable = New DataTable()
- MovDetalle.Columns.Add(New DataColumn("Cantidad", GetType(Integer)))
+ MovDetalle.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
MovDetalle.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
MovDetalle.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
MovDetalle.Columns.Add(New DataColumn("PU", GetType(Decimal)))
@@ -15100,29 +15145,48 @@ Partial Class Ventas
Next
'Le damos salida de apartado por traspaso
- Dim CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta, CveAlmacenDestino:=CveAlmacenExA)
+ Dim CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta, CveAlmacenDestino:=CveAlmacenExA, MovimientoPrePoliza:=False)
If Not CveMovimientoSalidaPorTraspaso > 0 Then
OcurrioError = True
End If
+ Dim CveMovimientoEntrada As Integer = -1
+
+ Dim TotalPrePoliza As Decimal = 0
+
'Le damos entrada al general por traspaso
If Not OcurrioError Then
- Dim GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenExA, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta) > 0
- If Not GeneroMovimientoAlmacen Then
- OcurrioError = True
+ If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaPorTraspaso, UsuarioActual.CveEmpresa) Then
+ MovDetalle = ObjInventario.DtResultados.Copy()
+ TotalPrePoliza = MovDetalle.SUMD("Total").RoundSQL(2)
End If
+
+ If Not OcurrioError Then
+ CveMovimientoEntrada = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenExA, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso, AplicaMovimientoDetalleEntrada:=False, ObjConta:=ObjConta, MovimientoPrePoliza:=False)
+
+ If CveMovimientoEntrada <= 0 Then
+ OcurrioError = True
+ End If
+ End If
+
End If
'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN
- If Not OcurrioError AndAlso DebeGenerarMovimiento Then
+ If Not OcurrioError Then
If Not (ObjInventario.GetInv_Mov(factura.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al verificar inventario.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
End If
+ If Not OcurrioError Then
+ If ContabilizaMovimientoAlmacen(ObjConta, Now, ObjFactura.SerieFolio, "Ventas/Rem", CveMovimientoSalidaPorTraspaso, CveMovimientoEntrada, TotalPrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) <= 0 Then
+ OcurrioError = True
+ End If
+ End If
+
End If
End If
@@ -16358,6 +16422,7 @@ Partial Class Ventas
End Function
#End Region
+
#Region " BTN ELIMINAR "
Protected Sub BtnEmitir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEmitir.Click
@@ -20151,6 +20216,7 @@ Partial Class Ventas
If Not OcurrioError Then
If MovimientoPrePoliza AndAlso CveMovimientoInventario > 0 Then
'OcurrioError = Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoInventario, CveAlmacen)
+
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
Dim DtCostos = ObjInventario.DtResultados.Copy
Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
@@ -20201,6 +20267,7 @@ Partial Class Ventas
Else
OcurrioError = True
End If
+
End If
End If
@@ -22583,30 +22650,35 @@ Partial Class Ventas
End Sub
- Private Sub CargaComboCFDICliente()
- If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
- DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI().FiltraParametros("CveUsoCFDI = 23")
- DdlUsoCFDICliente.DataBind()
- Else
- Dim RegimenFiscalCliente = DdlRegimenFiscalCliente.SelectedValue.ToString()
- If Not UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
- RegimenFiscalCliente = "-1"
- End If
-
- DdlUsoCFDICliente.Items.Clear()
- If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
- Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
- DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
+ Private Sub CargaComboCFDICliente()
+ If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
+ If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
+ DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI().FiltraParametros("CveUsoCFDI = 23")
+ DdlUsoCFDICliente.DataBind()
Else
- DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
- End If
+ Dim RegimenFiscalCliente As String = "-1"
- DdlUsoCFDICliente.DataBind()
+ If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
+ RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {DdlRegimenFiscalCliente.SelectedValue.ToEntero()}")
+ End If
+
+ DdlUsoCFDICliente.Items.Clear()
+ If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
+ Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
+ DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
+ Else
+ DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
+ End If
+
+ DdlUsoCFDICliente.DataBind()
+ DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ End If
+ Else
+ DdlUsoCFDICliente.Items.Clear()
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
- End If
-
-
- UpAgregarCliente.Update()
+ End If
+
+ UpAgregarCliente.Update()
End Sub
Protected Sub DdlRegimenFiscalCliente_SelectedIndexChanged(sender As Object, e As EventArgs)
@@ -22621,6 +22693,41 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero()
CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero()
+
+ Dim RegimenFiscalCliente As String = "-1"
+
+ If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
+ RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {CveRegimenFiscal}")
+ End If
+
+ If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.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 TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue <> "23" Then
+ Alert("El uso cfdi del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
+ Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then
+ Alert("El uso cfdi del cliente no puede ser 'S01 - Sin efectos fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
+ Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}")
+
+ If DtUsosCFDI.Rows.Count = 0 Then
+ Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
End If
If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
@@ -34510,7 +34617,7 @@ Partial Class Ventas
DVRegimenSociedad.Visible = False
DivRazonSocial2.Attributes.Add("class", "col-md-12")
- If RdTipoPersona.SelectedValue.ToEntero = 1 And UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
+ If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True
@@ -34537,6 +34644,11 @@ Partial Class Ventas
End If
+ DdlRegimenFiscalCliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+ DdlUsoCFDICliente.Items.Clear()
+ DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
End If
UpAgregarCliente.Update()