📄 newdj.pas
字号:
end
else
hykh.Enabled:=false;
end;
procedure Tdjform.jzfsnameKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
procedure Tdjform.grid1DblClick(Sender: TObject);
var ls:string;
i:integer;
begin
if Panel1.Visible then
begin
ls:=' ';
if activecontrol=grid1 then
begin
i:=1;
while trim(rmnogrid.cells[0,i])<>'' do
begin
if trim(rmnogrid.cells[0,i])=trim(lsroom[grid1.row,grid1.col]) then
begin
ls:='$';
break;
end;
i:=i+1;
end;
if ls<>'$' then ls:=lsstatusarr[grid1.row,grid1.col];
// addyj:=200;
end;
if activecontrol=grid2 then
begin
i:=1;
while trim(rmnogrid.cells[0,i])<>'' do
begin
if trim(rmnogrid.cells[0,i])=trim(llssroom[grid2.row,grid2.col]) then
begin
ls:='$';
break;
end;
i:=i+1;
end;
if ls<>'$' then ls:=llssstatusarr[grid2.row,grid2.col];
// addyj:=300;
end;
if activecontrol=mangrid then
begin
i:=1;
while trim(rmnogrid.cells[0,i])<>'' do
begin
if (trim(rmnogrid.cells[0,i])=trim(mangrid.cells[mangrid.Col,mangrid.Row])) and (trim(rmnogrid.cells[3,i])='男') then
begin
ls:='$';
break;
end;
i:=i+1;
end;
if ls<>'$' then
ls:=mangrid.Cells[mangrid.Col,1];
// addyj:=100;
end;
if activecontrol=womangrid then
begin
i:=1;
while trim(rmnogrid.cells[0,i])<>'' do
begin
if (trim(rmnogrid.cells[0,i])=trim(womangrid.cells[womangrid.Col,womangrid.Row])) and (trim(rmnogrid.cells[3,i])='女') then
begin
ls:='$';
break;
end;
i:=i+1;
end;
if ls<>'$' then
ls:=womangrid.Cells[womangrid.Col,1];
// addyj:=100;
end;
if activecontrol=jylgrid then
begin
i:=1;
while trim(rmnogrid.cells[0,i])<>'' do
begin
if (trim(rmnogrid.cells[0,i])=trim(jylgrid.cells[jylgrid.Col,jylgrid.Row])) then
begin
ls:='$';
break;
end;
i:=i+1;
end;
if ls<>'$' then
ls:=jylgrid.Cells[jylgrid.Col,1];
// addyj:=100;
end;
// tt:=tstringgrid(activecontrol);
if activecontrol=grid1 then
begin
rmno:=lsroom[grid1.row,grid1.col];
// tt:=rmnogrid;
end;
if activecontrol=grid2 then
begin
rmno:=llssroom[grid2.row,grid2.col];
// tt:=rmnogrid;
end;
if activecontrol=mangrid then
begin
// tt:=mansygrid;
rmno:=mangrid.Cells[mangrid.col,mangrid.row];
end;
if activecontrol=womangrid then
begin
// tt:=womansygrid;
rmno:=womangrid.Cells[womangrid.col,womangrid.row];
end;
if activecontrol=jylgrid then
begin
// tt:=womansygrid;
rmno:=jylgrid.Cells[jylgrid.col,jylgrid.row];
end;
if ls='0' then
djform.n1click(NIl);
if ls='5' then
begin
if application.MessageBox('此房间是预定房,是否一定要登记此房间?','提示信息',36)=7 then exit;
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
fm.Query2.SQL.Add('delete from ydroommx where roomno='''+rmno+'''');
fm.Query2.ExecSQL;
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
djform.n1click(NIl);
end;
end
else
begin //Button1.Tag=1 结帐Button1.Tag=0 消费
if (Button1.Enabled=false) then
begin
// if (activecontrol=grid1) and (((Button1.Tag=1) and ((lsstatusarr[grid1.row,grid1.col]='6')or (lsstatusarr[grid1.row,grid1.col]='1')or (lsstatusarr[grid1.row,grid1.col]='4'))) or ((Button1.Tag=0) and ((lsstatusarr[grid1.row,grid1.col]='1') or (lsstatusarr[grid1.row,grid1.col]='6') or (lsstatusarr[grid1.row,grid1.col]='4')))) then
if (activecontrol=grid1)and(((Button1.Tag=1)and((lsstatusarr[grid1.row,grid1.col]='6')or(lsstatusarr[grid1.row,grid1.col]='4')or(lsstatusarr[grid1.row,grid1.col]='7')))or((Button1.Tag=0)and((lsstatusarr[grid1.row,grid1.col]='1')or(lsstatusarr[grid1.row,grid1.col]='4')or(lsstatusarr[grid1.row,grid1.col]='7')))or((Button1.Tag=2)and((lsstatusarr[grid1.row,grid1.col]='1')or(lsstatusarr[grid1.row,grid1.col]='4')or(lsstatusarr[grid1.row,grid1.col]='7')or(lsstatusarr[grid1.row,grid1.col]='6')))) then
begin
xfrmno.Text:=lsroom[grid1.row,grid1.col];
close;
end;
// if (activecontrol=grid2) and (((Button1.Tag=1) and ((llssstatusarr[grid2.row,grid2.col]='6')or (llssstatusarr[grid2.row,grid2.col]='1')or (llssstatusarr[grid2.row,grid2.col]='4'))) or ((Button1.Tag=0) and ((llssstatusarr[grid2.row,grid2.col]='1') or (llssstatusarr[grid2.row,grid2.col]='6') or (llssstatusarr[grid2.row,grid2.col]='4')))) then
if (activecontrol=grid2)and(((Button1.Tag=1)and((llssstatusarr[grid2.row,grid2.col]='6')or(llssstatusarr[grid2.row,grid2.col]='4')or(llssstatusarr[grid2.row,grid2.col]='7')))or((Button1.Tag=0)and((llssstatusarr[grid2.row,grid2.col]='1')or(llssstatusarr[grid2.row,grid2.col]='4')or(llssstatusarr[grid2.row,grid2.col]='7')))or((Button1.Tag=2)and((llssstatusarr[grid2.row,grid2.col]='1')or(llssstatusarr[grid2.row,grid2.col]='4')or(llssstatusarr[grid2.row,grid2.col]='7')or(llssstatusarr[grid2.row,grid2.col]='6')))) then
begin
xfrmno.Text:=llssroom[grid2.row,grid2.col];
close;
end;
// if (activecontrol=mangrid) and (((Button1.Tag=1) and ((mangrid.Cells[mangrid.col,1]='6')or (mangrid.Cells[mangrid.col,1]='1')or (mangrid.Cells[mangrid.col,1]='4'))) or ((Button1.Tag=0) and ((mangrid.Cells[mangrid.col,1]='1') or (mangrid.Cells[mangrid.col,1]='6') or (mangrid.Cells[mangrid.col,1]='4')))) then
if(activecontrol=mangrid)and(((Button1.Tag=1)and((mangrid.Cells[mangrid.col,1]='6')or(mangrid.Cells[mangrid.col,1]='1')or(mangrid.Cells[mangrid.col,1]='4')or(mangrid.Cells[mangrid.col,1]='7')))or((Button1.Tag=0)and((mangrid.Cells[mangrid.col,1]='1')or(mangrid.Cells[mangrid.col,1]='4')or(mangrid.Cells[mangrid.col,1]='7')))or((Button1.Tag=2)and((mangrid.Cells[mangrid.col,1]='1')or(mangrid.Cells[mangrid.col,1]='4')or(mangrid.Cells[mangrid.col,1]='7')or(mangrid.Cells[mangrid.col,1]='6')))) then
begin
xfrmno.Text:=mangrid.Cells[mangrid.col,mangrid.row]+' 1';
close;
end;
// if (activecontrol=womangrid) and (((Button1.Tag=1) and ((womangrid.Cells[womangrid.col,1]='6')or (womangrid.Cells[womangrid.col,1]='1')or (womangrid.Cells[womangrid.col,1]='4'))) or ((Button1.Tag=0) and ((womangrid.Cells[womangrid.col,1]='1') or (womangrid.Cells[womangrid.col,1]='6') or (womangrid.Cells[womangrid.col,1]='4')))) then
if (activecontrol=womangrid)and(((Button1.Tag=1)and((womangrid.Cells[womangrid.col,1]='6')or(womangrid.Cells[womangrid.col,1]='1')or(womangrid.Cells[womangrid.col,1]='4')or(womangrid.Cells[womangrid.col,1]='7')))or((Button1.Tag=0)and((womangrid.Cells[womangrid.col,1]='1')or(womangrid.Cells[womangrid.col,1]='4')or(womangrid.Cells[womangrid.col,1]='7')))or((Button1.Tag=2)and((womangrid.Cells[womangrid.col,1]='1')or(womangrid.Cells[womangrid.col,1]='4')or(womangrid.Cells[womangrid.col,1]='7')or(womangrid.Cells[womangrid.col,1]='6')))) then
begin
xfrmno.Text:=womangrid.Cells[womangrid.col,womangrid.row]+' 0';
close;
end;
// if (activecontrol=jylgrid) and (((Button1.Tag=1) and ((jylgrid.Cells[jylgrid.col,1]='6')or (jylgrid.Cells[jylgrid.col,1]='1')or (jylgrid.Cells[jylgrid.col,1]='4'))) or ((Button1.Tag=0) and ((jylgrid.Cells[jylgrid.col,1]='1') or (jylgrid.Cells[jylgrid.col,1]='6') or (jylgrid.Cells[jylgrid.col,1]='4')))) then
if (activecontrol=jylgrid)and(((Button1.Tag=1)and((jylgrid.Cells[jylgrid.col,1]='6') or (jylgrid.Cells[jylgrid.col,1]='1')or(jylgrid.Cells[jylgrid.col,1]='4')or(jylgrid.Cells[jylgrid.col,1]='7')))or((Button1.Tag=0) and ((jylgrid.Cells[jylgrid.col,1]='1')or(jylgrid.Cells[jylgrid.col,1]='4') or (jylgrid.Cells[jylgrid.col,1]='7')))or((Button1.Tag=2)and((jylgrid.Cells[jylgrid.col,1]='1')or(jylgrid.Cells[jylgrid.col,1]='4') or(jylgrid.Cells[jylgrid.col,1]='7')or(jylgrid.Cells[jylgrid.col,1]='6')))) then
begin
xfrmno.Text:=jylgrid.Cells[jylgrid.col,jylgrid.row];
close;
end;
end;
if Caption='请选择散座号' then
begin
if (Height>=100) and (((activecontrol as Tstringgrid).canvas.font.color=$0000ff00)or((activecontrol as Tstringgrid).canvas.font.color=$02aa00aa)) then
begin
if (activecontrol=mangrid) then
begin
i:=1;
if trim(xfrmno.Text)='0' then
begin
while (i<>0) and (trim(rmhsan.mansan.Cells[0,i])<>'') do
begin
if trim(rmhsan.mansan.Cells[0,i])=trim(mangrid.Cells[mangrid.col,mangrid.row]) then
i:=0
else
i:=i+1;
end;
if i<>0 then
rmhsan.mansan.Cells[0,i]:=mangrid.Cells[mangrid.col,mangrid.row];
exit;
end;
if trim(xfrmno.Text)='1' then
begin
while (i<>0) and (trim(hfform.newmanno.Cells[0,i])<>'') do
begin
if trim(hfform.newmanno.Cells[0,i])=trim(mangrid.Cells[mangrid.col,mangrid.row]) then
i:=0
else
i:=i+1;
end;
if i<>0 then
hfform.newmanno.Cells[0,i]:=mangrid.Cells[mangrid.col,mangrid.row];
exit;
end;
end;
if (activecontrol=womangrid) then
begin
i:=1;
if trim(xfrmno.Text)='0' then
begin
while (i<>0) and (trim(rmhsan.womansan.Cells[0,i])<>'') do
begin
if trim(rmhsan.womansan.Cells[0,i])=trim(womangrid.Cells[womangrid.col,womangrid.row]) then
i:=0
else
i:=i+1;
end;
if i<>0 then
rmhsan.womansan.Cells[0,i]:=womangrid.Cells[womangrid.col,womangrid.row];
exit;
end;
if trim(xfrmno.Text)='1' then
begin
while (i<>0) and (trim(hfform.newwomanno.Cells[0,i])<>'') do
begin
if trim(hfform.newwomanno.Cells[0,i])=trim(womangrid.Cells[womangrid.col,womangrid.row]) then
i:=0
else
i:=i+1;
end;
if i<>0 then
hfform.newwomanno.Cells[0,i]:=womangrid.Cells[womangrid.col,womangrid.row];
exit;
end;
end;
end;
if (Height<100) and (((activecontrol as Tstringgrid).canvas.font.color=$000000ff)or((activecontrol as Tstringgrid).canvas.font.color=$02aa00aa)or((activecontrol as Tstringgrid).canvas.font.color=$004080FF)) then
begin
edit1.Text:='';
if (activecontrol as Tstringgrid).canvas.font.color=$02aa00aa then edit1.Text:='0';
if (activecontrol=mangrid) then
xfrmno.Text:=mangrid.Cells[mangrid.col,mangrid.row]+' 1';
if (activecontrol=womangrid) then
xfrmno.Text:=womangrid.Cells[womangrid.col,womangrid.row]+' 0';
close;
end;
end;
end;
end;
procedure Tdjform.rmnogridDblClick(Sender: TObject);
var i,j:integer;
begin
if (rmnogrid.Col=0) and (rmnogrid.Cells[0,rmnogrid.row]<>'') then
begin
i:=rmnogrid.row;
if trim(rmnogrid.cells[1,i])='是' then
yj.Value:=yj.Value-strtoint(rmnogrid.cells[19,i])
else
yj.Value:=yj.Value-strtoint(rmnogrid.cells[18,i]);
while trim(rmnogrid.cells[0,i])<>'' do
begin
for j:=0 to 19 do
rmnogrid.cells[j,i]:=rmnogrid.cells[j,i+1];
i:=i+1;
end;
end;
if (rmnogrid.Col=3) and (rmnogrid.Cells[0,rmnogrid.row]<>'') and (rmnogrid.Cells[15,rmnogrid.row]='2') then
begin
i:=rmnogrid.row;
if trim(rmnogrid.cells[3,i])='男' then
rmnogrid.cells[3,i]:='女' else
begin
if trim(rmnogrid.cells[3,i])='女' then
rmnogrid.cells[3,i]:='俩' else
begin
if trim(rmnogrid.cells[3,i])='俩' then
rmnogrid.cells[3,i]:='男';
end;
end;
end;
if (rmnogrid.Col=1) and (trim(rmnogrid.Cells[1,rmnogrid.Row])<>'') then
begin
if trim(rmnogrid.Cells[1,rmnogrid.Row])='是' then
begin
rmnogrid.Cells[1,rmnogrid.Row]:='否';
rmnogrid.Cells[4,rmnogrid.Row]:=floattostr(strtofloat(rmnogrid.Cells[16,rmnogrid.Row])*zkl.Value/100);
yj.Value:=yj.Value-strtoint(rmnogrid.cells[19,rmnogrid.Row])+strtoint(rmnogrid.cells[18,rmnogrid.Row]);
end
else
begin
rmnogrid.Cells[1,rmnogrid.Row]:='是';
rmnogrid.Cells[4,rmnogrid.Row]:=floattostr(strtofloat(rmnogrid.Cells[17,rmnogrid.Row])*zkl.Value/100);
yj.Value:=yj.Value-strtoint(rmnogrid.cells[18,rmnogrid.Row])+strtoint(rmnogrid.cells[19,rmnogrid.Row]);
end;
end;
end;
procedure Tdjform.pdjKeyPress(Sender: TObject; var Key: Char);
begin
if ((key>'9') or (key<'0'))and(key<>#8) then key:=#0;
end;
procedure Tdjform.rmnogridKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
{if (trim(rmnogrid.Cells[1,rmnogrid.Row])='') then
rmnogrid.Options:=[goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect,goAlwaysShowEditor]
else
begin
if (rmnogrid.Col=1) or (rmnogrid.Col=2)or (rmnogrid.Col=3)or (rmnogrid.Col=4)or (rmnogrid.Col=6)or (rmnogrid.Col=7) then
rmnogrid.Options:=[goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect,goAlwaysShowEditor];
end;
if (rmnogrid.Col=5) then
rmnogrid.Options:=[goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect,goEditing,goAlwaysShowEditor];}
end;
procedure Tdjform.rmnogridKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (rmnogrid.Col=1) and (trim(rmnogrid.Cells[1,rmnogrid.Row])<>'') then
begin
if (trim(rmnogrid.Cells[1,rmnogrid.Row])='0') or (trim(rmnogrid.Cells[1,rmnogrid.Row])='是') then
begin
rmnogrid.Cells[1,rmnogrid.Row]:='否';
rmnogrid.Cells[4,rmnogrid.Row]:=rmnogrid.Cells[6,rmnogrid.Row];
yj.Value:=yj.Value-strtoint(rmnogrid.cells[9,rmnogrid.Row])+strtoint(rmnogrid.cells[8,rmnogrid.Row]);
end
else
begin
rmnogrid.Cells[1,rmnogrid.Row]:='是';
yj.Value:=yj.Value-strtoint(rmnogrid.cells[8,rmnogrid.Row])+strtoint(rmnogrid.cells[9,rmnogrid.Row]);
rmnogrid.Cells[4,rmnogrid.Row]:=rmnogrid.Cells[7,rmnogrid.Row];
end;
end;
end;
procedure Tdjform.zklChange(Sender: TObject);
var i:integer;
begin
i:=1;
while trim(rmnogrid.Cells[0,i])<>'' do
begin
if trim(rmnogrid.cells[1,i])='是' then rmnogrid.cells[4,i]:=floattostr(strtofloat(rmnogrid.cells[17,i])*zkl.Value/100)
else rmnogrid.cells[4,i]:=floattostr(strtofloat(rmnogrid.cells[16,i])*zkl.Value/100);
i:=i+1;
end;
end;
procedure Tdjform.jylgridDrawCell(Sender: TObject; Col, Row: Integer;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -