⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newdj.pas

📁 集成酒店桑拿食管管理的完整程序
💻 PAS
📖 第 1 页 / 共 5 页
字号:
         q1.ParamByName('pstatus').asstring :='4'
      else
      begin
         if (CheckBox2.Checked)and (jzfsname.ItemIndex=0)   then
         q1.ParamByName('pstatus').asstring :='7' else
         q1.ParamByName('pstatus').asstring :='1';
         CheckBox2.Checked:=false
      end;
      q1.ParamByName('proomno').asstring :=trim(rmnogrid.cells[0,i]);
      q1.Prepare;
      q1.ExecSQL;
      q1.Active :=false;
      q1.UnPrepare;
      i:=i+1;
    end;
   end;
end;

procedure Tdjform.Button1Click(Sender: TObject);
var
     i:integer;  str:string;
     rmflag:boolean;
begin
  servertime(NIL);
     szacc:='';
     cfhd:='';
    str:='';
   for i:=1 to rmnogrid.RowCount do
      if trim(rmnogrid.cells[0,i])<>'' then
      begin
        query1.Active:=false;
        query1.SQL.Clear;
        query1.SQL.Add('select roomno from nowin where roomno='''+trim(rmnogrid.cells[0,i])+'''');
        query1.Prepare;
        query1.Open;
        if query1.RecordCount<>0 then
        begin
           showmessage('房间:'+trim(rmnogrid.cells[0,i])+'错误!《请核对,数据校验后再录入!》');
           FormShow(nil);
           exit;
        end;
        { if trim(rmnogrid.cells[5,i])='' then
         begin
          showmessage('房间:'+trim(rmnogrid.cells[0,i])+'鞋牌号没有输入');
          exit;
         end; }
        { if (trim(rmnogrid.cells[7,i])<>'4') and (trim(rmnogrid.cells[7,i])<>'12') and (trim(rmnogrid.cells[7,i])<>'24') then
         begin
          showmessage('房间:'+trim(rmnogrid.cells[0,i])+'周转时间不对');
          exit;
         end;}
         if trim(rmnogrid.cells[4,i])='' then
         begin
          showmessage('房间:'+trim(rmnogrid.cells[0,i])+'房价没有输入');
          exit;
         end;
      end;
     rmflag:=checkgrid(rmnogrid);
     if (not rmflag) then
     begin
        messagedlg('没有选择手号',mtInformation,[mbok],0);
        exit;
     end ;
     if length(trim(cfhd))>0 then
     begin
        showmessage('手号'+cfhd+' 错误');
        rmnogrid.SetFocus ;
        exit;
     end;
     if  length(trim(pdj.text))=0 then
     begin
       showmessage('单号不能为空');
       pdj.SetFocus ;
       exit;
     end;
   if trim(szno.Text)='' then
   begin
     q1.Close;
     q1.SQL.Clear;
     q1.sql.Add('select * from qbnowin where djcode='''+trim(pdj.Text)+'''');
  //   q1.sql.Add('union(select * from lsnowin where djcode='''+trim(pdj.Text)+''')');
     q1.Prepare;
     q1.Open;
      if q1.RecordCount<>0 then
      begin
        showmessage('登记单号重复,请核对后再录入');
        exit;
      end;
    end;
  //   szacc:=getnewcode('accno');
     if length(trim(szno.text))=0 then
        begin
          szacc:=getnewcode('accno');
//         szacc:=xdh('nowin','lsnowin','accno',6);;
         lsmd:=(md.Checked) and (mxf.Checked) ;
        end
     else
        begin
        q1.Active :=false;
        q1.sql.Clear ;
        q1.sql.add('select accno,ismd from nowin where ((handno=:phdno) and (sex=:pxb))');
        q1.ParamByName ('phdno').asstring:=trim(szno.text);
        if man.Checked =true  then
           q1.ParamByName ('pxb').asstring:='1';
        if woman.Checked =true  then
           q1.ParamByName ('pxb').asstring:='0';
        if (man.Checked =false) and (woman.Checked =false)  then
        BEGIN
           if copy(trim(szno.text),1,1)='Y' then
           q1.ParamByName ('pxb').asstring:='3'
           else
           q1.ParamByName ('pxb').asstring:='2';
        end;
        q1.Prepare;
        q1.open;
        q1.Active :=true;
        if q1.RecordCount >0 then
           begin
           szacc:=q1.fieldbyname('accno').asstring;
           lsmd:=q1.FieldByName ('ismd').asboolean;
           q1.Active :=false;
           end
        else
           begin
           showmessage('随帐手号错误');
           q1.Active :=false;
           q1.UnPrepare;
           exit;
           end;
        end;
   if szacc='' then
   begin
     showmessage('操作有误,请重来!');
     exit;
   end;
   //********find a djno**********************//
 //  if trim(pdj.Text)='' then
 //    pdj.Text:=xdh('nowin','lsnowin','djcode',6);
   rmno:='';
   for i:=1 to rmnogrid.RowCount do
      if trim(rmnogrid.cells[0,i])<>'' then
      begin
         rmno:=rmnogrid.cells[0,i];
         break;
      end;
   //***********database is nowin *****************//
   if rmflag then
       ADDman;
   //******* database is account *****************//
    //***********curbcinfo *****************//
    q1.Active :=false;
    q1.sql.clear;
    q1.sql.add('update curbcinfo set room=room+:prm,man=man+:pman,woman=woman+:pwoman,zdroom=zdroom+:pzdrm');
    q1.ParamByName ('prm').asinteger:=roomnum;
    q1.ParamByName ('pman').asinteger:=mannum;
    q1.ParamByName ('pwoman').asinteger:=womannum;
    q1.ParamByName ('pzdrm').asinteger:=zdrmnum;
    q1.Prepare;
    q1.ExecSQL ;
    if md.Checked then str:=str+',免房费';
    if mxf.Checked then str:=str+',免消费';
    addlogo(curper.code,datetimetostr(now),'登记'+trim(pdj.Text)+'方式:'+trim(jzfsname.Text)+' '+str);
    q1.Active :=false;
    q1.UnPrepare;
    showmessage('登记成功');
    init;
end;


procedure Tdjform.Timer1Timer(Sender: TObject);
var col,row:integer;
begin
   maskedit1.Text :=datetimetostr(now);
   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;

end;

procedure Tdjform.Button2Click(Sender: TObject);
begin
   djform.close;
end;

procedure Tdjform.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=13 then
     selectnext(activecontrol,true,true);
  if key=27 then
      close;
  if key=112 then
  if not Panel1.Visible then
  begin
    if xt=1 then help(6);
    if xt=0 then help(10);
  end
  else
  begin
    if xt=0 then help(1);
  end;


end;

procedure Tdjform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   edit2.Text:='';
   timer1.free;
   q1.Free;
   q2.Free;
end;

procedure Tdjform.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:=8;
   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 Tdjform.rmnogridKeyPress(Sender: TObject; var Key: Char);
begin
  if (rmnogrid.Col<>5) then
        key:=char(0);
 {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];

  if ((key<'0') or (key>'9')) then
     if (key<>char(8)) and (key<>'.') then
        key:=char(0);
end;

procedure Tdjform.rmnogridSelectCell(Sender: TObject; Col, Row: Integer;
  var CanSelect: Boolean);
var
  aa,bb:array [0..1] of string;
begin
  if (col=0) and (rmnogrid.cells[2,currow]='') and (length(trim(rmnogrid.cells[0,currow]))>0) then
     begin
     aa[0]:='';
     getvalue(aa,'select roomtype from room where roomno='''+trim(rmnogrid.cells[0,currow])+'''');
     if length(trim(aa[0]))>0 then
        begin
        bb[0]:='';
        getvalue(bb,'select bednum from roomtype where roomtype='''+trim(aa[0])+'''');
        end;
     rmnogrid.cells[2,currow]:=bb[0];
     end;
     if (col=0) and (rmnogrid.cells[1,currow]='') and (length(trim(rmnogrid.cells[0,currow]))>0) then
        rmnogrid.cells[1,currow]:='0';

end;

procedure Tdjform.rmnogridSetEditText(Sender: TObject; ACol, ARow: Integer;
  const Value: String);
begin
  currow:=arow;
end;

procedure Tdjform.jzfsnameChange(Sender: TObject);
var i,j:integer;
begin

  for j:=0 to jzfsname.Items.Count do
  if  jzfsname.Items[j]=trim(jzfsname.text) then
   jzfsname.ItemIndex:=j;
   jzfs.ItemIndex:=jzfsname.ItemIndex;
   jzfsname.TEXT:=jzfsname.Items[jzfsname.ItemIndex];
   if (trim(jzfsname.text)<>'现金')then
       yj.Text:='0'
   else
   begin
     i:=1;
     while trim(rmnogrid.Cells[0,i])<>'' do
     begin
        yj.Value:=yj.Value+strtoint(rmnogrid.cells[18,i]);
        i:=i+1;
     end;
   end;

    if (trim(jzfsname.text)='免单') or (trim(jzfsname.text)='免费') then
    begin
       md.Checked:=true;
       mxf.Checked:=true;
    end
    else
    begin
       md.Checked:=false;
       mxf.Checked:=false;
    end;
    if (trim(jzfsname.text)='会员卡') or (trim(jzfsname.text)='储值卡') then
    begin
       hykh.Enabled:=true;
       hykh.SetFocus;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -