📄 xgft.pas
字号:
if length(trim(copy(n1.Caption,1,4)))=3 then
begin
if trim(ComboBox1.Items[0][i])=trim(copy(trim(n1.Caption),1,1)) then
begin
bz:=true;
break;
end
else bz:=false;
end ;
end;
{ for i:=9 to length(ComboBox1.Items[0]) do
if ComboBox1.Items[0][i]<>',' then ls:=ls+ComboBox1.Items[0][i]
else
if trim(ls)<> trim(copy(trim(n1.Caption),2,1)) then ls:=''
else bz:=true;
if trim(ls)<> trim(copy(trim(n1.Caption),2,1)) then ls:=''
else bz:=true; }
if not bz then
begin
application.messagebox('你无权修改!','提示信息',48);
exit;
end;
if trim(xgftform.Caption)='' then
xgftform.close
else
begin //and(copy(n2.Caption,2,1)<>'6')
if messagedlg('你确认修改:'+trim(copy(trim(n1.Caption),1,4))+'房态吗?',mtInformation, [mbYes, mbNo], 0) = mrno then
exit;
if (trim(n2.Caption)<>'') then
begin
q2.Active :=false;
q2.sql.clear;
q2.sql.add('update room set status='''+copy(n2.Caption,2,1)+''' where roomno='''+trim(copy(trim(n1.Caption),1,4))+'''');
// q2.sql.add('update room set status=''0'' where roomno='''+trim(copy(trim(n1.Caption),1,4))+'''');
q2.Prepare;
q2.ExecSQL;
addlogo(curper.code,datetimetostr(now),'改:'+trim(copy(trim(n1.Caption),1,4))+'>>房态');
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;
end;
end;
procedure Txgftform.PopupMenu1Popup(Sender: TObject);
var
rmno:string;
lstab: string;
begin
if activecontrol=grid1 then
begin
rmno:=lsroom[grid1.row,grid1.col];
lstab:=lsstatusarr[grid1.row,grid1.col];
end;
if activecontrol=grid2 then
begin
rmno:=llssroom[grid2.row,grid2.col];
lstab:=llssstatusarr[grid2.row,grid2.col];
end;
if trim(Caption)<>'' then
begin
if trim(lstab)='2' then
begin
popupmenu1.items[0].enabled:=true;
popupmenu1.items[1].enabled:=true;
N1.Caption:=rmno+' 脏房转待租房';
N2.Caption:=rmno+' 脏房转维修房';
end;
if trim(lstab)='0' then
begin
popupmenu1.items[1].enabled:=true;
popupmenu1.items[0].enabled:=false;
N2.Caption:=rmno+' 待租房转维修房';
N1.Caption:='';
end;
if trim(lstab)='3' then
begin
popupmenu1.items[0].enabled:=true;
popupmenu1.items[1].enabled:=false;
N1.Caption:=rmno+' 维修房转待租房';
N2.Caption:='0';
end;
if (trim(lstab)='1')or(trim(lstab)='7') then
begin
popupmenu1.items[0].enabled:=true;
popupmenu1.items[1].enabled:=false;
N1.Caption:=rmno+' 宾客可结帐';
N2.Caption:='6';
// N2.Caption:='1';
end;
if (trim(lstab)>'3')and(trim(lstab)<>'7') 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 Txgftform.N2Click(Sender: TObject);
var i:integer;ls:string;bz:boolean;
begin
ls:='';bz:=false;
for i:=9 to length(ComboBox1.Items[0]) do
begin
if length(trim(copy(n2.Caption,1,4)))=4 then
begin
if trim(ComboBox1.Items[0][i])=trim(copy(trim(n2.Caption),2,1)) then
begin
bz:=true;
break;
end
else bz:=false;
end ;
if length(trim(copy(n2.Caption,1,4)))=3 then
begin
if trim(ComboBox1.Items[0][i])=trim(copy(trim(n2.Caption),1,1)) then
begin
bz:=true;
break;
end
else bz:=false;
end ;
end;
{ for i:=9 to length(ComboBox1.Items[0]) do
if ComboBox1.Items[0][i]<>',' then ls:=ls+ComboBox1.Items[0][i]
else
if trim(ls)<> trim(copy(trim(n2.Caption),1,1)) then ls:=''
else bz:=true;
if trim(ls)<> trim(copy(trim(n2.Caption),1,1)) then ls:=''
else bz:=true; }
if not bz then
begin
application.messagebox('你无权修改!','提示信息',48);
exit;
end;
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;
addlogo(curper.code,datetimetostr(now),'改'+trim(copy(trim(n2.Caption),1,4))+'房态');
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 Txgftform.Timer1Timer(Sender: TObject);
var col,row:integer;
begin
roomini;
col:=grid1.Col;row:=grid1.Row;
xggrid(grid1);
grid1.Col:=col;grid1.Row:=row;
col:=grid2.Col;row:=grid2.Row;
xggrid(grid2);
grid2.Col:=col;grid2.Row:=row;
{ 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 Txgftform.Button2Click(Sender: TObject);
begin
xgftform.close;
end;
procedure Txgftform.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 Txgftform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
timer1.free;
q2.Free;
action:=cafree;
end;
procedure Txgftform.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;
if llssstatusarr[row,col]='7' then
begin
grid2.canvas.font.color:=$003F8FA0; //
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 Txgftform.rmnogridKeyPress(Sender: TObject; var Key: Char);
begin
if ((key<'0') or (key>'9')) then
if key<>char(8) then
key:=char(0);
end;
procedure Txgftform.rmnogridSetEditText(Sender: TObject; ACol, ARow: Integer;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -