//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Unit2.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm2 *Form2; //--------------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) { TbPrecios->Active = true; TbHistorial ->Active = true; Timer1->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TForm2::Timer1Timer(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TForm2::TbHistorialAfterOpen(TDataSet *DataSet) { TbHistorial->First(); while ( !TbHistorial->Eof ) { if ( TbHistorial->FieldByName("idtc")->AsInteger < 900 ) { // Buscamos en la tabla de precios, al 1º que tenga un tiempo superior o igual // al que nos pide el cliente... TbPrecios->First(); while( !TbPrecios->Eof && (double)TbPrecios->FieldByName("Tiempo")->AsDateTime < (double)TbHistorial->FieldByName("Tiempo")->AsDateTime )//->Time ) TbPrecios->Next(); TbHistorial->Edit(); TbHistorial->FieldByName("Precio")->AsCurrency = TbPrecios->FieldByName("Precio")->AsCurrency; TbHistorial->Post(); } TbHistorial->Next(); } } //---------------------------------------------------------------------------