Читайте также:
|
|
Приложение №1
Форма 1 – Виртуальный магазин по продаже мебели
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, jpeg, ExtCtrls, XPMan, ComObj, DB, DBTables;
type
TGlavn = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
XPManifest1: TXPManifest;
T_klient: TTable;
N7: TMenuItem;
T_postav: TTable;
T_mebel: TTable;
T_oplata: TTable;
T_zakaz: TTable;
N8: TMenuItem;
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure N8Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Glavn: TGlavn;
implementation
uses Unit2, Unit3, Unit4, Unit5, Unit6;
{$R *.dfm}
procedure TGlavn.N1Click(Sender: TObject);
begin
Postav.Show;
end;
procedure TGlavn.N2Click(Sender: TObject);
begin
Klient.Show;
end;
procedure TGlavn.N3Click(Sender: TObject);
begin
Mebel.Show;
end;
procedure TGlavn.N4Click(Sender: TObject);
begin
Oplata.Show;
end;
procedure TGlavn.N5Click(Sender: TObject);
begin
Zakaz.Show;
end;
procedure TGlavn.N6Click(Sender: TObject);
begin
Glavn.Close;
end;
procedure TGlavn.FormCreate(Sender: TObject);
begin
Glavn.BorderStyle:= bsToolWindow;
end;
procedure TGlavn.FormPaint(Sender: TObject);
var
bm:TBitMap;
begin
bm:=TBitMap.Create;
bm.Loadfromfile('1.bmp');
Glavn.Canvas.Draw(0,0,bm);
end;
procedure TGlavn.N7Click(Sender: TObject);
begin
winhelp(Glavn.Handle,'help.hlp',HELP_CONTEXT,1);
end;
procedure TGlavn.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform (WM_SYSCOMMAND, SC_MOVE+2, 0);
end;
procedure TGlavn.N8Click(Sender: TObject);
begin
Glavn.WindowState:= wsMinimized;
end; end.
Форма 2 - Клиенты
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ExtCtrls, DBCtrls, Grids, DBGrids, DBTables, Menus, StdCtrls,
Mask, jpeg, RpCon, RpConDS, RpConBDE, RpDefine, RpRave, XPMan, ComObj;
type
TKlient = class(TForm)
Table1: TTable;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
RadioGroup1: TRadioGroup;
Edit1: TEdit;
Image1: TImage;
DBEdit5: TDBEdit;
Image4: TImage;
Image5: TImage;
Label6: TLabel;
N3: TMenuItem;
N4: TMenuItem;
XPManifest1: TXPManifest;
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure Image1Click(Sender: TObject);
procedure Image4Click(Sender: TObject);
procedure Image5Click(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure N4Click(Sender: TObject);
private
R:short; t:integer; nz:short;
{ Private declarations }
public
{ Public declarations }
end;
var
Klient: TKlient;
implementation
uses Unit1;
{$R *.dfm}
procedure TKlient.N1Click(Sender: TObject);
begin
Glavn.Show;
end;
procedure TKlient.N2Click(Sender: TObject);
begin
Klient.Close;
end;
procedure TKlient.RadioGroup1Click(Sender: TObject);
begin
Table1.Filtered:=true;
case RadioGroup1.ItemIndex
of
0:Table1.Filtered:=false;
1:Table1.Filter:='Fam='+ QuotedStr(Edit1.text);
2:Table1.Filter:='Im='+ QuotedStr(Edit1.text);
3:Table1.Filter:='Otch='+ QuotedStr(Edit1.text);
4:Table1.Filter:='Adres_k='+ QuotedStr(Edit1.text);
5:Table1.Filter:='Tel_k='+ QuotedStr(Edit1.text);
end; end;
procedure TKlient.Image1Click(Sender: TObject);
begin
Table1.Last;
R:=Table1.Fields[0].Value+1;
Table1.Insert;
Table1.Append;
Table1.Fields[0].Value:=R;
end;
procedure TKlient.Image4Click(Sender: TObject);
begin
Table1.FindKey ([nz]);
Table1.Delete;
Table1.Close;
Table1.Open;
end;
procedure TKlient.Image5Click(Sender: TObject);
begin
Table1.Refresh;
end;
procedure TKlient.DBGrid1CellClick(Column: TColumn);
begin
nz:=Table1.fields[0].value;
end;
procedure TKlient.FormCreate(Sender: TObject);
begin
Klient.BorderStyle:= bsToolWindow;
end;
procedure TKlient.FormPaint(Sender: TObject);
var
bm:TBitMap;
begin
bm:=TBitMap.Create;
bm.Loadfromfile('2.bmp');
Klient.Canvas.Draw(0,0,bm);
end;
procedure TKlient.N3Click(Sender: TObject);
var
XL,Sheet,Colum:Variant;
index,i:integer;
//Uses модуль ComObj
begin
t:=0;
table1.Close;
table1.Open;
XL:=CreateOLEObject('Excel.Application');
XL.visible:=true;
XL.WorkBooks.add('F:\BD_Kursovik\klient.xls');
XL.workbooks[1].worksheets[1].Name:='клиенты';
Colum:=XL.workbooks[1].worksheets['клиенты'].columns;
Colum:=XL.workbooks[1].worksheets['клиенты'].Rows;
sheet:=XL.workbooks[1].worksheets['клиенты'];
index:=4;
table1.First;
for i:=0 to table1.RecordCount-1 do
begin
t:=t+1;
sheet.cells[index,1]:=t;
sheet.cells[index,2]:=table1.Fields[0].AsString;
sheet.cells[index,3]:=table1.Fields[1].AsString;
sheet.cells[index,4]:=table1.Fields[2].AsString;
sheet.cells[index,5]:=table1.Fields[3].AsString;
sheet.cells[index,6]:=table1.Fields[4].AsString;
sheet.cells[index,7]:=table1.Fields[5].AsString;
inc(index);
table1.Next;
end; end;
procedure TKlient.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform (WM_SYSCOMMAND, SC_MOVE+2, 0);
end;
procedure TKlient.N4Click(Sender: TObject);
begin
Klient.WindowState:= wsMinimized;
end; end.
Форма 3 - Мебель
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, ExtCtrls, DBCtrls, Grids, DBGrids, Menus,
StdCtrls, Mask, jpeg, RpCon, RpConDS, RpConBDE, RpDefine, RpRave, XPMan, ComObj;
type
TMebel = class(TForm)
DBGrid1: TDBGrid;
Table1: TTable;
DataSource1: TDataSource;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
RadioGroup1: TRadioGroup;
Edit1: TEdit;
Image1: TImage;
Image4: TImage;
Image5: TImage;
Label7: TLabel;
N3: TMenuItem;
N4: TMenuItem;
XPManifest1: TXPManifest;
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure Image1Click(Sender: TObject);
procedure Image4Click(Sender: TObject);
procedure Image5Click(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure N4Click(Sender: TObject);
private
M:short; nz:short; t:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Mebel: TMebel;
implementation
uses Unit1;
{$R *.dfm}
procedure TMebel.N1Click(Sender: TObject);
begin
Glavn.Show;
end;
procedure TMebel.N2Click(Sender: TObject);
begin
Mebel.Close;
end;
procedure TMebel.RadioGroup1Click(Sender: TObject);
begin
Table1.Filtered:=true;
case RadioGroup1.ItemIndex
of
0:Table1.Filtered:=false;
1:Table1.Filter:='Name_m='+ QuotedStr(Edit1.text);
2:Table1.Filter:='Srok='+ QuotedStr(Edit1.text);
3:Table1.Filter:='Cvet='+ QuotedStr(Edit1.text);
4:Table1.Filter:='Ves='+ QuotedStr(Edit1.text);
5:Table1.Filter:='Material='+ QuotedStr(Edit1.text);
6:Table1.Filter:='Cena='+ QuotedStr(Edit1.text);
end; end;
procedure TMebel.Image1Click(Sender: TObject);
begin
Table1.Last;
M:=Table1.Fields[0].Value+1;
Table1.Insert;
Table1.Append;
Table1.Fields[0].Value:=M;
end;
procedure TMebel.Image4Click(Sender: TObject);
begin
Table1.FindKey([nz]);
Table1.Delete;
Table1.Close;
Table1.Open;
end;
procedure TMebel.Image5Click(Sender: TObject);
begin
Table1.Refresh;
end;
procedure TMebel.DBGrid1CellClick(Column: TColumn);
begin
nz:=Table1.fields[0].value;
end;
procedure TMebel.FormCreate(Sender: TObject);
begin
Mebel.BorderStyle:= bsToolWindow;
end;
procedure TMebel.FormPaint(Sender: TObject);
var
bm:TBitMap;
begin
bm:=TBitMap.Create;
bm.Loadfromfile('3.bmp');
Mebel.Canvas.Draw(0,0,bm);
end;
procedure TMebel.N3Click(Sender: TObject);
var
XL,Sheet,Colum:Variant;
index,i:integer;
//Uses модуль ComObj
begin
t:=0;
table1.Close;
table1.Open;
XL:=CreateOLEObject('Excel.Application');
XL.visible:=true;
XL.WorkBooks.add('F:\BD_Kursovik\mebel.xls');
XL.workbooks[1].worksheets[1].Name:='мебель';
Colum:=XL.workbooks[1].worksheets['мебель'].columns;
Colum:=XL.workbooks[1].worksheets['мебель'].Rows;
sheet:=XL.workbooks[1].worksheets['мебель'];
index:=4;
table1.First;
for i:=0 to table1.RecordCount-1 do
begin
t:=t+1;
sheet.cells[index,1]:=t;
sheet.cells[index,2]:=table1.Fields[0].AsString;
sheet.cells[index,3]:=table1.Fields[1].AsString;
sheet.cells[index,4]:=table1.Fields[2].AsString;
sheet.cells[index,5]:=table1.Fields[3].AsString;
sheet.cells[index,6]:=table1.Fields[4].AsString;
sheet.cells[index,7]:=table1.Fields[5].AsString;
sheet.cells[index,8]:=table1.Fields[6].AsString;
inc(index);
table1.Next;
end; end;
procedure TMebel.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform (WM_SYSCOMMAND, SC_MOVE+2, 0);
end;
procedure TMebel.N4Click(Sender: TObject);
begin
Mebel.WindowState:= wsMinimized;
end; end.
Форма 4 – Тип оплаты
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, ExtCtrls, DBCtrls, Grids, DBGrids, Menus, StdCtrls,
Mask, jpeg, RpCon, RpConDS, RpConBDE, RpDefine, RpRave, XPMan, ComObj;
type
TOplata = class(TForm)
Table1: TTable;
DataSource1: TDataSource;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
DBGrid1: TDBGrid;
Label1: TLabel;
Label2: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
Image1: TImage;
Image2: TImage;
Image3: TImage;
RadioGroup1: TRadioGroup;
Edit1: TEdit;
Label6: TLabel;
N3: TMenuItem;
N4: TMenuItem;
XPManifest1: TXPManifest;
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure Image1Click(Sender: TObject);
procedure Image2Click(Sender: TObject);
procedure Image3Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure N4Click(Sender: TObject);
private O:short; K:short; KK:short; t:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Oplata: TOplata;
implementation
uses Unit1;
{$R *.dfm}
procedure TOplata.N1Click(Sender: TObject);
begin
Glavn.Show;
end;
procedure TOplata.N2Click(Sender: TObject);
begin
Oplata.Close;
end;
procedure TOplata.FormCreate(Sender: TObject);
begin
Oplata.BorderStyle:= bsToolWindow;
end;
procedure TOplata.DBGrid1CellClick(Column: TColumn);
begin
K:=Table1.fields[0].value;
end;
procedure TOplata.Image1Click(Sender: TObject);
begin
Table1.FindKey ([K]);
Table1.Delete;
Table1.Close;
Table1.Open;
end;
procedure TOplata.Image2Click(Sender: TObject);
begin
Table1.Last;
KK:=Table1.Fields[0].Value+1;
Table1.Insert;
Table1.Append;
Table1.Fields[0].Value:=KK;
end;
procedure TOplata.Image3Click(Sender: TObject);
begin
Table1.Refresh;
end;
procedure TOplata.RadioGroup1Click(Sender: TObject);
begin
Table1.Filtered:=true;
case RadioGroup1.ItemIndex
of
0:Table1.Filtered:=false;
1:Table1.Filter:='Name_b='+ QuotedStr(Edit1.text);
2:Table1.Filter:='Nomer_s='+ QuotedStr(Edit1.text);
end; end;
procedure TOplata.FormPaint(Sender: TObject);
var
bm:TBitMap;
begin
bm:=TBitMap.Create;
bm.Loadfromfile('4.bmp');
Oplata.Canvas.Draw(0,0,bm);
end;
procedure TOplata.N3Click(Sender: TObject);
var
XL,Sheet,Colum:Variant;
index,i:integer;
//Uses модуль ComObj
begin
t:=0;
table1.Close;
table1.Open;
XL:=CreateOLEObject('Excel.Application');
XL.visible:=true;
XL.WorkBooks.add('F:\BD_Kursovik\oplata.xls');
XL.workbooks[1].worksheets[1].Name:='Поставщик';
Colum:=XL.workbooks[1].worksheets['Поставщик'].columns;
Colum:=XL.workbooks[1].worksheets['Поставщик'].Rows;
sheet:=XL.workbooks[1].worksheets['Поставщик'];
index:=4;
table1.First;
for i:=0 to table1.RecordCount-1 do
begin
t:=t+1;
sheet.cells[index,1]:=t;
sheet.cells[index,2]:=table1.Fields[0].AsString;
sheet.cells[index,3]:=table1.Fields[1].AsString;
sheet.cells[index,4]:=table1.Fields[2].AsString;
inc(index);
table1.Next;
end; end;
procedure TOplata.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform (WM_SYSCOMMAND, SC_MOVE+2, 0);
end;
procedure TOplata.N4Click(Sender: TObject);
begin
Oplata.WindowState:= wsMinimized;
end; end.
Форма 5 - Поставщики
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, DB, DBTables, Grids, DBGrids, StdCtrls, Mask,
Menus, jpeg, RpCon, RpConDS, RpConBDE, RpDefine, RpRave, XPMan, ComObj;
type
TPostav = class(TForm)
DBGrid1: TDBGrid;
Table1: TTable;
DataSource1: TDataSource;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Bdedit1: TDBEdit;
Bdedit2: TDBEdit;
Bdedit3: TDBEdit;
Bdedit4: TDBEdit;
Bdedit5: TDBEdit;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
Edit1: TEdit;
RadioGroup1: TRadioGroup;
Image1: TImage;
Image4: TImage;
Image5: TImage;
Label6: TLabel;
N3: TMenuItem;
N4: TMenuItem;
XPManifest1: TXPManifest;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure Image1Click(Sender: TObject);
procedure Image4Click(Sender: TObject);
procedure Image5Click(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure N4Click(Sender: TObject);
private
P:short; nz:short; t:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Postav: TPostav;
implementation
uses Unit1;
{$R *.dfm}
procedure TPostav.Button2Click(Sender: TObject);
begin
if not Table1.Locate('Name_p',Edit1.text,[LoCaseInsensitive,LoPartialKey])
then begin
ShowMessage('Не найдено');
Edit1.SetFocus;
Edit1.AutoSelect:=true;
end; end;
procedure TPostav.Button3Click(Sender: TObject);
begin
Table1.Cancel;
end;
procedure TPostav.N1Click(Sender: TObject);
begin
Glavn.Show;
end;
procedure TPostav.N2Click(Sender: TObject);
begin
Postav.Close;
end;
procedure TPostav.RadioGroup1Click(Sender: TObject);
begin
Table1.Filtered:=true;
case RadioGroup1.ItemIndex
of
0:Table1.Filtered:=false;
1:Table1.Filter:='Name_p='+ QuotedStr(Edit1.text);
2:Table1.Filter:='Inn='+ QuotedStr(Edit1.text);
3:Table1.Filter:='Adres_p='+ QuotedStr(Edit1.text);
4:Table1.Filter:='Tel_p='+ QuotedStr(Edit1.text);
5:Table1.Filter:='Ruck='+ QuotedStr(Edit1.text);
end; end;
procedure TPostav.Image1Click(Sender: TObject);
begin
Table1.Last;
P:=Table1.Fields[0].Value+1;
Table1.Insert;
Table1.Append;
Table1.Fields[0].Value:=P;
end;
procedure TPostav.Image4Click(Sender: TObject);
begin
Table1.FindKey([nz]);
Table1.Delete;
Table1.Close;
Table1.Open;
end;
procedure TPostav.Image5Click(Sender: TObject);
begin
Table1.Refresh;
end;
procedure TPostav.DBGrid1CellClick(Column: TColumn);
begin
nz:=Table1.fields[0].value;
end;
procedure TPostav.FormCreate(Sender: TObject);
begin
Postav.BorderStyle:= bsToolWindow;
end;
procedure TPostav.FormPaint(Sender: TObject);
var
bm:TBitMap;
begin
bm:=TBitMap.Create;
bm.Loadfromfile('6.bmp');
Postav.Canvas.Draw(0,0,bm);
end;
procedure TPostav.N3Click(Sender: TObject);
var
XL,Sheet,Colum:Variant;
index,i:integer;
//Uses модуль ComObj
begin
t:=0;
table1.Close;
table1.Open;
XL:=CreateOLEObject('Excel.Application');
XL.visible:=true;
XL.WorkBooks.add('F:\BD_Kursovik\postav.xls');
XL.workbooks[1].worksheets[1].Name:='поставщик';
Colum:=XL.workbooks[1].worksheets['поставщик'].columns;
Colum:=XL.workbooks[1].worksheets['поставщик'].Rows;
sheet:=XL.workbooks[1].worksheets['поставщик'];
index:=4;
table1.First;
for i:=0 to table1.RecordCount-1 do
begin
t:=t+1;
sheet.cells[index,1]:=t;
sheet.cells[index,2]:=table1.Fields[0].AsString;
sheet.cells[index,3]:=table1.Fields[1].AsString;
sheet.cells[index,4]:=table1.Fields[2].AsString;
sheet.cells[index,5]:=table1.Fields[3].AsString;
sheet.cells[index,6]:=table1.Fields[4].AsString;
sheet.cells[index,7]:=table1.Fields[5].AsString;
inc(index);
table1.Next;
end; end;
procedure TPostav.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform (WM_SYSCOMMAND, SC_MOVE+2, 0);
end;
procedure TPostav.N4Click(Sender: TObject);
begin
Postav.WindowState:= wsMinimized; end; end.
Форма 6 - Заказ
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, ExtCtrls, DBCtrls, Grids, DBGrids, Menus, StdCtrls,
Mask, ComCtrls, jpeg, RpCon, RpConDS, RpDefine, RpRave, XPMan, ComObj;
type
TZakaz = class(TForm)
DataSource1: TDataSource;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
DBGrid1: TDBGrid;
Qzakaz: TQuery;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
RadioGroup1: TRadioGroup;
Edit22: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label7: TLabel;
Edit5: TEdit;
Label8: TLabel;
Edit6: TEdit;
Label9: TLabel;
Edit7: TEdit;
DSpostav: TDataSource;
DBGpostav: TDBGrid;
t_postav: TTable;
T_zakaz: TTable;
T_klient: TTable;
DSklient: TDataSource;
DBGklient: TDBGrid;
T_mebel: TTable;
DSmebel: TDataSource;
DBGmebel: TDBGrid;
T_oplata: TTable;
DSoplata: TDataSource;
DBGoplata: TDBGrid;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
N3: TMenuItem;
N4: TMenuItem;
XPManifest1: TXPManifest;
QzakazZakaz_id: TSmallintField;
QzakazData_zakaza: TDateField;
QzakazData_ispol: TDateField;
QzakazPostav_id: TSmallintField;
QzakazKlient_id: TSmallintField;
QzakazMeb_id: TSmallintField;
QzakazOplata_id: TSmallintField;
Qzakazname_p: TStringField;
Qzakazfam: TStringField;
Qzakazname_m: TStringField;
Qzakazname_b: TStringField;
Qzakaznomer_s: TStringField;
Qzakazcena: TStringField;
T_zakazZakaz_id: TSmallintField;
T_zakazData_zakaza: TDateField;
T_zakazData_ispol: TDateField;
T_zakazPostav_id: TSmallintField;
T_zakazKlient_id: TSmallintField;
T_zakazMeb_id: TSmallintField;
T_zakazOplata_id: TSmallintField;
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure DBGpostavCellClick(Column: TColumn);
procedure Edit2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DBGklientCellClick(Column: TColumn);
procedure Edit3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DBGmebelCellClick(Column: TColumn);
procedure Edit4MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DBGoplataCellClick(Column: TColumn);
procedure Edit5MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure RadioGroup1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure DateTimePicker1Click(Sender: TObject);
procedure DateTimePicker2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
private
nz,n,postav,oplata,meb,klient:short; a:integer; t:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
Zakaz: TZakaz;
implementation
uses Unit1, Unit3, Unit5;
{$R *.dfm}
procedure TZakaz.N1Click(Sender: TObject);
begin
Glavn.Show;
end;
procedure TZakaz.N2Click(Sender: TObject);
begin
Zakaz.Close;
end;
procedure TZakaz.FormCreate(Sender: TObject);
begin
Zakaz.BorderStyle:= bsToolWindow;
//edit0.Text:=datetostr(date);
//edit1.Text:=datetostr(date);
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
edit7.Text:='';
end;
procedure TZakaz.DBGrid1CellClick(Column: TColumn);
begin
nz:=qzakaz.Fields[0].Value;
end;
procedure TZakaz.DBGpostavCellClick(Column: TColumn);
begin
postav:=t_postav.Fields[0].Value;
edit2.Text:=t_postav.Fields[1].Value;
dbgpostav.Visible:=false;
end;
procedure TZakaz.Edit2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
dbgpostav.Visible:=true;
end;
procedure TZakaz.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform (WM_SYSCOMMAND, SC_MOVE+2, 0);
dbgpostav.Visible:=false;
dbgklient.Visible:=false;
dbgoplata.Visible:=false;
dbgmebel.Visible:=false;
end;
procedure TZakaz.DBGklientCellClick(Column: TColumn);
begin
klient:=t_klient.Fields[0].Value;
edit3.Text:=t_klient.Fields[1].Value;
dbgklient.Visible:=false;
end;
procedure TZakaz.Edit3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
dbgklient.Visible:=true;
end;
procedure TZakaz.DBGmebelCellClick(Column: TColumn);
begin
meb:=t_mebel.Fields[0].Value;
edit4.Text:=t_mebel.Fields[1].Value;
edit7.Text:=t_mebel.Fields[6].Value+' руб';
dbgmebel.Visible:=false;
end;
procedure TZakaz.Edit4MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
dbgmebel.Visible:=true;
end;
procedure TZakaz.DBGoplataCellClick(Column: TColumn);
begin
oplata:=t_oplata.Fields[0].Value;
edit5.Text:=t_oplata.Fields[1].Value;
edit6.Text:=t_oplata.Fields[2].Value;
dbgoplata.Visible:=false;
end;
procedure TZakaz.Edit5MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
dbgoplata.Visible:=true;
end;
procedure TZakaz.RadioGroup1Click(Sender: TObject);
begin
Qzakaz.Filtered:=true;
case RadioGroup1.ItemIndex
of
0:Qzakaz.Filtered:=false;
1:Qzakaz.Filter:='name_p='+ QuotedStr(Edit22.text);
2:Qzakaz.Filter:='fam='+ QuotedStr(Edit22.text);
3:Qzakaz.Filter:='name_m='+ QuotedStr(Edit22.text);
4:Qzakaz.Filter:='name_b='+ QuotedStr(Edit22.text);
5:Qzakaz.Filter:='nomer_s='+ QuotedStr(Edit22.text);
6:Qzakaz.Filter:='cena='+ QuotedStr(Edit22.text);
end; end;
procedure TZakaz.Button1Click(Sender: TObject);
begin
a:=2;
//edit0.Text:=qzakaz.Fields[1].Value;
//edit1.Text:=qzakaz.Fields[2].Value;
edit2.Text:=qzakaz.Fields[7].Value;
edit3.Text:=qzakaz.Fields[8].Value;
edit4.Text:=qzakaz.Fields[9].Value;
edit5.Text:=qzakaz.Fields[10].Value;
edit6.Text:=qzakaz.Fields[11].Value;
edit7.Text:=qzakaz.Fields[12].Value;
postav:=qzakaz.Fields[3].AsInteger;
klient:=qzakaz.Fields[4].AsInteger;
meb:=qzakaz.Fields[5].AsInteger;
oplata:=qzakaz.Fields[6].AsInteger;
end;
procedure TZakaz.Button2Click(Sender: TObject);
begin
if (edit2.Text='') or (edit3.Text='')
or(edit4.Text='') or (edit5.Text='') or (edit6.Text='') or (edit7.Text='')
then showmessage('Введите все записи!')
else
if a=2 then
begin
t_zakaz.FindKey([nz]);
t_zakaz.Edit;
t_zakaz.Fields[0].Value:=nz;
t_zakaz.Fields[1].Value:=DateTimePicker1.Date;
//t_zakaz.Fields[1].Value:=strtodate(edit0.Text);
//t_zakaz.Fields[2].Value:=strtodate(edit1.Text);
t_zakaz.Fields[2].Value:=DateTimePicker2.Date;
t_zakaz.Fields[3].Value:=postav;
t_zakaz.Fields[4].Value:=klient;
t_zakaz.Fields[5].Value:=meb;
t_zakaz.Fields[6].Value:=oplata;
t_zakaz.Post;
t_zakaz.Close;
t_zakaz.Open;
qzakaz.Close;
qzakaz.Open;
a:=0;
end
else
begin
t_zakaz.Last;
n:=t_zakaz.Fields[0].Value;
t_zakaz.Append;
t_zakaz.Fields[0].Value:=n+1;
t_zakaz.Fields[1].Value:=DateTimePicker1.Date;
//t_zakaz.Fields[1].Value:=strtodate(edit0.Text);
t_zakaz.Fields[2].Value:=DateTimePicker2.Date;
//t_zakaz.Fields[2].Value:=strtodate(edit1.Text);
t_zakaz.Fields[3].Value:=postav;
t_zakaz.Fields[4].Value:=klient;
t_zakaz.Fields[5].Value:=meb;
t_zakaz.Fields[6].Value:=oplata;
t_zakaz.Post;
t_zakaz.Close;
t_zakaz.Open;
qzakaz.Close;
qzakaz.Open;
end;
//edit0.Text:='';
//edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
edit7.Text:='';
end;
procedure TZakaz.Button3Click(Sender: TObject);
begin
if (edit2.Text='') or (edit3.Text='')
or(edit4.Text='') or (edit5.Text='') or (edit6.Text='') or (edit7.Text='')
then showmessage('Введите все записи!')
else
if a=2 then
begin
t_zakaz.FindKey([nz]);
t_zakaz.Edit;
t_zakaz.Fields[0].Value:=nz;
t_zakaz.Fields[1].Value:=DateTimePicker1.Date;
//t_zakaz.Fields[1].Value:=strtodate(edit0.Text);
t_zakaz.Fields[2].Value:=DateTimePicker2.Date;
//t_zakaz.Fields[2].Value:=strtodate(edit1.Text);
t_zakaz.Fields[3].Value:=postav;
t_zakaz.Fields[4].Value:=klient;
t_zakaz.Fields[5].Value:=meb;
t_zakaz.Fields[6].Value:=oplata;
t_zakaz.Post;
t_zakaz.Close;
t_zakaz.Open;
qzakaz.Close;
qzakaz.Open;
a:=0;
end
else
begin
t_zakaz.Last;
n:=t_zakaz.Fields[0].Value;
t_zakaz.Append;
t_zakaz.Fields[0].Value:=n+1;
t_zakaz.Fields[1].Value:=DateTimePicker1.Date;
//t_zakaz.Fields[1].Value:=strtodate(edit0.Text);
t_zakaz.Fields[2].Value:=DateTimePicker2.Date;
//t_zakaz.Fields[2].Value:=strtodate(edit1.Text);
t_zakaz.Fields[3].Value:=postav;
t_zakaz.Fields[4].Value:=klient;
t_zakaz.Fields[5].Value:=meb;
t_zakaz.Fields[6].Value:=oplata;
t_zakaz.Post;
t_zakaz.Close;
t_zakaz.Open;
qzakaz.Close;
qzakaz.Open;
end;
//edit0.Text:='';
//edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
edit7.Text:='';
end;
procedure TZakaz.Button4Click(Sender: TObject);
begin
t_zakaz.FindKey([nz]);
t_zakaz.Delete;
t_zakaz.Close;
t_zakaz.Open;
qzakaz.Close;
qzakaz.Open;
end;
procedure TZakaz.FormPaint(Sender: TObject);
var
bm:TBitMap;
begin
bm:=TBitMap.Create;
bm.Loadfromfile('5.bmp');
Zakaz.Canvas.Draw(0,0,bm);
end;
procedure TZakaz.DateTimePicker1Click(Sender: TObject);
begin
dbgpostav.Visible:=true;
end;
procedure TZakaz.DateTimePicker2Click(Sender: TObject);
begin
dbgpostav.Visible:=true;
end;
procedure TZakaz.N3Click(Sender: TObject);
var
XL,Sheet,Colum:Variant;
index,i:integer;
//Uses модуль ComObj
begin
t:=0;
qzakaz.Close;
qzakaz.Open;
XL:=CreateOLEObject('Excel.Application');
XL.visible:=true;
XL.WorkBooks.add('F:\BD_Kursovik\zakaz.xls');
XL.workbooks[1].worksheets[1].Name:='заказ';
Colum:=XL.workbooks[1].worksheets['заказ'].columns;
Colum:=XL.workbooks[1].worksheets['заказ'].Rows;
sheet:=XL.workbooks[1].worksheets['заказ'];
index:=4;
qzakaz.First;
for i:=0 to qzakaz.RecordCount-1 do
begin
t:=t+1;
sheet.cells[index,1]:=t;
sheet.cells[index,2]:=qzakaz.Fields[0].AsString;
sheet.cells[index,3]:=qzakaz.Fields[1].AsString;
sheet.cells[index,4]:=qzakaz.Fields[2].AsString;
sheet.cells[index,5]:=qzakaz.Fields[3].AsString;
sheet.cells[index,6]:=qzakaz.Fields[4].AsString;
sheet.cells[index,7]:=qzakaz.Fields[5].AsString;
sheet.cells[index,8]:=qzakaz.Fields[6].AsString;
sheet.cells[index,9]:=qzakaz.Fields[7].AsString;
sheet.cells[index,10]:=qzakaz.Fields[8].AsString;
inc(index);
qzakaz.Next;
end; end;
procedure TZakaz.N4Click(Sender: TObject);
begin
Zakaz.WindowState:= wsMinimized;
end;
end.
Дата добавления: 2015-07-21; просмотров: 53 | Нарушение авторских прав
<== предыдущая страница | | | следующая страница ==> |
Инструкция по эксплуатации ПП | | | Система российских СМИ |