Смекни!
smekni.com

Разработка информационной системы Отель (стр. 4 из 4)

RadioGroup1: TRadioGroup;

Label12: TLabel;

Label13: TLabel;

Label14: TLabel;

Label15: TLabel;

Button2: TButton;

Button3: TButton;

Button4: TButton;

Button5: TButton;

RadioGroup2: TRadioGroup;

Label23: TLabel;

Label24: TLabel;

Label26: TLabel;

Label27: TLabel;

Label28: TLabel;

Label29: TLabel;

Label30: TLabel;

Label31: TLabel;

Label32: TLabel;

Button6: TButton;

Button7: TButton;

Button8: TButton;

Button9: TButton;

Label33: TLabel;

Label34: TLabel;

Label35: TLabel;

Label41: TLabel;

Label42: TLabel;

Label43: TLabel;

Button11: TButton;

Button12: TButton;

Button13: TButton;

Label44: TLabel;

Label45: TLabel;

Label46: TLabel;

Button14: TButton;

Table1Nom_kom: TSmallintField;

Table1Klass: TStringField;

Table1Kolvo_mest: TSmallintField;

Table1Stoimost: TCurrencyField;

Table1Opisanie: TStringField;

Table2Nom_kom: TSmallintField;

Table2K_post: TSmallintField;

Table2Data_zas: TDateField;

Table2Data_vus: TDateField;

Table2Bron: TBooleanField;

Table2K_zan: TSmallintField;

Table3K_post: TSmallintField;

Table3Fam: TStringField;

Table3Im: TStringField;

Table3Otch: TStringField;

Table3Nazv_org: TStringField;

Table3Nom_ydost: TStringField;

Table4K_post: TSmallintField;

Table4Fam: TStringField;

Table4Im: TStringField;

Table4Otch: TStringField;

Table4Nom_ydost: TStringField;

Table4Nom_kom: TSmallintField;

Table4Srok_proj: TIntegerField;

Table5K_ysl: TSmallintField;

Table5Naim: TStringField;

Table6K_ysl: TSmallintField;

Table6Nom_kom: TSmallintField;

Table6Data_okaz: TDateField;

Table6K_zan: TSmallintField;

Button15: TButton;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

Button16: TButton;

Label47: TLabel;

DBEdit6: TDBEdit;

Edit4: TEdit;

Button17: TButton;

RadioGroup4: TRadioGroup;

Edit5: TEdit;

StringGrid1: TStringGrid;

Edit6: TEdit;

Label16: TLabel;

Button18: TButton;

DBEdit8: TDBEdit;

DBEdit9: TDBEdit;

DBEdit10: TDBEdit;

DBEdit11: TDBEdit;

DBEdit12: TDBEdit;

DBEdit13: TDBEdit;

Button19: TButton;

Button20: TButton;

Edit8: TEdit;

Label17: TLabel;

Edit1: TEdit;

Label7: TLabel;

DataSource6: TDataSource;

Edit2: TEdit;

Label8: TLabel;

Edit3: TEdit;

Label9: TLabel;

Table5Cena: TIntegerField;

Label10: TLabel;

DBEdit7: TDBEdit;

DBEdit14: TDBEdit;

DBEdit15: TDBEdit;

DBEdit16: TDBEdit;

Button1: TButton;

Edit7: TEdit;

Edit9: TEdit;

Edit10: TEdit;

Edit11: TEdit;

Edit12: TEdit;

Edit13: TEdit;

Button10: TButton;

Edit14: TEdit;

Edit15: TEdit;

procedure FormActivate(Sender:TObject);

procedure N6Click(Sender: TObject);

procedure N11Click(Sender: TObject);

procedure N12Click(Sender: TObject);

procedure N13Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button11Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure Button13Click(Sender: TObject);

procedure Button15Click(Sender: TObject);

procedure Button16Click(Sender: TObject);

procedure Button17Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button18Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure Button19Click(Sender: TObject);

procedure Button20Click(Sender: TObject);

procedure Button12Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button14Click(Sender: TObject);

procedure Button9Click(Sender: TObject);

procedure Button10Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.FormActivate(Sender:TObject);

Var k : string;

begin

k:=GetCurrentDir+'\Table\';

Table1.Active:=false;

Table2.Active:=False;

Table3.Active:=False;

Table4.Active:=False;

Table5.Active:=False;

Table6.Active:=False;

Table1.DatabaseName:=k;

Table2.DatabaseName:=k;

Table3.DatabaseName:=k;

Table4.DatabaseName:=k;

Table5.DatabaseName:=k;

Table6.DatabaseName:=k;

Table1.TableName:='Nomera';

Table2.TableName:='Zan_nom';

Table3.TableName:='Post';

Table4.TableName:='Arhiv';

Table5.TableName:='Dop_ysl';

Table6.TableName:='Okaz_dy';

Table1.Active:=True;

Table2.Active:=True;

Table3.Active:=True;

Table4.Active:=True;

Table5.Active:=True;

Table6.Active:=True;

end;

procedure TForm1.N6Click(Sender: TObject);

begin

Close;

end;

procedure TForm1.N11Click(Sender: TObject);

begin

PageControl1.Visible:=True;

PageControl1.ActivePage:=TabSheet1;

end;

procedure TForm1.N12Click(Sender: TObject);

begin

PageControl1.Visible:=True;

PageControl1.ActivePage:=TabSheet2;

end;

procedure TForm1.N13Click(Sender: TObject);

begin

PageControl1.Visible:=True;

PageControl1.ActivePage:=TabSheet3;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

DBEdit1.Clear;

DBEdit2.Clear;

dbEdit3.Clear;

dbEdit4.Clear;

dbEdit5.Clear;

DBEdit6.Clear;

end;

procedure TForm1.Button6Click(Sender: TObject);

begin

DBEdit8.Clear;

DBEdit9.Clear;

DBEdit10.Clear;

DBEdit11.Clear;

DBEdit12.Clear;

DBEdit13.Clear;

end;

procedure TForm1.Button11Click(Sender: TObject);

begin

DBEdit7.Clear;

DBEdit14.Clear;

DBEdit15.Clear;

DBEdit16.Clear;

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

Table2.Insert;

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

if MessageDlg(‘Выдействительнохотитеудалитьзапись?', mtConfirmation,[mbYes,mbNo],0) = mrYes then

Table2.Delete;

end;

procedure TForm1.Button8Click(Sender: TObject);

begin

if MessageDlg(‘Выдействительнохотитеудалитьзапись?', mtConfirmation,[mbYes,mbNo],0) = mrYes then

Table3.Delete;

end;

procedure TForm1.Button13Click(Sender: TObject);

begin

if MessageDlg(‘Выдействительнохотитеудалитьзапись?', mtConfirmation,[mbYes,mbNo],0) = mrYes then

Table6.Delete;

end;

procedure TForm1.Button15Click(Sender: TObject);

begin

Form2.Show;

Edit6.Text:=FormatDateTime('dd.mm.yyyy',now());

StringGrid1.Cells[0,0]:='Íîìåð';

StringGrid1.ColWidths[0]:=200;

Panel1.Caption:=FormatDateTime('dd.mm.yyyy',now());

end;

procedure TForm1.Button16Click(Sender: TObject);

begin

try

Table2.Edit;

Table2.Post;

except

MessageDlg('Введенынекорректныеданные',mtError,[mbOK],0);

Table2.Cancel;

end;

end;

procedure TForm1.Button17Click(Sender: TObject);

begin

If RadioGroup1.ItemIndex=0 then Table1.Filtered:=false else

begin

Case RadioGroup1.ItemIndex of

1: Table1.Filter:='Klass = '+edit4.Text;

2: Table1.Filter:='Nom_kom = '+edit4.Text;

3: Table1.Filter:='Kol-vo_mest = '+edit4.Text;

4: Table1.Filter:='Stoimost = '+edit4.Text;

end;

Table1.Filtered:=true;

end;

end;

procedure TForm1.Button5Click(Sender: TObject);

begin

Case RadioGroup4.ItemIndex of

0: Table1.Locate('Nom_kom',strtoint(Edit5.Text),[]);

1: Table1.Locate('Klass',Edit5.Text,[]);

2: Table1.Locate('Kol-vo_mest',strtoint(Edit5.Text),[]);

end;

end;

procedure TForm1.Button18Click(Sender: TObject);

Var i:integer;

begin

Table2.First;

StringGrid1.RowCount:=2;

While not Table2.Eof do

begin

i:=StringGrid1.RowCount;

If Table2Data_vus.AsString=Edit6.Text then

begin

StringGrid1.Cells[0,i-1]:=Table2Nom_kom.AsString;

StringGrid1.RowCount:=i+1;

end;

Table2.Next;

end;

end;

procedure TForm1.Button7Click(Sender: TObject);

begin

Table3.Insert;

end;

procedure TForm1.Button19Click(Sender: TObject);

begin

try

Table3.Edit;

table3.Post;

except

MessageDlg(‘Введенынекорректныеданные', mtError,[mbOK],0);

table3.Cancel;

end;

end;

procedure TForm1.Button20Click(Sender: TObject);

Var cen,st:integer;

begin

st:=0;

Table4.Insert;

Table4K_post.AsString:=Table3K_post.AsString;

Table4Fam.AsString:=Table3Fam.AsString;

Table4Im.AsString:=Table3Im.AsString;

Table4Otch.AsString:=Table3Otch.AsString;

Table4Nom_ydost.AsString:=Table3Nom_ydost.AsString;

Table2.First;

While not Table2.Eof do

begin

If Table2K_post.AsString=Table3K_post.AsString then

Table4Nom_kom.AsString:=Table2Nom_kom.AsString;

table2.Next;

end;

Table4Srok_proj.AsString:=edit8.Text;

Table4.Post;

Table1.First;

While not table1.Eof do

begin

If Table1Nom_kom.AsString=Table4Nom_kom.AsString then

cen:=Table1Stoimost.AsInteger;

Table1.Next;

end;

Edit1.Text:=inttostr(cen*Table4Srok_proj.AsInteger);

Table2.Locate('K_post',Table3K_post.AsInteger,[]);

Table6.First;

While not Table6.Eof do

begin

If Table6Nom_kom.AsString=Table2Nom_kom.asstring then

begin

Table5.Locate('K_ysl',Table6K_ysl.AsInteger,[]);

cen:=Table5Cena.AsInteger;

st:=st+cen;

end;

Table6.Next;

end;

Edit2.Text:=inttostr(st);

Edit3.Text:=inttostr(strtoint(edit1.Text)+st);

Table6.First;

While not Table6.Eof do

begin

If Table6K_zan.AsString=Table2K_zan.AsString

then Table6.Delete;

Table6.Next;

end;

Table2.Delete;

Table3.Delete;

end;

procedure TForm1.Button12Click(Sender: TObject);

begin

Table6.Insert;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

try

Table6.Edit;

Table6.Post;

Except

Table6.Cancel;

end;

end;

procedure TForm1.Button14Click(Sender: TObject);

begin

Table6.Locate('K_ysl;Nom_kom;Data_okaz',VarArrayOf([StrToInt(Edit7.Text),StrToInt(Edit9.Text),StrToDate(Edit10.Text)]),[]);

end;

procedure TForm1.Button9Click(Sender: TObject);

begin

Table4.Locate('Nom_kom;Fam;Im',VarArrayOf([StrToInt(Edit11.Text),Edit12.Text,Edit13.Text]),[]);

end;

procedure TForm1.Button10Click(Sender: TObject);

begin

If RadioGroup2.ItemIndex=0 then Table3.Filtered:=false else

begin

Case RadioGroup2.ItemIndex of

1: Table3.Filter:='Fam = '+ edit14.Text;

2: Table3.Filter:='K_post = '+ edit15.Text;

end;

Table3.Filtered:=true;

end;

end;

end.

Форма №2 «Пароль»

unit Unit2;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

type

TForm2 = class(TForm)

Edit1: TEdit;

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

const s=123;

var

Form2: TForm2;

implementation

uses unit1;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);

begin

If Edit1.Text=inttostr(s)

then

begin

Form1.N1.Enabled:=true;

close;

end

else

begin

If MessageDlg('Повторитьпопытку?',mtError,[mbOK,mbNo],0)=mrOK

then Edit1.Text:=''

else

begin

Form1.Close;

close;

end;

end;

Form1.Button15.Visible:=false;

end;

end.