?? mc_dloptions.~pas
字號(hào):
unit MC_DLOptions;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBTables, Db, StdCtrls, Buttons, Grids, DBGrids, DBCtrls;
type
TDLOptions = 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;
procedure DBGrid1DblClick(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DLOptions: TDLOptions;
implementation
uses MC_SFYL, MC_FWXXDJ;
{$R *.DFM}
procedure TDLOptions.DBGrid1DblClick(Sender: TObject);
var a,b:integer;
begin
For a:=0 to ListBox1.Items.Count-1 do
begin
if ListBox1.Items.Strings[a]=Table2.FieldByName('大樓編號(hào)').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('大樓編號(hào)').AsString);
end;
end;
procedure TDLOptions.ListBox1DblClick(Sender: TObject);
begin
if ListBox1.Items.Count<>0 then
begin
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
end;
procedure TDLOptions.BitBtn3Click(Sender: TObject);
begin
Close;
end;
procedure TDLOptions.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DLOptions.Release;
DLOptions:=Nil;
end;
procedure TDLOptions.BitBtn1Click(Sender: TObject);
var ZD: String;
ZDZ: Array of String;
a,b,c:integer;
S,d:Real;
Fi:STring;
begin
if ListBox1.Items.Count=0 then
begin
ShowMessage('請(qǐng)選擇要瀏覽的大樓.');
end
else
begin
SetLength(ZDZ,ListBox1.Items.Count);//分配動(dòng)態(tài)變量,記得釋放掉
ZD:='大樓編號(hào)';
//-----------------------------------------------------------------
SFYL.Query1.Close;
SFYL.Query1.SQL.Clear;
SFYL.Query1.SQL.Add('Select * From 水費(fèi) Where');
SFYL.Query1.SQL.Add('水表編號(hào) in (Select 房間編號(hào) From 房屋信息表 Where 大樓編號(hào)=:A');
SFYL.Query1.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
SFYL.Query1.SQL.Add('or 大樓編號(hào)='''+ZDZ[a]+'''');
//SFYL.Query1.ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];
end;
SFYL.Query1.SQL.Add(')');
SFYL.Query1.Open;
//-----------------------------------------------------------------
SFYL.Query2.Close;
SFYL.Query2.SQL.Clear;
SFYL.Query2.SQL.Add('Select * From 電費(fèi) Where');
SFYL.Query2.SQL.Add('電表編號(hào) in (Select 房間編號(hào) From 房屋信息表 Where 大樓編號(hào)=:A');
SFYL.Query2.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
SFYL.Query2.SQL.Add('or 大樓編號(hào)='''+ZDZ[a]+'''');
//SFYL.Query2.ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];
end;
SFYL.Query2.SQL.Add(')');
SFYL.Query2.Open;
//-----------------------------------------------------------------
SFYL.Query3.Close;
SFYL.Query3.SQL.Clear;
SFYL.Query3.SQL.Add('Select * From 煤氣費(fèi) Where');
SFYL.Query3.SQL.Add('煤氣表編號(hào) in (Select 房間編號(hào) From 房屋信息表 Where 大樓編號(hào)=:A');
SFYL.Query3.ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];
SFYL.Query3.SQL.Add('or 大樓編號(hào)='''+ZDZ[a]+'''');
//SFYL.Query3.ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];
end;
SFYL.Query3.SQL.Add(')');
SFYL.Query3.Open;
//-----------------------------------------------------------------
//--------------
SFYL.StringGrid2.ColCount:=2;
SFYL.StringGrid2.RowCount:=2;
SFYL.StringGrid2.FixedRows:=1;
SFYL.StringGrid2.FixedCols:=1;
with SFYL.Query4 do
begin
Close;
SQL.Clear;
SQL.Add('Select Distinct 費(fèi)用科目 From 其它費(fèi)用表 ORDER BY 費(fèi)用科目 ASC');
Open;
with SFYL.StringGrid2 do
begin
ColCount:=2+1+2*RecordCount+1;
Cells[1,0]:='收費(fèi)編號(hào)';
ColWidths[1]:=100;
Cells[2,0]:='姓名';
ColWidths[2]:=50;
Cells[ColCount-1,0]:='共余額';
ColWidths[ColCount-1]:=50;
a:=2;
while not EOF do
begin
a:=a+1;
Cells[A,0]:='應(yīng)收'+FieldByName('費(fèi)用科目').AsString;
Colwidths[a]:=80;
a:=a+1;
Cells[A,0]:='實(shí)收'+FieldByName('費(fèi)用科目').AsString;
Colwidths[a]:=80;
Next;
end;
end;
//-------
Close;
SQL.Clear;
SQL.Add('Select Distinct 收費(fèi)編號(hào) From 其它費(fèi)用表');
SQL.Add('Where 收費(fèi)編號(hào) in (Select 房間編號(hào) From 房屋信息表');
SQL.Add('Where 大樓編號(hào)=:A');
ParamByName('A').AsString:=ListBox1.Items.Strings[0];
For a:=1 to ListBox1.Items.Count-1 do
begin
ZDZ[a]:=ListBox1.Items.Strings[a];;
SQL.Add('or 大樓編號(hào)='''+ZDZ[a]+'''');
//ParamByName('ZDZ[a]').AsString:=ListBox1.Items.Strings[a];
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -