vc fez tudo correto, so precisa agora criar as rotinas em C no padrão do xHarbour para que ele enchergue as rotinas, este arquivo já existe tem o nome de SIAR9998.C, nao sei se tiveram mudanças, mas usei a um ano e meio atras e tava tudo funcionando beleza, o arquivo é este abaixo, so colocar em um .C e colocar no seu makefile tambem
Código: Selecionar todos
/* ============================================================
* Biblioteca de Funcoes em Flagship interagindo com fonte em C
* da Biblioteca Lib300fi.a da BEMATECH, e LibNorteBema.c
* Com indicacao da literatura por Jorge Somers leia-se FSWEB.
* Data...: 19/04/2000
* Codigo Escrito por Frank Sipoli / Manoel (Manvfran)
* =========================================================== */
#include "hbapi.h"
#include "stdio.h"
#include "string.h"
/* --------------------------------------- *
* Funcao para abrir porta serial recebendo
* parametro externo de um fonte .prg
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_ABREPORTASERIAL) {
unsigned char *nporta;
int erro;
char Var[3000];
memset(Var, '\x0',3000);
nporta = hb_parc(1);
if (( erro = Bematech_FI_AbrePortaSerial(nporta)) != 0 ) {
// Var[0] =(char) (erro);
hb_retni(erro);
}
// Var[0] =(char) (erro);
hb_retni(erro);
}
/* --------------------------------------- *
* Funcao para fechar porta serial
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_FECHAPORTA) {
int erro;
char Var[3000];
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_FechaPorta()) != 0 ) {
hb_ret();
}
}
/* --------------------------------------- *
* Funcao para ver aliquotas cadastradas.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_LEITURAALIQUOTAS) {
char aliq [] = "|26|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_LeituraAliquotas(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver cgc cadastrado.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_CGCIE) {
char ncgc [] = "|35|2|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_CGCIE(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver o estado de pouco papel.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_MONITORAMENTOPAPEL) {
char npapel [] = "|62|54|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
Retorno[0] = 0; Retorno[1] = 0; Retorno[2] = 0; Retorno[3] = 0;
if (( erro = Bematech_FI_MonitoramentoPapel(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver numero do caixa
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_NUMEROCAIXA) {
char term [] = "|35|14|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_NumeroCaixa(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver numero da Loja responsavel
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_NUMEROLOJA) {
char term [] = "|35|14|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_NumeroLoja(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver numero do cupom fiscal
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_NUMEROCUPOM) {
char ncup [] = "|30|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_NumeroCupom(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para abrir cupom fiscal
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_ABRECUPOM) {
char acup [] = "|00|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_AbreCupom("", &Retorno)) != 0 ) {
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para enviar item ao cupom fiscal
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_VENDEITEM) {
int lng;
unsigned char *itemcf;
unsigned char *codig;
unsigned char *descri;
unsigned char *aliq;
unsigned char *quant;
unsigned char *valo;
unsigned char *descont;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
codig = hb_parc(1);
descri = hb_parc(2);
aliq = hb_parc(3);
quant = hb_parc(4);
valo = hb_parc(5);
descont = hb_parc(6);
if (( erro = Bematech_FI_VendeItem(codig,descri,aliq,quant,valo,descont, &Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para enviar item ao cupom fiscal
* Comandos FlagShip interno ao prog em C */
HB_FUNC( BEMATECH_FI_VENDEITEM3CASASVALOR) {
int lng;
unsigned char *itemcf;
unsigned char *codig;
unsigned char *descri;
unsigned char *aliq;
unsigned char *quant;
unsigned char *valo;
unsigned char *descont;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
codig = hb_parc(1);
descri = hb_parc(2);
aliq = hb_parc(3);
quant = hb_parc(4);
valo = hb_parc(5);
descont = hb_parc(6);
if (( erro = Bematech_FI_VendeItem3CasasValor(codig,descri,aliq,quant,valo,descont, &Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para totalizar o cupom fiscal
* Comandos FlagShip interno ao prog em C */
HB_FUNC( BEMATECH_FI_INICIAFECHAMENTOCUPOM) {
int lng;
unsigned char *ndesc;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
unsigned char *tpdesc;
unsigned char *vrdesc;
char Aux;
memset(Var, '\x0',3000);
tpdesc = hb_parc(1);
vrdesc = hb_parc(2);
if (( erro = Bematech_FI_IniciaFechamentoCupom(tpdesc,vrdesc,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver numero do cupom fiscal
* Comandos FlagShip interno ao prog em C */
HB_FUNC( BEMATECH_FI_TERMINAFECHAMENTOCUPOM) {
int lng;
unsigned char *msgvar;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
msgvar = hb_parc(1);
if (( erro = Bematech_FI_TerminaFechamentoCupom(msgvar,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para cancelar cupom fiscal anterior
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_CANCELACUPOM)
{
char ncanc [] = "|14|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var,'\x0',3000);
if (( erro = Bematech_FI_CancelaCupom(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para cancelar item anterior
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_CANCELAITEMANTERIOR) {
char stat [] = "|13|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_CancelaItemAnterior(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para consultar e cadastrar forma
* de pagamento retornando o indice na qual
* esta cadastrada na impressora fiscal.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_VERIFICAFORMAPAGAMENTO) {
int lng;
unsigned char *wcforma;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
wcforma = hb_parc(1);
if (( erro = Bematech_FI_VerificaFormaPagamento(wcforma, Var ,&Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para consultar forma de pgto de
* vendeer na forma p/ o cupom fiscal.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_EFETUAFORMAPAGAMENTO) {
unsigned char *indforma;
unsigned char *vrtota;
unsigned char *descri;
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
memset(Var, '\x0',3000);
indforma = hb_parc(1);
vrtota = hb_parc(2);
descri = hb_parc(3);
if (( erro =Bematech_FI_EfetuaFormaPagamento(indforma,vrtota,descri,&Retorno)) != 0 ) {
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para consultar forma de pgto de
* vendeer na forma p/ o cupom fiscal.
* Comandos FlagShip interno ao prog em C */
/*HB_FUNC(BEMATECH_FI_FORMAPAGAMENTOMP20FI) {
unsigned char *desco;
unsigned char *vrtota;
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
memset(Var, '\x0',3000);
desco = hb_parc(1);
vrtota = hb_parc(2);
if (( erro =Bematech_FI_FormaPagamentoMp20fi(desco,vrtota,&Retorno)) !=0 )
{
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
*/
/* --------------------------------------- *
* Funcao para emitir leitura X
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_LEITURAX) {
char aleix [] = "|06|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_LeituraX(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para emitir leitura X
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_LEITURAXSERIAL) {
char aleix [] = "|06|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_LeituraXSerial(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para efetuar reducao Z
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_REDUCAOZ) {
char aredz [] = "|05|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_ReducaoZ(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para cadastrar aliquota na IMP
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_ADICIONAALIQUOTA) {
int lng;
int Retorno[4];
unsigned char *aliqu;
unsigned char *temiss;
int erro, cond;
char resp [1024];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
Retorno[0] = 0; Retorno[1] = 0; Retorno[2] = 0; Retorno[3] = 0;
aliqu = hb_parc(1);
temiss = hb_parc(2);
if (( erro = Bematech_FI_AdicionaAliquota(aliqu,temiss,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para abrir cupom nao fiscal
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 08/09/2000 */
HB_FUNC( BEMATECH_FI_ABRECOMPROVANTENAOFISCALVINCULADO) {
int lng;
unsigned char *formapgt;
unsigned char *wn_valor;
unsigned char *wn_cupom;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
formapgt = hb_parc(1);
wn_valor = hb_parc(2);
wn_cupom = hb_parc(3);
if (( erro = Bematech_FI_AbreComprovanteNaoFiscalVinculado(formapgt,wn_valor,wn_cupom, &Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para imprimir o cupom nao fiscal
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 08/09/2000 */
HB_FUNC( BEMATECH_FI_USACOMPROVANTENAOFISCALVINCULADO) {
int lng;
unsigned char *finalcup;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
finalcup = hb_parc(1);
if (( erro = Bematech_FI_UsaComprovanteNaoFiscalVinculado(finalcup, &Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para fechar Cupom nao Fiscal
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 08/09/2000 */
HB_FUNC(BEMATECH_FI_FECHACOMPROVANTENAOFISCALVINCULADO) {
char ncgc [] = "|21|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_FechaComprovanteNaoFiscalVinculado(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver a ultima reducao Z.
* Comandos FlagShip interno ao prog em C */
HB_FUNC( BEMATECH_FI_DADOSULTIMAREDUCAO) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_DadosUltimaReducao(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver os Totalizadores Parciais.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_LEITURATOTALIZADORESPARCIAIS) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_LeituraTotalizadoresParciais(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver os Totalizadores Parciais.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(SUBTOTAL_C) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_SubTotal(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver os Totalizadores Parciais.
* Comandos FlagShip interno ao prog em C */
HB_FUNC( BEMATECH_FI_NUMEROREDUCOES) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_NumeroReducoes(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver os Totalizadores Parciais.
* Comandos FlagShip interno ao prog em C */
HB_FUNC( BEMATECH_FI_FLAGSISS) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_FlagsISS(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver os Totalizadores Parciais.
* Comandos FlagShip interno ao prog em C */
HB_FUNC( BEMATECH_FI_FLAGSFISCAIS) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_FlagsFiscais(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para imprimir a leitura memoria fiscal por data
* recebendo a data inicial e final
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 09/06/2001 */
HB_FUNC(BEMATECH_FI_LEITURAMEMORIAFISCALDATA) {
int lng;
unsigned char *dtini;
unsigned char *dtfim;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
dtini = hb_parc(1);
dtfim = hb_parc(2);
if (( erro = Bematech_FI_LeituraMemoriaFiscalData(dtini,dtfim,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para imprimir a leitura memoria fiscal por data pela saida serial
* recebendo a data inicial e final
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 09/06/2001 */
HB_FUNC(BEMATECH_FI_LEITURAMEMORIADISCALDATASERIAL) {
int lng;
unsigned char *dtini;
unsigned char *dtfim;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
dtini = hb_parc(1);
dtfim = hb_parc(2);
if (( erro = Bematech_FI_LeituraMemoriaFiscalDataSerial(dtini,dtfim,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/*--------------------------------------------------------------------------
* Funcao para imprimir a leitura memoria fiscal por reducao
* recebendo o numero inicial e final
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 09/06/2001 */
HB_FUNC( BEMATECH_FI_LEITURAMEMORIAFISCALREDUCAO) {
int lng;
unsigned char *rdzini;
unsigned char *rdzfim;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
rdzini = hb_parc(1);
rdzfim = hb_parc(2);
if (( erro = Bematech_FI_LeituraMemoriaFiscalReducao(rdzini,rdzfim,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/*--------------------------------------------------------------------------
* Funcao para imprimir a leitura memoria fiscal por reducao pela serial
* recebendo o numero inicial e final
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 09/06/2001 */
HB_FUNC( BEMATECH_FI_LEITURAMEMORIAFISCALREDUCAOSERIAL) {
int lng;
unsigned char *rdzini;
unsigned char *rdzfim;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
rdzini = hb_parc(1);
rdzfim = hb_parc(2);
if (( erro = Bematech_FI_LeituraMemoriaFiscalReducaoSerial(rdzini,rdzfim,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/*--------------------------------------------------------------------------
* Funcao para testar o estado da impressora fiscal
* retornando ACK, ST1 e ST2
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 19/06/2001 */
HB_FUNC(BEMATECH_FI_ESTADOIMPRESSORA) {
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_EstadoImpressora(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/*--------------------------------------------------------------------------
* Funcao para ler o numero de serie da impressora fiscal
* retornando variavel com 16 caracteres
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 04/07/2001 */
HB_FUNC( BEMATECH_FI_NUMEROSERIE) {
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_NumeroSerie(Var,&Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/*--------------------------------------------------------------------------
* Funcao para ler a data e a hora da impressora Fiscal
* retornando variavel com 13 caracteres
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 26/07/2001 */
HB_FUNC(BEMATECH_FI_DATAHORA) {
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_DataHora(Var,&Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para impressao do Relatorio Gerencial
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 25/09/2001 */
HB_FUNC( BEMATECH_FI_RELATORIOGERENCIAL) {
char ncgc [] = "|21|";
int erro, cond;
char resp [1024];
unsigned char *txtger;
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
txtger = hb_parc(1);
if (( erro = Bematech_FI_RelatorioGerencial(txtger,&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para Fechamento do Relatorio Gerencial
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 25/09/2001 */
HB_FUNC( BEMATECH_FI_FECHARELATORIOGERENCIAL) {
char ncgc [] = "|21|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_FechaRelatorioGerencial(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/*--------------------------------------------------------------------------
* Funcao para programar o horario de verao da impressora Fiscal
* retornando variavel com 13 caracteres
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 26/07/2001 */
HB_FUNC(BEMATECH_FI_PROGRAMAHORARIOVERAO) {
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_ProgramaHorarioVerao(Var,&Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/*--------------------------------------------------------------------------
* Funcao para verificar se a Impressora Fiscal esta com a opcao Truncamento
* ativa [1=sim 2=nao]
* retornando variavel com 13 caracteres
* Comandos FlagShip interno ao prog em C
* Manoel Vicente 26/07/2001 */
HB_FUNC(BEMATECH_FI_PROGRAMATRUNCAMENTO) {
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_ProgramaTruncamento(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
HB_FUNC( BEMATECH_FI_PROGRAMAARREDONDAMENTO) {
int lng;
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_ProgramaArredondamento(&Retorno)) != 0 ) {
hb_ret();
}
Var[0] = (char)(Retorno[0]);
Var[1] = (char)(Retorno[1]);
Var[2] = (char)(Retorno[2]);
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver a data da ultima reducao Z.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(BEMATECH_FI_DATAULTIMAREDUCAO) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_DataUltimaReducao(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/* --------------------------------------- *
* Funcao para ver a data do movimento.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(DTMOVIM_C) {
char ncgc [] = "|62|55|";
int erro, cond;
char resp [1024];
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
if (( erro = Bematech_FI_DataMovimento(Var, &Retorno)) != 0 ) {
hb_ret();
}
hb_retc(Var);
}
/*HB_FUNC(LERARQC) {
int lng;
unsigned char *nporta,*xfile,*nfile;
int erro, cond;
int ptr;
unsigned char *resp[101];
char *pxarq;
int Retorno[4];
char Var[3000];
char Aux;
memset(Var, '\x0',3000);
resp[0] = 0;
resp[1] = hb_parc(1);
resp[2] = hb_parc(2);
if (( erro = Siar_FI_Leitura(2,hb_parc(1) ,hb_parc(2))) != 0 ) {
hb_ret();
}
hb_ret();
}
*/
/* --------------------------------------- *
* Funcao para ver a data do movimento.
* Comandos FlagShip interno ao prog em C */
HB_FUNC(LERARQ_C)
{ int count,c;
FILE *IPFile;
FILE *OPFile;
IPFile = fopen(hb_parc(1),"r");
OPFile = fopen(hb_parc(2),"w");
while ((c = fgetc(IPFile)) != EOF) { fputc(c, OPFile); }
fclose(IPFile);
fclose(OPFile);
hb_ret();
}