Ajuste, aplicando filtro de consulta por conter NF

This commit is contained in:
Kenio 2025-09-29 08:48:36 -03:00
parent 3e80407c27
commit 38d427c7d8
2 changed files with 19 additions and 6 deletions

View file

@ -748,15 +748,21 @@ class FinancialMovements
left join users u on cbc.user_id = u.user_id
where fm.movement_date_cancel is null ';
/** verifica se a consulta será pela data de pagamento */
if($this->status == 2){
/** Aplica o filtro para movimentações que possuem nota fiscal */
if($this->status == 3){
$this->and .= ' and (select count(d.documents_id) from documents d where d.financial_movements_id = fm.financial_movements_id and documents_categorys_id = 2) > 0 ';
/** Aplica o filtro para movimentações que não podem estar sem a data de pagemnto informada */
}elseif($this->status == 2){
$this->and .= ' and fm.movement_date_paid is not null ';
/** aplica o filtro para movimentações que não possuem data de pagamento */
} elseif($this->status == 1){
$this->and .= ' and fm.movement_date_paid is null ';
}
}
/** Verifica se existem filtros a serem aplicados */
@ -879,11 +885,17 @@ class FinancialMovements
left join companies c on fm.company_id = c.company_id
where fm.movement_date_cancel is null';
/** verifica se a consulta será pela data de pagamento */
if($this->status == 2){
/** Aplica o filtro para movimentações que possuem nota fiscal */
if($this->status == 3){
$this->and .= ' and (select count(d.documents_id) from documents d where d.financial_movements_id = fm.financial_movements_id and documents_categorys_id = 2) > 0 ';
/** Aplica o filtro para movimentações que não podem estar sem a data de pagemnto informada */
}elseif($this->status == 2){
$this->and .= ' and fm.movement_date_paid is not null ';
/** aplica o filtro para movimentações que não possuem data de pagamento */
} elseif($this->status == 1){
$this->and .= ' and fm.movement_date_paid is null ';

View file

@ -152,9 +152,10 @@ try{
<div class="form-group">
<!--<label for="status">Pago: </label>-->
<select class="form-control form-control w-100" id="status" name="status">
<option value="" selected>Pago?</option>
<option value="" selected>Situação</option>
<option value="1" <?php echo $FinancialMovementsValidate->getStatusSearch() == 1 ? 'selected' : '';?>>Não</option>
<option value="2" <?php echo $FinancialMovementsValidate->getStatusSearch() == 2 ? 'selected' : '';?>>Sim</option>
<option value="3" <?php echo $FinancialMovementsValidate->getStatusSearch() == 3 ? 'selected' : '';?>>NF</option>
</select>
</div>
</div>