SCCRDUP;Compras do Cliente;sys_tbbrow; 3;1;16;79;psccrdup;;
:SKEL
VARIAVEL w_colsep = chr(179)
VARIAVEL w_headsep = chr(196)
VARIAVEL zAreaOrig = Select()
VARIAVEL #TEXTO_FONTE
   SccrDup->(DbCloseArea(), Abra ("0NOIDX", r_siga, "SCCRDUP", "SCCRDUP", "SCCRDUP", "STRZERO(CR_COD_CLI,6)+DTOS(CR_DT_EMIS)") )
   OrdScope(0, StrZero(m_fcli,6) )
   OrdScope(1, StrZero(m_fcli,6) )
   __SetCentury("on")
#FIM_TEXTO_FONTE
VARIAVEL zbSoAbertas = {|| m_fcli=cr_cod_cli.and.!left(Cr_num_ped,2)$"/CX/CZ/".and.DAY(CR_DT_LQD)=0 }
VARIAVEL zbTodas = {|| m_fcli=cr_cod_cli.and.!left(Cr_num_ped,2)$"/CX/CZ/"}
VARIAVEL zbFiltraAbertas = {|| DbSetFilter(zbSoAbertas, "m_fcli=cr_cod_cli"), if(sGuiMode, d_ob:Top(), D_oB:goTop())}
VARIAVEL zbFiltraTodas = {|| DbSetFilter(zbTodas, "m_fcli=cr_cod_cli"), if(sGuiMode, d_ob:top(), D_oB:goTop()) }
VARIAVEL znil = DbSetFilter(zbSoAbertas, "m_fcli=cr_cod_cli")
VARIAVEL znil = dbGoTop()
COMANDO SAIDA SccrDup->(DbCloseArea(), Abra(lTrim(Str(zAreaOrig,3))+"NOIDX",r_siga,"SCCRDUP","SCCRDUP","SCRID_ND","CR_NUM_PED") )
COMANDO SAIDA DbSelectArea( zAreaOrig ) 
:TBMT
 13;psq_enter();Enter-Confirma ;
 80;tb_pesq(d_ob);P-Pesquisa ;
 22;tb_insert(D_OB);Ins-Inclui ;
 84;tb_locate(D_oB);T-Trecho ; 
 32;DoGet(D_oB);Barra-Edita ;
 47;eVal(zbFiltraTodas);/-Todas ;
 65;eVal(zbFiltraAbertas);A-Abertas ;
:TBFI
Cupom;cr_num_ped;C;999999xx;  8;N;
Vd;cr_zona;C;99;  2;N;
Emissao;cr_dt_emis;D;; 10;N;
Valor;cr_Valor;N;@E 999,999.99; 10;N;
Vencto;cr_dt_venc;D;; 10;N;
Val Lqd/Ad;cr_Val_lqd;N;@E 999,999.99; 10;S;
Dt Lqd;cr_dt_lqd;D;; 10;S;
Hora;cr_hora;C;99:99;5;N;
Obs;cr_obs;C;@s25;25;S;
DtAlter;cr_data;D;;10;N;
HrAlter;cr_hora;C;xxxxx;5;N;
Usuario;cr_usuario;C;@s8;8;N;
