-- Se Empresa Matriz e Forma de Cobrança Filial
if (nvl(ln_cd_proposta_matriz, null) is null) and (lv_forma_cobranca = 'F') then
pr_insere_tb_faturamento;
lb_existe_fatura_filial := true;
ln_nu_faturados := ln_nu_faturados + 1;
-- Se Empresa Filial e Forma de Cobrança Filial
elsif (nvl(ln_cd_proposta_matriz, null) is not null) and (lv_forma_cobranca = 'F') then
pr_insere_tb_faturamento;
lb_existe_fatura_filial := true;
ln_nu_faturados := ln_nu_faturados + 1;
end if;
2. Both the IF and Elsif do the same thing! (Why have Elsif?)
Now tell me if with code of this level the billing will go out at the end of the right ... :-d