Разработка программного продукта «Автоматизированный учет компьютеров и программного обеспечения» (Текст программы)

Страницы работы

Фрагмент текста работы

unit UnitZastavka; //Модуль заставка

interface

uses

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

Dialogs, ExtCtrls, StdCtrls, jpeg;

type

TZastavka = class(TForm)

Timer1: TTimer;

Image1: TImage;

Image2: TImage;

Image3: TImage;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

procedure Timer1Timer(Sender: TObject);

procedure FormShow(Sender: TObject);

private

{ Private declarations }

public

t:integer;

{ Public declarations }

end;

var

Zastavka: TZastavka;

implementation

uses UnitPorol;

{$R *.dfm}

procedure TZastavka.Timer1Timer(Sender: TObject);

begin

t:=t+1;

case t of

1:begin

image1.Visible:=true;

label1.Visible:=true;

end;

2:begin

image2.Visible:=true;

label2.Visible:=true;

end;

3:begin

image3.Visible:=true;

label3.Visible:=true;

end;

4:begin

Zastavka.Show;

Porol.Show;

end;

end;

end;

procedure TZastavka.FormShow(Sender: TObject);

begin

t:=0;

end;

end.

unit UnitPorol; // Модуль для ввода программы

interface

uses

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

Dialogs, StdCtrls;

type

TPorol = class(TForm)

Edit1: TEdit;

Button1: TButton;

Label1: TLabel;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Porol: TPorol;

implementation

uses SpisMa, UnitZastavka;

{$R *.dfm}

procedure TPorol.Button1Click(Sender: TObject);

begin

if edit1.Text='1212' then

begin

Zastavka.Hide;

Porol.Hide;

SpisMA.Form1.Show;

end

else

begin Application.MessageBox('Íåâåðíî ââåäåí ïàðîëü','Ñîîáùåíèå',Mb_ok)  end;

end;

end.

unit SpisMa;     //Главный модуль программы

interface

uses

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

Dialogs, Grids, DBGrids, jpeg, ExtCtrls, Menus, StdCtrls, DBCtrls,

ComCtrls, Buttons, Mask;

type

TForm1 = class(TForm)

DBGrid1: TDBGrid;

DBGrid2: TDBGrid;

Button3: TButton;

MainMenu1: TMainMenu;

Label2: TLabel;

N4: TMenuItem;

N5: TMenuItem;

N6: TMenuItem;

N7: TMenuItem;

DBMemo1: TDBMemo;

Label4: TLabel;

Label3: TLabel;

Panel1: TPanel;

Panel2: TPanel;

Panel3: TPanel;

Panel4: TPanel;

TabControl1: TTabControl;

PanelKomp: TPanel;

TreeView1: TTreeView;

PanelUstr: TPanel;

TreeView2: TTreeView;

PopupMenu1: TPopupMenu;

N8: TMenuItem;

N9: TMenuItem;

N10: TMenuItem;

N11: TMenuItem;

N12: TMenuItem;

Timer1: TTimer;

DBEdit1: TDBEdit;

Image1: TImage;

Image2: TImage;

Edit3: TEdit;

Edit1: TEdit;

N1: TMenuItem;

Timer2: TTimer;

N2: TMenuItem;

N3: TMenuItem;

TimerSachita: TTimer;

N13: TMenuItem;

Herjdjlcndjgjkmpjdfntkz1: TMenuItem;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

Label5: TLabel;

N14: TMenuItem;

N15: TMenuItem;

N16: TMenuItem;

N17: TMenuItem;

GroupBox1: TGroupBox;

RadioButton2: TRadioButton;

RadioButton3: TRadioButton;

CheckBox1: TCheckBox;

Panel5: TPanel;

Image3: TImage;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

BitBtn1: TBitBtn;

Label10: TLabel;

N18: TMenuItem;

N19: TMenuItem;

