?? searchbysellunit.pas
字號:
Unit SearchBySellUniT;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, LbSpeedButton, DB, ADODB, Grids, DBGridEh, ExtCtrls,
AAFont, AACtrls, ComCtrls, LbButton, ACReportClass;
Type
TSearchBySellForm = Class(TForm)
AALabel1: TAALabel;
Panel1: TPanel;
Splitter3: TSplitter;
Splitter2: TSplitter;
Splitter4: TSplitter;
DBGridEH1: TDBGridEh;
DBGridEh2: TDBGridEh;
DBGridEh3: TDBGridEh;
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
DataSource2: TDataSource;
ADOQuery2: TADOQuery;
DataSource3: TDataSource;
ADOQuery3: TADOQuery;
Panel2: TPanel;
Panel4: TPanel;
LbSpeedButton2: TLbSpeedButton;
LbSpeedButton1: TLbSpeedButton;
ADOQuery4: TADOQuery;
DataSource4: TDataSource;
CheckBox1: TCheckBox;
Panel3: TPanel;
AALabel2: TAALabel;
AALabel3: TAALabel;
AALabel4: TAALabel;
AALabel5: TAALabel;
AALabel6: TAALabel;
AALabel7: TAALabel;
AALabel8: TAALabel;
AALabel9: TAALabel;
AALabel10: TAALabel;
AALabel11: TAALabel;
AALabel12: TAALabel;
AALabel13: TAALabel;
AALabel14: TAALabel;
AALabel15: TAALabel;
AALabel16: TAALabel;
AALabel17: TAALabel;
AALabel18: TAALabel;
AALabel19: TAALabel;
AALabel20: TAALabel;
AALabel22: TAALabel;
AALabel23: TAALabel;
AALabel24: TAALabel;
AALabel25: TAALabel;
AALabel26: TAALabel;
AALabel27: TAALabel;
AALabel28: TAALabel;
AALabel29: TAALabel;
AALabel30: TAALabel;
AALabel31: TAALabel;
AALabel32: TAALabel;
AALabel33: TAALabel;
AALabel34: TAALabel;
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
StaticText4: TStaticText;
StaticText5: TStaticText;
StaticText6: TStaticText;
StaticText7: TStaticText;
StaticText8: TStaticText;
StaticText9: TStaticText;
StaticText10: TStaticText;
StaticText11: TStaticText;
StaticText12: TStaticText;
StaticText13: TStaticText;
StaticText14: TStaticText;
StaticText15: TStaticText;
StaticText16: TStaticText;
StaticText17: TStaticText;
StaticText18: TStaticText;
StaticText19: TStaticText;
StaticText20: TStaticText;
StaticText21: TStaticText;
StaticText22: TStaticText;
StaticText23: TStaticText;
StaticText24: TStaticText;
StaticText25: TStaticText;
StaticText26: TStaticText;
StaticText27: TStaticText;
StaticText28: TStaticText;
StaticText29: TStaticText;
StaticText30: TStaticText;
StaticText31: TStaticText;
StaticText32: TStaticText;
StaticText33: TStaticText;
StaticText34: TStaticText;
StaticText35: TStaticText;
StaticText36: TStaticText;
StaticText37: TStaticText;
StaticText38: TStaticText;
StaticText39: TStaticText;
StaticText40: TStaticText;
AALabel35: TAALabel;
Panel5: TPanel;
CheckBox2: TCheckBox;
LbButton1: TLbButton;
LbButton2: TLbButton;
LbButton3: TLbButton;
Panel9: TPanel;
Panel6: TPanel;
DBGridEh4: TDBGridEh;
AcReport1: TAcReport;
SaveDialog1: TSaveDialog;
LbButton4: TLbButton;
LbButton5: TLbButton;
AcReport2: TAcReport;
AALabel36: TAALabel;
AALabel21: TAALabel;
combobox1: TComboBox;
StaticText41: TStaticText;
Procedure ClearSTEXT;
Procedure GetCount;
Procedure GetRecByTypestr(stype: String);
Procedure GetReportFile2();
Procedure GetReportFile1();
Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
Procedure LbSpeedButton2Click(Sender: TObject);
Procedure DBGridEh1CellClick(Column: TColumnEh);
Procedure DBGridEh2CellClick(Column: TColumnEh);
Procedure ADOQuery1AfterScroll(DataSet: TDataSet);
Procedure ADOQuery2AfterScroll(DataSet: TDataSet);
Procedure LbSpeedButton1Click(Sender: TObject);
Procedure LbButton1Click(Sender: TObject);
Procedure LbButton2Click(Sender: TObject);
Procedure LbButton4Click(Sender: TObject);
Procedure DBGridEh4DblClick(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
End;
Var
SearchBySellForm : TSearchBySellForm;
Implementation
Uses DM, ViewUnitUnit, PUBFunction;
{$R *.dfm}
Procedure TSearchBySellForm.FormClose(Sender: TObject;
Var Action: TCloseAction);
Begin
Action := cafree;
SearchBySellForm := Nil;
End;
Procedure TSearchBySellForm.LbSpeedButton2Click(Sender: TObject);
Begin
Close;
End;
Procedure TSearchBySellForm.DBGridEh1CellClick(Column: TColumnEh);
Begin
With ADOQuery2 Do Begin
sql.Text :=
'select * FROM 項目信息表 WHERE 公司編號=''' +
ADOQuery1.fieldbyname('公司編號').Text + '''';
open;
End;
DBGridEh2CellClick(DBGridEh2.Columns.Items[0]);
End;
Procedure TSearchBySellForm.DBGridEh2CellClick(Column: TColumnEh);
Begin
With ADOQuery3 Do Begin
sql.Text :=
'SELECT * from 單體信息表 WHERE 公司編號=''' +
ADOQuery1.fieldbyname('公司編號').Text + ''' and 項目編號=''' +
ADOQuery2.fieldbyname('項目編號').Text + '''';
open;
End;
CheckBox1.Caption := '查詢整個[' + ADOQuery2.fieldbyname('項目名稱').Text +
']項目';
End;
Procedure TSearchBySellForm.ADOQuery1AfterScroll(DataSet: TDataSet);
Begin
DBGridEh1CellClick(DBGridEH1.Columns.Items[0]);
End;
Procedure TSearchBySellForm.ADOQuery2AfterScroll(DataSet: TDataSet);
Begin
DBGridEh2CellClick(DBGridEh2.Columns.Items[0]);
End;
Procedure TSearchBySellForm.LbSpeedButton1Click(Sender: TObject);
Begin
ClearSTEXT;
GetCount;
GetRecByTypestr(combobox1.Text);
End;
Procedure TSearchBySellForm.GetCount;
Var
wstr1 : String;
ADOC : TADOQuery;
Begin
wstr1 := ' 公司編號=''' + ADOQuery1.fieldbyname('公司編號').Text +
''' AND 項目編號=''' + ADOQuery2.fieldbyname('項目編號').Text + '''';
If Not (CheckBox1.Checked) Then
wstr1 := wstr1 + ' and 幢號=''' + ADOQuery3.fieldbyname('幢號').Text +
'''';
ADOC := TADOQuery.create(self);
With ADOC Do Begin
connection := DM.DataModule2.ADOConnection1;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1;
open;
StaticText1.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''預(yù)(銷)售''';
open;
StaticText2.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''抵押''';
open;
StaticText3.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''租賃''';
open;
StaticText4.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''預(yù)定''';
open;
StaticText5.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''預(yù)留''';
open;
StaticText6.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''拆遷還建''';
open;
StaticText7.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''未售''';
open;
StaticText8.Caption := fieldbyname('SUM1').Text;
//面積完畢
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1;
open;
StaticText37.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''預(yù)(銷)售''';
open;
StaticText9.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''抵押''';
open;
StaticText10.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''租賃''';
open;
StaticText11.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''預(yù)定''';
open;
StaticText12.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''預(yù)留''';
open;
StaticText13.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''拆遷還建''';
open;
StaticText14.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select count(合同約定建筑面積) as sum1 from 單元信息表 where '
+
wstr1 + ' and 銷售類型=''未售''';
open;
StaticText15.Caption := fieldbyname('SUM1').Text;
//套數(shù)完成
wstr1 := wstr1 + ' and 是否過期=FALSE';
sql.Text := 'select sum(成交總價) as sum1 from 單元預(yù)售表 where ' +
wstr1;
open;
StaticText16.Caption := fieldbyname('SUM1').Text;
sql.Text := 'select sum(抵押貸款額) as sum1 from 單元抵押表 where ' +
wstr1;
open;
StaticText17.Caption := fieldbyname('SUM1').Text;
sql.Text :=
'select sum(已交租金) as sum1,sum(未交租金) as sum2 from 單元租賃表 where ' +
wstr1;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -