. , , ,

,,,

Delphi 2.0 — ,

unit redakt;

interface

uses

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

ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Mask, Buttons, DBCGrids;

type

TForm2 = class(TForm)

Panel1: TPanel;

Button3: TButton;

Button4: TButton;

Button6: TButton;

Button7: TButton;

Button5: TButton;

Button8: TButton;

Button9: TButton;

Button10: TButton;

RadioGroup1: TRadioGroup;

CheckBox1: TCheckBox;

BitBtn1: TBitBtn;

Edit1: TEdit;

RadioGroup2: TRadioGroup;

CheckBox3: TCheckBox;

DBGrid1: TDBGrid;

DBEdit1: TDBEdit;

Label1: TLabel;

CheckBox2: TCheckBox;

Edit2: TEdit;

BitBtn2: TBitBtn;

Label2: TLabel;

procedure ComboBox1Change(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure Button9Click(Sender: TObject);

procedure Button10Click(Sender: TObject);

procedure RadioGroup1Click(Sender: TObject);

procedure CheckBox1Click(Sender: TObject);

procedure DBEdit1Change(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure Edit1Change(Sender: TObject);

procedure CheckBox3Click(Sender: TObject);

procedure RadioGroup2Click(Sender: TObject);

procedure DBEdit1Click(Sender: TObject);

procedure CheckBox2Click(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure SpeedButton3Click(Sender: TObject);

procedure SpeedButton4Click(Sender: TObject);

procedure Edit2Change(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

{ procedure FormCreate(Sender: TObject);}

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

implementation

uses data, Enter, categor, Vopros2;

{$R *.DFM}

procedure TForm2.ComboBox1Change(Sender: TObject);

begin

{Form2.ComboBox1:=}

end;

procedure TForm2.Button3Click(Sender: TObject);

begin

DM.Table4.First;

Form2.DBGrid1.SetFocus;

end;

procedure TForm2.Button4Click(Sender: TObject);

begin

DM.Table4.Next;

Form2.DBGrid1.SetFocus;

end;

procedure TForm2.Button6Click(Sender: TObject);

begin

DM.Table4.Prior;

Form2.DBGrid1.SetFocus;

end;

procedure TForm2.Button5Click(Sender: TObject);

begin

DM.Table4.Last;

Form2.DBGrid1.SetFocus;

end;

procedure TForm2.Button7Click(Sender: TObject);

begin

DM.Table4.Edit;

Form2.DBGrid1.SetFocus;

end;

procedure TForm2.Button8Click(Sender: TObject);

begin

DM.Table4.Insert;

Form2.DBGrid1.SetFocus;

end;

procedure TForm2.Button9Click(Sender: TObject);

begin

DM.Table4.Edit ;

DM.Table4.Post;

DM.Table1.Refresh;

DM.Table2.Refresh;

DM.Table3.Refresh;

DM.Table4.Refresh;

Form2.DBGrid1.Setfocus;

end;

procedure TForm2.Button10Click(Sender: TObject);

begin

if not DM.Table4.EOF then

begin

with DM.Table4 do

begin

DisableControls;

Delete;

{ MessageDlg('╙ ■ ?',mtCustom,(mbYes),(mbNo));}

EnableControls;

Form2.DbGrid1.SetFocus;

end;

end;

end;

procedure TForm2.RadioGroup1Click(Sender: TObject);

var Pole:shortstring;

begin

Case Form2.RadioGroup1.ItemIndex of

0: Pole:='';

1:Pole:='-';

2:Pole:='';

3:Pole:='';

4:Pole:='╩ ';

end;

if Form2.RadioGroup1.ItemIndex=0 then

DM.Table4.IndexFieldNames:='Categorija';

if Form2.RadioGroup1.ItemIndex=1 then

DM.Table4.IndexFieldNames:='Firma';

if Form2.RadioGroup1.ItemIndex=2 then

DM.Table4.IndexFieldNames:='Model';

if Form2.RadioGroup1.ItemIndex=3 then

DM.Table4.IndexFieldNames:='CENAD';

if Form2.RadioGroup1.ItemIndex=4 then

DM.Table4.IndexFieldNames:='SKLAD';

DM.Table4.Refresh;

DM.Table4.Close;

DM.Table4.Open;

Form2.DbGrid1.SetFocus;

end;

procedure TForm2.CheckBox1Click(Sender: TObject);

begin

if Form2.CheckBox1.Checked then

begin

Form2.RadioGroup1.Visible:=True;

Form2.RadioGroup1.ItemIndex:=0;

end

else

begin

DM.Table4.IndexFieldNames:='';

Form2.RadioGroup1.Visible:=False;

end;

end;

procedure TForm2.DBEdit1Change(Sender: TObject);

begin

Form3.Button6.Visible:=True;

Form3.Show;

Form3.Dbgrid1.SetFocus;

end;

procedure TForm2.BitBtn1Click(Sender: TObject);

begin

Form10.ShowModal;

end;

procedure TForm2.Edit1Change(Sender: TObject);

var Pole:ShortString;sd:real;

begin

if Edit1.Modified then

begin

CASE RadioGroup2.ItemIndex OF

0:

begin

DM.Table4.IndexFieldNames := 'CATEGORIJA';

DM.Table4CATEGORIJA.Index := 0;

Pole:='CATEGORIJA';

end;

1:

begin

DM.Table4.IndexFieldNames := 'FIRMA';

DM.Table4FIRMA.Index := 0;

Pole:='FIRMA';

end;

2:

begin

DM.Table4.IndexFieldNames := 'MODEL';

DM.Table4MODEL.Index := 0;

Pole:='MODEL';

end;

3:

begin

DM.Table4.IndexFieldNames := 'CENAD';

DM.Table4CENAR.Index := 0;

Pole:='CENAD'

end;

4:

begin

DM.Table4.IndexFieldNames := 'SKLAD';

DM.Table4SKLAD.Index := 0;

Pole:='SKLAD';

end;

end;

{ DM.Table4.FindNearest([Edit1.Text]);}

if RadioGroup2.ItemIndex<=2 then

DM.Table4.FindNearest([Edit1.text])

else

if Edit1.text <> '' then

begin

try

sd:=StrToFloat(Edit1.Text);

DM.Table4.FindNearest([sd]);

except

on EConvertError do

begin

ShowMessage('√ !');

Form2.Label2.Caption:='';

end

end;

end;

{ try

sd:=StrToFloat(Edit1.text);

except

raise Exception.create(Edit1.text+' !');

end

else

DM.Table4.FindNearest([StrToFloat(Edit1.text)]);

DM.Table4.FindNearest([Edit1.Text]);

then Form2.Label1.Caption('╟'+Edit1.Text+' ');}

end;

Form2.Label2.caption:=('╩ :' +DM.Table4CATEGORIJA.Value+' '+'╘:'+DM.Table4Firma.Value+' '+'╠:'+DM.Table4MODEL.Value);

end;

procedure TForm2.CheckBox3Click(Sender: TObject);

begin

if Form2.CheckBox3.Checked then

begin

Form2.Label2.Visible:=True;

Form2.Edit1.Visible:=True;

Form2.CheckBox2.Checked:=False;

Form2.RadioGroup2.Visible:=True;

RadioGroup2.ItemIndex:=0;

RadioGroup1.ItemIndex:=RadioGroup2.ItemIndex;

Form2.CheckBox1.Checked:=True;

end

else

begin

Form2.RadioGroup2.Visible:=False;

Form2.Edit1.Visible:=False;

Form2.Label2.Visible:=False;

end;

end;

procedure TForm2.RadioGroup2Click(Sender: TObject);

begin

RadioGroup1.ItemIndex:=RadioGroup2.ItemIndex;

end;

procedure TForm2.DBEdit1Click(Sender: TObject);

begin

Form3.Button6.Visible:=True;

Form3.ShowModal;

end;

procedure TForm2.CheckBox2Click(Sender: TObject);

begin

if Form2.CheckBox2.Checked then

begin

Form2.Label2.Visible:=True;

Form2.BitBtn2.Visible:=True;

Form2.Edit2.Visible:=True;

Form2.CheckBox3.Checked:=False;

Form2.RadioGroup2.Visible:=True;

Form2.Checkbox1.Checked:=True;

end

else

begin

Form2.Label2.Visible:=False;

Form2.BitBtn2.Visible:=False;

Form2.Edit2.Visible:=False;

Form2.RadioGroup2.Visible:=False;

end;

end;

procedure TForm2.SpeedButton1Click(Sender: TObject);

var pole:shortstring;

begin

CASE RadioGroup2.ItemIndex OF

0:

begin

DM.Table4.IndexFieldNames := 'CATEGORIJA';

DM.Table4CATEGORIJA.Index := 0;

Pole:='CATEGORIJA';

end;

1:

begin

DM.Table4.IndexFieldNames := 'FIRMA';

DM.Table4FIRMA.Index := 0;

Pole:='FIRMA';

end;

2:

begin

DM.Table4.IndexFieldNames := 'MODEL';

DM.Table4MODEL.Index := 0;

Pole:='MODEL';

end;

3:

begin

DM.Table4.IndexFieldNames := 'CENAD';

DM.Table4CENAD.Index := 0;

Pole:='CENAD'

end;

4:

begin

DM.Table2.IndexFieldNames := 'SKLAD';

DM.Table2SKLAD.Index := 0;

Pole:='SKLAD';

end;

end;

DM.Table4.locate(pole,Edit2.Text,[loCaseInsensitive,

lopartialKey]);

end;

procedure TForm2.SpeedButton3Click(Sender: TObject);

begin

DM.Table4.First;

Form2.Dbgrid1.SetFocus;

end;

procedure TForm2.SpeedButton4Click(Sender: TObject);

begin

DM.Table4.FindLast;

Form2.Dbgrid1.SetFocus;

end;

procedure TForm2.Edit2Change(Sender: TObject);

var Pole:shortString;sd:real;

begin

end;

procedure TForm2.BitBtn2Click(Sender: TObject);

var Pole:shortstring;sd:real;

begin

Form2.Label2.Visible:=True;

CASE RadioGroup2.ItemIndex OF

0:

begin

DM.Table4.IndexFieldNames := 'CATEGORIJA';

DM.Table4CATEGORIJA.Index := 0;

Pole:='CATEGORIJA';

end;

1:

begin

DM.Table4.IndexFieldNames := 'FIRMA';

DM.Table4FIRMA.Index := 0;

Pole:='FIRMA';

end;

2:

begin

DM.Table4.IndexFieldNames := 'MODEL';

DM.Table4MODEL.Index := 0;

Pole:='MODEL';

end;

3:

begin

DM.Table4.IndexFieldNames := 'CENAD';

DM.Table4CENAR.Index := 0;

Pole:='CENAD'

end;

4:

begin

DM.Table4.IndexFieldNames := 'SKLAD';

DM.Table4SKLAD.Index := 0;

Pole:='SKLAD';

end;

end;

if RadioGroup2.ItemIndex<=2 then

begin

if not

DM.Table4.Locate(Pole,Edit2.text,[LoCaseInsensitive,LoPartialKey])

then

begin

ShowMessage('╟'+ ' '+Edit2.text+' '+' ');

Form2.Label2.Caption:='';

end

else

Form2.Label2.caption:=('╩ :' +DM.Table4CATEGORIJA.Value+' '+'╘:'+DM.Table4Firma.Value+' '+'╠:'+DM.Table4MODEL.Value);

end

else

if Edit1.text <> '' then

begin

try

sd:=STRToFloat(Edit1.Text);

if not DM.Table4.Locate(Pole,sd,[LoCaseInsensitive,LoPartialKey])

then

begin

ShowMessage('╟'+ ' '+Edit2.text+' '+' ');

Form2.Label2.Caption:='';

end

else

Form2.Label2.caption:=('╩ :' +DM.Table4CATEGORIJA.Value+' '+'╘:'+DM.Table4Firma.Value+' '+'╠:'+DM.Table4MODEL.Value);

except

on EConvertError do

begin

ShowMessage('√ !');

Form2.Label2.Caption:='';

end

end;

{ DM.Table4.FindFirst;}

end;end;

end.

unit redakt; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Mask, Buttons, DBCGrids; type TForm2 = class(TForm) Panel1: TPanel; Butt

 

 

 

! , , , .
. , :