📄 unitbebarrange.pas
字号:
unit unitBebArrange;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ToolWin, ComCtrls, ExtCtrls, StdCtrls, ImgList, DB, ADODB,
Buttons;
type
TfrmBedArrange = class(TForm)
CoolBar1: TCoolBar;
StatusBar1: TStatusBar;
Panel1: TPanel;
Splitter1: TSplitter;
Panel2: TPanel;
Panel3: TPanel;
Splitter2: TSplitter;
Panel4: TPanel;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
lvwBed: TListView;
BedImages: TImageList;
ADOQuery: TADOQuery;
Memo1: TMemo;
Panel5: TPanel;
Splitter3: TSplitter;
Panel6: TPanel;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
Image1: TImage;
Image2: TImage;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
edtXM: TEdit;
edtSex: TEdit;
edtNation: TEdit;
edtBirth: TEdit;
edtPhone: TEdit;
edtAddress: TEdit;
edtIDNo: TEdit;
edtRegistdate: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
ADOCmd: TADOCommand;
ADOStored: TADOStoredProc;
Edit1: TEdit;
ADOSetBed: TADOQuery;
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
private
StrCon:string; //连接字符串connectionstring
clientid:string; //当前要安排的客人编号
//IdenNO:string; //房间编号的程序ID
{ Private declarations }
public
CurrNo:string; //房间编号
{ Public declarations }
end;
var
frmBedArrange: TfrmBedArrange;
implementation
uses UnitRegist, UnitMain, UnitRoomQuery;
{$R *.dfm}
procedure TfrmBedArrange.ToolButton2Click(Sender: TObject);
begin
application.CreateForm(TfrmRegist,frmRegist);
frmRegist.Show;
end;
procedure TfrmBedArrange.ToolButton6Click(Sender: TObject);
begin
frmBedArrange.Close;
end;
procedure TfrmBedArrange.FormCreate(Sender: TObject);
begin
frmMain.ReadINI ;
StrCon:=frmMain.strCon ;
clientid:=frmMain.clientid;
end;
procedure TfrmBedArrange.ToolButton3Click(Sender: TObject);
var
xx:TListItem;
begin
adoquery.Close;
adoquery.ConnectionString:=strCon;
adoquery.SQL.Clear;
adoquery.SQL.Add('execute ListBedStatus '''+CurrNo+'''');
adoquery.Open ;
while not adoquery.Eof do
begin
xx:=lvwbed.Items.Add ;
xx.Caption:=adoquery.Fields[0].AsString ;
xx.ImageIndex:=adoquery.FieldValues['bed_status'] ;
adoquery.Next;
end;
end;
procedure TfrmBedArrange.ToolButton4Click(Sender: TObject);
var
//xx:Tparameter;
xx:string;
begin
xx:='8713063';
adoquery.Close;
adoquery.SQl.Clear ;
adoquery.SQL.Add('execute protest :xx ');
adoquery.Parameters.ParamByName('xx').Value:=xx;
//adoquery.Parameters.Clear ;
adoquery.ConnectionString:=strcon;
//showmessage(strCon);
//xx:=adoquery.Parameters.AddParameter;
//xx.Name:=name;
//xx.Value :='winsometig';
//xx.DataType:=ftfixedchar;
//xx.Direction:=pdinput;
//xx.Size:=10;
adoquery.open;
showmessage(adoquery.Fields[0].asstring) ;
adoquery.close;
end;
procedure TfrmBedArrange.FormShow(Sender: TObject);
var
strSmt:string;
begin
if ClientID<>'NONE' then //Show current client information
begin
strSmt:='select custom_name,b.Sex_name,c.Country_name,a.custom_birth, ';
strSmt:=strSmt+' a.custom_phone,a.custom_address,a.custom_idno, ';
strSmt:=strSmt+' a.regist_date,d.room_no,d.flooer_id,a.bed_no,e.bedSta_name, ';
strSmt:=strSmt+' a.bedsta_id,f.roompro_name ';
strSmt:=strSmt+' from CustomerList a left outer join SexList b ';
strSmt:=strSmt+' on a.custom_sexid=b.Sex_id ';
strSmt:=strSmt+' left outer join CountryList c ';
strSmt:=strSmt+' on a.custom_countryid=c.Country_id';
strSmt:=strSmt+' left outer join RoomList d';
strSmt:=strSmt+' on a.room_id=d.room_id ';
strSmt:=strSmt+' left outer join Bedstatus e';
strSmt:=strSmt+' on a.bedsta_id=e.BedSta_id';
strSmt:=strSmt+' left outer join RoomProperty f';
strSmt:=strSmt+' on d.roompro_id =f.Roompro_id';
strSmt:=strSmt+' where regist_id='+ClientID+'';
edtxm.Text:=strsmt;
// exit;
try
adoquery.Close;
adoquery.SQL.Clear;
adoquery.sql.Add(strSmt);
adoquery.ConnectionString:=strCon;
adoquery.Open ;
while not adoquery.Eof do
begin
edtxm.Text:=adoquery.FieldValues['custom_name'];
edtsex.Text:=adoquery.FieldValues['Sex_name'];
edtnation.Text:=adoquery.FieldValues['Country_name'];
edtbirth.Text:=adoquery.FieldValues['custom_birth'];
edtidno.Text:=adoquery.FieldValues['custom_idno'];
edtphone.Text:=adoquery.FieldValues['custom_phone'];
edtaddress.Text:=adoquery.FieldValues['custom_address'];
edtregistdate.Text:=adoquery.FieldValues['regist_date'];
adoquery.Next;
end;
finally
adoquery.Close;
adoquery.SQL.Clear ;
end;
end;
end;
procedure TfrmBedArrange.ToolButton1Click(Sender: TObject);
var
strSmt:string;
return_value:string;
SelID:string;
xx:TlistItem;
begin
if ClientID='NONE' then
begin
showmessage('当前没有客人');
exit;
end;
if lvwbed.SelCount=0 then
begin
showmessage('没有选择床位');
exit;
end;
if (lvwbed.SelCount<>0) and (lvwbed.Selected.ImageIndex=1) then
begin
showmessage('所选房间已住人');
exit;
end;
xx:=lvwbed.Selected ;
SelID:=xx.Caption ;
strSmt:='execute ArrangeSomeone '+Clientid+','''+CurrNo+''','+SelID;
adosetbed.Close;
adosetbed.SQL.Clear ;
adosetbed.SQL.add(strSmt);
adosetbed.ConnectionString:=strCon;
showmessage(strSmt);
edit1.Text:=strSmt;
adosetbed.Open ;
while not adosetbed.Eof do
begin
return_value:=adosetbed.Fields[0].AsString;
adosetbed.Next;
end;
if return_value='success' then
begin
showmessage('房间设置成功');
xx.ImageIndex:=1;
frmRoomQuery.btnShowAll.Click;
frmRoomQuery.GetClientData;
end;
if return_value='falure' then
showmessage('房间被锁定,请稍后再试');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -