<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{142,54,1250,696}</property>
    <property name="Name">[se_setor.scr]</property>
    <property name="Caption">[Setores da Producao]</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 zUnd:=""
//skel variavel bSeekSetor := {|cCodSetor| osrset->(cCodSetor=CodSetor.or.DbSeek(cCodSetor)) }
//skel variavel zbPrd := {|nPcod| se_prod->(nPcod=pCod.or.dbseek(nPcod), AllTrim(pdesc)) }
////skel variavel zbPrdUnd = {|nPcod| se_prod->(nPcod=pCod.or.dbseek(nPcod), if( se_setor->CodSetor="AL".or.os_set->pPecas=0.or.!("KG"$punidade.or."M"$pUnidade.or."L"$pUnidade), punidade, if(os_set->pPecas=0,pUnidade," pc") ) ) }
//skel variavel zbPrdUnd := {|nPcod| se_prod->(nPcod=pCod.or.dbseek(nPcod), punidade) }
//skel VARIAVEL zbCli := {|nCli| sccrcli->(dbgoto(nCli)), sccrcli->cr_nome }
//skel VARIAVEL zbProducao := #TEXTO_FONTE
//skel    DbSelectArea('OS_SET')
//skel    DbSetFilter({||CodSetor=se_setor->CodSetor},"CodSetor=se_setor->CodSetor")
//skel    Brow_Db('OS_SET_FILTRADO')
//skel    DbClearFilter()
//skel    DbSelectArea('OS_SETOR')
//skel #FIM_TEXTO_FONTE

//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 VARIAVEL znAzul0:=16711680

//skel VARIAVEL zCorAgendadaPendente := {zRed,zWhite,zWhite,zRed}
//skel VARIAVEL zCorAgendada := {znAzul0,zWhite,zWhite,znAzul0}
//skel VARIAVEL zCorSemAgendamento := {8388736,zWhite,zWhite,8388736}
//skel VARIAVEL zCorConcluida:={zGreen,zWhite,zWhite,zGreen}
////   hwg_TbFi(D_oB, 'Nome;Cr_nome;C;@s40;40;N;zbCor;')

//skel VARIAVEL zbCor = {|| osrseti->( IF( If(CodSetor='AL',mQUANT-mqAtend,pPecas-mqAtend)<=0, zCorConcluida, if(mqAtend=0,zCorAgendada,zCorAgendadaPendente) )) }

//skel VARIAVEL zbAgendamento := {|| if( Os_SetPp->( DbSeek(OsrSetI->(CodSetor+Str(pCodInsumo,6))) ) , fp_ptfun->(DbSeek(Os_SetPp->fNumero),if(empty(fNomeGuerr),fNome,fNomeGuerr)), "Sem Agendamento") }
//// Abra ('0NOIDX', r_siga, 'fp_ptfun', 'fp_ptfun', 'fp_ptfun', 'FNUMERO')
//// Abra ('0NOIDX', r_siga, 'Os_SetPp', 'Os_SetPp', 'OsSetPp2', 'CodSetor+Str(pCodInsumo,6)+Str(pCod,6)+Str(fNumPed,10)', 'Os_SetPp', 'CodSetor+Str(pCod,6)+Str(fNumPed,10)+Str(RecnoPnMv,10)+Str(RecnoSeKit,10)')

oContextMenu:=Hwg_ContextMenu()
hwg_Btn(oToolbar,5,5,64,64)
hwg_TbMt(oToolbar,' 22;tb_insert(D_OB);Ins-Inclui ;Ins-Inclui;cadastrar.ico;;;;;Inclui;;;')
hwg_TbMt(oToolbar,' 65;tb_update(D_OB);A-Altera ;A-Altera;alterar.ico;;;;;&A-Altera;;;')
hwg_TbMt(oToolbar,'  7;tb_del(D_ob);DEL-DELeta ;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;;;')
d_ob:lEditable = .t.
hwg_TbMt(oToolbar,' 79;tb_index(D_OB);O-Ordena ;O-Ordena a coluna do cursor;ordenar.ico;;;;;&O-Ordena;;;')
hwg_TbMt(oToolbar,' 73;lst_alias(D_OB);I-Imprime ;I-Imprime;impressora.ico;;;;;&I-Imprime;;;')
hwg_TbMt(oToolbar,' 73;Gera_OsSet("plano_de_corte");I-Corte ;I-Imprime Plano de Corte;impressora.ico;;;;;&I-Corte;;;')

