?? unitcastpurposeunit.pas
字號(hào):
Unit UnitCastPurposeUnit;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGridEh, StdCtrls, Buttons, DB, ADODB, LbButton, AAFont,
AACtrls, DBCtrls, ExtCtrls;
Type
TUnitCastPurposeForm = Class(TForm)
GroupBox1: TGroupBox;
DBGridEh3: TDBGridEh;
GroupBox6: TGroupBox;
DBGridEH1: TDBGridEh;
LbButton1: TLbButton;
LbButton2: TLbButton;
LbButton3: TLbButton;
LbButton4: TLbButton;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
AALabel2: TAALabel;
DBText1: TDBText;
AALabel3: TAALabel;
DBText2: TDBText;
AALabel4: TAALabel;
DBText3: TDBText;
AALabel5: TAALabel;
DBText4: TDBText;
Bevel1: TBevel;
StaticText3: TStaticText;
Panel1: TPanel;
AALabel1: TAALabel;
combobox1: TComboBox;
Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
Procedure LbButton4Click(Sender: TObject);
Procedure LbButton2Click(Sender: TObject);
Procedure LbButton3Click(Sender: TObject);
Procedure FormCreate(Sender: TObject);
Procedure ComboBox1Change(Sender: TObject);
Procedure LbButton1Click(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
End;
Var
UnitCastPurposeForm: TUnitCastPurposeForm;
sItemNo : TStringlist;
Implementation
Uses DM, ViewCasterUnit;
{$R *.dfm}
Procedure TUnitCastPurposeForm.FormClose(Sender: TObject;
Var Action: TCloseAction);
Begin
sItemNo.Free;
Action := cafree;
UnitCastPurposeForm := Nil;
End;
Procedure TUnitCastPurposeForm.LbButton4Click(Sender: TObject);
Begin
Close;
End;
Procedure TUnitCastPurposeForm.LbButton2Click(Sender: TObject);
Begin
If ViewCasterForm.ADOQuery3.Active Then
If ViewCasterForm.ADOQuery3.recordcount > 0 Then
ViewCasterForm.ADOQuery3.Delete;
End;
Procedure TUnitCastPurposeForm.LbButton3Click(Sender: TObject);
Begin
ViewCasterForm.ADOQuery3.Close;
ViewCasterForm.ADOQuery3.open;
ADOQuery1.Close;
ADOQuery1.open;
End;
Procedure TUnitCastPurposeForm.FormCreate(Sender: TObject);
Var
adot : TADOQuery;
i : integer;
Begin
With ADOQuery1 Do Begin //單元表
sql.Text :=
'select 單元信息表.公司編號(hào),單元信息表.項(xiàng)目編號(hào),項(xiàng)目名稱,幢號(hào),房號(hào),合同約定建筑面積 as 建筑面積,' +
'合同約定套內(nèi)面積 AS 套內(nèi)面積,合同約定分?jǐn)偯娣e AS 分?jǐn)偯娣e,' +
'可銷售房屋狀態(tài) from 單元信息表,項(xiàng)目信息表 where 單元信息表.公司編號(hào)=''' +
ViewCasterForm.ADOQuery1.fieldbyname('公司編號(hào)').Text +
''' and 項(xiàng)目信息表.公司編號(hào)=''' +
ViewCasterForm.ADOQuery1.fieldbyname('公司編號(hào)').Text +
''' AND (銷售類型 =''未售'' or 銷售類型=''無'') AND ' +
' 項(xiàng)目信息表.項(xiàng)目編號(hào)=單元信息表.項(xiàng)目編號(hào)';
open;
End;
sItemNo := TStringlist.create;
adot := TADOQuery.create(self);
With adot Do Begin
connection := DM.DataModule2.ADOConnection1;
sql.Text := ' select * from 項(xiàng)目信息表 where 公司編號(hào)=''' + DBText1.Caption
+ '''';
open;
combobox1.Items.Clear;
For i := 0 To recordcount - 1 Do Begin
combobox1.Items.Add(fieldbyname('項(xiàng)目名稱').Text);
sItemNo.Add(fieldbyname('項(xiàng)目編號(hào)').Text);
Next;
End;
Free;
End;
combobox1.Text := combobox1.Items[0];
ComboBox1Change(self);
End;
Procedure TUnitCastPurposeForm.ComboBox1Change(Sender: TObject);
Begin
With ADOQuery1 Do Begin //單元表
sql.Text :=
'select 單元信息表.公司編號(hào),單元信息表.項(xiàng)目編號(hào),項(xiàng)目名稱,幢號(hào),房號(hào),合同約定建筑面積 as 建筑面積,' +
'合同約定套內(nèi)面積 AS 套內(nèi)面積,合同約定分?jǐn)偯娣e AS 分?jǐn)偯娣e,' +
'可銷售房屋狀態(tài) from 單元信息表,項(xiàng)目信息表 where 單元信息表.公司編號(hào)=''' +
ViewCasterForm.ADOQuery1.fieldbyname('公司編號(hào)').Text +
''' AND 項(xiàng)目信息表.公司編號(hào)=''' +
ViewCasterForm.ADOQuery1.fieldbyname('公司編號(hào)').Text +
''' AND (銷售類型 =''未售'' or 銷售類型=''無'') AND ' +
'項(xiàng)目信息表.項(xiàng)目編號(hào)=單元信息表.項(xiàng)目編號(hào) ' +
' and 單元信息表.項(xiàng)目編號(hào)=''' +
sItemNo[combobox1.Items.IndexOf(combobox1.Text)] +
''' and 項(xiàng)目信息表.項(xiàng)目編號(hào)=''' +
sItemNo[combobox1.Items.IndexOf(combobox1.Text)] + '''';
open;
End;
End;
Procedure TUnitCastPurposeForm.LbButton1Click(Sender: TObject);
Var
adotemp : TADOQuery;
Begin
If ADOQuery1.recordcount = 0 Then Exit;
adotemp := TADOQuery.create(self);
With adotemp Do Begin
connection := DM.DataModule2.ADOConnection1;
sql.Text := 'select * from 客戶意向表 where 公司編號(hào)=''' +
ADOQuery1.fieldbyname('公司編號(hào)').Text + ''' and 項(xiàng)目編號(hào)=''' +
ADOQuery1.fieldbyname('項(xiàng)目編號(hào)').Text + ''' and 幢號(hào)=''' +
ADOQuery1.fieldbyname('幢號(hào)').Text + ''' and 房號(hào)=''' +
ADOQuery1.fieldbyname('房號(hào)').Text + ''' and 客戶編號(hào)=''' +
DBText3.Caption + '''';
open;
If recordcount > 0 Then Begin
Application.MessageBox('該房屋已被列入意向表或已被該客戶選中!請(qǐng)?jiān)谖词鄯课荼碇兄匦逻x擇',
'提示', MB_ICONERROR + mb_OK + MB_SYSTEMMODAL);
Free;
Exit;
End;
Free;
End;
With ViewCasterForm.ADOQuery3 Do Begin
Append;
fieldbyname('公司編號(hào)').Text := ADOQuery1.fieldbyname('公司編號(hào)').Text;
fieldbyname('項(xiàng)目編號(hào)').Text := ADOQuery1.fieldbyname('項(xiàng)目編號(hào)').Text;
fieldbyname('幢號(hào)').Text := ADOQuery1.fieldbyname('幢號(hào)').Text;
fieldbyname('房號(hào)').Text := ADOQuery1.fieldbyname('房號(hào)').Text;
fieldbyname('客戶編號(hào)').Text := DBText3.Caption;
post;
End;
End;
End.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -