VB_VLCMP;Cadastro de Vales Gas Emitidos;sys_tbbrow; 5; 0;20;79;padrao;;
:SKEL
VARIAVEL zNil := ABRA("0NOIDX",r_siga,"sccrcli","sccrcli")
VARIAVEL zNil := ABRA("0NOIDX",r_siga,se_prod,"Se_prod",seip_c,"pcod",seip_n,"pdesc")
VARIAVEL zNil := DbSelectArea("VB_VLCMP")
VARIAVEL zbCli := {|nCli| if(nCli>0, sccrcli->(DbGoTo(nCli),cr_nome), "") }
VARIAVEL zbGravaSequencia=#TEXTO_FONTE
   Private hReg,zNumIni:=0,zNumFim:=0,zpCod:=0,zaLines:={},zNumVale,zRecn
   aAdd( zaLines, {"2;2;Produto de Referencia:", "@zpCod", @zpCod, "999999", "", "psq_brow;se_prod;pseprod_valegas;N;S;"} )
   aAdd( zaLines, {"4;2;ValeGas Inicial......:", "@zNumIni", @zNumIni, "999999", "", ""} )
   aAdd( zaLines, {"5;2;ValeGas Final........:", "@zNumFim", @zNumFim, "999999", "", "zNumFim>0.and.zNumFim>=zNumIni"} )
   if QuickDialog("vb_vlcmp", "50;7;Cadastrar Vales Gas", zaLines)
      zRecn:=Recno()
      zNumVale := zNumIni-1
      do while ++zNumVale<=zNumFim
         if !vb_vlcmp->(DbSeek( Str(zPcod,6)+str(zNumVale,15) ))
            hReg := hb_hash("PCOD",zPcod, "PEDICAO",zNumVale,  "MDATA",s_datual, "PVLUVEN2", se_prod->PVLUVENDA, "PEATUAL",1 )
            vb_vlcmp->(AppendBlank(), Gather(hReg))
         endif     
      enddo
      DbGoto(zRecn)
      DobRefresh()
   endif
#FIM_TEXTO_FONTE
:TBMT
 22;eVal(zbGravaSequencia);Ins-Inclui ;
 13;DoGet(d_ob);Enter-Altera ;
  7;tb_del(D_ob);DEL-DELeta ;
 80;tb_pesq(D_OB);P-Pesquisa ;
 84;tb_locate(D_oB);T-Busca_Trecho ;
 76;tb_locate(D_oB);L-Busca_Iniciais ;
 67;tb_locate(D_oB);C-Repete_Busca ;
 79;tb_index(D_OB);O-Ordena ;
 70;tb_filter(d_ob);F-Filtra ;
 61;doget(D_ob,,.t.);=-Repete_Edicao ;
:TBFI
ValeGas;pedicao;N;999999;7;N;
Valor;PVLUVEN2;N;99999.99;8;S;
DtCadastro;mdata;D;99.99.99;10;S;
Sit;MfgEs;C;!;3;S;
DtVenda;fDataSai;D;99.99.99;8;S;
Revendedor;eVal(zbCli,fCli);P;@S25;25;N;
DtResgate;fDataCheg;D;99.99.99;8;S;
Cliente Atendido;eVal(zbCli,mCodForc);P;@S25;25;N;
Produto;Pcod;N;999999;6;N;