Atualizando financial_categories_datagrid.php
This commit is contained in:
parent
3a9489c8f8
commit
2a50794e01
1 changed files with 39 additions and 3 deletions
42
vendor/model/FinancialCategories.class.php
vendored
42
vendor/model/FinancialCategories.class.php
vendored
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue