Автор работы: Пользователь скрыл имя, 21 Ноября 2010 в 18:16, Не определен
Программа позволяет вести учет абитуриентов в Делфи
a_about.pas
unit a_about;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls;
type
TAboutBox = class(TForm)
Panel1: TPanel;
ProgramIcon: TImage;
ProductName: TLabel;
Version: TLabel;
Copyright: TLabel;
Comments: TLabel;
OKButton: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
AboutBox: TAboutBox;
implementation
{$R *.DFM}
end.
a_r.pas
unit a_r;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, QuickRpt, Qrctrls, Db, DBTables, TeEngine, Series, TeeProcs,
Chart, DBChart, QrTee;
type
Ta_r_f = class(TForm)
report1: TQuickRep;
Table1: TTable;
DataSource1: TDataSource;
DataSource2: TDataSource;
Table2: TTable;
DetailBand1: TQRBand;
QRSubDetail1: TQRSubDetail;
QRLabel5: TQRLabel;
TitleBand1: TQRBand;
QRLabel10: TQRLabel;
ColumnHeaderBand1: TQRBand;
QRGroup1: TQRGroup;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRShape2: TQRShape;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRExpr1: TQRExpr;
QRLabel4: TQRLabel;
QRDBText1: TQRDBText;
QRBand1: TQRBand;
QRExpr2: TQRExpr;
QRLabel6: TQRLabel;
Query1: TQuery;
DataSource3: TDataSource;
QRChart1: TQRChart;
QRDBChart1: TQRDBChart;
Series1: TPieSeries;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
a_r_f: Ta_r_f;
implementation
uses dm_u;
{$R *.DFM}
procedure Ta_r_f.FormCreate(Sender: TObject);
var
DBPath: String; {путь к базе данных}
begin
if Table1.Active=true
then
Table1.Active:=false;
if Table2.Active=true
then
Table2.Active:=false;
if Query1.Active=True
then
Query1.Active:=False;
DBPath:=ExtractFilePath(
Query1.DatabaseName:=DBPath;
Table1.DatabaseName:=DBPath;
Table1.Open;
Table2.DatabaseName:=DBPath;
Table2.Open;
Query1.Active:=True;
end;
end.
a_r2.pas
unit a_r2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, ExtCtrls, QuickRpt, Qrctrls, TeEngine, Series, TeeProcs,
Chart, DBChart, QrTee;
type
Ta_r2_f = class(TForm)
QuickRep1: TQuickRep;
DataSource1: TDataSource;
Query1: TQuery;
QRBand1: TQRBand;
QRLabel1: TQRLabel;
QRBand2: TQRBand;
QRGroup1: TQRGroup;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRDBText1: TQRDBText;
QRBand3: TQRBand;
QRLabel5: TQRLabel;
QRDBText4: TQRDBText;
QRShape1: TQRShape;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRBand4: TQRBand;
QRExpr1: TQRExpr;
QRChart1: TQRChart;
QRDBChart1: TQRDBChart;
Series1: TPieSeries;
procedure QuickRep1StartPage(Sender: TCustomQuickRep);
procedure
FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
a_r2_f: Ta_r2_f;
implementation
{$R *.DFM}
procedure Ta_r2_f.QuickRep1StartPage(
begin
QRDBChart1.CheckDatasource(
end;
procedure Ta_r2_f.FormCreate(Sender: TObject);
var
DBPath: String; {путь к базе данных}
begin
if Query1.Active=True
then
Query1.Active:=False;
DBPath:=ExtractFilePath(
Query1.DatabaseName:=DBPath;
end;
end.
dm_u.pas
unit dm_u;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables;
type
Tdm = class(TDataModule)
Query1: TQuery;
DataSource3: TDataSource;
Table2: TTable;
Table2A_id: TAutoIncField;
Table2A_surname: TStringField;
Table2A_math: TSmallintField;
Table2A_physic: TSmallintField;
Table2A_composition: TSmallintField;
Table2A_s_id: TSmallintField;
Table2sum: TIntegerField;
DataSource2: TDataSource;
Table1: TTable;
DataSource1: TDataSource;
db: TDatabase;
procedure Table2CalcFields(DataSet: TDataSet);
procedure Table2A_mathValidate(Sender: TField);
procedure Table2A_physicValidate(Sender: TField);
procedure
Table2A_compositionValidate(
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
dm: Tdm;
implementation
{$R *.DFM}
procedure Tdm.Table2CalcFields(DataSet: TDataSet);
begin
dm.Table2sum.Value:=dm.
end;
procedure Tdm.Table2A_mathValidate(
begin
if (dm.Table2A_math.Value<2) or (dm.Table2A_math.Value>5)
then
begin
ShowMessage('Оценка допустима только от 2 до 5!');
Abort;
end;
end;
procedure Tdm.Table2A_physicValidate(
begin
if (dm.Table2A_physic.Value<2) or (dm.Table2A_physic.Value>5)
then
begin
ShowMessage('Оценка допустима только от 2 до 5!');
Abort;
end;
end;
procedure Tdm.Table2A_
begin
if (dm.Table2A_composition.Value<
then
begin
ShowMessage('Оценка допустима только от 2 до 5!');
Abort;
end;
end;
procedure Tdm.DataModuleCreate(Sender: TObject);
var
DBPath: String; {путь к базе данных}
begin
with dm do
begin
if table1.Active=True
then
table1.active:=false;
if table2.active=true
then
table2.active:=false;
end;
DBPath:=ExtractFilePath(
DM.Table1.DatabaseName:=
DM.Table1.Open; {открыть таблицу}
DM.Table2.DatabaseName:=
DM.Table2.Open;
Query1.DatabaseName:=DBPath;
end;
end.
Приложение Г
Примеры экранных форм диаграмм и отчетов
Рисунок
Г.1 – Количество абитуриентов по специальностям
– отчет и диаграмма
Рисунок Г.2 – Сортировка по сумме баллов – отчет и диаграмма