SF_FATNF;PreNotas Disponiveis;sys_tbbrow; 4; 0;20;79;padrao;;
:SKEL
VARIAVEL w_colsep = chr(179)
VARIAVEL w_headsep = chr(196)
VARIAVEL Zrecn = Recno()
VARIAVEL zBlkCli = {|nCli| If(left(fCodop,1)$"123", sccpfor->(DbGoto(nCli),cp_nome), sccrcli->(DbGoto(nCli),cr_nome) ) }
VARIAVEL zBlB={|| Zrecn:=recno(),Nfe_CriarLoteXml(fNum, fNum, fnumped , , , .t., fnumped), eVal(zbOpenAll)}
VARIAVEL zBlEnter={|| Zrecn:=recno(),vb_venda("M",,.t.,,,"/ALTERARPN/"), eVal(zbOpenAll)}
VARIAVEL zBlC={|| Zrecn:=recno(),Nfe_ImprimirDanfe(fNum,fNum), eVal(zbOpenAll)}
VARIAVEL zBlD={|| Zrecn:=recno(),Nfe_EnviarNFE(fNum,fNum,.t.,fprenota), eVal(zbOpenAll)}
VARIAVEL zBlE={|| Zrecn:=recno(),Nfe_ConsultarNFE(fNum,fNum), eVal(zbOpenAll)}
VARIAVEL zBlF={|| Zrecn:=recno(),Nfe_CancelarNFE(fNum,fNum), eVal(zbOpenAll)}
VARIAVEL zBlG={|| Zrecn:=recno(),Nfe_InutilizarNFE(fNum,fNum), eVal(zbOpenAll)}
VARIAVEL zBlH={|| Zrecn:=recno(),NFE_AssinarNFe(fNum,fNum), eVal(zbOpenAll)}
VARIAVEL zBlI={|| Zrecn:=recno(),NFE_ValidarNFe(fNum,fNum), eVal(zbOpenAll)}
VARIAVEL zBlJ={|| Zrecn:=recno(),NFE_Email(fNum,fNum), eVal(zbOpenAll)}
VARIAVEL zBlQ={|| Zini:=s_df_ecfid+"\nf"+StrZero(fnum,6)+".ini", __run("notepad "+zini ) }
VARIAVEL zBlS={|| Zrecn:=recno(),Nfe_CmdLote("TXT_SEFAZ",fNum,fNum), DbGoto(Zrecn)}
VARIAVEL zNomeLst = "lst_exec('NFE10A')"
VARIAVEL zBlkPrt = _CreateBlock('zrecn:=recno(),Relat(zNomeLst,"nb"),eVal(zbOpenAll),dbgoto(zrecn)')
VARIAVEL zBlkItem= _CreateBlock('Zrecn:=recno(),w_chave:=sf_pn->fnum,DbCloseAll(),Abra("0NOIDX",r_siga,Se_mov,"SE_MOVNF",seim_f,"mfnum"),Brow_Db("SE_MOVNF",.t.),eVal(zbOpenAll)' )
:TBMT
 13;eVal(zBlEnter);Enter-Altera ;
 65;doget(D_ob);A-Edita ;
 66;eval(zBlB);B-Criar_Assinar_Validar ;
 68;eval(zBlD);D-Enviar_NFE ;
 67;eval(zBlC);C-Imprimir_DANFE ;
 83;eval(zBlS);S-TXT_SEFAZ ; 
 81;eval(zBlQ);Q-Editar_Ini ; 
 80;tb_pesq(D_OB);P-Pesquisa ;
 84;tb_locate(D_oB);T-Trecho ;
 61;doget(D_ob,,.t.);=-Repete_Edicao ;
  7;AcaoNaSelecaoNFE('CANCELAR_PN',.t.,fnumped);DEL-DELeta ;
:TBFI
NF;fnum;N;999999; 6;N;
*;FgDev;C;X; 1;S;
Obs;nfe_xmotiv;C;@S58;10;N;
CFOP;fCodOp;C;XXXXX; 5;S;
DtEmis;fDataEmi;D;; 8;;
CodCli;fCli;N;999999; 6;S;
RazSoc;eVal(zBlkCli,fCli);C;@S25;27;;
nProt;nfe_nprot;C;@15;8;;
Chave;fChaveNfe;C;@S44;44;;
XML;nfe_xml;C;@S75;74;;
Pedido;fNumPed;N;999999;6;S;
