<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{292,54,1003,590}</property>
    <property name="Name">[dlgNotas]</property>
    <property name="Caption">[Emissao de NFe]</property>
    <property name="AlwaysOnTop">.F.</property>
    <property name="AutoCenter">.T.</property>
    <property name="FormType">[dlgModal]</property>
    <property name="Modal">.T.</property>
    <property name="ScopeVarObj">[Local]</property>
    <property name="lClipper">.T.</property>
    <property name="lExitOnEnter">.T.</property>
    <property name="lExitOnESC">.T.</property>
    <property name="FromStyle">[Popup]</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">16777215</property>
    <property name="Icon">[]</property>
    <property name="Bitmap">[icon\tela.jpg]</property>
    <property name="NoIcon">.F.</property>
    <property name="SystemMenu">.F.</property>
    <property name="Minimizebox">.F.</property>
    <property name="Maximizebox">.F.</property>
    <property name="AbsAlignment">.F.</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[//skel variavel zProxNFe:=0
//skel variavel zProxNFC:=0

//skel variavel zFgPeriodo:=.t.
//skel variavel zDe:=s_Datual
//skel variavel zAte:=s_dAtual
//skel VARIAVEL zFileFat:='mem:_fatnf'
//skel variavel zwSomaFat:=0
//skel variavel zwfValES:=0
//skel variavel zwfValCV:=0
//skel variavel zwfValCT:=0
//skel variavel zwQtdPedidos:=0
//skel variavel zwSomaCanc:=0
//skel variavel zwQtdCanc:=0

//skel variavel zbProximosNumeros:={|| zProxNFe:=SiSemaf("CAPTE_PROXIMO_NUMERO", "/NFE/"), zProxNFc:=SiSemaf("CAPTE_PROXIMO_NUMERO", "/NFC/") , oProxNFE:Refresh(), oProxNFC:Refresh() }
////MoveWindow(oDlg:Handle, 0,0,1019,547)

IF .not. sFgNFC
   oContainerNFCNFE:Hide() 
ENDIF
if xGetEnv("FATURA_SERVICOS")<>"S"
   oBtnOs:Hide()
   oBtnFecharOs:Hide()
   oBtnFatNFE:Hide()
   oBtnFatNFC:Hide()
   oBtnOutraS:Move( ,,oBtnVenda:nWidth, )
   oBtnOutraE:Move( ,,oBtnVenda:nWidth, )
ELSE
   IF LEFT(sys_segmento,2)<>'os'
      oBtnOs:SetText("Criar Orcamento")
      oBtnFecharOs:SetText("Fechar Orcamento")
   ENDIF
ENDIF

eVal(zbProximosNumeros)

zFgPeriodo:=.t.]]>
  </method>
  <part class="container">
    <style>
      <property name="Geometry">{601,144,184,381}</property>
      <property name="Name">[oContainerNFCNFE]</property>
      <property name="TabIndex">0</property>
    </style>
    <part class="group">
      <style>
        <property name="Geometry">{608,147,167,182}</property>
        <property name="Name">[oGroup5]</property>
        <property name="TextColor">4194304</property>
        <property name="Transparent">.T.</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="TabIndex">25</property>
      </style>
      <part class="buttonex">
        <style>
          <property name="Geometry">{624,188,134,134}</property>
          <property name="Name">[oButtonex27]</property>
          <property name="Caption">[]</property>
          <property name="font">
            <font name="Arial" width="0" height="-21" weight="700"/>
          </property>
          <property name="WordWrap">.T.</property>
          <property name="Bitmap">[icon\logonfce_nc.jpg]</property>
          <property name="PicturePosition">[1-Center]</property>
          <property name="Transparent">.T.</property>
          <property name="ToolTip">
