Смекни!
smekni.com

Автоматизированный учет дисциплинарной практики в УВД (стр. 6 из 8)

6. Пономаренко Сергей. Базы данных в Delphi 7. Самоучитель. – Издательство «Питер», Санкт-Петербург – 2003 г.

7. Форонов В.В. Программирование баз данных в Delphi 7. Учебный курс.-СПб.: Питер, 2006.-459 с.: ил.


ПРИЛОЖЕНИЕ А

(обязательное)

Текст программы

unitUnit1; //загрузочная форма

interface

uses

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

Dialogs, ComCtrls, ExtCtrls, jpeg;

type

TForm1 = class(TForm)

Image1: TImage;

Timer1: TTimer;

ProgressBar1: TProgressBar;

procedure Timer1Timer(Sender: TObject);

procedure FormActivate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);

var

i,k:Integer;

begin

k:=250;

timer1.Enabled:=true;

for i:=0 to 60 do

begin

ProgressBar1.Position:=ProgressBar1.Position+2;

Sleep(30);

if i mod 10=0 then begin

k:=k-30;

form1.AlphaBlendValue:=k;

end;

end;

ProgressBar1.Position:=0;

form2.Show;

form1.Hide;

timer1.Enabled:=false;

form2.PageControl1.ActivePage:=form2.TabSheet1;

end;

procedure TForm1.FormActivate(Sender: TObject);

begin

timer1.Enabled:=true;

end;

end.

unitUnit2;//главная форма отображения информации

interface

uses

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

Dialogs, StdCtrls, Buttons, ComCtrls, Grids, DBGrids, Menus, bsSkinCtrls,

bsSkinData, BusinessSkinForm,ShellAPI;

type

TForm2 = class(TForm)

PageControl1: TPageControl;

TabSheet1: TTabSheet;

TabSheet2: TTabSheet;

DBGrid1: TDBGrid;

DBGrid2: TDBGrid;

TabSheet3: TTabSheet;

DBGrid3: TDBGrid;

bsBusinessSkinForm1: TbsBusinessSkinForm;

bsSkinData1: TbsSkinData;

bsCompressedStoredSkin1: TbsCompressedStoredSkin;

bsSkinButton1: TbsSkinButton;

bsSkinButton2: TbsSkinButton;

bsSkinButton3: TbsSkinButton;

bsSkinButton4: TbsSkinButton;

bsSkinMainMenu1: TbsSkinMainMenu;

bsSkinMainMenuBar1: TbsSkinMainMenuBar;

N12: TMenuItem;

N17: TMenuItem;

N18: TMenuItem;

N19: TMenuItem;

N20: TMenuItem;

N21: TMenuItem;

N22: TMenuItem;

N23: TMenuItem;

N24: TMenuItem;

N25: TMenuItem;

N26: TMenuItem;

N27: TMenuItem;

N28: TMenuItem;

N29: TMenuItem;

N31: TMenuItem;

N32: TMenuItem;

procedure BitBtn2Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure FormActivate(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure BitBtn4Click(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure N6Click(Sender: TObject);

procedure N7Click(Sender: TObject);

procedure N8Click(Sender: TObject);

procedure N9Click(Sender: TObject);

procedure N10Click(Sender: TObject);

procedure N11Click(Sender: TObject);

procedure N13Click(Sender: TObject);

procedure bsSkinButton1Click(Sender: TObject);

procedure bsSkinButton2Click(Sender: TObject);

procedure bsSkinButton3Click(Sender: TObject);

procedure bsSkinButton4Click(Sender: TObject);

procedure N20Click(Sender: TObject);

procedure N22Click(Sender: TObject);

procedure N23Click(Sender: TObject);

procedure N24Click(Sender: TObject);

procedure N25Click(Sender: TObject);

procedure N26Click(Sender: TObject);

procedure N32Click(Sender: TObject);

procedure N27Click(Sender: TObject);

procedure N17Click(Sender: TObject);

procedure N31Click(Sender: TObject);

procedure N18Click(Sender: TObject);

procedure N29Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

implementation

uses Unit1, Unit3, Unit4, Unit5, Unit6, Unit7, Unit8, Unit9, Unit10,

Unit11, Unit12, Unit13, Unit14, Unit15;

{$R *.dfm}

procedure TForm2.BitBtn2Click(Sender: TObject);

begin

Form1.close;

form2.Close;

form3.Close;

form5.Close;

form6.Close;

form7.Close;

form8.Close;

form9.Close;

form10.Close;

form11.close;

form12.close;

form13.close;

end;

procedure TForm2.BitBtn1Click(Sender: TObject);

begin

form3.Show;

end;

procedure TForm2.FormActivate(Sender: TObject);

var k:integer;

begin

with datamodule4.ADOQuery1 do begin

Close;

SQL.Clear;

SQL.Add('select * from Pract');

sql.Add('where Rugo="АппаратУВД"');

Open;

if RecordCount <> 0 then

begin

datamodule4.DataSource1.DataSet :=datamodule4.adoquery1;

end

else

begin

end;

end;

with datamodule4.ADOQuery2 do begin

Close;

SQL.Clear;

SQL.Add('select * from Pract');

sql.Add('where Rugo<>"АппаратУВД"');

Open;

if RecordCount <> 0 then

begin

datamodule4.DataSource2.DataSet :=datamodule4.adoquery2;

end

else

begin

end;

end;

datamodule4.ADOTable1.Open;

datamodule4.ADOTable2.Open;

while not datamodule4.ADOTable1.Eof do

begin

k:=0;

if datamodule4.ADOTable1dataspr.Value<=date() then

begin

datamodule4.ADOTable2.Insert;

datamodule4.ADOTable2['Fam']:=datamodule4.ADOTable1fam.Value;

datamodule4.ADOTable2['Imia']:=datamodule4.ADOTable1imia.Value;

datamodule4.ADOTable2['otc']:=datamodule4.ADOTable1otc.Value;

datamodule4.ADOTable2['zvanie']:=datamodule4.ADOTable1zvanie.Value;

datamodule4.ADOTable2['rugo']:=datamodule4.ADOTable1rugo.Value;

datamodule4.ADOTable2['sl']:=datamodule4.ADOTable1sl.Value;

datamodule4.ADOTable2['podr']:=datamodule4.ADOTable1podr.Value;

datamodule4.ADOTable2['dolj']:=datamodule4.ADOTable1dolj.Value;

datamodule4.ADOTable2['vzisk']:=datamodule4.ADOTable1vzisk.Value;

datamodule4.ADOTable2['chpr']:=datamodule4.ADOTable1chpr.Value;

datamodule4.ADOTable2['nompr']:=datamodule4.ADOTable1nompr.Value;

datamodule4.ADOTable2['datapr']:=datamodule4.ADOTable1datapr.Value;

datamodule4.ADOTable2['opis']:=datamodule4.ADOTable1opis.Value;

datamodule4.ADOTable2['nomspr']:=datamodule4.ADOTable1nomspr.Value;

datamodule4.ADOTable2['dataspr']:=datamodule4.ADOTable1dataspr.Value;

datamodule4.ADOTable2.Post;

datamodule4.ADOTable1.Delete;

k:=1;

end;

datamodule4.ADOTable1.Next;

if k=1 then datamodule4.ADOTable1.Prior;

end;

datamodule4.ADOTable1.Close;

datamodule4.ADOTable2.Close;

datamodule4.ADOTable2.Active:=true;

end;

procedure TForm2.BitBtn3Click(Sender: TObject);

begin

if pagecontrol1.ActivePage=tabsheet1 then begin

if datamodule4.ADOQuery1.IsEmpty then exit;

form5.Show;

form5.DataSource1.DataSet:=datamodule4.ADOQuery1;

form5.DateTimePicker1.Date:=datamodule4.ADOQuery1Datapr.Value;

end;

if pagecontrol1.ActivePage=tabsheet2 then begin

if datamodule4.ADOQuery2.IsEmpty then exit;

form5.Show;

form5.DataSource1.DataSet:=datamodule4.ADOQuery2;

form5.DateTimePicker1.Date:=datamodule4.ADOQuery2Datapr.Value;

end;

if pagecontrol1.ActivePage=tabsheet3 then begin

if datamodule4.ADOtable2.IsEmpty then exit;

form5.Show;

form5.DataSource1.DataSet:=datamodule4.ADOTable2;

form5.DateTimePicker1.Date:=datamodule4.ADOTable2Datapr.Value;

end;

end;

procedure TForm2.BitBtn4Click(Sender: TObject);

begin

if pagecontrol1.ActivePage=tabsheet1 then begin

if datamodule4.ADOQuery1.IsEmpty then exit;

if datamodule4.ADOQuery1 = nil then Exit;

if MessageBox(0,'Вы действительно хотите удалить?','Подтверждение',

33) <> IDOKthen Exit;

datamodule4.ADOQuery1.Delete;

datamodule4.ADOQuery1.Requery;

end;

if pagecontrol1.ActivePage=tabsheet2 then begin

if datamodule4.ADOQuery2.IsEmpty then exit;

if datamodule4.ADOQuery2 = nil then Exit;

if MessageBox(0,'Вы действительно хотите удалить?','Подтверждение',

33) <> IDOKthen Exit;

datamodule4.ADOQuery2.Delete;

datamodule4.ADOQuery2.Requery;

end;

if pagecontrol1.ActivePage=tabsheet3 then begin

if datamodule4.ADOTable2.IsEmpty then exit;

if datamodule4.ADOTable2 = nil then Exit;

if MessageBox(0,'Вы действительно хотите удалить?','Подтверждение',

33) <> IDOKthen Exit;

datamodule4.ADOTable2.Delete;

datamodule4.ADOTable2.Requery;

end;

end;

procedure TForm2.N3Click(Sender: TObject);

begin

form1.Close;

form2.Close;

form3.Close;

form5.Close;

form6.Close;

form7.Close;

form8.Close;

form9.Close;

form10.Close;

form11.Close;

form12.Close;

form13.Close;

end;

procedure TForm2.N7Click(Sender: TObject);

begin

form6.Caption:='Поискпозванию';

form8.Show;

end;

procedure TForm2.N8Click(Sender: TObject);

begin

form6.Caption:='Поискпообласти';

form9.show;

end;

procedure TForm2.N9Click(Sender: TObject);

begin

form6.Caption:='Поискпослужбе';

form10.show;

end;

procedure TForm2.N10Click(Sender: TObject);

begin

form6.Caption:='Поиск по подразделению';

form11.show;

end;

procedure TForm2.N11Click(Sender: TObject);

begin

form6.Caption:='Поиск по должности';

form12.show;

end;

procedure TForm2.N13Click(Sender: TObject);

begin

form6.Caption:='Поиск по месту приказа';

form13.show;

end;

procedure TForm2.bsSkinButton1Click(Sender: TObject);

begin

Form1.close;

form2.Close;

form3.Close;

form5.Close;

form6.Close;

form7.Close;

form8.Close;

form9.Close;

form10.Close;

form11.close;

form12.close;

form13.close;

form14.Close;

form15.Close;

end;

procedure TForm2.bsSkinButton2Click(Sender: TObject);

begin

if pagecontrol1.ActivePage=tabsheet1 then begin

if datamodule4.ADOQuery1.IsEmpty then exit;

if datamodule4.ADOQuery1 = nil then Exit;

if MessageBox(0,'Вы действительно хотите удалить?','Подтверждение',

33) <> IDOKthen Exit;

datamodule4.ADOQuery1.Delete;

datamodule4.ADOQuery1.Requery;

end;

if pagecontrol1.ActivePage=tabsheet2 then begin

if datamodule4.ADOQuery2.IsEmpty then exit;

if datamodule4.ADOQuery2 = nil then Exit;

if MessageBox(0,'Вы действительно хотите удалить?','Подтверждение',

33) <> IDOKthen Exit;

datamodule4.ADOQuery2.Delete;

datamodule4.ADOQuery2.Requery;

end;

if pagecontrol1.ActivePage=tabsheet3 then begin

if datamodule4.ADOTable2.IsEmpty then exit;

if datamodule4.ADOTable2 = nil then Exit;

if MessageBox(0,'Вы действительно хотите удалить?','Подтверждение',

33) <> IDOKthen Exit;

datamodule4.ADOTable2.Delete;

datamodule4.ADOTable2.Requery;

end;

end;

procedure TForm2.bsSkinButton3Click(Sender: TObject);

begin

if pagecontrol1.ActivePage=tabsheet1 then begin

if datamodule4.ADOQuery1.IsEmpty then exit;

form5.Show;

form5.DataSource1.DataSet:=datamodule4.ADOQuery1;

form5.DateTimePicker1.Date:=datamodule4.ADOQuery1Datapr.Value;

end;

if pagecontrol1.ActivePage=tabsheet2 then begin

if datamodule4.ADOQuery2.IsEmpty then exit;

form5.Show;

form5.DataSource1.DataSet:=datamodule4.ADOQuery2;

form5.DateTimePicker1.Date:=datamodule4.ADOQuery2Datapr.Value;

end;

if pagecontrol1.ActivePage=tabsheet3 then begin

if datamodule4.ADOtable2.IsEmpty then exit;

form5.Show;

form5.DataSource1.DataSet:=datamodule4.ADOTable2;

form5.DateTimePicker1.Date:=datamodule4.ADOTable2Datapr.Value;

end;

end;

procedure TForm2.bsSkinButton4Click(Sender: TObject);

begin

form3.Show;

end;

procedure TForm2.N20Click(Sender: TObject);

begin

form1.Close;

form2.Close;

form3.Close;

form5.Close;

form6.Close;

form7.Close;

form8.Close;

form9.Close;

form10.Close;

form11.Close;

form12.Close;

form13.Close;

form14.Close;

form15.Close;

end;

procedure TForm2.N22Click(Sender: TObject);

begin

form6.Caption:='Поискпофамилии';

form6.bsSkinButton2.Visible:=true;

form14.show;

end;

procedure TForm2.N23Click(Sender: TObject);

begin

form6.Caption:='Поискпозванию';

form8.Show;

end;

procedure TForm2.N24Click(Sender: TObject);

begin

form6.Caption:='Поискпообласти';

form9.show;

end;

procedure TForm2.N25Click(Sender: TObject);

begin

form6.Caption:='Поискпослужбе';

form10.show;

end;

procedure TForm2.N26Click(Sender: TObject);

begin

form6.Caption:='Поиск по подразделению';

form11.show;

end;

procedure TForm2.N32Click(Sender: TObject);

begin

form6.Caption:='Поиск по должности';

form12.show;

end;

procedure TForm2.N27Click(Sender: TObject);

begin

form6.Caption:='Поиск по месту приказа';

form13.show;

end;

procedure TForm2.N17Click(Sender: TObject);

begin

if pagecontrol1.ActivePage=tabsheet1 then begin

form7.DataSource1.DataSet:=datamodule4.ADOQuery1;

form7.Show;

end;

if pagecontrol1.ActivePage=tabsheet2 then begin

form7.DataSource1.DataSet:=datamodule4.ADOQuery2;

form7.Show;

end;

if pagecontrol1.ActivePage=tabsheet3 then begin

form7.DataSource1.DataSet:=datamodule4.ADOTable2;

form7.Show;

end;

end;

procedure TForm2.N31Click(Sender: TObject);

begin

form15.show;

end;

procedure TForm2.N18Click(Sender: TObject);

begin

if pagecontrol1.ActivePage=tabsheet1 then datamodule4.RvProject1.Execute;

if pagecontrol1.ActivePage=tabsheet2 then datamodule4.RvProject2.Execute;

end;

procedure TForm2.N29Click(Sender: TObject);

begin

shellExeCute(handle,nil,'Справка.chm',nil,nil,sw_restore);

end;

end.

unitUnit3; //форма добавления записи

interface

uses

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

Dialogs, Menus, StdCtrls, Buttons, ComCtrls, bsSkinCtrls, bsSkinData,

BusinessSkinForm, bsdbctrls, Mask, bsSkinBoxCtrls;

type

TForm3 = class(TForm)

Label2: TLabel;

Label3: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

Edit11: TEdit;

Edit13: TEdit;

Edit4: TEdit;

PopupMenu1: TPopupMenu;

N1,N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13, N14, N15, N16, N17, N18, N19,N20: TMenuItem;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

PopupMenu2: TPopupMenu;

N21,N22,N23,N24,N25, N26, N27, N28, N29, N30,N31,N32,N33,N34,N35,N36,N37,N38,N39,N40,N41,N42,N43,N44,N45,N46,N47,N48, N49,N50,N51,N52,N53,N54,N55,N56,N57,N58,N59,N60,N61: TMenuItem;

DateTimePicker1: TDateTimePicker;

ComboBox3: TComboBox;

bsBusinessSkinForm1: TbsBusinessSkinForm;

bsSkinData1: TbsSkinData;

bsCompressedStoredSkin1: TbsCompressedStoredSkin;

bsSkinButton1: TbsSkinButton;

Label1: TLabel;