📄 newdj.pas
字号:
xggrid(grid1);
xggrid(grid2);
jzfsname.ItemIndex:=0;
jzfsname.Text:=jzfsname.Items[0];
md.Checked:=false;
mxf.Checked:=false;
end;
end ;
procedure Tdjform.grid1DrawCell(Sender: TObject; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var
lsfj :string;
lsls:string;
begin
grid1.canvas.font.color:=clred;
// grid1.canvas.font.style:=[fsbold];
// grid1.canvas.font.size:=8;
grid1.canvas.pen.mode:=pmCopy;
lsfj:=lsroom[row,col];
if length(trim(lsstatusarr[row,col]))>0 then
begin
if lsstatusarr[row,col]='0' then
begin
grid1.canvas.font.color:=$0000ff00; //GReen
lsls:=lsfj+' 空';
end;
if lsstatusarr[row,col]='1' then
begin
grid1.canvas.font.color:=$000000ff; //GRed
lsls:=lsfj+' 满';
end;
if lsstatusarr[row,col]='2' then
begin
grid1.canvas.font.color:=$0000ffff; //Yellow
lsls:=lsfj+' 脏';
end ;
if lsstatusarr[row,col]='3' then
begin
grid1.canvas.font.color:=$00ffff00; //
lsls:=lsfj+' 修';
end;
if lsstatusarr[row,col]='4' then
begin
grid1.canvas.font.color:=$02aa00aa; //
lsls:=lsfj+' 免';
end;
if lsstatusarr[row,col]='5' then
begin
grid1.canvas.font.color:=clOlive; //
lsls:=lsfj+' 订';
end;
if lsstatusarr[row,col]='6' then
begin
grid1.canvas.font.color:=$004080FF; //
lsls:=lsfj+' 通';
end;
if lsstatusarr[row,col]='7' then
begin
grid1.canvas.font.color:=$003F8FA0; //
lsls:=lsfj+' 贵';
end;
grid1.canvas.textrect(grid1.cellrect(col,row),grid1.cellrect(col,row).Left,grid1.cellrect(col,row).Top,lsls);
end;
end;
procedure Tdjform.N1Click(Sender: TObject);
var
i:integer;
aa:array[0..8] of string;
begin
if Panel1.Visible then
begin
if ((activecontrol as tstringgrid)=grid1) or ((activecontrol as tstringgrid)=grid2) then
begin
getvalue(aa,'select roomtype from room where roomno='''+trim(rmno)+'''');
if trim(aa[0])='' then
begin
showmessage('操作有误!请从来');
exit;
end;
curroomtype:=aa[0];
end;
{ if trim(pdj.text)='' then
begin
pdj.text:=xdh('nowin','lsnowin','djcode',6);
end; }
for i:=1 to rmnogrid.rowcount-1 do
begin
if length(trim(rmnogrid.Cells [0,i]))=0 then
begin
if ((activecontrol as tstringgrid)=grid1) or ((activecontrol as tstringgrid)=grid2) then
begin
aa[0]:='';
aa[1]:='';
aa[2]:='';
aa[3]:='';
aa[4]:='';
getvalue(aa,'select bednum,Price,zdPrice,deposit,zddeposit,havetime,select1,hyprice12,Turntime2 from roomtype where roomtype='''+trim(curroomtype)+'''');
if xxzl.Checked then
begin
Application.CreateForm(Tbkzlform, bkzlform);
bkzlform.roomno.Text:=rmno;
if (aa[5]='True') or (aa[5]='1') then bkzlform.zd.Enabled:=true else
bkzlform.zd.Enabled:=false;
if (aa[6]='True') or (aa[6]='1') then bkzlform.th.Enabled:=true else
bkzlform.th.Enabled:=false;
if (aa[8]='24') then bkzlform.swf.Enabled:=true else
bkzlform.swf.Enabled:=false;
bkzlform.rs.Text:=aa[0];
if trim(hykh.Text)<>'' then
begin
bkzlform.hyj.Checked:=true;
bkzlform.hyj.Enabled:=true;
bkzlform.bzj.Enabled:=false;
bkzlform.gbj.Enabled:=false;
bkzlform.th.Enabled:=false;
bkzlform.rmmoney.Text:=aa[7];
end else
begin
bkzlform.hyj.Enabled:=false;
bkzlform.hyj.Checked:=false;
bkzlform.rmmoney.Text:=aa[1];
end;
// bkzlform.rs.Text:=aa[0];
bkzlform.spinEdit1.Value:=12;
bkzlform.showmodal;
if bkzlform.name.Tag<>1 then
begin
bkzlform.Free;
exit;
end;
if bkzlform.zd.Checked then
rmnogrid.cells[1,i]:='是' else rmnogrid.cells[1,i]:='否';
if bkzlform.woman.Checked then
rmnogrid.cells[3,i]:='女';
if bkzlform.man.Checked then
rmnogrid.cells[3,i]:='男';
if bkzlform.liang.Checked then
rmnogrid.cells[3,i]:='俩' ;
rmnogrid.cells[2,i]:=bkzlform.rs.Text;
rmnogrid.cells[6,i]:=bkzlform.name.Text;
rmnogrid.cells[4,i]:=bkzlform.rmmoney.Text;
aa[1]:=bkzlform.rmmoney.Text;
if trim(aa[1])='' then
begin
showmessage('操作有误!请从来');
exit;
end;
rmnogrid.cells[7,i]:=bkzlform.SpinEdit1.Text;
rmnogrid.cells[8,i]:=bkzlform.age.Text;
rmnogrid.cells[9,i]:=bkzlform.zj.Text;
rmnogrid.cells[10,i]:=bkzlform.id.Text;
rmnogrid.cells[11,i]:=bkzlform.workdw.Text;
bkzlform.Free;
end;
if trim(rmnogrid.cells[1,i])='' then rmnogrid.cells[1,i]:='否';
if trim(rmnogrid.cells[3,i])='' then rmnogrid.cells[3,i]:='男';
if trim(rmnogrid.cells[2,i])='' then rmnogrid.cells[2,i]:=aa[0];
// rmnogrid.cells[4,i]:=floattostr(strtofloat(aa[1])*zkl.Value/100);
rmnogrid.cells[4,i]:=aa[1];
rmnogrid.cells[15,i]:='2';
// rmnogrid.cells[16,i]:=aa[1];
if xxzl.Checked then
rmnogrid.cells[16,i]:=bkzlform.rmmoney.Text else
rmnogrid.cells[16,i]:=aa[1];
rmnogrid.cells[17,i]:=aa[2];
rmnogrid.cells[18,i]:=aa[3];
rmnogrid.cells[19,i]:=aa[4];
// addyj:=strtofloat(aa[3]);
// if trim(aa[3])<>'' then yj.Value:=yj.Value+strtoint(aa[3]);
end;
rmnogrid.cells[0,i]:=rmno;
if ((activecontrol as tstringgrid)=mangrid) then
begin
aa[0]:='';
aa[1]:='';
aa[2]:='';
getvalue(aa,'select sanprice from syssetup');
// rmnogrid.cells[4,i]:=floattostr(strtofloat(aa[0])*zkl.Value/100);
if trim(aa[0])='' then aa[0]:='22';
rmnogrid.cells[4,i]:=aa[0];
rmnogrid.cells[3,i]:='男';
rmnogrid.cells[7,i]:='12';
rmnogrid.cells[15,i]:='1';
rmnogrid.cells[16,i]:=aa[0];
rmnogrid.cells[17,i]:=aa[0];
rmnogrid.cells[18,i]:='100';
rmnogrid.cells[19,i]:='100';
end;
if ((activecontrol as tstringgrid)=womangrid) then
begin
aa[1]:='';
aa[2]:='';
getvalue(aa,'select womansanprice from syssetup');
// rmnogrid.cells[4,i]:=floattostr(strtofloat(aa[0])*zkl.Value/100);
if trim(aa[0])='' then aa[0]:='22';
rmnogrid.cells[4,i]:=aa[0];
rmnogrid.cells[7,i]:='12';
rmnogrid.cells[15,i]:='0';
rmnogrid.cells[16,i]:=aa[0];
rmnogrid.cells[17,i]:=aa[0];
rmnogrid.cells[3,i]:='女';
rmnogrid.cells[18,i]:='100';
rmnogrid.cells[19,i]:='100';
end;
if ((activecontrol as tstringgrid)=jylgrid) then
begin
rmnogrid.cells[4,i]:='0';
rmnogrid.cells[15,i]:='3';
rmnogrid.cells[7,i]:='12';
rmnogrid.cells[16,i]:='0';
rmnogrid.cells[17,i]:='0';
rmnogrid.cells[3,i]:='娱';
rmnogrid.cells[18,i]:='0';
rmnogrid.cells[19,i]:='100';
end;
yj.Value:=yj.Value+strtoint(rmnogrid.cells[18,i]);
break;
end;
{ 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]);}
end;
end;
end;
procedure Tdjform.PopupMenu1Popup(Sender: TObject);
var
ls: string;
i :integer;
begin
if Panel1.Visible then
begin
// tt:=tstringgrid(activecontrol);
if activecontrol=grid1 then
begin
rmno:=lsroom[grid1.row,grid1.col];
ls:=lsstatusarr[grid1.row,grid1.col];
n2.Enabled:=(ls='6');
// tt:=rmnogrid;
// addyj:=200;
end;
if activecontrol=grid2 then
begin
rmno:=llssroom[grid2.row,grid2.col];
// tt:=rmnogrid;
ls:=llssstatusarr[grid2.row,grid2.col];
// addyj:=300;
end;
if activecontrol=mangrid then
begin
ls:=trim(mangrid.Cells[mangrid.Col,1]);
// tt:=mansygrid;
rmno:=trim(mangrid.Cells[mangrid.Col,mangrid.row])+'男';
// addyj:=100;
end;
if activecontrol=womangrid then
begin
ls:=trim(womangrid.Cells[womangrid.Col,1]);
// tt:=womansygrid;
rmno:=trim(womangrid.Cells[womangrid.Col,womangrid.row])+'女';
// addyj:=100;
end;
if (activecontrol=grid1) or (activecontrol=grid2) then
begin
n1.Caption:='登记'+rmno+'房间';
end
else
begin
n1.Caption:='登记'+rmno+'散座';
rmno:=copy(rmno,1,3);
end;
popupmenu1.items[0].enabled:=false;
// popupmenu1.items[1].enabled:=false;
if ls='0' then
begin
for i:=1 to rmnogrid.rowcount-1 do
if trim(rmnogrid.Cells [0,i])=trim(rmno) then
break;
if i>rmnogrid.rowcount-1 then
popupmenu1.items[0].enabled:=true;
end;
end;
end;
procedure Tdjform.rmnogridExit(Sender: TObject);
var
aa:array [0..1] of string;
i,j:integer;
ss:string;
begin
j:=rmnogrid.rowcount-1;
ss:='';
for i:=1 to rmnogrid.rowcount-1 do
if (length(trim(rmnogrid.cells[0,i]))<>0) then
begin
if (length(trim(rmnogrid.cells[1,i]))<>0) then
begin
aa[0]:='';
getvalue(aa,'select status from room where roomno='''+trim(rmnogrid.cells[0,i])+'''');
if ((aa[0]<>'0')and(aa[0]<>'5')) or (aa[0]='') then
begin
if j>i then j:=i ;
ss:=ss+rmnogrid.cells[0,i]+' ';
end;
end;
if (length(trim(rmnogrid.cells[1,i]))=0) and (trim(rmnogrid.cells[15,i])='1') then
begin
aa[0]:='';
getvalue(aa,'select status from mansan where roomno='''+trim(rmnogrid.cells[0,i])+'''');
if (aa[0]<>'0') or (aa[0]='') then
begin
if j>i then j:=i ;
ss:=ss+rmnogrid.cells[0,i]+' ';
end
end;
if (length(trim(rmnogrid.cells[1,i]))=0) and (trim(rmnogrid.cells[15,i])='0') then
begin
aa[0]:='';
getvalue(aa,'select status from womansan where roomno='''+trim(rmnogrid.cells[0,i])+'''');
if (aa[0]<>'0') or (aa[0]='') then
begin
if j>i then j:=i ;
ss:=ss+rmnogrid.cells[0,i]+' ';
end
end;
end;
if trim(ss)<>'' then
begin
showmessage('手号 '+ss+' 非法!');
rmnogrid.row:=j;
rmnogrid.setfocus;
end;
yj.setfocus;
{ for i:=1 to rmnogrid.rowcount-1 do
begin
// if length(trim(rmnogrid.cells[1,i]))<>0 then
// rmnogrid.cells[3,i]:='';
if length(trim(rmnogrid.cells[3,i]))<>0 then
rmnogrid.cells[1,i]:='';
end; }
{ for i:=1 to rmnogrid.rowcount-1 do
begin
if length(trim(rmnogrid.cells[0,i]))=0 then
rmnogrid.cells[2,i]:=''
else
if length(trim(rmnogrid.cells[2,i]))=0 then
begin
aa[0]:='';
getvalue(aa,'select roomtype from room where roomno='''+trim(rmnogrid.cells[0,i])+'''');
if length(trim(aa[0]))>0 then
begin
bb[0]:='';
getvalue(bb,'select bednum from roomtype where roomtype='''+trim(aa[0])+'''');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -