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

📄 pas_payhint.~pas

📁 比较详细的功能
💻 ~PAS
字号:
unit pas_payHint;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, StdCtrls, Buttons, ComCtrls, ToolWin;

type
  TForm_payhint = class(TForm)
    DBGrid1: TDBGrid;
    ToolBar1: TToolBar;
    selectclient: TSpeedButton;
    ToolButton5: TToolButton;
    selectLandlord: TSpeedButton;
    dtp_selecttime: TDateTimePicker;
    Label6: TLabel;
    cb_depart: TComboBox;
    Label1: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure selectclientClick(Sender: TObject);
    procedure selectLandlordClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cb_departDropDown(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form_payhint: TForm_payhint;

implementation
   uses pas_dm2, Pas_DM;
{$R *.dfm}

procedure TForm_payhint.BitBtn1Click(Sender: TObject);
begin
  close;
end; 

procedure TForm_payhint.selectclientClick(Sender: TObject);
var
   s:string;
begin
   try
     with dm2.query_payhint do
     begin 
       close;
       sql.Clear;
       s:=' select ho_contractno as 合同编号,'+
          ' 客户名称 =(select c_name from client where c_no=ho_client) ,'+
          ' ho_no as 房屋编号,'+
          ' ho_starttime as 合同生效时间,'+
          ' hi_fktime as 付款时间,'+
          ' hi_times as 第几次,'+
          ' hi_days as  提前天数,'+
          ' ho_rent as 租金,'+
          ' ho_rentunit as 租金单位'+
          ' from house_histry,hint'+
          ' where abs(datediff(day,hi_fktime,'''+datetostr(dtp_selecttime.DateTime)+'''))<=hi_days '+
          ' and hi_fkorno=0'+
          ' and ho_client is not null'+
          ' and ho_contractno=hi_cno'+
          ' and ho_depart like ''%'+cb_depart.Text+'%'''+
          ' and ho_validorno=1'+
          ' union '+
          ' select ho_contractno as 合同编号,'+
          ' 客户名称 =(select c_name from client where c_no=ho_client) ,'+
          ' ho_no as 房屋编号,'+
          ' ho_starttime as 合同生效时间,'+
          ' hi_fktime as 付款时间,'+
          ' hi_times as 第几次,'+
          ' hi_days as  提前天数,'+
          ' ho_rent as 租金,'+
          ' ho_rentunit as 租金单位'+

          ' from house_histry,hint'+
          ' where datediff(day,hi_fktime,'''+datetostr(dtp_selecttime.DateTime)+''')>=0 '+
          ' and hi_fkorno=0'+
          ' and ho_client is not null'+
          ' and ho_depart like ''%'+cb_depart.Text+'%'''+
          ' and ho_contractno=hi_cno'+
          ' and ho_validorno=1';
       sql.Add(s);
       open;
       end;

   except
      showmessage('查询失败!');
   end;
end;

procedure TForm_payhint.selectLandlordClick(Sender: TObject);
var
   s:string;
begin
   try
     with dm2.query_payhint do
     begin 
       close;
       sql.Clear;
         //筛选出这段时间应该提示的房子
       s:=' select ho_contractno as 合同编号,'+
          ' 房东名称 =(select l_name from landlord where l_no=ho_landlord) ,'+
          ' ho_no as 房屋编号,'+
          ' ho_starttime as 合同生效时间,'+
          ' hi_fktime as 付款时间,'+
          ' hi_times as 第几次,'+
          ' hi_days as  提前天数,'+
          ' ho_rent as 租金,'+
          ' ho_rentunit as 租金单位'+

          ' from house_histry,hint'+
          ' where abs(datediff(day,hi_fktime,'''+datetostr(dtp_selecttime.DateTime)+'''))<=hi_days '+
          ' and hi_fkorno=0'+
          ' and ho_landlord is not null'+
          ' and ho_contractno=hi_cno'+
          ' and ho_depart like ''%'+cb_depart.Text+'%'''+
          ' and ho_validorno=1'+
          ' union '+
          //筛选出当天之前所有没有交的房租
          ' select ho_contractno as 合同编号,'+
          ' 房东名称 =(select l_name from landlord where l_no=ho_landlord) ,'+
          ' ho_no as 房屋编号,'+
          ' ho_starttime as 合同生效时间,'+
          ' hi_fktime as 付款时间,'+
          ' hi_times as 第几次,'+
          ' hi_days as  提前天数,'+
          ' ho_rent as 租金,'+
          ' ho_rentunit as 租金单位'+      
          ' from house_histry,hint'+
          ' where datediff(day,hi_fktime,'''+datetostr(dtp_selecttime.DateTime)+''')>=0 '+
          ' and hi_fkorno=0'+
          ' and ho_landlord is not null'+
          ' and ho_contractno=hi_cno'+
          ' and ho_depart like ''%'+cb_depart.Text+'%'''+
          ' and ho_validorno=1';
       sql.Add(s);
       open;
       end;

   except
      showmessage('查询失败!');
   end;
end;

procedure TForm_payhint.FormShow(Sender: TObject);
begin
  dtp_selecttime.DateTime:=now();
end;

procedure TForm_payhint.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 
    if   Key   =   VK_F1   then
      begin
          selectclient.Click;
          Key   :=   0;
          exit;
      end;
      
    if   Key   =   VK_F2   then
      begin
          selectlandlord.Click;
          Key   :=   0;
          exit;
      end;
end;

procedure TForm_payhint.cb_departDropDown(Sender: TObject);
var
s:string;
  begin
  try
  with dm.query_houserent do
  begin
    close;
    sql.Clear;
    s:='select dp_no from depart';
    sql.Add(s);
    open;
  end;
   cb_depart.Items.Clear;
    while not dm.query_houserent.Eof do
    begin
      cb_depart.Items.Add(dm.query_houserent.Fields.Fields[0].AsString);
      dm.query_houserent.Next;
      end;
  except
    showmessage('something wrong');
  end;
end;

end.


⌨️ 快捷键说明

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