From 2a50794e01640266506ffbb57dc67de17f442bfc Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Mon, 18 Aug 2025 13:50:23 -0300 Subject: [PATCH] Atualizando financial_categories_datagrid.php --- vendor/model/FinancialCategories.class.php | 42 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/vendor/model/FinancialCategories.class.php b/vendor/model/FinancialCategories.class.php index 63fffee..1d4134e 100644 --- a/vendor/model/FinancialCategories.class.php +++ b/vendor/model/FinancialCategories.class.php @@ -122,11 +122,12 @@ class FinancialCategories } /** Lista todos os egistros do banco com ou sem paginação*/ - public function All(int $start, int $max) + public function All(int $start, int $max, string $description) { /** Parametros de entrada */ $this->start = $start; $this->max = $max; + $this->description = $description; /** Verifico se há paginação */ if($this->max){ @@ -136,9 +137,25 @@ class FinancialCategories /** Consulta SQL */ $this->sql = 'select * from financial_categories '. $this->limit; + /** Verifica se alguma descrição foi informada */ + if($this->description){ + + $this->sql .= ' and description like :description '; + + } + /** Preparo o SQL para execução */ $this->stmt = $this->connection->connect()->prepare($this->sql); + /** Verifica se alguma descrição foi informada */ + if($this->description){ + + /** Preencho os parâmetros do SQL */ + $this->stmt->bindParam(':description', '%'.$this->description.'%'); + + } + + /** Executo o SQL */ $this->stmt->execute(); @@ -148,15 +165,34 @@ class FinancialCategories } /** Conta a quantidades de registros */ - public function Count() + public function Count(string $description) { + + /** Parametros de entreda */ + $this->description = $description; + /** Consulta SQL */ $this->sql = 'select count(financial_categories_id) as qtde - from financial_categories'; + from financial_categories '; + + /** Verifica se alguma descrição foi informada */ + if($this->description){ + + $this->sql .= ' and description like :description '; + + } /** Preparo o SQL para execução */ $this->stmt = $this->connection->connect()->prepare($this->sql); + /** Verifica se alguma descrição foi informada */ + if($this->description){ + + /** Preencho os parâmetros do SQL */ + $this->stmt->bindParam(':description', '%'.$this->description.'%'); + + } + /** Executo o SQL */ $this->stmt->execute();