'Select Count(人口编号) From 人口信息');
Query1.SQL.Add('Where 房间代号 in (Select 房间编号 From 房屋信息表 where 大楼编号=:A');
Query1.ParamByName('A').AsString:=StringGrid1.Cells[1,1];
For b:=1 to StringGrid1.RowCount-1 do
begin
Query1.SQL.Add('or 大楼编号 = '''+StringGrid1.Cells[1,b]+'''');
end;
Query1.SQL.Add(')');
Query1.SQL.Add(' And 性别=''女''');
Query1.Open;
Series1.AddPie(Query1.Fields[0].AsInteger,'女性人口数',clBlue);
end;
1: begin
Label2.caption:='现签约住户数、现空闲房屋数各占总房数的百分比';
Series1.Clear;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select Count(业主代号) From 业主信息表');
Query1.SQL.Add('Where 业主代号 in ( Select 房间编号 From 房屋信息表 Where 大楼编号=:A');
Query1.ParamByName('A').AsString:=StringGrid1.Cells[1,1];
For b:=1 to StringGrid1.RowCount-1 do
begin
Query1.SQL.Add('or 大楼编号 = '''+StringGrid1.Cells[1,b]+'''');
end;
Query1.SQL.Add(')');
Query1.Open;
C:=Query1.Fields[0].AsInteger;
Series1.AddPie(Query1.Fields[0].AsInteger,'已签约房屋',ClBlue);
//-------------------------------------------------------------
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select Count(房间编号) From 房屋信息表');
Query1.SQL.Add('Where 大楼编号=:A');
Query1.ParamByName('A').AsString:=StringGrid1.Cells[1,1];
For b:=1 to StringGrid1.RowCount-1 do
begin
Query1.SQL.Add('or 大楼编号 = '''+StringGrid1.Cells[1,b]+'''');
end;
Query1.Open;
Series1.AddPie(Query1.Fields[0].AsInteger-c,'未签约房屋',ClRed);
end;
2: begin
Label2.Caption:='已出租房屋数量、空闲可出租房屋数量各占总出租房屋数的百分比';
Series1.Clear;
Query1.Close;
Query1.SQL.clear;
Query1.SQL.Add('Select Count(房间代号) From 房租费用表');
Query1.SQL.Add('where 房间代号 in ( Select 房间编号 From 房屋信息表 Where 大楼编号=:A');
Query1.ParamByName('A').AsString:=StringGrid1.Cells[1,1];
For B:=1 to StringGrid1.RowCount-1 do
begin
Query1.SQL.Add('or 大楼编号 = '''+StringGrid1.Cells[1,b]+'''');
end;
Query1.SQL.Add(')');
Query1.Open;
C:=Query1.FieldS[0].AsInteger;
Series1.AddPie(C,'已出租数',ClRed);
//-------------------------------------------------------------
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select Count(房间编号) From 房屋出租信息表');
Query1.SQL.Add('where 房间编号 in (Select 房间编