//---------------------------------------------------------------------------

#ifndef ticketsH
#define ticketsH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "DigitNum.h"
#include <Buttons.hpp>
#include <DBCtrls.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Mask.hpp>
#include <Db.hpp>
#include <DBTables.hpp>
#include <DB.hpp>
//---------------------------------------------------------------------------
class TfTickets : public TForm
{
__published:	// IDE-managed Components
        TPanel *Panel1;
        TLabel *Label1;
        TBevel *Bevel1;
        TImage *CardOK;
        TBitBtn *BitBtn1;
        TBevel *Bevel2;
        TBevel *Bevel3;
        TBitBtn *BitBtn2;
        TEdit *Edit1;
        TLabel *Label2;
        TLabel *Label3;
        TComboBox *ComboBox1;
        TDataSource *DsATickets;
        TTable *TbTickets;
        TTable *TbVentas;
        TTable *TbPrecios;
        TLabel *Label4;
        TLabel *Label5;
        TSession *Session1;
        TLabel *Label6;
        TLabel *Label7;
        TDigitNum *DigitNum1;
        TDigitNum *DigitNum2;
        TRadioGroup *RadioGroup1;
        TQuery *sql;
        void __fastcall BitBtn1Click(TObject *Sender);
        void __fastcall BitBtn2Click(TObject *Sender);
        void __fastcall ComboBox1Change(TObject *Sender);
        void __fastcall Edit1KeyPress(TObject *Sender, char &Key);
        void __fastcall FormDestroy(TObject *Sender);
private:	// User declarations
        int __fastcall obtenerTicket(void);


        void __fastcall ObtenDirLEGOS(AnsiString cadena, int &nLEGOS, int **ID);
        int __fastcall NDias( TDateTime E, TDateTime S );
        int __fastcall NMinutos( TDateTime hE, TDateTime hS );
        Currency __fastcall CalculaCoste( int Minutos, int Dias );

        TStringList *ticketE,*ticketS;

        void __fastcall ticket_Imprimir(int idt,char tipo,Currency pvp,int mm,TDateTime fechaE,TDateTime fechaS);
        AnsiString __fastcall ticket_parsearLinea(AnsiString linea, int idt, Currency pvp,int mm, TDateTime fechaE, TDateTime fechaS);
        bool __fastcall ticket_writeCOM(AnsiString output);
        void __fastcall ticket_CerrarPuerto(void);
        AnsiString __fastcall ticket_SearchAndReplace(AnsiString l, AnsiString s, AnsiString r );
        HANDLE __fastcall ticket_AbrirPuerto(char *puerto);
        HANDLE hCom;

public:		// User declarations
        __fastcall TfTickets(TComponent* Owner);
        bool __fastcall GrabaTarjeta(int ID);
          Currency precioInicial,precioMinuto;
};
//---------------------------------------------------------------------------
extern PACKAGE TfTickets *fTickets;
//---------------------------------------------------------------------------
#endif
