From 21d6457c994126e0a2a8cefd96f19096f4bc7d41 Mon Sep 17 00:00:00 2001 From: rrene Date: Fri, 9 Oct 2020 12:17:52 -0700 Subject: [PATCH] parametro de desglosaieps --- Ventas/Ventas.aspx.vb | 180 +++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index f66c6c5ef..6b1589eed 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -14555,116 +14555,116 @@ Partial Class Ventas If UsuarioActual.TienePermisoProceso(68) AndAlso Not PSCodigoSAT.Contiene("84111506", "80141610") Then TxtPrecio.Enabled = False If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then - DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString()) - CambiaMoneda() + DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString()) + CambiaMoneda() + End If + + 'SUGIERE PRECIO + Dim PrecioSugerido = 0.0 + PrecioSugerido = drPS("Precio").ToString().ToDouble + + 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 + If PrecioAplicado > 0 Then + PrecioSugerido = PrecioAplicado + End If + End If + ObjPS.Dispose() + End If + + If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente + Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero + ' si es 10. primero el cliente + Dim CvePrecioListaPS As Integer + Dim PorcentajePrecio As Double = 0 + + If TipoPrecioLista = 10 Then + + CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero() + If CvePrecioListaPS <= 0 Then + + CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero() + + End If + + Else + + CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero() + If CvePrecioListaPS <= 0 Then + + CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero() + + End If + End If - 'SUGIERE PRECIO - Dim PrecioSugerido = 0.0 - PrecioSugerido = drPS("Precio").ToString().ToDouble - - If UsuarioActual.CveEmpresa.Contiene(1) Then + If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPorcentajeProductos(CveCliente) Then - Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDouble - If PrecioAplicado > 0 Then - PrecioSugerido = PrecioAplicado - End If + If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then + PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDouble + PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDouble End If ObjPS.Dispose() End If - If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente - Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero - ' si es 10. primero el cliente - Dim CvePrecioListaPS As Integer - Dim PorcentajePrecio As Double = 0 - - If TipoPrecioLista = 10 Then - - CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero() - If CvePrecioListaPS <= 0 Then - - CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero() - - End If - - Else - - CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero() - If CvePrecioListaPS <= 0 Then - - CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero() - - 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) + '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() + If CostoPS > 0 And PorcentajePrecio > 0 Then + PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS End If - - 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 - 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) - '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() - If CostoPS > 0 And PorcentajePrecio > 0 Then - PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS - End If - End If - CvePrecioLista = CvePrecioListaPS End If + CvePrecioLista = CvePrecioListaPS + End If - 'Dim ObjClasificaciones As New ClsClasificaciones - 'If ObjClasificaciones.GetClasificaciones() Then - ' PrecioBaseCosto = ObjClasificaciones.DtResultados.FiltroPrimeroValor("PrecioBaseCosto", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveClasificacion = {drPS("CveClasificacion")}").ToDecimal - 'End If + 'Dim ObjClasificaciones As New ClsClasificaciones + 'If ObjClasificaciones.GetClasificaciones() Then + ' PrecioBaseCosto = ObjClasificaciones.DtResultados.FiltroPrimeroValor("PrecioBaseCosto", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveClasificacion = {drPS("CveClasificacion")}").ToDecimal + 'End If - If PrecioSugerido > 0 Then - Dim PrecioBaseCosto As Decimal = 0 - PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=drPS("CveClasificacion").ToString().ToEntero()).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal + If PrecioSugerido > 0 Then + Dim PrecioBaseCosto As Decimal = 0 + PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=drPS("CveClasificacion").ToString().ToEntero()).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal - If PrecioBaseCosto > 0 Then - PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1) - End If - TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere + If PrecioBaseCosto > 0 Then + PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1) End If + TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere + End If - If IsNumeric(TxtCantidad.Text.Trim) Then - LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2) + If IsNumeric(TxtCantidad.Text.Trim) Then + LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2) + Else + LblTotalPS.Text = "0.00" + End If + LblPrecio1.Text = TxtPrecio.Text + UPPDescuento.Update() + + HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString() + HdnIVARetAPS.Value = drPS("RetIVA").ToString() + HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString() + HdnCtaContable.Value = drPS("IdCtaContVentas").ToString() + HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString() + HdnCodigo.Value = drPS("Codigo").ToString() + If DdlClasificacion.SelectedIndex = 0 Then + If drPS("CveClasificacion").ToString() IsNot Nothing Then + DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString()) Else - LblTotalPS.Text = "0.00" - End If - LblPrecio1.Text = TxtPrecio.Text - UPPDescuento.Update() - - HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString() - HdnIVARetAPS.Value = drPS("RetIVA").ToString() - HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString() - HdnCtaContable.Value = drPS("IdCtaContVentas").ToString() - HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString() - HdnCodigo.Value = drPS("Codigo").ToString() - If DdlClasificacion.SelectedIndex = 0 Then - If drPS("CveClasificacion").ToString() IsNot Nothing Then - DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString()) - Else - Alert("El Productos/Servicio no tiene asignada una Clasificación.", TipoMensaje.MsgInformacion) - End If - + Alert("El Productos/Servicio no tiene asignada una Clasificación.", TipoMensaje.MsgInformacion) End If End If - ElseIf CvePSParametro = -2 Then + End If + + ElseIf CvePSParametro = -2 Then CargaPS(DdlClasificacion.SelectedValue.ToEntero(), Ddl) End If @@ -15774,7 +15774,7 @@ Partial Class Ventas 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 Me.ObjFacturaNC.VentaDesglosaIEPS)) + 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