📄 realtyf52a.pas
字号:
query.SQL.Clear;
query.SQL.Add('select * from 装修验收 where 申请单号='''+edit1.Text+'''');
query.Open;
if query.RecordCount>0 then
begin
query1.SQL.Clear;
query1.SQL.Add('select * from 装修申请 where 单号='''+query.fieldbyname('申请单号').Value+'''');
query1.Open;
if query1.RecordCount>0 then
begin
query2.SQL.Clear;
query2.SQL.Add('select * from 房间 where 编号 ='''+query1.fieldbyname('房间').Value+'''') ;
query2.Open;
if query2.RecordCount>0 then
begin
with f_RealtyF52.listview1.Items.Add do
begin
query3.SQL.Clear;
query3.SQL.Add('select * from 组织机构 where 编号='''+query2.fieldbyname('管理处').Value+'''');
query3.Open;
if query3.RecordCount>0 then
s1:=query3.fieldbyname('名称').Value;
query3.SQL.Clear;
query3.SQL.Add('select * from 管理区 where 编号='''+query2.fieldbyname('管理区').Value+'''');
query3.Open;
if query3.RecordCount>0 then
s2:=query3.fieldbyname('名称').Value;
query3.SQL.Clear;
query3.SQL.Add('select * from 楼宇 where 编号='''+query2.fieldbyname('楼宇').Value+'''');
query3.Open;
if query3.RecordCount>0 then
s3:=query3.fieldbyname('名称').Value;
caption:=s1;
subitems.Add(s2);
subitems.Add(s3);
subitems.Add(query1.fieldbyname('房间').Value);
s5:=mainform.getName('房间',query1.fieldbyname('房间').Value);
subitems.Add(s5);
subitems.Add(query1.fieldbyname('单号').Value);
subitems.Add(query1.fieldbyname('操作员').Value);
subitems.Add(query1.fieldbyname('客户').Value);
query3.SQL.Clear;
query3.SQL.Add('select * from 客户资料 where 客户名称='''+query1.fieldbyname('客户').Value+'''');
query3.Open;
if query3.RecordCount>0 then
begin
subitems.Add(query3.fieldbyname('电话').Value);
end
else
begin
subitems.Add('');
end;
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);
query3.sql.clear;
query3.sql.add('select * from 职员 where 名称='''+query.fieldbyname('验收人').Value+'''');
query3.open;
if query3.recordcount>0 then
begin
subitems.Add(query3.fieldbyname('电话1').Value);
subitems.Add(query3.fieldbyname('职务').Value);
subitems.Add(query3.fieldbyname('岗位').Value);
end
else
begin
subitems.Add('');
subitems.Add('');
subitems.Add('');
end;
subitems.Add(query1.fieldbyname('装修公司').Value);
subitems.Add(query.fieldbyname('审核').Value);
end;
end;
end;
query.Next;
end;
query2.Close;
query2.Free;
query3.Close;
query3.Free;
query1.Close;
query1.Free;
query.Close;
query.Free;
if f_RealtyF52.listview1.Items.Count>0 then f_RealtyF52.listview1.Items.Item[0].Selected:=true;
edit1.text:='';
edit5.text:='';
edit4.Text:='';
edit3.date:=date;
edit2.ItemIndex:=edit2.Items.IndexOf('');
edit11.text:='';
edit12.text:='';
edit13.Text:='';
edit14.text:='';
edit15.text:='';
edit16.Text:='';
edit17.text:='';
edit18.text:='';
edit1.SetFocus;
end;
if f_RealtyF52.bNew=false then
begin
s:='update 装修验收 set 申请单号='''+edit1.text;
s:=s+''',验收项目='''+edit2.text;
s:=s+''',验收日期='''+datetostr(edit3.date);
s:=s+''',验收人='''+edit4.text;
s:=s+''',验收说明='''+edit5.text;
s:=s+''',验收通过='''+s4;
s:=s+''' where 申请单号='''+f_RealtyF52.ListView1.Selected.SubItems[4]+'''';
query.SQL.Clear;
query.SQL.Add(s);
DataModuleADO.ADOConnection1.BeginTrans;
query.ExecSQL;
DataModuleADO.ADOConnection1.CommitTrans;
query.sql.clear;
query.SQL.Add('select * from 装修验收 where 申请单号='''+edit1.Text+'''');
query.Open;
if query.RecordCount>0 then
begin
query1.SQL.Clear;
query1.SQL.Add('select * from 装修申请 where 单号='''+query.fieldbyname('申请单号').Value+'''');
query1.Open;
if query1.RecordCount>0 then
begin
query2.SQL.Clear;
query2.SQL.Add('select * from 房间 where 编号 ='''+query1.fieldbyname('房间').Value+'''') ;
query2.Open;
if query2.RecordCount>0 then
begin
with f_RealtyF52.listview1.Selected do
begin
query3.SQL.Clear;
query3.SQL.Add('select * from 组织机构 where 编号='''+query2.fieldbyname('管理处').Value+'''');
query3.Open;
if query3.RecordCount>0 then
s1:=query3.fieldbyname('名称').Value;
query3.SQL.Clear;
query3.SQL.Add('select * from 管理区 where 编号='''+query2.fieldbyname('管理区').Value+'''');
query3.Open;
if query3.RecordCount>0 then
s2:=query3.fieldbyname('名称').Value;
query3.SQL.Clear;
query3.SQL.Add('select * from 楼宇 where 编号='''+query2.fieldbyname('楼宇').Value+'''');
query3.Open;
if query3.RecordCount>0 then
s3:=query3.fieldbyname('名称').Value;
caption:=s1;
subitems[0]:=s2;
subitems[1]:=s3;
s5:=mainform.getName('房间',query1.fieldbyname('房间').Value);
subitems[2]:=query1.fieldbyname('房间').Value;
subitems[3]:=s5;
subitems[4]:=query1.fieldbyname('单号').Value;
subitems[5]:=query1.fieldbyname('操作员').Value;
subitems[6]:=query1.fieldbyname('客户').Value;
query3.SQL.Clear;
query3.SQL.Add('select * from 客户资料 where 客户名称='''+query1.fieldbyname('客户').Value+'''');
query3.Open;
if query3.RecordCount>0 then
begin
subitems[7]:=query3.fieldbyname('电话').Value;
end
else
begin
subitems[7]:='';
end;
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;
query3.sql.clear;
query3.sql.add('select * from 职员 where 名称='''+query.fieldbyname('验收人').Value+'''');
query3.open;
if query3.recordcount>0 then
begin
subitems[13]:=query3.fieldbyname('电话1').Value;
subitems[14]:=query3.fieldbyname('职务').Value;
subitems[15]:=query3.fieldbyname('岗位').Value;
end
else
begin
subitems[13]:='';
subitems[14]:='';
subitems[15]:='';
end;
subitems[16]:=query1.fieldbyname('装修公司').Value;
subitems[17]:=query.fieldbyname('审核').Value;
end;
end;
end;
query.Next;
end;
query2.Close;
query2.Free;
query3.Close;
query3.Free;
query1.Close;
query1.Free;
query.Close;
query.Free;
close;
end;
end;
procedure Tf_RealtyF52A.Button5Click(Sender: TObject);
begin
close;
end;
procedure Tf_RealtyF52A.edit2Select(Sender: TObject);
begin
if edit2.Text='新增验收项目' then
begin
mainform.t1:='验收项目';
f_Car4s931:=Tf_Car4s931.Create(self);
f_Car4s931.showmodal;
if f_Car4s931.bOK=true then
begin
edit2.Items.Add(mainform.t1);
edit2.ItemIndex:=edit2.Items.IndexOf(mainform.t1);
end
else edit2.ItemIndex:=edit2.Items.IndexOf('');
end;
end;
procedure Tf_RealtyF52A.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -