Главная страница

курсовая работа тема акимат. Акимат. Разработка информационной системы контроля исполнения поручений для сотрудников акимата


Скачать 1.29 Mb.
НазваниеРазработка информационной системы контроля исполнения поручений для сотрудников акимата
Анкоркурсовая работа тема акимат
Дата08.12.2022
Размер1.29 Mb.
Формат файлаdocx
Имя файлаАкимат.docx
ТипКурсовой проект
#834845
страница8 из 8
1   2   3   4   5   6   7   8

end;
var

FmEvent: TFmEvent;
implementation

uses UnDM;

{$R *.dfm}
end.


unit UnFull;
interface
uses

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

Dialogs, StdCtrls, DBCtrls, ExtCtrls, Mask, Buttons;
type

TFmFull = class(TForm)

Panel1: TPanel;

Panel2: TPanel;

DBMemo1: TDBMemo;

DBLookupComboBox1: TDBLookupComboBox;

DBLookupComboBox2: TDBLookupComboBox;

DBLookupComboBox3: TDBLookupComboBox;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

DBEdit4: TDBEdit;

Label4: TLabel;

DBCheckBox1: TDBCheckBox;

DBEdit5: TDBEdit;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

BitBtn1: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

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

private

{ Private declarations }

public

{ Public declarations }

end;
var

FmFull: TFmFull;
implementation

uses UnDM;

{$R *.dfm}
procedure TFmFull.BitBtn1Click(Sender: TObject);

begin

FmFull.DBEdit1.Enabled := true;

FmFull.DBEdit2.Enabled := true;

FmFull.DBEdit3.Enabled := true;

FmFull.DBEdit4.Enabled := true;

FmFull.DBEdit5.Enabled := true;

FmFull.DBLookupComboBox1.Enabled := true;

FmFull.DBLookupComboBox2.Enabled := true;

FmFull.DBLookupComboBox3.Enabled := true;

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

begin

If DM.TbLetter.Modified then DM.TbLetter.Post;

end;
end.

unit UnMain;
interface
uses

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

Dialogs, Grids, DBGrids, DBCtrls, StdCtrls, Buttons, ExtCtrls, DB,

ComCtrls;
type

TFmMain = class(TForm)

Panel1: TPanel;

GroupBox1: TGroupBox;

BitBtn2: TBitBtn;

BitBtn3: TBitBtn;

Panel2: TPanel;

Panel3: TPanel;

DBNavigator1: TDBNavigator;

Panel5: TPanel;

BitBtn4: TBitBtn;

BitBtn5: TBitBtn;

DBGrid1: TDBGrid;

Panel4: TPanel;

RadioGroup1: TRadioGroup;

Edit1: TEdit;

GroupBox2: TGroupBox;

Label1: TLabel;

SpeedButton1: TSpeedButton;

CheckBox1: TCheckBox;

CheckBox3: TCheckBox;

CheckBox4: TCheckBox;

DateTimePicker1: TDateTimePicker;

DateTimePicker2: TDateTimePicker;

DBLookupComboBox2: TDBLookupComboBox;

DBLookupComboBox3: TDBLookupComboBox;

Label2: TLabel;

BitBtn1: TBitBtn;

Panel6: TPanel;

MonthCalendar1: TMonthCalendar;

Panel7: TPanel;

BitBtn10: TBitBtn;

procedure FormShow(Sender: TObject);

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

procedure BitBtn5Click(Sender: TObject);

procedure BitBtn4Click(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;

DataCol: Integer; Column: TColumn; State: TGridDrawState);

procedure DBGrid1ColEnter(Sender: TObject);

procedure DBGrid1CellClick(Column: TColumn);