hwg_Btn(oToolbar,10,639+30,70,24)
// hwg_TbMt(oToolbar,' 32;eVal(zbProducao);Barra-Producao ;Barra-Informa Producao;sembitmap;;;Lucida Bright;-11;Producao;;6;')
// hwg_TbMt(oToolbar,' 13;eVal(zbProducao);Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
//hwg_TbMt(oToolbar,' 13;doget(D_ob);Enter-Edita ;Enter - Edita;sembitmap;;;Lucida Bright;-11;Edita;;6;')
hwg_TbMt(oToolbar,'61;doget(D_ob,,.t.);=-Repete_Edicao ;= - Repete_Edicao;sembitmap;;;Lucida Bright;-11;&=-Repete_Edicao;;6;')
hwg_TbMt(oToolbar,'84;tb_locate(D_oB);T-Busca_Trecho ;T-Pesquisa Trecho na coluna do cursor;sembitmap;;;Lucida Bright;-11;&T-Trecho;;6;')
hwg_TbMt(oToolbar,'76;tb_locate(D_oB);L-Busca_Iniciais ;L-Busca pelas Iniciais na coluna do cursor;sembitmap;;;Lucida Bright;-11;&L-Iniciais;;6;')
hwg_TbMt(oToolbar,'67;tb_locate(D_oB);C-Repete_Busca ;C-Repete Busca na coluna do cursor;sembitmap;;;Lucida Bright;-11;&C-Continua;;6;')
hwg_TbMt(oToolbar,'70;tb_filter(d_ob);F-Filtra ;F-Filtra Cursor;sembitmap;;;Lucida Bright;-11;&F-Filtra;;6;')
hwg_TbMt(oToolbar,'69;tb_filter(d_ob,"Exp");E-Filtra_Expressao ;E-Filtra Expressao;sembitmap;;;Lucida Bright;-11;&E-Filtra;;6;')

hwg_Btn(oToolbar,,,100,)
hwg_TbMt(oToolbar,'57;Gera_OsSet("LIMPA_OS_SET");9-RestartPlan;9-Reinicia Controle da Producao pelas Ordens de Producao Ativas;sembitmap;;;Lucida Bright;-11;&9-RestartPlan;;6;')
hwg_TbMt(oToolbar,'52;Gera_OsSet("informar_atendimento_os");4-Atend.OS;4-Confirma Atendimento da OS Selecionada;sembitmap;;;Lucida Bright;-11;&4-Atend.OS;;6;')
hwg_TbMt(oToolbar,'53;Gera_OsSet("informar_atendimento_insumo");5-Atd.Insumo;5-Confirma Atendimento do INSUMO Selecionado;sembitmap;;;Lucida Bright;-11;&5-Atend.INSUMO;;6;')
hwg_TbMt(oToolbar,'54;Gera_OsSet("informar_atendimento_composicao");6-Atd.COMP;6-Confirma Atendimento da COMPOSICAO Selecionada;sembitmap;;;Lucida Bright;-11;&6-Atend.COMPOSICAO;;6;')

//hwg_TbMt(oToolbar,' 73;Gera_OsSet("informar_atendimento");5-Atendimento ;5-Informar Consumo/Producao;sembitmap;;;Lucida Bright;-11;&5-Atendimento;;6;')
//hwg_TbMt(oToolbar,' 73;Gera_OsSet("informar_atendimento_composicao");6-Atend_Comp ;6-Confirmar Consumo/Producao da Composicao pela previsao;sembitmap;;;Lucida Bright;-11;&6-Atend_Comp;;6;')
//hwg_TbMt(oToolbar,' 73;Gera_OsSet("informar_atendimento_os");7-Atend_Os ;7-Informar Consumo/Producao da OS pelas previsoes;sembitmap;;;Lucida Bright;-11;&7-Atend_Os;;6;')

hwg_EndMenu()
if type("oDlgStatusBar")="B"
   oDlgStatusBar:Anchor:=14
endif

oButtomEx:Hide()

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

oComposicoesComInsumo:SetGet("Composicoes com "+eVal(zbPrd,osrseti->pCodInsumo) )
oPartesDoInsumoPorComposicoes:SetGet("Partes por Composicoes, de "+eVal(zbPrd,osrseti->pCodInsumo) )
oInsumosDoSetor:SetGet("Insumos a Ser Processados no Setor "+se_setor->(CODSETOR+" "+DESC))
oOrdensDeProducao:SetGet("Ordens de Producao a Ser Atendidas" )
oComposicoesEmProducao:SetGet("Composicoes a Ser Produzidas" )