[Cria, Assina e Valida, Transmite e Imprime XML de NFc]          </property>
          <property name="TabIndex">14</property>
        </style>
        <method name="onClick">
          <![CDATA[BrowNfePN(,'65')
eVal(zbProximosNumeros)]]>
        </method>
      </part>
      <part class="label">
        <style>
          <property name="Geometry">{615,160,155,18}</property>
          <property name="Name">[oLabel4]</property>
          <property name="Caption">[NFC-e Nao Confirmadas]</property>
          <property name="Justify">[Center]</property>
          <property name="TextColor">255</property>
          <property name="font">
            <font name="Arial" width="0" height="-12" weight="700"/>
          </property>
          <property name="Transparent">.T.</property>
          <property name="TabIndex">27</property>
        </style>
      </part>
    </part>
    <part class="group">
      <style>
        <property name="Geometry">{608,334,167,182}</property>
        <property name="Name">[oGroup6]</property>
        <property name="TextColor">4194304</property>
        <property name="Transparent">.T.</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="TabIndex">25</property>
      </style>
      <part class="buttonex">
        <style>
          <property name="Geometry">{624,371,134,134}</property>
          <property name="Name">[oButtonex26]</property>
          <property name="Caption">[]</property>
          <property name="font">
            <font name="Arial" width="0" height="-21" weight="700"/>
          </property>
          <property name="WordWrap">.T.</property>
          <property name="Bitmap">[icon\logonfce.jpg]</property>
          <property name="PicturePosition">[1-Center]</property>
          <property name="Transparent">.T.</property>
          <property name="ToolTip">[Exibe Notas Fiscais de NFCs]</property>
          <property name="TabIndex">14</property>
        </style>
        <method name="onClick">
          <![CDATA[BrowNfe(,'65')
eVal(zbProximosNumeros)]]>
        </method>
      </part>
      <part class="label">
        <style>
          <property name="Geometry">{615,348,155,19}</property>
          <property name="Name">[oLabel5]</property>
          <property name="Caption">[NFC-e Ja Confirmadas]</property>
          <property name="Justify">[Center]</property>
          <property name="TextColor">8388608</property>
          <property name="Transparent">.T.</property>
          <property name="TabIndex">28</property>
        </style>
      </part>
    </part>
  </part>
  <part class="container">
    <style>
      <property name="Geometry">{407,144,184,381}</property>
      <property name="Name">[oContainerNFE]</property>
      <property name="TabIndex">0</property>
    </style>
    <part class="group">
      <style>
        <property name="Geometry">{415,147,167,182}</property>
        <property name="Name">[oGroup3]</property>
        <property name="TextColor">4194304</property>
        <property name="Transparent">.T.</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="TabIndex">25</property>
      </style>
      <part class="buttonex">
        <style>
          <property name="Geometry">{432,188,134,134}</property>
          <property name="Name">[oButtonex12]</property>
          <property name="Caption">[]</property>
          <property name="font">
            <font name="Arial" width="0" height="-21" weight="700"/>
          </property>
          <property name="WordWrap">.T.</property>
          <property name="Bitmap">[icon\logonfe_nc.jpg]</property>
          <property name="PicturePosition">[1-Center]</property>
          <property name="Transparent">.T.</property>
          <property name="ToolTip">
