Поможем написать учебную работу
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
Дoдaтoк A Пpoгpaмний кoд
program SyperMarket;
uses
Forms,
USyperMarket in 'USyperMarket.pas' {Form1},
Unit1 in 'Unit1.pas' {DataModule1: TDataModule},
UAgentu in 'UAgentu.pas' {Agentu},
UMagazin in 'UMagazin.pas' {Magazin},
UTovar in 'UTovar.pas' {Tovar},
UZajavka in 'UZajavka.pas' {Zajavka},
UPeregljad in 'UPeregljad.pas' {Peregljad},
UZaput1 in 'UZaput1.pas' {Form2},
UZaput2 in 'UZaput2.pas' {Form3},
UZaput3 in 'UZaput3.pas' {Form4},
UPrint2 in 'UPrint2.pas' {Form5},
UZaput4 in 'UZaput4.pas' {Form6},
UPrint1 in 'UPrint1.pas' {Form7};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TDataModule1, DataModule1);
Application.CreateForm(TAgentu, Agentu);
Application.CreateForm(TMagazin, Magazin);
Application.CreateForm(TTovar, Tovar);
Application.CreateForm(TZajavka, Zajavka);
Application.CreateForm(TPeregljad, Peregljad);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TForm3, Form3);
Application.CreateForm(TForm4, Form4);
Application.CreateForm(TForm5, Form5);
Application.CreateForm(TForm6, Form6);
Application.CreateForm(TForm7, Form7);
Application.Run;
end.
unit UAgentu;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Mask;
type
TAgentu = class(TForm)
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
GroupBox1: TGroupBox;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Agentu: TAgentu;
implementation
uses Unit1;
{$R *.dfm}
end.
unit UMagazin;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Mask;
type
TMagazin = class(TForm)
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Magazin: TMagazin;
implementation
uses Unit1;
{$R *.dfm}
end.
unit Unit1;
interface
uses
SysUtils, Classes, DB, IBCustomDataSet, IBTable, IBDatabase, IBQuery;
type
TDataModule1 = class(TDataModule)
IBDatabase1: TIBDatabase;
IBTransaction1: TIBTransaction;
IBTable1: TIBTable;
IBTable2: TIBTable;
IBTable3: TIBTable;
IBTable4: TIBTable;
IBTable5: TIBTable;
agent: TDataSource;
magazin: TDataSource;
tovar: TDataSource;
zajavka: TDataSource;
vmist: TDataSource;
IBTable6: TIBTable;
IBTable7: TIBTable;
IBTable8: TIBTable;
IBTable4ID_ZAJAVKA: TIntegerField;
IBTable4DATA_ZAJAVKA: TDateTimeField;
IBTable4ID_MAGAZIN: TIntegerField;
IBTable4ID_AGENTA: TIntegerField;
IBTable4ag: TStringField;
IBTable4mag: TStringField;
IBTable5ID_VMISTY: TIntegerField;
IBTable5ID_ZAJAVKA: TIntegerField;
IBTable5ID_TOVAR: TIntegerField;
IBTable5COUNTTOVAR: TIntegerField;
IBTable5tov: TStringField;
IBTable9: TIBTable;
IBTable5zajav: TStringField;
DataSource1: TDataSource;
IBQuery1: TIBQuery;
IBQuery2: TIBQuery;
DataSource2: TDataSource;
IBTable2ID_MAGAZIN: TIntegerField;
IBTable2NAME_MAGAZIN: TIBStringField;
IBTable2ARESA: TIBStringField;
IBTable2MENEDZER: TIBStringField;
DataSource3: TDataSource;
IBQuery3: TIBQuery;
IBTable1ID_AGENTA: TIntegerField;
IBTable1SURNAME: TIBStringField;
IBTable1NAME: TIBStringField;
IBTable1PO_BATKOVI: TIBStringField;
IBTable1DATA_WORK: TDateTimeField;
IBTable1OKLAD: TFloatField;
IBTable3ID_TOVAR: TIntegerField;
IBTable3NAME_TOVAR: TIBStringField;
IBTable3VUROBNUK: TIBStringField;
IBTable3PRICE: TFloatField;
DataSource4: TDataSource;
IBQuery4: TIBQuery;
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule1: TDataModule1;
implementation
{$R *.dfm}
end.
unit UPeregljad;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, ComCtrls, StdCtrls;
type
TPeregljad = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
TabSheet4: TTabSheet;
DBGrid4: TDBGrid;
Label1: TLabel;
DBNavigator2: TDBNavigator;
DBGrid5: TDBGrid;
DBNavigator3: TDBNavigator;
Label2: TLabel;
procedure PageControl1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Peregljad: TPeregljad;
implementation
uses Unit1;
{$R *.dfm}
procedure TPeregljad.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePage=TabSheet1 then
begin
DBNavigator1.Visible:=true;
DBNavigator1.DataSource:=DataModule1.agent;
end
else
if PageControl1.ActivePage=TabSheet2 then
begin
DBNavigator1.Visible:=true;
DBNavigator1.DataSource:=DataModule1.magazin;
end
else
if PageControl1.ActivePage=TabSheet3 then
begin
DBNavigator1.Visible:=true;
DBNavigator1.DataSource:=DataModule1.tovar;
end
else
if PageControl1.ActivePage=TabSheet4 then
DBNavigator1.Visible:=false;
end;
end.
unit UPrint2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls;
type
TForm5 = class(TForm)
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRLabel1: TQRLabel;
QRBand2: TQRBand;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRSubDetail1: TQRSubDetail;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
uses Unit1;
{$R *.dfm}
end.
unit USyperMarket;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N17: TMenuItem;
N18: TMenuItem;
N19: TMenuItem;
procedure N2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N11Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N17Click(Sender: TObject);
procedure N18Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure N15Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit1, UAgentu, UMagazin, UTovar, UZajavka, UPeregljad, UZaput1,
UZaput2, UZaput3, UPrint2, UZaput4;
{$R *.dfm}
procedure TForm1.N2Click(Sender: TObject);
begin
DataModule1.IBDatabase1.Connected:=true;
DataModule1.IBTable1.Open;
DataModule1.IBTable2.Open;
DataModule1.IBTable3.Open;
DataModule1.IBTable4.Open;
DataModule1.IBTable5.Open;
N6.Enabled:=True;
N10.Enabled:=true;
N13.Enabled:=true;
N14.Enabled:=true;
N12.Enabled:=true;
N3.Enabled:=true;
N2.Enabled:=false;
N5.Enabled:=false;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
N6.Enabled:=false;
N10.Enabled:=false;
N13.Enabled:=false;
N14.Enabled:=false;
N12.Enabled:=false;
N3.Enabled:=false;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
DataModule1.IBDatabase1.Connected:=false;
DataModule1.IBTable1.Close;
DataModule1.IBTable2.Close;
DataModule1.IBTable3.Close;
DataModule1.IBTable4.Close;
DataModule1.IBTable5.Close;
N6.Enabled:=false;
N10.Enabled:=false;
N13.Enabled:=false;
N14.Enabled:=false;
N12.Enabled:=false;
N3.Enabled:=false;
N2.Enabled:=true;
N5.Enabled:=true;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.N7Click(Sender: TObject);
begin
Agentu.ShowModal;
end;
procedure TForm1.N9Click(Sender: TObject);
begin
Magazin.ShowModal;
end;
procedure TForm1.N8Click(Sender: TObject);
begin
Tovar.ShowModal;
end;
procedure TForm1.N11Click(Sender: TObject);
begin
Zajavka.ShowModal;
end;
procedure TForm1.N12Click(Sender: TObject);
begin
Peregljad.ShowModal;
end;
procedure TForm1.N16Click(Sender: TObject);
begin
Form2.ShowModal;
end;
procedure TForm1.N17Click(Sender: TObject);
begin
Form3.ShowModal;
end;
procedure TForm1.N18Click(Sender: TObject);
begin
Form4.ShowModal;
end;
procedure TForm1.N19Click(Sender: TObject);
begin
DataModule1.IBTable3.Active:=true;
Form5:=TForm5.Create(Self);
Form5.QuickRep1.Preview;
Form5.Free;
end;
procedure TForm1.N15Click(Sender: TObject);
begin
Form6.ShowModal;
end;
end.
unit UTovar;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Mask;
type
TTovar = class(TForm)
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Tovar: TTovar;
implementation
uses Unit1;
{$R *.dfm}
end.
unit UZajavka;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Mask;
type
TZajavka = class(TForm)
DBNavigator1: TDBNavigator;
DBNavigator2: TDBNavigator;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
GroupBox2: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBLookupComboBox3: TDBLookupComboBox;
DBLookupComboBox4: TDBLookupComboBox;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Zajavka: TZajavka;
implementation
uses Unit1;
{$R *.dfm}
end.
unit UZaput1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids;
type
TForm2 = class(TForm)
DBGrid1: TDBGrid;
Panel2: TPanel;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var i:integer;
sum:real;
begin
DataModule1.IBQuery1.Close;
DataModule1.IBQuery1.SQL.Clear;
DataModule1.IBQuery1.SQL.Add('select ID_agenta, Surname, Name, Po_batkovi, Oklad');
DataModule1.IBQuery1.SQL.Add('from torgovuj');
DataModule1.IBQuery1.Open;
sum:=0;
for i:=1 to DataModule1.IBQuery1.RecordCount do
begin
sum:=sum+DataModule1.IBQuery1.fieldbyname('Oklad').AsFloat;
DataModule1.IBQuery1.Next;
end;
Edit2.Text:=FloatToStr(sum);
end;
end.
unit UZaput2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, Grids, DBGrids, StdCtrls;
type
TForm3 = class(TForm)
DBLookupComboBox1: TDBLookupComboBox;
GroupBox1: TGroupBox;
Label1: TLabel;
Button1: TButton;
DBGrid1: TDBGrid;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
DataModule1.IBQuery2.Close;
DataModule1.IBQuery2.SQL.Clear;
DataModule1.IBQuery2.SQL.Add('select id_magazin, name_magazin, aresa');
DataModule1.IBQuery2.SQL.Add('from torgovuj, zajavka, magazin');
DataModule1.IBQuery2.SQL.Add('where torgovuj.id_agenta=zajavka.id_agenta and magazin.id_magazin=zajavka.id_magazin and surname="'+DBLookupComboBox1.Text+'"');
DataModule1.IBQuery2.Open;
end;
end.
unit UZaput3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, DBCtrls, ExtCtrls;
type
TForm4 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
Button1: TButton;
DBGrid1: TDBGrid;
Panel2: TPanel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit3: TEdit;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm4.Button1Click(Sender: TObject);
var sum:real;
i:integer;
begin
DataModule1.IBQuery3.Close;
DataModule1.IBQuery3.SQL.Clear;
DataModule1.IBQuery3.SQL.Add('select ID_zajavka, Vurobnuk, Name_Tovar, CountTovar, Price, (CountTovar*Price) as Syma from Zajavka, Magazin, Tovar, Vmist_zakazy');
DataModule1.IBQuery3.SQL.Add('where Name_Magazin="'+DBLookupComboBox1.Text+'" and Tovar.ID_Tovar=Vmist_zakazy.id_Tovar and Magazin.ID_Magazin=Zajavka.id_Magazin and Zajavka.ID_Zajavka=Vmist_zakazy.ID_zajavka');
DataModule1.IBQuery3.Open;
sum:=0;
for i:=1 to DataModule1.IBQuery3.RecordCount do
begin
sum:=sum+DataModule1.IBQuery3.fieldbyname('Syma').AsFloat;
DataModule1.IBQuery3.Next;
end;
Edit3.Text:=FloatToStr(sum);
Edit1.Text:=FloatToStr(StrToFloat(Edit3.Text)*StrToFloat('0,'+Edit2.Text)+StrToFloat(Edit3.Text));
end;
end.
unit UZaput4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ComCtrls, ExtCtrls;
type
TForm6 = class(TForm)
Panel1: TPanel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
Picker1: TDateTimePicker;
Picker2: TDateTimePicker;
DBGrid1: TDBGrid;
Panel2: TPanel;
Label5: TLabel;
Edit3: TEdit;
Label1: TLabel;
Button3: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm6.Button1Click(Sender: TObject);
var sum:real;
i:integer;
begin
DataModule1.IBQuery4.Close;
DataModule1.IBQuery4.SQL.Clear;
DataModule1.IBQuery4.SQL.Add('select ID_tovar, Vurobnuk, Name_Tovar, CountTovar, Price, (CountTovar*Price) as Syma from Tovar, zajavka, Vmist_Zakazy');
DataModule1.IBQuery4.SQL.Add('where (Data_Zajavka between "'+DateToStr(Picker1.Date)+'"and"'+DateToStr(Picker2.Date)+'")and Tovar.ID_Tovar=Vmist_zakazy.id_Tovar and Zajavka.ID_Zajavka=Vmist_zakazy.ID_zajavka');
DataModule1.IBQuery4.Open;
sum:=0;
for i:=1 to DataModule1.IBQuery4.RecordCount do
begin
sum:=sum+DataModule1.IBQuery4.fieldbyname('Syma').AsFloat;
DataModule1.IBQuery4.Next;
end;
Edit3.Text:=FloatToStr(sum);
end;
end.
end.
unit UPrint1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls;
type
TForm7 = class(TForm)
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRLabel1: TQRLabel;
QRLabel3: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRBand2: TQRBand;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRSubDetail1: TQRSubDetail;
QRDBText8: TQRDBText;
QRDBText9: TQRDBText;
QRDBText10: TQRDBText;
QRDBText11: TQRDBText;
QRDBText2: TQRDBText;
QRBand3: TQRBand;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel4: TQRLabel;
QRDBText1: TQRDBText;
QRLabel13: TQRLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form7: TForm7;
implementation
uses Unit1;
{$R *.dfm}
end.