Good morning to all
I need a help I developed a forms to extract data to Excel but I have a field that brings the access key of the electronic invoice where this field in my table is velchar when EDITO EXCELLY This field leaves all desformated as an example 3,51407E + 43 could anyone help me?
Version: Forms [32 Bit] Version 6.0.8.27.0
ATT,
Tiago
File extracted by Forms in Excel
- dr_gori
- Moderador
- Posts: 5024
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Try to send the field between double quotation marks and an equal in front.
Thus:
Excel always tries to convert automatically. It gives a lot of problems in XML publisher as well.
Thus:
="1123412341234123"
- dr_gori
- Moderador
- Posts: 5024
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
I do not know exactly how you are doing the program.
But where you send the access switch, instead of sending
take a test if it will work ...
But where you send the access switch, instead of sending
123456
you send ="123456"
take a test if it will work ...
So it is in this way, the field calls access key
PROCEDURE PRC_NFS_SAIDAS IS
--
OUT_FILE TEXT_IO.FILE_TYPE;
vcabec VARCHAR2(2000) := '';
v_linha VARCHAR2(2000) := '';
v_detalhe varchar2(2000) := '';
v_nom_arquivo VARCHAR2(60) := 'NFS_SAIDAS.CSV';
v_dir_gravacao VARCHAR2(60) := '';
vCount number := 0;
V_VLR_ICMS NUMBER := 0;
V_VLR_ICMS_SUBS NUMBER := 0;
V_VLR_IPI NUMBER := 0;
V_VLR_PIS NUMBER := 0;
V_VLR_COFINS NUMBER := 0;
V_VLR_FRETE NUMBER := 0;
V_AUX_VLR_FRT NUMBER := 0;
V_AUX_QTD_FRT NUMBER := 0;
V_AUX1 NUMBER := 0;
V_AUX2 NUMBER := 0;
V_PROPR_ESTOQUE NUMBER := 0;
V_NRO_INST NUMBER := 0;
V_NOM_INST VARCHAR2(80);
V_DT_DE_VENCTO DATE := NULL;
V_STATUS_PAGTO VARCHAR2(1) := NULL;
--
CURSOR I IS
select fil.nro_empresa, fil.nro_filial, fil.nro_pessoa emissor ,fil.nom_filial razao_social_emissor,
nf.nro_pessoa_des destinatario, pfj.nom_razao_social razao_social_destinatario,
to_char(nf.dat_emissao,'dd/mm/yyyy') dat_emissao,
nf.nro_seq_nf, nf.nro_nota_fiscal, nf.cod_serie, nfi.nro_seq_nf_item
,nfi.nro_item, ite.nom_item, nfi.sig_uni_medida,
to_char(nfi.qtd_nf_item,'999G999G999G999G990D999','NLS_NUMERIC_CHARACTERS='',.''') qtd_nf_item,
to_char(nfi.vlr_unitario,'9G999G999G990D9999999','NLS_NUMERIC_CHARACTERS='',.''') vlr_unitario,
to_char(nvl(nfi.vlr_desconto,0),'999G999G999G990D99','NLS_NUMERIC_CHARACTERS='',.''') vlr_desconto,
to_char(nvl(nfii.vlr_imposto,0),'999G999G999G990D99','NLS_NUMERIC_CHARACTERS='',.''') vlr_imposto,
to_char(((nfi.qtd_nf_item * nfi.vlr_unitario) - nvl(nfi.vlr_desconto,0)) + nvl(nfii.vlr_imposto,0),'999G999G999G990D99','NLS_NUMERIC_CHARACTERS='',.''') vlr_total_item,
substr(cf.cod_grupo,1,1) || substr(cf.cod_cfop,1,2) || substr(cf.cod_cfop_compl,1,1) cfop,
nfi.cod_nat_operacao natop, n.des_nat_operacao,
nfi.tip_aplicacao_fiscal,
snf.des_situacao_nf,
nf.flg_tipo_nf ,
gr.cod_grupo_item, gr.des_grupo_item, sgr.cod_subgrupo_item, sgr.des_subgrupo_item,
nfe.nro_chave_acesso_nfe chave acesso
from ancapp.nota_fiscal nf,
ancapp.situacao_nf snf,
ancapp.pessoa_fisica_juridica pfj,
ancapp.filial fil,
ancapp.nota_fiscal_item nfi,
ancapp.natureza_operacao n,
ancapp.cfop cf,
ancapp.item ite,
ancapp.grupo_item gr,
ancapp.subgrupo_item sgr,
ancapp.nfe_nota_fiscal nfe,
(select nro_seq_nf, nro_seq_nf_item, sum(nvl(vlr_imposto,0)) vlr_imposto
from ancapp.nf_item_imposto
where nro_imposto in (2,3)
group by nro_seq_nf, nro_seq_nf_item) nfii
where nf.nro_situacao_nf = snf.nro_situacao_nf
and nf.nro_pessoa_emi = fil.nro_pessoa
and nf.nro_pessoa_des = pfj.nro_pessoa
and nf.flg_tipo_nf = 'S'
and nfi.nro_seq_nf = nf.nro_seq_nf
and nfi.nro_seq_nf = nfe.nro_seq_nf
and nfi.nro_item = ite.nro_item
and ite.cod_grupo_item = gr.cod_grupo_item
and ite.cod_grupo_item = sgr.cod_grupo_item and ite.cod_subgrupo_item = sgr.cod_subgrupo_item
and nfi.nro_seq_nf = nfii.nro_seq_nf (+)
and nfi.nro_seq_nf_item = nfii.nro_seq_nf_item (+)
and n.cod_nat_operacao = nfi.cod_nat_operacao
and cf.nro_seq_cfop = nfi.nro_seq_cfop
AND FIL.NRO_EMPRESA = NVL(:PARAMETRO.NRO_EMPRESA,FIL.NRO_EMPRESA)
AND FIL.NRO_FILIAL = NVL(:PARAMETRO.NRO_FILIAL,FIL.NRO_FILIAL)
and TRUNC(NF.DAT_EMISSAO) BETWEEN :PARAMETRO.DT_INICIO AND :PARAMETRO.DT_FIM
AND NF.NRO_SITUACAO_NF = ANCAPP.FUN_PAR('SITUACAO_NF.NORMAL')
AND NF.NRO_PESSOA_DES = NVL(:PARAMETRO.NRO_CLIENTE,NF.NRO_PESSOA_DES)
AND NFI.nro_item = NVL(:PARAMETRO.NRO_ITEM,NFI.NRO_ITEM)
AND ITE.cod_grupo_item = NVL(:PARAMETRO.GRUPO_ITEM, ITE.COD_GRUPO_ITEM)
AND ITE.cod_subgrupo_item = NVL(:PARAMETRO.SUBGRUPO_ITEM, ITE.COD_SUBGRUPO_ITEM)
order by to_char(nf.dat_emissao,'yyyy/mm'), fil.nro_empresa, fil.nro_filial, pfj.nom_razao_social;
BEGIN
--
IF :PARAMETRO.DIRETORIO IS NULL THEN
--
MOSTRA('Obrigatório informar o Diretório\Nome_do_arquivo (Ex: P:\NFS_SAIDAS.CSV)');
RAISE FORM_TRIGGER_FAILURE;
--
END IF;
--
:PARAMETRO.DIRETORIO := REPLACE(:PARAMETRO.DIRETORIO, '.TXT', '');
:PARAMETRO.DIRETORIO := REPLACE(:PARAMETRO.DIRETORIO, '.CSV', '');
--
:PARAMETRO.DIRETORIO := :PARAMETRO.DIRETORIO || '.CSV';
--
BEGIN
--
OUT_FILE := TEXT_IO.FOPEN(:PARAMETRO.DIRETORIO, 'W');
--
EXCEPTION
WHEN OTHERS THEN
--
GO_ITEM('DIRETORIO');
--
MOSTRA('Arquivo não foi aberto. Verifique o Diretorio\Nome.');
RAISE FORM_TRIGGER_FAILURE;
--
END;
--
BEGIN
--
vCount := vCount + 1;
--
IF vCount = 1 THEN
--
vCabec := 'NRO_EMPRESA;NRO_FILIAL;EMISSOR;RAZAO_SOCIAL_EMISSOR;DESTINATARIO;RAZAO_SOCIAL_DESTINATARIO;DAT_EMISSAO;' ||
'NRO_SEQ_NF;NRO_NOTA_FISCAL;COD_SERIE;NRO_SEQ_NF_ITEM;NRO_ITEM;NOM_ITEM;SIG_UNI_MEDIDA;QTD_NF_ITEM;VLR_UNITARIO;VLR_DESCONTO;' ||
'VLR_IMPOSTO;VLR_TOTAL_ITEM;CFOP;NATOP;DES_NAT_OPERACAO;TIP_APLICACAO_FISCAL;DES_SITUACAO_NF;FLG_TIPO_NF;' ||
'COD_GRUPO_ITEM;DES_GRUPO_ITEM;COD_SUBGRUPO_ITEM;DES_SUBGRUPO_ITEM;CHAVE_ACESSO_NFE';
TEXT_IO.PUT_LINE ( OUT_FILE, vCabec );
--
END IF;
---------------
FOR C1 IN I LOOP
-- DADOS
v_linha := C1.nro_empresa
|| ';' || C1.nro_filial
|| ';' || C1.emissor
|| ';' || C1.razao_social_emissor
|| ';' || C1.destinatario
|| ';' || C1.razao_social_destinatario
|| ';' || C1.dat_emissao
|| ';' || C1.nro_seq_nf
|| ';' || C1.nro_nota_fiscal
|| ';' || C1.cod_serie
|| ';' || C1.nro_seq_nf_item
|| ';' || C1.nro_item
|| ';' || C1.nom_item
|| ';' || C1.sig_uni_medida
|| ';' || C1.qtd_nf_item
|| ';' || C1.vlr_unitario
|| ';' || C1.vlr_desconto
|| ';' || C1.vlr_imposto
|| ';' || C1.vlr_total_item
|| ';' || C1.cfop
|| ';' || C1.natop
|| ';' || C1.des_nat_operacao
|| ';' || C1.tip_aplicacao_fiscal
|| ';' || C1.des_situacao_nf
|| ';' || C1.flg_tipo_nf
|| ';' || C1.cod_grupo_item
|| ';' || C1.des_grupo_item
|| ';' || C1.cod_subgrupo_item
|| ';' || C1.des_subgrupo_item
|| ';' || C1.chave_acesso;
--
TEXT_IO.PUT_LINE ( OUT_FILE, v_Linha );
-- zera variaveis;
V_VLR_FRETE := 0;
V_AUX_VLR_FRT := 0;
V_AUX_QTD_FRT := 0;
V_AUX1 := 0;
V_AUX2 := 0;
V_PROPR_ESTOQUE := 0;
V_NRO_INST := 0;
V_NOM_INST := NULL;
v_dt_de_vencto := null;
v_status_pagto := null;
END LOOP;
END;
TEXT_IO.FCLOSE( OUT_FILE );
EXCEPTION
WHEN OTHERS THEN
SET_APPLICATION_PROPERTY (CURSOR_STYLE, 'DEFAULT');
CLEAR_MESSAGE;
--OLE2.Release_Obj( application );
message('Falha ao gerar arquivo: '||sqlerrm);
message('Falha ao gerar arquivo: '||sqlerrm);
RAISE FORM_TRIGGER_FAILURE;
END;
- stcoutinho
- Moderador
- Posts: 850
- Joined: Wed, 11 May 2011 5:15 pm
- Location: são Paulo - SP
Tatellis,
Imagining that the field
For this, simply do the same treatment you made for the other numbers fields contained in the queries of your PL / SQL code, and for this you use the its to_char function.
Another point alerted by dr_gori : You could also use the double quotation marks ( ") to limit This invoice field. In this way Excel would understand the field as string .
Hugs,
Sergio
Imagining that the field
nf.nro_nota_fiscal
corresponds to the "Access key to your invoice", you need to convert the same from NUMBER
to VARCHAR
according to the dr_gori explained.For this, simply do the same treatment you made for the other numbers fields contained in the queries of your PL / SQL code, and for this you use the its to_char function.
Another point alerted by dr_gori : You could also use the double quotation marks ( ") to limit This invoice field. In this way Excel would understand the field as string .
Hugs,
Sergio
-
- Information
-
Who is online
Users browsing this forum: No registered users and 14 guests