Автор работы: Пользователь скрыл имя, 11 Июня 2014 в 20:57, курсовая работа
В настоящем проекте делается попытка проектирования такой АИС, которая бы способствовала повышению эффективности управления объектом, автоматизации труда работников, повышению их производительности, сокращению затрат на производственные расходы, и, как следствие этого, повышение прибыли, увеличение размеров уставного фонда, то есть достижение главных целей, которые предприятие ставит перед собой.
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure N6Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure N13Click(Sender: TObject);
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure Edit1Change(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure SpeedButton2Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure N22Click(Sender: TObject);
procedure N23Click(Sender: TObject);
procedure N24Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure N20Click(Sender: TObject);
procedure N21Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
n: Integer;
implementation
uses Klients, Documents, Predmet, Classification, EditZalog,
ReportZalog, ReportContract, LocateZalog, ReportDate_1, ReportDate_2;
{$R *.dfm}
procedure TfrmMain.FormCreate(Sender: TObject);
begin
tblKlients.DatabaseName
:= ExtractFileDir(Application.
tblKlients.TableName := 'Klients';
tblKlientsTEL.EditMask := '!99-99-99;1; ';
tblKlientsDATA_R.EditMask := '!99/99/00;1; ';
tblKlientsPAS_DATA.EditMask := '!99/99/00;1; ';
tblKlients.Open;
tblDocuments.DatabaseName
:= ExtractFileDir(Application.
tblDocuments.TableName := 'Documents';
tblDocuments.Open;
tblClassification.DatabaseName
:= ExtractFileDir(Application.
tblClassification.TableName := 'Classification';
tblClassification.Open;
tblPredmet.DatabaseName
:= ExtractFileDir(Application.
tblPredmet.TableName := 'Predmet';
tblPredmet.Open;
tblZalog.DatabaseName
:= ExtractFileDir(Application.
tblZalog.TableName := 'Zalog';
tblZalogDATA_P.EditMask := '!99/99/00;1; ';
tblZalogDATA_V.EditMask := '!99/99/00;1; ';
tblZalogSROK.EditMask := '!99/99/00;1; ';
tblZalog.Open;
tblZalogPredmets.DatabaseName
:= ExtractFileDir(Application.
tblZalogPredmets.TableName := 'ZalogPredmets';
tblZalogPredmets.Open;
end;
procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
tblKlients.Close;
tblDocuments.Close;
tblPredmet.Close;
tblClassification.Close;
tblZalog.Close;
tblZalogPredmets.Close;
end;
procedure TfrmMain.N6Click(Sender: TObject);
begin
Application.CreateForm(
frmKlients.ShowModal;
end;
procedure TfrmMain.N8Click(Sender: TObject);
begin
Application.CreateForm(
frmPredmet.ShowModal;
end;
procedure TfrmMain.N9Click(Sender: TObject);
begin
Application.CreateForm(
frmClassification.ShowModal;
end;
procedure TfrmMain.N12Click(Sender: TObject);
begin
Application.CreateForm(
frmDocuments.ShowModal;
end;
procedure TfrmMain.ToolButton1Click(
begin
tblZalog.Last;
n := tblZalogNDOC.AsInteger;
tblZalog.Append;
tblZalogNDOC.AsInteger := n + 1;
tblZalogS_KR.AsInteger := 0;
Application.CreateForm(
frmEditZalog.ShowModal;
end;
procedure TfrmMain.ToolButton2Click(
begin
frmMain.tblZalog.Edit;
Application.CreateForm(
if not tblZalogDATA_V.IsNull then
frmEditZalog.MaskEdit1.Text
:= DateToStr(tblZalogDATA_V.
frmEditZalog.ShowModal;
end;
procedure TfrmMain.ToolButton3Click(
begin
//
end;
procedure TfrmMain.ToolButton8Click(
begin
Application.CreateForm(
frmReportZalog.QuickRep1.
end;
procedure TfrmMain.N13Click(Sender: TObject);
begin
Application.CreateForm(
frmReportContract.QuickRep1.
end;
procedure TfrmMain.
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if not tblZalogDATA_V.IsNull then
begin
DBGrid1.Canvas.Brush.Color := clGreen;
DBGrid1.Canvas.Font.Color := clYellow;
DBGrid1.DefaultDrawDataCell(
end;
if (tblZalogDATA_V.IsNull) and (tblZalogSROK.AsDateTime < Date()) then
begin
DBGrid1.Canvas.Brush.Color := clRed;
DBGrid1.Canvas.Font.Color := clYellow;
DBGrid1.DefaultDrawDataCell(
end
end;
procedure TfrmMain.Edit1Change(Sender: TObject);
begin
if Edit1.Text <> '' then
tblZalog.Locate('NDOC', Edit1.Text, []);
end;
procedure TfrmMain.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9', #8]) then
key := #0;
end;
procedure TfrmMain.SpeedButton2Click(
begin
tblZalog.Filtered := False;
if SpeedButton1.Down then
begin
tblZalog.Filter := '(DATA_V = Null) AND (SROK > ''' + DateToStr(Date()) + ''')';
tblZalog.Filtered := True;
end;
if SpeedButton2.Down then
begin
tblZalog.Filter := 'DATA_V <> Null';
tblZalog.Filtered := True;
end;
if SpeedButton3.Down then
begin
tblZalog.Filter := '(DATA_V = Null) AND (SROK < ''' + DateToStr(Date()) + ''')';
tblZalog.Filtered := True;
end;
end;
procedure TfrmMain.ToolButton6Click(
begin
Application.CreateForm(
frmLocateZalog.ShowModal;
end;
procedure TfrmMain.N22Click(Sender: TObject);
begin
Application.CreateForm(
frmReportDate_1.Tag := 1;
frmReportDate_1.ShowModal
end;
procedure TfrmMain.N23Click(Sender: TObject);
begin
Application.CreateForm(
frmReportDate_1.Tag := 2;
frmReportDate_1.ShowModal
end;
procedure TfrmMain.N24Click(Sender: TObject);
begin
Application.CreateForm(
frmReportDate_1.Tag := 3;
frmReportDate_1.ShowModal
end;
procedure AddCombo;
begin
frmReportDate_2.ComboBox1.
frmReportDate_2.ComboBox1.
frmMain.tblClassification.
while not frmMain.tblClassification.Eof do
begin
frmReportDate_2.ComboBox1.
frmMain.tblClassification.
end;
frmReportDate_2.ComboBox1.
end;
procedure TfrmMain.N19Click(Sender: TObject);
begin
Application.CreateForm(
frmReportDate_2.Tag := 1;
AddCombo;
frmReportDate_2.ShowModal
end;
procedure TfrmMain.N20Click(Sender: TObject);
begin
Application.CreateForm(
frmReportDate_2.Tag := 2;
AddCombo;
frmReportDate_2.ShowModal
end;
procedure TfrmMain.N21Click(Sender: TObject);
begin
Application.CreateForm(
frmReportDate_2.Tag := 3;
AddCombo;
frmReportDate_2.ShowModal
end;
end.
Листинг модуля Classification
unit Classification;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, ComCtrls, ToolWin, StdCtrls;
type
TfrmClassification = class(TForm)
Label1: TLabel;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmClassification: TfrmClassification;
implementation
uses Main, EditClassification;
{$R *.dfm}
procedure TfrmClassification.
begin
frmMain.tblClassification.
Application.CreateForm(
frmEditClassification.
end;
procedure TfrmClassification.
begin
frmMain.tblClassification.
Application.CreateForm(
frmEditClassification.
end;
end.
Листинг модуля Documents
unit Documents;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, ComCtrls, ToolWin, StdCtrls;
type
TfrmDocuments = class(TForm)
Label1: TLabel;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmDocuments: TfrmDocuments;
implementation
uses Main, EditDocuments;
{$R *.dfm}
procedure TfrmDocuments.
begin
frmMain.tblDocuments.Append;
Application.CreateForm(
frmEditDocuments.ShowModal;
end;
procedure TfrmDocuments.
begin
frmMain.tblDocuments.Edit;
Application.CreateForm(
frmEditDocuments.ShowModal;
end;
end.
Листинг модуля EditClassification
unit EditClassification;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls;
type
TfrmEditClassification = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
DBEdit1: TDBEdit;
Button3: TButton;
Button4: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmEditClassification: TfrmEditClassification;
implementation
uses Main, Classification;
{$R *.dfm}
procedure TfrmEditClassification.
var Action: TCloseAction);
begin
if ModalResult = mrOk then
frmMain.tblClassification.Post
else
frmMain.tblClassification.
end;
end.
Листинг модуля EditDocuments
unit EditDocuments;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls;
type
TfrmEditDocuments = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
DBEdit1: TDBEdit;
Button1: TButton;
Button2: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmEditDocuments: TfrmEditDocuments;
implementation
uses Main, Documents;
{$R *.dfm}
procedure TfrmEditDocuments.FormClose(
var Action: TCloseAction);
begin
if ModalResult = mrOk then
frmMain.tblDocuments.Post
else
frmMain.tblDocuments.Cancel
end;
end.
Листинг модуля EditKlients
unit EditKlients;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, DB;
type
TfrmEditKlients = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
DBEdit1: TDBEdit;
GroupBox2: TGroupBox;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
Label8: TLabel;
Label9: TLabel;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DataSource1: TDataSource;
DBEdit8: TDBEdit;
Label10: TLabel;
Button1: TButton;
Button2: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmEditKlients: TfrmEditKlients;
implementation
uses Main, Klients;
{$R *.dfm}
procedure TfrmEditKlients.FormClose(
var Action: TCloseAction);
begin
if ModalResult = mrOk then
frmMain.tblKlients.Post
else
frmMain.tblKlients.Cancel
end;
end.
Листинг модуля EditPredmet
unit EditPredmet;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, StdCtrls, DBCtrls, Mask;
type
TfrmEditPredmet = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
Label2: TLabel;
Label8: TLabel;
DBEdit1: TDBEdit;
Button1: TButton;
Button2: TButton;
DataSource1: TDataSource;
DBLookupComboBox1: TDBLookupComboBox;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmEditPredmet: TfrmEditPredmet;
implementation
uses Main, Predmet;
{$R *.dfm}
procedure TfrmEditPredmet.Button1Click(
begin
frmMain.tblPredmet.Post;
Close
end;
procedure TfrmEditPredmet.Button2Click(
begin
frmMain.tblPredmet.Cancel;
Close
end;
end.
Листинг модуля EditZalog
unit EditZalog;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, StdCtrls, DBCtrls, Mask, Buttons, ComCtrls, ToolWin, Grids,
DBGrids, DBTables;
type
TfrmEditZalog = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label3: TLabel;
Label4: TLabel;
Label6: TLabel;
Label7: TLabel;
Button1: TButton;
Button2: TButton;
DataSource1: TDataSource;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
GroupBox3: TGroupBox;
DBLookupComboBox1: TDBLookupComboBox;
SpeedButton1: TSpeedButton;
GroupBox4: TGroupBox;
DBGrid1: TDBGrid;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
Label2: TLabel;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
Label5: TLabel;
GroupBox5: TGroupBox;
Label8: TLabel;
MaskEdit1: TMaskEdit;
procedure SpeedButton1Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure DBEdit3Change(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmEditZalog: TfrmEditZalog;
implementation
uses Main, Klients, EditZalogPredmet;
{$R *.dfm}
procedure TfrmEditZalog.
begin
Application.CreateForm(
frmKlients.Tag := 1;
frmKlients.ShowModal;
frmKlients.Tag := 0;
end;
procedure TfrmEditZalog.
begin
frmMain.tblZalogPredmets.
Application.CreateForm(
frmEditZalogPredmet.ShowModal;
end;
procedure TfrmEditZalog.
begin
frmMain.tblZalogPredmets.Edit;
Application.CreateForm(
frmEditZalogPredmet.ShowModal;
end;
procedure TfrmEditZalog.DBEdit3Change(
begin
if frmMain.tblZalog.State in [dsInsert, dsEdit] then
if (DBEdit3.Text <> '') and (DBEdit4.Text <> '') then
begin
frmMain.tblZalogS_PROC.AsFloat := (StrToFloat(DBEdit3.Text) * StrToFloat(DBEdit4.Text)) / 100;
frmMain.tblZalogS_DB.AsFloat := StrToFloat(DBEdit4.Text) + StrToFloat(DBEdit5.Text);
end
end;
procedure TfrmEditZalog.
begin
if Application.MessageBox('
frmMain.tblZalogPredmets.
end;
procedure TfrmEditZalog.FormClose(
var Action: TCloseAction);
begin
if ModalResult = mrOk then
begin
if MaskEdit1.Text = ' . . ' then
frmMain.tblZalogDATA_V.
else
frmMain.tblZalogDATA_V.
frmMain.tblZalog.Post;
frmMain.tblZalogPredmets.
frmMain.tblZalogPredmets.
end
else
begin
frmMain.tblZalog.Cancel;
frmMain.tblZalogPredmets.
end
end;
end.
Листинг модуля Klients
unit Klients;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls, ToolWin, StdCtrls, DB, AppEvnts;
type
TfrmKlients = class(TForm)
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
DBGrid1: TDBGrid;
Label1: TLabel;
DataSource1: TDataSource;
ToolButton4: TToolButton;
tbAddKlients: TToolButton;
ApplicationEvents1: TApplicationEvents;
ToolButton5: TToolButton;
Edit1: TEdit;
Label2: TLabel;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure tbAddKlientsClick(Sender: TObject);