first commit (2008-08-30)

This commit is contained in:
José David Guillén 2021-09-01 17:59:47 +02:00
commit 30ccf458a0
24 changed files with 2934 additions and 0 deletions

4
bin/cfg.ini Normal file
View File

@ -0,0 +1,4 @@
[www.infdj.com]
puerto=COM1
ticket_header= "Nombre de la Empresa","Otros datos",,,"Ticket de caja",,------------------
ticket_footer= ,,"Gracias por su Visita.",,,

BIN
bin/imprimirTicket.exe Normal file

Binary file not shown.

BIN
bin/imprimirTicket.tds Normal file

Binary file not shown.

157
imprimirTicket.bpr Normal file
View File

@ -0,0 +1,157 @@
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.06.00"/>
<PROJECT value="bin\imprimirTicket.exe"/>
<OBJFILES value="obj\imprimirTicket.obj obj\imprimirTicket_main.obj"/>
<RESFILES value="imprimirTicket.res"/>
<IDLFILES value=""/>
<IDLGENFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES) imprimirTicket_main.dfm"/>
<LIBFILES value=""/>
<LIBRARIES value="rtl.lib vcl.lib"/>
<SPARELIBS value="vcl.lib rtl.lib"/>
<PACKAGES value="vcl.bpi rtl.bpi dbrtl.bpi adortl.bpi vcldb.bpi vclx.bpi bdertl.bpi
vcldbx.bpi ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi teeui.bpi teedb.bpi
tee.bpi dss.bpi visualclx.bpi visualdbclx.bpi dsnapcrba.bpi dsnapcon.bpi
bcbsmp.bpi vclie.bpi xmlrtl.bpi inet.bpi inetdbbde.bpi inetdbxpress.bpi
inetdb.bpi nmfast.bpi webdsnap.bpi bcbie.bpi websnap.bpi soaprtl.bpi
dclocx.bpi dbexpress.bpi dbxcds.bpi indy.bpi bcb2kaxserver.bpi JDsoft.bpi
TVidGrab.bpi ZComponent.bpi ZPlain.bpi ZCore.bpi ZDbc.bpi ZParseSql.bpi
QR4RunC6.bpi"/>
<PATHCPP value=".;"/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
<USERDEFINES value="_DEBUG"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="imprimirTicket.cpp"/>
<INCLUDEPATH value="&quot;C:\Archivos de programa\Borland\CBuilder6\Projects&quot;;&quot;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src&quot;;$(BCB)\include;$(BCB)\include\vcl"/>
<LIBPATH value="&quot;C:\Archivos de programa\Borland\CBuilder6\Projects&quot;;C:\programacion\VCLs\lib;&quot;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src&quot;;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;C:\programacion\VCLs\TVidGrab"/>
<WARNINGS value="-w-par"/>
<OTHERFILES value=""/>
</MACROS>
<OPTIONS>
<IDLCFLAGS value="-I&quot;C:\Archivos de programa\Borland\CBuilder6\Projects&quot;
-I&quot;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src&quot;
-I$(BCB)\include -I$(BCB)\include\vcl -src_suffix cpp -D_DEBUG -boa"/>
<CFLAG1 value="-Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
-tW -tWM"/>
<PFLAGS value="-N2obj -N0obj -$YD -$W -$O- -$A8 -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zi"/>
<LFLAGS value="-lobj -Iobj -D&quot;&quot; -aa -Tpe -x -Gn -v"/>
<OTHERFILES value=""/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
<OTHERFILES value=""/>
</LINKER>
<FILELIST>
<FILE FILENAME="imprimirTicket.res" FORMNAME="" UNITNAME="imprimirTicket.res" CONTAINERID="ResTool" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="imprimirTicket.cpp" FORMNAME="" UNITNAME="imprimirTicket" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="imprimirTicket_main.cpp" FORMNAME="Form1" UNITNAME="imprimirTicket_main" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
</FILELIST>
<BUILDTOOLS>
</BUILDTOOLS>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1034
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Excluded Packages]
c:\archivos de programa\borland\cbuilder6\Bin\dclqrt60.bpl=QuickReport Components
c:\archivos de programa\borland\cbuilder6\Bin\dcltqr60.bpl=TeeChart for QuickReport Components
[HistoryLists\hlIncludePath]
Count=1
Item0=C:\Archivos de programa\Borland\CBuilder6\Projects;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src;$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=2
Item0=C:\Archivos de programa\Borland\CBuilder6\Projects;C:\programacion\VCLs\lib;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;C:\programacion\VCLs\TVidGrab
Item1=C:\Archivos de programa\Borland\CBuilder6\Projects;C:\programacion\VCLs\lib;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=1
Item0=_DEBUG
[HistoryLists\hlIntOutputDir]
Count=1
Item0=obj
[HistoryLists\hlFinalOutputDir]
Count=2
Item0=bin\
Item1=bin
[HistoryLists\hIBPIOutputDir]
Count=1
Item0=obj
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=
Launcher=
UseLauncher=0
DebugCWD=
HostApplication=
RemoteHost=
RemotePath=
RemoteLauncher=
RemoteCWD=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=1
LinkCGLIB=0
[CORBA]
AddServerUnit=1
AddClientUnit=1
PrecompiledHeaders=1
[Language]
ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
</PROJECT>

33
imprimirTicket.cpp Normal file
View File

@ -0,0 +1,33 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("imprimirTicket_main.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------

BIN
imprimirTicket.res Normal file

Binary file not shown.

157
imprimirTicket.~bpr Normal file
View File

@ -0,0 +1,157 @@
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.06.00"/>
<PROJECT value="bin\imprimirTicket.exe"/>
<OBJFILES value="obj\imprimirTicket.obj obj\imprimirTicket_main.obj"/>
<RESFILES value="imprimirTicket.res"/>
<IDLFILES value=""/>
<IDLGENFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES) imprimirTicket_main.dfm"/>
<LIBFILES value=""/>
<LIBRARIES value="rtl.lib vcl.lib"/>
<SPARELIBS value="vcl.lib rtl.lib"/>
<PACKAGES value="vcl.bpi rtl.bpi dbrtl.bpi adortl.bpi vcldb.bpi vclx.bpi bdertl.bpi
vcldbx.bpi ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi teeui.bpi teedb.bpi
tee.bpi dss.bpi visualclx.bpi visualdbclx.bpi dsnapcrba.bpi dsnapcon.bpi
bcbsmp.bpi vclie.bpi xmlrtl.bpi inet.bpi inetdbbde.bpi inetdbxpress.bpi
inetdb.bpi nmfast.bpi webdsnap.bpi bcbie.bpi websnap.bpi soaprtl.bpi
dclocx.bpi dbexpress.bpi dbxcds.bpi indy.bpi bcb2kaxserver.bpi JDsoft.bpi
TVidGrab.bpi ZComponent.bpi ZPlain.bpi ZCore.bpi ZDbc.bpi ZParseSql.bpi
QR4RunC6.bpi"/>
<PATHCPP value=".;"/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
<USERDEFINES value="_DEBUG"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="imprimirTicket.cpp"/>
<INCLUDEPATH value="&quot;C:\Archivos de programa\Borland\CBuilder6\Projects&quot;;&quot;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src&quot;;$(BCB)\include;$(BCB)\include\vcl"/>
<LIBPATH value="&quot;C:\Archivos de programa\Borland\CBuilder6\Projects&quot;;C:\programacion\VCLs\lib;&quot;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src&quot;;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;C:\programacion\VCLs\TVidGrab"/>
<WARNINGS value="-w-par"/>
<OTHERFILES value=""/>
</MACROS>
<OPTIONS>
<IDLCFLAGS value="-I&quot;C:\Archivos de programa\Borland\CBuilder6\Projects&quot;
-I&quot;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src&quot;
-I$(BCB)\include -I$(BCB)\include\vcl -src_suffix cpp -D_DEBUG -boa"/>
<CFLAG1 value="-Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
-tW -tWM"/>
<PFLAGS value="-N2obj -N0obj -$YD -$W -$O- -$A8 -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zi"/>
<LFLAGS value="-lobj -Iobj -D&quot;&quot; -aa -Tpe -x -Gn -v"/>
<OTHERFILES value=""/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
<OTHERFILES value=""/>
</LINKER>
<FILELIST>
<FILE FILENAME="imprimirTicket.res" FORMNAME="" UNITNAME="imprimirTicket.res" CONTAINERID="ResTool" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="imprimirTicket.cpp" FORMNAME="" UNITNAME="imprimirTicket" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="imprimirTicket_main.cpp" FORMNAME="Form1" UNITNAME="imprimirTicket_main" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
</FILELIST>
<BUILDTOOLS>
</BUILDTOOLS>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1034
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Excluded Packages]
c:\archivos de programa\borland\cbuilder6\Bin\dclqrt60.bpl=QuickReport Components
c:\archivos de programa\borland\cbuilder6\Bin\dcltqr60.bpl=TeeChart for QuickReport Components
[HistoryLists\hlIncludePath]
Count=1
Item0=C:\Archivos de programa\Borland\CBuilder6\Projects;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src;$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=2
Item0=C:\Archivos de programa\Borland\CBuilder6\Projects;C:\programacion\VCLs\lib;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib;C:\programacion\VCLs\TVidGrab
Item1=C:\Archivos de programa\Borland\CBuilder6\Projects;C:\programacion\VCLs\lib;C:\Documents and Settings\jd\Mis documentos\CBuilder\imprimirTicket\src;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=1
Item0=_DEBUG
[HistoryLists\hlIntOutputDir]
Count=1
Item0=obj
[HistoryLists\hlFinalOutputDir]
Count=2
Item0=bin\
Item1=bin
[HistoryLists\hIBPIOutputDir]
Count=1
Item0=obj
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=
Launcher=
UseLauncher=0
DebugCWD=
HostApplication=
RemoteHost=
RemotePath=
RemoteLauncher=
RemoteCWD=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=1
LinkCGLIB=0
[CORBA]
AddServerUnit=1
AddClientUnit=1
PrecompiledHeaders=1
[Language]
ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
</PROJECT>

33
imprimirTicket.~cpp Normal file
View File

@ -0,0 +1,33 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("src\imprimirTicket.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------

344
imprimirTicket_main.cpp Normal file
View File

@ -0,0 +1,344 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <StrUtils.hpp>
#include <inifiles.hpp>
#pragma hdrstop
#include "imprimirTicket_main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
#define min(a, b) (((a) < (b)) ? (a) : (b))
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
step = 0;
importeCobrar = 0;
importeEntrega = 0;
serial_port_connected = false;
importeTXT = "";
/* Advance mode */
/*
Articulo/s Uds Importe
---------------------------- --- -------
*/
sg->Cells[0][0] = "Articulo/s";
sg->Cells[1][0] = "Uds";
sg->Cells[2][0] = "Importe";
/****************/
}
//---------------------------------------------------------------------------
void __fastcall TForm1::addToNumber(AnsiString number)
{
if ( StrPos(importeTXT.c_str(), "," )==0 || number!="," )
importeTXT += number;
lcd->Caption = FormatFloat("#,##0.#0",importeTXT.ToDouble()) + "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btIntroClick(TObject *Sender)
{
switch( step )
{
case 0: stepLb->Caption = "Entrega:"; step++; lcd->Caption = "0.0 €"; importeCobrar = importeTXT.ToDouble(); importeEntrega = 0; importeTXT=""; break;
case 1: stepLb->Caption = "Cambio:"; step++; importeEntrega = importeTXT.ToDouble(); lcd->Caption = FormatFloat("#,##0.#0", (importeEntrega-importeCobrar) )+""; break;
case 2:
default:
imprimirTicket(importeCobrar,importeEntrega);
stepLb->Caption = "Importe:"; step=0; lcd->Caption = "0.0 €"; importeCobrar = 0; importeTXT=""; break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
addToNumber(",");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
addToNumber("0");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
addToNumber("3");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
addToNumber("2");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
addToNumber("1");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
addToNumber("6");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
addToNumber("5");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
addToNumber("4");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
addToNumber("9");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
addToNumber("8");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
addToNumber("7");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
importeTXT = "";
lcd->Caption = "0,0 €";
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::imprimirTicket(float importeCobrar, float importeEntrega)
{
if ( !serial_port_connected )
{
TIniFile *ini;
ini = new TIniFile( ExtractFileDir( Application->ExeName ) + "\\cfg.ini" );
puerto = ini->ReadString( "www.infdj.com", "PUERTO", "COM1" );
ticket_numberSufix = ini->ReadString( "www.infdj.com", "ticket_numberSufix", "" );
ticket_header = new TStringList;
ticket_header->CommaText = ini->ReadString( "www.infdj.com", "ticket_header", "" );
ticket_footer = new TStringList;
ticket_footer->CommaText = ini->ReadString( "www.infdj.com", "ticket_footer", "" );
delete ini;
serial_connect( puerto.c_str(),CBR_9600,NOPARITY,8,true );
}
AbreCajon();
int i;
for (i=0;i<ticket_header->Count;i++)
serial_sendLine( ticket_header->Strings[i] );
serial_sendLine( "Fecha: "+Now() );
serial_sendLine( "" );
serial_sendLine( Format( "Importe: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", importeEntrega), ticket_numberSufix )) ) );
serial_sendLine( "" );
serial_sendLine( "------------------------------" );
serial_sendLine( Format( "Entrega: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", importeEntrega), ticket_numberSufix )) ) );
serial_sendLine( Format( "Cambio: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", (importeEntrega-importeCobrar)), ticket_numberSufix )) ) );
serial_sendLine( "------------------------------" );
for (i=0;i<ticket_footer->Count;i++)
serial_sendLine( ticket_footer->Strings[i] );
}
// --------------------------------------------------------------------------
void __fastcall TForm1::AbreCajon()
{
char b[15];
b[0]=(char)0x1B; b[1]='p'; b[2]=0; b[3]=127; b[4]=127;
serial_sendData( b,5 );
}
//---------------------------------------------------------------------------
int __fastcall TForm1::serial_sendLine(AnsiString data)
{
data = "\r\n"+data;
return serial_sendData( data.c_str(), data.Length() );
}
//---------------------------------------------------------------------------
int __fastcall TForm1::serial_sendData(char *data,int length)
{
/*
int i,dev=-1;
for(i=0;dev!=0 && i<length;i++)
dev=TransmitCommChar( serial_hCom, data[i] );
*/
unsigned long int wt;
return WriteFile( serial_hCom,data,length,&wt,NULL);
// return dev;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::serial_disconnect()
{
if ( serial_port_connected )
{
CloseHandle( serial_hCom );
serial_hCom=0;
}
serial_port_connected = false;
}
//---------------------------------------------------------------------------
//, 9600, SERIAL_PARITY_NONE, 8, true);
void __fastcall TForm1::serial_connect(const char *port, int BaudRate,int Parity,char ByteSize, bool excl)
{
if ( serial_port_connected ) serial_disconnect();
// HANDLE serial_hCom;
serial_hCom = CreateFile( port,
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if (serial_hCom != INVALID_HANDLE_VALUE)
{
if ( port[0]=='L' )
{
serial_port_connected = true;
} else {
DCB dcb;
// We will build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
if ( GetCommState(serial_hCom, &dcb) )
{
// Fill in the DCB: baud=57,600 bps, 8 data bits, no parity, and 1 stop bit.
dcb.BaudRate = BaudRate;//CBR_1200; // set the baud rate
dcb.ByteSize = ByteSize;//8; // data size, xmit, and rcv
dcb.Parity = Parity;//NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
if ( !SetCommState(serial_hCom, &dcb) )
CloseHandle( serial_hCom );
else
serial_port_connected = true;
// TransmitCommChar( hCom, 0xFF );
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormKeyPress(TObject *Sender, char &Key)
{
if ( PageControl1->ActivePage == TabSheet2 ) return;
switch( Key )
{
case '.': addToNumber(","); break;
case '0': addToNumber("0"); break;
case '1': addToNumber("1"); break;
case '2': addToNumber("2"); break;
case '3': addToNumber("3"); break;
case '4': addToNumber("4"); break;
case '5': addToNumber("5"); break;
case '6': addToNumber("6"); break;
case '7': addToNumber("7"); break;
case '8': addToNumber("8"); break;
case '9': addToNumber("9"); break;
case '+': lcd->Caption = "0.0 €"; importeTXT=""; break;
case VK_RETURN: btIntroClick(NULL); break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
if ( serial_port_connected )
{
serial_disconnect();
delete ticket_header;
delete ticket_footer;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::sgKeyPress(TObject *Sender, char &Key)
{
if ( Key==VK_RETURN ) {
sg->Col = (sg->Col + 1)%3;
if ( sg->Col == 0 ) sg->Row = min(sg->Row+1,6);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
if ( !serial_port_connected )
{
TIniFile *ini;
ini = new TIniFile( ExtractFileDir( Application->ExeName ) + "\\TPV.ini" );
puerto = ini->ReadString( "TPV", "puertoImpresoraPOS", "COM1" );
delete ini;
serial_connect( puerto.c_str(),CBR_9600,NOPARITY,8,true );
}
AbreCajon();
char b[15];
// b[0]=(char)0x1B; b[1]='!'; b[2]=0x01; // Negrita
b[0]=(char)0x1B; b[1]='r'; b[2]='0'; serial_sendData( b,3 ); // Color Negro
b[0]=(char)0x1B; b[1]='a'; b[2]='0'; serial_sendData( b,3 ); // Alinear IZQUIERDA
int i;
for (i=0;i<Memo1->Lines->Count;i++)
serial_sendLine( Memo1->Lines->Strings[i] );
serial_sendLine( " Articulo/s Uds Importe" );
serial_sendLine( "---------------------------- --- -------" );
float importe, importeTotal;
importeTotal = 0;
for ( i=1; i<sg->RowCount; i++ ) {
if ( !sg->Cells[0][i].IsEmpty() ) {
try { importe = AnsiReplaceStr( sg->Cells[2][i], ".", "," ).ToDouble(); } catch(...) { importe = 0; }
serial_sendLine( Format( "%28s %-3s %s",ARRAYOFCONST(( sg->Cells[0][i],sg->Cells[1][i], FormatFloat("#,##0.#0", importe ) )) ) );
importeTotal += importe;
}
}
serial_sendLine( "" );
serial_sendLine( Format( "Importe: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", importeTotal), ticket_numberSufix )) ) );
for (i=0;i<Memo2->Lines->Count;i++)
serial_sendLine( Memo2->Lines->Strings[i] );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::PageControl1Change(TObject *Sender)
{
if ( PageControl1->ActivePage == TabSheet2 ) sg->SetFocus();
}
//---------------------------------------------------------------------------

BIN
imprimirTicket_main.ddp Normal file

Binary file not shown.

405
imprimirTicket_main.dfm Normal file
View File

@ -0,0 +1,405 @@
object Form1: TForm1
Left = 649
Top = 575
AutoScroll = False
Caption = 'www.infdj.com :: JDsoft ::'
ClientHeight = 434
ClientWidth = 316
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Icon.Data = {
0000010001001010000001000800680500001600000028000000100000002000
0000010008000000000040010000000000000000000000010000000000000000
0000000080000080000000808000800000008000800080800000C0C0C0008080
80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000606
0600121212001F1F1F002C2C2C003939390045454500525252005F5F5F006C6C
6C007878780085858500929292009F9F9F00ABABAB00B8B8B800C5C5C500D2D2
D200DEDEDE00EBEBEB00F8F8F800F0FBFF00A4A0A000C0DCC000F0CAA6000000
3E0000005D0000007C0000009B000000BA000000D9000000F0002424FF004848
FF006C6CFF009090FF00B4B4FF0000143E00001E5D0000287C0000329B00003C
BA000046D9000055F000246DFF004885FF006C9DFF0090B5FF00B4CDFF00002A
3E00003F5D0000547C0000699B00007EBA000093D90000AAF00024B6FF0048C2
FF006CCEFF0090DAFF00B4E6FF00003E3E00005D5D00007C7C00009B9B0000BA
BA0000D9D90000F0F00024FFFF0048FFFF006CFFFF0090FFFF00B4FFFF00003E
2A00005D3F00007C5400009B690000BA7E0000D9930000F0AA0024FFB60048FF
C2006CFFCE0090FFDA00B4FFE600003E1400005D1E00007C2800009B320000BA
3C0000D9460000F0550024FF6D0048FF85006CFF9D0090FFB500B4FFCD00003E
0000005D0000007C0000009B000000BA000000D9000000F0000024FF240048FF
48006CFF6C0090FF9000B4FFB400143E00001E5D0000287C0000329B00003CBA
000046D9000055F000006DFF240085FF48009DFF6C00B5FF9000CDFFB4002A3E
00003F5D0000547C0000699B00007EBA000093D90000AAF00000B6FF2400C2FF
4800CEFF6C00DAFF9000E6FFB4003E3E00005D5D00007C7C00009B9B0000BABA
0000D9D90000F0F00000FFFF2400FFFF4800FFFF6C00FFFF9000FFFFB4003E2A
00005D3F00007C5400009B690000BA7E0000D9930000F0AA0000FFB62400FFC2
4800FFCE6C00FFDA9000FFE6B4003E1400005D1E00007C2800009B320000BA3C
0000D9460000F0550000FF6D2400FF854800FF9D6C00FFB59000FFCDB4003E00
00005D0000007C0000009B000000BA000000D9000000F0000000FF242400FF48
4800FF6C6C00FF909000FFB4B4003E0014005D001E007C0028009B003200BA00
3C00D9004600F0005500FF246D00FF488500FF6C9D00FF90B500FFB4CD003E00
2A005D003F007C0054009B006900BA007E00D9009300F000AA00FF24B600FF48
C200FF6CCE00FF90DA00FFB4E6003E003E005D005D007C007C009B009B00BA00
BA00D900D900F000F000FF24FF00FF48FF00FF6CFF00FF90FF00FFB4FF002A00
3E003F005D0054007C0069009B007E00BA009300D900AA00F000B624FF00C248
FF00CE6CFF00DA90FF00E6B4FF0014003E001E005D0028007C0032009B003C00
BA004600D9005500F0006D24FF008548FF009D6CFF00B590FF00CDB4FF000000
00000000000000101010101010100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100505050505050505001F1F1F1F1F1F100505
0505030B0305001F1F1F1F1F1F100505030B0B0B0B0B001F0E0E0E0E1F100505
0B0B05050503001F0E0E0E0E1F1005030B0305050505001F1F1F1F1F1F10050B
0B0B0B0B0305000000000000000005030B030505050505050000000000000505
0B0B0505050B03050000000000000505030B0B0B0B0B05050000000000000505
0505030B0305050500000000000000050505050505050505000000000000FF80
FFFFFF80FFFFFF80FFFFFF80FFFFFF80FFFF0080FFFF0080FFFF0080FFFF0080
FFFF0080FFFF00FFFFFF003FFFFF003FFFFF003FFFFF003FFFFF803FFFFF}
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnDestroy = FormDestroy
OnKeyPress = FormKeyPress
PixelsPerInch = 96
TextHeight = 13
object PageControl1: TPageControl
Left = 0
Top = 0
Width = 316
Height = 434
ActivePage = TabSheet2
Align = alClient
Style = tsFlatButtons
TabIndex = 1
TabOrder = 0
OnChange = PageControl1Change
object TabSheet1: TTabSheet
Caption = 'B'#225'sico'
object lcd: TLabel
Left = 8
Top = 48
Width = 273
Height = 53
Alignment = taRightJustify
AutoSize = False
Caption = '0.0 '#8364
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -48
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object stepLb: TLabel
Left = 8
Top = 8
Width = 152
Height = 36
Caption = 'Importe:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -32
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object Label1: TLabel
Left = 96
Top = 393
Width = 96
Height = 13
Caption = 'Dise'#241'ado por JDsoft'
end
object Button1: TButton
Left = 8
Top = 112
Width = 57
Height = 57
Caption = '7'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 80
Top = 112
Width = 57
Height = 57
Caption = '8'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 152
Top = 112
Width = 57
Height = 57
Caption = '9'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 2
OnClick = Button3Click
end
object Button4: TButton
Left = 224
Top = 112
Width = 57
Height = 129
Caption = 'C'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 3
OnClick = Button4Click
end
object Button5: TButton
Left = 8
Top = 184
Width = 57
Height = 57
Caption = '4'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 4
OnClick = Button5Click
end
object Button6: TButton
Left = 80
Top = 184
Width = 57
Height = 57
Caption = '5'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 5
OnClick = Button6Click
end
object Button7: TButton
Left = 152
Top = 184
Width = 57
Height = 57
Caption = '6'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 6
OnClick = Button7Click
end
object Button9: TButton
Left = 8
Top = 256
Width = 57
Height = 57
Caption = '1'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 7
OnClick = Button9Click
end
object Button10: TButton
Left = 80
Top = 256
Width = 57
Height = 57
Caption = '2'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 8
OnClick = Button10Click
end
object Button11: TButton
Left = 152
Top = 256
Width = 57
Height = 57
Caption = '3'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 9
OnClick = Button11Click
end
object btIntro: TButton
Left = 224
Top = 256
Width = 57
Height = 129
Caption = 'Intro'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 10
OnClick = btIntroClick
end
object Button13: TButton
Left = 8
Top = 328
Width = 129
Height = 57
Caption = '0'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 11
OnClick = Button13Click
end
object Button14: TButton
Left = 152
Top = 328
Width = 57
Height = 57
Caption = '.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 12
OnClick = Button14Click
end
end
object TabSheet2: TTabSheet
Caption = 'Avanzado'
ImageIndex = 1
object Memo1: TMemo
Left = 0
Top = 0
Width = 308
Height = 169
Align = alTop
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Lines.Strings = (
' /'
' . Inform'#225'tica D.J. '
' / \ http://www.infdj.com'
' _|_ \ '
' / \_|_'
' | D | \ Murillo 11 - 41500'
' \___/ J | Alcala de Gdra. (Sevilla)'
' \___/ T:955.615.854 F:955.614.913'
''
'{fecha} . {hora} Ticket: {id}'
''
'')
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
end
object Memo2: TMemo
Left = 0
Top = 336
Width = 308
Height = 40
Align = alBottom
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Lines.Strings = (
''
' Gracias por su visita')
ParentFont = False
ScrollBars = ssVertical
TabOrder = 1
end
object sg: TStringGrid
Left = 0
Top = 169
Width = 308
Height = 167
Align = alClient
ColCount = 3
FixedCols = 0
RowCount = 7
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goEditing]
ParentFont = False
ScrollBars = ssVertical
TabOrder = 2
OnKeyPress = sgKeyPress
ColWidths = (
190
31
64)
end
object Panel1: TPanel
Left = 0
Top = 376
Width = 308
Height = 27
Align = alBottom
BevelOuter = bvLowered
TabOrder = 3
object SpeedButton1: TSpeedButton
Left = 88
Top = 2
Width = 137
Height = 22
Caption = 'Imprimir el Ticket'
Flat = True
OnClick = SpeedButton1Click
end
end
end
end
end

87
imprimirTicket_main.h Normal file
View File

@ -0,0 +1,87 @@
//---------------------------------------------------------------------------
#ifndef imprimirTicket_mainH
#define imprimirTicket_mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <Grids.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TPageControl *PageControl1;
TTabSheet *TabSheet1;
TLabel *lcd;
TLabel *stepLb;
TLabel *Label1;
TButton *Button1;
TButton *Button2;
TButton *Button3;
TButton *Button4;
TButton *Button5;
TButton *Button6;
TButton *Button7;
TButton *Button9;
TButton *Button10;
TButton *Button11;
TButton *btIntro;
TButton *Button13;
TButton *Button14;
TTabSheet *TabSheet2;
TMemo *Memo1;
TMemo *Memo2;
TStringGrid *sg;
TPanel *Panel1;
TSpeedButton *SpeedButton1;
void __fastcall btIntroClick(TObject *Sender);
void __fastcall Button14Click(TObject *Sender);
void __fastcall Button13Click(TObject *Sender);
void __fastcall Button11Click(TObject *Sender);
void __fastcall Button10Click(TObject *Sender);
void __fastcall Button9Click(TObject *Sender);
void __fastcall Button7Click(TObject *Sender);
void __fastcall Button6Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
void __fastcall FormKeyPress(TObject *Sender, char &Key);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall sgKeyPress(TObject *Sender, char &Key);
void __fastcall SpeedButton1Click(TObject *Sender);
void __fastcall PageControl1Change(TObject *Sender);
private: // User declarations
int step;
float importeCobrar, importeEntrega;
AnsiString importeTXT;
bool serial_port_connected;
HANDLE serial_hCom;
AnsiString puerto, ticket_numberSufix;
TStrings *ticket_header, *ticket_footer;
void __fastcall addToNumber(AnsiString number);
void __fastcall imprimirTicket(float importeCobrar, float importeEntrega);
void __fastcall AbreCajon();
void __fastcall serial_disconnect();
void __fastcall serial_connect(const char *port, int BaudRate,int Parity,char ByteSize, bool excl);
int __fastcall serial_sendData(char *data,int length);
int __fastcall serial_sendLine(AnsiString data);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

338
imprimirTicket_main.~cpp Normal file
View File

@ -0,0 +1,338 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <StrUtils.hpp>
#include <inifiles.hpp>
#pragma hdrstop
#include "imprimirTicket_main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
#define min(a, b) (((a) < (b)) ? (a) : (b))
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
step = 0;
importeCobrar = 0;
importeEntrega = 0;
serial_port_connected = false;
importeTXT = "";
/* Advance mode */
/*
Articulo/s Uds Importe
---------------------------- --- -------
*/
sg->Cells[0][0] = "Articulo/s";
sg->Cells[1][0] = "Uds";
sg->Cells[2][0] = "Importe";
/****************/
}
//---------------------------------------------------------------------------
void __fastcall TForm1::addToNumber(AnsiString number)
{
if ( StrPos(importeTXT.c_str(), "," )==0 || number!="," )
importeTXT += number;
lcd->Caption = FormatFloat("#,##0.#0",importeTXT.ToDouble()) + " €";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btIntroClick(TObject *Sender)
{
switch( step )
{
case 0: stepLb->Caption = "Entrega:"; step++; lcd->Caption = "0.0 €"; importeCobrar = importeTXT.ToDouble(); importeEntrega = 0; importeTXT=""; break;
case 1: stepLb->Caption = "Cambio:"; step++; importeEntrega = importeTXT.ToDouble(); lcd->Caption = FormatFloat("#,##0.#0", (importeEntrega-importeCobrar) )+" €"; break;
case 2:
default:
imprimirTicket(importeCobrar,importeEntrega);
stepLb->Caption = "Importe:"; step=0; lcd->Caption = "0.0 €"; importeCobrar = 0; importeTXT=""; break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
addToNumber(",");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
addToNumber("0");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
addToNumber("3");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
addToNumber("2");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
addToNumber("1");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
addToNumber("6");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
addToNumber("5");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
addToNumber("4");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
addToNumber("9");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
addToNumber("8");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
addToNumber("7");
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
importeTXT = "";
lcd->Caption = "0,0 €";
btIntro->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::imprimirTicket(float importeCobrar, float importeEntrega)
{
if ( !serial_port_connected )
{
TIniFile *ini;
ini = new TIniFile( ExtractFileDir( Application->ExeName ) + "\\cfg.ini" );
puerto = ini->ReadString( "www.infdj.com", "PUERTO", "COM1" );
ticket_numberSufix = ini->ReadString( "www.infdj.com", "ticket_numberSufix", "€" );
ticket_header = new TStringList;
ticket_header->CommaText = ini->ReadString( "www.infdj.com", "ticket_header", "" );
ticket_footer = new TStringList;
ticket_footer->CommaText = ini->ReadString( "www.infdj.com", "ticket_footer", "" );
delete ini;
serial_connect( puerto.c_str(),CBR_9600,NOPARITY,8,true );
}
AbreCajon();
int i;
for (i=0;i<ticket_header->Count;i++)
serial_sendLine( ticket_header->Strings[i] );
serial_sendLine( "Fecha: "+Now() );
serial_sendLine( "" );
serial_sendLine( Format( "Importe: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", importeEntrega), ticket_numberSufix )) ) );
serial_sendLine( "" );
serial_sendLine( "------------------------------" );
serial_sendLine( Format( "Entrega: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", importeEntrega), ticket_numberSufix )) ) );
serial_sendLine( Format( "Cambio: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", (importeEntrega-importeCobrar)), ticket_numberSufix )) ) );
serial_sendLine( "------------------------------" );
for (i=0;i<ticket_footer->Count;i++)
serial_sendLine( ticket_footer->Strings[i] );
}
// --------------------------------------------------------------------------
void __fastcall TForm1::AbreCajon()
{
char b[15];
b[0]=(char)0x1B; b[1]='p'; b[2]=0; b[3]=127; b[4]=127;
serial_sendData( b,5 );
}
//---------------------------------------------------------------------------
int __fastcall TForm1::serial_sendLine(AnsiString data)
{
data = "\r\n"+data;
return serial_sendData( data.c_str(), data.Length() );
}
//---------------------------------------------------------------------------
int __fastcall TForm1::serial_sendData(char *data,int length)
{
/*
int i,dev=-1;
for(i=0;dev!=0 && i<length;i++)
dev=TransmitCommChar( serial_hCom, data[i] );
*/
unsigned long int wt;
return WriteFile( serial_hCom,data,length,&wt,NULL);
// return dev;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::serial_disconnect()
{
if ( serial_port_connected )
{
CloseHandle( serial_hCom );
serial_hCom=0;
}
serial_port_connected = false;
}
//---------------------------------------------------------------------------
//, 9600, SERIAL_PARITY_NONE, 8, true);
void __fastcall TForm1::serial_connect(const char *port, int BaudRate,int Parity,char ByteSize, bool excl)
{
if ( serial_port_connected ) serial_disconnect();
// HANDLE serial_hCom;
serial_hCom = CreateFile( port,
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if (serial_hCom != INVALID_HANDLE_VALUE)
{
if ( port[0]=='L' )
{
serial_port_connected = true;
} else {
DCB dcb;
// We will build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
if ( GetCommState(serial_hCom, &dcb) )
{
// Fill in the DCB: baud=57,600 bps, 8 data bits, no parity, and 1 stop bit.
dcb.BaudRate = BaudRate;//CBR_1200; // set the baud rate
dcb.ByteSize = ByteSize;//8; // data size, xmit, and rcv
dcb.Parity = Parity;//NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
if ( !SetCommState(serial_hCom, &dcb) )
CloseHandle( serial_hCom );
else
serial_port_connected = true;
// TransmitCommChar( hCom, 0xFF );
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormKeyPress(TObject *Sender, char &Key)
{
if ( PageControl1->ActivePage == TabSheet2 ) return;
switch( Key )
{
case '.': addToNumber(","); break;
case '0': addToNumber("0"); break;
case '1': addToNumber("1"); break;
case '2': addToNumber("2"); break;
case '3': addToNumber("3"); break;
case '4': addToNumber("4"); break;
case '5': addToNumber("5"); break;
case '6': addToNumber("6"); break;
case '7': addToNumber("7"); break;
case '8': addToNumber("8"); break;
case '9': addToNumber("9"); break;
case '+': lcd->Caption = "0.0 €"; importeTXT=""; break;
case VK_RETURN: btIntroClick(NULL); break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
if ( serial_port_connected )
{
serial_disconnect();
delete ticket_header;
delete ticket_footer;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::sgKeyPress(TObject *Sender, char &Key)
{
if ( Key==VK_RETURN ) {
sg->Col = (sg->Col + 1)%3;
if ( sg->Col == 0 ) sg->Row = min(sg->Row+1,6);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
if ( !serial_port_connected )
{
TIniFile *ini;
ini = new TIniFile( ExtractFileDir( Application->ExeName ) + "\\TPV.ini" );
puerto = ini->ReadString( "TPV", "puertoImpresoraPOS", "COM1" );
delete ini;
serial_connect( puerto.c_str(),CBR_9600,NOPARITY,8,true );
}
AbreCajon();
int i;
for (i=0;i<Memo1->Lines->Count;i++)
serial_sendLine( Memo1->Lines->Strings[i] );
serial_sendLine( " Articulo/s Uds Importe" );
serial_sendLine( "---------------------------- --- -------" );
float importe, importeTotal;
importeTotal = 0;
for ( i=1; i<sg->RowCount; i++ ) {
if ( !sg->Cells[0][i].IsEmpty() ) {
try { importe = AnsiReplaceStr( sg->Cells[2][i], ".", "," ).ToDouble(); } catch(...) { importe = 0; }
serial_sendLine( Format( "%28s %-3s %s",ARRAYOFCONST(( sg->Cells[0][i],sg->Cells[1][i], FormatFloat("#,##0.#0", importe ) )) ) );
importeTotal += importe;
}
}
serial_sendLine( "" );
serial_sendLine( Format( "Importe: %20s %s",ARRAYOFCONST(( FormatFloat("#,##0.#0", importeTotal), ticket_numberSufix )) ) );
for (i=0;i<Memo2->Lines->Count;i++)
serial_sendLine( Memo2->Lines->Strings[i] );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::PageControl1Change(TObject *Sender)
{
if ( PageControl1->ActivePage == TabSheet2 ) sg->SetFocus();
}
//---------------------------------------------------------------------------

BIN
imprimirTicket_main.~ddp Normal file

Binary file not shown.

405
imprimirTicket_main.~dfm Normal file
View File

@ -0,0 +1,405 @@
object Form1: TForm1
Left = 649
Top = 575
AutoScroll = False
Caption = 'www.infdj.com :: JDsoft ::'
ClientHeight = 434
ClientWidth = 316
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Icon.Data = {
0000010001001010000001000800680500001600000028000000100000002000
0000010008000000000040010000000000000000000000010000000000000000
0000000080000080000000808000800000008000800080800000C0C0C0008080
80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000606
0600121212001F1F1F002C2C2C003939390045454500525252005F5F5F006C6C
6C007878780085858500929292009F9F9F00ABABAB00B8B8B800C5C5C500D2D2
D200DEDEDE00EBEBEB00F8F8F800F0FBFF00A4A0A000C0DCC000F0CAA6000000
3E0000005D0000007C0000009B000000BA000000D9000000F0002424FF004848
FF006C6CFF009090FF00B4B4FF0000143E00001E5D0000287C0000329B00003C
BA000046D9000055F000246DFF004885FF006C9DFF0090B5FF00B4CDFF00002A
3E00003F5D0000547C0000699B00007EBA000093D90000AAF00024B6FF0048C2
FF006CCEFF0090DAFF00B4E6FF00003E3E00005D5D00007C7C00009B9B0000BA
BA0000D9D90000F0F00024FFFF0048FFFF006CFFFF0090FFFF00B4FFFF00003E
2A00005D3F00007C5400009B690000BA7E0000D9930000F0AA0024FFB60048FF
C2006CFFCE0090FFDA00B4FFE600003E1400005D1E00007C2800009B320000BA
3C0000D9460000F0550024FF6D0048FF85006CFF9D0090FFB500B4FFCD00003E
0000005D0000007C0000009B000000BA000000D9000000F0000024FF240048FF
48006CFF6C0090FF9000B4FFB400143E00001E5D0000287C0000329B00003CBA
000046D9000055F000006DFF240085FF48009DFF6C00B5FF9000CDFFB4002A3E
00003F5D0000547C0000699B00007EBA000093D90000AAF00000B6FF2400C2FF
4800CEFF6C00DAFF9000E6FFB4003E3E00005D5D00007C7C00009B9B0000BABA
0000D9D90000F0F00000FFFF2400FFFF4800FFFF6C00FFFF9000FFFFB4003E2A
00005D3F00007C5400009B690000BA7E0000D9930000F0AA0000FFB62400FFC2
4800FFCE6C00FFDA9000FFE6B4003E1400005D1E00007C2800009B320000BA3C
0000D9460000F0550000FF6D2400FF854800FF9D6C00FFB59000FFCDB4003E00
00005D0000007C0000009B000000BA000000D9000000F0000000FF242400FF48
4800FF6C6C00FF909000FFB4B4003E0014005D001E007C0028009B003200BA00
3C00D9004600F0005500FF246D00FF488500FF6C9D00FF90B500FFB4CD003E00
2A005D003F007C0054009B006900BA007E00D9009300F000AA00FF24B600FF48
C200FF6CCE00FF90DA00FFB4E6003E003E005D005D007C007C009B009B00BA00
BA00D900D900F000F000FF24FF00FF48FF00FF6CFF00FF90FF00FFB4FF002A00
3E003F005D0054007C0069009B007E00BA009300D900AA00F000B624FF00C248
FF00CE6CFF00DA90FF00E6B4FF0014003E001E005D0028007C0032009B003C00
BA004600D9005500F0006D24FF008548FF009D6CFF00B590FF00CDB4FF000000
00000000000000101010101010100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100505050505050505001F1F1F1F1F1F100505
0505030B0305001F1F1F1F1F1F100505030B0B0B0B0B001F0E0E0E0E1F100505
0B0B05050503001F0E0E0E0E1F1005030B0305050505001F1F1F1F1F1F10050B
0B0B0B0B0305000000000000000005030B030505050505050000000000000505
0B0B0505050B03050000000000000505030B0B0B0B0B05050000000000000505
0505030B0305050500000000000000050505050505050505000000000000FF80
FFFFFF80FFFFFF80FFFFFF80FFFFFF80FFFF0080FFFF0080FFFF0080FFFF0080
FFFF0080FFFF00FFFFFF003FFFFF003FFFFF003FFFFF003FFFFF803FFFFF}
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnDestroy = FormDestroy
OnKeyPress = FormKeyPress
PixelsPerInch = 96
TextHeight = 13
object PageControl1: TPageControl
Left = 0
Top = 0
Width = 316
Height = 434
ActivePage = TabSheet1
Align = alClient
Style = tsFlatButtons
TabIndex = 0
TabOrder = 0
OnChange = PageControl1Change
object TabSheet1: TTabSheet
Caption = 'B'#225'sico'
object lcd: TLabel
Left = 8
Top = 48
Width = 273
Height = 53
Alignment = taRightJustify
AutoSize = False
Caption = '0.0 '#8364
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -48
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object stepLb: TLabel
Left = 8
Top = 8
Width = 152
Height = 36
Caption = 'Importe:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -32
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object Label1: TLabel
Left = 96
Top = 393
Width = 96
Height = 13
Caption = 'Dise'#241'ado por JDsoft'
end
object Button1: TButton
Left = 8
Top = 112
Width = 57
Height = 57
Caption = '7'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 80
Top = 112
Width = 57
Height = 57
Caption = '8'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 152
Top = 112
Width = 57
Height = 57
Caption = '9'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 2
OnClick = Button3Click
end
object Button4: TButton
Left = 224
Top = 112
Width = 57
Height = 129
Caption = 'C'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 3
OnClick = Button4Click
end
object Button5: TButton
Left = 8
Top = 184
Width = 57
Height = 57
Caption = '4'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 4
OnClick = Button5Click
end
object Button6: TButton
Left = 80
Top = 184
Width = 57
Height = 57
Caption = '5'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 5
OnClick = Button6Click
end
object Button7: TButton
Left = 152
Top = 184
Width = 57
Height = 57
Caption = '6'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 6
OnClick = Button7Click
end
object Button9: TButton
Left = 8
Top = 256
Width = 57
Height = 57
Caption = '1'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 7
OnClick = Button9Click
end
object Button10: TButton
Left = 80
Top = 256
Width = 57
Height = 57
Caption = '2'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 8
OnClick = Button10Click
end
object Button11: TButton
Left = 152
Top = 256
Width = 57
Height = 57
Caption = '3'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 9
OnClick = Button11Click
end
object btIntro: TButton
Left = 224
Top = 256
Width = 57
Height = 129
Caption = 'Intro'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 10
OnClick = btIntroClick
end
object Button13: TButton
Left = 8
Top = 328
Width = 129
Height = 57
Caption = '0'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 11
OnClick = Button13Click
end
object Button14: TButton
Left = 152
Top = 328
Width = 57
Height = 57
Caption = '.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 12
OnClick = Button14Click
end
end
object TabSheet2: TTabSheet
Caption = 'Avanzado'
ImageIndex = 1
object Memo1: TMemo
Left = 0
Top = 0
Width = 308
Height = 169
Align = alTop
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Lines.Strings = (
' /'
' . Inform'#225'tica D.J. '
' / \ http://www.infdj.com'
' _|_ \ '
' / \_|_'
' | D | \ Murillo 11 - 41500'
' \___/ J | Alcala de Gdra. (Sevilla)'
' \___/ T:955.615.854 F:955.614.913'
''
'{fecha} . {hora} Ticket: {id}'
''
'')
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
end
object Memo2: TMemo
Left = 0
Top = 336
Width = 308
Height = 40
Align = alBottom
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Lines.Strings = (
''
' Gracias por su visita')
ParentFont = False
ScrollBars = ssVertical
TabOrder = 1
end
object sg: TStringGrid
Left = 0
Top = 169
Width = 308
Height = 167
Align = alClient
ColCount = 3
FixedCols = 0
RowCount = 7
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goEditing]
ParentFont = False
ScrollBars = ssVertical
TabOrder = 2
OnKeyPress = sgKeyPress
ColWidths = (
190
31
64)
end
object Panel1: TPanel
Left = 0
Top = 376
Width = 308
Height = 27
Align = alBottom
BevelOuter = bvLowered
TabOrder = 3
object SpeedButton1: TSpeedButton
Left = 88
Top = 2
Width = 137
Height = 22
Caption = 'Imprimir el Ticket'
Flat = True
OnClick = SpeedButton1Click
end
end
end
end
end

87
imprimirTicket_main.~h Normal file
View File

@ -0,0 +1,87 @@
//---------------------------------------------------------------------------
#ifndef imprimirTicket_mainH
#define imprimirTicket_mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <Grids.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TPageControl *PageControl1;
TTabSheet *TabSheet1;
TLabel *lcd;
TLabel *stepLb;
TLabel *Label1;
TButton *Button1;
TButton *Button2;
TButton *Button3;
TButton *Button4;
TButton *Button5;
TButton *Button6;
TButton *Button7;
TButton *Button9;
TButton *Button10;
TButton *Button11;
TButton *btIntro;
TButton *Button13;
TButton *Button14;
TTabSheet *TabSheet2;
TMemo *Memo1;
TMemo *Memo2;
TStringGrid *sg;
TPanel *Panel1;
TSpeedButton *SpeedButton1;
void __fastcall btIntroClick(TObject *Sender);
void __fastcall Button14Click(TObject *Sender);
void __fastcall Button13Click(TObject *Sender);
void __fastcall Button11Click(TObject *Sender);
void __fastcall Button10Click(TObject *Sender);
void __fastcall Button9Click(TObject *Sender);
void __fastcall Button7Click(TObject *Sender);
void __fastcall Button6Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
void __fastcall FormKeyPress(TObject *Sender, char &Key);
void __fastcall FormDestroy(TObject *Sender);
void __fastcall sgKeyPress(TObject *Sender, char &Key);
void __fastcall SpeedButton1Click(TObject *Sender);
void __fastcall PageControl1Change(TObject *Sender);
private: // User declarations
int step;
float importeCobrar, importeEntrega;
AnsiString importeTXT;
bool serial_port_connected;
HANDLE serial_hCom;
AnsiString puerto, ticket_numberSufix;
TStrings *ticket_header, *ticket_footer;
void __fastcall addToNumber(AnsiString number);
void __fastcall imprimirTicket(float importeCobrar, float importeEntrega);
void __fastcall AbreCajon();
void __fastcall serial_disconnect();
void __fastcall serial_connect(const char *port, int BaudRate,int Parity,char ByteSize, bool excl);
int __fastcall serial_sendData(char *data,int length);
int __fastcall serial_sendLine(AnsiString data);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

BIN
obj/imprimirTicket.obj Normal file

Binary file not shown.

BIN
obj/imprimirTicket_main.obj Normal file

Binary file not shown.

100
src/imprimirTicket.cpp Normal file
View File

@ -0,0 +1,100 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "imprimirTicket.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
step = 0;
importeCobrar = 0;
importeEntrega = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::addToNumber(AnsiString number)
{
if ( StrPos(importeTXT.c_str(), "." )!=0 )
importeTXT = importeTXT + number;
lcd->Caption = FormatFloat("#,###.#0",importeTXT.ToDouble()) + "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button12Click(TObject *Sender)
{
switch( step )
{
case 0: stepLb->Caption = "Entrega:"; step++; lcd->Caption = "0.0 €"; importeCobrar = importeTXT.ToDouble(); importeEntrega = 0; importeTXT=""; break;
case 1: stepLb->Caption = "Cambio:"; step++; importeEntrega = importeTXT.ToDouble(); lcd->Caption = AnsiString(importeEntrega-importeCobrar)+""; break;
case 2:
default:
stepLb->Caption = "Importe:"; step=0; lcd->Caption = "0.0 €"; importeCobrar = 0; break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
addToNumber(".");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
addToNumber("0");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
addToNumber("3");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
addToNumber("2");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
addToNumber("1");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
addToNumber("6");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
addToNumber("5");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
addToNumber("4");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
addToNumber("9");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
addToNumber("8");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
addToNumber("7");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
importeTXT = "";
lcd->Caption = "0.0 €";
}
//---------------------------------------------------------------------------

287
src/imprimirTicket.dfm Normal file
View File

@ -0,0 +1,287 @@
object Form1: TForm1
Left = 814
Top = 118
AutoScroll = False
Caption = 'www.infdj.com :: JDsoft ::'
ClientHeight = 400
ClientWidth = 308
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Icon.Data = {
0000010001001010000001000800680500001600000028000000100000002000
0000010008000000000040010000000000000000000000010000000000000000
0000000080000080000000808000800000008000800080800000C0C0C0008080
80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000606
0600121212001F1F1F002C2C2C003939390045454500525252005F5F5F006C6C
6C007878780085858500929292009F9F9F00ABABAB00B8B8B800C5C5C500D2D2
D200DEDEDE00EBEBEB00F8F8F800F0FBFF00A4A0A000C0DCC000F0CAA6000000
3E0000005D0000007C0000009B000000BA000000D9000000F0002424FF004848
FF006C6CFF009090FF00B4B4FF0000143E00001E5D0000287C0000329B00003C
BA000046D9000055F000246DFF004885FF006C9DFF0090B5FF00B4CDFF00002A
3E00003F5D0000547C0000699B00007EBA000093D90000AAF00024B6FF0048C2
FF006CCEFF0090DAFF00B4E6FF00003E3E00005D5D00007C7C00009B9B0000BA
BA0000D9D90000F0F00024FFFF0048FFFF006CFFFF0090FFFF00B4FFFF00003E
2A00005D3F00007C5400009B690000BA7E0000D9930000F0AA0024FFB60048FF
C2006CFFCE0090FFDA00B4FFE600003E1400005D1E00007C2800009B320000BA
3C0000D9460000F0550024FF6D0048FF85006CFF9D0090FFB500B4FFCD00003E
0000005D0000007C0000009B000000BA000000D9000000F0000024FF240048FF
48006CFF6C0090FF9000B4FFB400143E00001E5D0000287C0000329B00003CBA
000046D9000055F000006DFF240085FF48009DFF6C00B5FF9000CDFFB4002A3E
00003F5D0000547C0000699B00007EBA000093D90000AAF00000B6FF2400C2FF
4800CEFF6C00DAFF9000E6FFB4003E3E00005D5D00007C7C00009B9B0000BABA
0000D9D90000F0F00000FFFF2400FFFF4800FFFF6C00FFFF9000FFFFB4003E2A
00005D3F00007C5400009B690000BA7E0000D9930000F0AA0000FFB62400FFC2
4800FFCE6C00FFDA9000FFE6B4003E1400005D1E00007C2800009B320000BA3C
0000D9460000F0550000FF6D2400FF854800FF9D6C00FFB59000FFCDB4003E00
00005D0000007C0000009B000000BA000000D9000000F0000000FF242400FF48
4800FF6C6C00FF909000FFB4B4003E0014005D001E007C0028009B003200BA00
3C00D9004600F0005500FF246D00FF488500FF6C9D00FF90B500FFB4CD003E00
2A005D003F007C0054009B006900BA007E00D9009300F000AA00FF24B600FF48
C200FF6CCE00FF90DA00FFB4E6003E003E005D005D007C007C009B009B00BA00
BA00D900D900F000F000FF24FF00FF48FF00FF6CFF00FF90FF00FFB4FF002A00
3E003F005D0054007C0069009B007E00BA009300D900AA00F000B624FF00C248
FF00CE6CFF00DA90FF00E6B4FF0014003E001E005D0028007C0032009B003C00
BA004600D9005500F0006D24FF008548FF009D6CFF00B590FF00CDB4FF000000
00000000000000101010101010100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100505050505050505001F1F1F1F1F1F100505
0505030B0305001F1F1F1F1F1F100505030B0B0B0B0B001F0E0E0E0E1F100505
0B0B05050503001F0E0E0E0E1F1005030B0305050505001F1F1F1F1F1F10050B
0B0B0B0B0305000000000000000005030B030505050505050000000000000505
0B0B0505050B03050000000000000505030B0B0B0B0B05050000000000000505
0505030B0305050500000000000000050505050505050505000000000000FF80
FFFFFF80FFFFFF80FFFFFF80FFFFFF80FFFF0080FFFF0080FFFF0080FFFF0080
FFFF0080FFFF00FFFFFF003FFFFF003FFFFF003FFFFF003FFFFF803FFFFF}
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object lcd: TLabel
Left = 16
Top = 48
Width = 273
Height = 53
Alignment = taRightJustify
AutoSize = False
Caption = '0.0 '#8364
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -48
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object stepLb: TLabel
Left = 16
Top = 8
Width = 152
Height = 36
Caption = 'Importe:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -32
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object Button1: TButton
Left = 16
Top = 112
Width = 57
Height = 57
Caption = '7'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 88
Top = 112
Width = 57
Height = 57
Caption = '8'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 160
Top = 112
Width = 57
Height = 57
Caption = '9'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 2
OnClick = Button3Click
end
object Button4: TButton
Left = 232
Top = 112
Width = 57
Height = 129
Caption = 'C'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 3
OnClick = Button4Click
end
object Button5: TButton
Left = 16
Top = 184
Width = 57
Height = 57
Caption = '4'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 4
OnClick = Button5Click
end
object Button6: TButton
Left = 88
Top = 184
Width = 57
Height = 57
Caption = '5'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 5
OnClick = Button6Click
end
object Button7: TButton
Left = 160
Top = 184
Width = 57
Height = 57
Caption = '6'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 6
OnClick = Button7Click
end
object Button9: TButton
Left = 16
Top = 256
Width = 57
Height = 57
Caption = '1'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 7
OnClick = Button9Click
end
object Button10: TButton
Left = 88
Top = 256
Width = 57
Height = 57
Caption = '2'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 8
OnClick = Button10Click
end
object Button11: TButton
Left = 160
Top = 256
Width = 57
Height = 57
Caption = '3'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 9
OnClick = Button11Click
end
object Button12: TButton
Left = 232
Top = 256
Width = 57
Height = 129
Caption = 'Intro'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 10
OnClick = Button12Click
end
object Button13: TButton
Left = 16
Top = 328
Width = 129
Height = 57
Caption = '0'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 11
OnClick = Button13Click
end
object Button14: TButton
Left = 160
Top = 328
Width = 57
Height = 57
Caption = '.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 12
OnClick = Button14Click
end
end

55
src/imprimirTicket.h Normal file
View File

@ -0,0 +1,55 @@
//---------------------------------------------------------------------------
#ifndef imprimirTicketH
#define imprimirTicketH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TButton *Button2;
TButton *Button3;
TButton *Button4;
TButton *Button5;
TButton *Button6;
TButton *Button7;
TButton *Button9;
TButton *Button10;
TButton *Button11;
TButton *Button12;
TButton *Button13;
TButton *Button14;
TLabel *lcd;
TLabel *stepLb;
void __fastcall Button12Click(TObject *Sender);
void __fastcall Button14Click(TObject *Sender);
void __fastcall Button13Click(TObject *Sender);
void __fastcall Button11Click(TObject *Sender);
void __fastcall Button10Click(TObject *Sender);
void __fastcall Button9Click(TObject *Sender);
void __fastcall Button7Click(TObject *Sender);
void __fastcall Button6Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
private: // User declarations
int step;
float importeCobrar, importeEntrega;
AnsiString importeTXT;
void __fastcall addToNumber(AnsiString number);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

100
src/imprimirTicket.~cpp Normal file
View File

@ -0,0 +1,100 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "imprimirTicket.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
step = 0;
importeCobrar = 0;
importeEntrega = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::addToNumber(AnsiString number)
{
if ( StrPos(importeTXT.c_str(), "." )!=0 )
importeTXT = importeTXT + number;
lcd->Caption = FormatFloat("#,###.#0",importeTXT.ToDouble()) + " €";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button12Click(TObject *Sender)
{
switch( step )
{
case 0: stepLb->Caption = "Entrega:"; step++; lcd->Caption = "0.0 €"; importeCobrar = importeTXT.ToDouble(); importeEntrega = 0; importeTXT=""; break;
case 1: stepLb->Caption = "Cambio:"; step++; importeEntrega = importeTXT.ToDouble(); lcd->Caption = AnsiString(importeEntrega-importeCobrar)+" €"; break;
case 2:
default:
stepLb->Caption = "Importe:"; step=0; lcd->Caption = "0.0 €"; importeCobrar = 0; break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click(TObject *Sender)
{
addToNumber(".");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click(TObject *Sender)
{
addToNumber("0");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click(TObject *Sender)
{
addToNumber("3");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button10Click(TObject *Sender)
{
addToNumber("2");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click(TObject *Sender)
{
addToNumber("1");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
addToNumber("6");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
addToNumber("5");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
addToNumber("4");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
addToNumber("9");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
addToNumber("8");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
addToNumber("7");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
importeTXT = "";
lcd->Caption = "0.0 €";
}
//---------------------------------------------------------------------------

287
src/imprimirTicket.~dfm Normal file
View File

@ -0,0 +1,287 @@
object Form1: TForm1
Left = 814
Top = 118
AutoScroll = False
Caption = 'www.infdj.com :: JDsoft ::'
ClientHeight = 400
ClientWidth = 308
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Icon.Data = {
0000010001001010000001000800680500001600000028000000100000002000
0000010008000000000040010000000000000000000000010000000000000000
0000000080000080000000808000800000008000800080800000C0C0C0008080
80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000606
0600121212001F1F1F002C2C2C003939390045454500525252005F5F5F006C6C
6C007878780085858500929292009F9F9F00ABABAB00B8B8B800C5C5C500D2D2
D200DEDEDE00EBEBEB00F8F8F800F0FBFF00A4A0A000C0DCC000F0CAA6000000
3E0000005D0000007C0000009B000000BA000000D9000000F0002424FF004848
FF006C6CFF009090FF00B4B4FF0000143E00001E5D0000287C0000329B00003C
BA000046D9000055F000246DFF004885FF006C9DFF0090B5FF00B4CDFF00002A
3E00003F5D0000547C0000699B00007EBA000093D90000AAF00024B6FF0048C2
FF006CCEFF0090DAFF00B4E6FF00003E3E00005D5D00007C7C00009B9B0000BA
BA0000D9D90000F0F00024FFFF0048FFFF006CFFFF0090FFFF00B4FFFF00003E
2A00005D3F00007C5400009B690000BA7E0000D9930000F0AA0024FFB60048FF
C2006CFFCE0090FFDA00B4FFE600003E1400005D1E00007C2800009B320000BA
3C0000D9460000F0550024FF6D0048FF85006CFF9D0090FFB500B4FFCD00003E
0000005D0000007C0000009B000000BA000000D9000000F0000024FF240048FF
48006CFF6C0090FF9000B4FFB400143E00001E5D0000287C0000329B00003CBA
000046D9000055F000006DFF240085FF48009DFF6C00B5FF9000CDFFB4002A3E
00003F5D0000547C0000699B00007EBA000093D90000AAF00000B6FF2400C2FF
4800CEFF6C00DAFF9000E6FFB4003E3E00005D5D00007C7C00009B9B0000BABA
0000D9D90000F0F00000FFFF2400FFFF4800FFFF6C00FFFF9000FFFFB4003E2A
00005D3F00007C5400009B690000BA7E0000D9930000F0AA0000FFB62400FFC2
4800FFCE6C00FFDA9000FFE6B4003E1400005D1E00007C2800009B320000BA3C
0000D9460000F0550000FF6D2400FF854800FF9D6C00FFB59000FFCDB4003E00
00005D0000007C0000009B000000BA000000D9000000F0000000FF242400FF48
4800FF6C6C00FF909000FFB4B4003E0014005D001E007C0028009B003200BA00
3C00D9004600F0005500FF246D00FF488500FF6C9D00FF90B500FFB4CD003E00
2A005D003F007C0054009B006900BA007E00D9009300F000AA00FF24B600FF48
C200FF6CCE00FF90DA00FFB4E6003E003E005D005D007C007C009B009B00BA00
BA00D900D900F000F000FF24FF00FF48FF00FF6CFF00FF90FF00FFB4FF002A00
3E003F005D0054007C0069009B007E00BA009300D900AA00F000B624FF00C248
FF00CE6CFF00DA90FF00E6B4FF0014003E001E005D0028007C0032009B003C00
BA004600D9005500F0006D24FF008548FF009D6CFF00B590FF00CDB4FF000000
00000000000000101010101010100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100000000000000000001F1F1F1F1F1F100000
000000000000001F101A1A101F100505050505050505001F1F1F1F1F1F100505
0505030B0305001F1F1F1F1F1F100505030B0B0B0B0B001F0E0E0E0E1F100505
0B0B05050503001F0E0E0E0E1F1005030B0305050505001F1F1F1F1F1F10050B
0B0B0B0B0305000000000000000005030B030505050505050000000000000505
0B0B0505050B03050000000000000505030B0B0B0B0B05050000000000000505
0505030B0305050500000000000000050505050505050505000000000000FF80
FFFFFF80FFFFFF80FFFFFF80FFFFFF80FFFF0080FFFF0080FFFF0080FFFF0080
FFFF0080FFFF00FFFFFF003FFFFF003FFFFF003FFFFF003FFFFF803FFFFF}
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object lcd: TLabel
Left = 16
Top = 48
Width = 273
Height = 53
Alignment = taRightJustify
AutoSize = False
Caption = '0.0 '#8364
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Height = -48
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object stepLb: TLabel
Left = 16
Top = 8
Width = 152
Height = 36
Caption = 'Importe:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -32
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
Transparent = True
end
object Button1: TButton
Left = 16
Top = 112
Width = 57
Height = 57
Caption = '7'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 88
Top = 112
Width = 57
Height = 57
Caption = '8'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 160
Top = 112
Width = 57
Height = 57
Caption = '9'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 2
OnClick = Button3Click
end
object Button4: TButton
Left = 232
Top = 112
Width = 57
Height = 129
Caption = 'C'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 3
OnClick = Button4Click
end
object Button5: TButton
Left = 16
Top = 184
Width = 57
Height = 57
Caption = '4'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 4
OnClick = Button5Click
end
object Button6: TButton
Left = 88
Top = 184
Width = 57
Height = 57
Caption = '5'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 5
OnClick = Button6Click
end
object Button7: TButton
Left = 160
Top = 184
Width = 57
Height = 57
Caption = '6'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 6
OnClick = Button7Click
end
object Button9: TButton
Left = 16
Top = 256
Width = 57
Height = 57
Caption = '1'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 7
OnClick = Button9Click
end
object Button10: TButton
Left = 88
Top = 256
Width = 57
Height = 57
Caption = '2'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 8
OnClick = Button10Click
end
object Button11: TButton
Left = 160
Top = 256
Width = 57
Height = 57
Caption = '3'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 9
OnClick = Button11Click
end
object Button12: TButton
Left = 232
Top = 256
Width = 57
Height = 129
Caption = 'Intro'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -19
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 10
OnClick = Button12Click
end
object Button13: TButton
Left = 16
Top = 328
Width = 129
Height = 57
Caption = '0'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 11
OnClick = Button13Click
end
object Button14: TButton
Left = 160
Top = 328
Width = 57
Height = 57
Caption = '.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 12
OnClick = Button14Click
end
end

55
src/imprimirTicket.~h Normal file
View File

@ -0,0 +1,55 @@
//---------------------------------------------------------------------------
#ifndef imprimirTicketH
#define imprimirTicketH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TButton *Button2;
TButton *Button3;
TButton *Button4;
TButton *Button5;
TButton *Button6;
TButton *Button7;
TButton *Button9;
TButton *Button10;
TButton *Button11;
TButton *Button12;
TButton *Button13;
TButton *Button14;
TLabel *lcd;
TLabel *stepLb;
void __fastcall Button12Click(TObject *Sender);
void __fastcall Button14Click(TObject *Sender);
void __fastcall Button13Click(TObject *Sender);
void __fastcall Button11Click(TObject *Sender);
void __fastcall Button10Click(TObject *Sender);
void __fastcall Button9Click(TObject *Sender);
void __fastcall Button7Click(TObject *Sender);
void __fastcall Button6Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
private: // User declarations
int step;
float importeCobrar, importeEntrega;
AnsiString importeTXT;
void __fastcall addToNumber(char number);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif