📄 pas_houserent.pas
字号:
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;
if(rb_fd.Checked) then
begin
try
with dm.Query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractno 合同编号,ho_no 房子编号,ho_landlord 房东编号,ho_deputy 代理人编号,ho_starttime 开始时间,ho_leavetime 结束时间,ho_rent 租金,ho_rentunit 租金单位,ho_remarks 备注 from house_histry where ho_contractno like ''%'+
edit_contractno.Text+'%'' and ho_client is null';
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;
end;
procedure TForm_constract.SpeedButton4Click(Sender: TObject);
begin
try
with dm.Query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractno 合同编号,ho_no 房子编号,isNULL(ho_landlord,ho_client) 房东或者客户编号,ho_deputy 代理人编号,ho_starttime 开始时间,'+
'ho_leavetime 结束时间,ho_rent 租金,'+
'ho_rentunit 租金单位,ho_remarks 备注 ,ho_validorno 有无效 from house_histry where ho_no like ''%'+
trim(cb_ho.Text)+'%'' order by ho_autono';
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;
end;
procedure TForm_constract.SpeedButton6Click(Sender: TObject);
begin
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 备注,ho_validorno 有无效 from house_histry where ho_depart like ''%'+
cb_depart.Text+'%'' and ho_landlord is null and ho_validorno=1 order by ho_autono';
open;
if dm.query_houserent.RecordCount=0 then
begin
showmessage('没有这个合同');
exit;
end;
end;
except
showmessage('查询失败');
end;
end;
if(rb_fd.Checked) then
begin
try
with dm.Query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractno 合同编号,ho_no 房子编号,ho_landlord 房东编号,'+
'ho_deputy 代理人编号,ho_starttime 开始时间,ho_leavetime 结束时间,ho_rent 租金,'+
' ho_rentunit 租金单位,ho_remarks 备注,ho_validorno 有无效 from house_histry where ho_depart like ''%'+
cb_depart.Text+'%'' and ho_client is null and ho_validorno=1 order by ho_autono';
open;
if dm.query_houserent.RecordCount=0 then
begin
showmessage('没有这个合同');
exit;
end;
end;
except
showmessage('查询失败');
end;
end;
end;
procedure TForm_constract.sb_fksjClick(Sender: TObject);
var
s:string;
begin
if edit_contractNo.Text='' then
begin
showmessage('合同号不能为空');
exit;
end;
with pas_dm.DM.AQ1 do
begin
close;
sql.Clear;
s:='select hi_cno 合同编号,hi_times 付款次数,hi_fktime 付款时间,hi_fkorno 付款没有,hi_days 提前天数 from hint where hi_cno='''+trim(edit_contractNO.text)+'''';
sql.Add(s);
open;
if dm.AQ1.RecordCount = 0 then
begin
showmessage('这个合同的付款时间未设置');
exit;
end;
end;
end;
procedure TForm_constract.Edit_timesKeyPress(Sender: TObject; var Key: Char);
var
s:string;
begin
if key<>#13 then exit;
if edit_contractNo.Text='' then
begin
showmessage('合同号不能为空');
exit;
end;
try
strtoint(Edit_times.text);
except
end;
if IDOK=messagebox(handle,pchar('确定'+edit_contractNo.Text+'合同是要付款 '+Edit_times.Text+' 次吗???'),'警告', MB_OKCANCEL) then
begin
if edit_contractNo.Text='' then
begin
showmessage('合同号不能为空');
exit;
end;
with pas_dm.DM.AQ1 do
begin
close;
sql.Clear;
s:='select ho_contractno 合同编号 from house_histry where ho_contractno='''+trim(edit_contractNo.text)+'''';
sql.Add(s);
open;
if dm.AQ1.RecordCount = 0 then
begin
showmessage('没有合同号');
exit;
end;
if application.FindComponent('Form_inputtime')=nil then
begin
application.CreateForm(TForm_inputtime,Form_inputtime);
end;
try
Form_inputtime.ShowModal;
except
showmessage('窗口显示错误');
Form_inputtime.Free;
Form_inputtime:=nil;
end;
end;
end;
end;
procedure TForm_constract.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_F1 then
begin
speedbutton4.Click;
Key := 0;
exit;
end;
if Key = VK_F2 then
begin
speedbutton5.Click;
Key := 0;
exit;
end;
if Key = VK_F3 then
begin
speedbutton6.Click;
Key := 0;
exit;
end;
if Key = VK_F4 then
begin
add.Click;
Key := 0;
exit;
end;
end;
procedure TForm_constract.SpeedButton5Click(Sender: TObject);
begin
try
with dm.Query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractno 合同编号,ho_no 房子编号,isNULL(ho_landlord,ho_client) 房东或者客户编号,ho_deputy 代理人编号,ho_starttime 开始时间,ho_leavetime 结束时间,ho_rent 租金,ho_rentunit 租金单位,ho_remarks 备注,ho_validorno 有无效'+
' from house_histry where ho_landlord like ''%'+
cb_no.Text+'%'' or ho_client like ''%'+cb_no.Text+'%'' order by ho_autono';
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;
end;
procedure TForm_constract.sp_noTClick(Sender: TObject);
begin
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 not in (select hi_cno from hint) and ho_landlord is null order by ho_autono';
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;
if(rb_fd.Checked) then
begin
try
with dm.Query_houserent do
begin
close;
sql.clear;
sql.Text:='select ho_contractno 合同编号,ho_no 房子编号,ho_landlord 房东编号,ho_deputy 代理人编号,ho_starttime 开始时间,ho_leavetime 结束时间,ho_rent 租金,ho_rentunit 租金单位,ho_remarks 备注 '+
' from house_histry where ho_contractno not in (select hi_cno from hint)and ho_client is null';
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;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -