diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 0bc56af0b..ab804f1be 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -4008,20 +4008,20 @@ Partial Class PV DdlUnidadMedida.SelectedValueExist(drPS("CveUnidadMedida").ToString) 'SUGIERE PRECIO - Dim PrecioSugerido = 0.0 - PrecioSugerido = drPS("Precio").ToString.ToDouble + Dim PrecioSugerido As Decimal = 0 + PrecioSugerido = drPS("Precio").ToString.ToDecimal If UsuarioActual.CveEmpresa.Contiene(80, 119) Then Dim CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then - PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDouble + PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal If PrecioSugerido = 0 Then Dim ObjInventarios As New ClsInventarios Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) ObjInventarios.Dispose() - Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDouble + Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal If CostoPS > 0 And PorcentajePrecio > 0 Then PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS End If @@ -4034,7 +4034,7 @@ Partial Class PV If UsuarioActual.CveEmpresa.Contiene(1) Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPorcentajeProductos(CveCliente) Then - Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDouble + Dim PrecioAplicado As Decimal = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDecimal If PrecioAplicado > 0 Then PrecioSugerido = PrecioAplicado End If @@ -4046,7 +4046,7 @@ Partial Class PV Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero ' si es 10. primero el cliente Dim CvePrecioListaPS As Integer - Dim PorcentajePrecio As Double = 0 + Dim PorcentajePrecio As Decimal = 0 If TipoPrecioLista = 10 Then CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero() @@ -4063,15 +4063,15 @@ Partial Class PV If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then - PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDouble - PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDouble + PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal + PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal End If ObjPS.Dispose() End If If PrecioSugerido = 0 Then Dim ObjInventarios As New ClsInventarios - Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) + Dim CostoPS As Decimal = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) ObjInventarios.Dispose() @@ -4124,9 +4124,13 @@ Partial Class PV End If 'Descuento por clasificación - If drPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then - TxtDescuento.Text = (PrecioSugerido * ClasificacionesDescuentos(drPS("CveClasificacion").ToString.ToEntero)).ToString("F2") + Dim ObjDescuento As New Descuentos + + ObjDescuento = CalcularDescuentos(CvePSParametro, TxtCantidad.Text.Trim.ToDecimal, PrecioSugerido) + If ObjDescuento.EsPUModificado Then + PrecioSugerido = ObjDescuento.PU End If + TxtDescuento.Text = ObjDescuento.ImporteDescuento.ToString("N2") HdnDescuentoOriginal.Value = TxtDescuento.Text.ToDecimal().ToString() LblDescuentoIncluido.Text = TxtDescuento.Text.ToDecimal().FormatoNumero(2) @@ -4317,6 +4321,10 @@ Partial Class PV End If End If + Else + If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then + Descuento = PU * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero) + End If End If ObjDescuento.ImporteDescuento = Descuento