Ocorrência
No módulo Tesouraria, ao tentar realizar integração de itens de cupons (VGTIFCIT), apresenta o erro abaixo , e assim não é possível efetuar a integração.

Ambiente
Retail Manager System – Tesouraria – V12R23 (serve para todas as versões).
Causa
Esse erro ocorre se o cliente não estiver com as tabelas fiscais convertidas nos meses referente, que necessário que esteja convertidas anualmente e as procedures atualizadas, neste caso a procedure PROC_TES_MOVI.
Solução
Para solucionar essa ocorrência, realize os seguintes passos:
1. No arquivo de log (extensão .rrl) ou na tela do RMS, verifique se a versão do programa VGTIFCIT está atualizada;
2. Verifique se as tabelas fiscais da tabela AA1FR60I estão convertidas (AA1FR60I_aaaamm);
3. Verificar se a tabela AG3VNFCC está com o campo NFCC_INF_CHR;
4. Verificar se a tabela AA1FR60I está com o campo R60I_VLR_ACR;
5. Verificar se as tabelas mensais de Cupons estão convertidas (R60I_VLR_ACR) - AA1FR60I_2019016.
6. Se as tabelas mensais não estiverem convertidas:
6.1. Executar VGTUR60I, versão 12.23 (ou qualquer outra versão);
6.2 Selecione a loja, periodo e filtrar;
6.3. Confirmar a conversão das tabelas;
7. Se a conversão não funcionar via programa VGTUR60I ou VGTUNFCE;
8. Executar via banco de dados a PROC_TES_CUP_CONV informando S no primeiro parâmetro;
9. Se a orientação acima não funcione, seguir abaixo:
9.1. Aplicar o pacote CONV_60i mencionado na ultima interação;
9.2. No banco de Dados (PLSQL Developer) executar:
9.2.1. File - New - Command Window e clica, aparecerá a tela baixo;

9.3. Copia o arquivo CNV_60I.sql (imagem abaixo) em um diretório ( a escolher);

9.4. Coloque o caminho da seguinte forma: @C:\CNV_F60I.sql;
9.5. Escolha o o período inicial (DDMMAA) Exemplo:121212;


9.6.Escolha o o período final (DDMMAA) Exp:301212;

10. Após executar os processos acima, o programa irá funcionar normalmente;


