SX_NC;Notas de Credito;sys_tbbrow; 3; 0;23;79;padrao;;
:SKEL
VARIAVEL w_colsep = chr(179)
VARIAVEL w_headsep = chr(196)
VARIAVEL zArea0 := lTrim(Str(Select(),4))
VARIAVEL zRecno0 := SX_NC->(Recno())
VARIAVEL zbOpenAll = #TEXTO_FONTE
      zRecno0 := SX_NC->(Recno())
      DbCloseAll()
      Abra_Arq("SX_NC",,zArea0,r_siga)
      SX_NC->( dbGoTo(zRecno0), ABRA("0NOIDX",r_siga,"SCCRDUP","SCCRDUP","SCCRDUP","STRZERO(CR_COD_CLI,6)+DTOS(CR_DT_EMIS)"), Abra_arq("sccrcli") )
#FIM_TEXTO_FONTE
VARIAVEL zNil=eVal(zbOpenAll)
VARIAVEL zbCli={|nCodCli|sccrcli->(DbGoto(nCodCli),cr_nome)}
VARIAVEL zbCor=" "
comando saida znil=if(Select("sccrcli")>0, sccrcli->(DbCloseArea()), "")
comando saida znil=if(Select("SCCRDUP")>0, SCCRDUP->(DbCloseArea()), "")

VARIAVEL znAzul0:=16711680
VARIAVEL znAzul1:=10027008
VARIAVEL zAzul2:=16776960
VARIAVEL zW:=16777215
VARIAVEL zBlack:=0
VARIAVEL zRed:=255
VARIAVEL zGreen:=32768
VARIAVEL znCinza:=8421504
VARIAVEL zYellow:=65535
VARIAVEL zFgUsaCores:=(xGetEnv("USA_CORES_NO_BROWSE")="S")
variavel #TEXTO_FONTE
   //ONINIT
   if zFgUsaCores
      zbCor:={||IF(CP_VALOR<0,{znAzul0,zW,zW,znAzul0},{zBlack,zW,zW,zBlack})}
      hwg_TbFi(D_oB, 'Cli;FCLI;N;999999;  6;S;zbCor;')
      hwg_TbFi(D_oB, 'NomeCli;eVal(zbCli,FCLI);P;@S25;25;N;zbCor;')
      hwg_TbFi(D_oB, 'DtEmis;CP_DT_EMIS;D;;  8;S;zbCor;')
      hwg_TbFi(D_oB, 'Descricao;MemoLine(cp_desc,25,1);P;@S26;26;N;zbCor;')
      hwg_TbFi(D_oB, 'Valor;Abs(CP_VALOR);P;999999.99; 9;S;zbCor;')
      hwg_TbFi(D_oB, 'TipoDoc;if(cr_tip_dup="PG","ResgateNC",SxNomeFormaPag(CR_TIP_DUP));P;@S9;9;N;zbCor;')
   else
      hwg_TbFi(D_oB, 'Cli;FCLI;N;999999;  6;S;zbCor;')
      hwg_TbFi(D_oB, 'NomeCli;eVal(zbCli,FCLI);P;@S25;25;N;zbCor;')
      hwg_TbFi(D_oB, 'DtEmis;CP_DT_EMIS;D;;  8;S;zbCor;')
      hwg_TbFi(D_oB, 'Descricao;MemoLine(cp_desc,25,1);P;@S26;26;N;zbCor;')
      hwg_TbFi(D_oB, 'Valor;Abs(CP_VALOR);P;999999.99; 9;S;zbCor;')
      hwg_TbFi(D_oB, 'TipoDoc;if(cr_tip_dup="PG","ResgateNC",SxNomeFormaPag(CR_TIP_DUP));P;@S9;9;N;zbCor;')
   endif
   hwg_TbFi(D_oB, 'Pedido;FNUMPED;N;9999999999; 10;;')
   hwg_TbFi(D_oB, 'NfPgto;PFNUM;N;9999999999; 10;;')
   hwg_TbFi(D_oB, 'DtVenc;CP_DT_VENC;D;;  8;;')
   hwg_TbFi(D_oB, 'DtLqtd;CP_DT_LQD;D;;  8;;')
   //ENDONINIT
#FIM_TEXTO_FONTE
// 82;eVal(zbAction,{||tb_insert(D_OB,"SX_NC_RESGATE")});R-Resgata ;
:TBMT
 22;eVal(zbAction,{||(xGetEnv("LANCA_NC_AVULSAS_NO_CHECKOUT")<>"S".or.vb_caixa("CaixaAberto?")).and.tb_insert(D_OB).and.(DbGoBottom(),DobRefresh())});Ins-Inclui ;
 65;tb_update(D_OB);A-Altera ;
  7;tb_del(D_ob);DEL-DELeta ;
 13;doget(D_ob);Enter-Edita ;
 32;tb_cons();Barra-Exibe ;
 73;PrtFormRtf(if(CP_VALOR<0,"notacredito_resgate.rtf","notacredito.rtf") );I-Imprime ;
 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 ;