SCCRDUP;Duplicatas dos Clientes;sys_tbbrow; 5; 0;20;79;sccrdup;;
:SKEL
VARIAVEL w_colsep=" "+chr(179)
VARIAVEL znil=__SetCentury("on")
VARIAVEL zbCli={|nCodCli|sccrcli->(DbGoto(nCodCli),cr_nome)}
VARIAVEL zBlkCta = {|nCta| sx_conta->(dbSeek(nCta), ct_titulo)}

VARIAVEL zRecnBrw := 0
VARIAVEL zArea0 := lTrim(Str(Select(),4))
VARIAVEL zbOpenAll:={||Abra("0NOIDX",R_SIGA,"sccrcli","sccrcli"),Abra_Arq("sccrdup",,zArea0,r_siga), DbSetFilter({||left(cr_num_ped,2)$'/SX/CX/CF/NC/'},"left(cr_num_ped,2)$'/SX/CX/CF/NC/'"),if(zRecnBrw=0, (DbGoTop(),zRecnBrw:=Recno()),DbGoTo(zRecnBrw)) }
variavel zbOpenAll:=#TEXTO_FONTE
    DbCloseAll()
    Abra("0NOIDX",r_siga,"sx_conta","sx_conta","sx_conta","sx_conta")
    Abra("0NOIDX",R_SIGA,"sccrcli","sccrcli")
    if(zFgPeriodo,dbUseArea(.T.,,zFileMem, "sccrdup",.f.,.F.),Abra_Arq("sccrdup",,zArea0,r_siga))
    DbSetFilter({||day(cr_dt_lqd)>0},"day(cr_dt_lqd)>0")
    if(zRecnBrw=0, (DbGoBottom(),DbSkip(-14),zRecnBrw:=Recno()),DbGoTo(zRecnBrw))
#FIM_TEXTO_FONTE
VARIAVEL zbAction := {|bFunction| zRecnBrw:=Recno(), eVal(bFunction), eVal(zbOpenAll), DbGoTo(zRecnBrw), DobRefresh()}
VARIAVEL znil := eVal( zbOpenAll )

VARIAVEL zbRelat := {||Relat('lst_exec("recibo_sccrdup_fr3")',"nb","NaoFecheNaSaida","X")}

VARIAVEL zbCor=" "
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 zBfTodas:={||DbClearFilter(),DbGoTop(),d_ob:Refresh(),d_ob:SetFocus()}

comando saida DbCloseAll()

