Автор работы: Пользователь скрыл имя, 29 Ноября 2012 в 12:39, курсовая работа
Целью данного курсового проекта является разработка и реализация базы данных для ресторана, чтобы обеспечить хранение, накопление и предоставление информации о деятельности ресторана. Создаваемая база данных предназначена в основном для автоматизации деятельности основных подразделений ресторана, а именно кухня, бухгалтерия, а также обслуживания клиентов.
Задачами курсового проекта являются:
описание предметной области;
описание технологии функционирования ИС;
построение концептуальной и даталогической (реляционной) модели БД;
физическое проектирование БД;
разработка функциональной модели СУБД;
разработка экранных форм ввода-вывода и отчета;
разработка функциональных модулей.
Разработанная база данных проста в
применении и может быть использована
в любом ресторане.
Листинг программы
Модуль «Главное окно программы»
unit Restaurant;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, DBTables, Menus, StdCtrls, DBCtrls, RpCon,
RpConDS, RpDefine, RpRave, jpeg, ExtCtrls;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N4: TMenuItem;
Image1: TImage;
N9: TMenuItem;
procedure N6Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure Image1Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure N9Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2, Unit3, Unit4, Unit5, Unit6, Unit7, Unit8;
{$R *.dfm}
procedure TForm1.N6Click(Sender: TObject);
begin
Form2.Show;
end;
procedure TForm1.N8Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.N7Click(Sender: TObject);
begin
Form3.Show;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Form4:=TForm4.Create(
Form4.ShowModal; {Показать форму модально}
Form4.Free; {Закрыть форму с заставкой}
end;
procedure TForm1.N2Click(Sender: TObject);
begin
Form5.Show;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
Form6.Show;
end;
procedure TForm1.Image1Click(Sender: TObject);
begin
Form7.Show;
end;
procedure TForm1.N4Click(Sender: TObject);
begin
Form7.Show;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MessageDlg('Вы действительно
[mbYes, mbNo], 0) = mrYes then
begin
Action := caFree
end
else
Action := caNone;
end;
procedure TForm1.N9Click(Sender: TObject);
begin
Form8.Show;
end;
end.
Модуль «О программе»
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Image1: TImage;
Label1: TLabel;
Bevel1: TBevel;
Bevel2: TBevel;
Bevel3: TBevel;
Bevel4: TBevel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
Close;
end;
Модуль «Об авторе»
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm3 = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
Close;
end;
end.
Модуль «Заставка»
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, jpeg;
type
TForm4 = class(TForm)
Image1: TImage;
Label1: TLabel;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
procedure TForm4.FormCreate(Sender: TObject);
begin
Close;
end;
end.
Модуль «Персонал»
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, DB, DBTables, Grids, DBGrids, StdCtrls;
type
TForm5 = class(TForm)
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Table1: TTable;
DBNavigator1: TDBNavigator;
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Button2: TButton;
RadioGroup1: TRadioGroup;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
Table1.Locate('Familiya', edit1.text, [loCaseInsensitive,
end;
procedure TForm5.Button2Click(Sender: TObject);
begin
Form5.Close;
end;
procedure TForm5.RadioGroup1Click(
begin
case RadioGroup1.ItemIndex of
0: Table1.IndexName:= '_data_rogden';
1: Table1.IndexName:= 'Kod_dolgnosti';
end;
end;
Модуль «Постоянные клиенты»
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, Grids, DBGrids, StdCtrls, ExtCtrls, DBCtrls;
type
TForm6 = class(TForm)
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Table1: TTable;
DBNavigator1: TDBNavigator;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
{$R *.dfm}
procedure TForm6.Button1Click(Sender: TObject);
var Ysl, Field2: String;
begin
If edit1.Text<>'' then edit1.Text:=Chr(39)+Edit1.
Field2:='Procent_skidki';
Ysl:=Field2+'='+Edit1.text;
table1.Filtered:=True;
table1.FilterOptions:=[
table1.Filter:=Ysl;
end;
procedure TForm6.FormCreate(Sender: TObject);
begin
Table1.Filtered:=False;
end;
procedure TForm6.Button2Click(Sender: TObject);
begin
Form6.Close;
end;
end.
Модуль «Ассортимент блюд»
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls, RpCon, RpConDS, RpDefine, RpRave,
Menus, StdCtrls, DBCtrls, DB, DBTables, Grids, DBGrids, Mask, jpeg;
type
TForm7 = class(TForm)
DataSource1: TDataSource;
DBMemo1: TDBMemo;
Label1: TLabel;
MainMenu1: TMainMenu;
N1: TMenuItem;
RvProject1: TRvProject;
RvDataSetConnection1: TRvDataSetConnection;
Label2: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
DBGrid1: TDBGrid;
Table1: TTable;
Label3: TLabel;
DBGrid2: TDBGrid;
DataSource2: TDataSource;
Table2: TTable;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
DBEdit7: TDBEdit;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Image1: TImage;
Button8: TButton;
Query1: TQuery;
DataSource3: TDataSource;
Table1Kod_bluda: TAutoIncField;
Table1Naimen_bluda: TStringField;
Table1Soderganie: TStringField;
Table1Kalorinost: TIntegerField;
Table1Ves_bluda: TIntegerField;
Table1Vremya_prigot: TStringField;
Table1Stoimost_rub: TIntegerField;
Table1Kod_vida: TIntegerField;
C1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
Query2: TQuery;
DataSource4: TDataSource;
DataSource5: TDataSource;
Query3: TQuery;
Query4: TQuery;
DataSource6: TDataSource;
DataSource7: TDataSource;
DataSource8: TDataSource;
Query5: TQuery;
Query6: TQuery;
RvProject2: TRvProject;
RvDataSetConnection2: TRvDataSetConnection;
RvProject3: TRvProject;
RvDataSetConnection3: TRvDataSetConnection;
RvProject4: TRvProject;
RvDataSetConnection4: TRvDataSetConnection;
RvProject5: TRvProject;
RvDataSetConnection5: TRvDataSetConnection;
RvProject6: TRvProject;
RvDataSetConnection6: TRvDataSetConnection;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure C1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form7: TForm7;
implementation
uses Restaurant;
{$R *.dfm}
procedure TForm7.Button1Click(Sender: TObject);
var Field1, Yslovie: String;
begin
If edit1.Text<>'' then edit1.Text:=Chr(39)+Edit1.
Field1:='Kod_vida';
Yslovie:=Field1+'='+Edit1.
table1.Filtered:=True;
table1.FilterOptions:=[
table1.Filter:=Yslovie;
end;
procedure TForm7.FormCreate(Sender: TObject);
begin
Table1.FilterOptions:=[
table1.Filtered:=False;
end;
procedure TForm7.Button2Click(Sender: TObject);
begin
table1.Filtered:=false;
end;
procedure TForm7.Button4Click(Sender: TObject);
begin
IF Table1.State = dsBrowse THEN
Table1.Insert;
end;
procedure TForm7.Button5Click(Sender: TObject);
begin
IF Table1.State = dsBrowse THEN
Table1.Edit;
end;
procedure TForm7.Button6Click(Sender: TObject);
begin
IF Table1.State = dsBrowse THEN
IF MessageDlg( 'Подтвердите удаление записи!', mtConfirmation, [mbYes, mbNo],0) = mrYes THEN
Table1.Delete;
end;
procedure TForm7.Button7Click(Sender: TObject);
begin
IF Table1.State in [dsInsert,dsEdit] THEN
Table1.Post;
end;
procedure TForm7.Button8Click(Sender: TObject);
begin
Form7.Close;
end;
procedure TForm7.C1Click(Sender: TObject);
begin
RvProject1.Execute;
end;
procedure TForm7.N2Click(Sender: TObject);
begin
RvProject2.Execute;
end;
procedure TForm7.N4Click(Sender: TObject);
begin
RvProject4.Execute;
end;
procedure TForm7.N3Click(Sender: TObject);
begin
RvProject3.Execute;
end;
procedure TForm7.N5Click(Sender: TObject);
begin
RvProject5.Execute;
end;
procedure TForm7.N6Click(Sender: TObject);
begin
RvProject6.Execute;
end;
end.
Модуль «Заказы»
unit Unit8;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, Grids, DBGrids, StdCtrls, Mask, DBCtrls, RpCon,
RpConDS, RpDefine, RpRave, ExtCtrls;
type
TForm8 = class(TForm)
DataSource1: TDataSource;
Table1: TTable;
Query1: TQuery;
DataSource2: TDataSource;
DBEdit1: TDBEdit;
DBEdit3: TDBEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
RvProject1: TRvProject;
RvDataSetConnection7: TRvDataSetConnection;
Button4: TButton;
Button5: TButton;
RvProject2: TRvProject;
RvDataSetConnection8: TRvDataSetConnection;
DataSource3: TDataSource;
Table2: TTable;
DBGrid3: TDBGrid;
RvProject3: TRvProject;
RvDataSetConnection9: TRvDataSetConnection;
Button6: TButton;
Label1: TLabel;
DBEdit2: TDBEdit;
DBEdit4: TDBEdit;
Label2: TLabel;
DBGrid1: TDBGrid;
DataSource4: TDataSource;
DBGrid4: TDBGrid;
Table3: TTable;
Edit1: TEdit;
Label3: TLabel;
Button8: TButton;
Query2: TQuery;
DataSource5: TDataSource;
DBGrid5: TDBGrid;
DBGrid2: TDBGrid;
Bevel1: TBevel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form8: TForm8;
implementation
{$R *.dfm}
procedure TForm8.Button1Click(Sender: TObject);
begin
IF Table1.State = dsBrowse THEN
Table1.Insert;
end;
procedure TForm8.Button2Click(Sender: TObject);
begin
IF Table1.State in [dsInsert,dsEdit] THEN
Table1.Post;
end;
procedure TForm8.Button3Click(Sender: TObject);
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add ('SELECT T.Naimen_bluda, K.Kolichestvo, T.Stoimost_rub, (K.Kolichestvo * T.Stoimost_rub) As Stoimost');
Query1.SQL.Add ('FROM Menu T, Zakazu K');
Query1.SQL.Add ('WHERE T.Kod_bluda=K.Kod_bluda');
Query1.Open;
end;
procedure TForm8.Button4Click(Sender: TObject);
begin
If Query1.FieldByName('Naimen_
begin
if Query1.FieldByName('
if Query1.FieldByName('Stoimost_
if Query1.FieldByName('Stoimost')
if DbEdit2.Text<>'' then
if DbEdit4.Text<>'' then
RvProject1.Execute;
end
else
ShowMessage('Заказ отсутствует!');
if DbEdit2.Text='' then ShowMessage('Некому принять заказ');
if DbEdit4.Text='' then ShowMessage('Некого обслужить');
end;
procedure TForm8.Button5Click(Sender: TObject);
begin
Form8.Close;
end;
procedure TForm8.Button6Click(Sender: TObject);
begin
IF Table1.State = dsBrowse THEN
Table1.Delete;
end;
procedure TForm8.Button8Click(Sender: TObject);
begin
If Table3.Locate('Kod_klienta', edit1.text, [loCaseInsensitive,
begin
ShowMessage ('Наличие скидки');
Query2.Active:=True;
end
else
ShowMessage ('Cкидки нет');
end;
end.