📄 pas_househistry.pas
字号:
unit pas_houseHistry;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls, StdCtrls, Buttons;
type
TForm_houseHistry = class(TForm)
PC: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
TabSheet6: TTabSheet;
dtp2: TDateTimePicker;
dtp1: TDateTimePicker;
select: TSpeedButton;
Label3: TLabel;
Label2: TLabel;
Label1: TLabel;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
DBGrid4: TDBGrid;
DBGrid5: TDBGrid;
DBGrid6: TDBGrid;
cb_ho: TComboBox;
procedure FormActivate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure PCChange(Sender: TObject);
procedure cb_hoDropDown(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_houseHistry: TForm_houseHistry;
implementation
uses pas_dm;
{$R *.dfm}
procedure TForm_houseHistry.FormActivate(Sender: TObject);
begin
dtp1.DateTime:=now();
dtp2.DateTime:=now();
end;
procedure TForm_houseHistry.BitBtn1Click(Sender: TObject);
var
s:string;
begin
if cb_ho.Text='' then
begin
showmessage('房间编码不能为空');
exit;
end;
try
with dm.Query_househistry do
begin
close;
sql.Clear;
s:=' select ho_no as 房子编号,'+
' ho_contractno as 合同编号,'+
' ho_landlord 房东名称 ,'+
' ho_client 客户名称 ,'+
' isnull(ho_deputy,'' '') as 代理人编号,'+
' ho_starttime as 签合同日期,'+
' ho_leavetime as 合同结束日期,'+
' ho_releasetime as 合同解除日期,'+
' ho_rent as 租金,'+
' ho_rentunit as 租金单位,'+
' ho_rentorno as 是否已租,'+
' ho_operator as 操作人,'+
' ho_now as 操作时间,'+
' ho_remarks as 备注'+
' from house_histry '+
' where ho_no='''+trim(cb_ho.Text)+''' and DATEDIFF(day,ho_now,'''+
datetostr(dtp1.DateTime)+''')<=0 and DATEDIFF(day,ho_now,'''+
datetostr(dtp2.DateTime)+''')>=0 ';
sql.Add(s);
open;
end;
except
end;
end;
procedure TForm_houseHistry.PCChange(Sender: TObject);
begin
if pc.ActivePage=tabsheet1 then
begin
try
with dm.Query_househistry do
begin
close;
sql.clear;
sql.Add(' select h_no 房子编号,h_addr 房子地址,'+
' h_area 所属区域,h_ht 户型,h_landlord 房东,'+
' h_tel 电话,h_rent 参考房租,h_rentunit 租金单位,'+
' h_remarks 备注 from house where h_validorno=1');
open;
end;
except
showmessage('查询失败');
end;
end;
if pc.ActivePage=TabSheet2 then
begin
try
with dm.Query_househistry do
begin
close;
sql.clear;
sql.Text:= 'select h_no 房子编号,h_addr 房子地址,'+
' h_area 所属区域,h_ht 户型,h_landlord 房东,'+
' h_tel 电话,h_rent 参考房租,h_rentunit 租金单位,'+
' h_remarks 备注 from house where h_validorno=1 and h_sign=0'
end;
except
showmessage('查询失败');
end;
end;
if pc.ActivePage=TabSheet3 then
begin
try
with dm.Query_househistry do
begin
close;
sql.clear;
sql.Text:= 'select h_no 房子编号,h_addr 房子地址,'+
' h_area 所属区域,h_ht 户型,h_landlord 房东,'+
' h_tel 电话,h_rent 参考房租,h_rentunit 租金单位,'+
' h_remarks 备注 from house where h_validorno=1 and h_sign=1';
open;
end;
except
showmessage('查询失败');
end;
end;
if pc.ActivePage=TabSheet5 then
begin
try
with dm.Query_househistry do
begin
close;
sql.clear;
sql.Text:= 'select h_no 房子编号,h_addr 房子地址,'+
' h_area 所属区域,h_ht 户型,h_landlord 房东,'+
' h_tel 电话,h_rent 参考房租,h_rentunit 租金单位,'+
' h_remarks 备注 from house where h_validorno=0 ';
open;
end;
except
showmessage('查询失败');
end;
end;
if pc.ActivePage=TabSheet6 then
begin
try
with dm.Query_househistry do
begin
close;
sql.clear;
sql.Text:= 'select h_no 房子编号,h_addr 房子地址,'+
' h_area 所属区域,h_ht 户型,h_landlord 房东,'+
' h_tel 电话,h_rent 参考房租,h_rentunit 租金单位,'+
' h_remarks 备注 from house ';
open;
end;
except
showmessage('查询失败');
end;
end;
end;
procedure TForm_houseHistry.cb_hoDropDown(Sender: TObject);
var
s:string;
begin
try
with dm.query_houserent do
begin
close;
sql.Clear;
s:='select h_no from house ';
sql.Add(s);
open;
cb_ho.Items.Clear;
while not dm.query_houserent.Eof do
begin
cb_ho.Items.Add(fields.Fields[0].asstring);
next;
end;
end;
except
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -