📄 realtya121.pas
字号:
SubItems[3]:=Query.FieldByName('层数').Value;
SubItems[4]:=Query.FieldByName('楼高').Value;
SubItems[5]:=Query.FieldByName('朝向').Value;
SubItems[6]:=Query.FieldByName('开发商').Value;
SubItems[7]:=Query.FieldByName('承建商').Value;
SubItems[8]:=Query.FieldByName('楼宇类型').Value;
SubItems[9]:=Query.FieldByName('建筑面积').Value;
SubItems[10]:=Query.FieldByName('使用面积').Value;
SubItems[11]:=Query.FieldByName('绿化面积').Value;
SubItems[12]:=Query.FieldByName('竣工日期').Value;
SubItems[13]:=Query.FieldByName('入伙日期').Value;
SubItems[14]:=Query.FieldByName('开工日期').Value;
SubItems[15]:=Query.FieldByName('楼宇结构').Value;
SubItems[16]:=Query.FieldByName('楼宇用途').Value;
end;
end;
query.close;
query.Free;
close;
exit;
end
else
begin
query.sql.clear;
query.sql.add('select * from 楼宇 where 编号='''+f_RealtyA12.ListView1.Selected.Caption+'''');
query.Open;
if query.RecordCount>0 then
begin
with f_RealtyA12.ListView1.Items.Add do
begin
Caption:=Query.FieldByName('编号').Value;
SubItems.Add(Query.FieldByName('名称').Value);
SubItems.Add(Query.FieldByName('管理处').Value);
SubItems.Add(Query.FieldByName('管理区').Value);
SubItems.Add(Query.FieldByName('层数').Value);
SubItems.Add(Query.FieldByName('楼高').Value);
SubItems.Add(Query.FieldByName('朝向').Value);
SubItems.Add(Query.FieldByName('开发商').Value);
SubItems.Add(Query.FieldByName('承建商').Value);
SubItems.Add(Query.FieldByName('楼宇类型').Value);
SubItems.Add(Query.FieldByName('建筑面积').Value);
SubItems.Add(Query.FieldByName('使用面积').Value);
SubItems.Add(Query.FieldByName('绿化面积').Value);
SubItems.Add(Query.FieldByName('竣工日期').Value);
SubItems.Add(Query.FieldByName('入伙日期').Value);
SubItems.Add(Query.FieldByName('开工日期').Value);
SubItems.Add(Query.FieldByName('楼宇结构').Value);
SubItems.Add(Query.FieldByName('楼宇用途').Value);
end;
end;
end;
query.Close;
query.Free;
end;
procedure Tf_RealtyA121.ToolButton5Click(Sender: TObject);
begin
close;
end;
procedure Tf_RealtyA121.N11Click(Sender: TObject);
begin
getID;
Edit2.Text := '';
Edit3.Text := '';
Edit4.Text := '';
Edit5.Text := '';
Edit6.date := date;
Edit7.date := date;
Edit8.date := date;
Edit9.Text := '';
Edit10.Text := '';
Edit11.Text := '';
Edit12.Text := '';
Edit13.Text := '';
Edit14.Text := '';
Edit15.Text := '';
Edit16.Text := '';
Edit17.Text := '';
end;
procedure Tf_RealtyA121.Button1Click(Sender: TObject);
begin
f_RealtyA11:=Tf_RealtyA11.Create(self);
f_RealtyA11.ToolButton6.Visible:=true;
f_RealtyA11.ShowModal;
if f_RealtyA11.bOk=true then
begin
edit3.Text:=f_RealtyA11.sNum+'--'+f_RealtyA11.sName;
end;
end;
procedure Tf_RealtyA121.ToolButton6Click(Sender: TObject);
Var
query:TADOQuery;
s,s1,s2,s3,s4,s5,s6,s7:String;
i:integer;
tmpNode:TTreeNode;
begin
if edit1.Text='' then
begin
showmessage('编号不能为空');
edit1.SetFocus;
exit;
end;
if edit2.Text='' then
begin
showmessage('名称不能为空');
edit2.SetFocus;
exit;
end;
if edit3.Text='' then
begin
showmessage('管理区不能为空');
edit3.SetFocus;
exit;
end;
s1:=edit9.Text;
s2:=edit10.Text;
s3:=edit11.Text;
s4:=edit12.Text;
s5:=edit16.Text;
s6:=edit17.Text;
if edit9.Text='' then s1:='-';
if edit10.Text='' then s2:='-';
if edit11.Text='' then s3:='-';
if edit12.Text='' then s4:='-';
if edit16.Text='' then s5:='-';
if edit17.Text='' then s6:='-';
edit4.Text:=mainform.StdInt(edit4.Text);
edit5.Text:=mainform.StdInt(edit5.Text);
edit13.Text:=mainform.StdDou2(edit13.Text);
edit14.Text:=mainform.StdDou2(edit14.Text);
edit15.Text:=mainform.StdDou2(edit15.Text);
query:=TADOQuery.Create(nil);
query.Connection:=DataModuleADO.ADOConnection1;
s:='select * from 管理区 where 编号='''+mainform.getNum(Edit3.Text)+'''';
query.SQL.Clear;
query.SQL.Add(s);
query.Open;
if query.RecordCount>0 then
begin
s7:=query.fieldbyname('管理处').Value;
end;
if f_RealtyA12.bMod=false then
begin
s:='select * from 楼宇 where 编号='''+Edit1.Text;
s:=s+'''';
query.SQL.Clear;
query.SQL.Add(s);
query.Open;
if query.RecordCount>0 then
begin
if query.FieldByName('编号').Value=edit1.Text then
begin
showmessage('编号重复!,请重新输入!');
edit1.SetFocus;
exit;
end;
end;
s:='insert into 楼宇(编号,名称,管理处,管理区,层数,楼高,';
s:=s+'朝向,开发商,承建商,楼宇类型,建筑面积,';
s:=s+'使用面积,绿化面积,竣工日期,入伙日期,开工日期,';
s:=s+'楼宇结构,楼宇用途)';
s:=s+' Values(:s1,:s2,:s22,:s3,:s4,:s5,';
s:=s+':s6,:s7,:s8,:s9,:s10,';
s:=s+':s11,:s12,:s13,:s14,:s15,';
s:=s+':s16,:s17)';
query.SQL.Clear;
query.SQL.Add(s);
query.Parameters.ParamByName('s1').Value:=edit1.Text;
query.Parameters.ParamByName('s2').Value:=edit2.Text;
query.Parameters.ParamByName('s22').Value:=s7;
query.Parameters.ParamByName('s3').Value:=mainform.getNum(Edit3.Text);
query.Parameters.ParamByName('s4').Value:=strtofloat(edit4.Text);
query.Parameters.ParamByName('s5').Value:=strtofloat(edit5.Text);
query.Parameters.ParamByName('s6').Value:=s1;
query.Parameters.ParamByName('s7').Value:=s2;
query.Parameters.ParamByName('s8').Value:=s3;
query.Parameters.ParamByName('s9').Value:=s4;
query.Parameters.ParamByName('s10').Value:=strtofloat(edit13.Text);
query.Parameters.ParamByName('s11').Value:=strtofloat(edit14.Text);
query.Parameters.ParamByName('s12').Value:=strtofloat(edit15.Text);
query.Parameters.ParamByName('s13').Value:=datetostr(edit6.date);
query.Parameters.ParamByName('s14').Value:=datetostr(edit7.date);
query.Parameters.ParamByName('s15').Value:=datetostr(edit8.date);
query.Parameters.ParamByName('s16').Value:=s5;
query.Parameters.ParamByName('s17').Value:=s6;
DataModuleADO.ADOConnection1.BeginTrans;
query.ExecSQL;
DataModuleADO.ADOConnection1.CommitTrans;
s:='select * from 楼宇 where 编号='''+Edit1.Text;
s:=s+'''';
query.sql.clear;
Query.SQL.Add(s);
Query.Open ;
if query.RecordCount>0 then
begin
with f_RealtyA12.ListView1.Items.Add do
begin
Caption:=Query.FieldByName('编号').Value;
SubItems.Add(Query.FieldByName('名称').Value);
SubItems.Add(mainform.getName('组织机构',Query.FieldByName('管理处').Value));
SubItems.Add(mainform.getLastName(Edit3.Text));
SubItems.Add(Query.FieldByName('层数').Value);
SubItems.Add(Query.FieldByName('楼高').Value);
SubItems.Add(Query.FieldByName('朝向').Value);
SubItems.Add(Query.FieldByName('开发商').Value);
SubItems.Add(Query.FieldByName('承建商').Value);
SubItems.Add(Query.FieldByName('楼宇类型').Value);
SubItems.Add(Query.FieldByName('建筑面积').Value);
SubItems.Add(Query.FieldByName('使用面积').Value);
SubItems.Add(Query.FieldByName('绿化面积').Value);
SubItems.Add(Query.FieldByName('竣工日期').Value);
SubItems.Add(Query.FieldByName('入伙日期').Value);
SubItems.Add(Query.FieldByName('开工日期').Value);
SubItems.Add(Query.FieldByName('楼宇结构').Value);
SubItems.Add(Query.FieldByName('楼宇用途').Value);
end;
end;
if f_RealtyA12.listview1.Items.Count=1 then f_RealtyA12.listview1.Items.Item[0].Selected:=true;
GetId;
Edit2.Text := '';
Edit3.Text := '';
Edit4.Text := '';
Edit5.Text := '';
Edit6.date := date;
Edit7.date := date;
Edit8.date := date;
Edit9.Text := '';
Edit10.Text := '';
Edit11.Text := '';
Edit12.Text := '';
Edit13.Text := '';
Edit14.Text := '';
Edit15.Text := '';
Edit16.Text := '';
Edit17.Text := '';
Edit1.SetFocus;
end;
if f_RealtyA12.bMod=true then
begin
if Edit1.Text<>f_RealtyA12.ListView1.Selected.Caption then
begin
s:='select * from 楼宇 where 编号='''+Edit1.Text;
s:=s+'''';
query.SQL.Add(s);
query.Open;
if query.RecordCount>0 then
begin
showmessage('编号重复!,请重新输入!');
edit1.SetFocus;
exit;
end;
end;
s:='update 楼宇 set 编号='''+edit1.Text;
s:=s+''',名称='''+edit2.Text;
s:=s+''',层数='+edit4.Text;
s:=s+',楼高='+edit5.Text;
s:=s+',朝向='''+s1;
s:=s+''',开发商='''+s2;
s:=s+''',承建商='''+s3;
s:=s+''',楼宇类型='''+s4;
s:=s+''',建筑面积='+edit13.Text;
s:=s+',使用面积='+edit14.Text;
s:=s+',绿化面积='+edit15.Text;
s:=s+',竣工日期='''+datetostr(edit6.date);
s:=s+''',入伙日期='''+datetostr(edit7.date);
s:=s+''',开工日期='''+datetostr(edit8.date);
s:=s+''',楼宇结构='''+s5;
s:=s+''',楼宇用途='''+s6;
s:=s+''',管理区='''+mainform.getNum(Edit3.Text);
s:=s+''',管理处='''+s7;
s:=s+''' where 编号='''+f_RealtyA12.ListView1.Selected.Caption;
s:=s+'''';
query.SQL.Clear;
query.sql.Add(s);
DataModuleADO.ADOConnection1.BeginTrans;
query.ExecSQL;
DataModuleADO.ADOConnection1.CommitTrans;
s:='select * from 楼宇 where 编号='''+Edit1.Text;
s:=s+'''';
query.sql.clear;
Query.SQL.Add(s);
Query.Open ;
if query.RecordCount>0 then
begin
with f_RealtyA12.ListView1.Selected do
begin
Caption:=Query.FieldByName('编号').Value;
SubItems[0]:=Query.FieldByName('名称').Value;
SubItems[1]:=mainform.getName('组织机构',Query.FieldByName('管理处').Value);
SubItems[2]:=mainform.getLastName(Edit3.Text);
SubItems[3]:=Query.FieldByName('层数').Value;
SubItems[4]:=Query.FieldByName('楼高').Value;
SubItems[5]:=Query.FieldByName('朝向').Value;
SubItems[6]:=Query.FieldByName('开发商').Value;
SubItems[7]:=Query.FieldByName('承建商').Value;
SubItems[8]:=Query.FieldByName('楼宇类型').Value;
SubItems[9]:=Query.FieldByName('建筑面积').Value;
SubItems[10]:=Query.FieldByName('使用面积').Value;
SubItems[11]:=Query.FieldByName('绿化面积').Value;
SubItems[12]:=Query.FieldByName('竣工日期').Value;
SubItems[13]:=Query.FieldByName('入伙日期').Value;
SubItems[14]:=Query.FieldByName('开工日期').Value;
SubItems[15]:=Query.FieldByName('楼宇结构').Value;
SubItems[16]:=Query.FieldByName('楼宇用途').Value;
end;
end;
query.close;
query.Free;
close;
end;
end;
procedure Tf_RealtyA121.Edit4Exit(Sender: TObject);
begin
Edit4.Text:=mainform.StdInt(Edit4.Text);
end;
procedure Tf_RealtyA121.Edit5Exit(Sender: TObject);
begin
Edit5.Text:=mainform.StdDou2(Edit5.Text);
end;
procedure Tf_RealtyA121.Edit9Select(Sender: TObject);
begin
if edit9.Text='新增朝向' then
begin
mainform.t1:='朝向';
f_Car4s931:=Tf_Car4s931.Create(self);
f_Car4s931.showmodal;
if f_Car4s931.bOK=true then
begin
edit9.Items.Add(mainform.t1);
edit9.ItemIndex:=edit9.Items.IndexOf(mainform.t1);
end
else edit9.ItemIndex:=edit9.Items.IndexOf('');
end;
end;
procedure Tf_RealtyA121.Edit12Select(Sender: TObject);
begin
if edit12.Text='新增楼宇类型' then
begin
mainform.t1:='楼宇类型';
f_Car4s931:=Tf_Car4s931.Create(self);
f_Car4s931.showmodal;
if f_Car4s931.bOK=true then
begin
edit12.Items.Add(mainform.t1);
edit12.ItemIndex:=edit12.Items.IndexOf(mainform.t1);
end
else edit12.ItemIndex:=edit12.Items.IndexOf('');
end;
end;
procedure Tf_RealtyA121.Edit16Select(Sender: TObject);
begin
if edit16.Text='新增楼宇结构' then
begin
mainform.t1:='楼宇结构';
f_Car4s931:=Tf_Car4s931.Create(self);
f_Car4s931.showmodal;
if f_Car4s931.bOK=true then
begin
edit16.Items.Add(mainform.t1);
edit16.ItemIndex:=edit16.Items.IndexOf(mainform.t1);
end
else edit16.ItemIndex:=edit16.Items.IndexOf('');
end;
end;
procedure Tf_RealtyA121.Edit17Select(Sender: TObject);
begin
if edit17.Text='新增用途' then
begin
mainform.t1:='用途';
f_Car4s931:=Tf_Car4s931.Create(self);
f_Car4s931.showmodal;
if f_Car4s931.bOK=true then
begin
edit17.Items.Add(mainform.t1);
edit17.ItemIndex:=edit17.Items.IndexOf(mainform.t1);
end
else edit17.ItemIndex:=edit17.Items.IndexOf('');
end;
end;
procedure Tf_RealtyA121.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -