Проектирование информационной системы по учету расхода материалов на производство

Технико-экономическая характеристика предметной области, предприятия и средств проектирования. Разработка модели информационной системы учета затрат на производство продукции. Реализация ее с помощью базы данных и системы визуального программирования.

Рубрика Программирование, компьютеры и кибернетика
Вид курсовая работа
Язык русский
Дата добавления 11.11.2017
Размер файла 1,2 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

adotNomGrup.Open;

adotStatiya.Open;

end;

end.

unit ufmMain;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Menus, ComCtrls, ToolWin, ActnList, ImgList, ExtCtrls, DBCtrls,

Grids, DBGrids, StdCtrls, StdActns, XPMan;

type

TfmMain = class(TForm)

ActionList1: TActionList;

MainMenu1: TMainMenu;

ImageList1: TImageList;

Splitter1: TSplitter;

Panel1: TPanel;

Panel2: TPanel;

Panel3: TPanel;

Panel4: TPanel;

dbnPrihod: TDBNavigator;

dbnSpisanie: TDBNavigator;

dbgPrihod: TDBGrid;

dbgSpisanie: TDBGrid;

Panel5: TPanel;

Bevel1: TBevel;

Label1: TLabel;

Panel6: TPanel;

Bevel2: TBevel;

Label2: TLabel;

ActionExit: TFileExit;

N1: TMenuItem;

Exit1: TMenuItem;

ActionSclad: TAction;

ActionPodrazd: TAction;

ActionNomGrup: TAction;

ActionMat: TAction;

ActionStatiya: TAction;

N2: TMenuItem;

N3: TMenuItem;

N4: TMenuItem;

N5: TMenuItem;

N6: TMenuItem;

N7: TMenuItem;

N8: TMenuItem;

ActionMatVed: TAction;

N9: TMenuItem;

XPManifest1: TXPManifest;

procedure dbgPrihodDblClick(Sender: TObject);

procedure dbnPrihodClick(Sender: TObject; Button: TNavigateBtn);

procedure dbgSpisanieDblClick(Sender: TObject);

procedure dbnSpisanieClick(Sender: TObject; Button: TNavigateBtn);

procedure ActionMatExecute(Sender: TObject);

procedure ActionScladExecute(Sender: TObject);

procedure ActionPodrazdExecute(Sender: TObject);

procedure ActionNomGrupExecute(Sender: TObject);

procedure ActionStatiyaExecute(Sender: TObject);

procedure ActionMatVedExecute(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

fmMain: TfmMain;

implementation

uses

udmMain, ufmPrihod, ufmSpisanie, ufmNSI, ufmMatVed;

{$R *.dfm}

procedure TfmMain.ActionMatExecute(Sender: TObject);

begin

ShowNSIForm('Материалы', 'Материалы');

end;

procedure TfmMain.ActionMatVedExecute(Sender: TObject);

begin

fmMatVed := TfmMatVed.Create(Application);

fmMatVed.ShowModal;

fmMatVed.Free;

end;

procedure TfmMain.ActionNomGrupExecute(Sender: TObject);

begin

ShowNSIForm('НоменклатурныеГруппы', 'Номенклатурные группы');

end;

procedure TfmMain.ActionPodrazdExecute(Sender: TObject);

begin

ShowNSIForm('Подразделения', 'Подразделения');

end;

procedure TfmMain.ActionScladExecute(Sender: TObject);

begin

ShowNSIForm('Склады', 'Склады');

end;

procedure TfmMain.ActionStatiyaExecute(Sender: TObject);

begin

ShowNSIForm('СтатьиЗатрат', 'Статьи затрат');

end;

procedure TfmMain.dbgPrihodDblClick(Sender: TObject);

begin

fmPrihod := TfmPrihod.Create(Application);

fmPrihod.ShowModal;

fmPrihod.Free;

end;

procedure TfmMain.dbgSpisanieDblClick(Sender: TObject);

begin

fmSpisanie := TfmSpisanie.Create(Application);

fmSpisanie.ShowModal;

fmSpisanie.Free;

end;

procedure TfmMain.dbnSpisanieClick(Sender: TObject; Button: TNavigateBtn);

begin

if Button in [nbEdit, nbInsert] then

dbgSpisanieDblClick(Sender);

end;

procedure TfmMain.dbnPrihodClick(Sender: TObject; Button: TNavigateBtn);

begin

if Button in [nbEdit, nbInsert] then

dbgPrihodDblClick(Sender);

end;

end.

unit ufmNSI;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Buttons, ActnList;

type

TfmNSI = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

BitBtn3: TBitBtn;

ActionList1: TActionList;

ActionOK: TAction;

ActionSave: TAction;

ActionClose: TAction;

procedure ActionOKExecute(Sender: TObject);

procedure ActionSaveExecute(Sender: TObject);

procedure ActionCloseExecute(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

procedure ShowNSIForm(TableName, FormName: string);

var

fmNSI: TfmNSI;

implementation

uses

DB, udmMain;

{$R *.dfm}

procedure ShowNSIForm(TableName, FormName: string);

begin

with dmMain do

begin

adotNSI.TableName := TableName;

adotNSI.Open;

fmNSI := TfmNSI.Create(Application);

fmNSI.Caption := FormName;

fmNSI.ShowModal;

fmNSI.Free;

adotNSI.Close;

end;

end;

procedure TfmNSI.ActionCloseExecute(Sender: TObject);

begin

with dmMain do

if adotNSI.State in [dsInsert, dsEdit] then

if MessageDlg('Справочник изменен. Записать?',

mtConfirmation, mbYesNoCancel, -1) = mrYes then

adotNSI.Post

else

adotNSI.Cancel;

Close;

end;

procedure TfmNSI.ActionOKExecute(Sender: TObject);

begin

ActionSaveExecute(Sender);

Close;

end;

procedure TfmNSI.ActionSaveExecute(Sender: TObject);

begin

with dmMain do

begin

if adotNSI.State in [dsInsert, dsEdit] then

adotNSI.Post;

end;

end;

end.

unit ufmPrihod;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Mask, DBCtrls, Buttons, Grids, DBGrids, ExtCtrls, ActnList,

ComCtrls;

type

TfmPrihod = class(TForm)

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

DBEdit1: TDBEdit;

DBLookupComboBox1: TDBLookupComboBox;

BitBtn1: TBitBtn;

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

BitBtn3: TBitBtn;

ActionList1: TActionList;

ActionOK: TAction;

ActionSave: TAction;

ActionClose: TAction;

dtpDate: TDateTimePicker;

BitBtn2: TBitBtn;

procedure ActionSaveExecute(Sender: TObject);

procedure ActionCloseExecute(Sender: TObject);

procedure ActionOKExecute(Sender: TObject);

procedure dtpDateChange(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

private

{ Private declarations }

public

{ Public declarations }

end;

var

fmPrihod: TfmPrihod;

implementation

uses

DB, udmMain;

{$R *.dfm}

procedure TfmPrihod.ActionCloseExecute(Sender: TObject);

begin

Close;

end;

procedure TfmPrihod.ActionOKExecute(Sender: TObject);

begin

ActionSaveExecute(Sender);

Close;

end;

procedure TfmPrihod.ActionSaveExecute(Sender: TObject);

begin

with dmMain do

begin

if adotDocPrihod.State in [dsInsert, dsEdit] then

adotDocPrihod.Post;

if adotTabPrihod.State in [dsInsert, dsEdit] then

adotTabPrihod.Post;

end;

end;

procedure TfmPrihod.dtpDateChange(Sender: TObject);

begin

with dmMain do

begin

if not (adotDocPrihod.State in [dsInsert, dsEdit]) then

adotDocPrihod.Edit;

adotDocPrihod.FieldByName('Дата').AsDateTime := dtpDate.DateTime;

end;

end;

procedure TfmPrihod.FormClose(Sender: TObject; var Action: TCloseAction);

var

SaveDoc, SaveTab: Boolean;

begin

with dmMain do

begin

SaveDoc := adotDocPrihod.State in [dsInsert, dsEdit];

SaveTab := adotTabPrihod.State in [dsInsert, dsEdit];

if SaveDoc or SaveTab then

if MessageDlg('Документ изменен. Записать?',mtConfirmation, mbYesNoCancel, -1) = mrYes then

begin

if SaveDoc then

adotDocPrihod.Post;

if SaveTab then

adotTabPrihod.Post;

end else begin

if SaveDoc then

adotDocPrihod.Cancel;

if SaveTab then

adotTabPrihod.Cancel;

end;

end;

end;

procedure TfmPrihod.FormCreate(Sender: TObject);

begin

with dmMain do

case adotDocPrihod.State of

dsInsert:

begin

dtpDate.DateTime := Now;

adotDocPrihod.FieldByName('Дата').AsDateTime := dtpDate.DateTime;

adotDocPrihod.Post;

end;

dsEdit:

dtpDate.DateTime := adotDocPrihod.FieldByName('Дата').AsDateTime;

else

if adotDocPrihod.FieldByName('Номер').AsInteger = 0 then

begin

dtpDate.DateTime := Now;

adotDocPrihod.Insert;

adotDocPrihod.FieldByName('Дата').AsDateTime := dtpDate.DateTime;

adotDocPrihod.Post;

end else

dtpDate.DateTime := adotDocPrihod.FieldByName('Дата').AsDateTime;

end;

end;

end.

unit ufmSpisanie;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Mask, DBCtrls, ComCtrls, Grids, DBGrids, ActnList, Buttons,

ExtCtrls;

type

TfmSpisanie = class(TForm)

Label1: TLabel;

DBEdit1: TDBEdit;

Label2: TLabel;

dtpDate: TDateTimePicker;

DBLookupComboBox1: TDBLookupComboBox;

Label3: TLabel;

DBLookupComboBox2: TDBLookupComboBox;

Label4: TLabel;

DBLookupComboBox3: TDBLookupComboBox;

DBLookupComboBox4: TDBLookupComboBox;

Label5: TLabel;

Label6: TLabel;

DBGrid1: TDBGrid;

ActionList1: TActionList;

ActionOK: TAction;

ActionSave: TAction;

ActionClose: TAction;

DBNavigator1: TDBNavigator;

BitBtn1: TBitBtn;

BitBtn3: TBitBtn;

BitBtn2: TBitBtn;

procedure ActionOKExecute(Sender: TObject);

procedure ActionSaveExecute(Sender: TObject);

procedure ActionCloseExecute(Sender: TObject);

procedure dtpDateChange(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

private

{ Private declarations }

public

{ Public declarations }

end;

var

fmSpisanie: TfmSpisanie;

implementation

uses

DB, udmMain;

{$R *.dfm}

procedure TfmSpisanie.ActionCloseExecute(Sender: TObject);

begin

Close;

end;

procedure TfmSpisanie.ActionOKExecute(Sender: TObject);

begin

ActionSaveExecute(Sender);

Close;

end;

procedure TfmSpisanie.ActionSaveExecute(Sender: TObject);

begin

with dmMain do

begin

if adotDocSpisanie.State in [dsInsert, dsEdit] then

adotDocSpisanie.Post;

if adotTabSpisanie.State in [dsInsert, dsEdit] then

adotTabSpisanie.Post;

end;

end;

procedure TfmSpisanie.dtpDateChange(Sender: TObject);

begin

with dmMain do

begin

if not (adotDocSpisanie.State in [dsInsert, dsEdit]) then

adotDocSpisanie.Edit;

adotDocSpisanie.FieldByName('Дата').AsDateTime := dtpDate.DateTime;

end;

end;

procedure TfmSpisanie.FormClose(Sender: TObject; var Action: TCloseAction);

var

SaveDoc, SaveTab: Boolean;

begin

with dmMain do

begin

SaveDoc := adotDocSpisanie.State in [dsInsert, dsEdit];

SaveTab := adotTabSpisanie.State in [dsInsert, dsEdit];

if SaveDoc or SaveTab then

if MessageDlg('Документ изменен. Записать?',

mtConfirmation, mbYesNoCancel, -1) = mrYes then

begin

if SaveDoc then

adotDocSpisanie.Post;

if SaveTab then

adotTabSpisanie.Post;

end else begin

if SaveDoc then

adotDocSpisanie.Cancel;

if SaveTab then

adotTabSpisanie.Cancel;

end;

end;

end;

procedure TfmSpisanie.FormCreate(Sender: TObject);

begin

with dmMain do

case adotDocSpisanie.State of

dsInsert:

begin

dtpDate.DateTime := Now;

adotDocSpisanie.FieldByName('Дата').AsDateTime := dtpDate.DateTime;

adotDocSpisanie.Post;

end;

dsEdit:

dtpDate.DateTime := adotDocSpisanie.FieldByName('Дата').AsDateTime;

else

if adotDocSpisanie.FieldByName('Номер').AsInteger = 0 then

begin

dtpDate.DateTime := Now;

adotDocSpisanie.Insert;

adotDocSpisanie.FieldByName('Дата').AsDateTime := dtpDate.DateTime;

adotDocSpisanie.Post;

end else

dtpDate.DateTime := adotDocSpisanie.FieldByName('Дата').AsDateTime;

end;

end;

end.

unit ufmMatVed;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, RpBase, RpSystem, RpDefine, RpRave, StdCtrls, Buttons, ComCtrls,

RpCon, RpConDS;

type

TfmMatVed = class(TForm)

RvProject: TRvProject;

RvSystem: TRvSystem;

bbtnStart: TBitBtn;

dtpBegin: TDateTimePicker;

dtpEnd: TDateTimePicker;

Label1: TLabel;

Label2: TLabel;

RvDataSetConnection: TRvDataSetConnection;

procedure bbtnStartClick(Sender: TObject);

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

fmMatVed: TfmMatVed;

implementation

uses

udmMain;

{$R *.dfm}

procedure TfmMatVed.bbtnStartClick(Sender: TObject);

var

DBegin, DEnd : TDateTime;

Year, Month, Day: Word;

begin

with dmMain do

begin

DecodeDate(dtpBegin.DateTime, Year, Month, Day);

DBegin := EncodeDate(Year, Month, Day);

DecodeDate(dtpEnd.DateTime, Year, Month, Day);

DEnd := EncodeDate(Year, Month, Day) + EncodeTime(23, 59, 59, 999);

adospMatVed.Parameters.FindParam('ПериодС').Value := DBegin;

adospMatVed.Parameters.FindParam('ПериодПо').Value := DEnd;

adospMatVed.Open;

RvProject.Open;

RvProject.SelectReport('RaveProject', False);

RvProject.Execute;

RvProject.Close;

adospMatVed.Close;

end;

end;

procedure TfmMatVed.FormCreate(Sender: TObject);

begin

RvProject.ProjectFile := ChangeFileExt(ParamStr(0), '.rav');

dtpBegin.DateTime := Now;

dtpEnd.DateTime := dtpBegin.DateTime;

end;

end.

Размещено на Allbest.ru

...

Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.