<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{143,56,1473,655}</property>
    <property name="Name">[sx_orc_d.scr]</property>
    <property name="Caption">[Solicitacoes Agrupadas]</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 w_headsep := chr(196)
//skel VARIAVEL zRecnBrw := 1

//skel VARIAVEL zNil := ( Abra("0NOIDX",R_SIGA,"SX_ORCAP","SX_ORCAP") , dbCreate('mem:_orcapf',DbStruct()), DbCloseArea() )
//skel VARIAVEL zbOpenAll := #TEXTO_FONTE
//skel    DbCloseAll()
//skel    Abra_Arq("SE_PROD")
//skel    Abra("0NOIDX",R_SIGA,"SX_ORCAP","SX_ORCAP","SX_ORCAP","Str(IdCotacao,6)+Str(IdForn,6)+Str(pCod,6)")
//skel    use ('mem:_orcapf') new exclusive
//skel    Abra("0NOIDX",R_SIGA,"SX_ORCAF","SX_ORCAF","SX_ORCAF","str(idcotacao,6)+cp_desc")
//skel    Abra("0NOIDX",R_SIGA,"SX_ORC_D","SX_ORC_D","SX_ORC_D","CP_DESC")
//skel    DbGoTo(zRecnBrw)
//skel #FIM_TEXTO_FONTE
//skel 
//skel VARIAVEL zbAddForns = #TEXTO_FONTE
//skel    Private zFgHaForns,zIdCotacao:=IdCotacao,zDescCotacao:=CP_DESC
//skel    se !(zFgHaForns:=SX_ORCAF->(DbSeek(str(zIdCotacao,6)))) entao zFgHaForns:=SX_ORCAF->(DbGet("SX_ORCAF",1))
//skel    se zFgHaForns entao SX_ORCAF->( Brow_Db("SX_ORCAF") )
//skel #FIM_TEXTO_FONTE
//skel 
//skel VARIAVEL zbPrtCotacao = {||zRecnBrw:=recno(),z_cotsobre:=IdCotacao,Relat("pf_rorc(z_cotsobre)"),eVal(zbOpenAll),dbgoto(zRecnBrw)}
//skel VARIAVEL zbCompras = {||zRecnBrw:=recno(), DispEnt(sx_orcap->pcod) ,eVal(zbOpenAll),dbgoto(zRecnBrw)}
//skel VARIAVEL zbExtrato = {||zRecnBrw:=recno(), se_prod->(DbSeek(sx_orcap->pcod),ext_screen(sx_orcap->pcod)) ,eVal(zbOpenAll),dbgoto(zRecnBrw)}
//skel 
//skel COMANDO ANTES eVal(zbOpenAll)
//skel 
//skel comando saida Select('_orcapf')>0.and.(_orcapf->(DbCloseArea()), DbDrop('mem:_orcapf'), .t.)

d_ob:lEditable = .t.

oContextMenu:=Hwg_ContextMenu()
// hwg_Btn(oToolbar,5,5,64,64)
hwg_Btn(oToolbar,5,5,80,64)
hwg_TbMt(oToolbar,'22;tb_insert(D_OB).and.(DbGoTo(zRecnBrw),if(pitens="S",SxOrcProdutos(D_oB,IdCotacao),eVal(zbAddForns)));Ins-Inclui ;Ins-Inclui nova cotacao;cadastrar.ico;;;Lucida Bright;-8;Add_Cotacao;;;')
hwg_TbMt(oToolbar,'13;SxOrcProdutos(d_ob, Sx_Orc_D->IdCotacao, 0);Enter-Produtos ;Enter - Adiciona Produtos na Cotacao;cadastrar.ico;;;Lucida Bright;-11;Produtos;;;')
hwg_TbMt(oToolbar,'32;Eval(zbAddForns);Barra-Fornecedores ;Barra - Adiciona,Altera ou Deleta Fornecedores na Cotacao;cadastrar.ico;;;Lucida Bright;-11;Fornecedores;;;')
hwg_TbMt(oToolbar,'13;SxOrcProdutos(d_ob, Sx_Orc_D->IdCotacao, sx_orcaf->IdForn);0-ProdsForn ;0 - Produtos do Fornecedor Selecionado;cadastrar.ico;;;Lucida Bright;-11;0-ProdForn;;;')
hwg_TbMt(oToolbar,'49;SxOrcProdutos("Cotar_Pedido");1-CotaPedido ;1 - Cotacao para um pedido selecionado;cadastrar.ico;;;Lucida Bright;-11;1-CotaPedido;;;')

hwg_Btn(oToolbar,5,334,70,64)
hwg_TbMt(oToolbar,'73;Eval(zbPrtCotacao);I-Imprime ;I - Imprime;impressora.ico;;;Lucida Bright;-11;&I-Imprime;;;')
hwg_TbMt(oToolbar,'73;Eval(zbCompras);G-Compras ;G - Exibe extrato de compras do produto da cotacao;impressora.ico;;;Lucida Bright;-11;&G-Compras;;;')
hwg_Btn(oToolbar,5,415,70,64)
hwg_TbMt(oToolbar,'73;Eval(zbExtrato);E-Extrato ;E - Extrato da movimentacao do produto da cotacao;impressora.ico;;;Lucida Bright;-11;&E-Extrato;;;')

//hwg_TbMt(oToolbar,'7;tb_del(d_ob);Del-Apaga ;Del-Deleta;deletar.ico;;;;;Deleta;;;')
//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_Btn(oToolbar,10,595,70,24)
hwg_TbMt(oToolbar,'69;DoGet(D_ob);E-Edita ;E - Altera Coluna do Cursor;sembitmap;;;Lucida Bright;-11;&E-Edita;;6;')
// hwg_TbMt(oToolbar,'73;pf_rorc(IdCotacao);I-Imprime ;I - Imprime;sembitmap;;;Lucida Bright;-11;&I-Imprime;;6;')

hwg_TbMt(oToolbar,'7;tb_del(d_ob);Del-Apaga ;Del-Deleta;sembitmap;;;;;Deleta;;6;')
hwg_TbMt(oToolbar,'80;tb_pesq(D_OB);P-Pesquisa ;P-Pesquisa na coluna do cursor;sembitmap;;;;;&P-Pesquisa;;6;')
hwg_TbMt(oToolbar,'79;tb_index(D_OB);O-Ordena ;O-Ordena a coluna do cursor;sembitmap;;;;;&O-Ordena;;6;')

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()
if type("oDlgStatusBar")="B"
   oDlgStatusBar:Anchor:=14
endif

]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <part class="status">
    <style>
      <property name="Geometry">{0,625,1473,30}</property>
      <property name="Name">[oDlgStatusBar]</property>
      <property name="aParts">{608,152,0}</property>
    </style>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{10,75,399,244}</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[oBrwProds:Refresh() 
oBrwForns:Refresh()
oBrwFornProds:Refresh()

oProdsDaCotacao:SetGet("Produtos da Cotacao "+ALLTRIM(sx_orc_d->cp_desc))
oProdsDaCotacao:Refresh()

oFornsDaCotacao:SetGet("Fornecedores da Cotacao "+ALLTRIM(sx_orc_d->cp_desc))
oFornsDaCotacao:Refresh()

oProdsDoFornecedor:SetGet("Produtos do Fornecedor "+ALLTRIM(sx_orcaf->cp_fantasi))
oProdsDoFornecedor:Refresh()

oFornsDoProduto:SetGet("Fornecedores do Produto "+ALLTRIM(sx_orcap->pDesc))
oFornsDoProduto:Refresh()
SxOrcProdutos(D_OB, sx_orc_d->IdCotacao,,sx_orcap->pCod)
oBrwFornsDoProduto:Refresh()

]]>
    </method>
    <method name="onInit">
      <![CDATA[hwg_TbFi(D_oB, 'Assunto;CP_DESC;C;@S30; 30;;')
hwg_TbFi(D_oB, 'UltComp;Substr(Dtoc(Data),4,5);C;99.99; 7;;')
hwg_TbFi(D_oB, 'Observacoes;CP_DESC2;C;@S24;20;;')
hwg_TbFi(D_oB, 'Itens;Pitens;C;x;5;;')
hwg_TbFi(D_oB, 'Codigo;IDCOTACAO;N;999999;  6;;')
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.,"SX_ORC_D",.F.,.T.,{||.T.} }
d_ob:bEdit := {|D_oB| .t.}
sHwgKeyEdit:= 32
AADD(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})
]]>
    </method>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{455,0,438,47}</property>
      <property name="Name">[oLabel1]</property>
      <property name="Caption">[Cotacoes Cadastradas]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Arial" width="0" height="-37" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">5</property>
    </style>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{941,75,522,244}</property>
      <property name="Name">[oBrwForns]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onPosChange">
      <![CDATA[oBrwFornProds:Refresh() 
oProdsDoFornecedor:SetGet("Produtos do Fornecedor "+ALLTRIM(sx_orcaf->cp_fantasi))
oProdsDoFornecedor:Refresh()

]]>
    </method>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( 'sx_orcaf' ) 
