Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.1 kB
2
Indexable
Never
--BPM Recebto Centralizado
--Será gerado um novo processo para a Central de Lancto de Notas para cada nova NFe importada

declare
  vnNroprocessocentral number;

begin

  if (to_char(sysdate, 'd') = 7 and sysdate between trunc(sysdate) + 7 / 24 and
     trunc(sysdate) + 12 / 24) or
     (to_char(sysdate, 'd') between 2 and 6 and
     sysdate between trunc(sysdate) + 7 / 24 and trunc(sysdate) + 18 / 24) then
  
    select a.valor
      into vnNroprocessocentral
      from max_parametro a
     where a.grupo = 'BPM'
       and a.parametro = 'COD_PROC_CENTRAL_LANCTO_NF';
  
    for t in (select nroempresa
                from max_empresa a
               where a.status = 'A'
                 and a.nroempresa in (101,203,208,209,210,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416))    
     loop
    
      spBPM_IniciaRecebCentral(vnNroprocessocentral,
                               'false',
                               'BPM',
                               t.nroempresa);
    
      Commit;
    
    end loop;
  end if;
end;
Leave a Comment