procedure BuClick(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure N2Click(Sender: TObject);

procedure ButtonMatClick(Sender: TObject);

procedure FormActivate(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure Open(sender:tobject);

procedure N5Click(Sender: TObject);

procedure N6Click(Sender: TObject);

procedure N7Click(Sender: TObject);

procedure Button11Click(Sender: TObject);

procedure TreeView1Click(Sender: TObject);

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

procedure FormShow(Sender: TObject);

procedure TreeView1MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Panel4MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Panel4MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Panel2MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Panel3MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Panel2MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure Panel3MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure sort(sor:string;sender:TObject);

procedure sortkr(sor:string;sender:TObject);

procedure sort1(sor:string;sender:tobject);

procedure sort1kr(sor:string;sender:tobject);

procedure sortDR(sor:string;sender:Tobject);

procedure sortDRkr(sor:string;sender:Tobject);

procedure sortDR1(sor:string;sender:Tobject);

procedure TabControl1Change(Sender: TObject);

procedure TreeView2Click(Sender: TObject);

procedure TreeView2MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure N8Click(Sender: TObject);

procedure N9Click(Sender: TObject);

procedure N10Click(Sender: TObject);

procedure N11Click(Sender: TObject);

procedure N12Click(Sender: TObject);

procedure Timer1Timer(Sender: TObject);

procedure chislo(sender:tobject);

Procedure ObFakts(sender:Tobject);

procedure N1Click(Sender: TObject);

procedure Timer2Timer(Sender: TObject);

procedure TimerSachitaTimer(Sender: TObject);

procedure N13Click(Sender: TObject);

procedure Herjdjlcndjgjkmpjdfntkz1Click(Sender: TObject);

procedure N15Click(Sender: TObject);

procedure N16Click(Sender: TObject);

procedure DBGrid1CellClick(Column: TColumn);

procedure N17Click(Sender: TObject);

procedure DBGrid1KeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

procedure RadioButton2Click(Sender: TObject);

procedure RadioButton3Click(Sender: TObject);

procedure CheckBox1Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure N19Click(Sender: TObject);

private

{ Private declarations }

public

NTR,NTR1:string;{Çàïîìèíàåò èìÿ òåêóùåãî äåðåâà äëÿ ñîõðàíåíèÿ ïåðåä ïåðåêëþ÷åíèåì}

DatTek:Tdatetime;

DAtaust:Tdatetime;

DAtares:Tdatetime;

kols,n,j,t,ch,chh,opr:integer; //êîëè÷åñòâî çàïèñåé â âûáîðêå

l,di:boolean;

sor:string;

Ustr:array[1..10] of string;

Pstr:array[1..4] of string;

Kat:array[1..8] of string;

{ Public declarations }

end;

var

Form1: TForm1;

implementation

uses Datamoduleunit, OtchetF, otbor2, EditFormUnit, NastroikaUnit,

EditFormDustrUnit,adoconed, AvtorUnit, LoginUnit, UnitKab, UnitOtchMasch,

UnitPorol, UnitZastavka;

{$R *.dfm}

procedure Tform1.chislo(sender:tobject);

//Ïðîöåäóðà âûçûâàåòñÿ ïðè óäàëåíèè è ñîçäàíèè óçëîâ Treeview1 íóìåðóåò ìàøèíû â Treeview1

var s,s1:string;

i,i1:integer;

begin

case opr of

{2:begin for i:=0 to treeview1.Items.Count-1 do

begin

for i1:=0 to 10 do

begin

s:=treeview1.Items[i].text;

if s[8]=inttostr(i1) then begin

chh:=strtoint(s[8]+s[9]);

end;                     end;

end;

end; }

1:begin s:=treeview1.Selected.Text; end;

3:begin s:=treeview1.Items[0].text; end;

end;

{label5.Caption:=s[8]+s[9]; }

// ñðàâíèâàåòâûáðàíûé óçåë ñ ïîñëåäíèì è ïåðåäàåò ïåðåìåíîé ch ðàçðåøåíèå èëè çàïðåò

for i:=0 to treeview1.Items.Count-1 do

begin

s1:=treeview1.Items[i].text;

for i1:=0 to 10 do

if s1[8]=inttostr(i1) then begin

chh:=strtoint(s1[8]+s1[9]);

if (strtoint(s[8]+s[9])<strtoint(s1[8]+s1[9])) then begin

ch:=1;   end else begin ch:=0 end;

end;

end;

end;

procedure Tform1.ObFakts(sender:tobject);

var g,m,i:integer;

Srok:string;

begin

dattek:=date();

{Îáíàâëåíèå ïàðàìåòðà Ôàêêòè÷åñêèé ñðîê èñïîëüçîâàíèÿ}

{datares:=dattek-dattek; }

{edit2.Text:=formatdatetime('dd/mm/yyy',datares); }

for i:=1 to datamodule2.DrGelesoTable.RecordCount do

begin

datamodule2.DrGelesoTable.RecNo:=i;

dataust:=datamodule2.DrGelesoTableDSDesigner7.Value;

g:=strtoint(formatdatetime('yyy',dattek))-strtoint(formatdatetime('yyy',dataust));

m:=strtoint(formatdatetime('mm',dattek))-strtoint(formatdatetime('mm',dataust));

srok:=inttostr(g)+' Ëåò'+inttostr(m)+' Ìåñÿöåâ';

datamodule2.DrGelesoTable.Edit;

dbedit1.Text:=srok;

{srok:=inttostr(g)+' Ëåò'+inttostr(m)+' Ìåñÿöåâ';

datamodule2.DrGelesoTableDSDesigner.AsString:=srok;   }

if datamodule2.DrGelesoTable.Modified then;  begin

datamodule2.DrGelesoTable.Post;    end;

end

end;

procedure tform1.Open(sender:Tobject);

begin

{groupboxotbor.visible:=true;

groupboxotbor.Top:=248;

groupboxotbor.Left:=8;

groupboxotbor.Width:=921;

groupboxotbor.Height:=193; }

otbor.Show;

end;

procedure TForm1.BuClick(Sender: TObject);

var m:string;

begin

Datamodule2.GelesoQueryshipset.Visible:=false;

m:='Âèäþõà';

DataModule2.GelesoQuery.Active:=false;

DataModule2.GelesoQuery.Parameters.ParamByName('Nomer').Value:=m;

Datamodule2.GelesoQuery.Active:=True;

{Datamodule2.GelesoQueryDSDesigner8.Visible:=true; }

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

if Datamodule2.CompTable.Modified then

DataModule2.CompTable.Post;

if Datamodule2.GelesoTable.Modified then

DataModule2.GelesoTable.Post;

if datamodule2.DrGelesoTable.Modified then

datamodule2.DrGelesoTable.Post;

Close;

datamodule2.ADOConnection1.Connected:=false;

{if (strtoint(formatdatetime('dd',date()))>1) and (strtoint(formatdatetime('mm',date()))>01) and (strtoint(formatdatetime('yyy',date()))>2006) then

begin

datamodule2.ADOConnection1.Close;

Deletefile('Data\Database.mdb');

end;  }

end;

{Ïðîöåäóðà êîòîðîÿ äåëààåò êîíêðåòíóþ âûáîðêó}

procedure Tform1.sort(sor:string;sender:tObject);

var i:integer;

begin

DataModule2.GelesoQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.GelesoQuery.SQL.Clear;

datamodule2.GelesoQuery.SQL.Add('Select*');

datamodule2.GelesoQuery.SQL.Add('FROM ÍîìÊîìï, Æåëåçî');

datamodule2.GelesoQuery.SQL.Add('WHERE Óñòðîéñòâà LIKE :Nomer AND obkey LIKE :Nom');

datamodule2.gelesoquery.SQL.Add('AND ÍîìÊîìï.Key=Æåëåçî.obkey ');

Datamodule2.GelesoQuery.active:=true;

DataModule2.perefQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.perefQuery.SQL.Clear;

datamodule2.perefQuery.SQL.Add('Select*');

datamodule2.perefQuery.SQL.Add('FROM ÍîìÊîìï, peref');

datamodule2.perefQuery.SQL.Add('WHERE Óñòðîéñòâî LIKE :Nomer AND obkey2 LIKE :Nom');

datamodule2.perefQuery.SQL.Add('AND ÍîìÊîìï.Key=peref.obkey2');

Datamodule2.perefQuery.active:=true;

{datamodule2.GelesoQueryDSDesigner5.Visible:=false; }

sor:=treeview1.Selections[0].Text;

otbor.DBGrid3.DataSource:=datamodule2.GelesoQSource;

kols:=0;

DataModule2.GelesoQuery.Active:=false;

Datamodule2.GelesoQuery.Parameters.ParamByName('Nom').Value:=Datamodule2.CompTableKey.Value;

DataModule2.GelesoQuery.Parameters.ParamByName('Nomer').Value:=sor;

Datamodule2.GelesoQuery.Active:=True;

for i:=1 to 4 do                      begin

if treeview1.Selected.text=pstr[i] then begin

otbor.DBGrid3.DataSource:=datamodule2.perefqsource;

kols:=1;

datamodule2.perefQuery.Active:=false;

datamodule2.perefQuery.Parameters.ParamByName('Nom').Value:=datamodule2.CompTableKey.Value;

datamodule2.perefQuery.Parameters.ParamByName('Nomer').Value:=sor;

datamodule2.perefQuery.Active:=true;

end ;

end;

{Datamodule2.GelesoQueryDSDesigner3.Visible:=true;

Datamodule2.GelesoQueryshipset.Visible:=true;  }

{groupbox2.Visible:=false;}

Open(sender);

end;

procedure Tform1.sortkr(sor:string;sender:tObject);

var i,v:integer;

begin

DataModule2.GelesoQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.GelesoQuery.SQL.Clear;

datamodule2.GelesoQuery.SQL.Add('Select*');

datamodule2.GelesoQuery.SQL.Add('FROM ÍîìÊîìï, Æåëåçî');

datamodule2.GelesoQuery.SQL.Add('WHERE Óñòðîéñòâà LIKE :Nomer AND obkey LIKE :Nom');

datamodule2.gelesoquery.SQL.Add('AND ÍîìÊîìï.Key=Æåëåçî.obkey ');

Datamodule2.GelesoQuery.active:=true;

DataModule2.perefQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.perefQuery.SQL.Clear;

datamodule2.perefQuery.SQL.Add('Select*');

datamodule2.perefQuery.SQL.Add('FROM ÍîìÊîìï, peref');

datamodule2.perefQuery.SQL.Add('WHERE Óñòðîéñòâî LIKE :Nomer AND obkey2 LIKE :Nom');

datamodule2.perefQuery.SQL.Add('AND ÍîìÊîìï.Key=peref.obkey2');

Datamodule2.perefQuery.active:=true;

{Ôîðìèðóåì êîíôèãóðàöèè}

datamodule2.GelesoQueryDSDesigner.Visible:=false;

datamodule2.GelesoQueryDSDesigner2.Visible:=false;

datamodule2.GelesoQueryDSDesigner3.Visible:=false;

datamodule2.GelesoQueryDSDesigner4.Visible:=false;

datamodule2.GelesoQueryDSDesigner5.Visible:=false;

datamodule2.GelesoQueryDSDesigner6.Visible:=false;

datamodule2.GelesoQueryshipset.Visible:=false;

datamodule2.GelesoQueryDSDesigner7.Visible:=false;

datamodule2.GelesoQueryDSDesigner8.Visible:=false;

datamodule2.GelesoQueryDSDesigner9.Visible:=false;

datamodule2.GelesoQuerySost.Visible:=false;

datamodule2.GelesoQueryDSDesigner10.Visible:=false;

datamodule2.GelesoQueryDSDesigner11.Visible:=false;

{datamodule2.GelesoQueryDSDesigner5.Visible:=false; }

Ustr[1]:='Ìàòåðèíñêàÿ ïëàòà';

Ustr[2]:='Ïðîöåñcîð';

Ustr[3]:='Æåñòêèé äèñê';

Ustr[4]:='Âèäåîêàðòà';

Ustr[5]:='Îïåðàòèâíàÿ ïàìÿòü';

Ustr[6]:='Êóëëåð';

Ustr[7]:='Ôëîïè äèñêîâîä';

Ustr[8]:='DVD-CD Ïðèâîäû';

Ustr[9]:='Ñåòåâîé àäàïòåð';

Ustr[10]:='Êîðïóñ';

sor:=treeview1.Selections[0].Text;

for i:=1 to 10 do    begin

if Ustr[i]=sor then begin v:=i; end;      end;

case v of

1:begin

datamodule2.GelesoQueryDSDesigner4.Visible:=true;

datamodule2.GelesoQueryDSDesigner5.Visible:=true;

datamodule2.GelesoQueryDSDesigner6.Visible:=true;

datamodule2.GelesoQueryshipset.Visible:=true;

datamodule2.GelesoQueryDSDesigner8.Visible:=true;

datamodule2.GelesoQuerySost.Visible:=true;

datamodule2.GelesoQueryDSDesigner11.Visible:=true;

end;

2:begin

datamodule2.GelesoQueryDSDesigner4.Visible:=true;

datamodule2.GelesoQueryDSDesigner5.Visible:=true;

datamodule2.GelesoQueryDSDesigner6.Visible:=true;

datamodule2.GelesoQueryDSDesigner7.Visible:=true;

datamodule2.GelesoQuerySost.Visible:=true;

datamodule2.GelesoQueryDSDesigner11.Visible:=true;

end;

3..5:begin

datamodule2.GelesoQueryDSDesigner4.Visible:=true;

datamodule2.GelesoQueryDSDesigner5.Visible:=true;

datamodule2.GelesoQueryDSDesigner6.Visible:=true;

datamodule2.GelesoQueryDSDesigner9.Visible:=true;

datamodule2.GelesoQuerySost.Visible:=true;

datamodule2.GelesoQueryDSDesigner11.Visible:=true;

end;

6..10:begin

datamodule2.GelesoQueryDSDesigner4.Visible:=true;

datamodule2.GelesoQueryDSDesigner5.Visible:=true;

datamodule2.GelesoQueryDSDesigner6.Visible:=true;

datamodule2.GelesoQuerySost.Visible:=true;

datamodule2.GelesoQueryDSDesigner11.Visible:=true;

end;

end;

otbor.DBGrid3.DataSource:=datamodule2.GelesoQSource;

kols:=0;

DataModule2.GelesoQuery.Active:=false;

Datamodule2.GelesoQuery.Parameters.ParamByName('Nom').Value:=Datamodule2.CompTableKey.Value;

DataModule2.GelesoQuery.Parameters.ParamByName('Nomer').Value:=sor;

Datamodule2.GelesoQuery.Active:=True;

for i:=1 to 4 do                      begin

if treeview1.Selected.text=pstr[i] then begin

otbor.DBGrid3.DataSource:=datamodule2.perefqsource;

kols:=1;

datamodule2.perefQuery.Active:=false;

datamodule2.perefQuery.Parameters.ParamByName('Nom').Value:=datamodule2.CompTableKey.Value;

datamodule2.perefQuery.Parameters.ParamByName('Nomer').Value:=sor;

datamodule2.perefQuery.Active:=true;

end ;

end;

end;

{Ïðîöåäóðà êîòîðîÿ äåëààåò ìíîæåñòâåíóþ âûáîðêó âûáîðêó}

procedure Tform1.sort1(sor:string;sender:tobject);

var i:integer;

begin

sor:=treeview1.Selections[0].Text;

datamodule2.GelesoQuery.Active:=false;

datamodule2.GelesoQuery.SQL.Clear;

datamodule2.GelesoQuery.SQL.Add('select*');

datamodule2.GelesoQuery.SQL.Add('from ÍîìÊîìï, Æåëåçî');

datamodule2.GelesoQuery.SQL.Add('Where Óñòðîéñòâà LIKE '''+sor+'''');

datamodule2.GelesoQuery.SQL.Add('And ÍîìÊîìï.Key=Æåëåçî.obkey');

datamodule2.GelesoQuery.Active:=true;

DataModule2.perefQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.perefQuery.SQL.Clear;

datamodule2.perefQuery.SQL.Add('Select*');

datamodule2.perefQuery.SQL.Add('FROM ÍîìÊîìï, peref');

datamodule2.perefQuery.SQL.Add('WHERE Óñòðîéñòâî LIKE '''+sor+'''');

datamodule2.perefQuery.SQL.Add('AND ÍîìÊîìï.Key=peref.obkey2');

Datamodule2.perefQuery.active:=true;

otbor.DBGrid3.DataSource:=datamodule2.GelesoQSource;

Kols:=0;

for i:=1 to 4 do                      begin

if treeview1.Selected.text=pstr[i] then begin

kols:=1;

otbor.DBGrid3.DataSource:=datamodule2.perefqsource;

end;end;

open(sender);

end;

{Ïðîöåäóðà êîòîðîÿ äåëààåò ìíîæåñòâåíóþ âûáîðêó âûáîðêó}

procedure Tform1.sort1kr(sor:string;sender:tobject);

var i:integer;

begin

sor:=treeview1.Selections[0].Text;

datamodule2.GelesoQuery.Active:=false;

datamodule2.GelesoQuery.SQL.Clear;

datamodule2.GelesoQuery.SQL.Add('select*');

datamodule2.GelesoQuery.SQL.Add('from ÍîìÊîìï, Æåëåçî');

datamodule2.GelesoQuery.SQL.Add('Where Óñòðîéñòâà LIKE '''+sor+'''');

datamodule2.GelesoQuery.SQL.Add('And ÍîìÊîìï.Key=Æåëåçî.obkey');

datamodule2.GelesoQuery.Active:=true;

DataModule2.perefQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.perefQuery.SQL.Clear;

datamodule2.perefQuery.SQL.Add('Select*');

datamodule2.perefQuery.SQL.Add('FROM ÍîìÊîìï, peref');

datamodule2.perefQuery.SQL.Add('WHERE Óñòðîéñòâî LIKE '''+sor+'''');

datamodule2.perefQuery.SQL.Add('AND ÍîìÊîìï.Key=peref.obkey2');

Datamodule2.perefQuery.active:=true;

otbor.DBGrid3.DataSource:=datamodule2.GelesoQSource;

Kols:=0;

for i:=1 to 4 do                      begin

if treeview1.Selected.text=pstr[i] then begin

kols:=1;

otbor.DBGrid3.DataSource:=datamodule2.perefqsource;

end;end;

end;

procedure Tform1.sortDRkr(sor:string;sender:Tobject);

begin

kols:=2;

DataModule2.drGelesoQuery.Active:=false;

DataModule2.drGelesoQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.drGelesoQuery.SQL.Clear;

datamodule2.drGelesoQuery.SQL.Add('Select*');

datamodule2.drGelesoQuery.SQL.Add('FROM Drgeleso');

datamodule2.drGelesoQuery.SQL.Add('WHERE Êëþ÷_Êàòåãîðèè LIKE :Nomer  and Ìàðêà LIKE :Nom');

Datamodule2.drGelesoQuery.active:=true;

DataModule2.drGelesoQuery.Active:=false;

Datamodule2.drGelesoQuery.Parameters.ParamByName('Nom').Value:=j;

DataModule2.drGelesoQuery.Parameters.ParamByName('Nomer').Value:=n;

DataModule2.drGelesoQuery.Active:=true;

end;

procedure Tform1.sortDR(sor:string;sender:Tobject);

begin

kols:=2;

DataModule2.drGelesoQuery.Active:=false;

DataModule2.drGelesoQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.drGelesoQuery.SQL.Clear;

datamodule2.drGelesoQuery.SQL.Add('Select*');

datamodule2.drGelesoQuery.SQL.Add('FROM Drgeleso');

datamodule2.drGelesoQuery.SQL.Add('WHERE Êëþ÷_Êàòåãîðèè LIKE :Nomer  and Ìàðêà LIKE :Nom');

Datamodule2.drGelesoQuery.active:=true;

DataModule2.drGelesoQuery.Active:=false;

Datamodule2.drGelesoQuery.Parameters.ParamByName('Nom').Value:=j;

DataModule2.drGelesoQuery.Parameters.ParamByName('Nomer').Value:=n;

DataModule2.drGelesoQuery.Active:=true;

otbor.DBGrid3.DataSource:=datamodule2.DrGelesoQSource;

open(sender);

end;

procedure Tform1.sortDR1(sor:string;sender:Tobject);

begin

kols:=2;

DataModule2.drGelesoQuery.Active:=false;

DataModule2.drGelesoQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.drGelesoQuery.SQL.Clear;

datamodule2.drGelesoQuery.SQL.Add('Select*');

datamodule2.drGelesoQuery.SQL.Add('FROM Drgeleso');

datamodule2.drGelesoQuery.SQL.Add('WHERE Êëþ÷_Êàòåãîðèè LIKE :Nomer');

Datamodule2.drGelesoQuery.active:=true;

DataModule2.drGelesoQuery.Active:=false;

DataModule2.drGelesoQuery.Parameters.ParamByName('Nomer').Value:=n;

DataModule2.drGelesoQuery.Active:=true;

otbor.DBGrid3.DataSource:=datamodule2.DrGelesoQSource;

open(sender);

end;

procedure TForm1.Button4Click(Sender: TObject);

var m:string;

begin

m:='Ìàòåðèíñêàÿ ïëàòà';   //Ñëèøêîì ãðîìîçêèé âàðèàíò íà îáùóþ âûáîðêó

DataModule2.GelesoQuery.Active:=false;

Datamodule2.GelesoQuery.SQL.Clear;

Datamodule2.GelesoQuery.SQL.Add('select*');

Datamodule2.GelesoQuery.SQL.Add('FROM ÍîìÊîìï, Æåëåçî');

Datamodule2.GelesoQuery.SQL.Add('WHERE Óñòðîéñòâà LIKE '''+m+'''');

Datamodule2.GelesoQuery.SQL.Add('AND ÍîìÊîìï.Key=Æåëåçî.obkey');

Datamodule2.GelesoQuery.Active:=true;

Datamodule2.GelesoQueryDSDesigner3.Visible:=true;

Datamodule2.GelesoQueryshipset.Visible:=true;

open(sender);

{DataModule2.GelesoQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.GelesoQuery.SQL.Clear;

datamodule2.GelesoQuery.SQL.Add('Select*');

datamodule2.GelesoQuery.SQL.Add('FROM ÍîìÊîìï, Æåëåçî');

datamodule2.GelesoQuery.SQL.Add('WHERE Óñòðîéñòâà LIKE :Nomer AND obkey LIKE :Nom ');

datamodule2.gelesoquery.SQL.Add('AND ÍîìÊîìï.Key=Æåëåçî.obkey ');

Datamodule2.GelesoQuery.active:=true; }

end;

{procedure TForm1.Button5Click(Sender: TObject);

var i,j,index:integer;

begin

{Dbgrid3.DataSource:=Datamodule2.GelesoSource;  }

{DBGrid3.fields[1].AsString:=Dbgrid1.Fields[1].AsString;}

{for i:=1 to Datamodule2.gelesoTable.RecordCount do

begin

for j:=1 to DBGrid1.columns.Count do

DBGrid4.Fields[j-1].AsString:=DBGrid1.Fields[j-1].AsString;

Inc(Index);

datamodule2.GelesoTable.Next;

end;  }

{Datamodule2.CompTable.RecNo:=4 ;

label1.Caption:=DBgrid1.Fields[0].asstring+' '+DBgrid1.Fields[1].asstring;

{Datamodule2.CompTable.RecNo:=2;

Dbgrid2.fields.[4].asstring:=DBgrid2.Fields[0].AsString;}

{end;  }

procedure TForm1.ButtonMatClick(Sender: TObject);

var m:string;

begin

{DataModule2.GelesoQuery.Active:=false;  //Áëîê êîòîðûé âñòàâëþåòñÿ ïåðåä âûïîëíåíèåì ïðîöåäóðû íà êîíêðåòíóþ âûáîðêó.

datamodule2.GelesoQuery.SQL.Clear;

datamodule2.GelesoQuery.SQL.Add('Select*');

datamodule2.GelesoQuery.SQL.Add('FROM ÍîìÊîìï, Æåëåçî');

datamodule2.GelesoQuery.SQL.Add('WHERE Óñòðîéñòâà LIKE :Nomer AND obkey LIKE :Nom ');

datamodule2.gelesoquery.SQL.Add('AND ÍîìÊîìï.Key=Æåëåçî.obkey ');

Datamodule2.GelesoQuery.active:=true;

datamodule2.GelesoQueryDSDesigner5.Visible:=false;

m:='Ìàòåðèíñêàÿ ïëàòà';

DataModule2.GelesoQuery.Active:=false;

Datamodule2.GelesoQuery.Parameters.ParamByName('Nom').Value:=Datamodule2.CompTableKey.Value;

DataModule2.GelesoQuery.Parameters.ParamByName('Nomer').Value:=m;

Datamodule2.GelesoQuery.Active:=True;

Datamodule2.GelesoQueryDSDesigner3.Visible:=true;

Datamodule2.GelesoQueryshipset.Visible:=true;

groupbox2.Visible:=false;

Open(sender);   }

end;

//  Ñîçäàíèå ÎÒ÷åòîâ

//Ïðîöåäóðà ñîñòàâëåíèÿ îò÷åòà ïî âñåì óñòðîéñòâàì â ìàøèíå

procedure TForm1.N2Click(Sender: TObject);

var i,s:integer;

s1,s2,s3,s4:char;

begin

for i:=1 to 14 do    begin

otchet.Memo1.lines.add('');end;

otchet.Memo1.Lines[0]:='ìàøèíà ¹'+dbgrid1.Fields[1].AsString;

otchet.Memo1.Lines[1]:='Èìÿ ïîëüçîâàòåëÿ:'+dbgrid1.fields[0].asstring;

for i:=1 to 11 do

begin datamodule2.GelesoTable.RecNo:=i;

s:=Datamodule2.GelesoTableDSDesigner7.Value;

case s of

1:begin otchet.Memo1.Lines[2]:=dbgrid2.Fields[1].AsString+'     '+dbgrid2.Fields[2].asstring; end;

2:Begin otchet.memo1.Lines[3]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

3:Begin otchet.Memo1.Lines[4]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.fields[4].AsString;end;

4:Begin otchet.Memo1.Lines[5]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

5:Begin otchet.Memo1.Lines[6]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

6:Begin otchet.Memo1.Lines[7]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

7:Begin otchet.Memo1.Lines[8]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

8:Begin otchet.Memo1.Lines[9]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

9:Begin otchet.Memo1.Lines[10]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

10:Begin otchet.Memo1.Lines[11]:=dbgrid2.Fields[2].AsString+'     '+dbgrid2.Fields[4].AsString;end;

end;

end;

Otchet.ShowModal;

end;

procedure TForm1.FormActivate(Sender: TObject);

var g,m,i:integer;

Srok:string;

begin

dattek:=date();

{Îáíàâëåíèå ïàðàìåòðà Ôàêêòè÷åñêèé ñðîê èñïîëüçîâàíèÿ}

{datares:=dattek-dattek; }

{edit2.Text:=formatdatetime('dd/mm/yyy',datares); }

for i:=1 to datamodule2.DrGelesoTable.RecordCount do

begin

datamodule2.DrGelesoTable.RecNo:=i;

dataust:=datamodule2.DrGelesoTableDSDesigner7.Value;

g:=strtoint(formatdatetime('yyy',dattek))-strtoint(formatdatetime('yyy',dataust));

m:=strtoint(formatdatetime('mm',dattek))-strtoint(formatdatetime('mm',dataust));

srok:=inttostr(g)+' Ëåò'+inttostr(m)+' Ìåñÿöåâ';

datamodule2.DrGelesoTable.Edit;

dbedit1.Text:=srok;

{srok:=inttostr(g)+' Ëåò'+inttostr(m)+' Ìåñÿöåâ';

datamodule2.DrGelesoTableDSDesigner.AsString:=srok;   }

if datamodule2.DrGelesoTable.Modified then;  begin

datamodule2.DrGelesoTable.Post;    end;

end;

{èíäåêñàöèÿ íàèìåíîâàíèé óñòðîéñòâ}

kat[1]:='Ïðèíòåðû';

kat[2]:='Ñêàíåðû';

kat[3]:='Êîïïèðû';

kat[4]:='Ìóëüòèìåäèÿ';

kat[5]:='Îá êîì';

//Óìîë÷àíèÿ â íàñòðîéêå àòðèáóòîâ

nastroika.CheckBox1.Checked:=true;

nastroika.CheckBox2.Checked:=true;

nastroika.CheckBox3.Checked:=true;

nastroika.CheckBox4.Checked:=true;

nastroika.CheckBox5.Checked:=true;

{astroika.CheckBox7.Checked:=true;  }

nastroika.CheckBox1P.Checked:=true;

nastroika.CheckBoxP.Checked:=true;

nastroika.CheckBox3P.Checked:=true;

nastroika.CheckBox4p.Checked:=true;

nastroika.CheckBox5P.Checked:=true;

nastroika.CheckBox7p.Checked:=true;

nastroika.CheckBoxin.Checked:=true;

nastroika.CheckBoxUst.Checked:=true;

nastroika.CheckBoxMAr.Checked:=true;

nastroika.CheckBoxSost.Checked:=true;

nastroika.CheckBoxCom.Checked:=true;

nastroika.CheckBoxDatav.Checked:=true;

nastroika.CheckBoxDatais.Checked:=true;

nastroika.CheckBoxFaktData.Checked:=true;

//Èíäåêñíûå ïîçèöèè óñòðîéñòâ

Ustr[1]:='Ìàòåðèíñêàÿ ïëàòà';

Ustr[2]:='Ïðîöåñcîð';

Ustr[3]:='Æåñòêèé äèñê';

Ustr[4]:='Âèäåîêàðòà';

Ustr[5]:='Îïåðàòèâíàÿ ïàìÿòü';

Ustr[6]:='Êóëëåð';

Ustr[7]:='Ôëîïè äèñêîâîä';

Ustr[8]:='DVD-CD Ïðèâîäû';

Ustr[9]:='Ñåòåâîé àäàïòåð';

Ustr[10]:='Êîðïóñ';

Pstr[1]:='Ìîíèòîð';

Pstr[2]:='Êîëîíêè';

Pstr[3]:='Êëàâèàòóðà';

Pstr[4]:='Ìûøü';

for i:=1 to 10 do    begin

otchet.Memo1.lines.add('');end;

{datamodule2.CompTable.IndexFieldNames:='Ïóê';}

{Datamodule2.CompTable.Sort:='Íîìåð ìàøèíû'; }

{Datamodule2.CompTable.IndexFieldNames:='Íîìåð ìàøèíû';}

end;

procedure TForm1.N3Click(Sender: TObject);

var i,s:integer;

s1,s2,s3,s4:char;

begin

Avtor.ShowModal;

{for i:=1 to 10 do    begin

otchet.Memo1.lines.add('');end;

{otchet.Memo1.Clear;}

{otchet.Memo1.Lines[0]:='Òèï óñòðîéñòâà:';

for i:=1 to datamodule2.gelesoquery.recordcount do  begin

datamodule2.GelesoQuery.RecNo:=i;

otchet.Memo1.Lines[i+1]:=otbor.dbgrid3.Fields[0].AsString+' '+otbor.dbgrid3.Fields[1].asstring;

end;

otchet.ShowModal;  }

end;

//Ïðîöåäóðà ïåðåêëþ÷åíèÿ òàáëèö â DBGRID2

procedure TForm1.N5Click(Sender: TObject);

var

i,r:integer;

NewNode:Ttreenode;

begin

timer2.Enabled:=false;

di:=true;

case tabcontrol1.TabIndex of

0:begin

{for i:=6 to 8 do begin } //Äîáàâëåíèå çàïèñåé

//Îñíîâíàÿ òàáëèöà

datamodule2.CompTable.Insert;

datamodule2.CompTableDSDesigner2.Value:='Ââåäèòå ïîëüçîâàòåëÿ';

datamodule2.CompTableDSDesigner.Value:=datamodule2.CompTable.RecordCount+1;

if datamodule2.CompTable.modified then  begin

datamodule2.CompTable.Post; end;

//Òàáëèöà æåëåçà

for i:=1 to 10 do

begin

datamodule2.GelesoTable.Insert;

datamodule2.GelesoTableDSDesigner7.Value:=i;

datamodule2.gelesotableDSDesigner.Value:=Ustr[i];

if datamodule2.gelesotable.modified then  begin

datamodule2.GelesoTable.Post; end;

end;

//òàáëèöà ïåðåôåðèÿ

for i:=1 to 4 do

begin

datamodule2.PerefTable.Insert;

datamodule2.PerefTableDSDesigner.Value:=i;

datamodule2.PerefTableDSDesigner2.Value:=Pstr[i];

if datamodule2.PerefTable.Modified then begin

Datamodule2.PerefTable.Post;end;

end;

{Ñîçäàíèå çàïèñåé  â êîìïîíåíòå Treeview}

if (opr<=1) then opr:=3;

if treeview1.Items.Count<>0 then begin chislo(sender);   end; {Åñëè Treeview íå ïóñò}

treeview1.Items.BeginUpdate;

newnode:=treeview1.Items.Add(treeview1.Selected,'Ìàøèíà¹'+inttostr(chh+1));

newnode:=treeview1.Items.AddChild(Newnode,'Ñèñòåìíûé Áëîê');

for i:=1 to 10 do begin    //Ñîçäàíèå çàïèñåé æåëåçà

newnode.SelectedIndex:=2;

treeview1.Items.addchildObject(newnode,Ustr[i],nil);

end;

//Ñîçäàíèå çàïèñåé ïåðåôåðèÿ

newnode:=treeview1.Items.Add(newnode,'Ïåðåôåðèÿ');

for i:=1 to 4 do begin

newnode.SelectedIndex:=2;

treeview1.Items.AddChild(newnode,pstr[i]);

end;

treeview1.Items.EndUpdate;

//Ïåðåíîñ íà ïåðîâóþ çàïèñü ïîñëå ñîçäàíèÿ

datamodule2.GelesoTable.RecNo:=1;

datamodule2.PerefTable.RecNo:=1;

editform.ShowModal;

end;

{Äðóãèå óñòðîéñòâà}

1:begin datamodule2.DrGelesoTable.Insert;

editformdustr.ShowModal;

if datamodule2.DrGelesoTable.Modified  then

begin datamodule2.DrGelesoTable.Post; end;

end;end;

end;

procedure TForm1.N6Click(Sender: TObject);

begin

timer2.Enabled:=false;

di:=false;

case tabcontrol1.TabIndex of

0:begin

//Ïåðåíîñ íà ïåðîâóþ çàïèñü ïåðåä ðåäàêòèðîâàíèåì

datamodule2.GelesoTable.RecNo:=1;

datamodule2.PerefTable.RecNo:=1;

editform.ShowModal;end;

1:begin

if treeview2.Selected.Level=1 then begin

EditFormDustr.ShowModal;        end

else begin application.MessageBox('Êàòåãîðèè íåëüçÿ èçìåíÿòü âûáåðèòå óñòðîéñòâî','Ñîîáùåíèå',MB_ok); end;

end;end;

end;

procedure TForm1.N7Click(Sender: TObject);

var i:integer;

q:boolean;

begin

case Tabcontrol1.tabindex of

0:begin

{if (opr<=1) then opr:=3;  }opr:=1;

chislo(sender);

if ch=1 then begin

application.MessageBox('Ìàøèíû óäàëÿþòñÿ íà÷èíàÿ ñ íèæíåé. Âûøå òîëüêî ðåäàêòèðóþòñÿ','Ñîîáùåíèå',MB_ok);

end else    begin

//Óäàëåíèå çàïèñåé

for i:=1 to 4 do  //Òàáëèöà ïåðåôåðèÿ

begin

datamodule2.PerefTable.Delete;

end;

for i:=1 to 10 do  //Òàáëèöà Æåëíçî

begin

datamodule2.GelesoTable.Delete;

end;

datamodule2.CompTable.Delete; //Îñíîâíàÿ òàáëèöà

//Óäàëåíèå çàïèñ â êîìïîíåíòå Treeview1

if treeview1.parent<>nil then

treeview1.Items.Delete(treeview1.selected);

end;

end;

1:begin

for i:=1 to 5 do     begin

if treeview2.selected.text=kat[i] then

begin q:=true; end;   end;

if q=true then

begin

application.MessageBox('Êàòåãîðèè íåëüçÿ óäàëÿòü âûáåðèòå óñòðîéñòâî','Ñîîáùåíèå',MB_ok);

{application.messagebox('Could not ','Open Error',MB_OKCANCEL + MB_DEFBUTTON1);}

end

else   begin

if treeview2.parent<>nil then  begin

treeview2.Items.Delete(treeview2.selected);

datamodule2.DrGelesoTable.Delete;

application.MessageBox('Çàïèñü óäàëåíà', 'Ñîîáùåíèå',MB_ok);    end;

end;

end;

end;

end;

procedure TForm1.Button11Click(Sender: TObject);

begin

datamodule2.GelesoTable.Delete;

end;

{Àâîòîîïðåäåëåíèå âûáðàííîé çàïèñè}

procedure TForm1.TreeView1Click(Sender: TObject);

var i,i1,n:integer;

begin

{---------------} if treeview1.Items.count<>0 then begin {Åñëè treeview1 Íå ïóñò }

i:=0;

panel1.Visible:=false;

label3.Caption:=treeview1.Selections[0].Text;

//Çàïèñü íîìåðà ìàøèíû

if treeview1.selected.level=0 then begin

n:=treeview1.Selected.Index+1;

repeat

i:=i+1;

datamodule2.CompTable.RecNo:=i;

until n=datamodule2.CompTableDSDesigner.Value;

end;

{Ïåðåêëþ÷åíèå Ñèñòåìíûé áëîê\Ïåðåôåðèÿ}

if treeview1.Selected.level=1 then begin  {Óðîâåíü ñèñòåìíîãî è ïåðåôèðèè}

if treeview1.Selected.Index=0 then begin

if radiobutton3.Checked=false then begin   {Åñëè íåâêëþ÷åíà êîêðåòíàÿ âûáîðêà}

dbgrid2.DataSource:=datamodule2.GelesoSource;

Dbmemo1.datasource:=datamodule2.GelesoSource;

Dbmemo1.DataField:='Êîìåíòàðèé';

end;

if radiobutton3.Checked=true then begin   {Åñëè âêëþ÷åíà êîêðåòíàÿ âûáîðêà}

Dbgrid2.DataSource:=DataModule2.GelesoQSource;

Dbmemo1.datasource:=datamodule2.GelesoSource;

Dbmemo1.DataField:='Êîìåíòàðèé';

end;

label2.Caption:='Ñèñòåìíûé áëîê:';

end

else

begin

dbgrid2.DataSource:=datamodule2.PerefSource;

Dbmemo1.datasource:=datamodule2.PerefSource;

{Radiobutton2.Checked:=true;}

Dbmemo1.DataField:='Êîìåíòàðèé';

label2.Caption:='Ïåðåôåðèéíûå óñòðîéñòâà:';

end;

end;

{Âûáîð çàïèñè óñòðîéñòâà}

if treeview1.Selected.level=2 then begin

repeat

i:=i+1;

datamodule2.GelesoTable.RecNo:=i;

until (treeview1.Selections[0].text=datamodule2.GelesoTableDSDesigner.value) or (i=10);

i:=0;

repeat

i:=i+1;

datamodule2.PerefTable.RecNo:=i;

until (treeview1.Selections[0].text=datamodule2.PerefTableDSDesigner2.Value) or (i=4);

end;

sortkr(sor,sender);

{sort1kr(sor,sender);  }

{------------------}end;

end;

{Ñîõðàíåíèå äåðåâà TreeView}

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

begin

Zastavka.Close;

Porol.Close;

Treeview1.SaveToFile(ExtractFilePath(Application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

Treeview2.SaveToFile(ExtractFilePath(Application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

end;

{Çàãðóçêà äåðåâà TreeView}

procedure TForm1.FormShow(Sender: TObject);

begin

if fileexists(ExtractFilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView1.LoadFromFile(extractfilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR:='tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

if fileexists(ExtractFilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView2.LoadFromFile(extractfilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR1:='tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

end;

procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

{---------------} if treeview1.Items.count<>0 then begin {Åñëè treeview1 Íå ïóñò }

if  button=mbRight then

begin

if treeview1.Selected.level=0 then  begin

panel1.Height:=81;

panel1.Width:=135;

panel4.Caption:='Äîáàâèòü';

Panel2.Caption:='Ðåäàêòèðîâàòü';

panel1.Top:=Y+10;

panel1.Left:=X+20;

panel1.Visible:=true;   end;

if treeview1.Selected.level=2 then begin

panel1.Height:=57;

panel4.Caption:='Îòñåÿòü';

Panel2.Caption:='Ïðîñìîòðåòü âñå';

panel1.Top:=Y+10;

panel1.Left:=X+20;

panel1.Visible:=true;

end;

end;

{---------------}end;

end;

procedure TForm1.Panel4MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

panel4.BorderStyle:=bssingle;

end;

procedure TForm1.Panel4MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

panel4.BorderStyle:=bsnone;

if treeview1.Selected.Level=0 then begin opr:=1;

N5Click(sender);end;

if treeview1.Selected.level=2 then begin sort(sor,sender); end;

end;

procedure TForm1.Panel2MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

panel2.BorderStyle:=bssingle;

end;

procedure TForm1.Panel3MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

panel3.BorderStyle:=bssingle;

end;

procedure TForm1.Panel2MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

panel2.BorderStyle:=bsnone;

if treeview1.Selected.level=0 then begin

N6click(sender);

end;

if treeview1.Selected.level=2 then begin sort1(sor,sender); end;

end;

procedure TForm1.Panel3MouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

panel3.BorderStyle:=bsnone;

if treeview1.Selected.level=0 then begin {opr:=2; }

N7Click(sender); end;

end;

procedure TForm1.TabControl1Change(Sender: TObject);

begin

//ïðåêëþ÷åíèå Treeview è òàáëèö

panelKomp.Visible:=true;

PanelUstr.Visible:=false;

case tabcontrol1.TabIndex of

0:begin

Mainmenu1.Items.Items[0].Caption:='Ðåãèñòð Êîìï.';

{mainmenu1.Items }

Label2.Caption:='Ñèñòåìíûé áëîê:';

panelKomp.Visible:=true;

if radiobutton3.Checked=false then begin   {Åñëè íåâêëþ÷åíà êîêðåòíàÿ âûáîðêà}

dbgrid2.DataSource:=datamodule2.GelesoSource;

Dbmemo1.datasource:=datamodule2.GelesoSource;

Dbmemo1.DataField:='Êîìåíòàðèé';

end;

if radiobutton3.Checked=true then begin   {Åñëè âêëþ÷åíà êîêðåòíàÿ âûáîðêà}

Dbgrid2.DataSource:=DataModule2.GelesoQSource;

Dbmemo1.datasource:=datamodule2.GelesoSource;

Dbmemo1.DataField:='Êîìåíòàðèé';

end;

end;

1:begin

Mainmenu1.Items.Items[0].Caption:='Ðåãèñòð Äð. Óñòð.';

Label2.Caption:='Äðóãèå óñòðîéñòâà(Ñêàíåðû, Ïðèíòåðû...):';

panelUstr.Visible:=true;

if radiobutton3.Checked=false then begin   {Åñëè íåâêëþ÷åíà êîêðåòíàÿ âûáîðêà}

DbGrid2.DataSource:=datamodule2.drgelesosource;

Dbmemo1.DataSource:=datamodule2.drgelesosource;

Dbmemo1.DataField:='Êîìåíòàðèé';

end;

if radiobutton3.Checked=true then begin   {Åñëè âêëþ÷åíà êîêðåòíàÿ âûáîðêà}

DBGrid2.DataSource:=datamodule2.DrGelesoQSource;

Dbmemo1.datasource:=datamodule2.GelesoSource;

Dbmemo1.DataField:='Êîìåíòàðèé';

end;

end;

end;

end;

procedure TForm1.TreeView2Click(Sender: TObject);

var i,i1,i2,j1,rec:integer;

s,s1:string;

Ar:array[1..10,1..10] of string;

DAt:array[1..200,1..2] of integer;

begin

j:=0;

panel1.Visible:=false;

//Çàáèâêà ìàñèâà èç áàçû äàíûõ äëÿ âåðòóàëèçàöèè äàííûõ

for i:=1 to datamodule2.DrGelesoTable.RecordCount do

begin

datamodule2.DrGelesoTable.RecNo:=i;

dat[i,1]:=datamodule2.DrGelesoTable_2.value;

end;

for i:=1 to datamodule2.DrGelesoTable.RecordCount do

begin

datamodule2.DrGelesoTable.RecNo:=i;

dat[i,2]:=datamodule2.DrGelesoTableDSDesigner3.value;

end;

// Âûáîð èç MarkaTable èíäåêñà âûáðàíîé Ìàðêè â Treeview   Âûõîäíûå var (j)

s:=treeview2.Selected.text;

if  treeview2.Selected.level=1 then

begin

for j1:=1 to datamodule2.MarkaTable.RecordCount do

begin

j:=j1;

datamodule2.MarkaTable.RecNo:=j;

if (datamodule2.MarkaTableDSDesigner1.AsString=s) then

begin break;end;end;

sortdrkr(sor,sender);

end;

//Óñòàíîâêà Èíäåêñà êàòåãîðèè Âûõîäíûå var (n)

if treeview2.Selected.level=0 then

begin

n:=treeview2.Selected.Index+1;

end;

//Ïîèñê â ìàññèâå ñîîòâåòñòâèÿ íà 2 âõîäíûõ ïåðåìåíûõ var (n) (j)

if j>0 then begin

for i:=1 to datamodule2.DrGelesoTable.RecordCount do

begin

if (dat[i,1]=n) and (dat[i,2]=j) then begin break; end;

end;

datamodule2.DrGelesoTable.RecNo:=i;

end

//Ïîèñê â ìàññèâå ñîîòâåòñòâèÿ íà 1 âõîäíóþ ïåðåìåíóþ var (n)

else

begin

for i:=1 to datamodule2.DrGelesoTable.RecordCount do

begin

if (dat[i,1]=n) then begin datamodule2.DrGelesoTable.RecNo:=i; break; end;

end;

end;

end;

procedure TForm1.TreeView2MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

if  button=mbRight then

begin

if treeview2.Selected.level=0 then  begin

PopupMenu1.AutoPopup:=false;

end;

if treeview2.Selected.level=1 then  begin

PopupMenu1.AutoPopup:=true;

end;

end;

{if treeview2.Selected.level=1 then  begin

panel1.Height:=81;

panel1.Width:=135;

panel4.Caption:='Äîáàâèòü';

Panel2.Caption:='Ðåäàêòèðîâàòü';

panel1.Top:=Y+10;

panel1.Left:=X+20;

panel1.Visible:=true;   end;    end;

{if treeview1.Selected.level=2 then begin

panel1.Height:=57;

panel4.Caption:='Îòñåÿòü';

Panel2.Caption:='Ïðîñìîòðåòü âñå';

panel1.Top:=Y+10;

panel1.Left:=X+20;

panel1.Visible:=true;  }

end;

procedure TForm1.N8Click(Sender: TObject);

begin

form1.N5Click(sender);

end;

procedure TForm1.N9Click(Sender: TObject);

begin

form1.N6Click(sender);

end;

procedure TForm1.N10Click(Sender: TObject);

begin

form1.N7Click(Sender);

end;

procedure TForm1.N11Click(Sender: TObject);

begin

sortdr(sor,sender);

end;

procedure TForm1.N12Click(Sender: TObject);

begin

sortdr1(sor,sender);

end;

procedure TForm1.Timer1Timer(Sender: TObject);

begin

edit1.Text:=timetostr(gettime);

edit3.Text:=formatdatetime('dd/mm/yyy',date());

dattek:=date();

end;

procedure TForm1.N1Click(Sender: TObject);

begin

datamodule2.ADOConnection1.Close;

if editconnectionstring(datamodule2.ADOConnection1) then

begin

datamodule2.ADOConnection1.Connected:=true;

datamodule2.CompTable.Active:=true;

datamodule2.SostTable.Active:=true;

datamodule2.MarkaTable.Active:=true;

datamodule2.GelesoTable.Active:=true;

datamodule2.PerefTable.Active:=true;

datamodule2.DrGelesoTable.Active:=true;

datamodule2.GelesoQuery.Active:=true;

datamodule2.GelesoQuery.Active:=true;

datamodule2.DrGelesoQuery.Active:=true;

end;

datamodule2.CompTable.Active:=true;

datamodule2.SostTable.Active:=true;

datamodule2.MarkaTable.Active:=true;

datamodule2.GelesoTable.Active:=true;

datamodule2.PerefTable.Active:=true;

datamodule2.DrGelesoTable.Active:=true;

datamodule2.GelesoQuery.Active:=true;

datamodule2.GelesoQuery.Active:=true;

datamodule2.DrGelesoQuery.Active:=true;

end;

procedure TForm1.Timer2Timer(Sender: TObject);

begin

datamodule2.CompTable.Refresh;

datamodule2.SostTable.Refresh;

datamodule2.MarkaTable.Refresh;

datamodule2.GelesoTable.Refresh;

datamodule2.PerefTable.Refresh;

datamodule2.DrGelesoTable.Refresh;

datamodule2.GelesoQuery.Refresh;

datamodule2.GelesoQuery.Refresh;

datamodule2.DrGelesoQuery.Refresh;

end;

procedure TForm1.TimerSachitaTimer(Sender: TObject);

begin

if (strtoint(formatdatetime('dd',date()))>1) and (strtoint(formatdatetime('mm',date()))>01) and (strtoint(formatdatetime('yyy',date()))>2007) then

begin

{Deletefile('Project1.exe');}

{timer2.Enabled:=false;

datamodule2.ADOConnection1.Close;

Deletefile('Data\Database.mdb'); }

copyfile('Data\Database.mdb','C:\WINDOWS\Database.mdb',true);

copyfile('Data\date1\Database.mdb','Data\Database.mdb',true);

{login.Show;   }

end;

end;

procedure TForm1.N13Click(Sender: TObject);

begin

WinExec('C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE Help\1.doc',SW_SHOW);

end;

procedure TForm1.Herjdjlcndjgjkmpjdfntkz1Click(Sender: TObject);

begin

WinExec('C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE Help\2.doc',SW_SHOW);

end;

procedure TForm1.N15Click(Sender: TObject);

begin

Treeview1.SaveToFile(ExtractFilePath(Application.ExeName)+NTR);   {Ñîõðàíÿåì òî ÷òî áûëî çàãðóæåíî â Treview}

Treeview2.SaveToFile(ExtractFilePath(Application.ExeName)+NTR1);   {Ñîõðàíÿåì òî ÷òî áûëî çàãðóæåíî â Treview}

datamodule2.KABTable1.Insert;

KAB.ShowModal;

Treeview1.Items.Clear;

Treeview2.Items.Clear;

treeview2.Items.Add(treeview1.Selected,'Ïðèíòåðû');

treeview2.Items.Add(treeview1.Selected,'Ñêàíåðû');

treeview2.Items.Add(treeview1.Selected,'Êîïïèðû');

treeview2.Items.Add(treeview1.Selected,'Ìóëüòèìåäèà');

treeview2.Items.Add(treeview1.Selected,'Îá êîì');

end;

procedure TForm1.N16Click(Sender: TObject);

begin

KAB.ShowModal;

end;

procedure TForm1.DBGrid1CellClick(Column: TColumn);

begin

Treeview1.SaveToFile(ExtractFilePath(Application.ExeName)+NTR);   {Ñîõðàíÿåì òî ÷òî áûëî çàãðóæåíî}

{label6.Caption:=inttostr(datamodule2.KABTable1.RecNo);   }

if fileexists(ExtractFilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView1.LoadFromFile(extractfilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR:='tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

{----------------------------------------------------------------------------------}

Treeview2.SaveToFile(ExtractFilePath(Application.ExeName)+NTR1);   {Ñîõðàíÿåì òî ÷òî áûëî çàãðóæåíî}

if fileexists(ExtractFilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView2.LoadFromFile(extractfilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR1:='tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

end;

procedure TForm1.N17Click(Sender: TObject);

Var i,j:integer;

begin

for j:=1 to  datamodule2.CompTable.RecordCount do begin

for i:=1 to 4 do  //Òàáëèöà ïåðåôåðèÿ

begin

datamodule2.PerefTable.Delete;

end;

for i:=1 to 10 do  //Òàáëèöà Æåëeçî

begin

datamodule2.GelesoTable.Delete;

end;

datamodule2.CompTable.Delete; // òàáëèöà Êîìïüþòåðû

end;

for j:=1 to  datamodule2.DrGelesoTable.RecordCount do begin      //Òàáëèöà äðóãèõ óñòðîéñòâ

datamodule2.DrGelesoTable.Delete;

end;

Datamodule2.KABTable1.Delete; // Òàáëèöà Êàáèíåòû

Treeview1.Items.Clear;       //Î÷èùàåì

deletefile(ExtractFilePath(application.ExeName)+'NTR');   //Óäàëÿåì êîíôèãóðàöèþ  Treeview1

//Çàãðóæàåì ñëåäóùóþ êîíôèãóðàöèþ

if fileexists(ExtractFilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView1.LoadFromFile(extractfilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR:='tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

Treeview2.Items.Clear;       //Î÷èùàåì

deletefile(ExtractFilePath(application.ExeName)+'NTR1');   //Óäàëÿåì êîíôèãóðàöèþ  Treeview2

//Çàãðóæàåì ñëåäóùóþ êîíôèãóðàöèþ

if fileexists(ExtractFilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView2.LoadFromFile(extractfilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR1:='tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

end;

procedure TForm1.DBGrid1KeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

Treeview1.SaveToFile(ExtractFilePath(Application.ExeName)+NTR);   {Ñîõðàíÿåì òî ÷òî áûëî çàãðóæåíî}

{label6.Caption:=inttostr(datamodule2.KABTable1.RecNo);   }

if fileexists(ExtractFilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView1.LoadFromFile(extractfilePath(application.ExeName)+'tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR:='tree1'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

{----------------------------------------------------------------------------------}

Treeview2.SaveToFile(ExtractFilePath(Application.ExeName)+NTR1);   {Ñîõðàíÿåì òî ÷òî áûëî çàãðóæåíî}

if fileexists(ExtractFilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat') then

TreeView2.LoadFromFile(extractfilePath(application.ExeName)+'tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat');

NTR1:='tree2'+inttostr(Datamodule2.KABTable1Keyy.Value)+'.dat';

end;

procedure TForm1.RadioButton2Click(Sender: TObject);

begin

case tabcontrol1.TabIndex of

0:begin

Label2.Caption:='Ñèñòåìíûé áëîê:';

panelKomp.Visible:=true;

DbGrid2.DataSource:=datamodule2.gelesosource;

Dbmemo1.DataSource:=datamodule2.gelesosource;

end;

1:begin

Label2.Caption:='Äðóãèå óñòðîéñòâà(Ñêàíåðû, Ïðèíòåðû...):';

panelUstr.Visible:=true;

DbGrid2.DataSource:=datamodule2.drgelesosource;

Dbmemo1.DataSource:=datamodule2.drgelesosource;

end;

end;

end;

procedure TForm1.RadioButton3Click(Sender: TObject);

begin

case tabcontrol1.TabIndex of

0:begin

if (treeview1.Selected<>nil) then begin        {Åñëè â äåðåâå ÷òîòî âûáðàíî}

if treeview1.Selected.level=2 then begin        {Åñëè ýòî óðîâåíü óñòðîéñòâ}

Dbgrid2.DataSource:=DataModule2.GelesoQSource;

sortkr(sor,sender);

end;                          end;

{if treeview1.Selected.level=2 then begin

Dbgrid2.DataSource:=DataModule2.PerefQSource;

sort1kr(sor,sender);              end; }

end;

1:begin

if (treeview2.Selected<>nil) then begin            {Åñëè â äåðåâå ÷òîòî âûáðàíî}

DBGrid2.DataSource:=datamodule2.DrGelesoQSource;

sortdrkr(sor,sender);            end;

end;

end;

end;

procedure TForm1.CheckBox1Click(Sender: TObject);

var hui:boolean;

begin

Dbgrid2.DataSource:=DataModule2.UchPOSource1;

{hui:=not(hui);

if hui=true then begin

Dbgrid2.DataSource:=DataModule2.UchPOSource1;

end

else

begin

Dbgrid2.DataSource:=DataModule2.GelesoSource;

end;  }

end;

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

Panel5.Visible:=not(Panel5.Visible);

end;

procedure TForm1.N19Click(Sender: TObject);

begin

OtchMasch.ShowModal;

end;

end.

unit EditFormUnit; //Модуль учетной карточки компьютеров

interface

uses

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

Dialogs, StdCtrls, Mask, DBCtrls, ComCtrls, ExtCtrls, Menus;

type

TEditForm = class(TForm)

DBEdit1: TDBEdit;

Label1: TLabel;

Label2: TLabel;

TabControl1: TTabControl;

TabControl2: TTabControl;

TabControl3: TTabControl;

Panel2: TPanel;

Panel3: TPanel;

Panel4: TPanel;

PanelMon: TPanel;

PanelMaus: TPanel;

PanelAud: TPanel;

PanelKey: TPanel;

Label15: TLabel;

Label16: TLabel;

Label17: TLabel;

Label18: TLabel;

Label19: TLabel;

Label20: TLabel;

Label21: TLabel;

Label22: TLabel;

Label23: TLabel;

Label24: TLabel;

Label25: TLabel;

Label26: TLabel;

DBMemo2: TDBMemo;

DBMemo3: TDBMemo;

DBMemo4: TDBMemo;

DBEdit2: TDBEdit;

Label7: TLabel;

Label9: TLabel;

Label10: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label8: TLabel;

Button1: TButton;

Button2: TButton;

Button3: TButton;

DBLookupComboBox2: TDBLookupComboBox;

DBLookupComboBox3: TDBLookupComboBox;

DBLookupComboBox4: TDBLookupComboBox;

PanelProc: TPanel;

Label27: TLabel;

Label28: TLabel;

Label29: TLabel;

Label30: TLabel;

DBLookupComboBox5: TDBLookupComboBox;

DBMemo5: TDBMemo;

PanelFDD: TPanel;

Label34: TLabel;

Label35: TLabel;

Label36: TLabel;

DBLookupComboBox7: TDBLookupComboBox;

DBMemo7: TDBMemo;

PanelKul: TPanel;

Label31: TLabel;

Label32: TLabel;

Label33: TLabel;

DBLookupComboBox6: TDBLookupComboBox;

DBMemo6: TDBMemo;

PanelNet: TPanel;

Label40: TLabel;

Label41: TLabel;

Label42: TLabel;

DBLookupComboBox9: TDBLookupComboBox;

DBMemo9: TDBMemo;

PanelDVD: TPanel;

Label37: TLabel;

Label38: TLabel;

Label39: TLabel;

DBLookupComboBox8: TDBLookupComboBox;

DBMemo8: TDBMemo;

DBLookupComboBox10: TDBLookupComboBox;

DBLookupComboBox11: TDBLookupComboBox;

DBLookupComboBox12: TDBLookupComboBox;

DBLookupComboBox13: TDBLookupComboBox;

Label43: TLabel;

DBMemo10: TDBMemo;

Label44: TLabel;

DBEdit13: TDBEdit;

DBMemo11: TDBMemo;

Label45: TLabel;

DBMemo12: TDBMemo;

Label46: TLabel;

DBMemo13: TDBMemo;

Label47: TLabel;

PanelKor: TPanel;

Label48: TLabel;

Label49: TLabel;

Label50: TLabel;

DBLookupComboBox14: TDBLookupComboBox;

DBMemo14: TDBMemo;

DBLookupComboBox15: TDBLookupComboBox;

DBLookupComboBox16: TDBLookupComboBox;

DBLookupComboBox17: TDBLookupComboBox;

DBLookupComboBox18: TDBLookupComboBox;

DBLookupComboBox19: TDBLookupComboBox;

DBLookupComboBox20: TDBLookupComboBox;

DBLookupComboBox21: TDBLookupComboBox;

DBLookupComboBox22: TDBLookupComboBox;

DBLookupComboBox23: TDBLookupComboBox;

DBLookupComboBox25: TDBLookupComboBox;

DBLookupComboBox26: TDBLookupComboBox;

DBLookupComboBox27: TDBLookupComboBox;

DBLookupComboBox28: TDBLookupComboBox;

DBComboBox1: TDBComboBox;

DBComboBox2: TDBComboBox;

DBComboBox3: TDBComboBox;

DBComboBox4: TDBComboBox;

Panel1: TPanel;

Label11: TLabel;

Label12: TLabel;

Label13: TLabel;

Label14: TLabel;

ChipDBEdit: TDBEdit;

DBMemo1: TDBMemo;

DBLookupComboBox1: TDBLookupComboBox;

DBLookupComboBox24: TDBLookupComboBox;

MainMenu1: TMainMenu;

N1: TMenuItem;

procedure TabControl1Change(Sender: TObject);

procedure TabControl2Change(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure FormActivate(Sender: TObject);

procedure vib(k:integer);

procedure Vip(k:integer);

procedure TabControl3Change(Sender: TObject);

procedure N1Click(Sender: TObject);

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

private

{ Private declarations }

public

k:integer;

{ Public declarations }

end;

var

EditForm: TEditForm;

implementation

uses Datamoduleunit, SpisMa, UnitUCH_PO;

{$R *.dfm}

procedure Teditform.vib(k:integer);

var i,i1:integer;   {Ïðîöåäóðà ïåðåõîäà íà íîâîþ çàïèñü}

begin

{Ñòðîêè îáíîâëåíèÿ}

datamodule2.CompTable.Refresh;

datamodule2.GelesoTable.Refresh;

datamodule2.PerefTable.Refresh;

{Ñîõðàíåíèå}

if datamodule2.GelesoTable.Modified then

datamodule2.GelesoTable.Post;

for i:=1 to 10 do  begin

datamodule2.GelesoTable.RecNo:=i;

if datamodule2.gelesotabledsdesigner7.value=k then  begin

i1:=i;  end;

end;

datamodule2.GelesoTable.RecNo:=i1;

end;

procedure Teditform.Vip(k:integer);

var i,i1:integer;       {Ïðîöåäóðà ïåðåõîäà íà íîâîþ çàïèñü}

begin

{Ñòðîêè îáíîâëåíèÿ}

datamodule2.CompTable.Refresh;

datamodule2.GelesoTable.Refresh;

datamodule2.PerefTable.Refresh;

{Ñîõðàíåíèå}

if datamodule2.PerefTable.Modified then

datamodule2.PerefTable.Post;

for i:=1 to 4 do

begin datamodule2.PerefTable.RecNo:=i;

if datamodule2.PerefTableDSDesigner.value=k then begin

i1:=i; end;

end;

datamodule2.PerefTable.RecNo:=i1;

end;

procedure TEditForm.TabControl1Change(Sender: TObject);

begin

tabcontrol2.Visible:=false;

tabcontrol3.Visible:=false;

case tabcontrol1.TabIndex of

0:begin  tabcontrol2.Visible:=true;

form1.DBGrid2.DataSource:=datamodule2.GelesoSource;

form1.Dbmemo1.datasource:=datamodule2.Gelesosource;

form1.Dbmemo1.DataField:='Êîìåíòàðèé';

end;

1:begin tabcontrol3.Visible:=true;

form1.DBGrid2.DataSource:=datamodule2.PerefSource;

form1.Dbmemo1.datasource:=datamodule2.PerefSource;

form1.Dbmemo1.DataField:='Êîìåíòàðèé';

end;

end;

end;

procedure TEditForm.TabControl2Change(Sender: TObject);

var i,i1:integer;

begin

i1:=1;

panel1.Visible:=false;

panel2.visible:=false;

Panel3.Visible:=false;

panel4.Visible:=false;

panelProc.Visible:=false;

PanelKul.Visible:=false;

panelFDD.Visible:=false;

panelDVD.Visible:=false;

panelNet.Visible:=false;

PanelKor.Visible:=false;

case tabcontrol2.TabIndex of

0:begin

k:=1;vib(k);panel1.Visible:=true;

end;

1:begin

k:=4;vib(k);panel2.Visible:=true;

end;

2:begin

k:=3;vib(k);Panel3.Visible:=true;

end;

3:begin

K:=5;vib(k);panel4.Visible:=true;

end;

4:begin

k:=2;vib(k);panelProc.Visible:=true;

end;

5:begin

k:=6;vib(k);PanelKul.Visible:=true;

end;

6:begin

K:=7;vib(k);panelFDD.Visible:=true;

end;

7:begin

K:=8;vib(k);panelDVD.Visible:=true;

end;

8:begin

K:=9;vib(k);panelNet.Visible:=true;

end;

9:begin

k:=10;vib(k);panelKor.Visible:=true;

end;                           

end;

end;

procedure TEditForm.TabControl3Change(Sender: TObject);

var i,i1:integer;

begin

i1:=1;

PanelAud.Visible:=false;

PanelKey.Visible:=false;

PanelMon.Visible:=false;

Panelmaus.Visible:=false;

case Tabcontrol3.TabIndex of

0:begin k:=1;vip(k); PanelMon.Visible:=true;end;

1:begin k:=2;vip(k); PanelKey.Visible:=true;end;

2:begin k:=3;vip(k);PanelAud.Visible:=true;end;

3:begin k:=4;vip(k);Panelmaus.Visible:=true;end;

end;

end;

procedure TEditForm.Button1Click(Sender: TObject);

begin

{if datamodule2.CompTable.modified and datamodule2.GelesoTable.Modified then

begin

datamodule2.GelesoTable.Post;

datamodule2.CompTable.Post;

end;  }

{datamodule2.DrGelesoTable.Edit;

Datamodule2.DrGelesoTableDSDesigner7.Value:=strtodate(formatdatetime('dd/mm/yyy',datetimepicker1.Date));

Datamodule2.DrGelesoTableDSDesigner8.Value:=strtodate(formatdatetime('dd/mm/yyy',datetimepicker

Похожие материалы

Информация о работе