oBrwForns:Alias := 'sx_orcaf'
oBrwForns:bColorSel:= RGB(3,23,133)
oBrwForns:tColorSel:= RGB(255,255,255)

hwg_TbFi(oBrwForns, 'Fantasia;CP_FANTASI;C;@S15; 15;;')
hwg_TbFi(oBrwForns, 'Fone;CP_FONE;C;@S15;15;;')
hwg_TbFi(oBrwForns, 'Contato;CP_CONTATO;C;@S25; 15;;')
hwg_TbFi(oBrwForns, 'Disponivel;CP_VALOR;N;@E 999,999.99; 10;;')
hwg_TbFi(oBrwForns, 'MenorPreco;CP_VAL_LQD;N;@E 999,999.99;10;;')
hwg_TbFi(oBrwForns, 'MaisCaros;CP_VALOR-CP_VAL_LQD;N;@E 999,999.99;10;;')


oBrwForns:lFilter := .T.
oBrwForns:bFirst := {|| sx_orcaf->( DBSEEK( sx_orc_d->(Str(IdCotacao,6)), .F. ) ) } 
oBrwForns:bLast  := {|| sx_orcaf->( DBSEEK( sx_orc_d->(Str(IdCotacao,6)), .F., .T. ) ) }
oBrwForns:bWhile := {|| sx_orcaf->IdCotacao = sx_orc_d->IdCotacao }

DbSelectArea( 'sx_orc_d' )
]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{428,75,500,244}</property>
      <property name="Name">[oBrwProds]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onPosChange">
      <![CDATA[oFornsDoProduto:SetGet("Fornecedores do Produto "+ALLTRIM(sx_orcap->pDesc))
oFornsDoProduto:Refresh()
SxOrcProdutos(D_OB, sx_orc_d->IdCotacao,,sx_orcap->pCod) 
oBrwFornsDoProduto:Refresh()]]>
    </method>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( 'sx_orcap' ) 
oBrwProds:Alias := 'sx_orcap'
oBrwProds:bColorSel:= RGB(3,23,133)
oBrwProds:tColorSel:= RGB(255,255,255)

hwg_TbFi(oBrwProds, 'Cod;PCOD;N;99999;  5;;')
hwg_TbFi(oBrwProds, 'Descricao;PDESC;C;@S30; 26;;')
hwg_TbFi(oBrwProds, 'UndCmp;Punidade;C;@S6;4;;')
hwg_TbFi(oBrwProds, 'Quant;Mquant;N;9999.99;7;;')

hwg_TbFi(oBrwProds, 'UltPrMedio;pVluVen3;N;9999.99;7;;')
hwg_TbFi(oBrwProds, 'PrMedio;pCustoVar;N;9999.99;7;;')

hwg_TbFi(oBrwProds, 'Total;Mquant*pVluVen3;N;999999.99;9;N;')
hwg_TbFi(oBrwProds, '%IPI;pipient;N;999.99;6;;')
hwg_TbFi(oBrwProds, 'Data;DATA;D;;8;;')

oBrwProds:lFilter := .T.
oBrwProds:bFirst := {|| sx_orcap->( DBSEEK( sx_orc_d->(Str(IdCotacao,6)+Str(0,6)), .F. ) ) } 
oBrwProds:bLast  := {|| sx_orcap->( DBSEEK( sx_orc_d->(Str(IdCotacao,6)+Str(0,6)), .F., .T. ) ) }
oBrwProds:bWhile := {|| sx_orcap->IdCotacao = sx_orc_d->IdCotacao .AND. sx_orcap->IdForn = 0}

DbSelectArea( 'sx_orc_d' )
]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{859,355,604,239}</property>
      <property name="Name">[oBrwFornProds]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( 'sx_orcap' ) 
