CT_BRD;Lancamentos de Borderos;sys_tbbrow; 3; 0;23;79;padrao;;
:SKEL
VARIAVEL w_colsep = chr(179)
VARIAVEL w_headsep = chr(196)
VARIAVEL zwFgExibindoRetornos:=.t.
VARIAVEL zbRetornos = #TEXTO_FONTE
      hwg_TbFi(@D_oB, 'Nome_Pagador;RET_SACADO;C;@S40; 40;;')
      hwg_TbFi(@D_oB, 'CmdRet;RET_CMD;C;xx;6;;')
      hwg_TbFi(@D_oB, 'DtCredRet;RET_DTCRED;D;; 10;;')
      hwg_TbFi(@D_oB, 'ValorLiq;RET_VLCRED;N;999999999.99;12;;')
      hwg_TbFi(@D_oB, 'Bco;RET_BCOREC;N;999;3;;')
      hwg_TbFi(@D_oB, 'BcoNossoNum;BNOSSONUM;N;999999999999999;15;;')
      hwg_TbFi(@D_oB, 'IdCxa;Sx_Acesso;N;999999;6;;')
      hwg_TbFi(@D_oB, 'IdDup;nRecno;N;999999;6;;')
      hwg_TbFi(@D_oB, 'DtVencRet;RET_DTVENC;D;; 10;;')
      hwg_TbFi(@D_oB, 'Valor;RET_VALOR;N;999999999.99;12;;')
      hwg_TbFi(@D_oB, 'Tarifa;RET_TARIFA;N;999.99; 6;;')
      hwg_TbFi(@D_oB, 'Encargos;RET_ENCARG;N;9999999.99;10;;')
      hwg_TbFi(@D_oB, 'IOF;RET_IOF;N;999999.99; 9;;')
      hwg_TbFi(@D_oB, 'CnpjCpf_Pag;RET_CNPJ;C;@S15; 15;;')
      hwg_TbFi(@D_oB, 'CmdEnv;ENV_CMD;C;xx;6;;')
      hwg_TbFi(@D_oB, 'CodObs;RET_OBS;C;xx;6;;')
      hwg_TbFi(@D_oB, 'Ok?;RET_IsOk;C;xx;6;;')
      hwg_TbFi(@D_oB, 'AgRec;RET_AG;N;99999;5;;')
      hwg_TbFi(@D_oB, 'Brd;BORDERO;N;999999;6;;')
      hwg_TbFi(@D_oB, 'Data;DATA;D;;8;;')
      hwg_TbFi(@D_oB, 'Pt;PORTADOR;N;99;2;;')
      hwg_TbFi(@D_oB, 'CodCli;CR_COD_CLI;N;999999;6;;')
      hwg_TbFi(@D_oB, 'NumDup;CR_NUM_PED;C;@S10; 10;;')
      hwg_TbFi(@D_oB, 'Valor;CR_VALOR;N;999999999.99; 14;;')
      hwg_TbFi(@D_oB, 'DtVenc;CR_DT_VENC;D;;8;;')
      hwg_TbFi(@D_oB, 'TRANS;TRANS;C;x;1;;')
      hwg_TbFi(@D_oB, 'NRECNO;NRECNO;N;99999999;8;;')
      hwg_TbFi(@D_oB, 'FNUMPED;FNUMPED;N;9999999999; 10;;')
      hwg_TbFi(@D_oB, 'Multa;BMULTAAUTO;N;99.99;7;;')
      hwg_TbFi(@D_oB, 'Juros;BJUROSMES;N;99.99;7;;')
      hwg_TbFi(@D_oB, 'Instrucoes;BINSTRUCOE;M;9Memo]; 10;;')
      hwg_TbFi(@D_oB, 'Db;BDIASBAIXA;N;99;2;;')
      hwg_TbFi(@D_oB, 'Dp;BDIASPROT;N;99;2;;')
      hwg_TbFi(@D_oB, 'Tarifa;TARIFA;N;99.99;7;;')
      hwg_TbFi(@D_oB, '%Enc;if(RET_VALOR>0,100*(RET_TARIFA+RET_ENCARG+RET_IOF)/RET_VALOR,0);P;999.99;6;;')