Informação Importante:
Copiar o Script CNV_60I.sql e aplicar via banco, apenas na para cliente V12;
set serveroutput on size 1000000
set feed off
set echo off;
set veri off;
prompt;
prompt Conversao para 60I Mensal (AA1FR60I)
prompt
prompt Este processo popula as tabelas mensais AA1FR60I_aaaamm
prompt com o conteudo da tabela AG2VR60I
prompt
accept p_ini prompt "Data inicial (DDMMAA) : ";
accept p_fim prompt "Data final (DDMMAA) : ";
prompt
prompt Aguarde ... Executando processo ...
prompt
declare
v_ini number(7);
v_fim number(7);
v_err varchar2(512);
procedure PROC_CNV_F60I(INI in number,
FIM in number) is
v_fig number(3);
v_mes number(5);
v_dta number(7);
v_reg number(7);
v_err varchar2(512);
v_sql varchar2(2048);
f_log varchar2(1);
a_log varchar2(50);
x_log varchar2(1024);
cursor C_Loj is
select distinct ctr_loja loj
from AG2VCTRL
where ctr_data_mov = mod(v_dta,1000000);
Loj C_Loj%rowtype;
cursor C_60i is
select trunc(mag60i_loja/10) fil,
mag60i_aaammdd dta,
mag60i_caixa cxa,
mag60i_cupom cup,
mag60i_seq seq,
mag60i_ean_prod ean,
mag60i_cod_item ite,
mag60i_quant qtd,
mag60i_vlr_unit vlr_uni,
mag60i_vlr_base vlr_ctb,
decode(mag60i_alq,0,0,mag60i_vlr_base) icm_bas,
mag60i_alq icm_alq,
mag60i_imposto icm_val,
substr(mag60i_filler,1,4) icm_trb,
nvl(r60p_secao,git_secao) sec,
mag60i_situacao sit,
nvl(r60p_pis_sit,0) pis_sit,
nvl(r60p_pis_cst,0) pis_cst,
nvl(r60p_pis_sst,0) pis_sst,
nvl(r60p_pis_ctb,0) pis_ctb,
nvl(r60p_pis_bas,0) pis_bas,
nvl(r60p_pis_alq,0) pis_alq,
nvl(r60p_pis_val,0) pis_val,
nvl(r60p_cof_sit,0) cof_sit,
nvl(r60p_cof_cst,0) cof_cst,
nvl(r60p_cof_sst,0) cof_sst,
nvl(r60p_cof_ctb,0) cof_ctb,
nvl(r60p_cof_bas,0) cof_bas,
nvl(r60p_cof_alq,0) cof_alq,
nvl(r60p_cof_val,0) cof_val,
nvl(r60p_cod_ctr,0) cod_ctr,
nvl(r60p_nat_rec,0) nat_rec,
nvl(git_tpo_emb_venda,'UN') emb_tpo,
nvl(git_emb_venda,1) emb_qtd,
substr(nvl(A.tab_conteudo,B.tab_conteudo),1,20) ecf_mdl,
substr(nvl(mag60i_seri_ecf,C.tab_conteudo),1,20) ecf_ser
from AG2VR60I,
AA3CITEM,
AG2VR60P,
AA2CTABE A,
AA2CTABE B,
AA2CTABE C
where C.tab_acesso (+) = to_char(trunc(mag60i_loja/10),'fm0000') || 'PDV' || to_char(mag60i_caixa,'fm000')
and C.tab_codigo (+) = 26
and B.tab_acesso (+) = to_char(trunc(mag60i_loja/10),'fm0000') || 'MOD' || to_char(mag60i_caixa,'fm000')
and B.tab_codigo (+) = 45
and A.tab_acesso (+) = to_char(trunc(mag60i_loja/10),'fm0000') || to_char(mag60i_caixa,'fm000') || 'MOD'
and A.tab_codigo (+) = 45
and r60p_cod_item (+) = mag60i_cod_item
and r60p_ean_prod (+) = mag60i_ean_prod
and r60p_seq (+) = mag60i_seq
and r60p_cupom (+) = mag60i_cupom
and r60p_caixa (+) = mag60i_caixa
and r60p_data (+) = mag60i_aaammdd
and r60p_loja (+) = mag60i_loja
and git_cod_item = mag60i_cod_item
and mag60i_aaammdd = v_dta
and mag60i_loja = Loj.loj;
C60 C_60i%rowtype;
begin
a_log := 'PROC_CNV_F60I_' || to_char(sysdate,'DDMMYY_HHMISS');
x_log := 'PROC_CNV_F60I - Inicio: ' || to_char(INI) || ' - Fim: ' || to_char(FIM);
f_log := f_registra_log(a_log,'W',x_log);
begin
insert into AA2CPARA
values(30,
rpad('AA1FR60I',10,' '),
rpad('S',30,' '));
exception
when others then
NULL;
end;
v_mes := 0;
v_dta := dateto_rms7(rms7to_date(INI) - 1);
v_err := NULL;
loop
v_dta := dateto_rms7(rms7to_date(v_dta) + 1);
if v_dta > FIM
or v_err is not NULL then
exit;
end if;
x_log := 'Data : ' || to_char(rms7to_date(v_dta),'DD/MM/YY');
f_log := f_registra_log(a_log,'A',x_log);
if v_mes <> trunc(v_dta/100) then
if PC_TES_VDT.EXISTE_OBJ('AA1FR60I_' || to_char(trunc(v_dta/100) + 190000,'fm000000'),' ') <> 'S' then
x_log := 'Cria Tabela : AA1FR60I_' || to_char(trunc(v_dta/100) + 190000,'fm000000');
f_log := f_registra_log(a_log,'A',x_log);
begin
PC_TES_VDT.PROC_GER_F60I(trunc(v_dta/10000),
mod(trunc(v_dta/100),100),
v_err);
exception
when others then
v_err := 'ERRO PROC_GER_F60I - ' || sqlcode || '-' || sqlerrm;
end;
if v_err <> 'OK' then
f_log := f_registra_log(a_log,'A','Erro : ' || v_err);
exit;
else
v_err := NULL;
end if;
end if;
v_mes := trunc(v_dta/100);
end if;
open C_Loj;
loop
fetch C_loj into Loj;
if C_loj%notfound
or v_err is not NULL then
exit;
end if;
x_log := 'Data : ' || to_char(rms7to_date(v_dta),'DD/MM/YY') || ' - Loja: ' || to_char(Loj.loj);
f_log := f_registra_log(a_log,'A',x_log);
v_reg := 0;
open C_60i;
loop
fetch C_60i into C60;
if C_60i%notfound
or v_err is not NULL then
exit;
end if;
v_fig := NULL;
if rtrim(C60.icm_trb) in ('I','F','N','D','S','R') then
begin
select to_number(substr(tab_conteudo,22,3))
into v_fig
from AA2CTABE
where tab_acesso = rpad(to_char(trunc(Loj.loj/10),'fm0000000') || rtrim(C60.icm_trb),10,' ')
and tab_codigo = 210;
exception
when others then
begin
select to_number(substr(tab_conteudo,22,3))
into v_fig
from AA2CTABE
where tab_acesso = rpad(rtrim(C60.icm_trb),10,' ')
and tab_codigo = 210;
exception
when others then
v_fig := NULL;
end;
end;
else
begin
select to_number(substr(tab_conteudo,22,3))
into v_fig
from AA2CTABE
where substr(tab_conteudo,8,4) = C60.icm_trb
and tab_acesso like to_char(trunc(Loj.loj/10),'fm0000000') || 'T%'
and tab_codigo = 210;
exception
when others then
begin
select to_number(substr(tab_conteudo,22,3))
into v_fig
from AA2CTABE
where substr(tab_conteudo,8,4) = C60.icm_trb
and tab_acesso like 'T%'
and tab_codigo = 210;
exception
when others then
v_fig := NULL;
end;
end;
end if;
v_fig := nvl(v_fig,0);
begin
v_sql := 'insert into AA1FR60I_' || to_char(trunc(v_dta/100) + 190000,'fm000000') || ' '
|| 'values(' || to_char(C60.fil)
|| ' ,' || to_char(C60.dta)
|| ' ,' || to_char(C60.cxa)
|| ' ,' || to_char(C60.cup)
|| ' ,' || to_char(C60.seq)
|| ' ,' || to_char(C60.ean)
|| ' ,' || to_char(C60.ite)
|| ' ,' || to_char(C60.sec)
|| ' ,' || '''' || C60.sit || ''''
|| ' ,' || to_char(C60.qtd)
|| ' ,' || to_char(C60.vlr_uni)
|| ' ,' || to_char(C60.vlr_ctb)
|| ' ,' || '0 '
|| ' ,' || to_char(v_fig)
|| ' ,' || '''' || C60.icm_trb || ''''
|| ' ,' || to_char(C60.icm_alq)
|| ' ,' || to_char(C60.icm_bas)
|| ' ,' || to_char(C60.icm_val)
|| ' ,' || to_char(C60.pis_sit)
|| ' ,' || to_char(C60.pis_cst)
|| ' ,' || to_char(C60.pis_sst)
|| ' ,' || to_char(C60.pis_ctb)
|| ' ,' || to_char(C60.pis_bas)
|| ' ,' || to_char(C60.pis_alq)
|| ' ,' || to_char(C60.pis_val)
|| ' ,' || to_char(C60.cof_sit)
|| ' ,' || to_char(C60.cof_cst)
|| ' ,' || to_char(C60.cof_sst)
|| ' ,' || to_char(C60.cof_ctb)
|| ' ,' || to_char(C60.cof_bas)
|| ' ,' || to_char(C60.cof_alq)
|| ' ,' || to_char(C60.cof_val)
|| ' ,' || to_char(C60.cod_ctr)
|| ' ,' || to_char(C60.nat_rec)
|| ' ,' || '''' || C60.emb_tpo || ''''
|| ' ,' || to_char(C60.emb_qtd)
|| ' ,' || '0 '
|| ' ,' || 'NULL '
|| ' ,' || to_char(C60.cxa)
|| ' ,' || '''' || C60.ecf_mdl || ''''
|| ' ,' || '''' || C60.ecf_ser || ''''
|| ' ,' || 'NULL '
|| ' ,' || 'NULL '
|| ' ,' || '0) ';
execute immediate v_sql;
exception
when DUP_VAL_ON_INDEX then
NULL;
when others then
v_err := 'ERRO INS AA1FR60I - ' || sqlcode || '-' || sqlerrm;
end;
v_reg := v_reg + sql%rowcount;
end loop;
close C_60i;
if v_err is NULL then
x_log := 'Data : ' || to_char(rms7to_date(v_dta),'DD/MM/YY') || ' - Loja: ' || to_char(Loj.loj) || ' - Reg.: ' || to_char(v_reg);
f_log := f_registra_log(a_log,'A',x_log);
commit;
else
rollback;
end if;
end loop;
close C_Loj;
if v_err is NULL then
commit;
else
rollback;
end if;
end loop;
if v_err is NULL then
commit;
v_err := 'OK';
else
rollback;
end if;
f_log := f_registra_log(a_log,'A','FIM DO PROCESSO : ' || v_err || ' - ' || to_char(rms7to_date(FIM),'DD/MM/YY'));
end PROC_CNV_F60I;
begin
v_err := NULL;
v_ini := nvl(dateto_rms7(rmsto_date(&&p_ini)),0);
v_fim := nvl(dateto_rms7(rmsto_date(&&p_fim)),0);
begin
PROC_CNV_F60I(v_ini, v_fim);
exception
when others then
v_err := 'Erro PROC_CNV_F60I - ' || sqlcode || '-' || sqlerrm;
end;
if v_err is NULL then
v_err := 'Processo efetuado - de ' || to_char(rms7to_date(v_ini),'DD/MM/YY') || ' até ' || to_char(rms7to_date(v_fim),'DD/MM/YY');
end if;
DBMS_OUTPUT.PUT_LINE(v_err);
end;
/
0 Comentários