oBrwFornProds:Alias := 'sx_orcap'
oBrwFornProds:bColorSel:= RGB(3,23,133)
oBrwFornProds:tColorSel:= RGB(255,255,255)

hwg_TbFi(oBrwFornProds, 'Cod;PCOD;N;99999;  5;;')
hwg_TbFi(oBrwFornProds, 'UndCmp;Punidade;C;@S6;4;;')
hwg_TbFi(oBrwFornProds, 'Descricao;PDESC;C;@S30; 26;;')
hwg_TbFi(oBrwFornProds, 'UltCompra;pVluVen3;N;9999.99;7;;')
hwg_TbFi(oBrwFornProds, 'PrMedio;pCustoVar;N;9999.99;7;;')
hwg_TbFi(oBrwFornProds, 'Quant;Mquant;N;9999.99;7;;')
hwg_TbFi(oBrwFornProds, 'Total;Mquant*pVluVen3;N;999999.99;9;N;')
hwg_TbFi(oBrwFornProds, '%IPI;pipient;N;999.99;6;;')
hwg_TbFi(oBrwFornProds, 'Data;DATA;D;;8;;')

oBrwFornProds:lFilter := .T.
oBrwFornProds:bFirst := {|| sx_orcap->( DBSEEK( sx_orc_d->(Str(IdCotacao,6)+Str(sx_orcaf->IdForn,6)), .F. ) ) } 
oBrwFornProds:bLast  := {|| sx_orcap->( DBSEEK( sx_orc_d->(Str(IdCotacao,6)+Str(sx_orcaf->IdForn,6)), .F., .T. ) ) }
oBrwFornProds:bWhile := {|| sx_orcap->IdCotacao = sx_orc_d->IdCotacao .AND. sx_orcap->IdForn = sx_orcaf->IdForn}

DbSelectArea( 'sx_orc_d' )

]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{234,355,604,239}</property>
      <property name="Name">[oBrwFornsDoProduto]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( '_orcapf' ) 
oBrwFornsDoProduto:Alias := '_orcapf'
oBrwFornsDoProduto:bColorSel:= RGB(3,23,133)
oBrwFornsDoProduto:tColorSel:= RGB(255,255,255)

hwg_TbFi(oBrwFornsDoProduto, 'Forn;Cp_Fantasi;C;@S15;15;;')
hwg_TbFi(oBrwFornsDoProduto, 'UndCmp;Punidade;C;@S6;4;;')
hwg_TbFi(oBrwFornsDoProduto, 'UltCompra;pVluVen3;N;9999.99;7;;')
hwg_TbFi(oBrwFornsDoProduto, 'PrMedio;pCustoVar;N;9999.99;7;;')
hwg_TbFi(oBrwFornsDoProduto, 'Quant;Mquant;N;9999.99;7;;')
hwg_TbFi(oBrwFornsDoProduto, 'Total;Mquant*pVluVen3;N;999999.99;9;N;')
hwg_TbFi(oBrwFornsDoProduto, '%IPI;pipient;N;999.99;6;;')
hwg_TbFi(oBrwFornsDoProduto, 'Data;DATA;D;;8;;')
hwg_TbFi(oBrwFornsDoProduto, 'Cod;PCOD;N;99999;  5;;')
hwg_TbFi(oBrwFornsDoProduto, 'Descricao;PDESC;C;@S30; 26;;')

DbSelectArea( 'sx_orc_d' )]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{941,53,522,22}</property>
      <property name="Name">[oFornsDaCotacao]</property>
      <property name="varName">[vEdit1]</property>
      <property name="TabIndex">7</property>
    </style>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{428,52,500,22}</property>
      <property name="Name">[oProdsDaCotacao]</property>
      <property name="varName">[vEdit2]</property>
      <property name="TabIndex">7</property>
    </style>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{859,334,604,22}</property>
      <property name="Name">[oProdsDoFornecedor]</property>
      <property name="varName">[vEdit3]</property>
      <property name="TabIndex">7</property>
    </style>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{234,334,604,22}</property>
      <property name="Name">[oFornsDoProduto]</property>
      <property name="varName">[vEdit4]</property>
      <property name="TabIndex">7</property>
    </style>
  </part>
</part>
