Смекни!
smekni.com

Разработка автоматизированной системы учета договоров для отеля (стр. 7 из 7)

}

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

Модуль фильтрации БД

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

#include <vcl.h>

#pragma hdrstop

#include "Unit26.h"

#include "Saw12.h"

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

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm26 *Form26;

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

__fastcall TForm26::TForm26(TComponent* Owner)

: TForm(Owner)

{

}

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

void __fastcall TForm26::BitBtn2Click(TObject *Sender)

{

Form26->Close();

}

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

void __fastcall TForm26::ComboBox1Change(TObject *Sender)

{

if(ComboBox1->ItemIndex==0){

Label2->Visible=true;

Label3->Visible=true;

EditDateRegMin->Visible=true;

EditDateRegMax->Visible=true;

EditSumAgrMin->Visible=false;

EditSumAgrMax->Visible=false;

EditDateCompMin->Visible=false;

EditDateCompMax->Visible=false;

EditDateAgreemMin->Visible=false;

EditDateAgreemMax->Visible=false;}

else { if(ComboBox1->ItemIndex==1){

Label2->Visible=true;

Label3->Visible=true;

EditDateAgreemMin->Visible=true;

EditDateAgreemMax->Visible=true;

EditDateRegMin->Visible=false;

EditDateRegMax->Visible=false;

EditSumAgrMin->Visible=false;

EditSumAgrMax->Visible=false;

EditDateCompMin->Visible=false;

EditDateCompMax->Visible=false;}

else {if(ComboBox1->ItemIndex==2){

Label2->Visible=true;

Label3->Visible=true;

EditDateCompMin->Visible=true;

EditDateCompMax->Visible=true;

EditDateAgreemMin->Visible=false;

EditDateAgreemMax->Visible=false;

EditDateRegMin->Visible=false;

EditDateRegMax->Visible=false;

EditSumAgrMin->Visible=false;

EditSumAgrMax->Visible=false;}

else {if(ComboBox1->ItemIndex==3){

Label2->Visible=true;

Label3->Visible=true;

EditSumAgrMin->Visible=true;

EditSumAgrMax->Visible=true;

EditDateCompMin->Visible=false;

EditDateCompMax->Visible=false;

EditDateAgreemMin->Visible=false;

EditDateAgreemMax->Visible=false;

EditDateRegMin->Visible=false;

EditDateRegMax->Visible=false;

}

}

}

}

}

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

void __fastcall TForm26::FormShow(TObject *Sender)

{

Label2->Visible=false;

Label3->Visible=false;

}

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

void __fastcall TForm26::BitBtn1Click(TObject *Sender)

{

if(ComboBox1->ItemIndex==0){

DataModule2->Table1->IndexFieldNames="Date_register";

DataModule2->Table1->SetRangeStart();

DataModule2->Table1->FieldByName("Date_register")->AsDateTime=StrToDate(EditDateRegMin->Text);

DataModule2->Table1->SetRangeEnd();

DataModule2->Table1->FieldByName("Date_register")->AsDateTime=StrToDate(EditDateRegMax->Text);

DataModule2->Table1->ApplyRange();

DataModule2->Table1->Refresh();

Form26->Close();}

else {if(ComboBox1->ItemIndex==1){

DataModule2->Table1->IndexFieldNames="Date_agreement";

DataModule2->Table1->SetRangeStart();

DataModule2->Table1->FieldByName("Date_agreement")->AsDateTime=StrToDate(EditDateAgreemMin->Text);

DataModule2->Table1->SetRangeEnd();

DataModule2->Table1->FieldByName("Date_agreement")->AsDateTime=StrToDate(EditDateAgreemMax->Text);

DataModule2->Table1->ApplyRange();

DataModule2->Table1->Refresh();

Form26->Close();}

else {if(ComboBox1->ItemIndex==2){

DataModule2->Table1->IndexFieldNames="Date_completion";

DataModule2->Table1->SetRangeStart();

DataModule2->Table1->FieldByName("Date_completion")->AsDateTime=StrToDate(EditDateCompMin->Text);

DataModule2->Table1->SetRangeEnd();

DataModule2->Table1->FieldByName("Date_completion")->AsDateTime=StrToDate(EditDateCompMax->Text);

DataModule2->Table1->ApplyRange();

DataModule2->Table1->Refresh();

Form26->Close();}

else {if(ComboBox1->ItemIndex==3){

DataModule2->Table1->IndexFieldNames="Sum_agreement";

DataModule2->Table1->SetRangeStart();

DataModule2->Table1->FieldByName("Sum_agreement")->AsString=EditSumAgrMin->Text;

DataModule2->Table1->SetRangeEnd();

DataModule2->Table1->FieldByName("Sum_agreement")->AsString=EditSumAgrMax->Text;

DataModule2->Table1->ApplyRange();

DataModule2->Table1->Refresh();//

Form26->Close();}

}

}

}

}

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


Приложение Б(обязательное)

Отчеты

Рисунок А.1 - Отчет по основным договорам

Рисунок A.1 - Отчет по дополнительным договорам