//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "Agenda.h"
#include "bdiario.h"
#include "diario.h"
#include "dos.h"
#include "listado.h"
#include "recuerda.h"
#include "telefonos.h"
//---------------------------------------------------------------------------
#pragma link "Grids"
#pragma resource "*.dfm"
int dia;
AnsiString fecha;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Salir1Click(TObject *Sender)
{
	Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Introducir2Click(TObject *Sender)
{
   TForm2 *Telefonos;
   Telefonos = new TForm2(this);
   Telefonos->ShowModal();
   delete Telefonos;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Creditos2Click(TObject *Sender)
{
	ShowMessage("Programa Realizado por OGA");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListaClick(TObject *Sender)
{
   TForm5 *Listado;
   Listado = new TForm5(this);
   Listado->ShowModal();
   delete Listado;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Introducir3Click(TObject *Sender)
{
   TForm3 *Recordatorio;
   Recordatorio = new TForm3(this);
   Recordatorio->ShowModal();
   delete Recordatorio;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Vertodos1Click(TObject *Sender)
{
   Table1->Refresh();
   Panel1->Visible=true;
   DBGrid1->Visible=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormActivate(TObject *Sender)
{
   TLocateOptions relacion;
   relacion << loPartialKey;
   int dia;
   int mes;
   int ano;
   struct date d;
   getdate(&d);
   dia = d.da_day;
   mes = d.da_mon;
   ano = d.da_year;
   fecha = AnsiString(dia) + '/' + AnsiString(mes) + '/' + AnsiString(ano);
   if (Table1->Locate("Fecha", fecha ,relacion) == true)
	{
    Label1->Visible=true;
    Panel1->Visible=true;
    Panel1->Caption=Table1->FieldValues["Recordatorio"];
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DBGrid1KeyPress(TObject *Sender, char &Key)
{
	DBGrid1->Visible=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	Panel1->Visible=false;
    DBGrid1->Visible=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Introducir1Click(TObject *Sender)
{
   TForm6 *Diario;
   Diario = new TForm6(this);
   Diario->ShowModal();
   delete Diario;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::PorFecha1Click(TObject *Sender)
{
   TForm7 *BDiario;
   BDiario = new TForm7(this);
   BDiario->Label1->Caption = "Introduzca Fecha:";
   BDiario->Edit1->Visible=true;
   BDiario->DBEdit1->Visible=false;
   BDiario->DBMemo1->Clear();
   dia=1;
   BDiario->ShowModal();
   delete BDiario;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TodaAgenda1Click(TObject *Sender)
{
   TForm7 *BDiario;
   BDiario = new TForm7(this);
   BDiario->Label1->Caption = "Fecha";
   BDiario->Edit1->Visible=false;
   BDiario->DBEdit1->Visible=true;
   dia=2;
   BDiario->ShowModal();
   delete BDiario;
}
//---------------------------------------------------------------------------


