Автоматизация ломбарда

Автор работы: Пользователь скрыл имя, 11 Июня 2014 в 20:57, курсовая работа

Краткое описание

В настоящем проекте делается попытка проектирования такой АИС, которая бы способствовала повышению эффективности управления объектом, автоматизации труда работников, повышению их производительности, сокращению затрат на производственные расходы, и, как следствие этого, повышение прибыли, увеличение размеров уставного фонда, то есть достижение главных целей, которые предприятие ставит перед собой.

Прикрепленные файлы: 1 файл

дима ломбард ВТ.doc

— 1.00 Мб (Скачать документ)

    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.ExeName)+'\BASES';

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.ExeName)+'\BASES';

tblDocuments.TableName := 'Documents';

tblDocuments.Open;

 

tblClassification.DatabaseName := ExtractFileDir(Application.ExeName)+'\BASES';

tblClassification.TableName := 'Classification';

tblClassification.Open;

 

tblPredmet.DatabaseName := ExtractFileDir(Application.ExeName)+'\BASES';

tblPredmet.TableName := 'Predmet';

tblPredmet.Open;

 

tblZalog.DatabaseName := ExtractFileDir(Application.ExeName)+'\BASES';

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.ExeName)+'\BASES';

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(TfrmKlients, frmKlients);

frmKlients.ShowModal;

end;

 

procedure TfrmMain.N8Click(Sender: TObject);

begin

Application.CreateForm(TfrmPredmet, frmPredmet);

frmPredmet.ShowModal;

end;

 

procedure TfrmMain.N9Click(Sender: TObject);

begin

Application.CreateForm(TfrmClassification, frmClassification);

frmClassification.ShowModal;

end;

 

procedure TfrmMain.N12Click(Sender: TObject);

begin

Application.CreateForm(TfrmDocuments, frmDocuments);

frmDocuments.ShowModal;

end;

 

procedure TfrmMain.ToolButton1Click(Sender: TObject);

begin

tblZalog.Last;

n := tblZalogNDOC.AsInteger;

tblZalog.Append;

tblZalogNDOC.AsInteger := n + 1;

tblZalogS_KR.AsInteger := 0;

Application.CreateForm(TfrmEditZalog, frmEditZalog);

frmEditZalog.ShowModal;

end;

 

procedure TfrmMain.ToolButton2Click(Sender: TObject);

begin

frmMain.tblZalog.Edit;

Application.CreateForm(TfrmEditZalog, frmEditZalog);

if not tblZalogDATA_V.IsNull then

  frmEditZalog.MaskEdit1.Text := DateToStr(tblZalogDATA_V.AsDateTime);

frmEditZalog.ShowModal;

end;

 

procedure TfrmMain.ToolButton3Click(Sender: TObject);

begin

//

end;

 

procedure TfrmMain.ToolButton8Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportZalog, frmReportZalog);

frmReportZalog.QuickRep1.PreviewModal

end;

 

procedure TfrmMain.N13Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportContract, frmReportContract);

frmReportContract.QuickRep1.PreviewModal

end;

 

procedure TfrmMain.DBGrid1DrawColumnCell(Sender: TObject;

  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(Rect, DBGrid1.Fields[DataCol], [gdSelected]);

  end;

if (tblZalogDATA_V.IsNull) and (tblZalogSROK.AsDateTime < Date()) then

  begin

   DBGrid1.Canvas.Brush.Color := clRed;

   DBGrid1.Canvas.Font.Color := clYellow;

   DBGrid1.DefaultDrawDataCell(Rect, DBGrid1.Fields[DataCol], [gdSelected]);

  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(Sender: TObject);

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(Sender: TObject);

begin

Application.CreateForm(TfrmLocateZalog, frmLocateZalog);

frmLocateZalog.ShowModal;

end;

 

procedure TfrmMain.N22Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportDate_1, frmReportDate_1);

frmReportDate_1.Tag := 1;

frmReportDate_1.ShowModal

end;

 

procedure TfrmMain.N23Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportDate_1, frmReportDate_1);

frmReportDate_1.Tag := 2;

frmReportDate_1.ShowModal

end;

 

procedure TfrmMain.N24Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportDate_1, frmReportDate_1);

frmReportDate_1.Tag := 3;

