#endif
Sort.h:
//---------------------------------------------------------------------------
#ifndef SortH
#define SortH
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
#include <vcl\ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm4 : public TForm
{
__published: // IDE-managed Components
TBevel *Bevel1;
TComboBox *ComboBox1;
TLabel *Label1;
TButton *Button1;
TButton *Button2;
void __fastcall ComboBox1Change(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm4(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern TForm4 *Form4;
//---------------------------------------------------------------------------
#endif
Unit1.h:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
#include <vcl\DBTables.hpp>
#include <vcl\DB.hpp>
#include <vcl\DBCtrls.hpp>
#include <vcl\Mask.hpp>
#include <vcl\Buttons.hpp>
#include <vcl\ComCtrls.hpp>
#include <vcl\DBGrids.hpp>
#include "Grids.hpp"
#include <vcl\ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm3 : public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TLabel *Label2;
TLabel *Label3;
TLabel *Label4;
TDBEdit *DBEdit3;
TDBEdit *DBEdit6;
TLabel *Label6;
TLabel *Label7;
TDBEdit *DBEdit8;
TButton *Button1;
TButton *Button2;
TButton *Button5;
TLabel *Label5;
TDBEdit *DBEdit4;
TDBEdit *DBEdit1;
TDBEdit *DBEdit2;
TLabel *Label8;
TDBEdit *DBEdit5;
TBitBtn *BitBtn1;
TBitBtn *BitBtn2;
TButton *Button3;
TStatusBar *StatusBar1;
void __fastcall FormCreate(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button6Click(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall Table1AfterOpen(TDataSet *DataSet);
void __fastcall Button3Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm3(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern TForm3 *Form3;
//---------------------------------------------------------------------------
#endif
2. Файлы с методами:
Project1.cpp:
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("kur1.cpp", Form1);
USEFORM("Richabt.cpp", Form2);
USERES("Project1.res");
USEFORM("Report.cpp", QRListForm);
USEDATAMODULE("Datam.cpp", DM1);
USEFORM("Unit1.cpp", Form3);
USEFORM("Findcust.cpp", fmFindCust);
USEFORM("Sort.cpp", Form4);
USEFORM("filter.cpp", Form5);
USEFORM("filename.cpp", Form6);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->CreateForm(__classid(TQRListForm), &QRListForm);
Application->CreateForm(__classid(TDM1), &DM1);
Application->CreateForm(__classid(TForm3), &Form3);
Application->CreateForm(__classid(TfmFindCust), &fmFindCust);
Application->CreateForm(__classid(TForm4), &Form4);
Application->CreateForm(__classid(TForm5), &Form5);
Application->CreateForm(__classid(TForm6), &Form6);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//---------------------------------------------------------------------------
Kur1.cpp:
#include <vcl\vcl.h>
#include <stdio.h>
#pragma hdrstop
#include "kur1.h"
#include "RichAbt.h"
#include "Datam.h"
#include "Report.h"
#include "Unit1.h"
#include "Findcust.h"
#include "Sort.h"
#include "filter.h"
#include "filename.h"
//---------------------------------------------------------------------------
#pragma link "Grids"
#pragma resource "*.dfm"
TForm1 *Form1;
AnsiString ff;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ff=Form1->Caption;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N10Click(TObject *Sender)
{
Form1->Caption=ff;
Form6->ShowModal();
N2->Enabled=true;
N20->Enabled=true;
N5->Enabled=true;
N14->Enabled=true;
N16->Enabled=true;
Form1->Caption =Form1->Caption+"->"+DM1->Table1->TableName;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N17Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N14Click(TObject *Sender)
{
QRListForm->QuickReport->Print();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N5Click(TObject *Sender)
{
DBGrid1->Visible=false;
DBNavigator1->Enabled=false;
BitBtn1->Enabled=false;
BitBtn2->Enabled=false;
BitBtn3->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N2Click(TObject *Sender)
{
DBGrid1->Visible=true;
DBNavigator1->Enabled=true;
BitBtn1->Enabled=true;
DBGrid1->ReadOnly=true;
BitBtn2->Enabled=true;
BitBtn3->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N16Click(TObject *Sender)
{
QRListForm->QuickReport->Preview();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N20Click(TObject *Sender)
{
Form3->ShowModal();
DM1->Table1->Refresh();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
DBGrid1->DataSource=DM1->DataSource2;
fmFindCust->ShowModal();
if (fmFindCust->ModalResult == mrOk)
DM1->Table1->GotoCurrent(DM1->Table1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
DBGrid1->DataSource=DM1->DataSource1;
Form4->ShowModal();
if (Form4->ModalResult == mrOk)
DM1->Table1->GotoCurrent(DM1->Table1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn3Click(TObject *Sender)
{
DBGrid1->DataSource=DM1->DataSource1;
Form5->ShowModal();
if (Form4->ModalResult == mrOk)
DM1->Table1->GotoCurrent(DM1->Table1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N7Click(TObject *Sender)
{
if ( OpenDialog1->Execute() )
{
Form1->Caption=ff;
N2->Enabled=true;
N20->Enabled=true;
N5->Enabled=true;
N14->Enabled=true;
N16->Enabled=true;
if (DM1->Table1->Active == true )
DM1->Table1->Active = false;
DM1->Table1->DatabaseName = ExtractFilePath( OpenDialog1->FileName );
DM1->Table1->TableName = ExtractFileName( OpenDialog1->FileName );
DM1->Table1->Active = true;
Form1->Caption =Form1->Caption+"->"+DM1->Table1->TableName;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N4Click(TObject *Sender)
{
Form2= new TForm2(Application);
Form2->ShowModal();
delete Form2;
}
//---------------------------------------------------------------------------
Datam.cpp:
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
#include "Datam.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TDM1 *DM1;
//---------------------------------------------------------------------------
__fastcall TDM1::TDM1(TComponent* Owner)
: TDataModule(Owner)
{
}
//---------------------------------------------------------------------------
filename.cpp:
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
#include "filename.h"
#include "Datam.h"
#include "kur1.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm6 *Form6;
//---------------------------------------------------------------------------
__fastcall TForm6::TForm6(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm6::Button1Click(TObject *Sender)
{
DM1->Table1->Active=false;
DM1->Query1->Active=false;
if (Edit1->Text == "")
Edit1->Text="ITF.db";
TFileStream *Old = new TFileStream("baza1.db", fmOpenRead);
TFileStream *New = new TFileStream(Edit1->Text,fmCreate);
New->CopyFrom(Old, Old->Size);
delete Old; delete New;
DM1->Table1->TableName=Edit1->Text;
DM1->Query1->Active=true;
DM1->Table1->Active=true;
}
//---------------------------------------------------------------------------
filter.cpp:
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
#include "filter.h"
#include "Datam.h"
#include "kur1.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm5 *Form5;
//---------------------------------------------------------------------------
__fastcall TForm5::TForm5(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm5::Button3Click(TObject *Sender)
{
AnsiString filter;
filter=Edit1->Text;
if(ComboBox1->Text != ""){
if(Edit1->Text != "" ){
if (ComboBox1->Text == "L.L.+."){
DM1->Query1->SQL->Clear();
DM1->Query1->SQL->Append("Select * From baza Where A=\""+filter+"\"");
DM1->Query1->Open();
DM1->Table1->Open();}
else if (ComboBox1->Text == "Lръєы№ЄхЄ"){
DM1->Query1->SQL->Clear();
DM1->Query1->SQL->Append("Select * From baza Where W=\""+filter+"\"");
DM1->Query1->Open();
DM1->Table1->Open();}
else if (ComboBox1->Text == "TяхЎшры№эюёЄ№"){
DM1->Query1->SQL->Clear();
DM1->Query1->SQL->Append("Select * From baza Where Q=\""+filter+"\"");
DM1->Query1->Open();
DM1->Table1->Open();}
else if (ComboBox1->Text == "+Ёєяяр"){
DM1->Query1->SQL->Clear();
DM1->Query1->SQL->Append("Select * From baza Where S=\""+filter+"\"");
DM1->Query1->Open();
DM1->Table1->Open();}
else if (ComboBox1->Text == "TЁ.+рыы"){
DM1->Query1->SQL->Clear();
DM1->Query1->SQL->Append("Select * From baza Where Z>="+filter);
DM1->Query1->Open();
DM1->Table1->Open();}}
else
{
DM1->Query1->SQL->Clear();
DM1->Query1->SQL->Append("Select * From baza ");
DM1->Query1->Open();
DM1->Table1->Open();}}
else{
DM1->Query1->SQL->Clear();
DM1->Query1->SQL->Append("Select * From baza ");
DM1->Query1->Open();
DM1->Table1->Open();}
DM1->Table1->Refresh();}
//---------------------------------------------------------------------------
findcust.cpp:
#include <vcl.h>
#pragma hdrstop
#include "FindCust.h"
#include "Datam.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TfmFindCust* fmFindCust;
char field[2]={'A','Z'};
char w1;
//---------------------------------------------------------------------------
__fastcall TfmFindCust::TfmFindCust(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfmFindCust::ComboBox1Change(TObject *Sender)
{
if (ComboBox1->Text == "L.L.+.")
w1=field[0];
else if (ComboBox1->Text == "TЁ.+рыы")
{w1=field[1];
//Edit1->Text = "";
}
else
ComboBox1->Text ="L.L.+.";
w1=field[0];
}
//---------------------------------------------------------------------
void __fastcall TfmFindCust::Edit1Change(TObject *Sender)
{
bool Success;
Set<TLocateOption,0,1> flags;
flags << loCaseInsensitive << loPartialKey;
TLocateOptions Options;
Success = DM1->Table1->Locate(w1,Edit1->Text,flags);
DM1->Table1->Refresh();
}
//---------------------------------------------------------------------------
Report.cpp:
//---------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Report.h"
#include "Datam.h"
#include "kur1.h"
//---------------------------------------------------------------------
#pragma resource "*.dfm"
TQRListForm *QRListForm;
//---------------------------------------------------------------------
// QuickReport simple list
// - Connect a datasource to the QuickReport component
// - Put QRDBText components on the Detail band
//---------------------------------------------------------------------
__fastcall TQRListForm::TQRListForm(TComponent* AOwner)
: TForm(AOwner)
{
}
//---------------------------------------------------------------------
void __fastcall TQRListForm::QRGroup1NeedData(AnsiString &Value)
{
//QuickReport->NewPage();
}
//---------------------------------------------------------------------------
RichAbt.cpp:
//----------------------------------------------------------------------------
//Borland C++Builder