34
#include "Unit8.h"
#include "Unit9.h"
#include "Unit10.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
Form1->Show();
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button2Click(TObject *Sender)
{
ADOQuery1->SQL->Text ="select m.id, m.name, t.name, c.name, o.name, m.rozmir, m.quant from
material m, tkans t, ov o, colors c where c.id = m.id_color and t.id = m.id_tkan and o.id = m.id_ov";
ADOQuery1->ExecSQL();
ADOQuery1->Active = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::N17Click(TObject *Sender)
{
Form6->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::N15Click(TObject *Sender)
{
Form7->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::N12Click(TObject *Sender)
{
Form8->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
String ss = Edit1->Text;
String SQL = "select m.id, m.name, t.name, c.name, o.name, m.rozmir, m.quant from material m, tkans t,
ov o, colors c where c.id = m.id_color and t.id = m.id_tkan and o.id = m.id_ov ";
if(!Edit1->Text.IsEmpty())
SQL+="and m.name like '%"+ss+"%' ";
if(RadioButton1->Checked)SQL+=" and quant > 0";
if(RadioButton2->Checked)SQL+=" and quant = 0";
if(CheckBox1->Checked)
{
if(ComboBox2->ItemIndex==0)SQL+=" order by m.id";
if(ComboBox2->ItemIndex==1)SQL+=" order by m.name";
if(ComboBox2->ItemIndex==2)SQL+=" order by t.name";
if(ComboBox2->ItemIndex==3)SQL+=" order by c.name";
if(ComboBox2->ItemIndex==4)SQL+=" order by o.id";
if(ComboBox2->ItemIndex==5)SQL+=" order by m.quant";
}
ADOQuery1->SQL->Text = SQL;
ADOQuery1->ExecSQL();
ADOQuery1->Active = true;
}
//---------------------------------------------------------------------------