[Cria, Assina e Valida, Transmite e Imprime XML de NFe]          </property>
          <property name="TabIndex">14</property>
        </style>
        <method name="onClick">
          <![CDATA[BrowNfePN(,'55')
eVal(zbProximosNumeros)]]>
        </method>
      </part>
      <part class="label">
        <style>
          <property name="Geometry">{421,160,155,18}</property>
          <property name="Name">[oLabel2]</property>
          <property name="Caption">[NF-e Nao Confirmadas]</property>
          <property name="Justify">[Center]</property>
          <property name="TextColor">255</property>
          <property name="font">
            <font name="Arial" width="0" height="-12" weight="700"/>
          </property>
          <property name="Transparent">.T.</property>
          <property name="TabIndex">27</property>
        </style>
      </part>
    </part>
    <part class="group">
      <style>
        <property name="Geometry">{415,334,167,182}</property>
        <property name="Name">[oGroup4]</property>
        <property name="TextColor">4194304</property>
        <property name="Transparent">.T.</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="TabIndex">25</property>
      </style>
      <part class="buttonex">
        <style>
          <property name="Geometry">{427,371,134,134}</property>
          <property name="Name">[oButtonex11]</property>
          <property name="Caption">[]</property>
          <property name="font">
            <font name="Arial" width="0" height="-21" weight="700"/>
          </property>
          <property name="WordWrap">.T.</property>
          <property name="Bitmap">[icon\logonfe.jpg]</property>
          <property name="PicturePosition">[1-Center]</property>
          <property name="Transparent">.T.</property>
          <property name="ToolTip">
[Cria, Assina, Valida ou Transmite NFes ainda nao transmitidas... ReImprime, Consulta, Cancela, Inutiliza NFEs]          </property>
          <property name="TabIndex">14</property>
        </style>
        <method name="onClick">
          <![CDATA[BrowNfe(,'55')
eVal(zbProximosNumeros)]]>
        </method>
      </part>
      <part class="label">
        <style>
          <property name="Geometry">{421,348,155,19}</property>
          <property name="Name">[oLabel3]</property>
          <property name="Caption">[NF-e Ja Confirmadas]</property>
          <property name="Justify">[Center]</property>
          <property name="TextColor">8388608</property>
          <property name="Transparent">.T.</property>
          <property name="TabIndex">28</property>
        </style>
      </part>
    </part>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{570,78,216,51}</property>
      <property name="Name">[oButtonex5]</property>
      <property name="Caption">[Relacao Geral NFE/NFC/NFS]</property>
      <property name="TextColor">8388608</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="ToolTip">[Relacao geral de NF-e,  NFC-e,  NFS-e]</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[IF .not. QuickDialog("qbe_periodo_ou_todas", "40;5;Parametros",{ ;
  {"1;3;CHECKBOX 'Exibe apenas um Periodo ?'", "@zFgPeriodo", @zFgPeriodo, "!", "", ""} ,;
  {"3;2;Data Inicial:","@zDe",@zDe,"99.99.9999","zFgPeriodo",""},;
  {"4;2;Data Final..:","@zAte",@zAte,"99.99.9999","zFgPeriodo",""}} ) 
  RETURN .t.
ENDIF

IF .NOT. zFgPeriodo
  CiBrow("SF_FATNF",,"SF_FATNF_LOCACAO")
  zFgPeriodo:=.t.
  RETURN .t.
ENDIF

   DBCLOSEALL()
   mensagem("Selecionando lancamentos entre "+Dtoc(zDe)+" e "+Dtoc(zAte))
   Abra ('0NOIDX', r_siga, sf_fat, "Sf_FatNF",  sf_fat_d, 'fdataemi')
   xDbCopyTo(zFileFat, "_fatnf", {||fDataEmi>=zDe.and.fDataEmi<=zAte}, ,{||fDataEmi<=zAte}, .t., , {||DbSeek(zDe,.t.)} )
   mensagem("")
   DbCloseAll()
   USE (zFileFat) new exclusive ALIAS Sf_FatNf
   
   IF RECCOUNT()>0 
      zwSomaFat:=0
      zwfValES:=0
      zwfValCV:=0
      zwfValCT:=0
      zwQtdPedidos:=0
      zwSomaCanc:=0
      zwQtdCanc:=0       
       DBEVAL({|| IF(fg_fat="C".OR."Cancela"$nfe_xmotiv.or.VAL(cod_sit)=2.or.val(cod_sit)=5, (zwSomacanc+=fval,++zwQtdCanc), (zwSomaFat+=fVal, zwfValES+=fValES, ++zwQtdPedidos,zwfValCV+=fValCV,zwfValCT+=fValCT) )}, {|| (LEFT(fCodop,1)$"567".AND.SUBSTR(fCodop,3,1)<>'9').OR.fValLoca>0.or.fCodop='5.933' } ) 
       DBGOTOP() 
       Brow_Db("SF_FATNF_PERIODO")
   ELSE
       ALERT("Nao Foram Selecionadas Emissoes entre "+DTOC(zDe)+" e "+Dtoc(zAte) )      
   ENDIF
  
   DbCloseAll()
   DbDrop(zFileFat)
]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{570,21,216,51}</property>
      <property name="Name">[oButtonex25]</property>
      <property name="Caption">[Relacao Geral de Prenotas]</property>
      <property name="TextColor">8388608</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="ToolTip">
[Relacao geral de Prenotas, Pedidos, Orcamentos, OS, Pendentes ou Processados, etc...]      </property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[BrowNfePn("SF_PN")]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{797,491,185,42}</property>
      <property name="Name">[oButtonex29]</property>
      <property name="Caption">[&amp;SyncNFE]</property>
      <property name="TextColor">4194304</property>
      <property name="font">
        <font name="Arial" width="0" height="-15" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="ToolTip">[Sincroniza XMLs com site da Receita Federal]</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[Sync_NFE()]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{797,537,185,42}</property>
      <property name="Name">[oButtonex24]</property>
      <property name="Caption">[&amp;XMLs p/ CONTADOR]</property>
      <property name="TextColor">4194304</property>
      <property name="font">
        <font name="Arial" width="0" height="-15" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="ToolTip">[Envia XMLs para Email do Contador]</property>
      <property name="TabIndex">9</property>
    </style>
    <method name="onClick">
      <![CDATA[hrb_enviaXmlContador()]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{803,51,84,34}</property>
      <property name="Name">[buttonsair]</property>
      <property name="Id">[IDCANCEL]</property>
      <property name="Caption">[Esc - Sair]</property>
      <property name="ToolTip">[Fecha Tela]</property>
      <property name="TabIndex">10</property>
    </style>
    <method name="onClick">
      <![CDATA[keyb_event( 27 )]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{728,546,13,16}</property>
      <property name="Name">[oButtonex3]</property>
      <property name="Caption">[&amp;I]</property>
      <property name="TextColor">4194304</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="ToolTip">[Redefine NUMERO DA PROXIMA NFE]</property>
      <property name="TabIndex">10</property>
    </style>
    <method name="onClick">
      <![CDATA[Nfe_SetProximoNumero(.t.,'/NFE/')]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{728,566,13,16}</property>
      <property name="Name">[oButtonex4]</property>
      <property name="Caption">[&amp;J]</property>
      <property name="TextColor">4194304</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="ToolTip">[Redefine Numero da PROXIMA NFC]</property>
      <property name="TabIndex">10</property>
    </style>
    <method name="onClick">
      <![CDATA[Nfe_SetProximoNumero(.t.,'/NFC/')]]>
    </method>
  </part>
  <part class="buttonex">
    <style>
      <property name="Geometry">{519,42,15,16}</property>
      <property name="Name">[oButtonex7]</property>
      <property name="Caption">[&amp;*]</property>
      <property name="TextColor">4194304</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="ToolTip">[Parametros da Impressao/Geracao da NFE]</property>
      <property name="TabIndex">10</property>
    </style>
    <method name="onClick">
      <![CDATA[ExecutaXML("dlgconfig_nfe")]]>
    </method>
  </part>
  <part class="checkbox">
    <style>
      <property name="Geometry">{5,555,266,22}</property>
      <property name="Name">[oCheck3]</property>
      <property name="varName">[vCheck3]</property>
      <property name="Caption">[Ativar Modo de Contingencia - SCAN]</property>
      <property name="WordWrap">.T.</property>
      <property name="Transparent">.T.</property>
      <property name="ToolTip">
[ATENCAO: O modo de Contingencia ( SCAN ) so devera ser usado se o Portal da NFe estiver fora do AR.]      </property>
      <property name="TabIndex">18</property>
    </style>
    <method name="onClick">
      <![CDATA[IF vCheck3
   s_nf_serie:=val(xGetEnv("NF_SERIE"))
ELSE
   s_nf_serie:=900
ENDIF
ALERT('O Modo de Contingencia SCAN foi '+IF(vCheck3,'DES','')+';;A Serie das notas foi modificada para '+LTRIM(STR(s_nf_serie,3))+'!;')
]]>
    </method>
  </part>
  <part class="checkbox">
    <style>
      <property name="Geometry">{5,530,266,22}</property>
      <property name="Name">[oCheck1]</property>
      <property name="varName">[vCheck1]</property>
      <property name="Caption">[Transmite NFE apos digitacao]</property>
      <property name="WordWrap">.T.</property>
      <property name="Transparent">.T.</property>
      <property name="ToolTip">
[Transmite automaticamente as NFE modelo 55 apos a digitacao das mesmas]      </property>
      <property name="TabIndex">18</property>
    </style>
    <method name="onClick">
      <![CDATA[xSetEnv("NFE_TRANSMITE_APOS_DIGITACAO", IF(vCheck1,"S","N") )]]>
    </method>
    <method name="onInit">
      <![CDATA[vCheck1:=(xGetEnv("NFE_TRANSMITE_APOS_DIGITACAO")="S")
oCheck1:Refresh()]]>
    </method>
  </part>
  <part class="radiogroup">
    <style>
      <property name="Geometry">{290,541,224,44}</property>
      <property name="Name">[oRadiogroup1]</property>
      <property name="varName">[vRadiogroup1]</property>
      <property name="Caption">[Ambiente da NFe]</property>
      <property name="Transparent">.T.</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">19</property>
    </style>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{297,557,86,22}</property>
        <property name="Name">[oRadiobutton1]</property>
        <property name="Caption">[Producao]</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">20</property>
      </style>
    </part>
    <part class="radiobutton">
      <style>
        <property name="Geometry">{387,557,113,22}</property>
        <property name="Name">[oRadiobutton2]</property>
        <property name="Caption">[Homologacao]</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">21</property>
      </style>
    </part>
  </part>
  <part class="group">
    <style>
      <property name="Geometry">{5,7,398,516}</property>
      <property name="Name">[oGroup1]</property>
      <property name="Caption">[Geracao de PRENOTAS]</property>
      <property name="Transparent">.T.</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">23</property>
    </style>
    <part class="buttonex">
      <style>
        <property name="Geometry">{219,414,174,47}</property>
        <property name="Name">[oBtnOs]</property>
        <property name="Caption">[&amp;C.Criar OS]</property>
        <property name="TextColor">4194304</property>
        <property name="font">
          <font name="Arial" width="0" height="-15" weight="700"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">9</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("S",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{219,465,174,47}</property>
        <property name="Name">[oBtnFecharOs]</property>
        <property name="Caption">[&amp;D.Fechar OS]</property>
        <property name="TextColor">4194304</property>
        <property name="font">
          <font name="Arial" width="0" height="-15" weight="700"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">9</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("S",,,,,"/FECHAPN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{207,496,12,16}</property>
        <property name="Name">[oBtnFatNFC]</property>
        <property name="Caption">[&amp;c]</property>
        <property name="TextColor">4194304</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="TabIndex">10</property>
      </style>
      <method name="onClick">
        <![CDATA[NfcRefCupons()]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{207,477,12,16}</property>
        <property name="Name">[oBtnFatNFE]</property>
        <property name="Caption">[&amp;e]</property>
        <property name="TextColor">4194304</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="TabIndex">10</property>
      </style>
      <method name="onClick">
        <![CDATA[NfcRefCupons('55')]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,28,183,46}</property>
        <property name="Name">[oBtnVenda]</property>
        <property name="Caption">[&amp;1.NFE de Produtos ou Servicos]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">[Efetua Venda de Produtos e/ou Servicos]</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[wFgVaiGerarNFE:=(xGetEnv("NFE_TRANSMITE_APOS_DIGITACAO")="S")
vb_venda("MV",,,,,"/PN/")
wFgVaiGerarNFE:=.f.

eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,78,183,62}</property>
        <property name="Name">[oButtonex16]</property>
        <property name="Caption">[&amp;2.Devolucao de uma NF ao Fornecedor]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MD1",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,145,183,62}</property>
        <property name="Name">[oButtonex17]</property>
        <property name="Caption">[&amp;3.Devolucao de Prods de Varias NFs a Forn.]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MD2",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{216,161,176,46}</property>
        <property name="Name">[oButtonex18]</property>
        <property name="Caption">[&amp;4.NFe Transferencia entre Lojas]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MT",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,220,183,62}</property>
        <property name="Name">[oButtonex19]</property>
        <property name="Caption">[&amp;5.NFe para registrar Entrada Avulsa]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("ME1",,.t.,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{216,220,176,62}</property>
        <property name="Name">[oButtonex20]</property>
        <property name="Caption">
[&amp;6.NFe p/ Entrada ref. Trocas/Dev. de Clientes]        </property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("ME2",,.t.,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,298,184,47}</property>
        <property name="Name">[oButtonex21]</property>
        <property name="Caption">[&amp;7.NFe referente a um Cupom Fiscal]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[wFgVaiGerarNFE:=(xGetEnv("NFE_TRANSMITE_APOS_DIGITACAO")="S")
vb_venda("MN1",,,,,"/PN/")
wFgVaiGerarNFE:=.f.
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{209,298,184,46}</property>
        <property name="Name">[oButtonex22]</property>
        <property name="Caption">[&amp;8.NFe referente a varios Cupons Fiscais]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MN2",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,413,174,46}</property>
        <property name="Name">[oBtnOutraS]</property>
        <property name="Caption">[&amp;A.Outras Saidas]</property>
        <property name="font">
          <font name="Arial" width="0" height="-16" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MO1",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,461,174,46}</property>
        <property name="Name">[oBtnOutraE]</property>
        <property name="Caption">[&amp;B.Outras Entradas]</property>
        <property name="font">
          <font name="Arial" width="0" height="-16" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MO2",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{12,348,184,46}</property>
        <property name="Name">[oButtonex15]</property>
        <property name="Caption">[&amp;9.NFe de Remessa a Venda no Estado]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MR1",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{209,348,184,46}</property>
        <property name="Name">[oButtonex28]</property>
        <property name="Caption">[&amp;0.NFe de Remessa a Venda InterEstadual]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-15" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[vb_venda("MR2",,,,,"/PN/")
eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{209,28,183,46}</property>
        <property name="Name">[oButtonex31]</property>
        <property name="Caption">[NFE Complementar]</property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-16" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">[Emite Nota Complementar]</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[wFgVaiGerarNFEcomplementar:=.t.
wFgVaiGerarNFE:=(xGetEnv("NFE_TRANSMITE_APOS_DIGITACAO")="S")
vb_venda("MV",,,,,"/PN/")
wFgVaiGerarNFE:=.f.
wFgVaiGerarNFEcomplementar:=.f.

eVal(zbProximosNumeros)]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{209,78,183,68}</property>
        <property name="Name">[oButtonex30]</property>
        <property name="Caption">
[NFE Entrada Ref. Cancelamento NFC NFE fora do prazo]        </property>
        <property name="font">
          <font name="Segoe UI Emoji" width="0" height="-16" weight="700"/>
        </property>
        <property name="WordWrap">.T.</property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">[Gera NFe de ajuste]</property>
        <property name="TabIndex">14</property>
      </style>
      <method name="onClick">
        <![CDATA[wFgVaiGerarNFErefCancelamento:=.t.
wFgVaiGerarNFE:=(xGetEnv("NFE_TRANSMITE_APOS_DIGITACAO")="S")
vb_venda("ME3",,,,,"/PN/")
wFgVaiGerarNFE:=.f.

eVal(zbProximosNumeros)]]>
      </method>
    </part>
  </part>
  <part class="group">
    <style>
      <property name="Geometry">{796,90,199,371}</property>
      <property name="Name">[oGroup2]</property>
      <property name="Caption">[Cadastros Relacionados]</property>
      <property name="Transparent">.T.</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">24</property>
    </style>
    <part class="buttonex">
      <style>
        <property name="Geometry">{803,162,185,46}</property>
        <property name="Name">[oButtonex9]</property>
        <property name="Caption">[CEPs]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">
[Cadastro de Logradouros do Brasil, emitido pela empresa Correios e Telegrafos do Brasil]        </property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[CiBrow("LOGRA")]]>
      </method>
      <part class="icon">
        <style>
          <property name="Geometry">{809,169,32,32}</property>
          <property name="Name">[oIcon4]</property>
          <property name="Icon">[icon\produto.ico]</property>
        </style>
      </part>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{803,209,185,46}</property>
        <property name="Name">[oButtonex10]</property>
        <property name="Caption">[CFOPS]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">[Exibe e Edita o Cadastro de CFOPs]</property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[CiBrow("SF_CODOP")]]>
      </method>
      <part class="icon">
        <style>
          <property name="Geometry">{809,215,32,32}</property>
          <property name="Name">[oIcon5]</property>
          <property name="Icon">[icon\cfops.ico]</property>
        </style>
      </part>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{803,256,185,46}</property>
        <property name="Name">[oButtonex2]</property>
        <property name="Caption">[Municipios]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">[Cadastro de Cidades no IBGE]</property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[CiBrow("vb_munic")]]>
      </method>
      <part class="icon">
        <style>
          <property name="Geometry">{809,263,32,32}</property>
          <property name="Name">[oIcon6]</property>
          <property name="Icon">[icon\cidades.ico]</property>
        </style>
      </part>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{803,114,185,46}</property>
        <property name="Name">[oButtonex6]</property>
        <property name="Caption">[Transportadores]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">[Cadastro de Transportadores da NFe]</property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[CiBrow("SF_TRN")]]>
      </method>
      <part class="icon">
        <style>
          <property name="Geometry">{809,121,32,32}</property>
          <property name="Name">[oIcon3]</property>
          <property name="Icon">[icon\transportador.ico]</property>
        </style>
      </part>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{803,358,185,46}</property>
        <property name="Name">[oButtonex13]</property>
        <property name="Caption">[CFOPs Padroes Ent/Sai]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">
[Define as CFOPs padroes a ser usadas nas Vendas, Compras, Transferencias, etc... de acordo com a categoria fiscal do produto...]        </property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[CiBrow("nftipoit")]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{803,407,185,46}</property>
        <property name="Name">[oButtonex14]</property>
        <property name="Caption">[Regime Tributacao]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">
[Define as Taxas Tributarias e CSTs ICMS, PIS, COFINS, IPI, etc...]        </property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[NfeDefaults('CONFIGURA')]]>
      </method>
    </part>
    <part class="buttonex">
      <style>
        <property name="Geometry">{803,309,185,46}</property>
        <property name="Name">[oButtonex23]</property>
        <property name="Caption">[Dados Emitente]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">
[Cadastra dados do Emitente, da Empresa Usuaria do sistema]        </property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[IdUsuarioPaf('Gravar')
CiBrow("ef_s10")
CiBrow("ef_s11")
CiBrow("ef_s8805")]]>
      </method>
      <part class="icon">
        <style>
          <property name="Geometry">{809,316,32,32}</property>
          <property name="Name">[oIcon7]</property>
          <property name="Icon">[icon\emitente.ico]</property>
        </style>
      </part>
    </part>
  </part>
  <part class="group">
    <style>
      <property name="Geometry">{407,7,110,133}</property>
      <property name="Name">[oGroup2]</property>
      <property name="Transparent">.T.</property>
      <property name="font">
        <font name="Arial" width="0" height="-13" weight="400"/>
      </property>
      <property name="TabIndex">24</property>
    </style>
    <part class="buttonex">
      <style>
        <property name="Geometry">{418,41,90,91}</property>
        <property name="Name">[oButtonex8]</property>
        <property name="Caption">[]</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Bitmap">[icon\cadastros.jpg]</property>
        <property name="Icon">[icon\clientes.ico]</property>
        <property name="Transparent">.T.</property>
        <property name="ToolTip">[Produtos, Clientes, Fornecedores, etc]</property>
        <property name="TabIndex">1</property>
      </style>
      <method name="onClick">
        <![CDATA[ExecutaXML("btncadastro")]]>
      </method>
    </part>
    <part class="label">
      <style>
        <property name="Geometry">{411,20,104,19}</property>
        <property name="Name">[oLabel1]</property>
        <property name="Caption">[Cadastros]</property>
        <property name="Justify">[Center]</property>
        <property name="TextColor">4194304</property>
        <property name="font">
          <font name="Arial" width="0" height="-13" weight="400"/>
        </property>
        <property name="Transparent">.T.</property>
        <property name="TabIndex">26</property>
      </style>
    </part>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{539,543,92,19}</property>
      <property name="Name">[oLabel6]</property>
      <property name="Caption">[Proxima NFe :]</property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">29</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{539,565,100,19}</property>
      <property name="Name">[oLabel7]</property>
      <property name="Caption">[Proxima NFCe:]</property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">29</property>
    </style>
    <method name="onInit">
      <![CDATA[//skel variavel zProxNFe:=0
//skel variavel zProxNFC:=0
//skel variavel zProxNFs:=0
//skel variavel zbProximosNumeros:={||#TEXTO_FONTE
//skel 

zProxNFe := SiSemaf("CAPTE_PROXIMO_NUMERO", "/NFE/")
zProxNFc := SiSemaf("CAPTE_PROXIMO_NUMERO", "/NFC/") 



//MoveWindow(oDlg:Handle, 0,0,1019,547)
IF .not. sFgNFC
   oContainerNFCNFE:Hide() 
ENDIF
if xGetEnv("FATURA_SERVICOS")<>"S"
   oBtnOs:Hide()
   oBtnFecharOs:Hide()
   oBtnFatNFE:Hide()
   oBtnFatNFC:Hide()
   oBtnOutraS:Move( ,,oBtnVenda:nWidth, )   
   oBtnOutraE:Move( ,,oBtnVenda:nWidth, )   
ELSE
   IF LEFT(sys_segmento,2)<>'os'
      oBtnOs:SetText("Criar Orcamento")
      oBtnFecharOs:SetText("Fechar Orcamento")
   ENDIF
ENDIF]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{643,540,80,22}</property>
      <property name="Name">[oProxNFe]</property>
      <property name="varName">[zProxNfe]</property>
      <property name="cPicture">[999999999]</property>
      <property name="nMaxLength">9</property>
      <property name="TabIndex">30</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.F.]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{643,563,80,22}</property>
      <property name="Name">[oProxNFC]</property>
      <property name="varName">[zProxNFC]</property>
      <property name="cPicture">[999999999]</property>
      <property name="nMaxLength">9</property>
      <property name="TabIndex">30</property>
    </style>
    <method name="onLostFocus">
      <![CDATA[ExecutaXML("dlgconfig_nfe")]]>
    </method>
    <method name="onGetFocus">
      <![CDATA[.F.]]>
    </method>
  </part>
</part>
