📄 xgft.pas
字号:
const Value: String);
begin
currow:=arow;
end;
procedure Txgftform.grid1DblClick(Sender: TObject);
begin
if not Button2.Visible then
begin //已住房间 免紫 满红
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)or ((activecontrol as Tstringgrid).canvas.font.color=$003F8FA0) 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') then
begin
n1.Caption:=lsroom[grid1.row,grid1.col];
n2.Caption:=' 6';
N1Click(nil);
end; //贵
if (activecontrol=grid1) and (lsstatusarr[grid1.row,grid1.col]='7') then
begin
n1.Caption:=lsroom[grid1.row,grid1.col];
n2.Caption:=' 6';
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') then
begin
n1.Caption:=llssroom[grid2.row,grid2.col];
n2.Caption:=' 6';
N1Click(nil);
end;
if (activecontrol=grid2) and (llssstatusarr[grid2.row,grid2.col]='7') then
begin
n1.Caption:=llssroom[grid2.row,grid2.col];
n2.Caption:=' 6';
N1Click(nil);
end;
end;
end;
procedure Txgftform.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; //
if mangrid1.Cells[Col,Row]='7' then
mangrid.canvas.font.color:=$003F8FA0; //
tt:=mangrid.cellrect(col,row);
mangrid.canvas.textrect(tt,tt.Left,tt.Top,mangrid.Cells[Col,Row]);
mangrid.canvas.brush:=bb;
end;
end;
procedure Txgftform.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; //
if womangrid1.Cells[Col,Row]='7' then
womangrid.canvas.font.color:=$003F8FA0; //
tt:=womangrid.cellrect(col,row);
womangrid.canvas.textrect(tt,tt.Left,tt.Top,womangrid.Cells[Col,Row]);
womangrid.canvas.brush:=bb;
end;
end;
procedure Txgftform.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; //
if jylgrid1.Cells[Col,Row]='7' then
jylgrid.canvas.font.color:=$003F8FA0; //
tt:=jylgrid.cellrect(col,row);
jylgrid.canvas.textrect(tt,tt.Left,tt.Top,jylgrid.Cells[Col,Row]);
jylgrid.canvas.brush:=bb;
end;
end;
procedure Txgftform.mangridDblClick(Sender: TObject);
var ls:string;
begin
if (xgftform.Caption='') then exit;
ls:='';
if (activecontrol=mangrid) and (mangrid1.Cells[mangrid.Col,mangrid.Row]='1') then
ls:=copy('mansan ',1,10)+mangrid.Cells[mangrid.Col,mangrid.Row];
if (activecontrol=womangrid) and (womangrid1.Cells[womangrid.Col,womangrid.Row]='1') then
ls:=copy('womansan ',1,10)+womangrid.Cells[womangrid.Col,womangrid.Row];
if (activecontrol=jylgrid) and (jylgrid1.Cells[jylgrid.Col,jylgrid.Row]='1') then
ls:=copy('jyl ',1,10)+jylgrid.Cells[jylgrid.Col,jylgrid.Row];
if (activecontrol=mangrid) and (mangrid1.Cells[mangrid.Col,mangrid.Row]='7') then
ls:=copy('mansan ',1,10)+mangrid.Cells[mangrid.Col,mangrid.Row];
if (activecontrol=womangrid) and (womangrid1.Cells[womangrid.Col,womangrid.Row]='7') then
ls:=copy('womansan ',1,10)+womangrid.Cells[womangrid.Col,womangrid.Row];
if (activecontrol=jylgrid) and (jylgrid1.Cells[jylgrid.Col,jylgrid.Row]='7') then
ls:=copy('jyl ',1,10)+jylgrid.Cells[jylgrid.Col,jylgrid.Row];
if ls<>'' then
begin
q2.Active:=false;
q2.SQL.Clear;
q2.SQL.Add('update '+trim(copy(ls,1,10))+' set status=''6'' where roomno='''+trim(copy(ls,11,6))+'''');
q2.ExecSQL;
q2.Active:=false;
q2.SQL.Clear;
roomini;
end;
end;
procedure Txgftform.grid1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if strtoint(floattostr(int((x/(grid1.DefaultColWidth+1)))))<grid1.ColCount then
grid1.Col:=strtoint(floattostr(int((x/(grid1.DefaultColWidth+1)))));
if strtoint(floattostr(int((y/(grid1.DefaultRowHeight+1)))))<grid1.RowCount then
grid1.row:=strtoint(floattostr(int((y/(grid1.DefaultRowHeight+1)))));
end;
procedure Txgftform.grid2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if strtoint(floattostr(int((x/(grid2.DefaultColWidth+1)))))< grid2.ColCount then
grid2.Col:=strtoint(floattostr(int((x/(grid2.DefaultColWidth+1)))));
if strtoint(floattostr(int((y/(grid2.DefaultRowHeight+1)))))< grid2.RowCount then
grid2.row:=strtoint(floattostr(int((y/(grid2.DefaultRowHeight+1)))));
end;
procedure Txgftform.mangridMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
{ if (strtoint(floattostr(int((x/(mangrid.DefaultColWidth+1)))))<mangrid.ColCount)
and (strtoint(floattostr(int((x/(mangrid.DefaultColWidth+1)))))>0) then
mangrid.Col:=strtoint(floattostr(int((x/(mangrid.DefaultColWidth+1))))); }
end;
procedure Txgftform.womangridMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
{ if (strtoint(floattostr(int((x/(womangrid.DefaultColWidth+1)))))<womangrid.ColCount)
and (strtoint(floattostr(int((x/(womangrid.DefaultColWidth+1)))))>0) then
womangrid.Col:=strtoint(floattostr(int((x/(womangrid.DefaultColWidth+1)))));}
end;
procedure Txgftform.jylgridMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
{ if (strtoint(floattostr(int((x/(jylgrid.DefaultColWidth+1)))))<jylgrid.ColCount)
and (strtoint(floattostr(int((x/(jylgrid.DefaultColWidth+1)))))>0) then
jylgrid.Col:=strtoint(floattostr(int((x/(jylgrid.DefaultColWidth+1))))); }
end;
procedure Txgftform.Button1Click(Sender: TObject);
begin
xgftform.FormShow(nil);
end;
procedure Txgftform.FormShow(Sender: TObject);
var i,j:integer;
arr:array[1..50] of integer;
ls:string;
begin
for j:=1 to 50 do arr[j]:=0;
//j:=1;
for i:=0 to ComponentCount-1 do
if (Components[i] is TPanel)and(Components[i].tag<>0) then
begin
(Components[i] as Tpanel).Caption:='';
arr[Components[i].tag]:=i;
// j:=j+1;
end;
q2.sql.text:='select code,Name,isvis from roomsetup,roomtype where RoomType.RoomType=roomsetup.RoomType ';
q2.open;
while (not q2.Eof) do
begin
if ( q2.Fields[2].AsBoolean) then
begin
with (Components[arr[q2.Fields[0].asinteger]] as TPanel) do
begin
Caption:=q2.Fields[1].asstring;
if q2.Fields[0].asinteger<=14 then
rmtypearr[1,q2.Fields[0].asinteger-1]:=q2.Fields[1].asstring
else
rmtypearr[2,q2.Fields[0].asinteger-15]:=q2.Fields[1].asstring;
ls:=q2.Fields[1].asstring;
q2.Next;
{ while (not q2.Eof) and (ls=trim(q2.Fields[1].asstring)) do
begin
(xgftform.Components[arr[q2.Fields[0].asinteger]] as TPanel).Visible:=false;
Width:=Width+55;
q2.Next;
end;}
end;
end
else q2.Next;
end;
q2.Close;
q2.sql.Clear;
q2.Active:=false;
try // E:\hy\家园复件 SOURCE6hy
// ComboBox1.Items.LoadFromFile('E:\hy\家园复件 SOURCE6hy'+'\cwsys.dll');
ComboBox1.Items.LoadFromFile(curper.workpath+'\cwsys.dll');
except
end;
roomnum:=0;
zdrmnum:=0;
mannum:=0;
womannum:=0;
shortdateformat:='yyyy-MM-dd';
mangrid.Cells[0,0]:='男散';
womangrid.Cells[0,0]:='女散';
jylgrid.Cells[0,0]:='娱乐';
// roomini;
init
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -