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

#include <vcl.h>
#pragma hdrstop

#include "capg_menu.h"
#include "capg_abonados.h"
#include "capg_tabonados.h"
#include "capg_tarifas.h"
#include "tickets.h"
#include "crd_ctrl.h"
#include "capg_gfact.h"
#include "capg_ifact.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
        : TForm(Owner)
{
        Height = 290;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::BitBtn2Click(TObject *Sender)
{
  TForm1 *GAb;
  GAb = new TForm1(this);
  this->Visible = false;
  GAb->ShowModal();
  this->Visible = true;
  delete GAb;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::BitBtn1Click(TObject *Sender)
{
  TForm2 *GTAb;
  GTAb = new TForm2(this);
  this->Visible = false;
  GTAb->ShowModal();
  this->Visible = true;
  delete GTAb;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::BitBtn5Click(TObject *Sender)
{
 if ( Height == 290 )
        Height = 390;
 else
        Height = 290;
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::BitBtn6Click(TObject *Sender)
{
  TfTarifas *F;
  F = new TfTarifas(this);
  this->Visible = false;
  F->ShowModal();
  this->Visible = true;
  delete F;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::BitBtn8Click(TObject *Sender)
{
 /*
  TfEstados *F;
  F = new TfEstados(this);
  this->Visible = false;
  F->ShowModal();
  this->Visible = true;
  delete F;
 */
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::BitBtn7Click(TObject *Sender)
{
  TfTickets *F;
  F = new TfTickets(this);
  this->Visible = false;
  F->ShowModal();
  this->Visible = true;
  delete F;
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::BitBtn3Click(TObject *Sender)
{
 TiFact *F;
 F = new TiFact(this);
 this->Visible = false;
 F->ShowModal();
 this->Visible = true;
 delete F;
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::BitBtn9Click(TObject *Sender)
{
 TgFact *F;
 F = new TgFact(this);
 this->Visible = false;
 F->ShowModal();
 this->Visible = true;
 delete F;
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::BitBtn4Click(TObject *Sender)
{
  ShowMessage( "Módulo no incluido en esta versión" );        
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::BitBtn10Click(TObject *Sender)
{
  if ( MessageDlg("Reiniciar a cero el contador.\nEsto incrementará la serie del ticket y pondra a cero el contador.\n\n¿Continuar con el proceso?",mtInformation, TMsgDlgButtons() << mbYes << mbNo, 0)==mrYes )
  {
    TQuery *sql;
    sql = new TQuery(this);
    sql->SQL->Clear();
    sql->SQL->Add("UPDATE 'datos\\contadores.db' SET Prefijo=Prefijo+1,Contador=0 WHERE Id=1");
    sql->ExecSQL();
    delete sql;
  }
}
//---------------------------------------------------------------------------

