?? unitforsaleunit.pas
字號:
Unit UnitForSaleUnit;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, LbButton, DB, ADODB, StdCtrls, DBCtrls, AAFont, AACtrls,
ExtCtrls, LbSpeedButton, Grids, DBGridEh, DBCtrlsEh, Mask;
Type
TUnitForSaleForm = Class(TForm)
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
AALabel1: TAALabel;
DBText1: TDBText;
AALabel2: TAALabel;
DBText2: TDBText;
AALabel31: TAALabel;
DBText3: TDBText;
AALabel32: TAALabel;
DBText4: TDBText;
AALabel3: TAALabel;
DBText5: TDBText;
Bevel1: TBevel;
AALabel4: TAALabel;
DBText6: TDBText;
Panel2: TPanel;
Panel1: TPanel;
AALabel9: TAALabel;
AALabel5: TAALabel;
AALabel6: TAALabel;
AALabel7: TAALabel;
AALabel23: TAALabel;
AALabel24: TAALabel;
DBNumberEditEh1: TDBNumberEditEh;
DBNumberEditEh2: TDBNumberEditEh;
DBDateTimeEditEh1: TDBDateTimeEditEh;
LbButton4: TLbButton;
LbButton2: TLbButton;
DBGridEH1: TDBGridEh;
Splitter1: TSplitter;
Panel3: TPanel;
LbSpeedButton1: TLbSpeedButton;
LbSpeedButton2: TLbSpeedButton;
LbSpeedButton3: TLbSpeedButton;
LbButton1: TLbButton;
AALabel8: TAALabel;
LbSpeedButton4: TLbSpeedButton;
Procedure SetPanelVisible(bVisible: Boolean);
Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
Procedure LbButton1Click(Sender: TObject);
Procedure LbButton2Click(Sender: TObject);
Procedure LbSpeedButton1Click(Sender: TObject);
Procedure LbSpeedButton2Click(Sender: TObject);
Procedure LbSpeedButton3Click(Sender: TObject);
Procedure LbButton4Click(Sender: TObject);
Procedure FormCreate(Sender: TObject);
Procedure DBDateTimeEditEh1Exit(Sender: TObject);
Procedure DBNumberEditEh1Change(Sender: TObject);
Procedure LbSpeedButton4Click(Sender: TObject);
Procedure DBGridEh1DblClick(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
End;
Var
UnitForSaleForm : TUnitForSaleForm;
area : double;
BendLoadDB : Boolean;
Implementation
Uses DM, ViewUnitUnit, PUBFunction;
{$R *.dfm}
Procedure TUnitForSaleForm.FormClose(Sender: TObject;
Var Action: TCloseAction);
Begin
Action := cafree;
UnitForSaleForm := Nil;
End;
Procedure TUnitForSaleForm.LbButton1Click(Sender: TObject);
Begin
ViewUnitForm.ADOQuery4.edit;
ViewUnitForm.ADOQuery4.fieldbyname('合同號').AsString := '';
ViewUnitForm.ADOQuery4.post;
Close;
End;
Procedure TUnitForSaleForm.LbButton2Click(Sender: TObject);
Begin
ADOQuery1.fieldbyname('公司編號').AsString :=
DBText1.Caption;
ADOQuery1.fieldbyname('項目編號').AsString :=
DBText3.Caption;
ADOQuery1.fieldbyname('幢號').AsString :=
DBText5.Caption;
ADOQuery1.fieldbyname('房號').AsString :=
DBText6.Caption;
ADOQuery1.post;
SetPanelVisible(false);
LbSpeedButton4.click;
End;
Procedure TUnitForSaleForm.LbSpeedButton1Click(Sender: TObject);
Begin
ADOQuery1.Append;
SetPanelVisible(true);
End;
Procedure TUnitForSaleForm.LbSpeedButton2Click(Sender: TObject);
Begin
If ADOQuery1.recordcount = 0 Then Exit;
ADOQuery1.edit;
SetPanelVisible(true);
End;
Procedure TUnitForSaleForm.LbSpeedButton3Click(Sender: TObject);
Begin
If ADOQuery1.recordcount > 0 Then
ADOQuery1.Delete;
End;
Procedure TUnitForSaleForm.LbButton4Click(Sender: TObject);
Begin
ADOQuery1.Cancel;
SetPanelVisible(false);
End;
Procedure TUnitForSaleForm.FormCreate(Sender: TObject);
Begin
BendLoadDB := false;
area := ViewUnitForm.ADOQuery4.fieldbyname('合同約定建筑面積').AsFloat;
With ADOQuery1 Do Begin
sql.Text := 'select * from 單元未售表 WHERE 公司編號=''' +
DBText1.Caption + ''' and 項目編號=''' +
DBText3.Caption + ''' AND 幢號=''' +
DBText5.Caption + ''' AND 房號=''' +
DBText6.Caption +
''' ORDER BY 待售起始日期 desc';
open;
End;
SetPanelVisible(false);
BendLoadDB := true;
End;
Procedure TUnitForSaleForm.SetPanelVisible(bVisible: Boolean);
Begin
//
Panel1.Visible := bVisible;
Panel3.Visible := Not bVisible;
DBGridEH1.Enabled := Not bVisible;
End;
Procedure TUnitForSaleForm.DBDateTimeEditEh1Exit(Sender: TObject);
Begin
FixEhDTBug(DBDateTimeEditEh1);
End;
Procedure TUnitForSaleForm.DBNumberEditEh1Change(Sender: TObject);
Begin
If Not BendLoadDB Then Exit;
DBNumberEditEh2.value := area * STRTOFLOATDEF(DBNumberEditEh1.Text,
0);
End;
Procedure TUnitForSaleForm.LbSpeedButton4Click(Sender: TObject);
Var
adotemp : TADOQuery;
Begin
BendLoadDB := false;
adotemp := TADOQuery.create(self);
With adotemp Do Begin
connection := DM.DataModule2.ADOConnection1;
sql.Text := 'update 單元未售表 SET 最后定價=FALSE where 公司編號=''' +
DBText1.Caption + ''' and 項目編號=''' +
DBText3.Caption + ''' AND 幢號=''' +
DBText5.Caption + ''' AND 房號=''' +
DBText6.Caption + '''';
ExecSQL;
sql.Text := 'select * from 單元未售表 WHERE 公司編號=''' +
DBText1.Caption + ''' and 項目編號=''' +
DBText3.Caption + ''' AND 幢號=''' +
DBText5.Caption + ''' AND 房號=''' +
DBText6.Caption +
''' ORDER BY 待售起始日期 desc';
open;
edit;
fieldbyname('最后定價').AsBoolean := true;
post;
Free;
End;
With ADOQuery1 Do Begin
sql.Text := 'select * from 單元未售表 WHERE 公司編號=''' +
DBText1.Caption + ''' and 項目編號=''' +
DBText3.Caption + ''' AND 幢號=''' +
DBText5.Caption + ''' AND 房號=''' +
DBText6.Caption +
''' ORDER BY 待售起始日期 desc';
open;
End;
Application.ProcessMessages;
BendLoadDB := true;
End;
Procedure TUnitForSaleForm.DBGridEh1DblClick(Sender: TObject);
Begin
LbSpeedButton2.click;
End;
End.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -