SCCPPED;Titulos a Pagar;sys_tbbrow; 8; 0;20;79;sccpped;;
:SKEL
VARIAVEL zRecnBrw := 0
VARIAVEL zArea0 := lTrim(Str(Select(),4))

variavel zbOpenAll:=#TEXTO_FONTE
    DbCloseAll()
    Abra("0NOIDX",R_SIGA,"sccpfor","sccpfor")
    Abra("0NOIDX",r_siga,"sx_conta","sx_conta","sx_conta","sx_conta")
    Abra("0NOIDX",R_SIGA,"CP_DIVIS","CP_DIVIS","CP_DIVIS","CP_DIVISAO")
    Abra("0NOIDX",r_siga,"cp_subd","cp_subd","cp_subd","cp_subdiv")
    if(zFgPeriodo,dbUseArea(.T.,,zFileMem, "sccpped",.f.,.F.),Abra_Arq("sccpped",,zArea0,r_siga))
    DbSetFilter({||day(cp_dt_lqd)>0},"day(cp_dt_lqd)>0")
    if(zRecnBrw=0, (DbGoBottom(),DbSkip(-14),zRecnBrw:=Recno()),DbGoTo(zRecnBrw))
#FIM_TEXTO_FONTE

VARIAVEL znil := eVal( zbOpenAll )
VARIAVEL zbAction := {|bFunction| zRecnBrw:=Recno(), eVal(bFunction), eVal(zbOpenAll), DbGoTo(zRecnBrw), DobRefresh()}
VARIAVEL zBlkCta := {|nCta| sx_conta->(dbSeek(nCta), ct_titulo)}

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

variavel zbIsGed := {|nCodFor,dDtEmis,nRecno| Ged_Files("pgto","RECIBOPGTO",nCodFor,dDtEmis,nRecno) }
variavel zbGetGed := {|nCodFor,dDtEmis,nRecno| Ged_Digitaliza("pgto","RECIBOPGTO",nCodFor,dDtEmis,nRecno),sFgDebugalert:=.f.,d_ob:Refresh(),.t.}
variavel zbAlteraGed := {|nCodFor,dDtEmis,nRecno| Ged_Digitaliza("pgto","ZOOM"+"RECIBOPGTO",nCodFor,dDtEmis,nRecno)}
variavel zbShowGed:={|nCodFor,dDtEmis,nRecno| Ged_ShowJpg("pgto","RECIBOPGTO",nCodFor,dDtEmis,nRecno)}

variavel zbDigitalizaOuAltera := {|nCodFor,dDtEmis,nRecno|sFgDebugalert:=.t., if( Ged_Files("pgto","RECIBOPGTO",nCodFor,dDtEmis,nRecno), Ged_Digitaliza("pgto","ZOOM"+"RECIBOPGTO",nCodFor,dDtEmis,nRecno), Ged_Digitaliza("pgto","RECIBOPGTO",nCodFor,dDtEmis,nRecno)) ,sFgDebugalert:=.f.,d_ob:Refresh(),.t.}