oOrdensDeProducao:Refresh()
oComposicoesEmProducao:Refresh()
oComposicoesComInsumo:Refresh()
oPartesDoInsumoPorComposicoes:Refresh()
oInsumosDoSetor:Refresh()

// oBtnLimpaFiltros:Move( ,oBtnFiltraSelecoes:nTop,, )   
oBtnLimpaFiltros:Hide()

oBtnFiltraOs:Hide()
oBtnFiltraComp:Hide()

IF se_Setor->CodSetor="AL"
   oBtnPlanProducao:Hide()
ELSE
   oBtnPlanProducao:Show()
ENDIF


]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <part class="browse">
    <style>
      <property name="Geometry">{10,77,456,145}</property>
      <property name="Name">[D_oB]</property>
      <property name="Anchor">11</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[oBrwInsumos:Refresh() 
oBrwComposicoes:Refresh()
oBrwPedidos:Refresh()

oInsumosDoSetor:SetGet("Insumos a Ser Processados no Setor "+se_setor->(CODSETOR+" "+DESC))
oInsumosDoSetor:Refresh()

IF se_setor->CodSetor="AL"
oBtnPlanProducao:Hide()
ELSE
oBtnPlanProducao:Show()
ENDIF
]]>
    </method>
    <method name="onInit">
      <![CDATA[
D_oB:Alias := alias()
D_oB:bColorSel:= RGB(3,23,233)
D_oB:tColorSel:= RGB(255,255,255)

hwg_TbFi(D_oB, 'Setor;DESC;C;@S20; 20;N;')
hwg_TbFi(D_oB, 'Codigo;CODSETOR;C;xx;  3;N;') 

hwg_TbFi(D_oB, 'QtdOS;(eVal(bSeekSetor,CodSetor), osrset->qPeds);P;9999999;7;N;')
hwg_TbFi(D_oB, 'Composicoes;(eVal(bSeekSetor,CodSetor), osrset->qComps);P;9999999;10;N;')
hwg_TbFi(D_oB, 'Insumos;(eVal(bSeekSetor,CodSetor), osrset->qInsumos);P;9999999;10;N;')
hwg_TbFi(D_oB, 'PartesInsumos;(eVal(bSeekSetor,CodSetor), osrset->pPecas);P;9999999;10;N;')

hwg_TbFi(D_oB, 'Prioridade;PRIORIDADE;C;xx;  2;;')
hwg_TbFi(D_oB, 'Obrigatorio;SELECIONA;C;x;  1;;')

//oBrwInsumos:bFirst := {|| osrseti->( DBSEEK( se_setor->CodSetor, .F. ) ) } 
//oBrwInsumos:bLast  := {|| osrseti->( DBSEEK( se_setor->CodSetor, .F., .T. ) ) }
//oBrwInsumos:bWhile := {|| osrseti->CodSetor = se_setor->CodSetor }

D_oB:lFilter := .T.
D_oB:bFor := {|| EVAL(bSeekSetor,CodSetor).and.osrset->qPeds>0 } 

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.,"SE_SETOR",.F.,.T.,{||.T.} }
// sHwgKeyEdit   := 61
AADD(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})
]]>
    </method>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{511,0,383,47}</property>
      <property name="Name">[oLabel1]</property>
      <property name="Caption">[Setores da Producao]</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">{876,77,364,142}</property>
      <property name="Name">[oBrwComposicoes]</property>
      <property name="Anchor">9</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[nBrwAtivo:=3]]>
    </method>
    <method name="onLostFocus">
      <![CDATA[nBrwAtivo:=1]]>
    </method>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( 'osrsetc' ) 

oBrwComposicoes:Alias := 'osrsetc'
oBrwComposicoes:bColorSel:= RGB(3,23,133)
oBrwComposicoes:tColorSel:= RGB(255,255,255)
oBrwComposicoes:lEditable = .t.


hwg_TbFi(oBrwComposicoes, '*;FG_LIB;L;;1;S;')
hwg_TbFi(oBrwComposicoes, 'QtdComp;QUANT;N;999999;6;N;')
hwg_TbFi(oBrwComposicoes, 'Composicao;eVal(zbPrd,pCod);P;@S35;35;N;')
hwg_TbFi(oBrwComposicoes, 'CodComp;PCOD;N;999999;6;N;')
// hwg_TbFi(oBrwComposicoes, 'Atendidas;MQATEND;N;99999999.999; 10;;')

