Смекни!
smekni.com

Автоматизация работы фирмы по продаже квартир (стр. 5 из 5)

StdCtrls, Mask, DBCtrls, ExtCtrls, Buttons;

type

TForm3 = class(TForm)

DBEdit1: TDBEdit;

Label2: TLabel;

DBEdit2: TDBEdit;

Label3: TLabel;

DBEdit3: TDBEdit;

Label4: TLabel;

DBEdit4: TDBEdit;

Label5: TLabel;

DBEdit5: TDBEdit;

Label6: TLabel;

DBEdit6: TDBEdit;

Label7: TLabel;

DBEdit7: TDBEdit;

Label8: TLabel;

DBEdit8: TDBEdit;

Label9: TLabel;

DBEdit9: TDBEdit;

Label10: TLabel;

DBEdit10: TDBEdit;

Label11: TLabel;

DBEdit11: TDBEdit;

Label12: TLabel;

DBEdit12: TDBEdit;

Label13: TLabel;

DBEdit13: TDBEdit;

Label1: TLabel;

Button2: TButton;

Label15: TLabel;

RadioGroup1: TRadioGroup;

Edit1: TEdit;

Label14: TLabel;

Button1: TButton;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Edit1Change(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

uses Unit1, Unit2;

{$R *.DFM}

procedure TForm3.Button1Click(Sender: TObject);

begin

form1.table1.Edit;

if messagedlg('Удалить', mtconfirmation, [mbyes, mbno],0)=mryes

then form1.table1.delete;

end;

procedure TForm3.Button2Click(Sender: TObject);

begin

Form1.Table1.Last;

Form1.Table1.Insert;

end;

procedure TForm3.Button3Click(Sender: TObject);

begin

form3.hide;

form2.show;

end;

procedure TForm3.Edit1Change(Sender: TObject);

begin

if Edit1.Text<>'' then

begin

case RadioGroup1.ItemIndex of

0: begin

form1.Table1.Locate('secondname',Edit1.Text,[]);

end;

1: begin

form1.table1.locate('dolgnost',edit1.text,[]);

end;

2: begin

form1.table1.locate('npassporta',edit1.text,[]);

end;

end;

end;

end;

procedure TForm3.BitBtn1Click(Sender: TObject);

begin

form1.Table1.FlushBuffers;

end;

procedure TForm3.BitBtn2Click(Sender: TObject);

begin

form3.Hide;

form2.show;

end;

end.

Unit4

unit Unit4;

interface

uses

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

StdCtrls, Mask, DBCtrls, ExtCtrls, DBCGrids, Db, DBTables, TeEngine,

Series, TeeProcs, Chart, DBChart, mxstore, mxDB, Grids, mxgrid, mxtables,

mxgraph, DBGrids, Spin, DBLookup, ColorGrd, ComCtrls, Tabnotbk;

type

TForm4 = class(TForm)

GroupBox1: TGroupBox;

DataSource1: TDataSource;

rayon: TCheckBox;

tipplan: TCheckBox;

DBGrid1: TDBGrid;

Button5: TButton;

Button2: TButton;

RadioGroup1: TRadioGroup;

Label1: TLabel;

DBLookupCombo1: TDBLookupCombo;

Query1: TQuery;

DataSource2: TDataSource;

Query2: TQuery;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

Button3: TButton;

Label2: TLabel;

DBLookupCombo2: TDBLookupCombo;

Label3: TLabel;

Button1: TButton;

GroupBox2: TGroupBox;

Edit1: TEdit;

Edit2: TEdit;

Label4: TLabel;

Label5: TLabel;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

RadioButton3: TRadioButton;

Button4: TButton;

DataSource3: TDataSource;

Query3: TQuery;

Query3BDEDesigner: TStringField;

Query3BDEDesigner2: TStringField;

Query3_: TFloatField;

Query3BDEDesigner3: TStringField;

Query3_2: TStringField;

Query3BDEDesigner4: TStringField;

Query3BDEDesigner5: TStringField;

Query3_3: TFloatField;

Query3_4: TFloatField;

Query3_5: TStringField;

Query3_6: TFloatField;

Query3BDEDesigner6: TStringField;

Query3BDEDesigner7: TFloatField;

Query3_7: TStringField;

Query3_1: TStringField;

DataSource4: TDataSource;

Query4: TQuery;

DataSource5: TDataSource;

Query5: TQuery;

DBGrid2: TDBGrid;

Label6: TLabel;

DataSource6: TDataSource;

Table1: TTable;

DBNavigator1: TDBNavigator;

Button6: TButton;

Query1BDEDesigner: TStringField;

Query1BDEDesigner2: TStringField;

Query1_: TFloatField;

Query1BDEDesigner3: TStringField;

Query1_2: TStringField;

Query1BDEDesigner4: TStringField;

Query1BDEDesigner5: TStringField;

Query1_3: TFloatField;

Query1_4: TFloatField;

Query1_5: TStringField;

Query1_6: TFloatField;

Query1BDEDesigner6: TStringField;

Query1BDEDesigner7: TFloatField;

Query1_7: TStringField;

Table1Inomer: TFloatField;

Table1Oper: TStringField;

Table1Tipplan: TStringField;

Table1Rayon: TStringField;

Table1Adress: TStringField;

Table1Obpl: TFloatField;

Table1Plkux: TFloatField;

Table1Sostkv: TStringField;

Table1Kolroom: TFloatField;

Table1Sityname: TStringField;

Table1Adress_prod: TStringField;

Table1Dopsv: TStringField;

Table1Vlad: TStringField;

Table1Zena: TFloatField;

procedure Button1Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure DBLookupCombo1Change(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure DBLookupCombo2Change(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure RadioButton1Click(Sender: TObject);

procedure RadioButton2Click(Sender: TObject);

procedure RadioButton3Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form4: TForm4;

implementation

uses Unit1, Unit5, Unit6, Unit7;

{$R *.DFM}

procedure TForm4.Button1Click(Sender: TObject);

begin

form4.hide;

form7.show;

end;

procedure TForm4.Button5Click(Sender: TObject);

begin

form4.hide;

form1.show;

end;

procedure TForm4.Button2Click(Sender: TObject);

begin

dbgrid1.DataSource:=DataSource1;

with Query1 do

begin

close;

with radioGroup1 do begin

case ItemIndex of

0:ParamByName('op').AsString:='продажа';

1:ParamByName('op').AsString:='обмен';

2:ParamByName('op').AsString:='%';

end;

end;{with}

if rayon.Checked then begin

if Combobox1.Text<>''then

ParamByName('ra').AsString:=Combobox1.Text

end

else ParamByName('ra').AsString:='%';

if tipPlan.Checked then begin

if Combobox2.Text<>''then

paramByName('tp').AsString:=Combobox2.Text

end

else ParamByName('tp').AsString:='%';

Open;

end;

end;

procedure TForm4.DBLookupCombo1Change(Sender: TObject);

begin

dbgrid1.DataSource:=DataSource2;

with query2 do begin

close;

parambyname('vl').asString:=DBLookupCombo1.text;

open;

end;

end;

procedure TForm4.Button3Click(Sender: TObject);

begin

if DBLookupCombo2.value<>'' then

begin

form4.hide;

form5.show;

form5.table1.edit;

form5.table1.fieldbyname('ras_schet').value:=form1.label2.caption;

form5.table1.fieldbyname('date_pol').value:=form5.DateTimePicker1.date;

form5.table1.fieldbyname('adress_kv').value:=form4.table1.Fieldbyname('adress').value;

form5.table1.fieldbyname('adress_prod').value:=form4.table1.Fieldbyname('adress_prod').value;

form5.table1.fieldbyname('stoimost_kv').value:=form4.table1.Fieldbyname('zena').value;

end

else dblookupcombo2.setfocus;

end;

procedure TForm4.DBLookupCombo2Change(Sender: TObject);

begin

with form1.table4 do begin

form1.table4.locate('name',string(form4.DBLookupCombo2),[]);

form4.Combobox1.text:=form1.table4.fieldbyname('rayonkv').asstring;

form4.Combobox2.text:=form1.table4.fieldbyname('tipplan').asstring;

end;

end;

procedure TForm4.Button4Click(Sender: TObject);

begin

dbgrid1.DataSource:=DataSource3;

if RadioButton1.checked then

begin

with query3 do

begin

close;

parambyname('par1').asinteger:=strtoint(edit1.text);

open;

end

end

else

if RadioButton2.checked then begin

dbgrid1.DataSource:=DataSource4;

with query4 do begin

close;

parambyname('par1').asinteger:=strtoint(edit2.text);

open;

end

end

else

if RadioButton3.checked then begin

dbgrid1.DataSource:=DataSource5;

with query5 do begin

close;

parambyname('par1').asinteger:=strtoint(edit1.text);

parambyname('par2').asinteger:=strtoint(edit2.text);

open;

end;

end;

end;

procedure TForm4.RadioButton1Click(Sender: TObject);

begin

edit1.visible:=true;

label4.visible:=true;

edit2.visible:=false;

label5.visible:=false;

end;

procedure TForm4.RadioButton2Click(Sender: TObject);

begin

edit1.visible:=false;

label4.visible:=false;

edit2.visible:=true;

label5.visible:=true;

end;

procedure TForm4.RadioButton3Click(Sender: TObject);

begin

edit1.visible:=true;;

label4.visible:=true;

edit2.visible:=true;

label5.visible:=true;

end;

procedure TForm4.Button6Click(Sender: TObject);

begin

form4.table1.Edit;

if messagedlg('Вы уверены', mtconfirmation, [mbyes, mbno],0)=mryes

then begin

with form4.table1 do begin

first;

insert;

form4.table1.fieldbyname('inomer').value:=form4.query1.fieldbyname('инд_номер').value;

form4.table1.fieldbyname('oper').value:=form4.query1.fieldbyname('операция').value;

form4.table1.fieldbyname('tipplan').value:=form4.query1.fieldbyname('тип_планировки').value;

form4.table1.fieldbyname('rayon').value:=form4.query1.fieldbyname('район').value;

form4.table1.fieldbyname('adress').value:=form4.query1.fieldbyname('адресс').value;

form4.table1.fieldbyname('obpl').value:=form4.query1.fieldbyname('общ_площадь').value;

form4.table1.fieldbyname('plkux').value:=form4.query1.fieldbyname('пл_кухни').value;

form4.table1.fieldbyname('sostkv').value:=form4.query1.fieldbyname('сост_кв').value;

form4.table1.fieldbyname('kolroom').value:=form4.query1.fieldbyname('кол-во_комнат').value;

form4.table1.fieldbyname('sityname').value:=form4.query1.fieldbyname('город').value;

form4.table1.fieldbyname('dopsv').value:=form4.query1.fieldbyname('дополн_свед').value;

form4.table1.fieldbyname('vlad').value:=form4.query1.fieldbyname('владелец').value;

form4.table1.fieldbyname('adress_prod').value:=form4.query1.fieldbyname('адресс продавца').value;

form4.table1.fieldbyname('zena').value:=form4.query1.fieldbyname('цена').value*1.05;

end;

end;

end;

end.

Unit5

unit Unit5;

interface

uses

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

StdCtrls, Db, Grids, DBGrids, DBTables, ComCtrls, Buttons;

type

TForm5 = class(TForm)

DataSource1: TDataSource;

DBGrid1: TDBGrid;

Table1: TTable;

DateTimePicker1: TDateTimePicker;

BitBtn1: TBitBtn;

Table1Ras_schet: TFloatField;

Table1Date_pol: TDateField;

Table1Stoimost_kv: TFloatField;

Table1Adress_kv: TStringField;

Table1Adress_prod: TStringField;

Label1: TLabel;

Button1: TButton;

procedure Button1Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form5: TForm5;

implementation

uses Unit4, Unit6, Unit1;

{$R *.DFM}

procedure TForm5.Button1Click(Sender: TObject);

begin

if messagedlg('Вы уверены', mtconfirmation, [mbyes, mbno],0)=mryes

then form5.print;

end;

procedure TForm5.BitBtn1Click(Sender: TObject);

begin

form5.hide;

form4.show;

form5.table1.flushbuffers;

with form6.table1 do begin

last;

insert;

form6.table1.edit;

form6.table1.fieldbyname('name_pokyp').value:=form4.DBLookupCombo2.value;

form6.table1.fieldbyname('date').value:=form5.DateTimePicker1.date;

form6.table1.fieldbyname('stoimost_kv').value:=form5.table1.fieldbyname('stoimost_kv').value;

form6.table1.fieldbyname('inomer_kv').value:=form4.table1.fieldbyname('inomer').value;

form6.table1.fieldbyname('name_prod').value:=form4.table1.fieldbyname('vlad').value;

end;

form6.table1.flushbuffers;

form1.table4.locate('name',form4.DBLookupCombo2.value,[]);

form1.table4.delete;

form4.table1.delete;

end;

end.

Unit6

unit Unit6;

interface

uses

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

Db, Grids, DBGrids, DBTables, StdCtrls, ExtCtrls, DBCtrls;

type

TForm6 = class(TForm)

DataSource1: TDataSource;

Table1: TTable;

DBGrid1: TDBGrid;

Button1: TButton;

DBNavigator1: TDBNavigator;

Table1Name_pokyp: TStringField;

Table1Date: TDateField;

Table1Stoimost_kv: TFloatField;

Table1Inomer_kv: TFloatField;

Table1Name_prod: TStringField;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form6: TForm6;

implementation

uses Unit1;

{$R *.DFM}

procedure TForm6.Button1Click(Sender: TObject);

begin

form6.hide;

form1.show;

end;

end.

Unit7

unit Unit7;

interface

uses

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

StdCtrls, Buttons, DBLookup, ExtCtrls, DBCtrls, Mask;

type

TForm7 = class(TForm)

BitBtn1: TBitBtn;

GroupBox1: TGroupBox;

DBEdit1: TDBEdit;

Label2: TLabel;

DBEdit2: TDBEdit;

Label3: TLabel;

DBEdit3: TDBEdit;

Label4: TLabel;

DBEdit4: TDBEdit;

DBNavigator1: TDBNavigator;

GroupBox2: TGroupBox;

Label1: TLabel;

DBEdit5: TDBEdit;

Label5: TLabel;

DBEdit6: TDBEdit;

Label6: TLabel;

DBEdit7: TDBEdit;

Label7: TLabel;

DBEdit8: TDBEdit;

Label8: TLabel;

DBEdit9: TDBEdit;

Label9: TLabel;

DBEdit10: TDBEdit;

Label10: TLabel;

DBEdit11: TDBEdit;

Label11: TLabel;

DBEdit12: TDBEdit;

Label12: TLabel;

DBEdit13: TDBEdit;

Label13: TLabel;

DBEdit14: TDBEdit;

Label14: TLabel;

DBEdit15: TDBEdit;

Label15: TLabel;

DBEdit16: TDBEdit;

Label16: TLabel;

DBEdit17: TDBEdit;

DBNavigator2: TDBNavigator;

RadioGroup1: TRadioGroup;

Edit1: TEdit;

procedure BitBtn1Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Edit1Change(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form7: TForm7;

implementation

uses Unit1, Unit4;

{$R *.DFM}

procedure TForm7.BitBtn1Click(Sender: TObject);

begin

form7.hide;

form4.show;

end;

procedure TForm7.Button1Click(Sender: TObject);

begin

form1.table3.flushbuffers;

form1.table2.flushbuffers;

end;

procedure TForm7.Edit1Change(Sender: TObject);

begin

if Edit1.Text<>'' then

begin

case RadioGroup1.ItemIndex of

0: begin

form1.Table3.Locate('vlad',Edit1.Text,[]);

end;

1: begin

form1.table3.locate('rschet',edit1.text,[]);

end;

end;

end;

end;

end.


Приложение Б