diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 558d8b7a5..2afd68348 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -18360,6 +18360,10 @@ Partial Class Ventas
Dim ClienteRetIVA = Me.ClienteRetIVA
+ If ClienteRetIVA <= 0 AndAlso DrPS("RetIVA").ToString.ToDecimal > 0 Then
+ ClienteRetIVA = DrPS("RetIVA").ToString.ToDecimal
+ DdlTipoRetencion.Enabled = True
+ End If
If ClienteRetIVA <= 0 Then
If CBool(DrPS("EsOutSourcing").ToString()) Then
@@ -18381,8 +18385,6 @@ Partial Class Ventas
Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
-
-
Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
@@ -18556,253 +18558,9 @@ Partial Class Ventas
OnError("Ocurrió un error al agregar el producto/servicio", ex)
End Try
-
Return Retorno
End Function
- 'Private Function AgregarProductoServicioCotizacion(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
- ' PU As Decimal, Descuento As Decimal, PorcentajeIVA As Decimal, ImporteIVA As Decimal, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, Optional Serie As String = "", Optional TiempoEntrega As String = "",
- ' Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
- ' Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "",
- ' Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False,
- ' Optional ImporteProntoPago As Decimal = 0) As Boolean
-
- ' Dim Retorno As Boolean = False
- ' Try
- ' If Not CvePS > 0 Then
- ' Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
- ' Return False
- ' End If
-
- ' Dim Row As DataRow = Nothing
- ' Dim TotalCalculableImpuestos As Decimal = 0
- ' PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
- ' Descuento = Descuento.RoundSQL(NumeroDecimales)
-
- ' If Not TmpDT.Columns.Contains("RetIVA") Then
- ' TmpDT.Columns.Add("RetIVA", GetType(Decimal))
- ' End If
-
- ' Row = TmpDT.NewRow()
- ' Row("CveProyecto") = CveProyecto
- ' Row("Proyecto") = Proyecto
- ' Row("CveSubProyecto") = CveSubProyecto
- ' Row("SubProyecto") = SubProyecto
- ' Row("Serie") = Serie
- ' Row("TiempoEntrega") = TiempoEntrega
- ' If Modalidad = "U" Then
- ' Row("Orden") = Index
- ' Else
- ' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
- ' If ConsecutivoActual < 0 Then
- ' ConsecutivoActual = 0
- ' End If
- ' Row("Orden") = ConsecutivoActual + 1
- ' End If
-
- ' Row("Cantidad") = Cantidad
- ' Row("CveUM") = CveUM
- ' Row("UM") = UM
- ' Row("CveClasificacion") = CveClasificacion
- ' Row("Clasificacion") = Clasificacion
- ' Row("CvePS") = CvePS
- ' Row("Obs") = Obs
-
-
- ' Dim DrPS As DataRow = Nothing
-
- ' DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
-
- ' If DrPS Is Nothing Then
- ' Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
- ' Return False
- ' End If
-
- ' If (DrPS("SATClaveUnidadMedida").ToString() = "" Or DrPS("SATClavePS").ToString() = "") Then
- ' 'VALIDA CLAVESAT
- ' If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then 'DOCUMENTOS DONDE NO SE VALIDA
- ' If DrPS("SATClavePS").ToString() = "" Then
- ' MensajeCveSAT.AppendFormat("{0}-{1}: Sin producto SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString())
- ' Return False
- ' ElseIf DrPS("SATClaveUnidadMedida").ToString() = "" Then
- ' MensajeCveSAT.AppendFormat("{0}-{1}: Sin Unidad Medida SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString())
- ' Return False
- ' End If
-
- ' 'If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
- ' ' MensajeCveSAT.AppendFormat("{0}-{1}: El producto/servicio no existe en el catálogo del SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString())
- ' ' Return False
- ' 'End If
- ' End If
- ' Else
- ' If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
- ' MensajeCveSAT.AppendFormat("{0}-{1}: El producto/servicio no existe en el catálogo del SAT
", DrPS("Codigo").ToString(), DrPS("PS").ToString())
- ' Return False
- ' End If
- ' End If
-
- ' 'verifica si tiene ventaminima
- ' If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString().ToDecimal > 0 Then
- ' 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
- ' If Cantidad Mod DrPS("VentaMinima").ToString().ToDecimal <> 0 Then
- ' Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString()))
- ' Return False
- ' End If
- ' End If
-
- ' 'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS
- ' Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS))
-
- ' If Not ClienteDesglosaIEPS Then
- ' If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then
- ' PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
- ' VentaDesglosaIEPS = True
- ' End If
- ' DrPS("IEPSPorcentaje") = 0
- ' End If
- ' 'SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA
- ' If FacturaDesglosoIEPS Then
- ' VentaDesglosaIEPS = True
- ' End If
-
-
- ' TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
-
- ' Row("PU") = PU
- ' Row("Codigo") = DrPS("Codigo")
- ' Row("NoIdentificacion") = DrPS("Codigo")
- ' Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
- ' Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
- ' Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
- ' Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
- ' If Modalidad = "U" Then
- ' Row("Consec") = Index
- ' Else
- ' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
- ' If ConsecutivoActual < 0 Then
- ' ConsecutivoActual = 0
- ' End If
- ' Row("Consec") = ConsecutivoActual + 1
- ' End If
-
- ' Row("PS") = DrPS("PS")
- ' Row("CodigoPS") = DrPS("PSCodigo").ToString()
- ' Row("CveTipoPS") = DrPS("CveTipoPS")
- ' Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
- ' Row("CveTamaño") = DrPS("CveTamaño")
-
- ' If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
- ' If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
-
- ' Row("PorcentajeIVA") = PorcentajeIVA
-
- ' Dim ClienteRetIVA = Me.ClienteRetIVA
-
- ' If ClienteRetIVA <= 0 Then
- ' If CBool(DrPS("EsOutSourcing").ToString()) Then
- ' ClienteRetIVA = 0.06D
- ' DdlTipoRetencion.SelectedValueExist("4")
- ' ElseIf DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
- ' ClienteRetIVA = 0.106667D
- ' ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
- ' ClienteRetIVA = 0.04D
- ' End If
- ' End If
-
- ' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
- ' TrRetIVA.Style.Add("display", "")
- ' DdlTipoRetencion.Visible = True
-
-
- ' Row("IVA") = PorcentajeIVA
- ' Row("ImporteIVA") = (ImporteIVA).RoundSQL(NumeroDecimales)
- ' Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
-
-
-
- ' Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
-
- ' Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
- ' Row("PorcentajeRetIVA") = ClienteRetIVA
- ' Row("PorcentajeRetISR") = ClienteRetISR
- ' Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
- ' Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
- ' Row("IEPS") = Row("ImporteIEPS")
- ' Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
- ' Row("TipoDescuento") = HdnTipoDescuento.Value
- ' Row("CvePromocionDetalle") = CvePromocionDetalle
- ' Row("Total") = (Cantidad * PU)
- ' Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
-
- ' 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
- ' ' Row("IdCtaContVentas") = IdCtaContable
- ' ' Row("AplicaParaConcepto") = AplicaParaConcepto
-
- ' Row("SATClaveProdServ") = DrPS("SATClavePS")
- ' Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
-
- ' If UsuarioActual.Empresa.UsaAC Then
- ' Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
- ' End If
-
- ' Row("EntregaDirecta") = EntregaDirecta
- ' 'Contratos
- ' Row("CveContratoDetalle") = CveContratoDetalle
- ' Row("CveVentaDetalle") = CveVentaDetalle
- ' Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido
- ' Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
- ' Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
- ' Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
- ' Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
- ' Row("CuentaPredial") = CuentaPredial
- ' Row("EsOutSourcing") = DrPS("EsOutSourcing")
- ' Row("EsCargo") = EsCargo
-
- ' If ImporteProntoPago > 0 Then
- ' Row("ImporteProntoPago") = ImporteProntoPago
- ' Row("TieneProntoPago") = "Si"
- ' 'SOLO DEBE MOSTRASE SI EL PAGO ES DE CONTADO
- ' If RBLPago.SelectedValue = "2" Then
- ' GvPS.Columns(22).Visible = True
- ' thProntoPago.Visible = True
- ' thProntoPago2.Visible = True
- ' End If
-
- ' End If
-
- ' If UsuarioActual.CveEmpresa = 119 Then
- ' If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
-
- ' 'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
- ' If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
- ' If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString() Then
- ' Alert($"La moneda base del producto: {DrPS("PSCodigo").ToString()} es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
- ' Return False
- ' End If
- ' End If
-
- ' 'ACTIVA PRODUCTOS DE LA MISMA MONEDA
- ' If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
- ' DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString())
- ' CambiaMoneda()
- ' DdlMoneda.Enabled = False
- ' End If
- ' End If
- ' End If
-
- ' 'RECARGAR GV
- ' TmpDT.Rows.Add(Row)
-
- ' Retorno = True
- ' Catch ex As Exception
- ' Retorno = False
- ' OnError("Ocurrió un error al agregar el producto/servicio", ex)
- ' End Try
-
-
- ' Return Retorno
- 'End Function
-
#End Region
#Region "D A T A - T A B L E S"
@@ -34697,17 +34455,17 @@ Partial Class Ventas
End If
Dim CveSubProyecto As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero()
- Dim CveProyecto = GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProyecto", "").ToEntero()
+ Dim CveProyecto = GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProyecto", "").ToEntero()
Dim Proyecto As String = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, CveProyecto, UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("Proyecto", "").ToString()
- AgregarProductoServicio(Cantidad, CveUM, UnidadMedida, CveClasificacion, Clasificacion,
+ AgregarProductoServicio(Cantidad, CveUM, UnidadMedida, CveClasificacion, Clasificacion,
CvePSServicio, "", TxtObservacionesMercancia.Text.Trim, PU, Descuento,
CveProyecto, Proyecto, CveSubProyecto, DdlSubProyectoDatos.SelectedItem.Text,
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=-1,
ImporteProntoPago:=0)
- CalculaUsados()
+ CalculaUsados()
CalculaTotalesVenta()
Else