oBrwComposicoes:lFilter := .T.
oBrwComposicoes:bFirst := {|| osrsetc->( DBSEEK( se_setor->CodSetor, .F. ) ) } 
oBrwComposicoes:bLast  := {|| osrsetc->( DBSEEK( se_setor->CodSetor, .F., .T. ) ) }
oBrwComposicoes:bWhile := {|| osrsetc->CodSetor = se_setor->CodSetor }

oBrwComposicoes:bKeyDown := {|self, wParam| (aBrowses[nBrwAtivo,2])->(hwg_oDlgKey(self, wparam,1)) , .T. }
oBrwComposicoes:bOther   := {|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}
oBrwComposicoes:cargo    := {.T.,.T.,"OSRSETC",.F.,.T.,{||.T.} }
AADD(aBrowses,{oBrwComposicoes,oBrwComposicoes:Alias,{||.f.},{|| .T.},})

// oBrwInsumos:Refresh()

DbSelectArea( 'se_setor' )
]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{478,77,388,140}</property>
      <property name="Name">[oBrwPedidos]</property>
      <property name="Anchor">9</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[nBrwAtivo:=2]]>
    </method>
    <method name="onLostFocus">
      <![CDATA[nBrwAtivo:=1]]>
    </method>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( 'osrsetp' ) 

oBrwPedidos:Alias := 'osrsetp'
oBrwPedidos:bColorSel:= RGB(3,23,133)
oBrwPedidos:tColorSel:= RGB(255,255,255)
oBrwPedidos:lEditable = .t.

hwg_TbFi(oBrwPedidos, '*;FG_LIB;L;;1;S;')
hwg_TbFi(oBrwPedidos, 'OS;fNumPed;N;999999;6;N;')
hwg_TbFi(oBrwPedidos, 'Data;sf_pn->(DbSeek(osrsetp->FNUMPED),fDataEmi);P;99.99.99;8;N;')
hwg_TbFi(oBrwPedidos, 'Cliente;(sf_pn->(fNumPed<>osrsetp->fNumPed.or.DbSeek(osrsetp->fNumPed)),sccrcli->(DbGoTo(sf_pn->fCli),cr_nome));P;@S20;20;N;')

oBrwPedidos:lFilter := .T.
oBrwPedidos:bFirst := {|| osrsetp->( DBSEEK( se_setor->CodSetor, .F. ) ) } 
oBrwPedidos:bLast  := {|| osrsetp->( DBSEEK( se_setor->CodSetor, .F., .T. ) ) }
oBrwPedidos:bWhile := {|| osrsetp->CodSetor = se_setor->CodSetor }

// oBrwInsumos:Refresh()

oBrwPedidos:bKeyDown := {|self, wParam| (aBrowses[nBrwAtivo,2])->(hwg_oDlgKey(self, wparam,1)) , .T. }
oBrwPedidos:bOther:={|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}
oBrwPedidos:cargo:={.T.,.T.,"OSRSETP",.F.,.T.,{||.T.} }
AADD(aBrowses,{oBrwPedidos,oBrwPedidos:Alias,{||.f.},{|| .T.},})

DbSelectArea( 'se_setor' )

]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{10,259,655,399}</property>
      <property name="Name">[oBrwInsumos]</property>
      <property name="Anchor">7</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onPosChange">
      <![CDATA[oBrowInsComp:Refresh()
oBrwInsDet:Refresh()

oComposicoesComInsumo:SetGet("Composicoes com "+eVal(zbPrd,osrseti->pCodInsumo) )
oPartesDoInsumoPorComposicoes:SetGet("Partes por Composicoes, de "+eVal(zbPrd,osrseti->pCodInsumo) )

oComposicoesComInsumo:Refresh()
oPartesDoInsumoPorComposicoes:Refresh()
]]>
    </method>
    <method name="onInit">
      <![CDATA[DBSELECTAREA( 'osrseti' ) 

oBrwInsumos:Alias := 'osrseti'
oBrwInsumos:bColorSel:= RGB(3,23,133)
oBrwInsumos:tColorSel:= RGB(255,255,255)

// hwg_TbFi(oBrwInsumos, 'Solicitadas;(zUnd:=eVal(zbPrdUnd,pCodInsumo), if(pPecas<=0,Transform(MQUANT,"@E 99999.999"),Transform(mQuant,"@E 99999,999"))+" "+zUnd);P;@S12;12;;', , , , 1, 1)
hwg_TbFi(oBrwInsumos, 'Solicitadas;Transform(MQUANT,"@E 99999.999")+" "+eVal(zbPrdUnd,pCodInsumo);P;@S12;12;;zbCor;', , , , 1, 1)
hwg_TbFi(oBrwInsumos, 'Descricao do Insumo;eVal(zbPrd,pCodInsumo);P;@S35;35;;zbCor;')
hwg_TbFi(oBrwInsumos, 'Pecas;pPecas;N;9999999;7;;zbCor;')
// hwg_TbFi(oBrwInsumos, 'Solicitadas;PadL(if(pPecas<=0,lTrim(Str(MQUANT,12,3))+" "+eVal(zbPrdUnd,pCodInsumo),lTrim(Str(mQuant*pPecas,12))+" pc"),10);P;@S10;10;;', , , , 1, 1)
hwg_TbFi(oBrwInsumos, 'Atendidas; Transform(MQATEND,if(CodSetor="AL","@E 99999.999","@E 9999999999"));P;@S10; 10;;zbCor;')
// hwg_TbFi(oBrwInsumos, 'Descricao do Insumo;eVal(zbPrd,pCodInsumo)+if(se_setor<>"AL"," Pecas: "+LTRIM(STR(pPecas)),"");P;@S35;35;;')
hwg_TbFi(oBrwInsumos, 'MaxUndCompra;if(CodSetor="AL",Transform((se_prod->pcod=osrseti->pCodInsumo.or.se_prod->(DbSeek(osrseti->pCodInsumo)), mQuant/se_prod->(if(pitens=0,1,pItens))),"@E 999999.999"),eval(zbAgendamento));P;@S10;10;;')

//hwg_TbFi(oBrwInsumos, 'Comprimento;se_prod->(pcod=osrseti->pCodInsumo.or.DbSeek(osrseti->pCodInsumo),pLargura);P;@E 999999.999;10;;')
//hwg_TbFi(oBrwInsumos, 'Altura;se_prod->(pcod=osrseti->pCodInsumo.or.DbSeek(osrseti->pCodInsumo),pAltura);P;@E 999999.999;10;;')

hwg_TbFi(oBrwInsumos, 'CodIns;PCODINSUMO;N;999999;6;;')
//hwg_TbFi(oBrwInsumos, 'QtdInsumo;MQUANT;N;@E 999999.999;10;;')
//hwg_TbFi(oBrwInsumos, 'Und;eVal(zbPrdUnd,pCodInsumo);P;@S3;3;;')
//hwg_TbFi(oBrwInsumos, 'QtdComp;Quant;N;9999999;7;;')
//hwg_TbFi(oBrwInsumos, 'Composicao;eVal(zbPrd,pCod);P;@S35;35;;')
oBrwInsumos:lFilter := .T.
oBrwInsumos:bFirst := {|| osrseti->( DBSEEK( se_setor->CodSetor, .F. ) ) } 
oBrwInsumos:bLast  := {|| osrseti->( DBSEEK( se_setor->CodSetor, .F., .T. ) ) }
oBrwInsumos:bWhile := {|| osrseti->CodSetor = se_setor->CodSetor }

// oBrwInsumos:Refresh()

DbSelectArea( 'se_setor' )]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{669,494,567,165}</property>
      <property name="Name">[oBrwInsDet]</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( 'os_set' ) 

oBrwInsDet:Alias := 'os_set'
oBrwInsDet:bColorSel:= RGB(3,23,133)
oBrwInsDet:tColorSel:= RGB(255,255,255)

hwg_TbFi(oBrwInsDet, 'Solicitadas;if(pPecas>0.and.pLargura+pAltura>0, Transform(Quant*pPecas,"@E 9999999")+" pc" , Transform(Quant*mQUANT,"@E 99999.999")+" "+eVal(zbPrdUnd,pCodInsumo));P;@S12;12;;', , , , 1, 1)

//hwg_TbFi(oBrwInsDet, 'Comprimento;if(pLargura>0,Str(pLargura*1000,4)+" mm","");P;@S10;10;;')
//hwg_TbFi(oBrwInsDet, 'Altura;if(pAltura>0,Str(pAltura*1000,4)+" mm","");P;@S10;10;;')

hwg_TbFi(oBrwInsDet, 'Dimensao da Peca;if(pLargura>0,Str(pLargura*1000,4)+" mm","")+if(pAltura>0," x "+Str(pAltura*1000,4)+" mm","");P;@S18;18;;')

// hwg_TbFi(oBrwInsDet, 'Atendidas;MQATEND;N;@E 99999999.999; 10;;')

hwg_TbFi(oBrwInsDet, 'Atendidas; if(pPecas>0.and.pLargura+pAltura>0, Transform(MQATEND,"@E 9999999")+" pc" , Transform(MQATEND,"@E 99999.999")+" "+eVal(zbPrdUnd,pCodInsumo));P;@S10;10;;')
hwg_TbFi(oBrwInsDet, 'Agendadas; if(CodSetor<>"AL",Transform(MQAgend,"@E 9999999")+" pc" , "");P;@S10;10;;')

hwg_TbFi(oBrwInsDet, 'QtdComp;Quant;N;9999999;7;;')
hwg_TbFi(oBrwInsDet, 'Composicao;eVal(zbPrd,pCod);P;@S25;25;;')
hwg_TbFi(oBrwInsDet, 'QtdInsumo;if(pPecas>0.and.pLargura+pAltura>0, Transform(Quant*mQUANT,"@E 99999.999")+" "+eVal(zbPrdUnd,pCodInsumo), "");P;@S12;10;;')

hwg_TbFi(oBrwInsDet, 'OS;fNumPed;N;999999;6;;')
hwg_TbFi(oBrwInsDet, 'Cliente;sccrcli->(DbGoTo(os_set->fCli),cr_nome);P;@S20;20;;')

// hwg_TbFi(oBrwInsDet, 'Und;eVal(zbPrdUnd,pCodInsumo);P;@S3;3;;')
hwg_TbFi(oBrwInsDet, 'CodIns;PCODINSUMO;N;999999;6;;')
hwg_TbFi(oBrwInsDet, 'Descricao do Insumo;eVal(zbPrd,pCodInsumo);P;@S35;35;;')
//hwg_TbFi(oBrwInsDet, 'Pecas;pPecas;N;9999999;7;;')

oBrwInsDet:lFilter := .T.
oBrwInsDet:bFirst := {|| os_set->( DBSEEK( osrseti->(CodSetor+Str(pCodInsumo,6)), .F. ) ) } 
oBrwInsDet:bLast  := {|| os_set->( DBSEEK( osrseti->(CodSetor+Str(pCodInsumo,6)), .F., .T. ) ) }
oBrwInsDet:bWhile := {|| os_set->(CodSetor+Str(pCodInsumo,6)) = osrseti->(CodSetor+Str(pCodInsumo,6)) }

// oBrwInsumos:Refresh()

DbSelectArea( 'se_setor' )]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{669,259,567,198}</property>
      <property name="Name">[oBrowInsComp]</property>
      <property name="Anchor">3</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( 'osrsetip' ) 

