diff --git a/Bancos/PopUpBuscarIE.aspx.vb b/Bancos/PopUpBuscarIE.aspx.vb index 494a38e23..28e66b31b 100644 --- a/Bancos/PopUpBuscarIE.aspx.vb +++ b/Bancos/PopUpBuscarIE.aspx.vb @@ -67,23 +67,29 @@ Partial Class Bancos_PopUpBuscarIE Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click - Dim ObjBancosIE As New ClsBancos Dim Folio As String = "-1" If TxtFolio.Text <> "" Then Folio = String.Format("%{0}%", TxtFolio.Text.Trim) - If ObjBancosIE.GetBancosIE(-1, DdlBanco.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, "-1", -1, Folio, "-1", -1, -1, -1, -1, -1, txtFechaI.Text.ToDate, MaxFecha.ToShortDateString.ToDate, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then - DtDatos = ObjBancosIE.DtResultados 'If(TxtFolio.Text <> "", ObjBancosIE.DtResultados.FiltraParametros(String.Format("Folio Like '{0}'", TxtFolio.Text)), ObjBancosIE.DtResultados) + If ValidarFiltrosSeleccionado() Then + + Dim ObjBancosIE As New ClsBancos + If ObjBancosIE.GetBancosIE(-1, DdlBanco.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, "-1", -1, Folio, "-1", -1, -1, -1, -1, -1, txtFechaI.Text.ToDate, + MaxFecha.ToShortDateString.ToDate, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then + DtDatos = ObjBancosIE.DtResultados 'If(TxtFolio.Text <> "", ObjBancosIE.DtResultados.FiltraParametros(String.Format("Folio Like '{0}'", TxtFolio.Text)), ObjBancosIE.DtResultados) + Else + Alert("Ocurrió un error al consultar los Anticipos", TipoMensaje.MsgError) + DtDatos = Nothing + End If + + ObjBancosIE.Dispose() + + If DtDatos IsNot Nothing Then + GvDatos.DataSource = DtDatos + GvDatos.DataBind() + UpDatos.Update() + End If Else - Alert("Ocurrió un error al consultar los Anticipos", TipoMensaje.MsgError) - DtDatos = Nothing - End If - - ObjBancosIE.Dispose() - - If DtDatos IsNot Nothing Then - GvDatos.DataSource = DtDatos - GvDatos.DataBind() - UpDatos.Update() + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) End If End Sub @@ -103,4 +109,11 @@ Partial Class Bancos_PopUpBuscarIE End If End Sub + Private Function ValidarFiltrosSeleccionado() As Boolean + If DdlBanco.SelectedValue.ToEntero > 0 Then Return True + If DdlCuenta.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.Length > 0 Then Return True + Return False + End Function + End Class diff --git a/CGame/PopUpBuscarEmpaque.aspx.cs b/CGame/PopUpBuscarEmpaque.aspx.cs index 72d8e2765..ce4a09ed2 100644 --- a/CGame/PopUpBuscarEmpaque.aspx.cs +++ b/CGame/PopUpBuscarEmpaque.aspx.cs @@ -26,27 +26,32 @@ public partial class CGame_PopUpBuscarProduccion :ClsPaginas } protected void Consultar_Click(object sender, EventArgs e) { - String Folio; - if (TxtFolio.Text != "") { Folio = TxtFolio.Text; } else { Folio = "-1"; } - ClsCGame ObjCGame = new ClsCGame(); - if (ObjCGame.GetProduccion(UsuarioActual.CveEmpresa, Folio, -1, DdlHuerta.SelectedValue.ToEntero(), TxtFechaEntregaI.Text.ToDate(), TxtFechaEntregaF.Text.ToDate())) + if (ValidarFiltrosSeleccionados()) { - GvDatos.DataSource = ObjCGame.DtResultados; - GvDatos.DataBind(); - LtlTotalRegistros.Text = ObjCGame.DtResultados.Rows.Count.ToString(); - if (ObjCGame.DtResultados.Rows.Count < 1) + String Folio; + if (TxtFolio.Text != "") { Folio = TxtFolio.Text; } else { Folio = "-1"; } + ClsCGame ObjCGame = new ClsCGame(); + if (ObjCGame.GetProduccion(UsuarioActual.CveEmpresa, Folio, -1, DdlHuerta.SelectedValue.ToEntero(), TxtFechaEntregaI.Text.ToDate(), TxtFechaEntregaF.Text.ToDate())) { - Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia); - } - else - { - TblBusqueda.Visible = true; + GvDatos.DataSource = ObjCGame.DtResultados; + GvDatos.DataBind(); + LtlTotalRegistros.Text = ObjCGame.DtResultados.Rows.Count.ToString(); + if (ObjCGame.DtResultados.Rows.Count < 1) + { + Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia); + } + else + { + TblBusqueda.Visible = true; + } } + ObjCGame.Dispose(); + UPDatos.Update(); + }else + { + Alert("Seleccione un criterio de busqueda",TipoMensaje.MsgAdvertencia); } - ObjCGame.Dispose(); - UPDatos.Update(); - } #region GridView @@ -60,4 +65,12 @@ public partial class CGame_PopUpBuscarProduccion :ClsPaginas } #endregion + private bool ValidarFiltrosSeleccionados() + { + if(TxtFolio.Text.Length > 0) return true; + if(DdlHuerta.SelectedValue.ToEntero() > 0) return true; + if(TxtFechaEntregaI.Text.Length > 0) return true; + if(TxtFechaEntregaF.Text.Length > 0) return true; + return false; + } } \ No newline at end of file diff --git a/CGame/PopUpBuscarOrdenProduccion.aspx.vb b/CGame/PopUpBuscarOrdenProduccion.aspx.vb index 484e1a0fa..f2bc848fc 100644 --- a/CGame/PopUpBuscarOrdenProduccion.aspx.vb +++ b/CGame/PopUpBuscarOrdenProduccion.aspx.vb @@ -37,19 +37,23 @@ Partial Class CGame_PopUpBuscarOrdenProduccion Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click Dim Folio As String If TxtFolio.Text.Trim <> "" Then Folio = TxtFolio.Text Else Folio = "-1" - Dim ObjOP As New ClsCGame - If ObjOP.GetOrdenProduccion(-1, UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero, Folio, TxtFechaEntregaI.Text.ToDate, TxtFechaEntregaF.Text.ToDate, DdlCliente.SelectedValue.ToEntero) Then - GvOP.DataSource = ObjOP.DtResultados - GvOP.DataBind() - LtlTotalRegistros.Text = ObjOP.DtResultados.Rows.Count.ToString - If Not ObjOP.DtResultados.Rows.Count > 0 Then - Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia) - Else - TblBusqueda.Visible = True + If ValidarFiltrosSeleccionado() Then + Dim ObjOP As New ClsCGame + If ObjOP.GetOrdenProduccion(-1, UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero, Folio, TxtFechaEntregaI.Text.ToDate, TxtFechaEntregaF.Text.ToDate, DdlCliente.SelectedValue.ToEntero) Then + GvOP.DataSource = ObjOP.DtResultados + GvOP.DataBind() + LtlTotalRegistros.Text = ObjOP.DtResultados.Rows.Count.ToString + If Not ObjOP.DtResultados.Rows.Count > 0 Then + Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia) + Else + TblBusqueda.Visible = True + End If End If + ObjOP.Dispose() + UPDatos.Update() + Else + Alert("Seleccione un criterio de busqueda", TipoMensaje.MsgAdvertencia) End If - ObjOP.Dispose() - UPDatos.Update() End Sub Private Sub GvOP_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvOP.RowDataBound @@ -57,4 +61,13 @@ Partial Class CGame_PopUpBuscarOrdenProduccion e.Row.FCLabel("LblFolio").Text = String.Format("
{0}{1}
", "", e.Row.DBCampo("Folio")) End If End Sub + + Private Function ValidarFiltrosSeleccionado() As Boolean + If DdlEstatus.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.Length > 0 Then Return True + If TxtFechaEntregaI.Text.Length > 0 Then Return True + If TxtFechaEntregaF.Text.Length > 0 Then Return True + If DdlCliente.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function End Class diff --git a/CRM/PopUpBuscarAcercamiento.aspx.cs b/CRM/PopUpBuscarAcercamiento.aspx.cs index 982fd1a6c..958a4cc7c 100644 --- a/CRM/PopUpBuscarAcercamiento.aspx.cs +++ b/CRM/PopUpBuscarAcercamiento.aspx.cs @@ -164,21 +164,41 @@ public partial class CRM_PopUpBuscarAcercamiento : ClsPaginas string FechaCierre = TxtFechaCierre.Text == "" ? "-1" : TxtFechaCierre.Text; string NombreAcercamiento = TxtAcercamiento.Text == "" ? "-1" : TxtAcercamiento.Text; - ClsCRM ObjCRM = new ClsCRM(); - if (ObjCRM.GetAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM, -1, CveTipoProceso, CveVendedor, "-1", "-1", NombreAcercamiento, CveMedioCaptacion, CveRechazoMotivo, CveProbabilidad, FechaApertura, FechaCierre)) + if (ValidarFiltrosSeleccionados()) { - GVDatos.DataSource = ObjCRM.DtResultados; - GVDatos.DataBind(); + ClsCRM ObjCRM = new ClsCRM(); + if (ObjCRM.GetAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM, -1, CveTipoProceso, CveVendedor, "-1", "-1", NombreAcercamiento, CveMedioCaptacion, CveRechazoMotivo, CveProbabilidad, FechaApertura, FechaCierre)) + { + GVDatos.DataSource = ObjCRM.DtResultados; + GVDatos.DataBind(); - LtlTotalRegistros.Text = ObjCRM.DtResultados.Rows.Count.ToString(); - if (ObjCRM.DtResultados.Rows.Count > 0) - DivBusqueda.Visible = true; - else - DivBusqueda.Visible = false; + LtlTotalRegistros.Text = ObjCRM.DtResultados.Rows.Count.ToString(); + if (ObjCRM.DtResultados.Rows.Count > 0) + DivBusqueda.Visible = true; + else + DivBusqueda.Visible = false; + } + + ObjCRM.Dispose(); + UPDatos.Update(); + }else + { + Alert("Seleccione un criterio de busqueda",ModExtensiones.TipoMensaje.MsgAdvertencia); } + } - ObjCRM.Dispose(); - UPDatos.Update(); + private bool ValidarFiltrosSeleccionados() + { + if (DdlTipoProceso.SelectedValue.ToEntero() > 0) return true; + if (DdlEmpresaCRM.SelectedValue.ToEntero() > 0) return true; + if (DdlVendedor.SelectedValue.ToEntero() > 0) return true; + if (DdlMedioCaptacion.SelectedValue.ToEntero() > 0) return true; + if (DdlRechazoMotivo.SelectedValue.ToEntero() > 0) return true; + if (DdlProbabilidad.SelectedValue.ToEntero() > 0) return true; + if (TxtFechaApertura.Text != "") return true; + if (TxtFechaCierre.Text != "") return true; + if (TxtAcercamiento.Text != "") return true; + return false; } #endregion } \ No newline at end of file diff --git a/Compras/PopUpBuscarProveedor.aspx.vb b/Compras/PopUpBuscarProveedor.aspx.vb index 3480e09ea..e86761bd7 100644 --- a/Compras/PopUpBuscarProveedor.aspx.vb +++ b/Compras/PopUpBuscarProveedor.aspx.vb @@ -60,15 +60,19 @@ Partial Class Compras_PopUpBuscarProveedor If TxtTelefono.Text.Trim <> String.Empty Then Telefono = TxtTelefono.Text.Trim CveTipoProveedor = DdlTipoProveedor.SelectedValue.ToEntero - If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, Codigo, RazonSocial, NombreComercial, NombreCorto, RFC, Contacto, Telefono, -1, UsuarioActual.CveEmpresa, CveTipoProveedor:=CveTipoProveedor) Then - If ObjProveedor.DtResultados.Rows.Count > 0 Then - LtlTotalRegistros.Text = ObjProveedor.DtResultados.Rows.Count.ToString.FormatoNumero(0) - GV.DataSource = ObjProveedor.DtResultados - Else - LtlTotalRegistros.Text = "0" - GV.DataSource = Nothing - Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + If ValidarUnFiltroSeleccionado() Then + If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, Codigo, RazonSocial, NombreComercial, NombreCorto, RFC, Contacto, Telefono, -1, UsuarioActual.CveEmpresa, CveTipoProveedor:=CveTipoProveedor) Then + If ObjProveedor.DtResultados.Rows.Count > 0 Then + LtlTotalRegistros.Text = ObjProveedor.DtResultados.Rows.Count.ToString.FormatoNumero(0) + GV.DataSource = ObjProveedor.DtResultados + Else + LtlTotalRegistros.Text = "0" + GV.DataSource = Nothing + Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + End If End If + Else + Alert("Seleccione un criterio de búsqueda", TipoMensaje.MsgAdvertencia) End If ObjProveedor.Dispose() @@ -106,7 +110,7 @@ Partial Class Compras_PopUpBuscarProveedor Case Else Liga = String.Format("", e.Row.DBCampo("CveProveedor")) End Select - + e.Row.FCLiteral("LtlCodigo").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("Codigo")) e.Row.FCLiteral("LtlRazonSocial").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("RazonSocial")) e.Row.FCLiteral("LtlNombreComercial").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("NombreComercial")) @@ -115,4 +119,16 @@ Partial Class Compras_PopUpBuscarProveedor e.Row.FCLiteral("LtlContacto").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("ContactoNombre")) End If End Sub + + Private Function ValidarUnFiltroSeleccionado() As Boolean + If TxtCodigo.Text.Trim <> String.Empty Then Return True + If TxtRazonSocial.Text.Trim <> String.Empty Then Return True + If TxtNombreComercial.Text.Trim <> String.Empty Then Return True + If TxtNombreCorto.Text.Trim <> String.Empty Then Return True + If TxtRFC.Text.Trim <> String.Empty Then Return True + If TxtContacto.Text.Trim <> String.Empty Then Return True + If TxtTelefono.Text.Trim <> String.Empty Then Return True + If DdlTipoProveedor.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function End Class diff --git a/Contratos/PopUpBuscarContrato.aspx.vb b/Contratos/PopUpBuscarContrato.aspx.vb index 75ff476e4..b25785ab2 100644 --- a/Contratos/PopUpBuscarContrato.aspx.vb +++ b/Contratos/PopUpBuscarContrato.aspx.vb @@ -125,7 +125,7 @@ Partial Class Contratos_PopUpBuscarContrato End Sub Protected Sub BtnBuscar_Click(sender As Object, e As EventArgs) Handles BtnBuscar.Click - Dim objContratos As New ClsContratos + Dim NumeroContrato As String = "-1" Dim Estatus As Integer = 1 @@ -141,20 +141,27 @@ Partial Class Contratos_PopUpBuscarContrato If TxtResponsable.Text.Trim.Length > 0 Then Responsable = TxtResponsable.Text If TxtNumeroContrato.Text.Trim.Length > 0 Then NumeroContrato = TxtNumeroContrato.Text - If (objContratos.GetContratosBusquedaRep(DdlTipo.SelectedValue.ToEntero, DdlTipoContrato.SelectedValue.ToEntero, NumeroContrato, Descripcion, - Ubicacion, Responsable, Estatus, DdlProyecto.SelectedValue.ToEntero, DdlSubProtecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, DdlCliente.SelectedValue.ToEntero, DdlProveedor.SelectedValue.ToEntero)) Then - GV.DataSource = objContratos.DtResultados - LtlTotalRegistros.Text = objContratos.DtResultados.Rows.Count.ToString + If ValidarUnFiltroSeleccionado() Then + Dim objContratos As New ClsContratos + If (objContratos.GetContratosBusquedaRep(DdlTipo.SelectedValue.ToEntero, DdlTipoContrato.SelectedValue.ToEntero, NumeroContrato, Descripcion, Ubicacion, Responsable, Estatus, + DdlProyecto.SelectedValue.ToEntero, DdlSubProtecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, DdlCliente.SelectedValue.ToEntero, + DdlProveedor.SelectedValue.ToEntero)) Then + GV.DataSource = objContratos.DtResultados + LtlTotalRegistros.Text = objContratos.DtResultados.Rows.Count.ToString + Else + GV.DataSource = Nothing + LtlTotalRegistros.Text = "0" + End If + + + + objContratos.Dispose() + GV.DataBind() + UPDatos.Update() Else - GV.DataSource = Nothing - LtlTotalRegistros.Text = "0" + Alert("Seleccione un criterio de busqueda", TipoMensaje.MsgAdvertencia) End If - - - objContratos.Dispose() - GV.DataBind() - UPDatos.Update() End Sub Private Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound @@ -173,6 +180,19 @@ Partial Class Contratos_PopUpBuscarContrato End If - End Sub + + Private Function ValidarUnFiltroSeleccionado() As Boolean + If TxtDescripcion.Text.Trim.Length > 0 Then Return True + If TxtUbicacion.Text.Trim.Length > 0 Then Return True + If TxtResponsable.Text.Trim.Length > 0 Then Return True + If TxtNumeroContrato.Text.Trim.Length > 0 Then Return True + 'If DdlTipo.SelectedValue.ToEntero > 0 Then Return True + If DdlTipoContrato.SelectedValue.ToEntero > 0 Then Return True + If DdlProyecto.SelectedValue.ToEntero > 0 Then Return True + If DdlSubProtecto.SelectedValue.ToEntero > 0 Then Return True + If DdlCliente.SelectedValue.ToEntero > 0 Then Return True + If DdlProveedor.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function End Class \ No newline at end of file diff --git a/Inventarios/PopUpBuscarMovto.aspx.vb b/Inventarios/PopUpBuscarMovto.aspx.vb index 92994df68..9f5c1dd38 100644 --- a/Inventarios/PopUpBuscarMovto.aspx.vb +++ b/Inventarios/PopUpBuscarMovto.aspx.vb @@ -49,27 +49,38 @@ Partial Class PopUpBuscarFolio CargaDatos() End Sub Private Sub CargaDatos() - Dim Reporte As New ClsInventarios + If ValidarFiltrosSeleccionados() Then + Dim Reporte As New ClsInventarios - Dim FechaInicial = If(TxtFechaI.Text.Trim <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text.ToDate, MinFecha) - Dim FechaFinal = If(TxtFechaF.Text.Trim <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text.ToDate, MaxFecha) - Dim FechaIngI = If(TxtFechaIngInicio.Text.Trim <> "" AndAlso TxtFechaIngInicio.Text <> "__/__/____", TxtFechaIngInicio.Text.ToDate, MinFecha) - Dim FechaIngF = If(TxtFechaIngFin.Text.Trim <> "" AndAlso TxtFechaIngFin.Text <> "__/__/____", TxtFechaIngFin.Text.ToDate, MaxFecha) + Dim FechaInicial = If(TxtFechaI.Text.Trim <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text.ToDate, MinFecha) + Dim FechaFinal = If(TxtFechaF.Text.Trim <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text.ToDate, MaxFecha) + Dim FechaIngI = If(TxtFechaIngInicio.Text.Trim <> "" AndAlso TxtFechaIngInicio.Text <> "__/__/____", TxtFechaIngInicio.Text.ToDate, MinFecha) + Dim FechaIngF = If(TxtFechaIngFin.Text.Trim <> "" AndAlso TxtFechaIngFin.Text <> "__/__/____", TxtFechaIngFin.Text.ToDate, MaxFecha) - If Reporte.GetMovimientosRep(DdlAlmacen.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, If(TxtFolio.Text = "", "-1", TxtFolio.Text.Trim).ToEntero, FechaIngI, FechaIngF, FechaInicial, FechaFinal, -1, UsuarioActual.CveEmpresa) Then - GvM.DataSource = Reporte.DtResultados - LtlTotalRegistros.Text = Reporte.DtResultados.Rows.Count.ToString.FormatoNumero(0) + If Reporte.GetMovimientosRep(DdlAlmacen.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, If(TxtFolio.Text = "", "-1", TxtFolio.Text.Trim).ToEntero, + FechaIngI, FechaIngF, FechaInicial, FechaFinal, -1, UsuarioActual.CveEmpresa) Then + GvM.DataSource = Reporte.DtResultados + LtlTotalRegistros.Text = Reporte.DtResultados.Rows.Count.ToString.FormatoNumero(0) + Else + GvM.DataSource = Nothing + End If + + GvM.DataBind() + + UPDatos.Update() + TblBusqueda.Visible = True + Reporte.Dispose() Else - GvM.DataSource = Nothing + Alert("Seleccione un criterio de busqueda", TipoMensaje.MsgAdvertencia) End If - - GvM.DataBind() - - UPDatos.Update() - TblBusqueda.Visible = True - Reporte.Dispose() End Sub + + Private Function ValidarFiltrosSeleccionados() As Boolean + If DdlAlmacen.SelectedValue.ToEntero > 0 Then Return True + If DdlTipoMovimiento.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.Length > 0 Then Return True + Return False + End Function #End Region - End Class diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx.vb b/Inventarios/PopUpExistenciasAlmacen.aspx.vb index 4f988dc7f..c3bc4fc7c 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx.vb +++ b/Inventarios/PopUpExistenciasAlmacen.aspx.vb @@ -94,72 +94,77 @@ Partial Class Inventarios_Default End If End Sub Private Sub CargaDatos(CvePS As Integer, Tipo As Integer) - Dim ObjInventarios As New ClsInventarios() - If ObjInventarios.GetExistenciasProducto(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then - Dim dr As Data.DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") - If dr IsNot Nothing Then - LtPs.Text = $"Producto: {dr("PSCodigo").ToString}" - Dim CvePrecioLista As Integer = -1 - If Not UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then 'sino manneja precios de lista - CvePrecioLista = -2 - End If + If ValidarFiltrosSeleccionados() Then + Dim ObjInventarios As New ClsInventarios() + If ObjInventarios.GetExistenciasProducto(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then + Dim dr As Data.DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") - Dim ObjVta As New ClsVentas - Dim objPS As New ClsProductosServicios - If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then - If ObjVta.DtResultados.Rows.Count > 0 Then - If CvePrecioLista = -1 Then CvePrecioLista = ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero - If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, -1, DDlPS.SelectedValue.ToEntero) Then - If objPS.DtResultados.Rows.Count > 0 Then - LtPrecioPS.Text = $"Precio de venta: $: {objPS.DtResultados.Rows(0)("PrecioLista").ToString.FormatoNumero} {dr("Abreviatura").ToString}" + If dr IsNot Nothing Then + LtPs.Text = $"Producto: {dr("PSCodigo").ToString}" + Dim CvePrecioLista As Integer = -1 + If Not UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then 'sino manneja precios de lista + CvePrecioLista = -2 + End If + + Dim ObjVta As New ClsVentas + Dim objPS As New ClsProductosServicios + If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then + If ObjVta.DtResultados.Rows.Count > 0 Then + If CvePrecioLista = -1 Then CvePrecioLista = ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero + If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, -1, DDlPS.SelectedValue.ToEntero) Then + If objPS.DtResultados.Rows.Count > 0 Then + LtPrecioPS.Text = $"Precio de venta: $: {objPS.DtResultados.Rows(0)("PrecioLista").ToString.FormatoNumero} {dr("Abreviatura").ToString}" + End If End If End If End If + ObjVta.Dispose() + objPS.Dispose() + If UsuarioActual.CveEmpresa = 119 Then + If CBool(dr("AplicaIEPS")) Then + LtlIEPS.Visible = True + LtlIEPSPorcentaje.Visible = True + LtlIEPSPorcentaje.Text = $"% {(dr("IEPSPorcentaje").ToString.ToDouble * 100).FormatoNumero}" + Else + LtlIEPS.Visible = False + LtlIEPSPorcentaje.Visible = False + End If + If dr("IVA").ToString = "-1" OrElse dr("IVA").ToString.ToDecimal > 0 Then + LtlIVA.Visible = True + LtlIVAPorcentaje.Visible = True + LtlIVAPorcentaje.Text = $"Si" + Else + LtlIVA.Visible = False + LtlIVAPorcentaje.Visible = False + End If + End If End If - ObjVta.Dispose() - objPS.Dispose() - If UsuarioActual.CveEmpresa = 119 Then - If CBool(dr("AplicaIEPS")) Then - LtlIEPS.Visible = True - LtlIEPSPorcentaje.Visible = True - LtlIEPSPorcentaje.Text = $"% {(dr("IEPSPorcentaje").ToString.ToDouble * 100).FormatoNumero}" - Else - LtlIEPS.Visible = False - LtlIEPSPorcentaje.Visible = False - End If - If dr("IVA").ToString = "-1" OrElse dr("IVA").ToString.ToDecimal > 0 Then - LtlIVA.Visible = True - LtlIVAPorcentaje.Visible = True - LtlIVAPorcentaje.Text = $"Si" - Else - LtlIVA.Visible = False - LtlIVAPorcentaje.Visible = False - End If + + If UsuarioActual.CveUsuario = 100 Then + HlPendiente.Visible = True + HlPendiente.NavigateUrl = String.Format("/Inventarios/RepVentasXSurtir.aspx?CvePS={0}", CvePS) + End If + + If ObjInventarios.DtResultados.Rows.Count > 0 Then + GV.DataSource = ObjInventarios.DtResultados + Else + GV.DataSource = Nothing + Dim Js = If(Tipo = 1, "", "window.setTimeout(Focus,200);") + Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) End If End If - If UsuarioActual.CveUsuario = 100 Then - HlPendiente.Visible = True - HlPendiente.NavigateUrl = String.Format("/Inventarios/RepVentasXSurtir.aspx?CvePS={0}", CvePS) - End If + ObjInventarios.Dispose() + GV.DataBind() - If ObjInventarios.DtResultados.Rows.Count > 0 Then - GV.DataSource = ObjInventarios.DtResultados - Else - GV.DataSource = Nothing - Dim Js = If(Tipo = 1, "", "window.setTimeout(Focus,200);") - Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) - End If + + + UPDatos.Update() + TblBusqueda.Visible = True + Else + Alert("Seleccione un producto o servicio", TipoMensaje.MsgAdvertencia) End If - - ObjInventarios.Dispose() - GV.DataBind() - - - - UPDatos.Update() - TblBusqueda.Visible = True End Sub Private Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -227,6 +232,7 @@ Partial Class Inventarios_Default End Sub Private Sub CargarDatosMedRin() + Dim ObjInventarios As New ClsInventarios If ObjInventarios.GetExistenciasMedRin(DDlPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlRin.SelectedValue.ToEntero, DdlMedidas.SelectedValue.ToEntero) Then GvMedRin.DataSource = ObjInventarios.DtResultados @@ -236,4 +242,9 @@ Partial Class Inventarios_Default UPDatos.Update() End Sub + Private Function ValidarFiltrosSeleccionados() As Boolean + If DDlPS.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function + End Class diff --git a/OC/PopUpBuscarReq.aspx.vb b/OC/PopUpBuscarReq.aspx.vb index 814797b58..043715c23 100644 --- a/OC/PopUpBuscarReq.aspx.vb +++ b/OC/PopUpBuscarReq.aspx.vb @@ -168,17 +168,23 @@ Partial Class OC_PopUpBuscarReq Dim FI As Date = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.Trim.ToDate) Dim guia As String = If(TxtGuia.Text.Trim = "", "-1", TxtGuia.Text) 'Cargar Datos - Dim ObjOC As New ClsOC - ObjOC.GetOrdenesCompraRep(DdlTipo.SelectedValue, CveProyecto, CveSubProyecto, -1, DdlEstatus.SelectedValue.ToEntero, FI, MaxFecha, -1, DdlProveedor.SelectedValue.ToEntero, If(TxtFolio.Text.ToEntero <= 0, -1, TxtFolio.Text.ToEntero), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Guia:=guia, - SoloSubProyectosConPermiso:=If(UsuarioActual.Empresa.Funcionalidad(530) = "1", True, False)) - Dim DtOC = ObjOC.DtResultados ' tipotermino, esattus inicial - ObjOC.Dispose() - GV.DataSource = DtOC - GV.DataBind() - LtlTotalRegistros.Text = GV.Rows.Count.ToString - LblTotalRegistros.Text = "Número de registros: " - UPDatos.Update() + If ValidarFiltrosSeleccionado() Then + Dim ObjOC As New ClsOC + ObjOC.GetOrdenesCompraRep(DdlTipo.SelectedValue, CveProyecto, CveSubProyecto, -1, DdlEstatus.SelectedValue.ToEntero, FI, MaxFecha, -1, DdlProveedor.SelectedValue.ToEntero, + If(TxtFolio.Text.ToEntero <= 0, -1, TxtFolio.Text.ToEntero), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Guia:=guia, + SoloSubProyectosConPermiso:=If(UsuarioActual.Empresa.Funcionalidad(530) = "1", True, False)) + Dim DtOC = ObjOC.DtResultados ' tipotermino, esattus inicial + ObjOC.Dispose() + + GV.DataSource = DtOC + GV.DataBind() + LtlTotalRegistros.Text = GV.Rows.Count.ToString + LblTotalRegistros.Text = "Número de registros: " + UPDatos.Update() + Else + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) + End If End Sub Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then @@ -245,6 +251,17 @@ Partial Class OC_PopUpBuscarReq End If End Sub + + Private Function ValidarFiltrosSeleccionado() As Boolean + If DdlTipo.SelectedValue.ToEntero > 0 Then Return True + If DdlEstatus.SelectedValue.ToEntero > 0 Then Return True + If DdlProveedor.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.ToEntero > 0 Then Return True + If DdlSubProyectos.SelectedValue.ToEntero > 0 Then Return True + If DdlProyectos.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function + #End Region #Region " VINCULA CON COMPRAS " diff --git a/OS/PopUpBuscarOS.aspx.vb b/OS/PopUpBuscarOS.aspx.vb index eca09e56b..3e288a7f4 100644 --- a/OS/PopUpBuscarOS.aspx.vb +++ b/OS/PopUpBuscarOS.aspx.vb @@ -35,16 +35,19 @@ Partial Class OS_PopUpBuscarOS 'If TxtFechaRecibido.Text.Trim <> String.Empty Then FechaRecibido.ToString() If DdlEstatusOrdenServicio.SelectedValue <> String.Empty Then CveEstatusOrdenServicio = DdlEstatusOrdenServicio.SelectedValue.ToEntero - - If ObjOS.GetOrdenesServicios(-1, CveCliente, Folio, CveUsuarioRecibio, CveEstatusOrdenServicio, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then - If ObjOS.DtResultados.Rows.Count > 0 Then - LtlTotalRegistros.Text = ObjOS.DtResultados.Rows.Count.ToString.FormatoNumero(0) - GV.DataSource = ObjOS.DtResultados - Else - LtlTotalRegistros.Text = "0" - GV.DataSource = Nothing - Alert("No se encontraron registros con losparámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + If ValidarUnFiltroSeleccionado() Then + If ObjOS.GetOrdenesServicios(-1, CveCliente, Folio, CveUsuarioRecibio, CveEstatusOrdenServicio, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then + If ObjOS.DtResultados.Rows.Count > 0 Then + LtlTotalRegistros.Text = ObjOS.DtResultados.Rows.Count.ToString.FormatoNumero(0) + GV.DataSource = ObjOS.DtResultados + Else + LtlTotalRegistros.Text = "0" + GV.DataSource = Nothing + Alert("No se encontraron registros con losparámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + End If End If + Else + Alert("Seleccione un criterio de búsqueda", TipoMensaje.MsgAdvertencia) End If ObjOS.Dispose() @@ -108,4 +111,13 @@ Partial Class OS_PopUpBuscarOS DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) End Sub + Private Function ValidarUnFiltroSeleccionado() As Boolean + If TxtFolio.Text.Trim <> String.Empty Then Return True + If DdlCliente.SelectedValue.ToEntero > 0 Then Return True + If DdlUsuarioRecibio.SelectedValue.ToEntero > 0 Then Return True + 'If TxtFechaRecibido.Text.Trim <> String.Empty Then FechaRecibido.ToString() + If DdlEstatusOrdenServicio.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function + End Class diff --git a/RH/PopUpBuscarPersonal.aspx.vb b/RH/PopUpBuscarPersonal.aspx.vb index e9d5cab16..78389afb8 100644 --- a/RH/PopUpBuscarPersonal.aspx.vb +++ b/RH/PopUpBuscarPersonal.aspx.vb @@ -383,4 +383,14 @@ Partial Class RH_PopUpBuscarPersonal End If End Sub + + Private Function ValidarFiltrosSeleccionado() As Boolean + If TxtCodigo.Text.Trim = String.Empty Then Return True + If TxtNombre.Text.Trim = String.Empty Then Return True + If TxtNSS.Text.Trim = String.Empty Then Return True + If TxtRFC.Text.Trim = String.Empty Then Return True + If TxtHorarioDe.Text.Trim = String.Empty Then Return True + Return False + End Function + End Class diff --git a/Ventas/PopUpBuscarPs.aspx.vb b/Ventas/PopUpBuscarPs.aspx.vb index f5baa1e9e..aa2cce4bb 100644 --- a/Ventas/PopUpBuscarPs.aspx.vb +++ b/Ventas/PopUpBuscarPs.aspx.vb @@ -91,6 +91,12 @@ Partial Class PopUpBuscarPs End Sub #End Region + Private Function ValidarUnFiltroSeleccionado() As Boolean + If TxtCodigo.Text.Trim <> String.Empty Then Return True + If TxtCodigoBarras.Text.Trim <> String.Empty Then Return True + If TxtNombre.Text.Trim <> String.Empty Then Return True + Return False + End Function End Class