#FIM_TEXTO_FONTE
VARIAVEL zbLancBord = #TEXTO_FONTE
      hwg_TbFi(@D_oB, 'Bord;BORDERO;N;999999;  6;;')
      hwg_TbFi(@D_oB, 'Data;DATA;D;;  8;;')
      hwg_TbFi(@D_oB, 'Prt;PORTADOR;N;99;  3;;')
      hwg_TbFi(@D_oB, 'CodCli;CR_COD_CLI;N;999999;  6;;')
      hwg_TbFi(@D_oB, 'Titulo;CR_NUM_PED;C;@S10; 10;;')
      hwg_TbFi(@D_oB, 'Valor;CR_VALOR;N;999999999.99; 14;;')
      hwg_TbFi(@D_oB, 'Dt_Venc;CR_DT_VENC;D;;  8;;')
      hwg_TbFi(@D_oB, 't;TRANS;C;x;  1;;')
      hwg_TbFi(@D_oB, 'NossoNumBco;BNOSSONUM;N;999999999999999;15;;')
      hwg_TbFi(@D_oB, 'IdCxa;Sx_Acesso;N;999999;6;;')
      hwg_TbFi(@D_oB, 'IdDup;nRecno;N;999999;6;;')
      hwg_TbFi(@D_oB, 'Controle;FNUMPED;N;9999999999; 10;;')
      hwg_TbFi(@D_oB, '%TxMult;BMULTAAUTO;N;99.99;  7;;')
      hwg_TbFi(@D_oB, '%TxJur;BJUROSMES;N;99.99;  7;;')
      hwg_TbFi(@D_oB, 'Instrucoes;BINSTRUCOE;M;9Memo]; 10;;')
      hwg_TbFi(@D_oB, 'db;BDIASBAIXA;N;99;  2;;')
      hwg_TbFi(@D_oB, 'dp;BDIASPROT;N;99;  2;;')
#FIM_TEXTO_FONTE

VARIAVEL zbTrocaColunas = #TEXTO_FONTE
   Private zTotCols:=if(sGuiMode, Len(d_ob:aColumns), d_ob:colCount )
   do while .t.
      if if(sGuiMode, Len(d_ob:aColumns), d_ob:colCount ) = 0
         exit
      endif   
      d_ob:DelColumn( 1 )
   enddo
   if zwFgExibindoRetornos
      dbSetFilter({||cr_num_ped<>"   "},'cr_num_ped<>"   "')
      DbGoTop()
      eVal(zbLancBord)
      zwFgExibindoRetornos:=.f.
   else
      DbClearFilter()
      dbSetFilter({||RET_CMD<>"  "},'RET_CMD<>"  "')
      DbGoTop()
      eVal(zbRetornos)
      zwFgExibindoRetornos:=.t.
   endif
   DobRefresh()
#FIM_TEXTO_FONTE

variavel #TEXTO_FONTE
   //ONINIT
      eVal(zbRetornos)
   //ENDONINIT
   //ONDLGINIT
      oDlg:Maximize()
   //ENDDLGINIT
#FIM_TEXTO_FONTE

:TBMT
 13;eval(zbTrocaColunas);Enter-Troca ;
  7;tb_del(d_ob);Del-Apaga ;
 65;tb_update(D_OB);A-Altera ;
 80;tb_pesq(D_OB);P-Pesquisa Chave;
 70;tb_filter(d_ob);F-Filtra ;
 84;tb_locate(D_oB);T-Busca_Trecho ;
 76;tb_locate(D_oB);L-Busca_Iniciais ;
 67;tb_locate(D_oB);C-Repete_Busca ;
 82;doget(D_ob,,.t.);R-Repete_Edicao ;
 79;tb_index(D_OB);O-Ordena ;
 73;eval(zbAction,{||lst_alias(D_OB)});I-Imprime ;
 61;doget(D_ob,,.t.);=-Repete_Edicao ;