📄 pas_houserent.~pas
字号:
cb_unit.Items.Clear;
while not dm.aq1.Eof do
begin
cb_unit.Items.Add(fields.Fields[0].asstring);
next;
end;
end;
except
end;
end;
procedure TForm_constract.selecteverythClick(Sender: TObject);
begin
try
with dm.query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractNo 合同号,ho_no 房间编号,ho_landlord 房东编号,ho_client 客户编号,ho_deputy 代理人,ho_starttime 合同开始时间,ho_leavetime 合同结束时间,ho_rent 房租,ho_rentunit 房租单位,ho_remarks 备注 from house_histry order by ho_contractno';
open;
end;
except
showmessage('查询失败');
end;
end;
procedure TForm_constract.validClick(Sender: TObject);
begin
try
with dm.query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractNo 合同号,ho_no 房间编号,ho_landlord 房东编号,ho_client 客户编号,ho_deputy 代理人,ho_starttime 合同开始时间,ho_leavetime 合同结束时间,ho_rent 房租,ho_rentunit 房租单位,ho_remarks 备注 from house_histry where ho_validorno=1';
open;
end;
except
showmessage('查询失败');
end;
end;
procedure TForm_constract.unValidClick(Sender: TObject);
begin
try
with dm.query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractNo 合同号,ho_no 房间编号,ho_landlord 房东编号,ho_client 客户编号,ho_deputy 代理人,ho_starttime 合同开始时间,ho_leavetime 合同结束时间,ho_rent 房租,ho_rentunit 房租单位,ho_remarks 备注 from house_histry where ho_validorno=0';
open;
end;
except
showmessage('查询失败');
end;
end;
procedure TForm_constract.setvalidClick(Sender: TObject);
var
s:string;
begin
with pas_dm.DM.query_houserent do
begin
if IDOK=messagebox(handle,pchar('编号为 '+dbgrid.Fields[0].AsString+' 的合同将被设为无效'),'警告', MB_OKCANCEL)
then
begin
try
s:=dbgrid.Fields[0].AsString;
Close;
SQL.Clear;
SQL.Add('update house_histry set ho_validorno=0 where ho_contractno='''+s+'''');
ExecSQL;
except
showmessage('出错');
end;
if RowsAffected=1 then
begin
showmessage(s+'设置无效成功');
end;
end;
end;
speedbutton4.Click;
end;
procedure TForm_constract.setUnvalidClick(Sender: TObject);
var
s:string;
begin
with pas_dm.DM.query_houserent do
begin
if IDOK=messagebox(handle,pchar('编号为 '+dbgrid.Fields[0].AsString+' 的合同将被设为有效'),'警告', MB_OKCANCEL)
then
begin
try
s:=dbgrid.Fields[0].AsString;
Close;
SQL.Clear;
SQL.Add('update house_histry set ho_validorno=1 where ho_contractno='''+s+'''');
ExecSQL;
except
showmessage('出错');
end;
if RowsAffected=1 then
begin
showmessage(s+'设置有效成功');
end;
end;
end;
speedbutton4.Click;
end;
procedure TForm_constract.DBGridCellClick(Column: TColumn);
begin
with pas_dm.DM.query_houserent do
begin
if dbgrid.FieldCount=0 then
begin
showmessage('没有打开数据库');
exit;
end;
if dbgrid.Fields[0].AsString='' then
begin
showmessage('数据库没有数据');
exit;
end;
if dbgrid.FieldCount>10
then
begin
edit_contractno.Text:=fields.Fields[0].AsString;
cb_ho.Text:=fields.Fields[1].AsString;
label2.caption:='房东客户编号';
cb_no.Text:=fields.Fields[2].AsString+' '+fields.Fields[3].AsString;
cb_dl.Text:=fields.Fields[4].AsString;
dtp_start.DateTime:=fields.Fields[5].AsDateTime;
dtp_end.DateTime:=fields.Fields[6].AsDateTime;
edit_rentfee.text:=fields.Fields[7].AsString;
cb_unit.Text:=fields.Fields[8].AsString;
edit_remarks.text:=fields.Fields[9].AsString;
end
else
begin
edit_contractno.Text:=fields.Fields[0].AsString;
cb_ho.Text:=fields.Fields[1].AsString;
cb_no.Text:=fields.Fields[2].AsString;
cb_dl.Text:=fields.Fields[3].AsString;
dtp_start.DateTime:=fields.Fields[4].AsDateTime;
dtp_end.DateTime:=fields.Fields[5].AsDateTime;
edit_rentfee.text:=fields.Fields[6].AsString;
cb_unit.Text:=fields.Fields[7].AsString;
edit_remarks.text:=fields.Fields[8].AsString;
end;
sb_fksj.Click;
end;
end;
procedure TForm_constract.DBGridDblClick(Sender: TObject);
var
s:string;
begin
s:='合同编号:'+dbgrid.Fields[0].AsString+#13+
'房子编号:'+dbgrid.Fields[1].AsString+#13
+dbgrid.Fields[2].AsString+#13
+dbgrid.Fields[3].AsString+#13
+dbgrid.Fields[4].AsString+#13
+dbgrid.Fields[5].AsString+#13
+dbgrid.Fields[6].AsString+#13
+dbgrid.Fields[7].AsString+#13
+dbgrid.Fields[8].AsString+#13;
if dbgrid.FieldCount>9
then
begin
s:=s+dbgrid.Fields[9].AsString;
showmessage(s);
end
else
begin
// showmessage(s);
end;
end;
procedure TForm_constract.cb_departDropDown(Sender: TObject);
var
s:string;
begin
try
with dm.gg do
begin
close;
sql.Clear;
s:='select dp_no from depart';
sql.Add(s);
open;
end;
cb_depart.Items.Clear;
while not dm.gg.Eof do
begin
cb_depart.Items.Add(dm.gg.Fields.Fields[0].AsString);
dm.gg.Next;
end;
except
showmessage('something wrong');
end;
end;
procedure TForm_constract.cb_sellerDropDown(Sender: TObject);
var
s:string;
begin
try
with dm.gg do
begin
close;
sql.Clear;
s:='select s_no from seller';
sql.Add(s);
open;
end;
cb_seller.Items.Clear;
while not dm.gg.Eof do
begin
cb_seller.Items.Add(dm.gg.Fields.Fields[0].AsString);
dm.gg.Next;
end;
except
showmessage('something wrong');
end;
end;
procedure TForm_constract.srkhClick(Sender: TObject);
begin
if rb_fd.Checked then
begin
if application.FindComponent('form_landlord')=nil then
begin
application.CreateForm(Tform_landlord,form_landlord);
end;
try
form_landlord.Show;
except
showmessage('窗口显示错误');
form_landlord.Free;
form_landlord:=nil;
end;
exit;
end;
if application.FindComponent('form_client')=nil then
begin
application.CreateForm(Tform_client,form_client);
end;
try
form_client.Show;
except
showmessage('窗口显示错误');
form_client.Free;
form_client:=nil;
end;
end;
procedure TForm_constract.srhouseClick(Sender: TObject);
begin
if application.FindComponent('form_house')=nil then
begin
application.CreateForm(Tform_house,form_house);
end;
try
form_house.Show;
except
showmessage('窗口显示错误');
form_house.Free;
form_house:=nil;
end;
end;
procedure TForm_constract.SpeedButton1Click(Sender: TObject);
begin
if application.FindComponent('form_deputy')=nil then
begin
application.CreateForm(Tform_deputy,form_deputy);
end;
try
form_deputy.Show;
except
showmessage('窗口显示错误');
form_deputy.Free;
form_deputy:=nil;
end;
end;
procedure TForm_constract.SpeedButton2Click(Sender: TObject);
begin
if application.FindComponent('form_depart')=nil then
begin
application.CreateForm(Tform_depart,form_depart);
end;
try
form_depart.Show;
except
showmessage('窗口显示错误');
form_depart.Free;
form_depart:=nil;
end;
end;
procedure TForm_constract.SpeedButton3Click(Sender: TObject);
begin
if application.FindComponent('form_seller')=nil then
begin
application.CreateForm(Tform_seller,form_seller);
end;
try
form_seller.Show;
except
showmessage('窗口显示错误');
form_seller.Free;
form_seller:=nil;
end;
end;
procedure TForm_constract.selectClick(Sender: TObject);
begin
if (edit_contractno.Text='') then
begin
showmessage('合同号码不能为空,请重输入!');
exit;
end;
if(rb_kh.Checked) then
begin
try
with dm.Query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractno 合同编号,ho_no 房子编号,ho_client 客户编号,ho_deputy 代理人编号,ho_starttime 合同开始时间,ho_leavetime 合同结束时间,ho_rent 合同租金,'+
' ho_rentunit 租金单位,ho_remarks 备注 from house_histry where ho_contractno like ''%'+
edit_contractno.Text+'%'' and ho_landlord is null order by ho_contractno';
open;
if dm.query_houserent.RecordCount=0 then
begin
showmessage('没有这个合同');
exit;
end;
edit_contractNo.Text:=fields.Fields[0].AsString;
cb_ho.Text:=fields.Fields[1].AsString;
cb_no.Text:=fields.Fields[2].AsString;
cb_dl.Text:=fields.Fields[3].AsString;
dtp_start.DateTime:=fields.Fields[4].AsDateTime;
dtp_end.DateTime:=fields.Fields[5].AsDateTime;
edit_rentfee.text:=fields.Fields[6].AsString;
cb_unit.Text:=fields.Fields[7].AsString;
edit_remarks.text:=fields.Fields[8].AsString;
end;
except
showmessage('查询失败');
end;
exit;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -