<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{157,74,1036,598}</property>
    <property name="Name">[sf_fatne.scr]</property>
    <property name="Caption">[Notas de Entrada]</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 z_Nil = ChecaFatfSeDeveAdicionarCampos()
//skel variavel z_recno:=Recno()
//skel variavel zBOpenAll = #TEXTO_FONTE
//skel    DbCloseAll()
//skel    Abra("0NOIDX",r_siga,"se_prod","se_prod","seip_c","pcod")
//skel    ABRA("0NOIDX",r_siga,"sccpfor","sccpfor")
//skel    Abra("0NOIDX",r_siga,"SE_MOVNF","SE_MOVNF","seim_f","mfnum")
//skel    Abra("0NOIDX",r_siga,"SCCPPED","SCCPPED","SCCPNPF","CP_NUM_PED")
//skel    Abra("0NOIDX",r_siga,sf_fatf, "SF_FATF", sf_fatf, "PFNUM", sf_fatf_nfe, "fChaveNfe")
//skel    sf_fatf->(OrdSetFocus(0), DbGoTo(z_recno))
//skel #FIM_TEXTO_FONTE
//skel VARIAVEL z_recno:=( eVal(zBOpenAll), DbGoBottom(), DbSkip(-9), Sf_Fatf->( Recno() ) )
//skel VARIAVEL zBlkPrd := {|nPcod| se_prod->(dbseek(nPcod)), se_prod->pdesc }
//skel VARIAVEL zBlkForn := {|nForn| sccpfor->(dbgoto(nForn),if(empty(cp_fantasi),cp_nome,cp_fantasi)) }
//skel VARIAVEL zbPrtPedido:= {||z_recno:=Recno(), Relat('lst_exec("NFE05")',"nb",,"X"), eVal(zbOpenAll) }
//skel VARIAVEL zbPrtDanfe:= {||z_recno:=Recno(), NFe_XmlToPdf(fChaveNfe), eVal(zbOpenAll) }
//skel COMANDO SAIDA DbCloseAll()

d_ob:lEditable = .t.

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-Estorna ;DEL-Estorna/Cancela Entrada da Nota Fiscal;deletar.ico;;;;;Estorna;;;')
//hwg_TbMt(oToolbar,'7;(z_recno:=Recno(),pf_del(D_ob,PfNum,PfFor));DEL-Estorna ;DEL-Estorna/Cancela Entrada da Nota Fiscal;deletar.ico;;;;;Estorna;;;')
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,' 73;eVal(zbPrtPedido);I-Imprime ;I-Imprime Copia do Pedido;impressora.ico;;;;;&I-Imprime;;;')
hwg_TbMt(oToolbar,' 73;eVal(zbPrtDanfe);I-Danfe ;I-Imprime Copia do Danfe;impressora.ico;;;;;&I-Danfe;;;')

hwg_Btn(oToolbar,10,544,70,24)
hwg_TbMt(oToolbar,'69;doget(D_ob);E-Edita ;E - Edita;sembitmap;;;Lucida Bright;-11;&E-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-Trecho ;T-Pesquisa Trecho na coluna do cursor;sembitmap;;;Lucida Bright;-11;&T-Trecho;;6;')
hwg_TbMt(oToolbar,'67;tb_locate(D_OB);C-Continua_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,'85;Fatf2FatnfUpdateEfd();U-Atualiza Descricoes;U - Atualiza Descricoes;sembitmap;;;Lucida Bright;-11;&U-Atualiza;;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()

oBrwItens:Refresh()
oBrwDups:Refresh()
oDlg:MAXIMIZE()
]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <part class="status">
    <style>
      <property name="Geometry">{0,568,1036,30}</property>
      <property name="Name">[oDlgStatusBar]</property>
      <property name="aParts">{608,152,0}</property>
    </style>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{10,77,1022,287}</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[oBrwItens:Refresh()
oBrwDups:Refresh()]]>
    </method>
    <method name="onInit">
      <![CDATA[hwg_TbFi(D_oB, 'Fornecedor;Eval(zBlkForn,fcli);P;@s15;11;N;')
hwg_TbFi(D_oB, 'N.F.;fnum;N;999999999;9;S;')
hwg_TbFi(D_oB, 'Valor;Fval;N;@E 999,999.99;10;S;')
hwg_TbFi(D_oB, 'Chegada;pfDataChe;D;99.99.9999;10;S;')
hwg_TbFi(D_oB, 'Emissao;pfdataemi;D;99.99.9999;10;S;')
Hwg_TbFi(D_oB, 'CFOP;Fcodop;C;XXXXX;5;S;')
hwg_TbFi(D_oB, 'CNPJ/CPF;fCnpjCpf;C;@S14;14;S;')
hwg_TbFi(D_oB, 'CodFor;fcli;N;999999;6;N;')
hwg_TbFi(D_oB, 'Ser;fSerie;C;XXX;3;S;')
hwg_TbFi(D_oB, 'Oper;Ind_Oper;C;X;4;S;')
hwg_TbFi(D_oB, 'Emit;Ind_Emit;C;X;4;S;')
hwg_TbFi(D_oB, 'Mod;Cod_Mod;C;XX;3;S;')
hwg_TbFi(D_oB, 'ChaveNFE;fChaveNFE;C;@S44;44;S;')
hwg_TbFi(D_oB, 'BaseICM;Fbaseicms;N;@E 999,999.99; 10;S;')
hwg_TbFi(D_oB, 'Cnpj_CPF;FCNPJCPF;C;99999999999999;14;S;')
hwg_TbFi(D_oB, '%TxICM;Ftaxaicms;N;@E 999.99; 6;S;')
hwg_TbFi(D_oB, 'ValorICM;Ftoticms;N;@E 999,999.99; 10;S;')
hwg_TbFi(D_oB, 'Pedido;fnumped;N;999999;6;S;')
hwg_TbFi(D_oB, 'Emissao;fdataemi;D;99.99.9999;10;S;')
hwg_TbFi(D_oB, 'Chegada;fDataCheg;D;99.99.9999;10;S;')
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.,"SF_FATF",.F.,.T.,{||.T.} }
// d_ob:bEdit := {|D_oB| .t.}
sHwgKeyEdit:= 69
AADD(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})
]]>
    </method>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{393,0,477,47}</property>
      <property name="Name">[oLabel1]</property>
      <property name="Caption">[Selecione Nota de Entrada]</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">{11,366,790,167}</property>
      <property name="Name">[oBrwItens]</property>
      <property name="Anchor">14</property>
      <property name="font">
        <font name="Arial" width="0" height="-11" weight="400"/>
      </property>
      <property name="Border">.F.</property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onInit">
      <![CDATA[oBrwItens:Alias := 'se_movnf'
oBrwItens:bColorSel:= RGB(3,23,133)
oBrwItens:tColorSel:= RGB(255,255,255)
DbSelectArea( 'se_movnf' )
hwg_TbFi(@oBrwItens, 'Prod;Pcod;N;999999;6;;')
hwg_TbFi(@oBrwItens, 'Descricao;eVal(zBlkPrd,pcod);P;@S18;18;;')
hwg_TbFi(@oBrwItens, 'Quant;mQuant;N;@e 9999.999;8;;')
hwg_TbFi(@oBrwItens, 'PrcUnit;mValor/mQuant;P;9999.99;8;;')
hwg_TbFi(@oBrwItens, 'ValTotal;mValor;N;999999.99;9;;')
hwg_TbFi(@oBrwItens, 'S;MFGES;C;X;1;;')
hwg_TbFi(@oBrwItens, 'Cfop;pCfop;C;99999;5;S;')
hwg_TbFi(@oBrwItens, 'DataCheg;mData;D;99.99.99;8;S;')
hwg_TbFi(@oBrwItens, 'NCM;se_prod->pcodclafis;P;99999999;8;N;')
hwg_TbFi(@oBrwItens, 'CF;se_prod->pcategoria;P;XXX;3;N;')
hwg_TbFi(@oBrwItens, 'UN;se_prod->punidade;P;XXX;3;N;')
hwg_TbFi(@oBrwItens, 'Pr_Cheio;pVluVenda;N;99999.99;8;S;')
hwg_TbFi(@oBrwItens, 'CodBarra;se_prod->pdic6;P;99999999999999;14;N;')
// alert('vai definir filtros oBrwItens:alias '+oBrwItens:alias+' Sf_FatNf->fnum '+str(Sf_FatNf->fnum,6)+ ' oBrwItens:nColumns '+str(oBrwItens:nColumns,4) )
oBrwItens:lFilter := .T.
oBrwItens:bFor := {|| se_movnf->mQuant>0.and.se_movnf->mCodForc=Sf_Fatf->pffor.AND.se_movnf->fNumPed=sf_fatf->pfNumPed.and.se_movnf->mFgEs$"ME"} 
oBrwItens:bFirst := {|| se_movnf->( DBSEEK( Sf_Fatf->pfnum, .F. ) ) } 
oBrwItens:bLast  := {|| se_movnf->( DBSEEK( Sf_Fatf->pfnum , .F., .T. ) ) }
oBrwItens:bWhile := {|| se_movnf->mfnum = Sf_Fatf->pfnum }
oBrwItens:Refresh()
DbSelectArea( 'SF_Fatf' )
// 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">{805,368,229,165}</property>
      <property name="Name">[oBrwDups]</property>
      <property name="Anchor">12</property>
      <property name="font">
        <font name="Arial" width="0" height="-11" weight="400"/>
      </property>
      <property name="TabIndex">7</property>
    </style>
    <method name="onInit">
      <![CDATA[oBrwDups:Alias := 'sccpped'
oBrwDups:bColorSel:= RGB(3,23,133)
oBrwDups:tColorSel:= RGB(255,255,255)
DbSelectArea( 'sccpped')
hwg_TbFi(@oBrwDups, 'Div;cp_Divisao;N;999;3;;')
hwg_TbFi(@oBrwDups, 'Valor;cP_valor;N;999999.99;9;;')
hwg_TbFi(@oBrwDups, 'Vencto;CP_DT_VENC;P;99.99.9999;10;;')
oBrwDups:lFilter := .T.

oBrwDups:bFirst := {|| sccpped->( DBSEEK( StrZero(Sf_Fatf->PfNum,10), .F. ) ) } 
oBrwDups:bLast  := {|| sccpped->( DBSEEK( StrZero(Sf_Fatf->PfNum,10), .F., .T. ) ) }
oBrwDups:bWhile := {|| LEFT(sccpped->cp_num_ped,10) = StrZero(Sf_Fatf->PfNum,10) }
oBrwDups:Refresh()
DbSelectArea( 'Sf_Fatf' )
]]>
    </method>
  </part>
</part>
