home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 April
/
Chip_1997-04_cd.bin
/
prezent
/
cb
/
data.z
/
QRYCUST.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-16
|
3KB
|
81 lines
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
#include "qrycust.h"
#include "pickdate.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TQueryCustDlg *QueryCustDlg;
//---------------------------------------------------------------------------
void TQueryCustDlg::SetFromDate(TDateTime NewDate)
{
FromEdit->Text = DateToStr(NewDate);
}
//---------------------------------------------------------------------------
void TQueryCustDlg::SetToDate(TDateTime NewDate)
{
ToEdit->Text = DateToStr(NewDate);
}
//---------------------------------------------------------------------------
TDateTime TQueryCustDlg::GetFromDate()
{
if (FromEdit->Text.c_str())
return StrToDate(FromEdit->Text);
else
return 0;
}
//---------------------------------------------------------------------------
TDateTime TQueryCustDlg::GetToDate()
{
if (ToEdit->Text.c_str())
return StrToDate(ToEdit->Text);
else
return 0;
}
//---------------------------------------------------------------------------
__fastcall TQueryCustDlg::TQueryCustDlg(TComponent* Owner)
: TForm(Owner)
{
Msglab->Caption = "Customers with LastInvoiceDate ranging:";
FromDate = EncodeDate(95, 01, 01);
ToDate = Now();
}
//---------------------------------------------------------------------------
void __fastcall TQueryCustDlg::OkBtnClick(TObject *Sender)
{
TDateTime Test;
try
{
Test = StrToDate(FromEdit->Text); // validate date strings
Test = StrToDate(ToEdit->Text);
if (((int)ToDate != 0) && (ToDate < FromDate))
{
ShowMessage("\"TO\" date cannot be less than \"FROM\" date");
ModalResult = mrNone;
}
else ModalResult = mrOk;
}
catch(EConvertError * ece)
{
ShowMessage(" Invalid date specified");
ModalResult = mrNone;
}
}
//---------------------------------------------------------------------------
void __fastcall TQueryCustDlg::PopupCalBtnFromClick(TObject *Sender)
{
BrDateForm->Date = StrToDate(FromEdit->Text); //start with current date }
if (BrDateForm->ShowModal() == mrOk)
FromEdit->Text = DateToStr(BrDateForm->Date);
}
//---------------------------------------------------------------------------
void __fastcall TQueryCustDlg::PopupCalToBtnClick(TObject *Sender)
{
BrDateForm->Date = StrToDate(ToEdit->Text); //start with current date }
if (BrDateForm->ShowModal() == mrOk)
ToEdit->Text = DateToStr(BrDateForm->Date);
}
//---------------------------------------------------------------------------