frmReportDate_1.ShowModal

end;

 

procedure AddCombo;

begin

frmReportDate_2.ComboBox1.Items.Clear;

frmReportDate_2.ComboBox1.Items.Add('ВСЕ');

frmMain.tblClassification.First;

while not frmMain.tblClassification.Eof do

  begin

   frmReportDate_2.ComboBox1.Items.Add(frmMain.tblClassificationNAME.asString);

   frmMain.tblClassification.Next;

  end;

frmReportDate_2.ComboBox1.ItemIndex := 0;

end;

 

procedure TfrmMain.N19Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportDate_2, frmReportDate_2);

frmReportDate_2.Tag := 1;

AddCombo;

frmReportDate_2.ShowModal

end;

 

procedure TfrmMain.N20Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportDate_2, frmReportDate_2);

frmReportDate_2.Tag := 2;

AddCombo;

frmReportDate_2.ShowModal

end;

 

procedure TfrmMain.N21Click(Sender: TObject);

begin

Application.CreateForm(TfrmReportDate_2, frmReportDate_2);

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.ToolButton1Click(Sender: TObject);

begin

frmMain.tblClassification.Append;

Application.CreateForm(TfrmEditClassification, frmEditClassification);

frmEditClassification.ShowModal;

end;

 

procedure TfrmClassification.ToolButton2Click(Sender: TObject);

begin

frmMain.tblClassification.Edit;

Application.CreateForm(TfrmEditClassification, frmEditClassification);

frmEditClassification.ShowModal;

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.ToolButton1Click(Sender: TObject);

begin

frmMain.tblDocuments.Append;

Application.CreateForm(TfrmEditDocuments, frmEditDocuments);

frmEditDocuments.ShowModal;

end;

 

procedure TfrmDocuments.ToolButton2Click(Sender: TObject);

begin

frmMain.tblDocuments.Edit;

Application.CreateForm(TfrmEditDocuments, frmEditDocuments);

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.FormClose(Sender: TObject;

  var Action: TCloseAction);

begin

if ModalResult = mrOk then

  frmMain.tblClassification.Post

else

  frmMain.tblClassification.Cancel

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(Sender: TObject;

  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(Sender: TObject;

  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(Sender: TObject);

begin

frmMain.tblPredmet.Post;

Close

end;

 

procedure TfrmEditPredmet.Button2Click(Sender: TObject);

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.SpeedButton1Click(Sender: TObject);

begin

Application.CreateForm(TfrmKlients, frmKlients);

frmKlients.Tag := 1;

frmKlients.ShowModal;

frmKlients.Tag := 0;

end;

 

procedure TfrmEditZalog.ToolButton1Click(Sender: TObject);

begin

frmMain.tblZalogPredmets.Append;

Application.CreateForm(TfrmEditZalogPredmet, frmEditZalogPredmet);

frmEditZalogPredmet.ShowModal;

end;

 

procedure TfrmEditZalog.ToolButton2Click(Sender: TObject);

begin

frmMain.tblZalogPredmets.Edit;

Application.CreateForm(TfrmEditZalogPredmet, frmEditZalogPredmet);

frmEditZalogPredmet.ShowModal;

end;

 

procedure TfrmEditZalog.DBEdit3Change(Sender: TObject);

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.ToolButton3Click(Sender: TObject);

begin

if Application.MessageBox('Удалить запись?','Удаление',MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2) = IDYES then

  frmMain.tblZalogPredmets.Delete

end;

 

procedure TfrmEditZalog.FormClose(Sender: TObject;

  var Action: TCloseAction);

begin

if ModalResult = mrOk then

  begin

   if MaskEdit1.Text = '  .  .  ' then

    frmMain.tblZalogDATA_V.AsVariant := null

   else

    frmMain.tblZalogDATA_V.AsDateTime := StrToDate(MaskEdit1.Text);

   frmMain.tblZalog.Post;

   frmMain.tblZalogPredmets.ApplyUpdates;

   frmMain.tblZalogPredmets.CommitUpdates;

  end

else

  begin

   frmMain.tblZalog.Cancel;

   frmMain.tblZalogPredmets.CancelUpdates;

  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);

Информация о работе Автоматизация ломбарда