variavel #TEXTO_FONTE
   //ONINIT
   hwg_TbFi(D_oB, 'Controle;CR_NUM_PED;C;@S11;11;N;')
   hwg_TbFi(D_oB, 'Cli;CR_COD_CLI;N;999999;6;N;')
   if zFgUsaCores
      // cor laranja=33023. Uma definicao de cores pega 4 parametros: {textColor, backColor, textColorSelecionado, backColorSelecionado}
      // Para colocar uma coluna colorida, defina um criterio de cores e adicione no fim da linha a zbCor: hwg_TbFi(D_oB, 'Cod;cr_cod_cli;N;999999;6;N;zbCor;')
      zbCor:={||IF(DAY(cr_dt_lqd)=0,IF(cr_dt_venc<s_datual,{zRed,zW,zW,zRed},if(cr_dt_venc=s_datual,{znAzul0,zW,zW,znAzul0},{zBlack,zW,zW,zBlack})),{zGreen,zW,zW,zGreen})}
      hwg_TbFi(D_oB, 'NomeCli;eVal(zbCli,CR_COD_CLI);P;@S25;25;N;zbCor;')
   ELSE
      hwg_TbFi(D_oB, 'NomeCli;eVal(zbCli,CR_COD_CLI);P;@S25;25;N;;')
   ENDIF
   hwg_TbFi(D_oB, 'TipoDoc;SxNomeFormaPag(CR_TIP_DUP);C;@S8;8;N;')
   hwg_TbFi(D_oB, 'Val Emis;CR_VALOR;N;9999999.99; 10;N;')
   hwg_TbFi(D_oB, 'Dt Emis;CR_DT_EMIS;D;99/99/9999; 10;N;')
   hwg_TbFi(D_oB, 'Dt Venc;CR_DT_VENC;D;99/99/9999; 10;S;')
   if sys_segmento='locacao'
      hwg_TbFi(D_oB, 'Dt Lqd;CR_DT_LQD;D;99/99/9999; 10;S;')
      hwg_TbFi(D_oB, 'Val Lqd;CR_VAL_LQD;N;9999999.99; 10;S;')
   ELSE
      hwg_TbFi(D_oB, 'Dt Lqd;CR_DT_LQD;D;99/99/9999; 10;N;')
      hwg_TbFi(D_oB, 'Val Lqd;CR_VAL_LQD;N;9999999.99; 10;N;')
   endif
   se fieldpos('CR_VALPEND')>0 entao hwg_TbFi(D_oB, 'Qt_Pend;CR_VALPEND;N;9999999.99; 10;S;')
   hwg_TbFi(D_oB, 'Td;CR_TIP_DUP;C;xx;  2;S;')
   hwg_TbFi(D_oB, 'NossoNumBanco;bNossoNum;N;999999999999999;15;S;')
   hwg_TbFi(D_oB, 'Obs;CR_OBS;C;@S30; 30;S;')
   hwg_TbFi(D_oB, 'NumFec;Si_NumFech;N;999999;6;N;')
   hwg_TbFi(D_oB, 'Cxa;Si_Caixa;N;999;3;N;')
   hwg_TbFi(D_oB, 'NumPed;fnumped;N;9999999999;10;N;')
   se fieldpos('fnum')>0 entao hwg_TbFi(D_oB, 'NF;fnum;N;9999999999;10;N;')
   se fieldpos('fnums')>0 entao hwg_TbFi(D_oB, 'NFS;fnums;N;9999999999;10;N;')
   hwg_TbFi(D_oB, 'Dt Chq;CR_DT_DOC;D;99/99/9999; 10;S;')
   hwg_TbFi(D_oB, 'CFOP;CR_CFOP;C;XXXXX;5;N;')
   hwg_TbFi(D_oB, 'ChqCrt;CR_NUM_DOC;N;999999;  6;S;')
   hwg_TbFi(D_oB, 'CtoBco;banco;N;999999;  6;S;')
   hwg_TbFi(D_oB, 'Cx;si_caixa;N;99;  2;N;')
   hwg_TbFi(D_oB, 'L;CR_TIP_LQD;C;x;  1;N;')
   hwg_TbFi(D_oB, 'J;CR_HA_JURO;C;x;  1;N;')
   hwg_TbFi(D_oB, 'Descont;CR_DESCONT;N;9999999.99; 10;N;')
   hwg_TbFi(D_oB, 'Vd;CR_ZONA;C;xx;  2;N;')
   hwg_TbFi(D_oB, 'S;CR_SITUAC;C;x;  1;N;')
   hwg_TbFi(D_oB, 'Pr;CR_LOCAL;C;xx;  2;N;')
   hwg_TbFi(D_oB, 'Dt Ger;CR_DATA;D;;  8;N;')
   hwg_TbFi(D_oB, 'Hora Ger;CR_HORA;C;@S8;  8;N;')
   hwg_TbFi(D_oB, 'Us;CR_USUARIO;N;9;  1;N;')
   //ENDONINIT
#FIM_TEXTO_FONTE
:TBMT
73;eVal(zbAction, zbRelat);I-Imprime;I-Imprime Recibo;impressora.ico;;;;;&I-Imprime;;;
80;tb_pesq(D_OB);P-Pesquisa ;P-Pesquisa na coluna do cursor;pesquisa.ico;;;;;&P-Pesquisa;;;
79;tb_index(D_OB);O-Ordena ;O-Ordena a coluna do cursor;ordenar.ico;;;;;&O-Ordena;;;
84;Eval(zBfTodas);T-Todos;H - Exibe todos os Titulos;sembitmap;;;Lucida Bright;-11;&T-Todos;;6;
13;doget(D_ob);Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;
70;tb_filter(d_ob);F-Filtra ;F-Filtra Cursor;sembitmap;;;Lucida Bright;-11;&F-Filtra;;6;
92;PrtBordero("RTF", , , "carne.rtf");\-Carnes_rtf ;\ - Carnes_rtf;sembitmap;;;Lucida Bright;-11;&\-Carnes_rtf;;6;
47;PrtBordero("RTF", , , "duplicata.rtf" );/-Duplicatas_rtf ;/ - Duplicatas_rtf;sembitmap;;;Lucida Bright;-11;&/-Duplicatas_rtf;;6;
74;PrtBordero("PDF", , , "duplicata.pdf");J-BOLETOS_pdf ;J - BOLETOS_pdf;sembitmap;;;Lucida Bright;-11;&J-BOLETOS_pdf;;6;
72;PrtBordero("HTM", , , "duplicata.htm");H-BOLETOS_Html ;H - BOLETOS_Html;sembitmap;;;Lucida Bright;-11;&H-BOLETOS_Html ;6;