select
  o.operador,
  o.nome
from
  operadores o
  inner join operadores_dos_grupos og on og.operador = o.operador
where
  og.grupo = 1
  and o.ativo = 'S'
  and (select count(*) from (
    select
      r.filial,
      r.vendedor,
      r.total vendas_quant
    from (
      select
        iif(ne.filial = 1 and ne.operacao in (1003, 1117, 1125, 1145, 1161, 1162), 100, ne.filial) filial,
        ne.vendedor,
        sum(case when ne.tipo = 'B' then -1 else 1 end) total
      from
        notas_emitidas ne
      where
        ne.tipo in ('A', 'B') and ne.cancelada = 'N'
        and ne.data >= :Data_Inicial and ne.data < :Data_Final + 1
        and ne.vendedor = o.operador
        and (ne.filial = :Filial or (ne.filial = 1 and :Filial = 100))
      group by
        1, 2
      ) r
    ) r
    where
      r.filial = :Filial and r.vendas_quant > 0
    ) = 0