oBrowInsComp:Alias := 'osrsetip'
oBrowInsComp:bColorSel:= RGB(3,23,133)
oBrowInsComp:tColorSel:= RGB(255,255,255)

hwg_TbFi(oBrowInsComp, 'Composicao;eVal(zbPrd,pCod);P;@S35;35;;')
hwg_TbFi(oBrowInsComp, 'QtdInsumo;Transform(MQUANT,"@E 99999.999")+" "+eVal(zbPrdUnd,pCodInsumo);P;@S12;12;;', , , , 1, 1)
hwg_TbFi(oBrowInsComp, 'Pecas;pPecas;N;9999999;7;;')
hwg_TbFi(oBrowInsComp, 'QtdAtendIns;MQATEND;N;@E 99999999.999; 11;;')
hwg_TbFi(oBrowInsComp, 'CodComp;PCOD;N;999999;6;;')
hwg_TbFi(oBrowInsComp, 'CodIns;PCODINSUMO;N;999999;6;;')
hwg_TbFi(oBrowInsComp, 'Descricao do Insumo;eVal(zbPrd,pCodInsumo);P;@S35;35;;')

oBrowInsComp:lFilter := .T.
oBrowInsComp:bFirst := {|| osrsetip->( DBSEEK( osrseti->(CodSetor+Str(pCodInsumo,6)), .F. ) ) } 
oBrowInsComp:bLast  := {|| osrsetip->( DBSEEK( osrseti->(CodSetor+Str(pCodInsumo,6)), .F., .T. ) ) }
oBrowInsComp:bWhile := {|| osrsetip->(CodSetor+Str(pCodInsumo,6)) = osrseti->(CodSetor+Str(pCodInsumo,6)) }

