Автор работы: Пользователь скрыл имя, 12 Марта 2012 в 19:19, курсовая работа
В настоящее время уровень компьютеризации во всех сферах человеческой жизни достиг небывалых высот. Уже трудно представить какое либо крупное промышленное предприятие без компьютерного управления производством, наука шагает семимильными шагами опять же благодаря компьютерным технологиям, медицина стала более эффективна благодаря «умным машинам».
Введение 3
1. Основные понятия
1.1 Описание среды разработки. 4
1.2 Организация баз данных 5
1.3 Поддержка языков БД 7
1.4 BDE………………………………………………………………….8
1.5 Архитектура СУБД 9
2. Постановка задачи 11
3. Использованные инструменты Delphi 12
4. Описание базы данных 12
4.1 Связь таблиц……………………………………………………….. 13
5. Структура программного продукта 14
5.1 Межмодульные связи………………………………………………15
6. Разработанные алгоритмы по теме работы…….....…………16
6.1 Сортировка………………………………………………………….16
6.2 Поиск………………………………………………………………...16
6.3 Фильтрация………………………………………………………….16
6.4 Формирование запросов……………………………………………16
6.5 Формирование отчетов 16
7. Описание пользовательского интерфейса 17
8. Заключение 23
9. Список использованной литературы 24
Приложение А. Текст программы. 18
Приложение Б. Экранные формы. 35
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PoiskForm: TPoiskForm;
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
procedure TPoiskForm.Button2Click(
begin
close;
end;
procedure TPoiskForm.Button1Click(
var
a,b,st,tab,z:string;
begin
tab:='';
z:='';
case RadioGroup1.ItemIndex of
0: begin
st:='Pokazatel';
tab:='Pokazateli ';
z:='';
end;
1: begin
st:='PlataPoPlanu';
tab:='Pokazateli ';
z:='';
end;
2: begin
st:='PlataPoFaktu';
tab:='Pokazateli ';
z:='';
end;
3: begin
st:='PlataVBudjet';
tab:='Pokazateli ';
z:='';
end;
4: begin
st:='Veshestvo';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
5: begin
st:='NormPlatZaTonn';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
6: begin
st:='PovKoef';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
7: begin
st:='ObemZagr';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
8: begin
st:='Plata';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
end;
a:=edit1.Text;
b:='=';
if (RadioGroup1.ItemIndex=0) or (RadioGroup1.ItemIndex=4) then begin
if CheckBox1.Checked then begin
a:=Edit1.Text+'%';
b:=' LIKE ';
end;
a:=''''+a+'''';
end;
dm.Query2.SQL.Clear;
dm.Query2.SQL.Text:='SELECT DISTINCT Pokazatel,PlataPoPlanu,
dm.Query2.Open;
end;
procedure TPoiskForm.Button3Click(
begin
dm.Query2.SQL.Clear;
dm.Query2.SQL.Text:='SELECT * FROM Pokazateli';
dm.Query2.Open;
end;
procedure TPoiskForm.FormActivate(
begin
dm.DataSource2.DataSet:=dm.
end;
procedure TPoiskForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
dm.DataSource2.DataSet:=dm.
end;
procedure TPoiskForm.FormCreate(Sender: TObject);
begin
DecimalSeparator:=('.');
end;
end.
Текст модуля fmFilterForm.
unit fmFilterForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls;
type
TFilterForm = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
GroupBox2: TGroupBox;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
DBGrid1: TDBGrid;
RadioGroup1: TRadioGroup;
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FilterForm: TFilterForm;
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
procedure TFilterForm.Button3Click(
begin
close;
end;
procedure TFilterForm.Button1Click(
var
a,b,st,tab,z:string;
begin
case RadioGroup1.ItemIndex of
0: begin
st:='PlataPoPlanu';
tab:='Pokazateli ';
z:='';
end;
1: begin
st:='PlataPoFaktu';
tab:='Pokazateli ';
z:='';
end;
2: begin
st:='PlataVBudjet';
tab:='Pokazateli ';
z:='';
end;
3: begin
st:='NormPlatZaTonn';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
4: begin
st:='PovKoef';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
5: begin
st:='ObemZagr';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
6: begin
st:='Plata';
tab:='Pokazateli,Veshestva ';
z:=' AND (ClassPokaz=ClassVesh)';
end;
end;
a:=Edit1.Text;
b:=Edit2.Text;
dm.Query1.SQL.Clear;
dm.Query1.SQL.Text:='SELECT DISTINCT Pokazatel,PlataPoPlanu,
dm.Query1.Open;
end;
procedure TFilterForm.Button2Click(
begin
dm.Query1.SQL.Clear;
dm.Query1.SQL.Text:='SELECT * FROM Pokazateli';
dm.Query1.Open;
end;
procedure TFilterForm.FormActivate(
begin
dm.DataSource2.DataSet:=dm.
end;
procedure TFilterForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
dm.DataSource2.DataSet:=dm.
end;
procedure TFilterForm.FormCreate(Sender: TObject);
begin
DecimalSeparator:=('.');
end;
end.
Текст модуля fmZapros.
unit fmZapros;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids, DBGrids, ComCtrls, ExtCtrls, XPMan;
type
MyFile=record
pass:string[255];
end;
TZaprosForm = class(TForm)
Panel1: TPanel;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
CheckBox2: TCheckBox;
CheckBox1: TCheckBox;
CheckBox3: TCheckBox;
GroupBox3: TGroupBox;
CheckBox4: TCheckBox;
CheckBox5: TCheckBox;
CheckBox6: TCheckBox;
CheckBox7: TCheckBox;
GroupBox4: TGroupBox;
CheckBox8: TCheckBox;
CheckBox9: TCheckBox;
CheckBox10: TCheckBox;
CheckBox11: TCheckBox;
CheckBox12: TCheckBox;
GroupBox5: TGroupBox;
CheckBox13: TCheckBox;
CheckBox14: TCheckBox;
CheckBox15: TCheckBox;
CheckBox16: TCheckBox;
CheckBox17: TCheckBox;
GroupBox15: TGroupBox;
GroupBox6: TGroupBox;
ComboBox1: TComboBox;
GroupBox7: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit3: TEdit;
GroupBox8: TGroupBox;
Label3: TLabel;
Label4: TLabel;
Edit2: TEdit;
Edit4: TEdit;
GroupBox16: TGroupBox;
GroupBox9: TGroupBox;
ComboBox2: TComboBox;
GroupBox10: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Edit5: TEdit;
Edit6: TEdit;
GroupBox11: TGroupBox;
Label7: TLabel;
Label8: TLabel;
Edit7: TEdit;
Edit8: TEdit;
GroupBox12: TGroupBox;
Label9: TLabel;
Label10: TLabel;
Edit9: TEdit;
Edit10: TEdit;
GroupBox17: TGroupBox;
GroupBox13: TGroupBox;
GroupBox14: TGroupBox;
Label11: TLabel;
Label12: TLabel;
Edit12: TEdit;
Edit13: TEdit;
GroupBox18: TGroupBox;
Label13: TLabel;
Label14: TLabel;
Edit14: TEdit;
Edit15: TEdit;
GroupBox19: TGroupBox;
Label15: TLabel;
Label16: TLabel;
Edit16: TEdit;
Edit17: TEdit;
GroupBox20: TGroupBox;
Label17: TLabel;
Label18: TLabel;
Edit18: TEdit;
Edit19: TEdit;
GroupBox21: TGroupBox;
GroupBox22: TGroupBox;
Label19: TLabel;
Label20: TLabel;
Edit20: TEdit;
Edit21: TEdit;
GroupBox23: TGroupBox;
Label21: TLabel;
Label22: TLabel;
Edit22: TEdit;
Edit23: TEdit;
GroupBox24: TGroupBox;
Label23: TLabel;
Label24: TLabel;
Edit24: TEdit;
Edit25: TEdit;
GroupBox25: TGroupBox;
Label25: TLabel;
Label26: TLabel;
Edit26: TEdit;
Edit27: TEdit;
GroupBox26: TGroupBox;
Label27: TLabel;
Label28: TLabel;
Edit28: TEdit;
Edit29: TEdit;
Button2: TButton;
Button1: TButton;
Button3: TButton;
Button4: TButton;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
DBGrid4: TDBGrid;
ComboBox3: TComboBox;
CheckBox18: TCheckBox;
ComboBox4: TComboBox;
DBGrid5: TDBGrid;
CheckBox19: TCheckBox;
GroupBox27: TGroupBox;
Label29: TLabel;
Label30: TLabel;
Edit11: TEdit;
Edit30: TEdit;
CheckBox20: TCheckBox;
ComboBox5: TComboBox;
procedure CheckBox1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure CheckBox3Click(Sender: TObject);
procedure CheckBox8Click(Sender: TObject);
procedure CheckBox4Click(Sender: TObject);
procedure CheckBox5Click(Sender: TObject);
procedure CheckBox6Click(Sender: TObject);
procedure CheckBox7Click(Sender: TObject);
procedure CheckBox9Click(Sender: TObject);
procedure CheckBox10Click(Sender: TObject);
procedure CheckBox11Click(Sender: TObject);
procedure CheckBox12Click(Sender: TObject);
procedure CheckBox13Click(Sender: TObject);
procedure CheckBox14Click(Sender: TObject);
procedure CheckBox15Click(Sender: TObject);
procedure CheckBox16Click(Sender: TObject);
procedure CheckBox17Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure DBGrid3CellClick(Column: TColumn);
procedure DBGrid2CellClick(Column: TColumn);
procedure DBGrid1CellClick(Column: TColumn);
procedure FormActivate(Sender: TObject);
procedure DBGrid2ColEnter(Sender: TObject);
procedure DBGrid1ColEnter(Sender: TObject);
procedure DBGrid3ColEnter(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure CheckBox18Click(Sender: TObject);
procedure ComboBox4Change(Sender: TObject);
procedure CheckBox19Click(Sender: TObject);
procedure CheckBox20Click(Sender: TObject);
procedure DBGrid4ColEnter(Sender: TObject);
procedure DBGrid4CellClick(Column: TColumn);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ZaprosForm: TZaprosForm;
che:array[1..20] of TCheckBox;
pole:array[1..18] of string=('Limit','God','
ZaTab,Zapros:string;
Zap:array[1..18] of string;
Sravn:array[1..20] of integer;
i,j,nk:integer;
ok,sto:boolean;
vp1,vp2,nz2,vp3,nz3,nz4:
F:File of MyFile;
st:MyFile;
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
Procedure ViewTab;
begin
With ZaprosForm do begin
dm.q2.SQL.Clear;
dm.q2.SQL.Text:='SELECT * FROM Pokazateli WHERE TipP='+''''+(DBGrid1.Fields[2]
dm.q2.Open;
dm.q3.SQL.Clear;
dm.q3.SQL.Text:='SELECT * FROM Veshestva WHERE ClassVesh='+''''+(DBGrid2.
dm.q3.Open;
dm.q4.SQL.Clear;
dm.q4.SQL.Text:='SELECT * FROM Normative WHERE VeshNID='+IntToStr(DBGrid3.
dm.q4.Open;
end;
end;
procedure TZaprosForm.CheckBox1Click(
begin
if ((CheckBox1.Checked) and (not CheckBox18.Checked)) or ((CheckBox1.Checked) and ok) then GroupBox6.Visible:=true
else GroupBox6.Visible:=false;
if CheckBox18.Checked then
if CheckBox1.Checked then begin
Sravn[nk]:=1;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.Button4Click(
begin
Close;
end;
procedure TZaprosForm.CheckBox2Click(
begin
if ((CheckBox2.Checked) and (not CheckBox18.Checked)) or ((CheckBox2.Checked) and ok) then GroupBox7.Visible:=true
else GroupBox7.Visible:=false;
if CheckBox18.Checked then
if CheckBox2.Checked then begin
Sravn[nk]:=2;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox3Click(
begin
if ((CheckBox3.Checked) and (not CheckBox18.Checked)) or ((CheckBox3.Checked) and ok) then GroupBox8.Visible:=true
else GroupBox8.Visible:=false;
if CheckBox18.Checked then
if CheckBox3.Checked then begin
Sravn[nk]:=3;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox8Click(
begin
if (CheckBox8.Checked) and (not CheckBox18.Checked) then GroupBox13.Visible:=true
else GroupBox13.Visible:=false;
if CheckBox18.Checked then
if CheckBox8.Checked then begin
Sravn[nk]:=8;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox4Click(
begin
if ((CheckBox4.Checked) and (not CheckBox18.Checked)) or ((CheckBox4.Checked) and ok) then GroupBox9.Visible:=true
else GroupBox9.Visible:=false;
if CheckBox18.Checked then
if CheckBox4.Checked then begin
Sravn[nk]:=4;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox5Click(
begin
if ((CheckBox5.Checked) and (not CheckBox18.Checked)) or ((CheckBox5.Checked) and ok) then GroupBox10.Visible:=true
else GroupBox10.Visible:=false;
if CheckBox18.Checked then
if CheckBox5.Checked then begin
Sravn[nk]:=5;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox6Click(
begin
if ((CheckBox6.Checked) and (not CheckBox18.Checked)) or ((CheckBox6.Checked) and ok) then GroupBox11.Visible:=true
else GroupBox11.Visible:=false;
if CheckBox18.Checked then
if CheckBox6.Checked then begin
Sravn[nk]:=6;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox7Click(
begin
if ((CheckBox7.Checked) and (not CheckBox18.Checked)) or ((CheckBox7.Checked) and ok) then GroupBox12.Visible:=true
else GroupBox12.Visible:=false;
if CheckBox18.Checked then
if CheckBox7.Checked then begin
Sravn[nk]:=7;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox9Click(
begin
if (CheckBox9.Checked) and (not CheckBox18.Checked) then GroupBox14.Visible:=true
else GroupBox14.Visible:=false;
if CheckBox18.Checked then
if CheckBox9.Checked then begin
Sravn[nk]:=9;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox10Click(
begin
if (CheckBox10.Checked) and (not CheckBox18.Checked) then GroupBox18.Visible:=true
else GroupBox18.Visible:=false;
if CheckBox18.Checked then
if CheckBox10.Checked then begin
Sravn[nk]:=10;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox11Click(
begin
if (CheckBox11.Checked) and (not CheckBox18.Checked) then GroupBox19.Visible:=true
else GroupBox19.Visible:=false;
if CheckBox18.Checked then
if CheckBox11.Checked then begin
Sravn[nk]:=11;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox12Click(
begin
if (CheckBox12.Checked) and (not CheckBox18.Checked) then GroupBox20.Visible:=true
else GroupBox20.Visible:=false;
if CheckBox18.Checked then
if CheckBox12.Checked then begin
Sravn[nk]:=12;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox13Click(
begin
if (CheckBox13.Checked) and (not CheckBox18.Checked) then GroupBox22.Visible:=true
else GroupBox22.Visible:=false;
if CheckBox18.Checked then
if CheckBox13.Checked then begin
Sravn[nk]:=13;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox14Click(
begin
if (CheckBox14.Checked) and (not CheckBox18.Checked) then GroupBox23.Visible:=true
else GroupBox23.Visible:=false;
if CheckBox18.Checked then
if CheckBox14.Checked then begin
Sravn[nk]:=14;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox15Click(
begin
if (CheckBox15.Checked) and (not CheckBox18.Checked) then GroupBox24.Visible:=true
else GroupBox24.Visible:=false;
if CheckBox18.Checked then
if CheckBox15.Checked then begin
Sravn[nk]:=15;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox16Click(
begin
if (CheckBox16.Checked) and (not CheckBox18.Checked) then GroupBox25.Visible:=true
else GroupBox25.Visible:=false;
if CheckBox18.Checked then
if CheckBox16.Checked then begin
Sravn[nk]:=16;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.CheckBox17Click(
begin
if (CheckBox17.Checked) and (not CheckBox18.Checked) then GroupBox26.Visible:=true
else GroupBox26.Visible:=false;
if CheckBox18.Checked then
if CheckBox17.Checked then begin
Sravn[nk]:=17;
inc(nk);
end else dec(nk);
end;
procedure TZaprosForm.Button3Click(
begin
CheckBox1.Checked:=false;
CheckBox2.Checked:=false;
CheckBox3.Checked:=false;
CheckBox4.Checked:=false;
CheckBox5.Checked:=false;
CheckBox6.Checked:=false;
CheckBox7.Checked:=false;
CheckBox8.Checked:=false;
CheckBox9.Checked:=false;
CheckBox10.Checked:=false;
CheckBox11.Checked:=false;
CheckBox12.Checked:=false;
CheckBox13.Checked:=false;
CheckBox14.Checked:=false;
CheckBox15.Checked:=false;
CheckBox16.Checked:=false;
CheckBox17.Checked:=false;
end;
procedure TZaprosForm.Button1Click(
var
flag:boolean;
k1,k2,k3,k4,n:integer;
svz,s,sm:string;
p:real;
begin
DecimalSeparator:=('.');
k1:=0;
k2:=0;
k3:=0;
k4:=0;
n:=0;
vp1:=true;
vp2:=true;
vp3:=true;
nz2:=false;
nz3:=false;
nz4:=false;
sm:='';
for i:=1 to 18 do
if che[i].Checked then begin
if (i>=1) and (i<=3) or (i=18) then inc(k1);
if (i>=4) and (i<=7) then inc(k2);
if (i>=8) and (i<=12) then inc(k3);
if (i>=13) and (i<=17) then inc(k4);
end;
for i:=1 to 18 do
if che[i].Checked then inc(n);
if n<>0 then begin
ZaTab:='';
for i:=1 to 18 do Zap[i]:='';
for i:=1 to 18 do
if che[i].Checked then begin
case i of
1: Zap[i]:='('+Pole[i]+'='+''''+
2: if (Edit1.Text='') then Zap[i]:='('+Pole[i]+'<='+
else if (Edit3.Text='') then Zap[i]:='('+Pole[i]+'>='+
else Zap[i]:='('+Pole[i]+'>='+
3: if (Edit2.Text='') then Zap[i]:='('+Pole[i]+'<='+
else if (Edit4.Text='') then Zap[i]:='('+Pole[i]+'>='+