📄 unitsellunit.pas
字号:
ADOQuery1.fieldbyname('项目编号').AsString :=
DBText3.Caption;
ADOQuery1.fieldbyname('幢号').AsString :=
DBText5.Caption;
ADOQuery1.fieldbyname('房号').AsString :=
DBText6.Caption;
ADOQuery1.post;
ViewUnitForm.ADOQuery4.edit;
ViewUnitForm.ADOQuery4.fieldbyname('客户编号').AsString :=
DBComboBox2.Text;
ViewUnitForm.ADOQuery4.fieldbyname('合同号').AsString :=
DBEdit1.Text;
ViewUnitForm.ADOQuery4.post;
Close;
End;
Procedure TUnitSellForm.DBDateTimeEditEh1Exit(Sender: TObject);
Begin
PUBFunction.FixEhDTBug(DBDateTimeEditEh1);
End;
Procedure TUnitSellForm.DBDateTimeEditEh2Exit(Sender: TObject);
Begin
PUBFunction.FixEhDTBug(DBDateTimeEditEh2);
End;
Procedure TUnitSellForm.DBDateTimeEditEh3Exit(Sender: TObject);
Begin
PUBFunction.FixEhDTBug(DBDateTimeEditEh3);
End;
Procedure TUnitSellForm.DBDateTimeEditEh4Exit(Sender: TObject);
Begin
PUBFunction.FixEhDTBug(DBDateTimeEditEh4);
End;
Procedure TUnitSellForm.DBDateTimeEditEh5Exit(Sender: TObject);
Begin
PUBFunction.FixEhDTBug(DBDateTimeEditEh5);
End;
Procedure TUnitSellForm.FormCreate(Sender: TObject);
Var
adoK : TADOQuery;
i : integer;
Begin
BendLoadDB := false;
area := ViewUnitForm.ADOQuery4.fieldbyname('合同约定建筑面积').AsFloat;
adoK := TADOQuery.create(self);
With adoK Do Begin
connection := DM.DataModule2.ADOConnection1;
sql.Text := 'select 客户编号 from 客户信息表 WHERE 公司编号=''' +
DBText1.Caption + '''';
open;
For i := 0 To recordcount - 1 Do Begin
DBComboBox2.Items.Add(fieldbyname('客户编号').Text);
Next;
End;
Free;
End;
End;
Procedure TUnitSellForm.DBComboBox2Change(Sender: TObject);
Begin
With ADOQuery2 Do Begin
Close;
sql.Text := 'select * from 客户信息表 WHERE 公司编号=''' +
DBText1.Caption + ''' AND 客户编号=''' +
DBComboBox2.Text + '''';
open;
End;
End;
Procedure TUnitSellForm.FormShow(Sender: TObject);
Begin
BendLoadDB := false;
With ADOQuery1 Do Begin
sql.Text := 'select * from 单元预售表 WHERE 公司编号=''' +
DBText1.Caption + ''' and 项目编号=''' +
DBText3.Caption + ''' and 幢号=''' +
DBText5.Caption + ''' AND 房号=''' +
DBText6.Caption + '''';
open;
If recordcount > 0 Then
ADOQuery1.edit
Else
ADOQuery1.Append;
End;
DBComboBox1Change(self);
DBComboBox2Change(self);
Application.ProcessMessages;
BendLoadDB := true;
DBNumberEditEh5Change(self);
DBNumberEditEh9Change(self);
End;
Procedure TUnitSellForm.DBNumberEditEh1Change(Sender: TObject);
Begin
If Not BendLoadDB Then Exit;
DBNumberEditEh2.value := area * STRTOFLOATDEF(DBNumberEditEh1.Text,
0);
End;
Procedure TUnitSellForm.DBNumberEditEh3Change(Sender: TObject);
Begin
If Not BendLoadDB Then Exit;
DBNumberEditEh4.value := area * STRTOFLOATDEF(DBNumberEditEh3.Text,
0);
End;
Procedure TUnitSellForm.LbButton1Click(Sender: TObject);
Var
ADOFS : TADOQuery;
Begin
ADOFS := TADOQuery.create(self);
With ADOFS Do Begin
connection := DM.DataModule2.ADOConnection1;
sql.Text := 'SELECT * FROM 单元未售表 WHERE 公司编号=''' +
DBText1.Caption + ''' AND 项目编号=''' +
DBText3.Caption + ''' and 幢号=''' +
DBText5.Caption + ''' AND 房号=''' +
DBText6.Caption + ''' ORDER BY 待售起始日期 DESC';
open;
If fieldbyname('待售单价').AsFloat <> 0 Then
DBNumberEditEh1.value := fieldbyname('待售单价').AsFloat;
Free;
End;
End;
Procedure TUnitSellForm.DBComboBox1Change(Sender: TObject);
Begin
Case DBComboBox1.Items.IndexOf(DBComboBox1.Text) Of
0: Begin
Panel2.Visible := false;
Panel3.Visible := false;
End;
1: Begin //分期
Panel3.Visible := true;
Panel2.Visible := false;
End;
2: Begin
Panel3.Visible := false;
Panel2.Visible := true;
End;
End;
Panel1.Visible := true;
End;
Procedure TUnitSellForm.DBNumberEditEh17Change(Sender: TObject);
Begin
If Not BendLoadDB Then Exit;
DBNumberEditEh18.value := area * STRTOFLOATDEF(DBNumberEditEh17.Text,
0);
End;
Procedure TUnitSellForm.DBNumberEditEh5Change(Sender: TObject);
Var
T, a, b, c, D : double;
Begin
If Not BendLoadDB Then Exit;
T := STRTOFLOATDEF(DBText9.Caption, 0);
If T = 0 Then Exit;
a := STRTOFLOATDEF(DBNumberEditEh5.Text, 0);
b := STRTOFLOATDEF(DBNumberEditEh6.Text, 0);
c := STRTOFLOATDEF(DBNumberEditEh7.Text, 0);
D := STRTOFLOATDEF(DBNumberEditEh8.Text, 0);
DBNumberEditEh20.value := T - (a + b + c + D);
End;
Procedure TUnitSellForm.DBNumberEditEh9Change(Sender: TObject);
Var
T, a, b, c, D : double;
Begin
If Not BendLoadDB Then Exit;
T := STRTOFLOATDEF(DBText9.Caption, 0);
If T = 0 Then Exit;
a := STRTOFLOATDEF(DBNumberEditEh9.Text, 0);
b := STRTOFLOATDEF(DBNumberEditEh10.Text, 0);
c := STRTOFLOATDEF(DBNumberEditEh11.Text, 0);
D := STRTOFLOATDEF(DBNumberEditEh12.Text, 0);
DBNumberEditEh21.value := a + b + c + D;
DBNumberEditEh22.value := T - (a + b + c + D);
End;
Procedure TUnitSellForm.TabSheet3Show(Sender: TObject);
Begin
DBNumberEditEh5Change(self);
DBNumberEditEh9Change(self);
End;
Procedure TUnitSellForm.DBNumberEditEh25Change(Sender: TObject);
Var
total, a, b, CS : double;
Begin
If Not BendLoadDB Then Exit;
CS := STRTOFLOATDEF(DBNumberEditEh25.Text, 0);
If (CS < 0) Or (CS > 9) Then Begin
Application.MessageBox('成数必须是1到9 之间的实数!请重新输入!',
'警告!',
MB_ICONERROR);
DBNumberEditEh25.SetFocus;
Exit;
End;
total := STRTOFLOATDEF(DBText7.Caption, 0);
If total = 0 Then Exit;
b := total * CS * 0.1;
a := total - b;
DBNumberEditEh13.value := a;
DBNumberEditEh14.value := b;
End;
Procedure TUnitSellForm.DBNumberEditEh19Change(Sender: TObject);
Var
total, a, b, CS : double;
Begin
If Not BendLoadDB Then Exit;
CS := STRTOFLOATDEF(DBNumberEditEh19.Text, 0);
If (CS < 0) Or (CS > 9) Then Begin
Application.MessageBox('成数必须是1到9 之间的实数!请重新输入!',
'警告!',
MB_ICONERROR);
DBNumberEditEh19.SetFocus;
Exit;
End;
total := STRTOFLOATDEF(DBText8.Caption, 0);
If total = 0 Then Exit;
b := total * CS * 0.1;
a := total - b;
DBNumberEditEh15.value := a;
DBNumberEditEh16.value := b;
End;
Procedure TUnitSellForm.LbButton3Click(Sender: TObject);
Var
lt, ly, lm : integer;
Begin
lt := StrToIntDef(DBNumberEditEh23.Text, 0);
ly := lt Div 12;
lm := lt Mod 12;
AALabel118.Caption := IntToStr(ly) + '年' + IntToStr(lm) + '月';
If StrToDateDef(DBDateTimeEditEh14.Text, 0) = 0 Then Exit;
DBDateTimeEditEh15.Text := FormatDateTime('yyyy-mm-dd',
PUBFunction.GetNextMonths(
tdatetime(DBDateTimeEditEh14.value), lt));
End;
Procedure TUnitSellForm.LbButton5Click(Sender: TObject);
Var
lt, ly, lm : integer;
Begin
lt := StrToIntDef(DBNumberEditEh24.Text, 0);
ly := lt Div 12;
lm := lt Mod 12;
AALabel121.Caption := IntToStr(ly) + '年' + IntToStr(lm) + '月';
If StrToDateDef(DBDateTimeEditEh16.Text, 0) = 0 Then Exit;
DBDateTimeEditEh17.Text := FormatDateTime('yyyy-mm-dd',
PUBFunction.GetNextMonths(
tdatetime(DBDateTimeEditEh16.value), lt));
End;
Procedure TUnitSellForm.DBNumberEditEh23Change(Sender: TObject);
Var
lt, ly, lm : integer;
Begin
lt := StrToIntDef(DBNumberEditEh23.Text, 0);
ly := lt Div 12;
lm := lt Mod 12;
AALabel118.Caption := IntToStr(ly) + '年' + IntToStr(lm) + '月';
End;
Procedure TUnitSellForm.DBNumberEditEh24Change(Sender: TObject);
Var
lt, ly, lm : integer;
Begin
lt := StrToIntDef(DBNumberEditEh24.Text, 0);
ly := lt Div 12;
lm := lt Mod 12;
AALabel121.Caption := IntToStr(ly) + '年' + IntToStr(lm) + '月';
End;
End.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -