unit glavn;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, Menus, StdCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    N6: TMenuItem;
    N11: TMenuItem;
    N7: TMenuItem;
    N8: TMenuItem;
    N9: TMenuItem;
    Label1: TLabel;
    N12: TMenuItem;
    N22: TMenuItem;
    Button1: TButton;
    Button2: TButton;
    N10: TMenuItem;
    N13: TMenuItem;
    N14: TMenuItem;
    N5: TMenuItem;
    procedure N2Click(Sender: TObject);
    procedure N3Click(Sender: TObject);
    procedure N11Click(Sender: TObject);
    procedure N4Click(Sender: TObject);
    procedure N31Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure N41Click(Sender: TObject);
    procedure ghh1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure N9Click(Sender: TObject);
    procedure N13Click(Sender: TObject);
    procedure N14Click(Sender: TObject);
    procedure N5Click(Sender: TObject);
    procedure N12Click(Sender: TObject);
    procedure N22Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses sooruzheniya, sportsmen, z1, z2, klubs, z3, organizator, turnir,
  datamodule, pasport, z4, reclama, zagruzka,Excel2000,ExcelXP,ComObj;

{$R *.dfm}

procedure TForm1.N22Click(Sender: TObject);
var
  SQ:String;
  XLApp, Sheet,Colum:Variant;
  i:integer;
begin
XLApp:=CreateOleObject('Excel.Application');  //Экспортирование данных в Excel
XLApp.Visible:=true;
XLApp.Workbooks.Add();
XLApp.Workbooks[1].WorkSheets[1].Name:='Клубы';
Colum:=XLApp.Workbooks[1].WorkSheets['Клубы'].Columns;
Sheet:=XLApp.Workbooks[1].WorkSheets['Клубы'];
Sheet.cells[1,1]:='Название';
Sheet.cells[1,2]:='Адрес';
dm1.sportsmen.First;
i:=1;
while not dm1.klub.Eof do
begin
i:=i+1;
Sheet.cells[i,1]:=dm1.klub.Fields.FieldByName('название').AsString;
Sheet.cells[i,2]:=dm1.klub.Fields.FieldByName('адрес').AsString;
dm1.klub.next;
end;
dm1.klub.First;
end;

procedure TForm1.N2Click(Sender: TObject);
begin
form2.show;
end;

procedure TForm1.N3Click(Sender: TObject);
begin
form3.show;
end;

procedure TForm1.N11Click(Sender: TObject);
begin
form4.show;
end;

procedure TForm1.N12Click(Sender: TObject);
var
  SQ:String;
  XLApp, Sheet,Colum:Variant;
  i:integer;
begin
XLApp:=CreateOleObject('Excel.Application');  //Экспортирование данных в Excel
XLApp.Visible:=true;
XLApp.Workbooks.Add();
XLApp.Workbooks[1].WorkSheets[1].Name:='Спортсмены';
Colum:=XLApp.Workbooks[1].WorkSheets['Спортсмены'].Columns;
Sheet:=XLApp.Workbooks[1].WorkSheets['Спортсмены'];
Sheet.cells[1,1]:='ФИО';
Sheet.cells[1,2]:='Адрес';
dm1.sportsmen.First;
i:=1;
while not dm1.sportsmen.Eof do
begin
i:=i+1;
Sheet.cells[i,1]:=dm1.sportsmen.Fields.FieldByName('ФИО').AsString;
Sheet.cells[i,2]:=dm1.sportsmen.Fields.FieldByName('дом_адрес').AsString;
dm1.sportsmen.next;
end;
dm1.sportsmen.First;
end;

procedure TForm1.N13Click(Sender: TObject);
begin
  form5.show;
end;

procedure TForm1.N14Click(Sender: TObject);
begin
 form8.show;
end;



procedure TForm1.N4Click(Sender: TObject);
begin
form6.show;
end;

procedure TForm1.N5Click(Sender: TObject);
begin
form9.Show;
end;

procedure TForm1.N31Click(Sender: TObject);
begin
form8.show;
end;



procedure TForm1.N9Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
form10.show;
end;

procedure TForm1.N41Click(Sender: TObject);
begin
form12.show;
end;



procedure TForm1.ghh1Click(Sender: TObject);
begin
form5.Show;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
form14.show;

end;

end.