procedure Edit1Change(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure BitBtn10Click(Sender: TObject);

procedure DBGrid1DblClick(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;
var

FmMain: TFmMain;
implementation

uses UnDM, UnSecret, UnEvent, UnNote, UnCat, UnStatus, UnAbout, UnFull;

{$R *.dfm}
procedure TFmMain.FormShow(Sender: TObject);

begin

DM.TbLetter.Filter := 'luser = '+ IntToStr(ident); //Задаем фильтр по Id пользователя

DM.TbLetter.Filtered := true;

DM.TbLetter.Active := false;

DM.TbLetter.Active := true;

DM.TbLetterl_user.ReadOnly := true;

DM.TbEvent.Active := false;

DM.TbEvent.Active := true;

DM.TbNote.Active := false;

DM.TbNote.Active := true;

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

begin

DM.TbLetter.Filter := '';

DM.TbLetter.Filtered := false;

DM.TbLetterl_user.ReadOnly := false;

DM.TbEvent.Active := false;

DM.TbEvent.Active := true;

DM.TbNote.Active := false;

DM.TbNote.Active := true;

end;
procedure TFmMain.BitBtn5Click(Sender: TObject);

begin

FmEvent.Caption := 'Работа по сообщению №' +IntToStr(DM.TbLetter.FieldByName('l_id').AsInteger) + ' от '+ DateToStr(DM.TbLetter.FieldByName('l_date').AsDateTime);

FmEvent.ShowModal;

end;
procedure TFmMain.BitBtn4Click(Sender: TObject);

begin

FmNote.Caption := 'Заметки к сообщению №' +IntToStr(DM.TbLetter.FieldByName('l_id').AsInteger) + ' от '+ DateToStr(DM.TbLetter.FieldByName('l_date').AsDateTime);

FmNote.ShowModal;

end;
procedure TFmMain.BitBtn3Click(Sender: TObject);

begin

FmCat.ShowModal;

end;
procedure TFmMain.BitBtn2Click(Sender: TObject);

begin

FmStatus.ShowModal;

end;
procedure DrawGridCheckBox(Canvas: TCanvas; Rect: TRect; Checked: boolean);

var

DrawFlags: Integer;

begin

Canvas.TextRect(Rect, Rect.Left + 1, Rect.Top + 1, ' ');

DrawFrameControl(Canvas.Handle, Rect, DFC_BUTTON, DFCS_BUTTONPUSH or DFCS_ADJUSTRECT);

DrawFlags := DFCS_BUTTONCHECK or DFCS_ADJUSTRECT;// DFCS_BUTTONCHECK

if Checked then

DrawFlags := DrawFlags or DFCS_CHECKED;

DrawFrameControl(Canvas.Handle, Rect, DFC_BUTTON, DrawFlags);

end;


procedure TFmMain.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;

DataCol: Integer; Column: TColumn; State: TGridDrawState);

begin

if Column.FieldName = 'l_read' then // одно поле

if Column.Field.AsBoolean = true then

DrawGridCheckBox(DBGrid1.Canvas, Rect, true)

else

DrawGridCheckBox(DBGrid1.Canvas, Rect, false)

end;
procedure TFmMain.DBGrid1ColEnter(Sender: TObject);

begin

with TDBGrid(Sender) do

if SelectedField.FieldName = 'l_read' then // одно поле

Options := Options - [dgEditing]

else

Options := Options + [dgEditing]

end;
procedure TFmMain.DBGrid1CellClick(Column: TColumn);

begin

if Column.FieldName = 'l_read' then

begin

DM.TbLetter.Edit;

DM.TbLetter.FieldByName('l_read').AsBoolean := Not DM.TbLetter.FieldByName('l_read').AsBoolean;

DM.TbLetter.Post;

end;

end;
procedure TFmMain.Edit1Change(Sender: TObject);

begin

Case RadioGroup1.ItemIndex of

0 : DM.TbLetter.Locate('l_theme', Edit1.Text,[loCaseInsensitive, loPartialKey]);

1 : DM.TbLetter.Locate('l_text', Edit1.Text,[loCaseInsensitive, loPartialKey]);

2 : DM.TbLetter.Locate('l_from', Edit1.Text,[loCaseInsensitive, loPartialKey]);

end;

end;
procedure TFmMain.SpeedButton1Click(Sender: TObject);

var str : string;

begin

str := 'luser = '+ IntToStr(ident); //Задаем фильтр по Id пользователя

if SpeedButton1.Caption = 'Включить фильтр' then //Если кнопка не нажата

begin
Label2.Visible := true;

SpeedButton1.Caption := 'Отключить фильтр';

SpeedButton1.Down := true;

if CheckBox1.Checked then

begin

if str <> '' then str := str +' and ';

str := str + 'l_date >= '+DateToStr(DateTimePicker1.Date)+' and l_date <= '+DateToStr(DateTimePicker2.Date); //фильтр по датам

end;

if (CheckBox3.Checked) and (DBLookupComboBox2.Text <> '')then

begin

if str <> '' then str := str +' and ';

str := str + 'status = '+IntToStr(DBLookupComboBox2.KeyValue); //фильтр по статусу

end;

if (CheckBox4.Checked) and (DBLookupComboBox3.Text <> '')then

begin

if str <> '' then str := str +' and ';

str := str + 'cat = '+IntToStr(DBLookupComboBox3.KeyValue); //фильтр по категории

end;

Dm.TbLetter.Filtered := false;

DM.TbLetter.Filter := str; //Задаем итоговый фильтр

Dm.TbLetter.Filtered := true;

//ShowMessage(str);

end

else

begin

Label2.Visible := false;

str := 'luser = '+ IntToStr(ident); //Задаем фильтр по Id пользователя

SpeedButton1.Caption := 'Включить фильтр';

SpeedButton1.Down := false;

Dm.TbLetter.Filtered := false;

DM.TbLetter.Filter := str;

Dm.TbLetter.Filtered := true;

end;

end;
procedure TFmMain.BitBtn10Click(Sender: TObject);

begin

FmAbout.ShowModal;

end;
procedure TFmMain.DBGrid1DblClick(Sender: TObject);

begin
FmFull.Show;

FmFull.DBEdit1.Enabled := false;

FmFull.DBEdit2.Enabled := false;

FmFull.DBEdit3.Enabled := false;

FmFull.DBEdit4.Enabled := false;

FmFull.DBEdit5.Enabled := false;

FmFull.DBLookupComboBox1.Enabled := false;

FmFull.DBLookupComboBox2.Enabled := false;

FmFull.DBLookupComboBox3.Enabled := false;

end;
end.


unit UnNote;
interface
uses

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

Dialogs, DBCtrls, Grids, DBGrids, ExtCtrls;
type

TFmNote = class(TForm)

Panel1: TPanel;

Panel2: TPanel;

Panel3: TPanel;

Panel4: TPanel;

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

private

{ Private declarations }

public

{ Public declarations }

end;
var

FmNote: TFmNote;
implementation

uses UnDM;

{$R *.dfm}
end.

unit UnPost;
interface
uses

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

Dialogs, StdCtrls, Buttons, Mask, DBCtrls;
type

TFmPost = class(TForm)

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;
var

FmPost: TFmPost;
implementation

uses UnDM;

{$R *.dfm}
procedure TFmPost.BitBtn1Click(Sender: TObject);

begin

If DM.TbPost.Modified then DM.TbPost.Post;

end;
procedure TFmPost.BitBtn2Click(Sender: TObject);

begin

close;

end;
end.


unit UnRCat;
interface
uses

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

Dialogs, ExtCtrls, TeEngine, Series, TeeProcs, Chart, DbChart, DBCtrls,

Grids, DBGrids, StdCtrls, Buttons;
type

TFmRCat = class(TForm)

Panel1: TPanel;

Panel2: TPanel;

Panel3: TPanel;

DBChart1: TDBChart;

Series1: TPieSeries;

DBNavigator1: TDBNavigator;

DBGrid1: TDBGrid;

Panel4: TPanel;

Series2: TBarSeries;

Series3: THorizBarSeries;

RadioGroup1: TRadioGroup;

BitBtn1: TBitBtn;

procedure RadioGroup1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;
var

FmRCat: TFmRCat;
implementation

uses UnDM;

{$R *.dfm}
procedure TFmRCat.RadioGroup1Click(Sender: TObject);

begin

Case RadioGroup1.ItemIndex of

0 : begin

DBChart1.Series[0].Active := true;

DBChart1.Series[1].Active := false;

DBChart1.Series[2].Active := false;

//DBChart1.Series[0].Assign(DBChart1.Series[0]);

end;

1 : begin

DBChart1.Series[1].Active := true;

DBChart1.Series[0].Active := false;

DBChart1.Series[2].Active := false;

//DBChart1.Series[1].Assign(DBChart1.Series[0]);

end;

2 : begin

DBChart1.Series[2].Active := true;

DBChart1.Series[1].Active := false;

DBChart1.Series[0].Active := false;

//DBChart1.Series[2].Assign(DBChart1.Series[0]);

end;

end;

end;
end.
unit UnSecret;
interface
uses

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

Dialogs, StdCtrls, Buttons, ToolWin, Mask, XPStyleActnCtrls, ComCtrls;
type

TForm1 = class(TForm)

EditPass: TEdit;

EditLogin: TEdit;

Label1: TLabel;

Label2: TLabel;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure FormActivate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;
var

Form1: TForm1;

ident : integer;
CancelConnect: Boolean;

ServerName, UserID, Password: string;

PersistSec: Boolean;

implementation

uses UnDM, UnMain, UnAdminMenu, IniFiles;

{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);

begin

DM.TbAdmin.Close;

DM.TbAdmin.Open;

DM.TbLetter.Close;

DM.TbLetter.Open;

DM.TbNote.Close;

DM.TbNote.Open;

DM.TbStatus.Close;

DM.TbStatus.Open;

DM.TbCat.Close;

DM.TbCat.Open;

DM.TbEvent.Close;

DM.TbEvent.Open;

DM.TbPost.Close;

DM.TbPost.Open;

//Ввод логина и пароля

DM.QLogin.Active := false;

DM.QLogin.Parameters[0].Value := EditLogin.Text;

DM.QLogin.Parameters[1].Value := EditPass.Text;

DM.QLogin.Active := true;
//Если такая запись имеется

If DM.QLogin.FieldByName('u_id').AsString = '' then

begin

ShowMessage('Вы ввели ошибочный логин/пароль!');

exit; //Выход

end

else

begin

If DM.QLogin.FieldByName('u_type').AsString = 'Менеджер' then

begin

//система учета договоров

ident := DM.QLogin.FieldByName('u_id').AsInteger;//Сохраняем id пользователя в переменную

FmMain.Caption := 'Работа в системе |'+DM.QLogin.FieldByName('u_fio').AsString;

FmMain.ShowModal;

end;

If DM.QLogin.FieldByName('u_type').AsString = 'Администратор' then

begin

//Форма администрирования

FmAdminMenu.Caption := 'Администрирование |'+DM.QLogin.FieldByName('u_fio').AsString;

FmAdminMenu.ShowModal;

end;
end;

end;
procedure TForm1.BitBtn2Click(Sender: TObject);

begin

Close;

end;
procedure TForm1.FormActivate(Sender: TObject);

var

IniFile: TIniFile;

f: File;

begin

DM.ADOC.Close;

ServerName := '(local)';

PersistSec := false;

UserID := 'sa';

Password := '';
// GetCurrentDir();

if FileExists(GetCurrentDir+'\Connect.ini') then

begin

IniFile := TIniFile.Create(GetCurrentDir+'\Connect.ini');

try

PersistSec := IniFile.ReadBool('Base', 'PersistSec', False);

ServerName := IniFile.ReadString('Base', 'ServerName', '(local)');

UserID := IniFile.ReadString('Base', 'UserID', 'sa');

Password := IniFile.ReadString('Base', 'Password', '');

finally

IniFile.Free;

end;

end;
if not FileExists(GetCurrentDir+'\Connect.ini') then

begin

//Создание файла, если он не существует:

AssignFile(f, GetCurrentDir+'\Connect.ini');

Rewrite(f);

CloseFile(f);

end;
IniFile := TIniFile.Create(GetCurrentDir+'\Connect.ini');

try

IniFile.WriteString('Base', 'ServerName', ServerName);

IniFile.WriteBool('Base', 'PersistSec', PersistSec);

if PersistSec then

begin

IniFile.WriteString('Base', 'UserID', UserID);

IniFile.WriteString('Base', 'Password', Password);

end;

finally

IniFile.Free;

end;


//if not Assigned(fmConnect) then

//Application.CreateForm(TfmConnect, fmConnect);
while (not DM.ADOC.Connected) do

begin

//Задание параметров подключения к серверу БД:

DM.ADOC.ConnectionString :=

'Provider=SQLOLEDB.1;Persist Security Info=' + BoolToStr(PersistSec, True) + ';User ID=' +

UserID + ';Initial Catalog=letter_sql;Data Source=' + ServerName +

';Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;' +

'Use Encryption for Data=False;Tag with column collation when possible=False';

if PersistSec then

DM.ADOC.ConnectionString :=

DM.ADOC.ConnectionString + ';Password=' + Password

else

DM.ADOC.ConnectionString :=

DM.ADOC.ConnectionString + ';Integrated Security=SSPI';
//Попытка подключения к БД:

try

DM.ADOC.Open;

except

on E: Exception do

begin

Application.MessageBox(PChar('Ошибка подключения к базе данных!' + Chr(13) +

'Строка ошибки:' + Chr(13) + E.Message), 'Ошибка', MB_OK+MB_ICONERROR);
end;

end;

end;

end;
end.


unit UnStatus;
interface
uses

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

Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, TeEngine, Series, TeeProcs,

Chart, DbChart;
type

TFmStatus = class(TForm)

Panel1: TPanel;

Panel2: TPanel;

Panel3: TPanel;

Panel4: TPanel;

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

private

{ Private declarations }

public

{ Public declarations }

end;
var

FmStatus: TFmStatus;
implementation

uses UnDM;

{$R *.dfm}
end.


1   2   3   4   5   6   7   8


написать администратору сайта