unitredakt;
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
usesdata, Enter, categor, Vopros2;
{$R*.DFM}
procedureTForm2.ComboBox1Change(Sender: TObject);
begin
{Form2.ComboBox1:=}
end;
procedureTForm2.Button3Click(Sender: TObject);
begin
DM.Table4.First;
Form2.DBGrid1.SetFocus;
end;
procedureTForm2.Button4Click(Sender: TObject);
begin
DM.Table4.Next;
Form2.DBGrid1.SetFocus;
end;
procedureTForm2.Button6Click(Sender: TObject);
begin
DM.Table4.Prior;
Form2.DBGrid1.SetFocus;
end;
procedureTForm2.Button5Click(Sender: TObject);
begin
DM.Table4.Last;
Form2.DBGrid1.SetFocus;
end;
procedureTForm2.Button7Click(Sender: TObject);
begin
DM.Table4.Edit;
Form2.DBGrid1.SetFocus;
end;
procedureTForm2.Button8Click(Sender: TObject);
begin
DM.Table4.Insert;
Form2.DBGrid1.SetFocus;
end;
procedureTForm2.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;
procedureTForm2.Button10Click(Sender: TObject);
begin
if notDM.Table4.EOF then
begin
withDM.Table4 do
begin
DisableControls;
Delete;
{MessageDlg('╙фрышЄ№ърЄхуюЁш■?',mtCustom,(mbYes),(mbNo));}
EnableControls;
Form2.DbGrid1.SetFocus;
end;
end;
end;
procedureTForm2.RadioGroup1Click(Sender: TObject);
varPole:shortstring;
begin
CaseForm2.RadioGroup1.ItemIndex of
0:Pole:='ърЄхуюЁшш';
1:Pole:='ЇшЁьх-шчуюЄютшЄхых';
2:Pole:='ьюфхыш';
3:Pole:='Ўхэх';
4:Pole:='╩юышўхёЄтєэрёъырфх';
end;
ifForm2.RadioGroup1.ItemIndex=0 then
DM.Table4.IndexFieldNames:='Categorija';
ifForm2.RadioGroup1.ItemIndex=1 then
DM.Table4.IndexFieldNames:='Firma';
ifForm2.RadioGroup1.ItemIndex=2 then
DM.Table4.IndexFieldNames:='Model';
ifForm2.RadioGroup1.ItemIndex=3 then
DM.Table4.IndexFieldNames:='CENAD';
ifForm2.RadioGroup1.ItemIndex=4 then
DM.Table4.IndexFieldNames:='SKLAD';
DM.Table4.Refresh;
DM.Table4.Close;
DM.Table4.Open;
Form2.DbGrid1.SetFocus;
end;
procedureTForm2.CheckBox1Click(Sender: TObject);
begin
ifForm2.CheckBox1.Checked then
begin
Form2.RadioGroup1.Visible:=True;
Form2.RadioGroup1.ItemIndex:=0;
end
else
begin
DM.Table4.IndexFieldNames:='';
Form2.RadioGroup1.Visible:=False;
end;
end;
procedureTForm2.DBEdit1Change(Sender: TObject);
begin
Form3.Button6.Visible:=True;
Form3.Show;
Form3.Dbgrid1.SetFocus;
end;
procedureTForm2.BitBtn1Click(Sender: TObject);
begin
Form10.ShowModal;
end;
procedureTForm2.Edit1Change(Sender: TObject);
varPole:ShortString;sd:real;
begin
ifEdit1.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
DM.Table4.FindNearest([Edit1.text])
else
if Edit1.text '' then
begin
try
sd:=StrToFloat(Edit1.Text);
DM.Table4.FindNearest([sd]);
except
onEConvertError do
begin
ShowMessage('эхяЁртшы№э√щттюф !');
Form2.Label2.Caption:='';
end
end;
end;
{ try
sd:=StrToFloat(Edit1.text);
except
raiseException.create(Edit1.text+' ¤Єю эх ўшёыютющ ЇюЁьрЄ !');
end
else
DM.Table4.FindNearest([StrToFloat(Edit1.text)]);
DM.Table4.FindNearest([Edit1.Text]);
thenForm2.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
CASERadioGroup2.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;
CASERadioGroup2.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;
ifRadioGroup2.ItemIndex
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 notDM.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
onEConvertError do
begin
ShowMessage('эхяЁртшы№э√щ ттюф !');
Form2.Label2.Caption:='';
end
end;
{ DM.Table4.FindFirst;}
end;end;
end.