public static List<InformePresupuestoEntidad> obtenerInforme(InformePresupuestoEntidad informe)
        {
            List<InformePresupuestoEntidad> lista = new List<InformePresupuestoEntidad>();
            SqlCommand command = new SqlCommand();
            SqlConnection connection = new SqlConnection();

            try
            {
                connection.ConnectionString = cadenaConeccion;
                connection.Open();
                string sql = "select c.cuit as 'cuit', c.nombre as 'nombreCliente', l.nombre as 'nombreLocalidad', p.fecha as 'fechaPresupuesto', c.preferencial as 'clientePreferencial', p.total as 'total' from Cliente c";
                sql += " JOIN Localidad l ON (l.id=c.idLocalidad) JOIN Presupuseto p ON (p.idCliente=c.id) JOIN DetallePresupuesto d ON (d.idPresupuesto=p.id) JOIN Matriz m ON (m.id=d.idMatriz) where c.id = @idCliente AND c.preferencial = @preferencial";

                if (informe.total > 0)
                {
                    sql += " AND p.total = @total";
                }

                command.CommandText = sql;
                command.Connection = connection;

                if (informe.total > 0)
                {
                    command.Parameters.AddWithValue("@total", informe.total);
                }

                command.Parameters.AddWithValue("@aplique", informe.preferencial);
                command.Parameters.AddWithValue("@idCliente", informe.idCliente);
                SqlDataReader dr = command.ExecuteReader();
                while (dr.Read())
                {
                    InformePresupuestoEntidad i = new InformePresupuestoEntidad();
                    i.cuit = int.Parse(dr["cuit"].ToString());
                    i.nombreCliente = dr["nombreCliente"].ToString();
                    i.nombreLocalidad = dr["nombreLocalidad"].ToString();
                    i.total = decimal.Parse(dr["total"].ToString());
                    i.fechaPresupuesto = DateTime.Parse(dr["fechaPresupuesto"].ToString());
                    i.preferencialBooleano = bool.Parse(dr["preferencial"].ToString());
                    lista.Add(i);
                }
            }
            catch (SqlException ex)
            {

            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
            return lista;
        }
        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            InformePresupuestoEntidad i = new InformePresupuestoEntidad();
            i.idCliente = int.Parse(ddlCliente.SelectedValue);
            i.preferencial = 0;
            if(cbxPreferencial.Checked == true)
            {
                i.preferencial = 1;
            }
            if(txtMonto.Text != "")
            {
                i.total = decimal.Parse(txtMonto.Text);
            }

            grvInforme.DataSource = InformePresupuestoGestor.obtenerInforme(i);
            grvInforme.DataBind();
        }