📄 srzrsunit.pas
字号:
unit srzrsunit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, ExtCtrls, StdCtrls, Spin;
type
Tsrzrsform = class(TForm)
Label1: TLabel;
zdrmno: TEdit;
Button1: TButton;
Button2: TButton;
Bevel1: TBevel;
q1: TQuery;
rmmoney: TSpinEdit;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure zdrmnoDblClick(Sender: TObject);
procedure zdrmnoExit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
srzrsform: Tsrzrsform;
implementation
uses dataproc, xgft, zdznozd;
{$R *.DFM}
procedure Tsrzrsform.FormCreate(Sender: TObject);
begin
zdrmno.text:='';
end;
procedure Tsrzrsform.Button1Click(Sender: TObject);
begin
if rmmoney.Value=0 then
begin
showmessage('房价错误');
rmmoney.setfocus;
exit;
end;
if messagedlg('房价正确吗?',mtInformation, [mbYes, mbNo], 0) = mrno then
exit;
if length(trim(zdrmno.text))>0 then
begin
q1.Active :=false;
q1.sql.clear; // (truntime=:pzd) and (isbj=:pbj)');
q1.sql.add('select handno from nowin where (handno=:phandno) and (truntime<>24)');
q1.ParamByName ('phandno').asstring:=trim(zdrmno.text);
// q1.parambyname('pzd').asboolean:=true;
// q1.parambyname('pbj').asboolean:=true;
q1.Prepare;
q1.open;
q1.active:=true;
if q1.RecordCount =0 then
begin
showmessage('房间错误');
zdrmno.setfocus;
exit;
end
else
begin
q1.Active :=false;
q1.sql.clear;
q1.sql.add('update nowin set istime=:pnozd,truntime=24,roomprice=:pprice where (handno=:phd)');
q1.parambyname('pnozd').asboolean:=false;
q1.ParamByName ('phd').asstring:=trim(zdrmno.text);;
q1.ParamByName ('pprice').asinteger:=rmmoney.Value;
q1.Prepare;
q1.ExecSQL;
q1.Active :=false;
showmessage('转为二十四小时房成功');
zdrmno.text:='';
zdrmno.setfocus;
end;
end;
end;
procedure Tsrzrsform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
q1.free;
end;
procedure Tsrzrsform.Button2Click(Sender: TObject);
begin
srzrsform.close;
end;
procedure Tsrzrsform.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=112 then
begin
if xt=0 then help(16);
end;
if key=13 then
selectnext(activecontrol,true,true);
if key=27 then
srzrsform.close;
end;
procedure Tsrzrsform.zdrmnoDblClick(Sender: TObject);
begin
Application.CreateForm(Txgftform, xgftform);
xgftform.Caption:='';
xgftform.Button2.Visible:=false;
xgftform.Timer1.Free;
xgftform.showmodal;
zdrmno.text:=xgftform.xgrmno.Text;
xgftform.Free;
activecontrol:=Button1;
end;
procedure Tsrzrsform.zdrmnoExit(Sender: TObject);
var aa:array[0..1] of string;
begin
if trim(zdrmno.text)<>'' then
begin
getvalue(aa,'select truntime from nowin where roomno='''+zdrmno.text+'''');
if trim(aa[0])='24' then
begin
showmessage(zdrmno.text+'房间已经是二十四小时房');
zdrmno.text:='';
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -