<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{126,117,1417,598}</property>
    <property name="Name">[sccrcli.scr]</property>
    <property name="Caption">[Controle de Locacoes]</property>
    <property name="AlwaysOnTop">.F.</property>
    <property name="AutoCenter">.T.</property>
    <property name="Font">
      <font name="Verdana" width="0" height="-13" weight="400"/>
    </property>
    <property name="FormType">[dlgModal]</property>
    <property name="Modal">.F.</property>
    <property name="ScopeVarObj">[Private]</property>
    <property name="lClipper">.T.</property>
    <property name="lExitOnEnter">.F.</property>
    <property name="lExitOnESC">.T.</property>
    <property name="FromStyle">[Center]</property>
    <property name="Clipsiblings">.F.</property>
    <property name="Clipchildren">.F.</property>
    <property name="TitleBar">.T.</property>
    <property name="StyleBorder">[3 - Sizable (Default)]</property>
    <property name="nBackColor">14215660</property>
    <property name="Icon">[]</property>
    <property name="Bitmap">[icon\tela.jpg]</property>
    <property name="NoIcon">.F.</property>
    <property name="SystemMenu">.T.</property>
    <property name="Minimizebox">.F.</property>
    <property name="Maximizebox">.T.</property>
    <property name="AbsAlignment">.T.</property>
    <property name="WindowState">[1 - Normal (Default)]</property>
    <property name="minHeight">-1</property>
    <property name="maxHeight">-1</property>
    <property name="minWidth">-1</property>
    <property name="maxWidth">-1</property>
    <property name="ScrollBars">[0 - None (Default)]</property>
    <property name="DSControl">.F.</property>
  </style>
  <method name="onDlgInit">
    <![CDATA[PARAMETERS oDlg
 
//skel VARIAVEL w_colsep = " "+chr(179)
//skel VARIAVEL zRecnBrw = 0
//skel VARIAVEL Z_Sele = 0
//skel VARIAVEL zSelCli = '0'
//skel VARIAVEL zbCloseAll = {||SCCRCLI->(zRecnBrw:=Recno(), zSelCli:=lTrim(Str(Select(),3))), DbCloseAll() }
//skel VARIAVEL zbReopenCli = {||Abra_Arq('SCCRCLI',,zSelCli,r_siga), DbGoto(zRecnBrw), if(sGuiMode,d_ob:Refresh(),) }
//skel VARIAVEL zbCloseDup  = {||if(Select("SccrDup")>0,SccrDup->(DbCloseArea()),"")}
//skel VARIAVEL zbPrtOs = {||Relat('lst_exec("OSOT")','nb','NaoFecheTabelasNaSaida')}
//skel VARIAVEL zBlkPrd = {|nPcod| se_prod->(dbseek(nPcod)), se_prod->pdesc }

//skel VARIAVEL z_BlkR := {||Z_Sele:=Select(),Abra_arq("hc_retdi"),DbGet("HC_RETDI",1,.t.,.f.,"HC_RECTV"),hc_retdi->(DbCloseArea()),DbSelectArea(z_sele)}

//skel variavel ztEmi=0
//skel variavel ztVc=0
//skel variavel ztAv=0
//skel VARIAVEL ztAvHoje=0
//skel 
//skel VARIAVEL zbCor0 = ""
//skel VARIAVEL zbCor = ""
//skel VARIAVEL zbCor2 = ""
//skel VARIAVEL znAzul0:=16711680
//skel VARIAVEL znAzul1:=10027008
//skel VARIAVEL zAzul2:=16776960
//skel VARIAVEL zWhite:=16777215
//skel VARIAVEL zBlack:=0
//skel VARIAVEL zRed:=255
//skel VARIAVEL zGreen:=32768
//skel VARIAVEL znCinza:=8421504
//skel VARIAVEL zYellow:=65535
//skel 
//skel VARIAVEL zCorVc := {zRed,zWhite,zWhite,zRed}
//skel VARIAVEL zCorHoje:= {znAzul0,zWhite,zWhite,znAzul0}
//skel VARIAVEL zCorAv:= {8388736,zWhite,zWhite,8388736}
//skel VARIAVEL zCorQtOk:={zGreen,zWhite,zWhite,zGreen}
//skel 
//skel variavel z_BlkF9 = #TEXTO_FONTE
//skel    Private zSele:=Select(), zCodTb:=cr_tabela, zTabFile:='VB_PR'+StrZero(zCodTb,2)+if(cr_TabGp='S','G','P'), zTbBrow:='SE_PROM'+if(cr_TabGp='S','G','P')
//skel    if xFile(R_siga+zTabFile-".dbf")
//skel       Abra("0",R_SIGA,zTabFile,"SE_PROM",zTabFile,if(cr_TabGp="S","GRUPO","PCOD"))
//skel       Brow_Db(zTbBrow,.t.)
//skel       Se_prom->(DbCloseArea())
//skel    else
//skel       Alert("Tabela Inexistente...Crie-a pela Opcao Precos Promocionais do Estoque...")
//skel    endif
//skel    DbSelectArea(zSele)
//skel #FIM_TEXTO_FONTE
//skel 
//skel variavel zBlkDelete = #TEXTO_FONTE
//skel    if Alert( "Confirma cancelar ficha do cliente ("+Str(SccrCli->Cr_Cod_Cli,6)+") "+AllTrim(SccrCli->Cr_Nome)+" ?",{"1.Sim","2.Nao"},"B/W")=1
//skel       DebCli(SccrCli->Cr_Cod_Cli,,,@ztEmi)
//skel       if ztEmi=0
//skel          SccrCli->(Tb_Del(W_dOb))
//skel       else
//skel          Alert("O Cliente "+AllTrim(SccrCli->Cr_Nome)+" NAO PODE SER CANCELADO pois possui Emissoes...")
//skel       endif
//skel    endif
//skel #FIM_TEXTO_FONTE
//skel 
//skel variavel zBlkCompras = #TEXTO_FONTE
//skel    Private m_fcli:=if(Cr_Cod_Cli=0,Recno(),Cr_Cod_Cli)
//skel    DebCli(m_fcli,.t.,,@ztEmi,@ztVc,@ztAv,,.t.)
//skel    if ztEmi=0
//skel       Alert("O Cliente ("+Str(SccrCli->Cr_Cod_Cli,6)+") "+AllTrim(SccrCli->Cr_Nome)+" nao possui Emissoes no Cadastro de Duplicatas...",,"R/W")
//skel    else
//skel       ABRA("0NOIDX", r_siga, "sf_vend", "sf_vend")
//skel       DbSelectArea("_duplcli")
//skel       dbCreateIndex( "_duplcli", 'if(day(cr_dt_lqd)=0,"0","1")+Str(99999999-Val(Dtos(Cr_Dt_Lqd)))', {||if(day(cr_dt_lqd)=0,"0","1")+Str(99999999-Val(Dtos(Cr_Dt_Lqd)))} )
//skel       __SetCentury("off")
//skel       DbSetFilter({||!(left(cr_num_ped,2)$'/CX/CZ/').or.day(Cr_Dt_Lqd)=0},"!cr_num_ped")
//skel       DbGoTop()
//skel       Brow_Db("SCCRDUP_CLI1",.t.)
//skel       SccrDup->( GatherDbChanges("_duplcli", "NRECNO") )
//skel       _duplcli->(DbCloseArea())
//skel       DbDrop("mem:_crdup")
//skel       sf_vend->(DbCloseArea())
//skel       DbSelectArea("SccrCli")
//skel    endif
//skel #FIM_TEXTO_FONTE
//skel  
//skel comando saida if( Select("Sccrdup")>0, SccrDup->(DbCloseArea()), "")
//skel 
//skel VARIAVEL m_fcli:=0
//skel VARIAVEL m_fNumPed:=0
//skel VARIAVEL m_PDIASLOCA:=0
//skel VARIAVEL m_fdataemi:=ctod('')
//skel VARIAVEL m_fval:=0
//skel VARIAVEL m_fValLoca:=0
//skel VARIAVEL zBlPrtContrato:={||zRecnBrw:=Recno(), m_fcli:=cr_cod_cli, PrtFormRtf("locacao_autforn","doc",.f.), eVal(zBOpenAll) } 

d_ob:lEditable = .t.

oContextMenu:=Hwg_ContextMenu()
hwg_Btn(oToolbar,5,5,64,64)
hwg_TbMt(oToolbar,'65;tb_update(D_OB,"sccrcli");A-Altera ;A-Altera Ficha Cadastral do Cliente;alterar.ico;;;;;&A-Ficha_Cli;;;')
hwg_TbMt(oToolbar,'80;tb_pesq(D_OB);P-Pesquisa ;P-Pesquisa na coluna do cursor;pesquisa.ico;;;;;&P-Pesquisa;;;')
hwg_TbMt(oToolbar,'79;tb_index(D_oB);O-Ordena ;O-Ordena a coluna do cursor;ordenar.ico;;;;;&O-Ordena;;;')
// hwg_TbMt(oToolbar,' 71;eVal(zbPrtExtrato);E-Extrato;E-Lista posicao dos pedidos do cliente;impressora.ico;;;;;&E-Extrato;;;')
hwg_TbMt(oToolbar,'71;EVAL(z_BlkR);R-Add_Sol;R-Registra Solicitacao do Cliente;televendas.ico;;;Lucida Bright;-11;&R-Add_Sol;;;')
hwg_TbMt(oToolbar,'71;StartLocacao("exiba_solicitacoes_do_cliente");S-Solicitacoes;S-Exibe Solicitacoes do Cliente;clientes.ico;;;Lucida Bright;-11;&S-Solicitacoes;;;')
hwg_Btn(oToolbar)
hwg_Btn(oToolbar)
hwg_TbMt(oToolbar,'71;StartLocacao("fatura");F-Fatura;F-Gera Fatura de Locacao Referente aos Aditivos do mes;receber.ico;;;Lucida Bright;-11;&F-Fat_Loc;;;')
hwg_Btn(oToolbar,10,544,70,24)
hwg_TbMt(oToolbar,'13;doget(D_ob);Enter-EditCol;Enter - Altera o campo da Coluna Selecionada;sembitmap;;;Lucida Bright;-11;EditCol;;6;')

IF wAptoOuMesas<>"criar_ordem_devolucao" .and. wAptoOuMesas<>"faturamento_de_periodo"
   hwg_TbMt(oToolbar,'47;eVal(zbCloseDup),PrtBordero("RTF", , , "duplicata.rtf", cr_cod_cli );/-Duplicatas_rtf ;/ - Duplicatas_rtf;sembitmap;;;Lucida Bright;-11;&/-Duplicatas_rtf;;6;')
   hwg_TbMt(oToolbar,'92;eVal(zbCloseDup),PrtBordero("RTF", , , "carne.rtf",     cr_cod_cli );\-Carnes_rtf ;\ - Carnes_rtf;sembitmap;;;Lucida Bright;-11;&\-Carnes_rtf;;6;')
   hwg_TbMt(oToolbar,'74;eVal(zbCloseDup),PrtBordero("PDF", , , "duplicata.pdf", cr_cod_cli );J-BOLETOS_pdf ;J - BOLETOS_pdf;sembitmap;;;Lucida Bright;-11;&J-BOLETOS_pdf;;6;')
   hwg_TbMt(oToolbar,'75;eVal(zbCloseDup),PrtBordero("HTM", , , "duplicata.htm", cr_cod_cli );K-BOLETOS_htm ;K - BOLETOS_htm;sembitmap;;;Lucida Bright;-11;&K-BOLETOS_htm;;6;')
endif

hwg_TbMt(oToolbar,' 69;eVal(zBlkCompras);E-Ext_Dups ;E - Extrato de Duplicatas emitidas para o cliente;sembitmap;;;Lucida Bright;-11;&E-Ext_Dups;;6;')
hwg_TbMt(oToolbar,'71;StartLocacao("extrato");E-Ext_Loc;E-Extrato das Locacoes do cliente;sembitmap;;;Lucida Bright;-11;&E-Ext_Loc;;6;')
   hwg_TbMt(oToolbar,'71;StartLocacao("exiba_faturas_de_servico_do_cliente");F-Fat_Cli;S-Exibe Faturas de Cobranca de Servicos de Locacao do Cliente selecionado;sembitmap;;;Lucida Bright;-11;&S-Fat_Cli;;6;')
   // hwg_TbMt(oToolbar,'71;StartLocacao("all_fatura");F-Fat_All;F-Gera Todas as Faturas de Locacao Referente aos Aditivos do mes;sembitmap;;;Lucida Bright;-11;&F-Fat_All;;6;')
hwg_Btn(oToolbar,,,110,24)
hwg_TbMt(oToolbar,' 76;eVal({||cr_RecFx->(DbClearFilter(),oBrwAdit:Refresh())});L-Adit.Devolvidos;L-Exibe todos os Aditivos, inclusive os ja devolvidos;sembitmap;;;Lucida Bright;-11;&L-Adit.Devolvidos;;6;')

//hwg_TbMt(oToolbar,"71;StartLocacao('fatura');F-Fatura;F-Gera Fatura de Locacao Referente aos Aditivos do mes;impressora.ico;;;;;&F-Fatura;;;")
//hwg_TbMt(oToolbar,"71;StartLocacao('all_fatura');F-FaturaTodas;F-Gera Todas as Faturas de Locacao Referente aos Aditivos do mes;impressora.ico;;;;;&F-FaturaTodas;;;")

SetDlgKey(oDlg,8,26,{|| (aBrowses[nBrwAtivo,2])->(moveRec(aBrowses[nBrwAtivo,1],"UP"))})
SetDlgKey(oDlg,8,28,{|| (aBrowses[nBrwAtivo,2])->(moveRec(aBrowses[nBrwAtivo,1],"DOWN"))})
Hwg_EndMenu()

oBrwObras:Refresh()
oBrwAdit:Refresh()
oBrwItens:Refresh()
oBrwFat:Refresh()

Ged_ShowJpg('locacao','CONTRATO',sccrcli->cr_cgc)
Ged_ShowJpg('locacao','ADITIVO',sccrcli->cr_cgc, if(sccrcli->cr_cod_cli=cr_recfx->cr_cod_Cli,cr_recfx->fnum,0) )
IF sf_fatnf->FgDev="E".and.sccrcli->cr_cod_cli=cr_recfx->cr_cod_Cli.and.sf_fatnf->fCli=sccrcli->cr_cod_cli
   oJpgRECIBODEV:Show()
   oBtnReciboDev:Show()
   Ged_ShowJpg('locacao','RECIBODEV',sccrcli->cr_cgc,sf_fatnf->fnum,sf_fatnf->fprenota)
ELSE
   oJpgRECIBODEV:Hide()
   oBtnReciboDev:Hide()
ENDIF]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <part class="status">
    <style>
      <property name="Geometry">{0,568,1417,30}</property>
      <property name="Name">[oDlgStatusBar]</property>
      <property name="aParts">{608,152,0}</property>
    </style>
  </part>
  <part class="bitmap">
    <style>
      <property name="Geometry">{1278,146,126,98}</property>
      <property name="Name">[oJpgContrato]</property>
      <property name="Anchor">9</property>
      <property name="Bitmap">[icon\sem_contrato.jpg]</property>
      <property name="ToolTip">
[Clique para digitalizar Contrato de Autorizacao de Fornecimento]      </property>
    </style>
    <method name="onClick">
      <![CDATA[Ged_Digitaliza('locacao','CONTRATO',sccrcli->cr_cgc)]]>
    </method>
    <method name="onInit">
      <![CDATA[Ged_ShowJpg('locacao','CONTRATO',sccrcli->cr_cgc)]]>
    </method>
  </part>
  <part class="bitmap">
    <style>
      <property name="Geometry">{1276,334,108,77}</property>
      <property name="Name">[oJpgAditivo]</property>
      <property name="Anchor">6</property>
      <property name="Bitmap">[icon\sem_aditivo.jpg]</property>
      <property name="ToolTip">
[Clique para Digitalizar Aditivo / Comprovante de Recebimento]      </property>
    </style>
    <method name="onClick">
      <![CDATA[Ged_Digitaliza('locacao','ADITIVO',sccrcli->cr_cgc,cr_recfx->fnum)]]>
    </method>
  </part>
  <part class="bitmap">
    <style>
      <property name="Geometry">{1276,457,108,77}</property>
      <property name="Name">[oJpgRECIBODEV]</property>
      <property name="Anchor">6</property>
      <property name="Bitmap">[icon\sem_aditivo.jpg]</property>
      <property name="ToolTip">
[Clique para Digitalizar Aditivo / Comprovante de Recebimento]      </property>
    </style>
    <method name="onClick">
      <![CDATA[IF sf_fatnf->FgDev="E"
   Ged_Digitaliza('locacao','RECIBODEV',sccrcli->cr_cgc,sf_fatnf->fnum, sf_fatnf->fprenota)
ELSE
   ALERT("Essa opcao deve ser usada para digitalizar os comprovantes de Devolucao!;Selecione uma operacao de devolucao com o cursor")
ENDIF]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{11,82,1000,222}</property>
      <property name="Name">[D_oB]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Lucida Sans Unicode" width="0" height="-16" weight="400"/>
      </property>
      <property name="GridLinesSepColor">0</property>
      <property name="TabIndex">4</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[nBrwAtivo:=1]]>
    </method>
    <method name="onPosChange">
      <![CDATA[oBrwObras:Refresh()
oBrwAdit:Refresh()
oBrwItens:Refresh()
oBrwFat:Refresh()

Ged_ShowJpg('locacao','CONTRATO',sccrcli->cr_cgc)
Ged_ShowJpg('locacao','ADITIVO',sccrcli->cr_cgc, if(sccrcli->cr_cod_cli=cr_recfx->cr_cod_Cli,cr_recfx->fnum,0) )

Ged_ShowJpg('locacao','RECIBODEV',sccrcli->cr_cgc,sf_fatnf->fnum,sf_fatnf->fprenota)]]>
    </method>
    <method name="onInit">
      <![CDATA[DBSELECTAREA("sccrcli")
   if sGuiMode
      IF xGetEnv("USA_CORES_NO_BROWSE")<>"N"
         zbCor0:= {||IF(ztVc>0,zCorVc,IF(ztAvHoje>0, zCorHoje, If(ztAv>0,zCorAv,If(ztEmi-ztVc-ztAv>0,zCorQtOk,{d_ob:tcolor,d_ob:bcolor,D_oB:tColorSel,D_oB:bColorSel})) ))}
         zbCor := {||DebCli(sccrcli->(if(cr_cod_cli=0,Recno(),cr_cod_cli)),.f.,.f.,@ztEmi,@ztVc,@ztAv,@ztAvHoje), EVAL(zbCor0) }
         IF sys_segmento='locacao'
            hwg_TbFi(D_oB, 'Nome;Cr_nome;C;@s33;33;N;zbCor;')
         ELSE
            hwg_TbFi(D_oB, 'Nome;Cr_nome;C;@s40;40;N;zbCor;')
         endif
         hwg_TbFi(D_oB,'CodCli;if(Cr_Cod_Cli=0,Recno(),Cr_Cod_Cli);P;999999;6;N;')
         hwg_TbFi(D_oB, 'Quitacoes;if(ztEmi-ztVc-ztAv>0,ztEmi-ztVc-ztAv,0);P;999999.99;9;N;zbCor0;')
         hwg_TbFi(D_oB, 'Vencidas;ztVc;P;999999.99;9;N;zbCor0;')
         hwg_TbFi(D_oB, 'A_Vencer;ztAv;P;999999.99;9;N;zbCor0;')
      ELSE
         hwg_TbFi(D_oB, 'Nome;Cr_nome;C;@s40;40;N;')
         hwg_TbFi(D_oB,'CodCli;if(Cr_Cod_Cli=0,Recno(),Cr_Cod_Cli);P;999999;6;N;')
      ENDIF
      IF sys_segmento='locacao'
         hwg_TbFi(D_oB, 'c;cr_tipocnt;C;X;1;S;')
         hwg_TbFi(D_oB, 'dv;cr_diavenc;N;99;2;S;')
         hwg_TbFi(D_oB, 'md;cr_MaxDias;N;99;2;S;')
         hwg_TbFi(D_oB, 'to;cr_toleran;N;99;2;S;')
         hwg_TbFi(D_oB, 'Dt Cont;cr_dt_cont;D;;8;;')
      ENDIF
      hwg_TbFi(D_oB, 'Ult Comp;tv_desd(recno());C;@s9;9;;')
      hwg_TbFi(D_oB, 'T;cr_tip_cli;C;9;1;N;')
      hwg_TbFi(D_oB, 'Tb;cr_tabela;N;99;2;S;')
      hwg_TbFi(D_oB, 'Fone;Cr_fone;C;@s15;15;N;')
      hwg_TbFi(D_oB, 'Bairro;Cr_bairro;C;@s30;30;S;')
      hwg_TbFi(D_oB, 'Rua;Cr_rua;C;@s40;40;N;')
      hwg_TbFi(D_oB, 'Vd;CR_ZONA;C;99;2;N;')
      hwg_TbFi(D_oB, 'Acesso;rec_del();N;999999;6;N;')
   else
      hwg_TbFi(@D_oB,"CodCli;if(Cr_Cod_Cli=0,rec_del(),Cr_Cod_Cli);N;999999;6;N;")
      hwg_TbFi(@D_oB,"Nome;Cr_nome;C;@s20;20;N;")
      hwg_TbFi(@D_oB,"Bairro;Cr_bairro;C;@s12;12;S;")
      hwg_TbFi(@D_oB,"Ult Comp;tv_desd(recno());C;@s9;9;;")
      hwg_TbFi(@D_oB,"Rua;Cr_rua;C;@s25;20;N;")
      hwg_TbFi(@D_oB,"T;cr_tip_cli;C;9;1;N;")
      hwg_TbFi(@D_oB,"Vd;CR_ZONA;C;99;2;N;")
      hwg_TbFi(@D_oB,"Cod;cr_cod_cli;N;999999;6;N;")
      hwg_TbFi(@D_oB,"Fone;Cr_fone;C;@s14;14;N;")
      hwg_TbFi(@D_oB,"Tb;cr_tabela;N;99;2;S;")
   endif
   hwg_TbFi(@D_oB,"gp;cr_TabGp;C;x;2;S;")
   hwg_TbFi(@D_oB,"Ponto Ref;Cr_PONTORE;C;@s30;30;N;")
   hwg_TbFi(@D_oB,"Contato;Cr_contato;C;@s15;15;N;")
   hwg_TbFi(@D_oB,"CGC/CPF;Cr_cgc;C;@s18;18;N;")
   hwg_TbFi(@D_oB,"Cidade;Cr_cidade;C;@s20;25;N;")
   hwg_TbFi(@D_oB,"CEP;Cr_CEP;C;@s9;9;N;")
   hwg_TbFi(@D_oB,"UF;Cr_UF;C;xx;2;N;")
   hwg_TbFi(@D_oB,"Fantasia;Cr_fantasi;C;@s30;30;N;")
D_oB:bColorSel:= RGB(3,23,233)
D_oB:tColorSel:= RGB(255,255,255)
D_oB:Alias := alias()
D_oB:lDisableVScrollPos := .t.
D_oB:bKeyDown := {|self, wParam| (aBrowses[nBrwAtivo,2])->(hwg_oDlgKey(self, wparam,1)) , .T. }
D_oB:bOther:={|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}
D_oB:cargo:={.T.,.T.,"SCCRCLI",.F.,.T.,{||.T.} }
AADD(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})
]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{1028,85,243,222}</property>
      <property name="Name">[oBrwObras]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Arial" width="0" height="-12" weight="400"/>
      </property>
      <property name="Border">.F.</property>
      <property name="TabIndex">5</property>
    </style>
    <method name="onPosChange">
      <![CDATA[oBrwAdit:Refresh()
oBrwFat:Refresh()]]>
    </method>
    <method name="onInit">
      <![CDATA[DbSelectArea( 'vb_pref' )
oBrwObras:Alias := 'vb_pref'
oBrwObras:bColorSel:= RGB(3,23,133)
oBrwObras:tColorSel:= RGB(255,255,255)

   hwg_TbFi(@oBrwObras,"Obra;fobraNoCli;N;999;4;N;")
   hwg_TbFi(@oBrwObras,"Fantasia;cr_fantasi;C;@s20;20;N;")
   hwg_TbFi(@oBrwObras,"Bairro;Cr_bairro;C;@s12;12;S;")
   hwg_TbFi(@oBrwObras,"Rua;Cr_rua;C;@s25;20;N;")
   hwg_TbFi(@oBrwObras,"Cli;Cr_Cod_Cli;N;999999;6;N;")
   hwg_TbFi(@oBrwObras,"Ponto Ref;Cr_PONTORE;C;@s30;30;N;")
   hwg_TbFi(@oBrwObras,"Contato;Cr_contato;C;@s15;15;N;")
   hwg_TbFi(@oBrwObras,"Cidade;Cr_cidade;C;@s20;25;N;")
   hwg_TbFi(@oBrwObras,"CEP;Cr_CEP;C;@s9;9;N;")
   hwg_TbFi(@oBrwObras,"UF;Cr_UF;C;xx;2;N;")
   hwg_TbFi(@oBrwObras,"Obra;fobra;N;999;4;N;")

oBrwObras:lFilter := .T.
oBrwObras:bFirst := {|| vb_pref->( DBSEEK( sccrcli->cr_cod_cli, .F. ) ) } 
oBrwObras:bLast  := {|| vb_pref->( DBSEEK( sccrcli->cr_cod_cli, .F., .T. ) ) }
oBrwObras:bWhile := {|| vb_pref->Cr_Cod_Cli = sccrcli->cr_cod_cli }
oBrwObras:Refresh()

oBrwObras:bOther:={|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}


DbSelectArea( 'sccrcli' )
// alert('definiu oBrwItens:alias '+oBrwItens:alias+' Sf_FatNf->fnum '+str(Sf_FatNf->fnum,6)+ ' oBrwItens:nColumns '+str(oBrwItens:nColumns,4) )
]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{10,332,423,199}</property>
      <property name="Name">[oBrwAdit]</property>
      <property name="Anchor">6</property>
      <property name="font">
        <font name="Arial" width="0" height="-12" weight="400"/>
      </property>
      <property name="Border">.F.</property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onPosChange">
      <![CDATA[oBrwFat:Refresh()
Ged_ShowJpg('locacao','ADITIVO',sccrcli->cr_cgc, if(sccrcli->cr_cod_cli=cr_recfx->cr_cod_Cli,cr_recfx->fnum,0) )]]>
    </method>
    <method name="onInit">
      <![CDATA[DbSelectArea( 'Cr_RecFx' )
oBrwAdit:Alias := 'Cr_RecFx'

oBrwAdit:bColorSel:= RGB(3,23,133)
oBrwAdit:tColorSel:= RGB(255,255,255)
hwg_TbFi(@oBrwAdit, 'Aditivo;lTrim(Str(fObraNoCli,2))+"."+lTrim(str(fAditivo,2))+".0";P;@S7;  8;;')
hwg_TbFi(@oBrwAdit, 'Controle;fnum;N;99999999;  8;;')
hwg_TbFi(@oBrwAdit, 'ValorEmUso;Cr_VALOR;N;9999999.99;10;;')
hwg_TbFi(@oBrwAdit, 'Dt1aReloc;Cr_dataini;N;99.99.9999;10;;')
hwg_TbFi(@oBrwAdit, 'f;FgFixoVar;C;X;1;;')
hwg_TbFi(@oBrwAdit, 'Cli;Cr_COD_cli;N;999999;6;;')
hwg_TbFi(@oBrwAdit, 'DEmis;CP_DIAEMIS;N;99;  5;;')
hwg_TbFi(@oBrwAdit, 'Obs;Cr_obs;C;@S20;20;;')
hwg_TbFi(@oBrwAdit, 'DVenc;CP_DIAVENC;N;99;  5;;')
hwg_TbFi(@oBrwAdit, 'Gr;GrupoCli;C;9;1;S;')
hwg_TbFi(@oBrwAdit, 'Rc;Cr_zona;N;99;  2;;')
hwg_TbFi(@oBrwAdit, 'PzVen;CP_PZ_VENC;N;99;  5;;')
hwg_TbFi(@oBrwAdit, "Obra;fobra;N;999;4;S;")
hwg_TbFi(@oBrwAdit, "iObra;fobraNoCli;N;999;4;S;")
hwg_TbFi(@oBrwAdit, "iAditivo;fAditivo;N;999;4;S;")

oBrwAdit:lFilter := .T.
oBrwAdit:bFirst := {|| Cr_RecFx->( DBSEEK( Str(sccrcli->cr_cod_cli,6) , .F. ) ) } 
oBrwAdit:bLast  := {|| Cr_RecFx->( DBSEEK( Str(sccrcli->cr_cod_cli,6) , .F., .T. ) ) }
oBrwAdit:bWhile := {|| Cr_RecFx->cr_cod_cli = sccrcli->cr_cod_cli }
oBrwAdit:Refresh()

oBrwAdit:bOther:={|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}

//ALERT('1aa recfx alias: '+ALIAS()+ '  '+STR(SELECT('sccrcli')) + '  '+Str(sccrcli->cr_cod_cli,6) )
DbSelectArea( 'sccrcli' )
]]>
    </method>
  </part>
  <part class="button">
    <style>
      <property name="Geometry">{1279,80,33,30}</property>
      <property name="Name">[oButton2]</property>
      <property name="Caption">[F&amp;2]</property>
      <property name="Anchor">9</property>
      <property name="ToolTip">[Cadastra nova obra]</property>
      <property name="TabIndex">7</property>
    </style>
    <method name="onClick">
      <![CDATA[w_fcli:=sccrcli->(if(Cr_Cod_Cli=0,Recno(),Cr_Cod_Cli))
IF vb_pref->( DbGet("VB_PREF", 1 ,,,"VB_PREF") )
   vb_pref->( DBSEEK(w_fcli) )
   oBrwObras:Refresh()
ENDIF]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{1278,248,36,22}</property>
      <property name="Name">[oButtonex1]</property>
      <property name="Caption">[S]</property>
      <property name="Anchor">9</property>
      <property name="Bitmap">[icon\scanner.ico]</property>
      <property name="Icon">[icon\scanner.ico]</property>
      <property name="ToolTip">[Re-scanear Contrato]</property>
      <property name="TabIndex">7</property>
    </style>
    <method name="onClick">
      <![CDATA[Ged_ShowJpg('locacao','ZOOMCONTRATO',sccrcli->cr_cgc)]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{1385,334,30,20}</property>
      <property name="Name">[oButtonex2]</property>
      <property name="Caption">[S]</property>
      <property name="Anchor">6</property>
      <property name="Bitmap">[icon\scanner.ico]</property>
      <property name="ToolTip">[Re-scanear Aditivo]</property>
      <property name="TabIndex">7</property>
    </style>
    <method name="onClick">
      <![CDATA[Ged_ShowJpg('locacao','ZOOMADITIVO',sccrcli->cr_cgc,cr_recfx->fnum)]]>
    </method>
  </part>
  <part class="button">
    <style>
      <property name="Geometry">{1318,80,33,30}</property>
      <property name="Name">[oButton3]</property>
      <property name="Caption">[F&amp;3]</property>
      <property name="Anchor">9</property>
      <property name="ToolTip">[Altera dados da Obra]</property>
      <property name="TabIndex">7</property>
    </style>
    <method name="onClick">
      <![CDATA[w_fcli:=sccrcli->(if(Cr_Cod_Cli=0,Recno(),Cr_Cod_Cli))
vb_pref->( DbGet("VB_PREF", 2,,,"VB_PREF") )
]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{1385,457,29,21}</property>
      <property name="Name">[oBtnReciboDev]</property>
      <property name="Caption">[S]</property>
      <property name="Anchor">6</property>
      <property name="Bitmap">[icon\scanner.ico]</property>
      <property name="ToolTip">[Re-scanear Aditivo]</property>
      <property name="TabIndex">7</property>
    </style>
    <method name="onClick">
      <![CDATA[IF sf_fatnf->FgDev="E"
   Ged_ShowJpg('locacao','ZOOMRECIBODEV',sccrcli->cr_cgc,sf_fatnf->fnum,sf_fatnf->fprenota)
ELSE
   ALERT("Essa opcao deve ser usada para digitalizar os comprovantes de Devolucao!;Selecione uma operacao de devolucao com o cursor")
ENDIF]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{440,334,472,197}</property>
      <property name="Name">[oBrwFat]</property>
      <property name="Anchor">6</property>
      <property name="font">
        <font name="Arial" width="0" height="-12" weight="400"/>
      </property>
      <property name="Border">.F.</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onPosChange">
      <![CDATA[IF sf_fatnf->FgDev="E"
   oJpgRECIBODEV:Show()
   oBtnReciboDev:Show()
   Ged_ShowJpg('locacao','RECIBODEV',sccrcli->cr_cgc,sf_fatnf->fnum,sf_fatnf->fprenota)
ELSE
   oJpgRECIBODEV:Hide()
   oBtnReciboDev:Hide()
ENDIF]]>
    </method>
    <method name="onInit">
      <![CDATA[DbSelectArea( 'sf_fatnf' )
oBrwFat:Alias := 'sf_fatnf'
oBrwFat:bColorSel:= RGB(3,23,133)
oBrwFat:tColorSel:= RGB(255,255,255)
hwg_TbFi(@oBrwFat, 'Aditivo;lTrim(Str(fObraNoCli,2))+"."+lTrim(str(fAditivo,2))+"."+lTrim(str(fqtdreloc,2));P;@S10;10;;')
hwg_TbFi(@oBrwFat, 'Fatura;fnum;N;999999;6;;;')
hwg_TbFi(@oBrwFat, 'Oper;if(FgDev="E","Devol",if(FgDev="R","Reloc",FgDev));P;@S5;5;;;')
hwg_TbFi(@oBrwFat, 'Valor;fValLoca;N;999999.99;9;;;')
hwg_TbFi(@oBrwFat, 'Referencia;Dtoc(fDataRet-30)+" a "+Dtoc(fDataRet);P;@S19;19;;')
hwg_TbFi(@oBrwFat, 'Dias;pDiasLoca;N;9999;4;S;;')
hwg_TbFi(@oBrwFat, 'DtProxLoc;fDataRet;D;99.99.99;9;S;;')
// hwg_TbFi(@oBrwFat, 'Duplicata;SccrDup->(IF(DBSEEK(STRZERO(sf_FatNf->fNumPed,6)),"Venc:"+DTOC(cr_dt_venc)+" Lqd:"+Dtoc(Cr_Dt_Lqd)+" ValDp:"+STR(Cr_Valor,10,2), "*Sem Duplicata/Cancelada*"));P;@S27;27;S;;')
hwg_TbFi(@oBrwFat, "Obra;fobra;N;999;4;S;")
hwg_TbFi(@oBrwFat, 'Emissao;fDataEmi;D;;8;;;')

oBrwFat:lFilter := .T.
oBrwFat:bFirst := {|| sf_fatnf->( DBSEEK( Cr_RecFx->fnum, .F. ) ) } 
oBrwFat:bLast  := {|| sf_fatnf->( DBSEEK( Cr_RecFx->fnum , .F., .T. ) ) }
oBrwFat:bWhile := {|| Cr_RecFx->cr_cod_cli = sccrcli->cr_cod_cli .AND. sf_fatnf->pfnum = Cr_RecFx->fnum }
oBrwFat:Refresh()
DbSelectArea( 'sccrcli' )
// alert('definiu oBrwItens:alias '+oBrwItens:alias+' Sf_FatNf->fnum '+str(Sf_FatNf->fnum,6)+ ' oBrwItens:nColumns '+str(oBrwItens:nColumns,4) )]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{917,334,355,197}</property>
      <property name="Name">[oBrwItens]</property>
      <property name="Anchor">6</property>
      <property name="font">
        <font name="Arial" width="0" height="-12" weight="400"/>
      </property>
      <property name="Border">.F.</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onInit">
      <![CDATA[DbSelectArea( 'sf_nfs' )
oBrwItens:Alias := 'sf_nfs'
oBrwItens:bColorSel:= RGB(3,23,133)
oBrwItens:tColorSel:= RGB(255,255,255)
hwg_TbFi(@oBrwItens, "Obra;fObraNoCli;N;999;4;S;")
hwg_TbFi(@oBrwItens, 'Fatura;FNUMS;N;99999999;8;;')
hwg_TbFi(@oBrwItens, 'Vencto;Cr_DT_VENC;D;;  8;;')
hwg_TbFi(@oBrwItens, 'Valor;FVAL;N;9999999.99; 12;;')
hwg_TbFi(@oBrwItens, 'Emissao;fDataEmi;D;;8;;;')

oBrwItens:lFilter := .T.
oBrwItens:bFirst := {|| sf_nfs->( DBSEEK( sccrcli->cr_cod_cli, .F. ) ) } 
oBrwItens:bLast  := {|| sf_nfs->( DBSEEK( sccrcli->cr_cod_cli, .F., .T. ) ) }
oBrwItens:bWhile := {|| sccrcli->cr_cod_cli = sf_nfs->fCli }
oBrwItens:Refresh()
DbSelectArea( 'sccrcli' )
// alert('definiu oBrwItens:alias '+oBrwItens:alias+' Sf_FatNf->fnum '+str(Sf_FatNf->fnum,6)+ ' oBrwItens:nColumns '+str(oBrwItens:nColumns,4) )]]>
    </method>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{10,312,210,19}</property>
      <property name="Name">[oLabel2]</property>
      <property name="Caption">[Aditivos do Cliente Selecionado]</property>
      <property name="Anchor">6</property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">10</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{1031,60,196,19}</property>
      <property name="Name">[oLabel4]</property>
      <property name="Caption">[Obras do Cliente Selecionado]</property>
      <property name="Anchor">9</property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">10</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{440,312,308,19}</property>
      <property name="Name">[oLabel5]</property>
      <property name="Caption">[Relocacoes do Aditivo Selecionado]</property>
      <property name="Anchor">6</property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">10</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{917,312,308,19}</property>
      <property name="Name">[oLabel1]</property>
      <property name="Caption">[Faturas de Cobranca Emitidas]</property>
      <property name="Anchor">6</property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">10</property>
    </style>
  </part>
  <part class="radiogroup">
    <style>
      <property name="Geometry">{509,2,286,75}</property>
      <property name="Name">[oRadiogroup1]</property>
      <property name="varName">[vRadiogroup1]</property>
      <property name="Caption">[Dia Preferencial Pgto / Tipos de Debitos]</property>
      <property name="TextColor">16711680</property>
      <property name="TabIndex">11</property>
    </style>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{516,19,63,22}</property>
        <property name="Name">[oRadiobutton4]</property>
        <property name="Caption">[Todos]</property>
        <property name="TabIndex">100</property>
      </style>
      <method name="onClick">
        <![CDATA[DBSETFILTER({||cr_tav+cr_tvc>0},"cr_tav+cr_tvc>0")
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{635,19,46,22}</property>
        <property name="Name">[oRadiobutton1]</property>
        <property name="Caption">[10]</property>
        <property name="TabIndex">101</property>
      </style>
      <method name="onClick">
        <![CDATA[DBSETFILTER({||cr_tloc>0.and.Cr_DiaVenc=10},"cr_tloc>0.and.Cr_DiaVenc=10")
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{685,19,46,22}</property>
        <property name="Name">[oRadiobutton2]</property>
        <property name="Caption">[20]</property>
        <property name="TabIndex">102</property>
      </style>
      <method name="onClick">
        <![CDATA[DBSETFILTER({||cr_tloc>0.and.Cr_DiaVenc=20},"cr_tloc>0.and.Cr_DiaVenc=20")
DbGoTop()
DobRefresh(D_oB)
]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{734,19,46,22}</property>
        <property name="Name">[oRadiobutton3]</property>
        <property name="Caption">[30]</property>
        <property name="TabIndex">103</property>
      </style>
      <method name="onClick">
        <![CDATA[DBSETFILTER({||cr_tloc>0.and.Cr_DiaVenc=30},"cr_tloc>0.and.Cr_DiaVenc=30")
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{516,47,111,22}</property>
        <property name="Name">[oRadiobutton5]</property>
        <property name="Caption">[So Locacoes]</property>
        <property name="TabIndex">104</property>
      </style>
      <method name="onClick">
        <![CDATA[DBSETFILTER({||cr_tloc>0},"cr_tloc>0")
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{635,47,153,22}</property>
        <property name="Name">[oRadiobutton7]</property>
        <property name="Caption">[Fat. Cobr. Abertas]</property>
        <property name="TabIndex">105</property>
      </style>
      <method name="onClick">
        <![CDATA[DBSETFILTER({||cr_tServ>0},"cr_tServ>0")
DbGoTop()
DobRefresh(D_oB)]]>
      </method>
    </part>
  </part>
</part>
