Смекни!
smekni.com

Организация автоматизации учета на предприятиях (стр. 4 из 5)

Label73: TLabel;

Edit40: TEdit;

Edit41: TEdit;

Edit42: TEdit;

GroupBox17: TGroupBox;

Label74: TLabel;

Label75: TLabel;

Label76: TLabel;

Label77: TLabel;

Label78: TLabel;

Label79: TLabel;

Label80: TLabel;

Label81: TLabel;

Edit43: TEdit;

Edit44: TEdit;

Edit45: TEdit;

Edit46: TEdit;

Edit47: TEdit;

Edit48: TEdit;

Edit49: TEdit;

Edit50: TEdit;

GroupBox18: TGroupBox;

Label82: TLabel;

Label83: TLabel;

Edit51: TEdit;

Edit52: TEdit;

GroupBox19: TGroupBox;

Label84: TLabel;

Label85: TLabel;

Label86: TLabel;

Label87: TLabel;

Edit53: TEdit;

Edit54: TEdit;

Edit55: TEdit;

Edit56: TEdit;

Button4: TButton;

IBQuery3: TIBQuery;

DBImage3: TDBImage;

N4: TMenuItem;

N5: TMenuItem;

N6: TMenuItem;

N7: TMenuItem;

N8: TMenuItem;

N9: TMenuItem;

N10: TMenuItem;

N11: TMenuItem;

Button5: TButton;

N12: TMenuItem;

N13: TMenuItem;

N14: TMenuItem;

N15: TMenuItem;

N16: TMenuItem;

N17: TMenuItem;

IBQuery4: TIBQuery;

N18: TMenuItem;

