Автор работы: Пользователь скрыл имя, 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
begin
VeshSum.Value:=
end;
end.
Текст модуля fmPassword.
unit fmPassword;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons,Dialogs;
type
MyFile=record
pass:string[20];
end;
TPasswordDlg = class(TForm)
Label1: TLabel;
Password: TEdit;
OKBtn: TButton;
CancelBtn: TButton;
procedure OKBtnClick(Sender: TObject);
procedure CancelBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PasswordDlg: TPasswordDlg;
F:File of MyFile;
st:MyFile;
implementation
uses fmRashet;
{$R *.dfm}
procedure TPasswordDlg.OKBtnClick(
begin
AssignFile(F,'Pass.txt');
Reset(F);
Read(F,st);
CloseFile(F);
if Password.Text=st.pass then begin
GlavForm.Show;
PasswordDlg.Visible:=false;
end else begin
Password.Text:='';
Password.SetFocus;
MessageDlg('Неправильный пароль!', mtWarning, [mbOk], 0);
end;
end;
procedure TPasswordDlg.CancelBtnClick(
begin
close;
end;
end.
Текст модуля fmSmenaPass.
unit fmSmenaPass;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
MyFile=record
pass:string[20];
end;
TSmenaPass = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
SmenaPass: TSmenaPass;
F:File of MyFile;
st,st2:MyFile;
implementation
uses fmRashet;
{$R *.dfm}
procedure TSmenaPass.BitBtn2Click(
begin
Close;
end;
procedure TSmenaPass.BitBtn1Click(
begin
AssignFile(F,'Pass.txt');
Reset(F);
Read(F,st);
CloseFile(F);
if (Edit1.Text=st.pass) then begin
if (Edit2.Text=Edit3.Text) then begin
st2.pass:=Edit2.Text;
AssignFile(F,'Pass.txt');
Rewrite(F);
Write(F,st2);
CloseFile(F);
close;
end else begin
Edit2.Text:='';
Edit3.Text:='';
Edit2.SetFocus;
MessageDlg('Введенные пароли не совпадают. Повторите ввод нового пароля и его подтверждения!', mtWarning, [mbOk], 0);
end;
end else begin
Edit1.Text:='';
Edit2.Text:='';
Edit3.Text:='';
Edit1.SetFocus;
MessageDlg('Неправильный текущий пароль!', mtWarning, [mbOk], 0);
end;
end;
end.
Текст модуля fmDobavForm.
unit fmDobavForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, Mask, DBCtrls, ComCtrls;
type
TDobavForm = class(TForm)
PageControl1: TPageControl;
TabSheet3: TTabSheet;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
BitBtn5: TBitBtn;
BitBtn6: TBitBtn;
ComboBox1: TComboBox;
Edit11: TEdit;
ComboBox2: TComboBox;
procedure BitBtn5Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DobavForm: TDobavForm;
k,svP,svV:integer;
st:string;
KolZap:array[1..50] of integer;
NazvPokaz:array[1..50] of string;
NazvVesh:array[1..50,1..300]of string;
Clas:array[1..10] of string = ('A','B','C','D','E','F','G','
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
procedure TDobavForm.BitBtn5Click(
var
i,j,n,k,p:integer;
sr,sr2:string;
begin
if (Edit11.Text<>'') then begin
p:=1;
for i:=1 to (dm.Pokaz.RecordCount) do begin
dm.Pokaz.RecNo:=i;
for j:=1 to (dm.Vesh.RecordCount) do begin
dm.Vesh.RecNo:=j;
NazvVesh[1,p]:=dm.Vesh.
NazvVesh[2,p]:=dm.Vesh.
NazvVesh[3,p]:=dm.Vesh.
NazvVesh[4,p]:=dm.Vesh.
NazvVesh[5,p]:=dm.Vesh.
inc(p);
end;
kolZap[i]:=j-1;
end;
dm.Limit.Filtered:=false;
n:=10;
for i:=1 to n do begin
dm.Pokaz.RecNo:=i;
NazvPokaz[i]:=dm.Pokaz.
end;
dm.Limit.Insert;
dm.Limit.FieldByName('Limit').
dm.Limit.FieldByName('God').
dm.Limit.FieldByName('Kvartal'
case ComboBox1.ItemIndex of
0:begin
dm.Limit.FieldByName('TipL').
k:=1;
end;
1:begin
dm.Limit.FieldByName('TipL').
k:=2;
end;
2:begin
dm.Limit.FieldByName('TipL').
k:=3;
end;
end;
dm.Limit.Post;
for i:=1 to n do begin
dm.Pokaz.RecNo:=i;
sr:='';
sr2:=clas[i];
for j:=1 to k do sr:=sr+sr2;
dm.Pokaz.Insert;
dm.Pokaz.FieldByName('
dm.Pokaz.FieldByName('TipP').
dm.Pokaz.FieldByName('
end;
dm.Pokaz.Post;
n:=1;
p:=1;
for i:=1 to (dm.Pokaz.RecordCount) do begin
dm.Pokaz.RecNo:=i;
sr:='';
sr2:=clas[i];
for j:=1 to k do sr:=sr+sr2;
sr:=sr+IntToStr(dm.Limit.
for j:=1 to KolZap[n] do begin
dm.Vesh.RecNo:=j;
dm.Vesh.Insert;
dm.Vesh.FieldByName('
dm.Vesh.FieldByName('NormID').
dm.Vesh.FieldByName('
dm.Vesh.FieldByName('PovKoef')
dm.Vesh.FieldByName('
dm.Vesh.Post;
inc(p);
end;
inc(n);
end;
dm.Pokaz.RecNo:=1;
close;
end else MessageDlg('Введите год!', mtWarning, [mbOk], 0);
end;
procedure TDobavForm.ComboBox1Change(
var
s:string;
begin
case ComboBox1.ItemIndex of
0:s:='P12007';
1:s:='V12007';
2:s:='Z12007';
end;
s:=''''+s+'''';
dm.Limit.Filter:='TipL='+s;
dm.Limit.Filtered:=true;
end;
procedure TDobavForm.BitBtn6Click(
begin
dm.Limit.Filtered:=false;
dm.Limit.Cancel;
dm.Pokaz.Cancel;
dm.Vesh.Cancel;
close;
end;
end.
Текст модуля fmIzmenForm
unit fmIzmenForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, Mask, DBCtrls, ComCtrls;
type
TIzmenForm = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
DBEdit1: TDBEdit;
Label1: TLabel;
DBEdit3: TDBEdit;
Label3: TLabel;
DBEdit4: TDBEdit;
Label4: TLabel;
DBEdit5: TDBEdit;
Label5: TLabel;
TabSheet2: TTabSheet;
Label6: TLabel;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
DBEdit9: TDBEdit;
Label9: TLabel;
DBEdit10: TDBEdit;
Label10: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
DBNavigator1: TDBNavigator;
DBNavigator2: TDBNavigator;
TabSheet3: TTabSheet;
DBEdit11: TDBEdit;
DBEdit12: TDBEdit;
DBEdit13: TDBEdit;
DBEdit14: TDBEdit;
DBEdit15: TDBEdit;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
BitBtn5: TBitBtn;
DBNavigator3: TDBNavigator;
BitBtn6: TBitBtn;
TabSheet4: TTabSheet;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DBNavigator4: TDBNavigator;
BitBtn7: TBitBtn;
ComboBox1: TComboBox;
Edit1: TEdit;
ComboBox2: TComboBox;
BitBtn8: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn7Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn8Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
IzmenForm: TIzmenForm;
i,j,sv:integer;
Clas:array[1..10] of string = ('A','B','C','D','E','F','G','
NazvVesh:array[1..50,1..300]of string;
KolZap:array[1..50] of integer;
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
procedure TIzmenForm.BitBtn1Click(
begin
//dm.Pokaz.Post;
close;
end;
procedure TIzmenForm.BitBtn3Click(
begin
dm.Vesh.Post;
close;
end;
procedure TIzmenForm.BitBtn7Click(
var
s,s2,sr,sr2:string;
k,p,n,o:integer;
begin
if (Edit1.Text<>'') then begin
p:=1;
for i:=1 to (dm.Pokaz.RecordCount) do begin
dm.Pokaz.RecNo:=i;
for j:=1 to (dm.Vesh.RecordCount) do begin
dm.Vesh.RecNo:=j;
NazvVesh[3,p]:=dm.Vesh.
NazvVesh[4,p]:=dm.Vesh.
inc(p);
end;
kolZap[i]:=j-1;
end;
dm.Limit.Filtered:=false;
dm.Limit.RecNo:=sv;
case ComboBox1.ItemIndex of
0: begin
s:='P';
k:=1;
end;
1: begin
s:='V';
k:=2;
end;
2: begin
s:='Z';
k:=3;
end;
end;
n:=1;
p:=1;
for i:=1 to (dm.Pokaz.RecordCount) do begin
dm.Pokaz.RecNo:=i;
for j:=1 to KolZap[n] do begin
dm.Vesh.RecNo:=j;
dm.Vesh.Edit;
dm.Vesh.FieldByName('
dm.Vesh.FieldByName('PovKoef')
dm.Vesh.Post;
inc(p);
end;
inc(n);
end;
n:=1;
for i:=1 to (dm.Pokaz.RecordCount) do begin
dm.Pokaz.RecNo:=i;
sr:='';
sr2:=clas[i];
for j:=1 to k do sr:=sr+sr2;
sr:=sr+ComboBox2.Text+Edit1.
for j:=1 to KolZap[n] do begin
dm.Vesh.RecNo:=j;
dm.Vesh.Edit;
dm.Vesh.FieldByName('
dm.Vesh.Post;
end;
inc(n);
end;
for i:=1 to (dm.Pokaz.RecordCount) do begin
s2:='';
for j:=1 to k do s2:=s2+clas[i];
dm.Pokaz.RecNo:=i;
dm.Pokaz.Edit;
dm.Pokaz.FieldByName('
dm.Pokaz.Edit;
end;
for i:=1 to (dm.Pokaz.RecordCount) do begin
dm.Pokaz.RecNo:=i;
dm.Pokaz.Edit;
dm.Pokaz.FieldByName('Tip').
end;
dm.Pokaz.Post;
dm.Limit.Edit;
dm.Limit.FieldByName('Limit').
dm.Limit.FieldByName('God').
dm.Limit.FieldByName('Kvartal'
dm.Limit.FieldByName('Tip').
dm.Limit.Post;
end else MessageDlg('Введите год!', mtWarning, [mbOk], 0);
end;
procedure TIzmenForm.FormActivate(Sender
begin
sv:=dm.Limit.RecNo;
Edit1.Text:=IntToStr(dm.Limit.
ComboBox2.Text:=IntToStr(dm.
ComboBox1.Text:=dm.Limit.
end;
procedure TIzmenForm.ComboBox1Change(
var
s:string;
begin
case ComboBox1.ItemIndex of
0:s:='P12007';
1:s:='V12007';
2:s:='Z12007';
end;
s:=''''+s+'''';
dm.Limit.Filter:='Tip='+s;
dm.Limit.Filtered:=true;
end;
procedure TIzmenForm.BitBtn2Click(
begin
dm.Pokaz.Cancel;
close;
end;
procedure TIzmenForm.BitBtn8Click(
begin
dm.Limit.Cancel;
dm.Pokaz.Cancel;
dm.Vesh.Cancel;
close;
end;
procedure TIzmenForm.BitBtn4Click(
begin
dm.Vesh.Cancel;
Close;
end;
procedure TIzmenForm.BitBtn5Click(
begin
//dm.Norma.Post;
close;
end;
procedure TIzmenForm.BitBtn6Click(
begin
dm.Norma.Cancel;
close;
end;
end.
Текст модуля fmVibor.
unit fmVibor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;
type
TViborForm = class(TForm)
RadioGroup1: TRadioGroup;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ViborForm: TViborForm;
implementation
uses fmRashet, fmVoprosForm, fmVoprosForm2, fmVoprosForm3;
{$R *.dfm}
procedure TViborForm.BitBtn1Click(
begin
Case RadioGroup1.ItemIndex of
0:VoprosForm.ShowModal;
1:VoprosForm2.ShowModal;
2:VoprosForm3.ShowModal;
end;
Close;
end;
procedure TViborForm.BitBtn2Click(
begin
Close;
end;
end.
Текст модуля fmVoprosForm.
unit fmVoprosForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TVoprosForm = class(TForm)
Panel1: TPanel;
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
VoprosForm: TVoprosForm;
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
procedure TVoprosForm.BitBtn2Click(
begin
dm.Pokaz.First;
while (not dm.Pokaz.Eof) do begin
while (not dm.Vesh.Eof) do
dm.Vesh.Delete;
dm.Pokaz.delete;
end;
dm.Limit.delete;
close;
end;
procedure TVoprosForm.BitBtn1Click(
begin
Close;
end;
end.
Текст модуля fmVoprosForm2.
unit fmVoprosForm2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TVoprosForm2 = class(TForm)
aaa: TPanel;
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
VoprosForm2: TVoprosForm2;
implementation
uses dmRashet, fmRashet;
{$R *.dfm}
procedure TVoprosForm2.BitBtn2Click(
begin
dm.Vesh.First;
while not dm.Vesh.Eof do
dm.Vesh.delete;
dm.Pokaz.delete;
close;
end;
procedure TVoprosForm2.BitBtn1Click(
begin
Close;
end;
end.
Текст модуля fmVoprosForm3.
unit fmVoprosForm3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TVoprosForm3 = class(TForm)
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
VoprosForm3: TVoprosForm3;
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
procedure TVoprosForm3.BitBtn1Click(
begin
dm.Vesh.delete;
close;
end;
procedure TVoprosForm3.BitBtn2Click(
begin
Close;
end;
end.
Текст модуля fmSortForm.
unit fmSortForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TSortForm = class(TForm)
RadioGroup2: TRadioGroup;
RadioGroup1: TRadioGroup;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure Button2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
SortForm: TSortForm;
implementation
uses fmRashet, dmRashet;
{$R *.dfm}
procedure TSortForm.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TSortForm.BitBtn1Click(Sender: TObject);
var
st:string;
begin
if RadioGroup2.ItemIndex=0 then begin
case RadioGroup1.ItemIndex of
0: st:='Lim';
1: st:='G';
2: st:='Kvart';
3: st:='All';
end;
dm.Limit.IndexName:=st;
end;
if RadioGroup2.ItemIndex=1 then begin
case RadioGroup1.ItemIndex of
0: st:='LimD';
1: st:='GD';
2: st:='KvartD';
3: st:='AllD';
end;
dm.Limit.IndexName:=st;
end;
end;
procedure TSortForm.BitBtn2Click(Sender: TObject);
begin
close;
end;
end.
Текст модуля fmPoisk.
unit fmPoisk;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Spin, DBCtrls, Grids, DBGrids, ExtCtrls;
type
TPoiskForm = class(TForm)
Edit1: TEdit;
Label1: TLabel;
DBGrid1: TDBGrid;
Button1: TButton;
Button2: TButton;
Button3: TButton;
CheckBox1: TCheckBox;
RadioGroup1: TRadioGroup;