variavel #TEXTO_FONTE
   //ONINIT
         hwg_TbFi(@D_oB,'*;Left(CP_NUM_PED,2);P;XX;2;N;')
         hwg_TbFi(@D_oB,'Dt Lqd;CP_DT_LQD;D;;8;S;')
         hwg_TbFi(@D_oB,'Val Lqd;CP_VAL_LQD;N;9999999.99; 10;S;')
         hwg_TbFi(@D_oB,'Comentario;CP_DESC;C;@s24;24;S;')
         hwg_TbFi(@D_oB,'CodForn;CP_COD_FOR;N;99999;5;N;')
         hwg_TbFi(@D_oB,'Nome/RazSoc;sccpfor->(DbGoTo(sccpped->cp_cod_for),if(empty(cp_fantasi),cp_nome,cp_fantasi));P;@s10; 10;N;')
         hwg_TbFi(@D_oB,'Div;CP_DIVISAO;N;999;3;S;')
         hwg_TbFi(@D_oB,'C.Custo;cp_divis->(DbGoTo(sccpped->cp_divisao),Desc);P;@S15;15;N;')
         hwg_TbFi(@D_oB,'SubDiv;CP_SUBDIV;C;99999;5;S;')
         hwg_TbFi(@D_oB,'Descricao;cp_subd->(if(DbSeek(sccpped->cp_subdiv),Desc,"Diversos"));P;@S15;15;N;')
         hwg_TbFi(@D_oB,'Conta;sx_conta;N;999;5;S;')
         hwg_TbFi(@D_oB,'Nome Cta;eval(zBlkCta,sx_conta);P;@s12; 12;N;')
         if xGetEnv("GED_DIGITALIZA_PAGAMENTOS")="S"
            hwg_TbFi(@D_oB,'Digitalizado?;if( eVal(zbIsGed,cp_cod_for,cp_dt_emis, if(fieldpos("recno")>0.and.recno>0,recno,recno()) ), "DIGITALIZADO", "NAO_DIGITALIZADO");P;@S16;16;N;') 
         endif
         hwg_TbFi(@D_oB,'Dt Emis;CP_DT_EMIS;D;;8;S;')
         hwg_TbFi(@D_oB,'Valor;CP_VALOR;N;99999.99;8;S;')
         hwg_TbFi(@D_oB,'Dt Venc;CP_DT_VENC;D;;8;S;')
         hwg_TbFi(@D_oB,'Cod Ped;CP_NUM_PED;C;xxxxxxxxxx; 10;N;')
         hwg_TbFi(@D_oB,'Duplic;CP_DUPLIC;C;xxxxxxxxxx; 10;N;')
         hwg_TbFi(@D_oB,'Gr;Grupo;N;9;1;S;')
         hwg_TbFi(@D_oB,'Tl;CP_TIP_LQD;C;x;2;N;')
         hwg_TbFi(@D_oB,'Prt;CP_LOCAL;N;999;3;N;')
         hwg_TbFi(@D_oB,'S;CP_SITUACA;N;1;1;N;')
         hwg_TbFi(@D_oB,'Acesso;rec_del();N;;7;N;')
         hwg_TbFi(@D_oB,'fc;SI_CAIXA;N;99; 2;S;')
         hwg_TbFi(@D_oB,'Di;CP_DIVISAO;N;99;2;S;')
   //ENDONINIT
   //ONDLGINIT
         oDlg:Maximize()
   //ENDDLGINIT
#FIM_TEXTO_FONTE

VARIAVEL zbClose:={|cAlias| Select(cAlias)>0 .and. ( (cAlias)->(DbCloseArea()), .t.) }
COMANDO SAIDA znil = ( eVal(zbClose,'Cp_Divis'), eVal(zbClose,'Cp_SubD'), eVal(zbClose,'SccpFor'), eVal(zbClose,'sccpfor'), eVal(zbClose,'sx_conta') )
:TBMT
13;doget(D_ob);Enter-Edita ;
32,xGetEnv("GED_DIGITALIZA_PAGAMENTOS")="S";eVal(zbDigitalizaOuAltera,cp_cod_for,cp_dt_emis, if(fieldpos("recno")>0.and.Recno>0,Recno,RecNo()) );Enter-Digitaliza ;Enter - Digitaliza recibo de Pagamento;scanner.ico;;;;;&Digitaliza;;;
79;tb_index(D_ob);O-Ordena ;
80;tb_pesq(D_OB);P-Pesquisa ;
73;eVal(zbAction, zbRelat);I-Imprime ;
84;tb_locate(D_oB);T-Busca_Trecho ;
67;tb_locate(D_oB);C-Repete_Busca ;
70;tb_filter(d_ob);F-Filtra ;
61;doget(D_ob,,.t.);=-Repete_Edicao ;
