Módulo: CÂMBIO EXPORTAÇÃO
Funcionalidade: Rotina Mensal
Data/Hora da Publicação: 15/10/2009 00:00:00
Data/Hora Última Alteração: 18/02/2011 17:14:19
Descrição da Nota: ROTINA MENSAL EXPORTAÇÃO - DEDUZ JUROS, DATA PAGAMENTO EXTERIOR-LIQ/VIN
Sintoma
Rotina Mensal Exportação - saldos incorretos, não considerando liquidação e/ou vinculações com data
de pagamento no exterior e deduz_juros preenchido.
Liquidação - esta permitindo alterar data de pagamento no exterior e deduz juros que foram
informados na vinculação.
Vinculação - não esta salvando data de pagamento no exterior e deduz juros em todas as faturas, só
nas que aparecem na tablecontrol.
Solução
Rotina Mensal Exportação - ajustes para considerar no saldo do contrato, as vinculações com data de
pagamento no exterior e, também, as liquidações, não deixando duplicar este abatimento no saldo.
Liquidação - ajustes para não permitir alterar o campo deduz_juros e data pagamento exterior quando
na tablecontrol de faturas, só houver faturas que tem estas informações(deduz e dtpagext) da
vinculação, ou seja, se foi preenchido na vinculação, traz para liquidação e não permite alterar.
Vinculação - ajustes para gravar o campo dtpagext e deduz_juros em todas as faturas da tablecontrol,
inclusive as que não aparecem na tela, não sendo obrigado a clicar em pagedown(cenário selecionando
todas as faturas pelo botão selecionar e clicar no botão vincular total, salvando após isso).
7.0
Produto:
Nota
Descrição
Informações Complementares
----------------------------------------------------------------------------------------------------
Nota Número 09200 Data: 15/10/2009 Hora: 15:53:47
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
Nota Número : 09200
Categoria : Erro de Programa
Prioridade : Média
Versão PW.CE : 8.0
Pacote : 00001
Agrupamento : 00001
----------------------------------------------------------------------------------------------------
Referência às notas relacionadas:
Número - Ordem - Versão - Pacote - Descrição Breve
00269 - 00001 - 6.0 - 00021 - BANCO NEGOC. CONSTA NO LOCAL DO BANCO FINANC.
00673 - 00002 - 6.0 - 00022 - 281688 - ROTINA MENSAL ULTIMA PARCELA - DEDUZ JUROS LIQUIDAÇÃO
01309 - 00003 - 6.0 - 00023 - ROTINA MENSAL EXPORTAÇÃO CONTABILIZAÇÃO SEPARADA DE ACC E ACE = S
03289 - 00004 - 6.0 - 00026 - ROTINA MENSAL - CAMPO TAXA - MONTANTE CONVERTE
03744 - 00005 - 7.0 - 00001 - ROTINA MENSAL EXPORTAÇÃO E CAPTAÇÃO - CÁLCULO JUROS
03834 - 00006 - 7.0 - 00001 - ROTINA MENSAL EXPORTAÇÃO - ORDENAÇÃO DADOS - CÁLCULO INCORRETO
04804 - 00007 - 7.0 - 00003 - EXPORTAÇÃO VINCULAÇÃO DE FATURAS
04930 - 00008 - 7.0 - 00003 - CODE INSPECTOR(ROTINA MENSAL)
05596 - 00009 - 7.0 - 00004 - ROTINA MENSAL EXPORTAÇÃO - JUROS INCORRETOS - LIQUIDAÇÃO COM ARBI
08164 - 00010 - 7.0 - 00008 - DA - DATA CREDITO NO EXTERIOR NA VINCULAÇÃO- PRÉ-PAGAMENTO SECURI
08226 - 00011 - 7.0 - 00009 - LIQUIDAÇÃO - GRAVAR NOVA DATA QUANDO ESTA EM PERÍODO FECHADO
08239 - 00012 - 7.0 - 00009 - VALORES MANTIDOS NO EXTERIOR E LIQUIDAÇÃO - COMISSÃO DE AGENTE
08377 - 00013 - 7.0 - 00009 - CAPTAÇÃO-DUMP RECALCULO JUROS-ROTINA MENSAL-VALOR NEGATIVO DTPAGE
09062 - 00014 - 8.0 - 00001 - DESVINCULAÇÃO LIQUIDAÇÃO ATUALIZAÇÃO INCORRETA 001-DTVINCUL E 005
09178 - 00015 - 8.0 - 00001 - ROTINA MENSAL EXPORTAÇÃO - CONTABILIZAÇÃO NA CONTA DE ACC/ACE
----------------------------------------------------------------------------------------------------
ROTINA MENSAL EXPORTAÇÃO - DEDUZ JUROS, DATA PAGAMENTO EXTERIOR-LIQ/VIN
----------------------------------------------------------------------------------------------------
Palavras Chave:
ROTINA MENSAL EXPORTAÇÃO - DEDUZ JUROS, DATA PAGAMENTO EXTERIOR-LIQ/VIN
----------------------------------------------------------------------------------------------------
Objetos da nota:
REPS /PWS/MZYCB004F01
REPS /PWS/MZYCB004F02
REPS /PWS/MZYCB004F03
REPS /PWS/MZYCB004I01
REPS /PWS/MZYCB004TOP
REPS /PWS/MZYCB009I01
REPS /PWS/ZYCBI003
REPS /PWS/ZYCBR003
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/MZYCB004F01
...
endif.
perform busca_liquidacoes.
perform provisiona_diferenca_juros.
endif.
endif.
endif.
if itab_zycbt226 is initial.
select *
from /pws/zycbt006
into corresponding fields of table itab_zycbt006_ca
* >> Início da exclusão: FORM GRAVA_TABELAS
where nrinvoic = itab_zycbt006-nrinvoic.
describe table itab_zycbt006_ca lines v_line.
if v_line < 2.
* << Fim da exclusão
* >> Início da inclusão: FORM GRAVA_TABELAS
where nrinvoic = itab_zycbt006-nrinvoic.
describe table itab_zycbt006_ca lines v_linha.
if v_linha < 2.
* << Fim da inclusão
if wa_zycbt007-liq_com_cg ne 'RP'.
perform estorna_comissao.
endif.
endif.
endif.
perform atualiza_tabelas_transp2.
if wa_zycbt007-liq_com_cg ne 'RP'.
perform liquida_comissao_agente.
endif.
if not itab_erro[] is initial.
...
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/MZYCB004F02
...
and tpdesp = itab_zycbt006-tpdesp
and nrparc = itab_zycbt006-nrparc
and dtincl = itab_zycbt006-dtincl
and nrinvoic = itab_zycbt006-nrinvoic
and gsberf = itab_zycbt006-gsberf
and dtvincul = itab_zycbt006-dtvincul
and dtvencto = itab_zycbt006-dtvencto
and nrparcf = itab_zycbt006-nrparcf.
update /pws/zycbt005 set belnr = itab_zycbt005_ant-belnr
dtbelnr = itab_zycbt005_ant-dtbelnr
* >> Início da exclusão: FORM ATUALIZA_TABELAS_TRANSP2
where nrseqc = itab_zycbt006-nrseqc.
* << Fim da exclusão
* >> Início da inclusão: FORM ATUALIZA_TABELAS_TRANSP2
where nrseqc = itab_zycbt006-nrseqc
and dtvincul = itab_zycbt006-dtvincul.
* << Fim da inclusão
move itab_zycbt006 to wa_zycbt006_sbu.
call customer-function '043'
exporting
wa_zycbt006 = wa_zycbt006_sbu.
delete from /pws/zycbt084 where nrseqc = itab_zycbt006-nrseqc
and nrinvoic = itab_zycbt006-nrinvoic
and gsberf = itab_zycbt006-gsberf
and dtvincul = itab_zycbt006-dtvincul
and dtpagto = itab_zycbt006-dtpagto
and dtpagext = itab_zycbt006-dtpagext
...
...
else.
perform grava_log using '/PWS/ZYCBT006'
wa_log
'A'.
endif.
endif.
if itab_zycbt006-v_status ne 'N'.
if not itab_zycbt006-belnr_d is initial.
if itab_zycbt005-dtbelnr > itab_zycbt006-dtpagto.
update /pws/zycbt005 set belnr = itab_zycbt006-belnr_d
* >> Início da exclusão: FORM ATUALIZA_TABELAS_TRANSP2
where nrseqc = itab_zycbt006-nrseqc.
* << Fim da exclusão
* >> Início da inclusão: FORM ATUALIZA_TABELAS_TRANSP2
where nrseqc = itab_zycbt006-nrseqc
and dtvincul = itab_zycbt006-dtvincul.
* << Fim da inclusão
else.
update /pws/zycbt005 set belnr = itab_zycbt006-belnr_d
dtbelnr = itab_zycbt006-dtpagto
* >> Início da exclusão: FORM ATUALIZA_TABELAS_TRANSP2
where nrseqc = itab_zycbt006-nrseqc.
* << Fim da exclusão
* >> Início da inclusão: FORM ATUALIZA_TABELAS_TRANSP2
where nrseqc = itab_zycbt006-nrseqc
and dtvincul = itab_zycbt006-dtvincul.
* << Fim da inclusão
endif.
else.
if v_liquida eq 'X'.
if itab_zycbt006-status = 'C'.
v_slpagar = itab_zycbt005-slpagar + ( itab_zycbt006-vlme *
itab_zycbt005-parid ).
endif.
read table /pws/zycbt005.
update /pws/zycbt005 set slpagar = v_slpagar
where nrseqc = itab_zycbt006-nrseqc
...
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/MZYCB004F03
...
and dtvencto = itab_zycbt006-dtvencto.
endif.
endloop.
modify /pws/zycbt005 from table itab_zycbt005.
itab_zycbt005-dtpagext = /pws/zycbe006-dtpagext.
modify itab_zycbt005 transporting dtpagext
where nrseqc = /pws/zycbe001-nrseqc.
modify /pws/zycbt001 from /pws/zycbe001.
endform.
form oculta_deduz_juros.
* >> Início da exclusão: FORM OCULTA_DEDUZ_JUROS
if /pws/zycbt005-dtpagext is initial.
select dtpagext
up to 1 rows
from /pws/zycbt005
into /pws/zycbt005-dtpagext
where nrseqc = /pws/zycbe001-nrseqc.
endselect.
if not /pws/zycbt005-dtpagext is initial.
* << Fim da exclusão
* >> Início da inclusão: FORM OCULTA_DEDUZ_JUROS
if v_check_flag_deduz is initial.
clear vg_flag.
describe table itab_zycbt005 lines v_linha.
read table itab_zycbt005 with key deduz_juros = 'X'.
if sy-subrc = 0 and v_linha = 1.
vg_flag = 'X'.
elseif sy-subrc = 0 and v_linha > 1.
read table itab_zycbt005 with key deduz_juros = ' '.
if sy-subrc ne 0.
* << Fim da inclusão
vg_flag = 'X'.
* >> Início da inclusão: FORM OCULTA_DEDUZ_JUROS
endif.
* << Fim da inclusão
endif.
* >> Início da inclusão: FORM OCULTA_DEDUZ_JUROS
v_check_flag_deduz = 'X'.
* << Fim da inclusão
endif.
loop at screen.
case screen-name.
when '/PWS/ZYCBE006-DEDUZ_JUROS' or 'V_DEDUZ'.
if ( /pws/zycbe001-tpcontr(1) = 'P' or
/pws/zycbe001-tpcontr(1) = 'S' ) and
not vg_flag is initial.
screen-invisible = '1'.
screen-input = '0'.
* >> Início da exclusão: FORM OCULTA_DEDUZ_JUROS
clear: /pws/zycbe006-deduz_juros, v_deduz.
* << Fim da exclusão
elseif vg_flag is initial and
( /pws/zycbe001-tpcontr(1) = 'P' or
/pws/zycbe001-tpcontr(1) = 'S' ).
screen-invisible = '0'.
screen-input = v_status_s.
endif.
when '/PWS/ZYCBE006-DTPAGEXT' or 'V_DTPAGEXT'.
if ( /pws/zycbe001-tpcontr(1) = 'P' or
/pws/zycbe001-tpcontr(1) = 'S' ) and
not vg_flag is initial.
...
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/MZYCB004I01
...
module user_command_0001 input.
case ok_code.
when 'DATAS'.
clear v_dtvincul.
clear v_dtvencto.
clear: v_nrinvoic, v_nrparcf, v_gsberf.
call screen '0010' starting at 2 2.
when 'ENTE'.
v_status_s = '1'.
clear v_ind_mudanca.
* >> Início da inclusão: MODULE USER_COMMAND_0001
clear v_check_flag_deduz.
* << Fim da inclusão
if v_dtvincul is initial.
message i011(pc) with text-023.
exit.
endif.
select single * from /pws/zycbt001
where nrseqc = v_nrseqc.
select single * from /pws/zycbt001 into /pws/zycbe001
where nrseqc = v_nrseqc.
if sy-subrc = 0.
perform carrega_itab_zycbt005.
...
...
module verifica_dtpagto input.
perform verifica_dtpagto.
endmodule.
module user_command_0002 input.
case ok_code.
when 'PAGTOS'.
clear: v_dtvincul, v_dtpagto.
call screen '0011' starting at 2 2.
when 'ENTE'.
clear v_ind_mudanca.
* >> Início da inclusão: MODULE USER_COMMAND_0002
clear v_check_flag_deduz.
* << Fim da inclusão
if v_dtvincul is initial.
message i011(pc) with text-023.
exit.
endif.
select single * from /pws/zycbt001
where nrseqc = v_nrseqc.
select single * from /pws/zycbt001 into /pws/zycbe001
where nrseqc = v_nrseqc.
if sy-subrc = 0.
perform carrega_itab_zycbt005.
...
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/MZYCB004TOP
...
v_taxa_cliente type /pws/zycbe033-kursf,
v_reais_f2 type /pws/zycbt226-sld_exterior,
v_vlmext type /pws/zycbt226-sld_exterior,
v_sld_exterior type /pws/zycbt226-sld_exterior,
v_periodo_aberto(1) type c.
data: v_tpcontabil type /pws/zycbt169-tpcontabil,
v_tot_contrato type c,
v_tot_cliente type c,
v_zuonr type bseg-zuonr.
data: vg_flag type c.
* >> Início da inclusão:
data: v_check_flag_deduz type c.
* << Fim da inclusão
data:
v_tpcontr like /pws/zycbt016-txtdesc,
v_bconegoc like lfa1-name1,
v_bcofinan like lfa1-name1.
data: wa_log type char4000,
wa_zycbt006_log like /pws/zycbt006,
wa_zycet048 like /pws/zycet048.
data: itab_zyglt100
type standard table of /pws/zyglt100
with header line,
...
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/MZYCB009I01
...
perform calcula_vldev.
perform calcula_jur_dev.
perform calcula_vlbrl.
clear /pws/zycbt088.
select single descr
from /pws/zycbt088
into v_descr_mot
where motivo eq /pws/zycbe050-mot_canc.
endmodule.
module valida_cliente input.
* >> Início da inclusão: MODULE VALIDA_CLIENTE
loop at itab_zycbt005.
v_index = sy-tabix.
itab_zycbt005-dtpagext = /pws/zycbe006-dtpagext.
itab_zycbt005-deduz_juros = /pws/zycbe005-deduz_juros.
* << Fim da inclusão
if /pws/zycbe001-tpcontr(1) eq 'D'.
* >> Início da exclusão: MODULE VALIDA_CLIENTE
loop at itab_zycbt005.
* << Fim da exclusão
if itab_zycbt005-kunnr ne /pws/zycbe001-kunnr.
message i061 with text-210 itab_zycbt005-nrinvoic
text-212 text-211.
delete itab_zycbt017_aux where nrinvoic = itab_zycbt005-nrinvoic
and nrparcf = itab_zycbt005-nrparcf
and gsberf = itab_zycbt005-gsberf.
delete itab_zycbt017 where nrinvoic = itab_zycbt005-nrinvoic
and nrparcf = itab_zycbt005-nrparcf
and gsberf = itab_zycbt005-gsberf.
delete itab_zycbt005 where nrinvoic = itab_zycbt005-nrinvoic
and nrparcf = itab_zycbt005-nrparcf
and gsberf = itab_zycbt005-gsberf.
/pws/zycbe001-slvinc = /pws/zycbe001-slvinc + itab_zycbt005-vlme_p.
clear: itab_zycbt017, itab_zycbt017_aux, itab_zycbt005.
endif.
* >> Início da inclusão: MODULE VALIDA_CLIENTE
endif.
modify itab_zycbt005 index v_index.
* << Fim da inclusão
endloop.
* >> Início da exclusão: MODULE VALIDA_CLIENTE
endif.
* << Fim da exclusão
endmodule.
module casas_decimais input.
select single currdec from tcurx
into v_decimais
where currkey = /pws/zycbe005-waers.
if sy-subrc <> 0.
...
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/ZYCBI003
...
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of itab_lfa1.
if /pws/zyglt009-imp_rot_sep eq 'S'.
v_tamr = 245.
else.
v_tamr = 229.
endif.
new-page line-size v_tamr.
perform totaliza_valores_lancados.
* >> Início da exclusão: FORM EXIBE_RELATORIO
sort itab_relat by tpcontr nrseqc tpcontab ftpj nrcontr nrinvoic
dtvincul nrparcp nrparcj dtde.
* << Fim da exclusão
* >> Início da inclusão: FORM EXIBE_RELATORIO
sort itab_relat by tpcontr nrseqc tpcontab ftpj nrcontr
nrparcp nrparcj nrinvoic dtvincul dtde dtate.
* << Fim da inclusão
if not itab_relat[] is initial.
select lifnr name1
from lfa1
into table itab_lfa1
for all entries in itab_relat
where lifnr = itab_relat-bco.
endif.
v_sytabix = 0.
describe table itab_relat lines v_lin.
read table itab_relat index 1.
...
...
endcase.
read table itab_contas index 1.
itab_relat-c_newko = itab_contas-konth.
endform.
form processa_periodo_jc using
value(p_dtfim) type d.
data: v_liq,
v_dtde like /pws/zycbt002-dtinicio,
v_dtate like /pws/zycbt002-dtfinal,
v_saldo like /pws/zycbt001-vlme.
* >> Início da exclusão: FORM PROCESSA_PERIODO_JC
read table itab_zycbt005 with key nrseqc = itab_zycbt001-nrseqc.
if ( itab_zycbt001-tpcontr(1) eq 'P' or
itab_zycbt001-tpcontr(1) eq 'S' ) and
sy-subrc = 0 and not itab_zycbt005-dtpagext is initial.
perform calcula_juros_vinculacao2 using v_liq
v_dtde
v_dtate
v_saldo
p_dtfim.
exit.
endif.
* << Fim da exclusão
clear itab_zycbt006_aux.
refresh itab_zycbt006_aux.
loop at itab_zycbt006 where nrseqc = itab_zycbt001-nrseqc.
move itab_zycbt006 to itab_zycbt006_aux.
append itab_zycbt006_aux.
endloop.
sort itab_zycbt006 by nrseqc dtpagto ascending.
sort itab_zycbt006_aux by dtpagto ascending.
loop at itab_zycbt002j where nrseqc = itab_zycbt001-nrseqc
and dtinicio < p_dtfim.
clear v_liq.
v_dtde = itab_zycbt002j-dtinicio.
v_dtate = itab_zycbt002j-dtfinal.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
v_saldo = itab_zycbt001-slpagar.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc
and not dtpagext is initial.
exit.
endloop.
if ( itab_zycbt001-tpcontr(1) eq 'P' or
itab_zycbt001-tpcontr(1) eq 'S' ) and
sy-subrc = 0 and not itab_zycbt005-dtpagext is initial.
perform calcula_juros_vinculacao2 using v_liq
v_dtde
v_dtate
v_saldo
p_dtfim.
endif.
* << Fim da inclusão
loop at itab_zycbt006 where nrseqc = itab_zycbt001-nrseqc and
dtpagto > itab_zycbt002j-dtinicio and
dtpagto <= itab_zycbt002j-dtfinal.
v_liq = 'X'.
* >> Início da exclusão: FORM PROCESSA_PERIODO_JC
v_saldo = itab_zycbt001-slpagar.
* << Fim da exclusão
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
clear itab_zycbt006_aux.
* << Fim da inclusão
loop at itab_zycbt006_aux where dtpagto >= itab_zycbt006-dtpagto.
select parid up to 1 rows from /pws/zycbt005
into /pws/zycbt005-parid
where nrseqc = itab_zycbt006_aux-nrseqc
and tpdesp = itab_zycbt006_aux-tpdesp
and nrparc = itab_zycbt006_aux-nrparc
and nrinvoic = itab_zycbt006_aux-nrinvoic
and gsberf = itab_zycbt006_aux-gsberf
and dtvincul = itab_zycbt006_aux-dtvincul
and dtvencto = itab_zycbt006_aux-dtvencto
and nrparcf = itab_zycbt006_aux-nrparcf.
endselect.
if /pws/zycbt005-parid > 0.
itab_zycbt006_aux-vlme = itab_zycbt006_aux-vlme *
/pws/zycbt005-parid.
endif.
v_saldo = v_saldo + itab_zycbt006_aux-vlme.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
endloop.
if sy-subrc ne 0.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc
and dtpagext >= itab_zycbt006-dtpagto.
read table itab_zycbt006 with key
nrseqc = itab_zycbt001-nrseqc
nrinvoic = itab_zycbt005-nrinvoic
nrparcf = itab_zycbt005-nrparcf
gsberf = itab_zycbt005-gsberf
dtpagext = itab_zycbt005-dtpagext.
if sy-subrc = 0.
continue.
endif.
v_saldo = v_saldo + itab_zycbt005-vlme_p.
* << Fim da inclusão
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
endif.
* << Fim da inclusão
itab_relat-dtde = v_dtde.
if itab_zycbt006-dtpagto < s_dtentr.
itab_relat-dtate = itab_zycbt006-dtpagto.
else.
itab_relat-dtate = s_dtentr.
endif.
...
...
itab_zycbt002j-txjtotal
itab_zycbt002j-tptxjur
itab_relat-dtde
itab_relat-dtate
itab_zycbt001-waers
itab_zycbt011-ctmoed
'A'.
endloop.
if v_dtate < itab_zycbt002j-dtfinal.
v_saldo = itab_zycbt001-slpagar.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
clear itab_zycbt006_aux.
* << Fim da inclusão
loop at itab_zycbt006_aux where dtpagto > v_dtde.
select parid up to 1 rows from /pws/zycbt005
into /pws/zycbt005-parid
where nrseqc = itab_zycbt006_aux-nrseqc
and tpdesp = itab_zycbt006_aux-tpdesp
and nrparc = itab_zycbt006_aux-nrparc
and nrinvoic = itab_zycbt006_aux-nrinvoic
and gsberf = itab_zycbt006_aux-gsberf
and dtvincul = itab_zycbt006_aux-dtvincul
and dtvencto = itab_zycbt006_aux-dtvencto
and nrparcf = itab_zycbt006_aux-nrparcf.
endselect.
if /pws/zycbt005-parid > 0.
itab_zycbt006_aux-vlme = itab_zycbt006_aux-vlme *
/pws/zycbt005-parid.
endif.
v_saldo = v_saldo + itab_zycbt006_aux-vlme.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
endloop.
if sy-subrc ne 0.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc
and dtpagext > v_dtde.
read table itab_zycbt006 with key
nrseqc = itab_zycbt001-nrseqc
nrinvoic = itab_zycbt005-nrinvoic
nrparcf = itab_zycbt005-nrparcf
gsberf = itab_zycbt005-gsberf
dtpagext = itab_zycbt005-dtpagext.
if sy-subrc = 0.
continue.
endif.
v_saldo = v_saldo + itab_zycbt005-vlme_p.
* << Fim da inclusão
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
endif.
* << Fim da inclusão
itab_relat-dtde = v_dtde.
if itab_zycbt002j-dtfinal < s_dtentr.
itab_relat-dtate = itab_zycbt002j-dtfinal.
else.
itab_relat-dtate = s_dtentr.
endif.
...
...
itab_zycbt002j-txjtotal
itab_zycbt002j-tptxjur
itab_relat-dtde
itab_relat-dtate
itab_zycbt001-waers
itab_zycbt011-ctmoed
'A'.
endif.
if v_liq is initial.
v_saldo = itab_zycbt001-slpagar.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
clear itab_zycbt006_aux.
* << Fim da inclusão
loop at itab_zycbt006_aux where dtpagto > v_dtde.
select parid up to 1 rows from /pws/zycbt005
into /pws/zycbt005-parid
where nrseqc = itab_zycbt006_aux-nrseqc
and tpdesp = itab_zycbt006_aux-tpdesp
and nrparc = itab_zycbt006_aux-nrparc
and nrinvoic = itab_zycbt006_aux-nrinvoic
and gsberf = itab_zycbt006_aux-gsberf
and dtvincul = itab_zycbt006_aux-dtvincul
and dtvencto = itab_zycbt006_aux-dtvencto
and nrparcf = itab_zycbt006_aux-nrparcf.
endselect.
if /pws/zycbt005-parid > 0.
itab_zycbt006_aux-vlme = itab_zycbt006_aux-vlme *
/pws/zycbt005-parid.
endif.
v_saldo = v_saldo + itab_zycbt006_aux-vlme.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
endloop.
if sy-subrc ne 0.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc
and dtpagext > v_dtde.
read table itab_zycbt006 with key
nrseqc = itab_zycbt001-nrseqc
nrinvoic = itab_zycbt005-nrinvoic
nrparcf = itab_zycbt005-nrparcf
gsberf = itab_zycbt005-gsberf
dtpagext = itab_zycbt005-dtpagext.
if sy-subrc = 0.
continue.
endif.
v_saldo = v_saldo + itab_zycbt005-vlme_p.
* << Fim da inclusão
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JC
endif.
* << Fim da inclusão
itab_relat-dtde = v_dtde.
if itab_zycbt002j-dtfinal < s_dtentr.
itab_relat-dtate = itab_zycbt002j-dtfinal.
else.
itab_relat-dtate = s_dtentr.
endif.
...
...
p_inicio
p_saldo_aux
p_linha2
p_contr
p_cont
p_linha
p_deduz
p_dtfim.
sort itab_zycbt005 by nrseqc dtpagext ascending.
sort itab_zycbt005_aux by dtpagext ascending.
* >> Início da exclusão: FORM CALCULA_JUROS_VINCULACAO1
loop at itab_zycbt002j where nrseqc = itab_zycbt001-nrseqc and
dtinicio < p_dtfim.
p_linha2 = p_linha2 + 1.
clear: p_saldo_final, v_juros, p_ultimo.
if itab_zycbt002j-tptxjur eq 'A'.
v_base_dias = 360.
elseif itab_zycbt002j-tptxjur eq 'M'.
v_base_dias = 30.
else.
v_base_dias = 180.
endif.
clear p_linha.
loop at itab_zycbt005 where nrseqc = itab_zycbt002j-nrseqc.
p_linha = p_linha + 1.
endloop.
p_saldo_final = itab_zycbt001-vlme.
loop at itab_zycbt005 where dtpagext < itab_zycbt002j-dtfinal and
dtpagext < s_dtentr and
dtpagext > '00000000' and
nrseqc = itab_zycbt001-nrseqc.
p_saldo_final = p_saldo_final - itab_zycbt005-vlme_p.
endloop.
v_saldo_inicial = itab_zycbt001-vlme.
loop at itab_zycbt005 where dtpagext <= itab_zycbt002j-dtinicio
and dtpagext > '00000000'
and nrseqc = itab_zycbt001-nrseqc.
v_saldo_inicial = v_saldo_inicial - itab_zycbt005-vlme_p.
endloop.
* << Fim da exclusão
move itab_zycbt005[] to itab_zycbt005_aux[].
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc
and dtpagext >= itab_zycbt002j-dtinicio
and dtpagext < itab_zycbt002j-dtfinal
and deduz_juros = 'X'.
* >> Início da inclusão: FORM CALCULA_JUROS_VINCULACAO1
exit.
* << Fim da inclusão
endloop.
if sy-subrc eq 0.
p_inicio = itab_zycbt002j-dtinicio.
loop at itab_zycbt005
where dtpagext >= itab_zycbt002j-dtinicio
and dtpagext < itab_zycbt002j-dtfinal
and dtpagext < s_dtentr
and nrseqc = itab_zycbt001-nrseqc.
* >> Início da inclusão: FORM CALCULA_JUROS_VINCULACAO1
read table itab_zycbt006 with key
nrseqc = itab_zycbt001-nrseqc
nrinvoic = itab_zycbt005-nrinvoic
nrparcf = itab_zycbt005-nrparcf
gsberf = itab_zycbt005-gsberf
dtpagext = itab_zycbt005-dtpagext.
if sy-subrc = 0.
continue.
endif.
* << Fim da inclusão
if p_ultimo eq itab_zycbt005-dtpagext.
continue.
endif.
if p_inicio eq itab_zycbt005-dtpagext.
if itab_zycbt005-deduz_juros = 'X'.
p_deduz = 'X'.
else.
p_saldo_aux = p_saldo_aux + itab_zycbt005-vlme_p.
endif.
continue.
...
...
itab_relat-txc = v_taxac.
itab_relat-vlmij = itab_relat-vlmej * itab_relat-txc.
perform preenche_itab_relat.
append itab_relat.
else.
describe table itab_zycbt002j_aux lines p_linha.
if p_linha2 eq p_linha.
if itab_zycbt002j-dtfinal < p_dtfim.
v_per_dias = itab_zycbt002j-dtfinal - p_inicio.
v_juros = ( p_saldo_final * itab_zycbt002j-txjtotal / 100 )
* >> Início da exclusão: FORM CALCULA_JUROS_VINCULACAO1
* ( v_per_dias / v_base_dias )
.
* << Fim da exclusão
* >> Início da inclusão: FORM CALCULA_JUROS_VINCULACAO1
* ( v_per_dias / v_base_dias ).
* << Fim da inclusão
itab_relat-vlmej = v_juros.
itab_relat-vlme = p_saldo_final.
itab_relat-dtde = p_inicio.
itab_relat-dtate = itab_zycbt002j-dtfinal.
else.
v_per_dias = p_dtfim - p_inicio.
v_juros = ( p_saldo_final * itab_zycbt002j-txjtotal / 100 )
* ( v_per_dias / v_base_dias ).
itab_relat-vlmej = v_juros.
itab_relat-vlme = p_saldo_final.
...
...
itab_relat-dtde = itab_zycbt002j-dtinicio.
itab_relat-dtate = itab_zycbt002j-dtfinal.
perform seleciona_taxa.
itab_relat-txc = v_taxac.
itab_relat-vlmij = itab_relat-vlmej * itab_relat-txc.
perform preenche_itab_relat.
append itab_relat.
endif.
endif.
clear p_cont.
* >> Início da exclusão: FORM CALCULA_JUROS_VINCULACAO1
endloop.
p_saldo_final = itab_zycbt001-vlme.
loop at itab_zycbt005 where dtpagext < s_dtentr
and dtpagext > '00000000'
and nrseqc = itab_zycbt001-nrseqc.
if itab_zycbt005-waers ne itab_relat-waers.
p_saldo_final = p_saldo_final - itab_zycbt005-vlvinc.
else.
p_saldo_final = p_saldo_final - itab_zycbt005-vlme_p.
endif.
endloop.
v_saldo_inicial = itab_zycbt001-vlme.
loop at itab_zycbt005 where dtpagext < itab_relat-dtate and
dtpagext > '00000000' and
nrseqc = itab_zycbt001-nrseqc.
if itab_zycbt005-waers ne itab_relat-waers.
v_saldo_inicial = v_saldo_inicial - itab_zycbt005-vlvinc.
else.
v_saldo_inicial = v_saldo_inicial - itab_zycbt005-vlme_p.
endif.
endloop.
if s_dtentr > itab_relat-dtate
and p_deduz eq 'X'.
v_per_dias = s_dtentr - itab_relat-dtate.
v_juros = ( p_saldo_final * itab_zycbt002j-txjtotal / 100 )
* ( v_per_dias / v_base_dias ).
if not v_juros is initial.
itab_relat-vlmej = v_juros.
itab_relat-vlme = p_saldo_final.
itab_relat-dtde = itab_relat-dtate.
itab_relat-dtate = s_dtentr.
perform seleciona_taxa.
itab_relat-txc = v_taxac.
itab_relat-vlmij = itab_relat-vlmej * itab_relat-txc.
perform preenche_itab_relat.
append itab_relat.
endif.
elseif s_dtentr > itab_relat-dtate.
v_per_dias = s_dtentr - itab_relat-dtate.
v_juros = ( p_saldo_final * itab_zycbt002j-txjtotal / 100 )
* ( v_per_dias / v_base_dias ).
if not v_juros is initial.
itab_relat-vlmej = v_juros.
itab_relat-vlme = p_saldo_final.
itab_relat-dtde = itab_relat-dtate.
itab_relat-dtate = s_dtentr.
perform seleciona_taxa.
itab_relat-txc = v_taxac.
itab_relat-vlmij = itab_relat-vlmej * itab_relat-txc.
perform preenche_itab_relat.
append itab_relat.
endif.
endif.
clear p_contr.
* << Fim da exclusão
endform.
form calcula_juros_vinculacao2 using p_liq
p_dtde
p_dtate
p_saldo
p_dtfim.
clear itab_zycbt005_aux.
refresh itab_zycbt005_aux.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc.
move itab_zycbt005 to itab_zycbt005_aux.
append itab_zycbt005_aux.
endloop.
sort itab_zycbt005 by nrseqc dtpagext ascending.
sort itab_zycbt005_aux by dtpagext ascending.
* >> Início da exclusão: FORM CALCULA_JUROS_VINCULACAO2
p_saldo = itab_zycbt001-slpagar.
loop at itab_zycbt002j where nrseqc = itab_zycbt001-nrseqc
and dtinicio < p_dtfim.
clear p_liq.
p_dtde = itab_zycbt002j-dtinicio.
p_dtate = itab_zycbt002j-dtfinal.
* << Fim da exclusão
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc and
dtpagext > itab_zycbt002j-dtinicio and
dtpagext <= itab_zycbt002j-dtfinal.
* >> Início da inclusão: FORM CALCULA_JUROS_VINCULACAO2
read table itab_zycbt006 with key
nrseqc = itab_zycbt001-nrseqc
nrinvoic = itab_zycbt005-nrinvoic
nrparcf = itab_zycbt005-nrparcf
gsberf = itab_zycbt005-gsberf
dtpagext = itab_zycbt005-dtpagext.
if sy-subrc = 0.
continue.
endif.
* << Fim da inclusão
p_liq = 'X'.
itab_relat-dtde = p_dtde.
if itab_zycbt005-dtpagext < s_dtentr
and itab_zycbt005-dtpagext > '00000000'.
itab_relat-dtate = itab_zycbt005-dtpagext.
* >> Início da exclusão: FORM CALCULA_JUROS_VINCULACAO2
else.
itab_relat-dtate = s_dtentr.
endif.
itab_relat-vlme = p_saldo.
itab_relat-ftpj = 'A'.
perform preenche_itab_relat.
p_dtde = itab_relat-dtate.
p_dtate = itab_relat-dtate.
check not itab_relat is initial.
check itab_relat-dtde =< itab_relat-dtate.
perform processa_calculo_juros using itab_relat-vlme
itab_zycbt002j-txjtotal
itab_zycbt002j-tptxjur
itab_relat-dtde
itab_relat-dtate
itab_zycbt001-waers
itab_zycbt011-ctmoed
'A'.
p_saldo = p_saldo - itab_zycbt005-vlme_p.
endloop.
if p_dtate < itab_zycbt002j-dtfinal.
itab_relat-dtde = p_dtde.
if itab_zycbt002j-dtfinal < s_dtentr.
itab_relat-dtate = itab_zycbt002j-dtfinal.
else.
itab_relat-dtate = s_dtentr.
endif.
check itab_relat-dtde < itab_relat-dtate.
itab_relat-vlme = p_saldo.
itab_relat-ftpj = 'A'.
perform preenche_itab_relat.
p_dtde = itab_relat-dtate.
p_dtate = itab_relat-dtate.
check not itab_relat is initial.
perform processa_calculo_juros using itab_relat-vlme
itab_zycbt002j-txjtotal
itab_zycbt002j-tptxjur
itab_relat-dtde
itab_relat-dtate
itab_zycbt001-waers
itab_zycbt011-ctmoed
'A'.
endif.
if p_liq is initial.
itab_relat-dtde = p_dtde.
if itab_zycbt002j-dtfinal < s_dtentr.
itab_relat-dtate = itab_zycbt002j-dtfinal.
* << Fim da exclusão
else.
itab_relat-dtate = s_dtentr.
endif.
itab_relat-vlme = p_saldo.
itab_relat-ftpj = 'A'.
perform preenche_itab_relat.
p_dtde = itab_relat-dtate.
p_dtate = itab_relat-dtate.
check not itab_relat is initial.
check itab_relat-dtde =< itab_relat-dtate.
perform processa_calculo_juros using itab_relat-vlme
itab_zycbt002j-txjtotal
itab_zycbt002j-tptxjur
itab_relat-dtde
itab_relat-dtate
itab_zycbt001-waers
itab_zycbt011-ctmoed
'A'.
* >> Início da exclusão: FORM CALCULA_JUROS_VINCULACAO2
endif.
* << Fim da exclusão
endloop.
endform.
----------------------------------------------------------------------------------------------------
Modificações efetuadas em REPS /PWS/ZYCBR003
...
v_imp type i,
v_ec type i,
v_nrparcj type /pws/zycbt002-nrparc,
v_programa type sy-cprog,
v_defator like tcurr-ffact,
v_parafator like tcurr-tfact,
v_separa type c,
v_vlprov_aux like /pws/zycbt004-vlme,
v_fprov type /pws/zycbt007-fprovisao,
v_liq type c.
* >> Início da exclusão:
data: v_jace type c,
v_dtpagto type sy-datum.
* << Fim da exclusão
* >> Início da inclusão:
data: v_jace type c,
v_dtpagto type sy-datum.
data: v_vinculacao type c.
* << Fim da inclusão
selection-screen begin of block a1 with frame title text-001.
parameters: s_bukrs like /pws/zycbt001-bukrs obligatory,
s_dtentr like sy-datum obligatory.
parameters: p_agrup as checkbox.
selection-screen end of block a1.
selection-screen begin of block b2 with frame title text-046.
parameters: s_rbrotm radiobutton group rg1,
s_rbrotd radiobutton group rg1,
s_rbrela radiobutton group rg1.
selection-screen end of block b2.
...
...
endloop.
clear: itab_zycbt001, itab_zycbt002p, itab_zycbt002j.
endform.
form preenche_itab_relat.
itab_relat-nrseqc = itab_zycbt001-nrseqc.
itab_relat-nrcontr = itab_zycbt001-nrcontr.
itab_relat-tpcontr = itab_zycbt001-tpcontr.
itab_relat-nrparcj = itab_zycbt002j-nrparc.
itab_relat-nrparcp = itab_zycbt002p-nrparc.
itab_relat-przcontr = itab_zycbt001-przcontr.
* >> Início da inclusão: FORM PREENCHE_ITAB_RELAT
if itab_relat-tpcontr(1) = 'P' or
itab_relat-tpcontr(1) = 'S'.
clear: itab_relat-nrinvoic, itab_relat-dtvincul.
else.
if not itab_zycbt006_aux-nrinvoic is initial.
itab_relat-nrinvoic = itab_zycbt006_aux-nrinvoic.
itab_relat-dtvincul = itab_zycbt006_aux-dtvincul.
elseif not itab_zycbt006-nrinvoic is initial.
itab_relat-nrinvoic = itab_zycbt006-nrinvoic.
itab_relat-dtvincul = itab_zycbt006-dtvincul.
elseif not itab_zycbt005-nrinvoic is initial.
* << Fim da inclusão
itab_relat-nrinvoic = itab_zycbt005-nrinvoic.
itab_relat-dtvincul = itab_zycbt005-dtvincul.
* >> Início da inclusão: FORM PREENCHE_ITAB_RELAT
endif.
endif.
* << Fim da inclusão
itab_relat-bco = itab_zycbt001-bconegoc.
select name1
up to 1 rows
into (lfa1-name1)
from lfa1
...
...
v_dtate like sy-datum.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc.
primeiro = 'X'.
itab_zycbt005-vlme_p = itab_zycbt005-vlme_p * itab_zycbt005-parid.
perform seleciona_data_operacao.
if itab_zycbt001-tpcontr(1) eq 'E' and not
itab_zycbt001-dtinijur is initial.
v_dtoperac = itab_zycbt001-dtinijur.
endif.
if itab_zycbt005-dtcredext is initial.
* >> Início da inclusão: FORM PROCESSA_VINCULACOES
clear itab_zycbt006_aux.
* << Fim da inclusão
loop at itab_zycbt006_aux where nrseqc = itab_zycbt005-nrseqc
and tpdesp = itab_zycbt005-tpdesp
and nrparc = itab_zycbt005-nrparc
and dtincl = itab_zycbt005-dtincl
and nrinvoic = itab_zycbt005-nrinvoic
and gsberf = itab_zycbt005-gsberf
and dtvincul = itab_zycbt005-dtvincul
and dtvencto = itab_zycbt005-dtvencto
and dtpagto <= s_dtentr.
if itab_zycbt006_aux-dtcalcjur eq 'L'.
...
...
v_nrdias = itab_zycbt010-nrdias.
clear itab_zycbt002j_aux.
refresh itab_zycbt002j_aux.
loop at itab_zycbt002j where nrseqc = itab_zycbt001-nrseqc and
dtinicio < p_dtfim.
move itab_zycbt002j to itab_zycbt002j_aux.
append itab_zycbt002j_aux.
endloop.
check sy-subrc eq 0.
clear v_linha2.
* >> Início da exclusão: FORM PROCESSA_PERIODO_JL
read table itab_zycbt005 with key nrseqc = itab_zycbt001-nrseqc.
if ( itab_zycbt001-tpcontr(1) eq 'P' or
itab_zycbt001-tpcontr(1) eq 'S' ) and
sy-subrc = 0 and not itab_zycbt005-dtpagext is initial.
perform calcula_juros_vinculacao1 using v_saldo_final
v_ultimo
v_inicio
v_saldo_aux
v_linha2
v_contr
v_cont
v_linha
v_deduz
p_dtfim.
exit.
endif.
* << Fim da exclusão
loop at itab_zycbt002j where nrseqc = itab_zycbt001-nrseqc and
dtinicio < p_dtfim.
v_linha2 = v_linha2 + 1.
clear: v_saldo_final, v_juros, v_ultimo.
if itab_zycbt002j-tptxjur eq 'A'.
v_base_dias = 360.
elseif itab_zycbt002j-tptxjur eq 'M'.
v_base_dias = 30.
else.
v_base_dias = 180.
...
...
clear v_linha.
loop at itab_zycbt006 where nrseqc = itab_zycbt002j-nrseqc.
v_linha = v_linha + 1.
endloop.
v_saldo_final = itab_zycbt001-vlme.
loop at itab_zycbt006 where dtpagto < itab_zycbt002j-dtfinal and
dtpagto < s_dtentr and
nrseqc = itab_zycbt001-nrseqc.
v_saldo_final = v_saldo_final - itab_zycbt006-vlme.
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
loop at itab_zycbt005 where dtpagext < itab_zycbt002j-dtfinal and
dtpagext < s_dtentr and
dtpagext > '00000000' and
nrseqc = itab_zycbt001-nrseqc.
read table itab_zycbt006 with key
nrseqc = itab_zycbt001-nrseqc
nrinvoic = itab_zycbt005-nrinvoic
nrparcf = itab_zycbt005-nrparcf
gsberf = itab_zycbt005-gsberf
dtpagext = itab_zycbt005-dtpagext.
if sy-subrc = 0.
continue.
endif.
v_saldo_final = v_saldo_final - itab_zycbt005-vlme_p.
endloop.
* << Fim da inclusão
v_saldo_inicial = itab_zycbt001-vlme.
loop at itab_zycbt006 where dtpagto <= itab_zycbt002j-dtinicio
and nrseqc = itab_zycbt001-nrseqc.
v_saldo_inicial = v_saldo_inicial - itab_zycbt006-vlme.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
endloop.
loop at itab_zycbt005 where dtpagext <= itab_zycbt002j-dtinicio
and dtpagext > '00000000'
and nrseqc = itab_zycbt001-nrseqc.
read table itab_zycbt006 with key
nrseqc = itab_zycbt001-nrseqc
nrinvoic = itab_zycbt005-nrinvoic
nrparcf = itab_zycbt005-nrparcf
gsberf = itab_zycbt005-gsberf
dtpagext = itab_zycbt005-dtpagext.
if sy-subrc = 0.
continue.
endif.
v_saldo_inicial = v_saldo_inicial - itab_zycbt005-vlme_p.
* << Fim da inclusão
endloop.
move itab_zycbt006[] to itab_zycbt006_aux[].
loop at itab_zycbt006 where nrseqc = itab_zycbt001-nrseqc
and dtpagto >= itab_zycbt002j-dtinicio
and dtpagto < itab_zycbt002j-dtfinal
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
and deduz_juros = 'X'.
exit.
endloop.
clear v_vinculacao.
if sy-subrc ne 0.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc
and dtpagext >= itab_zycbt002j-dtinicio
and dtpagext < itab_zycbt002j-dtfinal
* << Fim da inclusão
and deduz_juros = 'X'.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
v_vinculacao = 'X'.
exit.
* << Fim da inclusão
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
endif.
* << Fim da inclusão
if sy-subrc eq 0.
v_inicio = itab_zycbt002j-dtinicio.
loop at itab_zycbt006
where dtpagto >= itab_zycbt002j-dtinicio
and dtpagto < itab_zycbt002j-dtfinal
and dtpagto < s_dtentr
and nrseqc = itab_zycbt001-nrseqc.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
check v_vinculacao is initial.
* << Fim da inclusão
if v_ultimo eq itab_zycbt006-dtpagto.
continue.
endif.
if v_inicio eq itab_zycbt006-dtpagto.
if itab_zycbt006-deduz_juros = 'X'.
v_deduz = 'X'.
else.
v_saldo_aux = v_saldo_aux + itab_zycbt006-vlme.
endif.
continue.
...
...
endif.
v_juros = ( v_saldo_inicial * itab_zycbt002j-txjtotal / 100 )
* ( v_per_dias / v_base_dias ).
itab_relat-vlme = v_saldo_inicial.
itab_relat-dtde = v_inicio.
itab_relat-dtate = v_ultimo.
v_saldo_aux = v_saldo_aux + itab_zycbt006-vlme.
endif.
v_inicio = itab_zycbt006-dtpagto.
if v_deduz eq 'X'.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
clear itab_zycbt006_aux.
* << Fim da inclusão
loop at itab_zycbt006_aux
where dtpagto = itab_zycbt006-dtpagto and
nrseqc = itab_zycbt006-nrseqc and
( tpdesp ne itab_zycbt006-tpdesp or
nrparc ne itab_zycbt006-nrparc or
dtincl ne itab_zycbt006-dtincl or
nrinvoic ne itab_zycbt006-nrinvoic or
gsberf ne itab_zycbt006-gsberf or
dtvincul ne itab_zycbt006-dtvincul or
dtvencto ne itab_zycbt006-dtvencto ).
...
...
clear v_saldo_aux.
endif.
itab_relat-vlmej = v_juros.
perform seleciona_taxa.
itab_relat-txc = v_taxac.
itab_relat-vlmij = itab_relat-vlmej * itab_relat-txc.
perform preenche_itab_relat.
append itab_relat.
clear v_cont.
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
if not v_vinculacao is initial.
loop at itab_zycbt005 where nrseqc = itab_zycbt001-nrseqc
and not dtpagext is initial.
exit.
endloop.
if ( itab_zycbt001-tpcontr(1) eq 'P' or
itab_zycbt001-tpcontr(1) eq 'S' ) and
sy-subrc = 0 and not itab_zycbt005-dtpagext is initial.
perform calcula_juros_vinculacao1 using v_saldo_final
v_ultimo
v_inicio
v_saldo_aux
v_linha2
v_contr
v_cont
v_linha
v_deduz
p_dtfim.
continue.
endif.
endif.
* << Fim da inclusão
if sy-subrc eq 0.
if itab_zycbt002j-dtfinal < s_dtentr.
v_per_dias = itab_zycbt002j-dtfinal - v_inicio.
else.
v_per_dias = s_dtentr - v_inicio.
endif.
v_juros = ( v_saldo_inicial * itab_zycbt002j-txjtotal / 100 )
* ( v_per_dias / v_base_dias ).
itab_relat-vlmej = v_juros.
itab_relat-vlme = v_saldo_inicial.
...
...
v_saldo_final = v_saldo_final - itab_zycbt005-vlvinc.
elseif sy-subrc = 0 and
itab_zycbt005-vlme_p ne itab_zycbt006-vlme.
perform determina_fator using v_parafator
v_defator.
v_saldo_final = v_saldo_final - ( ( ( itab_zycbt005-parid /
v_defator ) * v_parafator ) * itab_zycbt006-vlme ).
endif.
else.
v_saldo_final = v_saldo_final - itab_zycbt006-vlme.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
endif.
endloop.
if sy-subrc ne 0.
v_saldo_final = itab_zycbt001-vlme.
loop at itab_zycbt005 where dtpagext < s_dtentr
and dtpagext > '00000000'
and nrseqc = itab_zycbt001-nrseqc.
if itab_zycbt005-waers ne itab_relat-waers.
v_saldo_final = v_saldo_final - itab_zycbt005-vlvinc.
else.
v_saldo_final = v_saldo_final - itab_zycbt005-vlme_p.
* << Fim da inclusão
endif.
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
endif.
* << Fim da inclusão
v_saldo_inicial = itab_zycbt001-vlme.
loop at itab_zycbt006 where dtpagto < itab_relat-dtate and
nrseqc = itab_zycbt001-nrseqc.
if itab_zycbt006-waers ne itab_relat-waers.
read table itab_zycbt005 with key nrinvoic = itab_zycbt006-nrinvoic
...
...
itab_zycbt005-vlme_p ne itab_zycbt006-vlme.
perform determina_fator using v_parafator
v_defator.
v_saldo_inicial = v_saldo_inicial - ( ( ( itab_zycbt005-parid /
v_defator ) * v_parafator ) * itab_zycbt006-vlme ).
endif.
else.
v_saldo_inicial = v_saldo_inicial - itab_zycbt006-vlme.
endif.
endloop.
* >> Início da inclusão: FORM PROCESSA_PERIODO_JL
if sy-subrc ne 0.
v_saldo_inicial = itab_zycbt001-vlme.
loop at itab_zycbt005 where dtpagext < itab_relat-dtate and
dtpagext > '00000000' and
nrseqc = itab_zycbt001-nrseqc.
if itab_zycbt005-waers ne itab_relat-waers.
v_saldo_inicial = v_saldo_inicial - itab_zycbt005-vlvinc.
else.
v_saldo_inicial = v_saldo_inicial - itab_zycbt005-vlme_p.
endif.
endloop.
endif.
* << Fim da inclusão
if s_dtentr > itab_relat-dtate
and v_deduz eq 'X'.
v_per_dias = s_dtentr - itab_relat-dtate.
v_juros = ( v_saldo_final * itab_zycbt002j-txjtotal / 100 )
* ( v_per_dias / v_base_dias ).
if not v_juros is initial.
itab_relat-vlmej = v_juros.
itab_relat-vlme = v_saldo_final.
itab_relat-dtde = itab_relat-dtate.
itab_relat-dtate = s_dtentr.
...