Atualizando página inicial

This commit is contained in:
Kenio 2025-08-20 13:05:23 -03:00
parent e1672ef83e
commit 3bac6d6988
2 changed files with 70 additions and 11 deletions

View file

@ -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()
{

View file

@ -363,20 +363,24 @@ try{
<?php
/** Consulta os clientes que estão no mês do reajuste */
$ProductsCompaniesResult = $ProductsCompanies->Readjustment($month[date('m')]);
foreach($ProductsCompaniesResult as $ClientsKey => $Result){
?>
if($FinancialMovements->OutputsNotPaidCount() > 0){
<tr>
<td><?php echo $Result->cns;?></td>
<td class="text-center" width="30"><?php echo $Result->due_date;?></td>
<td><?php echo $Result->nickname;?></td>
<td class="text-center" width="20"><button type="button" class="btn btn-light btn-sm" onclick="request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_form&company_id=<?php echo $Result->company_id;?>', '#loadContent', true, '', '', '', 'Preparando formulário', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Gerenciar orçamento"><i class="fas fa-ellipsis-v"></i></button></td>
<td class="text-center" width="20"><button type="button" class="btn btn-light btn-sm" onclick="request('FOLDER=view&TABLE=clients&ACTION=clients_form&company_id=<?php echo $Result->company_id;?>', '#loadContent', true, '', '', '', 'Preparando formulário', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Editar dados do cliente"><i class="far fa-edit"></i></button></td>
</tr>
/** Consulta os registros */
$ProductsCompaniesResult = $FinancialMovements->OutputsNotPaidAll();
foreach($ProductsCompaniesResult as $ProductsCompaniesKey => $Result){
?>
<tr>
<td><?php echo $Result->cns;?></td>
<td class="text-center" width="30"><?php echo $Result->movement_date_scheduled;?></td>
<td><?php echo $Result->nickname;?></td>
<td class="text-center" width="20"><button type="button" class="btn btn-light btn-sm" onclick="request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_form&company_id=<?php echo $Result->company_id;?>', '#loadContent', true, '', '', '', 'Preparando formulário', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Gerenciar orçamento"><i class="fas fa-ellipsis-v"></i></button></td>
<td class="text-center" width="20"><button type="button" class="btn btn-light btn-sm" onclick="request('FOLDER=view&TABLE=clients&ACTION=clients_form&company_id=<?php echo $Result->company_id;?>', '#loadContent', true, '', '', '', 'Preparando formulário', 'blue', 'circle', 'sm', true)" data-toggle="tooltip" data-placement="left" title="Editar dados do cliente"><i class="far fa-edit"></i></button></td>
</tr>
<?php } ?>
<?php } } ?>
<tbody>
</table>