SX_NC;Notas de Credito do Cliente;sys_tbbrow; 3; 0;23;79;padrao;;
:SKEL
VARIAVEL w_colsep = chr(179)
VARIAVEL w_headsep = chr(196)
VARIAVEL zbCli={|nCodCli|sccrcli->(DbGoto(nCodCli),cr_nome)}
VARIAVEL zFgCliClosed := (Select("SCCRCLI")=0)
VARIAVEL znil=sx_nc->(if(zFgCliClosed,Abra_arq("sccrcli"), ""))
VARIAVEL znil=sx_nc->(DbCloseArea(), Abra ("0NOIDX", r_siga, "sx_nc", "sx_nc", "sx_nc", "fcli"))
VARIAVEL znil=(OrdScope(0,m_fcli), OrdScope(1,m_fcli))
VARIAVEL zbCor=" "
comando saida znil=if(zFgCliClosed.and.Select("sccrcli")>0, sccrcli->(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
:TBMT
 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 ;
 70;tb_filter(d_ob);F-Filtra ;