DbSelectArea( 'se_setor' )
]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{669,240,567,22}</property>
      <property name="Name">[oComposicoesComInsumo]</property>
      <property name="varName">[vEdit1]</property>
      <property name="Anchor">3</property>
      <property name="TabIndex">8</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.f.]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{10,240,499,22}</property>
      <property name="Name">[oInsumosDoSetor]</property>
      <property name="varName">[vEdit2]</property>
      <property name="Anchor">3</property>
      <property name="TabIndex">8</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.f.]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{669,472,419,22}</property>
      <property name="Name">[oPartesDoInsumoPorComposicoes]</property>
      <property name="varName">[vEdit3]</property>
      <property name="Anchor">11</property>
      <property name="TabIndex">8</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.f.]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{478,51,388,22}</property>
      <property name="Name">[oOrdensDeProducao]</property>
      <property name="varName">[vEdit4]</property>
      <property name="Anchor">9</property>
      <property name="TabIndex">8</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.f.]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{876,51,364,22}</property>
      <property name="Name">[oComposicoesEmProducao]</property>
      <property name="varName">[vEdit5]</property>
      <property name="Anchor">9</property>
      <property name="TabIndex">8</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.f.]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{1221,472,15,22}</property>
      <property name="Name">[oButtonex1]</property>
      <property name="Caption">[&amp;*]</property>
      <property name="Anchor">9</property>
      <property name="BackColor">16711680</property>
      <property name="ToolTip">
[Informa atendimento/producao da parte solicitada, indicando o funcionario executor]      </property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Gera_OsSet("informar_atendimento")]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{736,51,128,22}</property>
      <property name="Name">[oBtnFiltraComp]</property>
      <property name="Caption">[&amp;2.Filtra Compos.]</property>
      <property name="Anchor">9</property>
      <property name="ToolTip">[Filtra insumos da Composicao sobre o Cursor]</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Gera_OsSet("FILTRA_COMPOSICAO_OU_PEDIDO","/"+LTRIM(STR(osrsetc->pCod,14))+"/")]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{601,51,128,22}</property>
      <property name="Name">[oBtnFiltraOS]</property>
      <property name="Caption">[&amp;1.Filtra OS]</property>
      <property name="Anchor">9</property>
      <property name="ToolTip">[Filtra Insumos da O.S. sobre o cursor]</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Gera_OsSet("FILTRA_COMPOSICAO_OU_PEDIDO",,,"/"+LTRIM(STR(osrsetp->fNumPed,14))+"/")]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{1112,24,128,22}</property>
      <property name="Name">[oBtnLimpaFiltros]</property>
      <property name="Caption">[&amp;0.Limpa Filtros]</property>
      <property name="Anchor">9</property>
      <property name="ToolTip">[Limpa filtragens e selecoes]</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Gera_OsSet("LIMPA_FILTROS")]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{518,240,144,22}</property>
      <property name="Name">[oBtnPlanProducao]</property>
      <property name="Caption">[&amp;8.Planejar Producao]</property>
      <property name="Anchor">3</property>
      <property name="BackColor">65408</property>
      <property name="ToolTip">[Efetua o planejamento das tarefas]</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Gera_OsSet("browse_programar_atendimento")]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{1097,472,118,22}</property>
      <property name="Name">[oButtonex6]</property>
      <property name="Caption">[&amp;1.Atendimento]</property>
      <property name="Anchor">9</property>
      <property name="BackColor">16711680</property>
      <property name="ToolTip">
[Informa atendimento/producao da parte solicitada, indicando o funcionario executor]      </property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Gera_OsSet("browse_informar_atendimento")]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{1112,0,128,22}</property>
      <property name="Name">[oBtnFiltraSelecoes]</property>
      <property name="Caption">[&amp;0.Filtra Selecoes]</property>
      <property name="Anchor">9</property>
      <property name="ToolTip">
[Filtra solicitacoes das composicoes ou pedidos marcados]      </property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Gera_OsSet("FILTRA_COMPOSICAO_OU_PEDIDO")]]>
    </method>
  </part>
</part>
