📄 xgftyqjz.pas
字号:
if trim(lstab)='6' then
begin
popupmenu1.items[0].enabled:=true;
popupmenu1.items[1].enabled:=false;
N1.Caption:=rmno+' 宾客稍后再结';
N2.Caption:='1';
end;
if (trim(lstab)>'3')and(trim(lstab)<>'6') then
begin
popupmenu1.items[0].enabled:=true;
popupmenu1.items[1].enabled:=false;
N1.Caption:=rmno+' 不能修改房态';
N2.Caption:='';
end;
end
else
begin
if trim(lstab)='0' then
begin
popupmenu1.items[1].enabled:=false;
popupmenu1.items[0].enabled:=true;
N1.Caption:='换入 '+rmno+' 房';
N2.Caption:='';
end
else
begin
popupmenu1.items[0].enabled:=true;
popupmenu1.items[1].enabled:=false;
N2.Caption:=rmno+' 不能换入';
N1.Caption:='';
end;
end; }
end;
procedure Txgyqjzform.N2Click(Sender: TObject);
begin
{ q2.Active :=false;
q2.sql.clear;
q2.sql.add('update room set status='''+'3'+''' where roomno='''+trim(copy(trim(n2.Caption),1,4))+'''');
q2.Prepare;
q2.ExecSQL;
roomini;
if grid1.col<>0 then grid1.col:=0
else grid1.col:=1;
if grid2.col<>0 then grid2.col:=0
else grid2.col:=1 }
end;
Function checkgrid(tg:tstringgrid):boolean;
var
i: integer;
begin
checkgrid:=false;
for i:=1 to tg.rowcount-1 do
if length(trim(tg.cells[0,i]))>0 then
begin
checkgrid:=true;
break;
end;
end;
procedure Txgyqjzform.Timer1Timer(Sender: TObject);
begin
roomini;
xggrid(grid1);
xggrid(grid2);
{ grid1.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect,goDrawFocusSelected,goEditing];
for i:=0 to grid1.rowcount-1 do
for j:=0 to grid1.colcount-1 do
xgftform.grid1drawcell(nil,j,i,tt,[gdFocused]);
grid1.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect,goDrawFocusSelected];
grid2.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect,goDrawFocusSelected,goEditing];
for i:=0 to grid2.rowcount-1 do
for j:=0 to grid2.colcount-1 do
xgftform.grid2drawcell(nil,j,i,tt,[gdFocused]);
grid2.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect,goDrawFocusSelected];
womangrid.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect,goEditing];
for i:=1 to womangrid.colcount-1 do
xgftform.womangriddrawcell(nil,i,0,tt, [gdFocused]);
womangrid.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect];
mangrid.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect,goEditing];
for i:=1 to mangrid.colcount-1 do
xgftform.mangriddrawcell(nil,i,0,tt, [gdFocused]);
mangrid.options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,goRangeSelect];
}
end;
procedure Txgyqjzform.Button2Click(Sender: TObject);
begin
xgyqjzform.close;
djform.FormShow(nil);
end;
procedure Txgyqjzform.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=112 then
begin
if xt=1 then help(18);
if xt=0 then help(24);
end;
if key=13 then
selectnext(activecontrol,true,true);
if key=27 then
close;
end;
procedure Txgyqjzform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
timer1.free;
q2.Free;
action:=cafree;
end;
procedure Txgyqjzform.grid2DrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var
lsfj :string;
lsls:string;
bb:Tbrush;
begin
grid2.canvas.font.style:=[fsbold];
// grid2.canvas.font.size:=12;
grid2.canvas.pen.mode:=pmCopy;
lsfj:=llssroom[row,col];
if length(trim(llssstatusarr[row,col]))>0 then
begin
bb:=grid2.canvas.brush;
if llssstatusarr[row,col]='0' then
begin
grid2.canvas.font.color:=$0000ff00; //GReen
lsls:=lsfj+' 空';
end;
if llssstatusarr[row,col]='1' then
begin
grid2.canvas.font.color:=$000000ff; //GReen
lsls:=lsfj+' 满';
end;
if llssstatusarr[row,col]='2' then
begin
grid2.canvas.font.color:=$0000ffff; //Yellow
lsls:=lsfj+' 脏';
end ;
if llssstatusarr[row,col]='3' then
begin
grid2.canvas.font.color:=$00ffff00; //GReen
lsls:=lsfj+' 修';
end;
if llssstatusarr[row,col]='4' then
begin
grid2.canvas.font.color:=$02aa00aa; //
lsls:=lsfj+' 免';
end;
if llssstatusarr[row,col]='5' then
begin
grid2.canvas.font.color:=clOlive; //
lsls:=lsfj+' 订';
end;
if llssstatusarr[row,col]='6' then
begin
grid2.canvas.font.color:=$004080FF; //
lsls:=lsfj+' 通';
end;
grid2.canvas.textrect(grid2.cellrect(col,row),grid2.cellrect(col,row).Left,grid2.cellrect(col,row).Top,lsls);
grid2.canvas.brush:=bb;
end;
end;
procedure Txgyqjzform.rmnogridKeyPress(Sender: TObject; var Key: Char);
begin
if ((key<'0') or (key>'9')) then
if key<>char(8) then
key:=char(0);
end;
procedure Txgyqjzform.rmnogridSetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: String);
begin
currow:=arow;
end;
procedure Txgyqjzform.grid1DblClick(Sender: TObject);
begin
{ if not Button2.Visible then
begin //已住房间 grid2.canvas.font.color:=$004080FF
if (xgftform.Caption='') and (((activecontrol as Tstringgrid).canvas.font.color=$02aa00aa) or ((activecontrol as Tstringgrid).canvas.font.color=$000000ff)or ((activecontrol as Tstringgrid).canvas.font.color=$004080FF)) then
begin
if (activecontrol=grid1) then
xgrmno.Text:=lsroom[grid1.row,grid1.col];
if (activecontrol=grid2) then
xgrmno.Text:=llssroom[grid2.row,grid2.col];
close;
end; //空房间
if (xgftform.Caption=' ') and ((activecontrol as Tstringgrid).canvas.font.color=$0000ff00) then
begin
if (activecontrol=grid1) then
xgrmno.Text:=lsroom[grid1.row,grid1.col];
if (activecontrol=grid2) then
xgrmno.Text:=llssroom[grid2.row,grid2.col];
close;
end;
end
else
begin }
{ if (activecontrol=grid1) and (lsstatusarr[grid1.row,grid1.col]='2') then
begin
n1.Caption:=lsroom[grid1.row,grid1.col];
n2.Caption:=' 0';
N1Click(nil);
end;
if (activecontrol=grid1) and ((lsstatusarr[grid1.row,grid1.col]='1')or(lsstatusarr[grid1.row,grid1.col]='4')) then
begin
if trim(lsstatusarr[grid1.row,grid1.col])='4' then
begin
bj:='1';
fh:=lsroom[grid1.row,grid1.col];
end;
else
bj:='0';
n1.Caption:=lsroom[grid1.row,grid1.col];
n2.Caption:=' 6';
N1Click(nil);
end; }
if (activecontrol=grid1) and (trim(lsstatusarr[grid1.row,grid1.col])='6') then
begin
n1.Caption:=lsroom[grid1.row,grid1.col];
N2.Caption:=' 1';
N1Click(nil);
end;
{ if (activecontrol=grid2) and (llssstatusarr[grid2.row,grid2.col]='2') then
begin
n1.Caption:=llssroom[grid2.row,grid2.col];
n2.Caption:=' 0';
N1Click(nil);
end;
if (activecontrol=grid2) and ((llssstatusarr[grid2.row,grid2.col]='1')or(llssstatusarr[grid2.row,grid2.col]='4')) then
begin
if trim(llssstatusarr[grid2.row,grid2.col])='4' then
begin
bj:='1';fh:=llssroom[grid2.row,grid2.col];
end
else bj:='0' ;
n1.Caption:=llssroom[grid2.row,grid2.col];
n2.Caption:=' 6';
N1Click(nil);
end; }
if (activecontrol=grid2) and (trim(llssstatusarr[grid2.row,grid2.col])='6') then
begin
n1.Caption:=llssroom[grid2.row,grid2.col];
N2.Caption:=' 1';
N1Click(nil);
end;
// end;
end;
procedure Txgyqjzform.mangridDrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var
bb:Tbrush;
tt:trect;
begin
if col=0 then
exit;
// lsroom:=copy('00'+trim(inttostr(col)),length(trim(inttostr(col))),3);
if length(trim(mangrid1.Cells[Col,Row]))>0 then
begin
bb:=mangrid.canvas.brush;
if mangrid1.Cells[Col,Row]='0' then
mangrid.canvas.font.color:=$0000ff00; //GReen
if mangrid1.Cells[Col,Row]='1' then
mangrid.canvas.font.color:=$000000ff; // Red
if mangrid1.Cells[Col,Row]='2' then
mangrid.canvas.font.color:=$0000ffff; // Yellow
if mangrid1.Cells[Col,Row]='3' then
mangrid.canvas.font.color:=$00ffff00; // blank
if mangrid1.Cells[Col,Row]='4' then
mangrid.canvas.font.color:=$02aa00aa; //
if mangrid1.Cells[Col,Row]='5' then
mangrid.canvas.font.color:=clOlive; //
if mangrid1.Cells[Col,Row]='6' then
mangrid.canvas.font.color:=$004080FF; //
tt:=mangrid.cellrect(col,row);
mangrid.canvas.textrect(tt,tt.Left,tt.Top,mangrid.Cells[Col,Row]);
mangrid.canvas.brush:=bb;
end;
end;
procedure Txgyqjzform.womangridDrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var
bb:Tbrush;
tt:trect;
begin
if col=0 then
exit;
// lsroom:=copy('00'+trim(inttostr(col)),length(trim(inttostr(col))),3);
if length(trim(womangrid1.Cells[Col,Row]))>0 then
begin
bb:=womangrid.canvas.brush;
if womangrid1.Cells[Col,Row]='0' then
womangrid.canvas.font.color:=$0000ff00; //GReen
if womangrid1.Cells[Col,Row]='1' then
womangrid.canvas.font.color:=$000000ff; // Red
if womangrid1.Cells[Col,Row]='2' then
womangrid.canvas.font.color:=$0000ffff; // Yellow
if womangrid1.Cells[Col,Row]='3' then
womangrid.canvas.font.color:=$00ffff00; // blank
if womangrid1.Cells[Col,Row]='4' then
womangrid.canvas.font.color:=$02aa00aa; //
if womangrid1.Cells[Col,Row]='5' then
womangrid.canvas.font.color:=clOlive; //
if womangrid1.Cells[Col,Row]='6' then
womangrid.canvas.font.color:=$004080FF; //
tt:=womangrid.cellrect(col,row);
womangrid.canvas.textrect(tt,tt.Left,tt.Top,womangrid.Cells[Col,Row]);
womangrid.canvas.brush:=bb;
end;
end;
procedure Txgyqjzform.jylgridDrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var
bb:Tbrush;
tt:trect;
begin
if col=0 then
exit;
// lsroom:=copy('00'+trim(inttostr(col)),length(trim(inttostr(col))),3);
if length(trim(jylgrid1.Cells[Col,Row]))>0 then
begin
bb:=jylgrid.canvas.brush;
if jylgrid1.Cells[Col,Row]='0' then
jylgrid.canvas.font.color:=$0000ff00; //GReen
if jylgrid1.Cells[Col,Row]='1' then
jylgrid.canvas.font.color:=$000000ff; // Red
if jylgrid1.Cells[Col,Row]='2' then
jylgrid.canvas.font.color:=$0000ffff; // Yellow
if jylgrid1.Cells[Col,Row]='3' then
jylgrid.canvas.font.color:=$00ffff00; // blank
if jylgrid1.Cells[Col,Row]='4' then
jylgrid.canvas.font.color:=$02aa00aa; //
if jylgrid1.Cells[Col,Row]='5' then
jylgrid.canvas.font.color:=clOlive; //
if jylgrid1.Cells[Col,Row]='6' then
jylgrid.canvas.font.color:=$004080FF; //
tt:=jylgrid.cellrect(col,row);
jylgrid.canvas.textrect(tt,tt.Left,tt.Top,jylgrid.Cells[Col,Row]);
jylgrid.canvas.brush:=bb;
end;
end;
procedure Txgyqjzform.mangridDblClick(Sender: TObject);
var ls:string;
begin
ls:='';
if (activecontrol=mangrid) and (mangrid1.Cells[mangrid.Col,mangrid.Row]='6') then
begin
ls:=copy('mansan ',1,10)+mangrid.Cells[mangrid.Col,mangrid.Row];
end;
if (activecontrol=womangrid) and (womangrid1.Cells[womangrid.Col,womangrid.Row]='6') then
begin
ls:=copy('womansan ',1,10)+womangrid.Cells[womangrid.Col,womangrid.Row];
end;
if (activecontrol=jylgrid) and (jylgrid1.Cells[jylgrid.Col,jylgrid.Row]='6') then
begin
ls:=copy('jyl ',1,10)+jylgrid.Cells[jylgrid.Col,jylgrid.Row];
end;
if ls<>'' then
begin
q2.Active:=false;
q2.SQL.Clear;
if (activecontrol=mangrid) and(mangrid1.Cells[mangrid.Col,mangrid.Row]='6')then
q2.SQL.Add('update '+trim(copy(ls,1,10))+' set status=''1'' where roomno='''+trim(copy(ls,11,6))+'''');
if (activecontrol=womangrid)and(womangrid1.Cells[womangrid.Col,womangrid.Row]='6') then
q2.SQL.Add('update '+trim(copy(ls,1,10))+' set status=''1'' where roomno='''+trim(copy(ls,11,6))+'''');
if (activecontrol=jylgrid) and(jylgrid1.Cells[jylgrid.Col,jylgrid.Row]='6') then
q2.SQL.Add('update '+trim(copy(ls,1,10))+' set status=''1'' where roomno='''+trim(copy(ls,11,6))+'''');
q2.ExecSQL;
q2.Active:=false;
q2.SQL.Clear;
roomini;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -