CtrlMstr/ComprarBono.cpp
2021-09-12 22:02:01 +02:00

59 lines
1.9 KiB
C++

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ComprarBono.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CoolForm"
#pragma link "FormularioREUSABLE"
#pragma resource "*.dfm"
TCBono *CBono;
//---------------------------------------------------------------------------
__fastcall TCBono::TCBono(TComponent* Owner)
: TFormREUSABLE(Owner)
{
Label1->Caption = TDateTime::CurrentDate();
}
//---------------------------------------------------------------------------
void __fastcall TCBono::BitBtn1Click(TObject *Sender)
{
try {
if ( Horas->Text.ToInt() < 0 || Horas->Text.ToInt() >50 ) Horas->Text = "0";
} catch(...) { Horas->Text = "0";
Horas->SelStart= 0;
Horas->SelLength= 1;
}
try {
if ( Min->Text.ToInt() < 0 || Min->Text.ToInt() >59 ) Min->Text = "0";
} catch(...) { Min->Text = "0";
Min->SelStart= 0;
Min->SelLength= 1;
}
if ( Horas->Text.ToInt() == 0 )
{
ShowMessage( "Debe indicar la DURACIÓN DEL BONO" );
return;
}
try{
if ( Currency(CosteBono->Text) == 0 )
{
ShowMessage( "Debe indicar la COSTE DEL BONO" );
return;
}
} catch(...) {
ShowMessage( "Debe indicar la COSTE DEL BONO" );
return;
}
ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TCBono::Button1Click(TObject *Sender)
{
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------