procedure FormDestroy(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure N2Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure IBQuery1AfterScroll(DataSet: TDataSet);

procedure N5Click(Sender: TObject);

procedure N6Click(Sender: TObject);

procedure N7Click(Sender: TObject);

procedure N9Click(Sender: TObject);

procedure N10Click(Sender: TObject);

procedure N11Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure N13Click(Sender: TObject);

procedure N14Click(Sender: TObject);

procedure N15Click(Sender: TObject);

procedure FormActivate(Sender: TObject);

procedure N16Click(Sender: TObject);

procedure N18Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

uses Unit2, Unit3, Unit4, Unit5;

{$R *.dfm}

procedure TForm1.FormDestroy(Sender: TObject);

begin

IBQuery1.Close;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

if OpenPictureDialog1.Execute Then

begin

DBImage2.Picture.LoadFromFile(OpenPictureDialog1.FileName);

IBQueryFoto.ParamByName('FOTO').LoadFromFile(OpenPictureDialog1.FileName,ftBlob);

IBQueryFoto.ParamByName('Nom').Value := IBQuery1.FieldByName('Nom').Value;

Try

IBQueryFoto.ExecSQL;

Except

DataModule2.IBTransaction1.RollbackRetaining;

ShowMessage('Ошибка установки фотографии');

Exit;

End;

DataModule2.IBTransaction1.CommitRetaining;

IBQuery1.Close;

IBQuery1.Open;

ShowMessage('Фотографияустановлена');

end;

end;

procedure TForm1.N2Click(Sender: TObject);

begin

close;

end;

procedure TForm1.Button2Click(Sender: TObject);

var

s : String;

begin

case ComboBox1.ItemIndex of

0 : S := 'Fam';

1 : S := 'Pol';

2 : S := 'INN';

end;

IBQuery1.Locate(S, Edit500.Text,[loPartialKey]);

end;

procedure TForm1.N3Click(Sender: TObject);

begin

Form3.QuickRep1.Preview;

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

IBQuery2.Params.ParamByName('Fam').Value:=Edit1.Text;

IBQuery2.Params.ParamByName('Name').Value:=Edit2.Text;

IBQuery2.Params.ParamByName('Otch').Value:=Edit3.Text;

IBQuery2.Params.ParamByName('Pol').Value:=Edit4.Text;

IBQuery2.Params.ParamByName('DR').Value:=Edit5.Text;

IBQuery2.Params.ParamByName('Ves').Value:=Edit6.Text;

IBQuery2.Params.ParamByName('Rost').Value:=Edit7.Text;

IBQuery2.Params.ParamByName('Adr_str').Value:=Edit8.Text;

IBQuery2.Params.ParamByName('Adr_obl').Value:=Edit9.Text;

IBQuery2.Params.ParamByName('Adr_gor').Value:=Edit10.Text;

IBQuery2.Params.ParamByName('Adr_yl').Value:=Edit11.Text;

IBQuery2.Params.ParamByName('Adr_dom').Value:=Edit12.Text;

IBQuery2.Params.ParamByName('Adr_kv').Value:=Edit13.Text;

IBQuery2.Params.ParamByName('Adr_ind').Value:=Edit14.Text;

IBQuery2.Params.ParamByName('Adr_tel').Value:=Edit15.Text;

IBQuery2.Params.ParamByName('Mroz_str').Value:=Edit16.Text;

IBQuery2.Params.ParamByName('Mroz_obl').Value:=Edit17.Text;

IBQuery2.Params.ParamByName('Paspost_nom').Value:=Edit18.Text;

IBQuery2.Params.ParamByName('Mroz_gor').Value:=Edit19.Text;

IBQuery2.Params.ParamByName('Paspost_ser').Value:=Edit20.Text;

IBQuery2.Params.ParamByName('Paspost_vidan').Value:=Edit21.Text;

IBQuery2.Params.ParamByName('Paspost_data').Value:=Edit22.Text;

IBQuery2.Params.ParamByName('Tryd_kn_seriya').Value:=Edit23.Text;

IBQuery2.Params.ParamByName('Tryd_kn_nomer').Value:=Edit24.Text;

IBQuery2.Params.ParamByName('Obrazov').Value:=Edit25.Text;

IBQuery2.Params.ParamByName('Grazdan').Value:=Edit26.Text;

IBQuery2.Params.ParamByName('Nom_strax_sved').Value:=Edit27.Text;

IBQuery2.Params.ParamByName('INN').Value:=Edit28.Text;

try

IBQuery2.ExecSQL;

Except

DataModule2.IBTransaction1.RollbackRetaining;

ShowMessage('Невозможно передать запись');

Exit;

end;

DataModule2.IBTransaction1.CommitRetaining;

ShowMessage('Записьдобавлена');

IBQuery1.Close;

IBQuery1.Open;

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

if MessageDlg('Обновитьанкетныеданные?', mtConfirmation, [mbYes, mbNo],0)=mrYes then

begin

IBQuery4.Params.ParamByName('Nom').Value:=IBQuery1NOM.Value;

IBQuery4.Params.ParamByName('Fam').Value:=Edit29.Text;

IBQuery4.Params.ParamByName('Name').Value:=Edit30.Text;

IBQuery4.Params.ParamByName('Otch').Value:=Edit31.Text;

IBQuery4.Params.ParamByName('Pol').Value:=Edit33.Text;

IBQuery4.Params.ParamByName('DR').Value:=Edit32.Text;

IBQuery4.Params.ParamByName('Ves').Value:=Edit34.Text;

IBQuery4.Params.ParamByName('Rost').Value:=Edit35.Text;

IBQuery4.Params.ParamByName('Adr_str').Value:=Edit43.Text;

IBQuery4.Params.ParamByName('Adr_obl').Value:=Edit44.Text;

IBQuery4.Params.ParamByName('Adr_gor').Value:=Edit45.Text;

IBQuery4.Params.ParamByName('Adr_yl').Value:=Edit46.Text;

IBQuery4.Params.ParamByName('Adr_dom').Value:=Edit47.Text;

IBQuery4.Params.ParamByName('Adr_kv').Value:=Edit48.Text;

IBQuery4.Params.ParamByName('Adr_ind').Value:=Edit50.Text;

IBQuery4.Params.ParamByName('Adr_tel').Value:=Edit49.Text;

IBQuery4.Params.ParamByName('Mroz_str').Value:=Edit40.Text;

IBQuery4.Params.ParamByName('Mroz_obl').Value:=Edit41.Text;

IBQuery4.Params.ParamByName('Paspost_nom').Value:=Edit53.Text;

IBQuery4.Params.ParamByName('Mroz_gor').Value:=Edit42.Text;

IBQuery4.Params.ParamByName('Paspost_ser').Value:=Edit54.Text;

IBQuery4.Params.ParamByName('Paspost_vidan').Value:=Edit55.Text;

IBQuery4.Params.ParamByName('Paspost_data').Value:=Edit56.Text;

IBQuery4.Params.ParamByName('Tryd_kn_seriya').Value:=Edit51.Text;

IBQuery4.Params.ParamByName('Tryd_kn_nomer').Value:=Edit52.Text;

IBQuery4.Params.ParamByName('Obrazov').Value:=Edit36.Text;

IBQuery4.Params.ParamByName('Grazdan').Value:=Edit37.Text;

IBQuery4.Params.ParamByName('Nom_strax_sved').Value:=Edit38.Text;

IBQuery4.Params.ParamByName('INN').Value:=Edit39.Text;

try

IBQuery4.ExecSQL;

Except

DataModule2.IBTransaction1.RollbackRetaining;

ShowMessage('Запись не добавлена');

exit;

end;

DataModule2.IBTransaction1.CommitRetaining;

ShowMessage('Записьобновлена');

IBQuery1.Close;

IBQuery1.Open;

end;

end;

procedure TForm1.IBQuery1AfterScroll(DataSet: TDataSet);

begin

if IBQuery1.FieldValues['Fam']<> null then

Edit29.Text:=IBQuery1.FieldValues['Fam'];

if IBQuery1.FieldValues['Name']<> null then

Edit30.Text:=IBQuery1.FieldValues['Name'];

if IBQuery1.FieldValues['Otch']<> null then

Edit31.Text:=IBQuery1.FieldValues['Otch'];

if IBQuery1.FieldValues['Pol']<> null then

Edit33.Text:=IBQuery1.FieldValues['Pol'];

if IBQuery1.FieldValues['DR']<> null then

Edit32.Text:=IBQuery1.FieldValues['DR'];

if IBQuery1.FieldValues['Ves']<> null then

Edit34.Text:=IBQuery1.FieldValues['Ves'];

if IBQuery1.FieldValues['Rost']<> null then

Edit35.Text:=IBQuery1.FieldValues['Rost'];

if IBQuery1.FieldValues['Adr_str']<> null then

Edit43.Text:=IBQuery1.FieldValues['Adr_str'];

if IBQuery1.FieldValues['Adr_obl']<> null then

Edit44.Text:=IBQuery1.FieldValues['Adr_obl'];

if IBQuery1.FieldValues['Adr_gor']<> null then

Edit45.Text:=IBQuery1.FieldValues['Adr_gor'];

if IBQuery1.FieldValues['Adr_yl']<> null then

Edit46.Text:=IBQuery1.FieldValues['Adr_yl'];

if IBQuery1.FieldValues['Adr_dom']<> null then

Edit47.Text:=IBQuery1.FieldValues['Adr_dom'];

if IBQuery1.FieldValues['Adr_kv']<> null then

Edit48.Text:=IBQuery1.FieldValues['Adr_kv'];

if IBQuery1.FieldValues['Adr_ind']<> null then

Edit50.Text:=IBQuery1.FieldValues['Adr_ind'];

if IBQuery1.FieldValues['Adr_tel']<> null then

Edit49.Text:=IBQuery1.FieldValues['Adr_tel'];

if IBQuery1.FieldValues['Mroz_str']<> null then

Edit40.Text:=IBQuery1.FieldValues['Mroz_str'];

if IBQuery1.FieldValues['Mroz_obl']<> null then

Edit41.Text:=IBQuery1.FieldValues['Mroz_obl'];

if IBQuery1.FieldValues['Paspost_nom']<> null then

Edit53.Text:=IBQuery1.FieldValues['Paspost_nom'];

if IBQuery1.FieldValues['Mroz_gor']<> null then

Edit42.Text:=IBQuery1.FieldValues['Mroz_gor'];

if IBQuery1.FieldValues['Paspost_ser']<> null then

Edit54.Text:=IBQuery1.FieldValues['Paspost_ser'];

if IBQuery1.FieldValues['Paspost_vidan']<> null then

Edit55.Text:=IBQuery1.FieldValues['Paspost_vidan'];

if IBQuery1.FieldValues['Paspost_data']<> null then

Edit56.Text:=IBQuery1.FieldValues['Paspost_data'];

if IBQuery1.FieldValues['Tryd_kn_seriya']<> null then

Edit51.Text:=IBQuery1.FieldValues['Tryd_kn_seriya'];

if IBQuery1.FieldValues['Tryd_kn_nomer']<> null then

Edit52.Text:=IBQuery1.FieldValues['Tryd_kn_nomer'];

if IBQuery1.FieldValues['Obrazov']<> null then

Edit36.Text:=IBQuery1.FieldValues['Obrazov'];

if IBQuery1.FieldValues['Grazdan']<> null then

Edit37.Text:=IBQuery1.FieldValues['Grazdan'];

if IBQuery1.FieldValues['Nom_strax_sved']<> null then

Edit38.Text:=IBQuery1.FieldValues['Nom_strax_sved'];

if IBQuery1.FieldValues['INN']<> null then

Edit39.Text:=IBQuery1.FieldValues['INN'];

end;

procedure TForm1.N5Click(Sender: TObject);

begin

Form4.Notebook1.PageIndex := 0;

Form4.GroupBox1.Caption := ' Пофамилии: ';

Form4.ShowModal;

end;

procedure TForm1.N6Click(Sender: TObject);

begin

Form4.Notebook1.PageIndex := 1;

Form4.GroupBox1.Caption := ' Пополу: ';

Form4.ShowModal;

end;

procedure TForm1.N7Click(Sender: TObject);

begin

Form4.Notebook1.PageIndex := 2;

Form4.GroupBox1.Caption := ' Податерождения: ';

Form4.ShowModal;

end;

procedure TForm1.N9Click(Sender: TObject);

begin

IBQuery1.Close;

IBQuery1.SQL.Clear;

IBQuery1.SQL.Add('select * from anketa order by fam');

IBQuery1.Open;

end;

procedure TForm1.N10Click(Sender: TObject);

begin

IBQuery1.Close;

IBQuery1.SQL.Clear;

IBQuery1.SQL.Add('select * from anketa order by dr');

IBQuery1.Open;

end;

procedure TForm1.N11Click(Sender: TObject);

begin

IBQuery1.Close;

IBQuery1.SQL.Clear;

IBQuery1.SQL.Add('select * from anketa order by rost');

IBQuery1.Open;

end;

procedure TForm1.Button5Click(Sender: TObject);

begin

if OpenPictureDialog1.Execute Then

begin

DBImage3.Picture.LoadFromFile(OpenPictureDialog1.FileName);

IBQueryFoto.ParamByName('FOTO').LoadFromFile(OpenPictureDialog1.FileName,ftBlob);

IBQueryFoto.ParamByName('Nom').Value := IBQuery1.FieldByName('Nom').Value;

Try

IBQueryFoto.ExecSQL;

Except

DataModule2.IBTransaction1.RollbackRetaining;

ShowMessage('Ошибка установки фотографии');

Exit;

End;

DataModule2.IBTransaction1.CommitRetaining;

IBQuery1.Close;

IBQuery1.Open;

ShowMessage('Фотографияустановлена');

end;

end;

procedure TForm1.N13Click(Sender: TObject);

begin

PageControl1.ActivePageIndex := 1;

end;

procedure TForm1.N14Click(Sender: TObject);

begin

PageControl1.ActivePageIndex := 2;

end;

procedure TForm1.N15Click(Sender: TObject);

begin

if MessageBox(Handle,'Выдействительнохотитеудалитьзапись?','Подтверждениеудаления', MB_YESNO or MB_ICONWARNING)=mrYes then

begin

IBQuery3.ParamByName('NOM').Value := IBQuery1.FieldByName('NOM').Value;

Try

IBQuery3.ExecSQL;

Except

DataModule2.IBTransaction1.RollbackRetaining;

MessageBox(Handle,'Невозможноудалитьзапись.','Ошибкаудалениязаписи', MB_OK or MB_ICONERROR);

Exit;

End;

DataModule2.IBTransaction1.CommitRetaining;

IBQuery1.Close;

IBQuery1.Open;

MessageBox(Handle,'Записьудалина.','Событие', MB_OK or MB_ICONINFORMATION);

end;

end;

procedure TForm1.FormActivate(Sender: TObject);

begin

IBQuery1.Open;

end;

procedure TForm1.N16Click(Sender: TObject);

begin

Form5.ShowModal;

end;

procedure TForm1.N18Click(Sender: TObject);

begin

IBQuery1.Close;

IBQuery1.SQL.Clear;

IBQuery1.SQL.Add('SELECT * FROM ANKETA');

IBQuery1.Open;

end;

end.

Модульформысфильтрацией

unit Unit4;

interface

uses

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

Dialogs, StdCtrls, ExtCtrls;

type

TForm4 = class(TForm)

GroupBox1: TGroupBox;

Notebook1: TNotebook;

Label1: TLabel;

Edit1: TEdit;

Button1: TButton;

Button2: TButton;

Button3: TButton;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

Button4: TButton;

Button5: TButton;

Edit2: TEdit;

Label2: TLabel;

Label3: TLabel;

Edit3: TEdit;

Button6: TButton;

Button7: TButton;

Button8: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form4: TForm4;

implementation

uses Unit1, Unit2, Unit3;