From 59e3885806b59925e50e7c9a0844b11d3a4300e0 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 9 Dec 2024 13:54:15 -0700 Subject: [PATCH 1/3] --FIX precio libre --- Ventas/Ventas.aspx.vb | 141 ++++++++++++++++++++++++++---------------- 1 file changed, 86 insertions(+), 55 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 2b8c9e0fc..d4ab195da 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9016,8 +9016,15 @@ Partial Class Ventas End If - If UsuarioActual.CveEmpresa = 189 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then - GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False + If UsuarioActual.CveEmpresa = 189 Then + Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.NewEditIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") + + If CBool(DrPS("PrecioLibre")) Then + GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True + Else + GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False + End If + End If End Sub @@ -9072,6 +9079,7 @@ Partial Class Ventas Dim DatarowPS As DataRow = Nothing DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1 + Dim PrecioLibre As Boolean = False If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then If DdlTipoComprobante.SelectedValue = "Cot" Then If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then @@ -9080,6 +9088,8 @@ Partial Class Ventas End If End If + PrecioLibre = CBool(DatarowPS("PrecioLibre")) + If DdlTipoComprobante.SelectedValue = "Ant" Then Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString If PSCodigoSAT <> "84111506" Then @@ -9248,35 +9258,39 @@ Partial Class Ventas 'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO Dim MensajeCosto As New StringBuilder Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) - If Not EsValido Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo
", DatarowPS("PS").ToString()) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango menor aceptado es: {0:#,###.00}% ${1}
", PorcentajeMinimoCostoEmpresa, CostoMenor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + + If Not PrecioLibre Then + If Not EsValido Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo
", DatarowPS("PS").ToString()) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0:#,###.00}% ${1}
", PorcentajeMinimoCostoEmpresa, CostoMenor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + + + Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() + e.Cancel = True + Exit Sub End If - - Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) - MensajeCosto.Clear() - e.Cancel = True - Exit Sub - End If - - 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO - If Not EsValidoMayor Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO + If Not EsValidoMayor Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() + e.Cancel = True + Exit Sub End If - Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) - MensajeCosto.Clear() - e.Cancel = True - Exit Sub End If + End If End If End If @@ -18381,7 +18395,10 @@ Partial Class Ventas tPrecioSugerido = 0 PrecioSugerido = 0 - Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia) + If Not CBool(drPS("PrecioLibre")) Then + Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia) + End If + End If Else ObjPrecioSugerido.CvePrecioLista = -1 @@ -18389,7 +18406,10 @@ Partial Class Ventas tPrecioSugerido = 0 PrecioSugerido = 0 - Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia) + If Not CBool(drPS("PrecioLibre")) Then + Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia) + End If + End If End If @@ -18410,11 +18430,10 @@ Partial Class Ventas tPrecioSugerido = 0 PrecioSugerido = 0 - TxtPrecio.Enabled = True + TxtPrecio.Enabled = CBool(drPS("PrecioLibre")) Else - TxtPrecio.Enabled = False + TxtPrecio.Enabled = CBool(drPS("PrecioLibre")) End If - End If If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido @@ -19439,6 +19458,8 @@ Partial Class Ventas Return False End If + Dim PrecioLibre As Boolean = False + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DatarowPS IsNot Nothing Then @@ -19457,6 +19478,8 @@ Partial Class Ventas End If End If + PrecioLibre = CBool(DatarowPS("PrecioLibre")) + End If End If @@ -19675,30 +19698,33 @@ Partial Class Ventas End If 'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO - Dim MensajeCosto As New StringBuilder - Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) - If Not EsValido Then - MensajeCosto.AppendFormat("El Producto {0}-{1}. No se puede vender a un precio menor de su Costo
", HdnCodigoPS.Value, HdnPS.Value) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% ${1:#,###.00}
", PorcentajeMinimoCostoEmpresa, CostoMenor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + If Not PrecioLibre Then + Dim MensajeCosto As New StringBuilder + Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) + + If Not EsValido Then + MensajeCosto.AppendFormat("El Producto {0}-{1}. No se puede vender a un precio menor de su Costo
", HdnCodigoPS.Value, HdnPS.Value) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% ${1:#,###.00}
", PorcentajeMinimoCostoEmpresa, CostoMenor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + + Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) + Return False End If - Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) - Return False - End If - - 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO - If Not EsValidoMayor Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO + If Not EsValidoMayor Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + Return False End If - Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) - Return False End If End If @@ -19977,9 +20003,14 @@ Partial Class Ventas End If Else - 'sino es la seleccionada se recalcula de nuevo - CargaPrecioLista(DdlPS.SelectedValue.ToEntero) - Exit Sub + + Dim PermiteEdicion = UsuarioActual.CveEmpresa = 189 AndAlso TxtPrecio.Enabled + If Not PermiteEdicion Then + 'sino es la seleccionada se recalcula de nuevo + CargaPrecioLista(DdlPS.SelectedValue.ToEntero) + Exit Sub + End If + End If Else If Me.CvePrecioLista > 0 Then From ed056dee52f36e5565b600916e444095ef83f1d3 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 9 Dec 2024 17:47:15 -0700 Subject: [PATCH 2/3] --FIX validacion depositos de caja --- Bancos/DepositosCaja.aspx.vb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index d0ab743c1..e283820f4 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -511,7 +511,19 @@ Partial Class Bancos_DepositosCaja FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) - If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, FechaI, FechaF) Then + Dim CveSubProyecto As Integer = -1 + + If DdlSubProyectos.SelectedValue.ToEntero > 0 Then + CveSubProyecto = DdlSubProyectos.SelectedValue.ToEntero + End If + + Dim CveSubProyectoCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero() + + If CveSubProyectoCuenta > 0 Then + CveSubProyecto = CveSubProyectoCuenta + End If + + If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, CveSubProyecto, FechaI, FechaF) Then Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND (CveUsuarioCobranza IS NULL OR CveUsuarioCobranza = {UsuarioActual.CveUsuario}) AND TipoDocto IN ('Ing','Rem') AND RemisionEspecial = 0") 'Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario} ") 'If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta From 40f61c1f031a4afa3614c6986ed50e2bd24f536a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 10 Dec 2024 09:37:06 -0700 Subject: [PATCH 3/3] --FIX Ventas --- Ventas/Ventas.aspx.vb | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 367275147..a2edc2a23 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8715,8 +8715,25 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = True e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind() + If UsuarioActual.CveEmpresa = 189 Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Ped") Then + Using ObjVta As New ClsVentas + If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), e.Row.DBCampo("CvePS").ToEntero(), UsuarioActual.CveEmpresa) Then + Dim Dt As DataTable = Nothing + If UsuarioActual.TienePermisoProceso(384) Then + Dt = ObjVta.DtResultados.Copy() + Else + Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'") + End If + e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = Dt + End If + End Using + End If + + End If + + e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind() e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista")) End If @@ -18486,8 +18503,10 @@ Partial Class Ventas ObjInventarios.Dispose() If Costo > 0 Then - Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / TxtPrecio.Text.ToDecimal()) * 100D) - LtlHeaderCosto.Text = String.Format("{0:N2}
{1}", Costo, PorUtilidad) + If TxtPrecio.Text.ToDecimal() > 0 Then + Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / TxtPrecio.Text.ToDecimal()) * 100D) + LtlHeaderCosto.Text = String.Format("{0:N2}
{1}", Costo, PorUtilidad) + End If End If End If End If