29 Jun 2020 13:30
Pois é, agora eles estão ficando igual a SefazClass de 10 anos atrás, que aliás, nem é DLL, é no próprio fonte.
Interface de Programação de Aplicações ou Interface de Programação de Aplicação), cuja sigla API provém do Inglês Application Programming Interface, é um ...
29 Jun 2020 13:52
29 Jun 2020 13:59
Usando as Classes de Alto Nível.
Para os usuários SAC existe um recurso ainda mais poderoso para se trabalhar com o ACBrLib, que seriam, as Classes de Alto Nível as quais farão a comunicação entre sua aplicação e as bibliotecas ACBr, com elas é possível utilizar os comandos de forma mais simples sem qualquer preocupação com as chamadas diretas das bibliotecas ACBr.
29 Jun 2020 14:12
29 Jun 2020 14:18
que seriam, as Classes de Alto Nível as quais farão a comunicação entre sua aplicação e as bibliotecas ACBr,
29 Jun 2020 14:22
Public Sub InicializarLib(Optional ByVal eArqConfig As String = "", _
Optional ByVal eChaveCrypt As String = "")
SetLibPath
Dim retorno As Long
retorno = NFE_Inicializar(eArqConfig, eChaveCrypt)
CheckResult retorno
End Sub
29 Jun 2020 14:26
METHOD New(eArqConfig, eChaveCrypt) CLASS ACBrNFe
local hResult, buffer, bufferLen, oErr
eArqConfig :=if(eArqConfig = nil, '', eArqConfig)
eChaveCrypt:=if(eChaveCrypt = nil, '', eChaveCrypt)
::hHandle := DllLoad(ACBrLIB)
if EMPTY(::hHandle) // Eric.Developer: xHarbour retorna 0x00000000
oErr := ErrorNew()
oErr:Severity := ES_ERROR
oErr:Description := "Erro a carregar a dll [" + ACBrLIB + "]"
Throw(oErr)
endif
hResult := DllCall(::hHandle, DLL_OSAPI, "NFE_Inicializar", hb_StrToUTF8(eArqConfig), hb_StrToUTF8(eChaveCrypt))
::CheckResult(hResult)
RETURN Self
29 Jun 2020 14:39
Function Main ()
local nfe
nfe := ACBrNFe():New()
nfe:ConfigGravarValor("Principal", "LogNivel", "4") // logParanoico
nfe:ConfigGravarValor("Principal", "LogPath", hb_dirBase() + "Logs")
nfe:ConfigGravar()
nfe:CarregarXML(hb_dirBase() + "nfe.xml")
nfe:Imprimir("", 1, "", "True", hb_dirBase() + "rftd.jpg", "", "")
?nfe:Nome
?nfe:Versao
return NIL
29 Jun 2020 14:50
29 Jun 2020 15:05
29 Jun 2020 22:00
29 Jun 2020 22:26
Itamar M. Lins Jr. escreveu:Isso eu já tinha visto... Tô levantado a questão aqui no grupo...
Pq estão usando a contrib do Pritpal Bedi para isso ?
27 Out 2020 10:07
#include 'FIVEWIN.CH'
#define DLL_CDECL 0x08
#define DLL_STDCALL 0x20
#define DLL_SYSTEM 0x04
#define STR_LEN 256
function Main()
local oWnd
define window oWnd from 5,5 to 30,85 title "ACBrLib Teste"
@ 3,10 BUTTON "Imprime NF-e" size 100,50 OF oWnd ACTION ImprimirNFE()
@ 3,40 BUTTON "Imprime SAT" size 100,50 OF oWnd ACTION ImprimirSAT()
set message of oWnd to "Teste ACBrLib" date time noinset
activate window oWnd centered
return nil
static function ImprimirNFE(eArquivoOuXml, cImpressora, nNumCopias, cProtocolo, bMostrarPreview, cMarcaDagua, bViaConsumidor, bSimplificado)
local hResult, bufferLen, buffer, oErr
local oDll := DllLoad( 'ACBrNFe32.dll' )
eArquivoOuXml := if(eArquivoOuXml=nil, "acbrnfe.xml", eArquivoOuXml)
cImpressora := if(cImpressora=nil, "", cImpressora)
nNumCopias := if(nNumCopias=nil, 1, nNumCopias)
cProtocolo := if(cProtocolo=nil, "", cProtocolo)
bMostrarPreview := if(bMostrarPreview=nil, "True", bMostrarPreview)
cMarcaDagua := if(cMarcaDagua=nil, "", cMarcaDagua)
bViaConsumidor := if(bViaConsumidor=nil, "", bViaConsumidor)
bSimplificado := if(bSimplificado=nil, "", bSimplificado)
hResult := DllCall(oDll, DLL_STDCALL, "NFE_Inicializar", hb_StrToUTF8("ACBrLib.Ini"), hb_StrToUTF8(""))
hResult := DllCall(oDll, DLL_STDCALL, "NFE_CarregarXML", hb_StrToUTF8(eArquivoOuXml))
hResult := DllCall(oDll, DLL_STDCALL, "NFE_Imprimir", hb_StrToUTF8(cImpressora), nNumCopias, hb_StrToUTF8(cProtocolo), hb_StrToUTF8(bMostrarPreview), hb_StrToUTF8(cMarcaDagua), hb_StrToUTF8(bViaConsumidor), hb_StrToUTF8(bSimplificado))
if !Empty(hResult)
bufferLen := STR_LEN
buffer := Space(bufferLen)
oErr := DllCall(oDll, DLL_STDCALL, "NFE_UltimoRetorno", @buffer, @bufferLen)
MsgStop(buffer, "Erro: "+Str(hResult))
endif
DllCall(oDll, DLL_STDCALL, "NFE_Finalizar")
DllUnload(oDll)
return nil
static function ImprimirSAT(eArquivoOuXml, cImpressora)
local hResult, bufferLen, buffer, oErr
local oDll := DllLoad( 'ACBrSat32.dll' )
eArquivoOuXml := if(eArquivoOuXml=nil, "acbrsat.xml", eArquivoOuXml)
cImpressora := if(cImpressora=nil, "", cImpressora)
hResult := DllCall(oDll, DLL_STDCALL, "SAT_Inicializar", hb_StrToUTF8("ACBrLib.Ini"), hb_StrToUTF8(""))
hResult := DllCall(oDll, DLL_STDCALL, "SAT_ImprimirExtratoVenda", hb_StrToUTF8(eArquivoOuXml), hb_StrToUTF8(cImpressora))
if !Empty(hResult)
bufferLen := STR_LEN
buffer := Space(bufferLen)
oErr := DllCall(oDll, DLL_STDCALL, "SAT_UltimoRetorno", @buffer, @bufferLen)
MsgStop(buffer, "Erro: "+Str(hResult))
endif
DllCall(oDll, DLL_STDCALL, "SAT_Finalizar")
DllUnload(oDll)
return nil
27 Out 2020 10:11
27 Out 2020 14:54