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

#include <vcl.h>
#pragma hdrstop

#include "herm_insignias.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TInsignias *Insignias;
//---------------------------------------------------------------------------
__fastcall TInsignias::TInsignias(TComponent* Owner)
        : TForm(Owner)
{
  OrdenarPor->ItemIndex = 0;
  TbInsignias->Active = true;
}
//---------------------------------------------------------------------------

void __fastcall TInsignias::SpeedButton1Click(TObject *Sender)
{
 Close();        
}
//---------------------------------------------------------------------------
void __fastcall TInsignias::TabControl1Change(TObject *Sender)
{
  TbInsignias->Filter = "CtoVirgen = " + (TabControl1->TabIndex ? AnsiString("True") : AnsiString("False") );
  TbInsignias->Filtered = true;
  DBGrid2CellClick(0);
}
//---------------------------------------------------------------------------
void __fastcall TInsignias::TbInsigniasNewRecord(TDataSet *DataSet)
{
  TbInsignias->FieldByName( "CtoVirgen" )->AsBoolean = TabControl1->TabIndex ? true : false;
}
//---------------------------------------------------------------------------
void __fastcall TInsignias::DBGrid2CellClick(TColumn *Column)
{
  TbBusqHnos->Close();
  TbBusqHnos->SQL->Clear();
  TbBusqHnos->SQL->Add("SELECT NumHno, ( ( ( (Apellido1 + ' ')  + Apellido2)  + ', ')  + Nombre) Nombre, DNI, FechaNacimiento, Antiguedad");
  TbBusqHnos->SQL->Add("       FROM \"datos\\tbHERM.db\" Tbherm     " );
  TbBusqHnos->SQL->Add("       WHERE   (Borrado = FALSE) AND (idInsignia = "+TbInsignias->FieldByName("idInsignia")->AsString + ")");
//  TbBusqHnos->SQL->Add("ORDER BY " + OrdenarPor->Items->Strings[OrdenarPor->ItemIndex] );
  TbBusqHnos->ExecSQL();
  TbBusqHnos->Active = true;
}
//---------------------------------------------------------------------------


