Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Impresión (https://www.clubdelphi.com/foros/forumdisplay.php?f=4)
-   -   Impresora Fiscal BMC-Camel térmica (https://www.clubdelphi.com/foros/showthread.php?t=47006)

sitrico 16-08-2007 01:13:36

Impresora Fiscal BMC-Camel térmica
 
Mi primer mensaje como usuario Premium :)

Estoy tratando de imprimir ticket fiscales usando una impresora CAMEL de BMC.

Se requiere una dll que debe implementarse en la aplicacion 'FpCtrl.dll'

dejo las declaraciones para que otros no sufran tanto.

Código Delphi [-]
// Estas librerías se encuentran declaradas en el dll de control de
// la impresora Fiscal FpCtrl.dll Ver: 1.0.0.1 bajada de internet

function OpenFpctrl(lpPortName: string): LongInt; stdcall; external 'FpCtrl.dll';
function CloseFpctrl: LongInt; stdcall; external 'FpCtrl.dll';
function CheckFprinter: LongInt; stdcall; external 'FpCtrl.dll';
function ReadFpStatus(Var Status,Error : LongInt): LongInt; stdcall; external 'FpCtrl.dll';
function SendCmd(Var Status,Error : LongInt; cmd : String): LongInt; stdcall; external 'FpCtrl.dll';
function SendNCmd(var Status,Error : LongInt; buffer : String): LongInt; stdcall; external 'FpCtrl.dll';
function SendFileCmd(var Status,Error : LongInt; FileName : String): LongInt; stdcall; external 'FpCtrl.dll';
function UploadReportCmd(Var Status,Error : LongInt; cmd, FileName : String): LongInt; stdcall; external 'FpCtrl.dll';

Const
// Result
CMD_OK = Byte(True);

//Status
FPCTL_NON_STATUS = $0;
FPCTL_NON_FISCAL_IN_IDLE = $1;
FPCTL_NON_FISCAL_IN_TRANSACTION = $2;
FPCTL_NON_FISCAL_NON_TRANSACTION = $3;
FPCTL_FISCAL_IN_IDLE = $4;
FPCTL_FISCAL_IN_TRANSACTION = $5;
FPCTL_FISCAL_NON_TRANSACTION = $6;
FPCTL_FISCAL_MEMORY_NEAR_FULL_IN_TRANSACTION = $7;
FPCTL_FISCAL_MEMORY_NEAR_FULL_NON_TRANSACTION = $8;
FPCTL_FISCAL_MEMORY_NEAR_FULL_IN_IDLE = $9;
FPCTL_FISCAL_MEMORY_FULL_IN_TRANSACTION = $A;
FPCTL_FISCAL_MEMORY_FULL_IN_NON_TRANSACTION = $B;
FPCTL_FISCAL_MEMORY_FULL_IN_IDLE = $C;
FPCTL_SENDNCMD_SUCCESS = $0;

// error
FPCTL_ERROR_NO_ERROR = $0;
FPCTL_ERROR_PAPER_END = $1;
FPCTL_ERROR_PRINTER_MECHA_ERROR = $2;
FPCTL_ERROR_PAPER_END_MECHA_ERROR = $3;
FPCTL_ERROR_COMMAND_INVALID_VAL = $50;
FPCTL_ERROR_COMMAND_INVALID_TAX = $54;
FPCTL_ERROR_NOT_ASSIGNED_CLERK = $58;
FPCTL_ERROR_INVALID_COMMAND = $5C;
FPCTL_ERROR_FISCAL_ERROR = $60;
FPCTL_ERROR_FISCAL_MEMORY_ERROR = $64;
FPCTL_ERROR_FISCAL_MEMORY_FULL = $6C;

FPCTL_ERROR_BUFFER_FULL = $70;
FPCTL_ERROR_ANSWERED_NAK = $80;
FPCTL_ERROR_NOT_ANSWERED = $89;
FPCTL_ERROR_UNKNOWN_ANSWERED = $90;
FPCTL_ERROR_COMM_API = $91;
FPCTL_ERROR_FILE_OPEN = $99;

// Comandos preprogramados por mí
CMD_TrainingOn = 'T1';
CMD_TrainingOff = 'T2';
CMD_ClerkLogOn = '5';
CMD_ClerkLogOff = '6';
CMD_TextPrint = '8  '; // dos espacios para sub cmd
CMD_ItemIva0 = Char($20);
CMD_ItemIva1 = Char($21);
CMD_ItemIva2 = Char($22);
CMD_ItemIva3 = Char($23);
CMD_SubTotalPrint = '3';
CMD_Cancel = '7';
CMD_InformacionCliente = 'i';

Básicamente con esto logro imprimir (en modo prueba) los tickets no fiscales pero para los fiscales sólo me funcionan si inicio y cierro el modo entrenamiento.

Lo que necesito es si alguien me puede enviar un ejemplo de la secuencia de comandos que se deben usar para imprimir un ticket fiscal (y no estaría de más uno no fiscal).

Algo como un seudocodigo:

Código Delphi [-]
Abrir puerto
verificar status
inicializar cajero
encabezados del ticket
itemsfiscales
subtotal
Total
Cerrarpuerto

he intentado cientos de combinaciones pero siempre me falla por uno u otra razon. Por ejem. no se puede generar un subtotal si no se han cargado items, no se pueden cargar items si es un ticket no fiscal y muchas más restricciones.

El manual que tengo no ayuda ABSOLUTAMENTE Nada, no tiene ejemplos utiles.

NOTA: D7+Firebird+FpCtrl.dll Ver: 1.0.0.1

- el &$%#"@# de las impresoras fiscales - :mad:


La franja horaria es GMT +2. Ahora son las 01:09:33.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi