⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unitobligateunit.pas

📁 短小而实用的房地产销售管理软件
💻 PAS
字号:
Unit UnitObligateUnit;

Interface

Uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, ExtCtrls, StdCtrls, DBCtrls, AAFont, AACtrls, Grids, DBGridEh,
   DB, ADODB, LbButton, DBCtrlsEh, Mask;

Type
   TunitObligateForm = Class(TForm)
      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;
      LbButton4: TLbButton;
      LbButton2: TLbButton;
      ADOQuery1: TADOQuery;
      DataSource1: TDataSource;
      DataSource2: TDataSource;
      ADOQuery2: TADOQuery;
      DBGridEH1: TDBGridEh;
      AALabel9: TAALabel;
      AALabel5: TAALabel;
      AALabel6: TAALabel;
      AALabel7: TAALabel;
      AALabel23: TAALabel;
      AALabel24: TAALabel;
      DBNumberEditEh1: TDBNumberEditEh;
      DBNumberEditEh2: TDBNumberEditEh;
      DBDateTimeEditEh1: TDBDateTimeEditEh;
      AALabel8: TAALabel;
      AALabel10: TAALabel;
      DBDateTimeEditEh2: TDBDateTimeEditEh;
      AALabel11: TAALabel;
      DBComboBox1: TDBComboBox;
      AALabel12: TAALabel;
      Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
      Procedure LbButton4Click(Sender: TObject);
      Procedure LbButton2Click(Sender: TObject);
      Procedure DBDateTimeEditEh1Exit(Sender: TObject);
      Procedure DBDateTimeEditEh2Exit(Sender: TObject);
      Procedure DBComboBox1Change(Sender: TObject);
      Procedure FormCreate(Sender: TObject);
      Procedure FormShow(Sender: TObject);
      Procedure DBNumberEditEh1Change(Sender: TObject);
   Private
    { Private declarations }
   Public
    { Public declarations }
   End;

Var
   unitObligateForm : TunitObligateForm;
   area             : double;
Implementation
Uses DM, ViewUnitUnit, PUBFunction;
{$R *.dfm}

Procedure TunitObligateForm.FormClose(Sender: TObject;
   Var Action: TCloseAction);
Begin
   Action := cafree;
   unitObligateForm := Nil;
End;

Procedure TunitObligateForm.LbButton4Click(Sender: TObject);
Begin
   ADOQuery1.Cancel;
   Close;
End;

Procedure TunitObligateForm.LbButton2Click(Sender: TObject);
Begin
   ADOQuery1.fieldbyname('公司编号').AsString :=
      DBText1.Caption;
   ADOQuery1.fieldbyname('项目编号').AsString :=
      DBText3.Caption;
   ADOQuery1.fieldbyname('幢号').AsString :=
      DBText5.Caption;
   ADOQuery1.fieldbyname('房号').AsString :=
      DBText6.Caption;
   ViewUnitForm.ADOQuery4.edit;
   ViewUnitForm.ADOQuery4.fieldbyname('客户编号').AsString :=
      DBComboBox1.Text;
   ViewUnitForm.ADOQuery4.fieldbyname('合同号').AsString := '';
   ViewUnitForm.ADOQuery4.post;
   ADOQuery1.post;
   Close;
End;

Procedure TunitObligateForm.DBDateTimeEditEh1Exit(Sender: TObject);
Begin
   PUBFunction.FixEhDTBug(DBDateTimeEditEh1);
End;

Procedure TunitObligateForm.DBDateTimeEditEh2Exit(Sender: TObject);
Begin
   PUBFunction.FixEhDTBug(DBDateTimeEditEh2);
End;

Procedure TunitObligateForm.DBComboBox1Change(Sender: TObject);
Begin
   With ADOQuery2 Do Begin
      Close;
      sql.Text := 'select * from 客户信息表 WHERE 公司编号=''' +
         DBText1.Caption + ''' AND 客户编号=''' +
         DBComboBox1.Text + '''';
      open;

   End;

End;

Procedure TunitObligateForm.FormCreate(Sender: TObject);
Var
   adoK             : TADOQuery;
   i                : integer;
Begin
   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
         DBComboBox1.Items.Add(fieldbyname('客户编号').Text);
         Next;
      End;

      Free;
   End;

End;

Procedure TunitObligateForm.FormShow(Sender: TObject);
Begin
   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);
//  ShowMessage(IntToStr(ADOQuery1.RECORDCOUNT));
End;

Procedure TunitObligateForm.DBNumberEditEh1Change(Sender: TObject);
Begin
   If ADOQuery1.Active Then
      DBNumberEditEh2.value := area * STRTOFLOATDEF(DBNumberEditEh1.Text,
         0);
End;

End.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -