From 3bac6d6988dc785952ab563e830a4de886a13be0 Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Wed, 20 Aug 2025 13:05:23 -0300 Subject: [PATCH] =?UTF-8?q?Atualizando=20p=C3=A1gina=20inicial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/model/FinancialMovements.class.php | 55 +++++++++++++++++++ .../financial_movements_resume.php | 26 +++++---- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/vendor/model/FinancialMovements.class.php b/vendor/model/FinancialMovements.class.php index 7c36959..246b9bb 100644 --- a/vendor/model/FinancialMovements.class.php +++ b/vendor/model/FinancialMovements.class.php @@ -1455,6 +1455,61 @@ class FinancialMovements } + /** Conta a quantidade de registros de saídas em atraso */ + public function OutputsNotPaidCount() + { + + /** Consulta SQL */ + $this->sql = 'SELECT count(fm.financial_movements_id) as qtde + FROM financial_movements fm + LEFT JOIN companies c ON fm.company_id = c.company_id + WHERE fm.financial_outputs_id > 0 + AND fm.movement_date_paid IS NULL + AND fm.status = 1 + AND fm.movement_date_scheduled <= CURRENT_DATE + INTERVAL 7 DAY -- até hoje + 7 dias + ORDER BY fm.movement_date_scheduled ASC;'; + + /** Preparo o SQL para execução */ + $this->stmt = $this->connection->connect()->prepare($this->sql); + + /** Preencho os parâmetros do SQL */ + $this->stmt->bindParam(':financial_movements_id', $this->financialMovementsId); + + /** Executo o SQL */ + $this->stmt->execute(); + + /** Retorno o resultado */ + return $this->stmt->fetchObject(); + } + + + /** Lista os registros de saídas em atraso */ + public function OutputsNotPaidAll() + { + + /** Consulta SQL */ + $this->sql = 'SELECT fm.* + FROM financial_movements fm + LEFT JOIN companies c ON fm.company_id = c.company_id + WHERE fm.financial_outputs_id > 0 + AND fm.movement_date_paid IS NULL + AND fm.status = 1 + AND fm.movement_date_scheduled <= CURRENT_DATE + INTERVAL 7 DAY -- até hoje + 7 dias + ORDER BY fm.movement_date_scheduled ASC;'; + + /** Preparo o SQL para execução */ + $this->stmt = $this->connection->connect()->prepare($this->sql); + + /** Preencho os parâmetros do SQL */ + $this->stmt->bindParam(':financial_movements_id', $this->financialMovementsId); + + /** Executo o SQL */ + $this->stmt->execute(); + + /** Retorno o resultado */ + return $this->stmt->fetchObject(); + } + /** Fecha uma conexão aberta anteriormente com o banco de dados */ function __destruct() { diff --git a/vendor/view/financial_movements/financial_movements_resume.php b/vendor/view/financial_movements/financial_movements_resume.php index 661d5a4..dfb4ffc 100644 --- a/vendor/view/financial_movements/financial_movements_resume.php +++ b/vendor/view/financial_movements/financial_movements_resume.php @@ -363,20 +363,24 @@ try{ Readjustment($month[date('m')]); - foreach($ProductsCompaniesResult as $ClientsKey => $Result){ - ?> + if($FinancialMovements->OutputsNotPaidCount() > 0){ - - cns;?> - due_date;?> - nickname;?> - - - + /** Consulta os registros */ + $ProductsCompaniesResult = $FinancialMovements->OutputsNotPaidAll(); + + foreach($ProductsCompaniesResult as $ProductsCompaniesKey => $Result){ + ?> + + + cns;?> + movement_date_scheduled;?> + nickname;?> + + + - +