?? mc_xzclass.~pas
字號:
unit MC_XZCLass;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBTables, Db, StdCtrls, Buttons, Grids, DBGrids, DBCtrls, ExtCtrls,
TeeProcs, TeEngine, Chart;
type
TXZClass = class(TForm)
GroupBox1: TGroupBox;
DBLookupComboBox1: TDBLookupComboBox;
GroupBox2: TGroupBox;
DBGrid1: TDBGrid;
GroupBox3: TGroupBox;
ListBox1: TListBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
DataSource1: TDataSource;
DataSource2: TDataSource;
Table2: TTable;
Table2BDEDesigner2: TStringField;
Table2BDEDesigner5: TIntegerField;
Table2BDEDesigner6: TStringField;
Table2BDEDesigner7: TStringField;
Table2BDEDesigner: TStringField;
Query1: TQuery;
Query1BDEDesigner: TStringField;
Query1BDEDesigner2: TStringField;
Query2: TQuery;
Query3: TQuery;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
XZClass: TXZClass;
implementation
uses MC_SFQKFX;
{$R *.DFM}
procedure TXZClass.FormClose(Sender: TObject; var Action: TCloseAction);
begin
XZCLAss.Release;
XZClass:=Nil;
end;
procedure TXZClass.BitBtn3Click(Sender: TObject);
begin
Close;
end;
procedure TXZClass.BitBtn2Click(Sender: TObject);
var a,b:integer;
begin
For a:=0 to ListBox1.Items.Count-1 do
begin
if ListBox1.Items.Strings[a]=Table2.FieldByName('大樓名稱').AsString then
begin
b:=0;
Break;
end else b:=1;
end;
if b=0 then
begin
ShowMessage('此大樓以被選種!!');
end
else
begin
ListBox1.Items.Add(Table2.FieldByName('大樓名稱').AsString);
end;
end;
procedure TXZClass.BitBtn4Click(Sender: TObject);
begin
if ListBox1.Items.Count<>0 then
begin
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
end;
procedure TXZClass.BitBtn1Click(Sender: TObject);
var ZD: String;
ZDZ: Array of String;//設(shè)立動態(tài)數(shù)組
a:integer;
begin
if ListBox1.Items.Count=0 then
begin
ShowMessage('請選擇要瀏覽的大樓.');
end
else
begin
SetLength(ZDZ,ListBox1.Items.Count);//分配動態(tài)變量,記得釋放掉
SFQKFX.Series1.Clear;//清楚圖表
if SFQKFX.ComboBox1.ItemIndex=0 then
begin
Query2.Close;
Query2.SQL.Add('Select Sum(實(shí)收金額),SUM(應(yīng)收金額) From 水費(fèi) ');
Query2.SQL.Add('Where 水表編號 in (Select 房間編號 From 房屋信息表');
Query2.SQL.Add('Where 大樓名=:A');
Query2.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
Query2.SQL.Add('or 大樓名='''+ZDZ[a]+'''');
end;
Query2.SQL.Add(')');
Query2.Open;
SFQKFX.Series1.AddPie(Query2.Fields[0].AsFloat,'水費(fèi)實(shí)收金額',clteecolor);
SFQKFX.Series1.AddPie(Query2.Fields[1].AsFloat,'水費(fèi)應(yīng)收金額',clTeeColor);
End;
if SFQKFX.ComboBox1.ItemIndex=1 then
begin
Query2.Close;
Query2.SQL.Add('Select Sum(實(shí)收金額),SUM(應(yīng)收金額) From 電費(fèi) ');
Query2.SQL.Add('Where 電表編號 in (Select 房間編號 From 房屋信息表');
Query2.SQL.Add('Where 大樓名=:A');
Query2.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
Query2.SQL.Add('or 大樓名='''+ZDZ[a]+'''');
end;
Query2.SQL.Add(')');
Query2.Open;
SFQKFX.Series1.AddPie(Query2.Fields[0].AsFloat,'電費(fèi)實(shí)收金額',clteecolor);
SFQKFX.Series1.AddPie(Query2.Fields[1].AsFloat,'電費(fèi)應(yīng)收金額',clTeeColor);
End;
if SFQKFX.ComboBox1.ItemIndex=2 then
begin
Query2.Close;
Query2.SQL.Add('Select Sum(實(shí)收金額),SUM(應(yīng)收金額) From 煤氣費(fèi) ');
Query2.SQL.Add('Where 煤氣表編號 in (Select 房間編號 From 房屋信息表');
Query2.SQL.Add('Where 大樓名=:A');
Query2.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
Query2.SQL.Add('or 大樓名='''+ZDZ[a]+'''');
end;
Query2.SQL.Add(')');
Query2.Open;
SFQKFX.Series1.AddPie(Query2.Fields[0].AsFloat,'煤氣費(fèi)實(shí)收金額',clteecolor);
SFQKFX.Series1.AddPie(Query2.Fields[1].AsFloat,'煤氣費(fèi)應(yīng)收金額',clTeeColor);
End;
if SFQKFX.ComboBox1.ItemIndex=3 then
begin
Query2.Close;
Query2.SQL.Clear;
Query2.SQL.Add('Select SUM(應(yīng)收金額),Sum(實(shí)收金額) From 采暖費(fèi)');
Query2.SQL.Add('Where 采暖費(fèi)編號 in (Select 房間編號 From 房屋信息表');
Query2.SQL.Add('Where 大樓名=:A');
Query2.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
Query2.SQL.Add('or 大樓名='''+ZDZ[a]+'''');
end;
Query2.SQL.Add(')');
Query2.Open;
SFQKFX.Series1.AddPie(Query2.Fields[0].AsFloat,'采暖應(yīng)收金額',clTeeColor);
SFQKFX.Series1.AddPie(Query2.Fields[1].AsFloat,'采暖實(shí)收金額',clTeeColor);
end;
if SFQKFX.ComboBox1.ItemIndex=4 then
begin
Query3.Close;
Query3.SQL.Clear;
Query3.SQL.Add('Select 科目名 From 其它科目');
Query3.Open;
While Not Query3.Eof do
begin
Query2.close;
Query2.SQL.Clear;
Query2.SQL.Add('Select Sum(應(yīng)收金額),Sum(實(shí)收金額) From 其它費(fèi)用表');
Query2.SQL.Add('Where 費(fèi)用科目=:B and 收費(fèi)編號 in (Select 房間編號 From 房屋信息表');
Query2.SQL.Add('Where 大樓名=:A');
Query2.ParamByname('A').AsString:=ListBox1.Items.Strings[0];
Query2.ParamByName('B').AsString:=Query3.FieldByName('科目名').AsString;
For a:=1 to Listbox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
Query2.SQL.Add('or 大樓名='''+ZDZ[a]+'''');
end;
Query2.SQL.Add(')');
Query2.Open;
SFQKFX.Series1.AddPie(Query2.Fields[0].AsFloat,'應(yīng)收'+Query3.FieldByName('科目名').AsString,clTeeColor);
SFQKFX.Series1.AddPie(Query2.Fields[1].AsFloat,'實(shí)收'+Query3.FieldByName('科目名').AsString,clTeeColor);
Query3.Next;
end;
end;
if SFQKFX.ComboBox1.ItemIndex=5 then
begin
Query3.Close;
Query3.SQL.Clear;
Query3.SQL.Add('Select 科目名 From 費(fèi)用科目');
Query3.Open;
While Not Query3.Eof do
begin
Query2.close;
Query2.SQL.Clear;
Query2.SQL.Add('Select Sum(應(yīng)收金額),Sum(實(shí)收金額) From 常用費(fèi)用');
Query2.SQL.Add('Where 費(fèi)用科目=:B and 收費(fèi)編號 in (Select 房間編號 From 房屋信息表');
Query2.SQL.Add('Where 大樓名=:A');
Query2.ParamByname('A').AsString:=ListBox1.Items.Strings[0];
Query2.ParamByName('B').AsString:=Query3.FieldByName('科目名').AsString;
For a:=1 to Listbox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
Query2.SQL.Add('or 大樓名='''+ZDZ[a]+'''');
end;
Query2.SQL.Add(')');
Query2.Open;
SFQKFX.Series1.AddPie(Query2.Fields[0].AsFloat,'應(yīng)收'+Query3.FieldByName('科目名').AsString,clTeeColor);
SFQKFX.Series1.AddPie(Query2.Fields[1].AsFloat,'實(shí)收'+Query3.FieldByName('科目名').AsString,clTeeColor);
Query3.Next;
end;
end;
ZDZ:=Nil;
Close;
end;
end;
procedure TXZClass.FormShow(Sender: TObject);
begin
DBLookupCombobox1.KeyValue:=Query1.FieldByName('小區(qū)名').asString;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -