<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{110,18,1019,650}</property>
    <property name="Name">[SF_NFE.scr]</property>
    <property name="Caption">[Relação de Notas Geradas]</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">[0 - No Border]</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">[3 - Maximized]</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
   // oDlg:Move( , , MAX(798,GetDesktopWidth()*0.95), MAX(570,GetDesktopHeight()*0.90), 1 )
oDlg:Center()
//skel VARIAVEL w_colsep = chr(179)
//skel VARIAVEL w_headsep = chr(196)
//skel VARIAVEL Zrecn = 1
//skel VARIAVEL zBlkCli = {|nCli| sccrcli->(DbGoto(nCli)), sccrcli->cr_nome }
//skel VARIAVEL zBlkForn = {|nCli| sccpfor->(DbGoto(nCli)), sccpfor->cp_nome }
//skel VARIAVEL zBlkPrd = {|nPcod| se_prod->(dbseek(nPcod)), se_prod->pdesc }
//skel VARIAVEL zbOpenProd= {|| Abra("0NOIDX",r_siga,"se_prod","se_prod","seip_c","pcod")}
//skel VARIAVEL zbOpenCli = {|| Abra("0NOIDX",r_siga,"sccrcli","sccrcli")}
//skel VARIAVEL zbOpenForn = {|| Abra("0NOIDX",r_siga,"sccpfor","sccpfor")}
//skel VARIAVEL zbOpenMov = {|| Abra("0NOIDX",r_siga,"se_movnf","se_movnf","se_movnf","mfnum")}
//skel VARIAVEL zbOpenFatNf = {|| Abra ("0",r_siga, "Sf_FatNF", "Sf_FatNF", "Sf_FatNF", "FNUM") , OrdScope(0,1) }
//skel VARIAVEL zbOpenAll = {|| Zrecn:=Recno(), DbCloseAll(), eVal(zbOpenForn), eVal(zbOpenProd), eVal(zbOpenCli), eVal(zbOpenMov), eVal(zbOpenFatNf), DbGoto(Zrecn)}
//skel VARIAVEL zNil = eval(zbOpenAll)
//skel zFiltEmit = "Val(nfe_nprot)>0"
//skel VARIAVEL zBlB={|| Zrecn:=recno(),Nfe_CriarLoteXml(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlC={|| Zrecn:=recno(),Nfe_ImprimirDanfe(fNum,fNum), SetFocus(d_ob), eVal(zbOpenAll)}
//skel VARIAVEL zBlD={|| Zrecn:=recno(),Nfe_EnviarNFE(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlE={|| Zrecn:=recno(),Nfe_ConsultarNFE(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlF={|| Zrecn:=recno(),Nfe_CancelarNFE(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlG={|| Zrecn:=recno(),Nfe_InutilizarNFE(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlH={|| Zrecn:=recno(),NFE_AssinarNFe(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlI={|| Zrecn:=recno(),NFE_ValidarNFe(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlJ={|| Zrecn:=recno(),NFE_Email(fNum,fNum), eVal(zbOpenAll)}
//skel VARIAVEL zBlU={|| DbSetFilter(_CreateBlock("val(nfe_nprot)>0"),"val(nfe_nprot)>0"), DbGoTop(), DobRefresh(d_ob) }
//skel VARIAVEL zBlV={|| DbSetFilter(_CreateBlock("'Cancelament'$nfe_xmotiv"),"'Cancelament'$nfe_xmotiv"), DbGoTop(), DobRefresh(d_ob)}
//skel VARIAVEL zBlV={|| DbSetFilter(_CreateBlock("'Inutiliza'$nfe_xmotiv.and.'Autoriza'$nfe_xmotiv"),"'Inutiliza'$nfe_xmotiv.and.'Autoriza'$nfe_xmotiv"), DbGoTop(), DobRefresh(d_ob)}
//skel VARIAVEL zBlX={|| DbSetFilter(_CreateBlock("'Inutiliza'$nfe_xmotiv.and.!'Autoriza'$nfe_xmotiv"),"'Inutiliza'$nfe_xmotiv.and.!'Autoriza'$nfe_xmotiv"), DbGoTop(), DobRefresh(d_ob)}
//skel VARIAVEL zBlZ={|| DbClearFilter(),DbGoTop(),DobRefresh(d_ob)}

//#define x_BLUE       16711680
//#define x_DARKBLUE   10027008
//#define x_WHITE      16777215
//#define x_CYAN       16776960
//#define x_BLACK             0
//#define x_RED             255
//#define x_GREEN         32768
//#define x_GRAY        8421504
//#define x_YELLOW        65535

//skel varIAVEL bCor = {|| if(se_prod->pdic6=0.or.se_prod->pcodclafis=0.or.left(se_prod->punidade,1)=" ", {16777215,255,16777215,10027008},{16711680,16777215,16776960,10027008}) }

oContextMenu:=Hwg_ContextMenu()
//hwg_Btn(oToolbar,5,5,54,54)
hwg_Btn(oToolbar,400,5,54,54)
hwg_TbMt(oToolbar,'67;AcaoNaSelecaoNFE("Nfe_ImprimirDanfe");C-Imprimir_DANFE ;C - Imprimir_DANFE;xml\icon\nfe_imprimir.jpg;47;47;;;')
hwg_TbMt(oToolbar,'74;AcaoNaSelecaoNFE("NFE_Email");J-Email_NFe ;J - Email_NFe;xml\icon\nfe_email.jpg;47;47;;;')
hwg_TbMt(oToolbar,'80;tb_pesq(D_OB);P-Pesquisa ;P-Pesquisa;;')
hwg_TbMt(oToolbar,'79;tb_index(D_OB);O-Ordena ;O - Ordena;xml\icon\ordena.jpg;47;47;;;')
hwg_TbMt(oToolbar,'0;;;espaco;espaco;')
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()]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <method name="onDlgExit">
    <![CDATA[DBCLOSEALL()
RETURN .t.]]>
  </method>
  <part class="status">
    <style>
      <property name="Geometry">{0,620,1019,30}</property>
      <property name="Name">[oDlgStatusBar]</property>
      <property name="aParts">{640,160,0}</property>
    </style>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{3,85,633,534}</property>
      <property name="Name">[D_oB]</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="Border">.F.</property>
      <property name="TabIndex">4</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[nBrwAtivo:=1]]>
    </method>
    <method name="onPosChange">
      <![CDATA[oBrwItens:Refresh()
      // alert('definiu oBrwItens:alias '+oBrwItens:alias+' Sf_FatNf->fnum '+str(Sf_FatNf->fnum,6)+ ' oBrwItens:nColumns '+str(oBrwItens:nColumns,4) ) ]]>
    </method>
    <method name="onInit">
      <![CDATA[D_oB:bColorSel:= RGB(3,23,133)
D_oB:tColorSel:= RGB(255,255,255)
D_oB:bKeyDown := {|self, wParam| (aBrowses[nBrwAtivo,2])->(hwg_oDlgKey(self, wparam,1)) , .T. }
hwg_TbFi(D_oB, 'NF;fnum;N;999999;  6;;')
hwg_TbFi(D_oB, 'Valor;Transform(fval,"@E 999,999.99");C;XXXXXXXXXX;10;;')
hwg_TbFi(D_oB, 'DtEmis;fDataEmi;D;;8;;')
hwg_TbFi(D_oB, 'St;COD_SIT;C;XX;2;;')
hwg_TbFi(D_oB, 'Obs;nfe_xmotiv;C;@S10;10;;')
hwg_TbFi(D_oB, 'CodCli;fCli;N;999999;  6;;')
hwg_TbFi(D_oB, 'RazSoc;eVal(zBlkCli,fCli);C;@S25;25;;')
hwg_TbFi(D_oB, 'Md;fModelo;C;99;2;;')
hwg_TbFi(D_oB, 'Serie;fSerie;C;999;3;;')
hwg_TbFi(D_oB, 'Chave;fChaveNfe;C;@S44;44;;')
hwg_TbFi(D_oB, 'nProt;nfe_nprot;C;@15;15;;')
hwg_TbFi(D_oB, 'XML  ;nfe_xml;C;@S75;74;;')
D_oB:Alias := alias()
DBGOBottom()
DbSkip( 0-D_oB:RowCount )
D_oB:bOther:={|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}
D_oB:cargo:={.T.,.T.,"SF_FATNF",.F.,.T.,{||.T.} }
aAdd(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})]]>
    </method>
    <method name="onPaint">
      <![CDATA[SETFOCUS(d_Ob)
      if( select("SF_FATNF")=0, eval(zbOpenAll), DbSelectArea("SF_FATNF") ) ]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{642,84,371,513}</property>
      <property name="Name">[oBrwItens]</property>
      <property name="Anchor">9</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="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;;bCor;')
hwg_TbFi(@oBrwItens, 'Descricao;eVal(zBlkPrd,pcod);C;@S20;20;;')
hwg_TbFi(@oBrwItens, 'Quant;mQuant;N;@e 9999.999;8;;')
hwg_TbFi(@oBrwItens, 'Valor;mValor;N;999999.99;9;;')
hwg_TbFi(@oBrwItens, 'Un;se_prod->pUNIDADE;C;XXX;3;;')
hwg_TbFi(@oBrwItens, 'Barra;se_prod->pdic6;N;9999999999999;13;;')
hwg_TbFi(@oBrwItens, 'NCM;se_prod->pcodclafis;N;99999999;8;;')
hwg_TbFi(@oBrwItens, 'ST;se_prod->pCATEGORIA;C;XXX;3;;')
// 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:bFirst := {|| se_movnf->( DBSEEK( Sf_FatNf->fnum, .F. ) ) } 
oBrwItens:bLast  := {|| se_movnf->( DBSEEK( Sf_FatNf->fnum , .F., .T. ) ) }
oBrwItens:bWhile := {|| se_movnf->mfnum = Sf_FatNf->fnum }
oBrwItens:Refresh()
DbSelectArea( 'SF_FatNf' )
// 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">{5,64,90,19}</property>
      <property name="Name">[oLabel2]</property>
      <property name="Caption">[Notas Fiscais]</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">7</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{644,64,202,19}</property>
      <property name="Name">[oLabel3]</property>
      <property name="Caption">[Produtos da Nota Selecionada]</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">7</property>
    </style>
  </part>
  <part class="button">
    <style>
      <property name="Geometry">{976,601,37,18}</property>
      <property name="Name">[oButton1]</property>
      <property name="Id">[IDCANCEL]</property>
      <property name="Caption">[Sair]</property>
      <property name="TabIndex">8</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{4,14,391,38}</property>
      <property name="Name">[oLabel4]</property>
      <property name="Caption">[Relação das Notas Geradas]</property>
      <property name="font">
        <font name="Arial" width="0" height="-29" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">9</property>
    </style>
  </part>
</part>
