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

📄 bkjzunit.pas

📁 东华休闲山庄洗浴、餐饮、客房管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      node:=self.suiTreeView1.Items.GetFirstNode;
      node:=self.suiTreeView1.Items.AddChild(node,Copy(temp,1,Pos(';',temp)-1)+':'+LoginForm.dsQuery.Fields[1].AsString);
      LoginForm.dsQuery.Close;
      Delete(temp,1,Pos(';',temp));
      while Pos(';',temp)>0 do
        begin
          Self.suiTreeView1.Items.AddChild(node,Copy(temp,1,Pos(';',temp)-1));
          Delete(temp,1,Pos(';',temp));
        end;
      Self.suiTreeView1.Items.EndUpdate;
      sql:='select lbxf_sph,lbxf_xfxm,lbxf_xmdj,lbxf_dzbl,lbxf_xfsl,'+
                  'lbxf_xfje,lbxf_xfbegin,lbxf_jjdw,lbxf_jzr,'+
                  '(1-lbxf_dzbl)*lbxf_xmdj*lbxf_xfsl as lbxf_yhje '+
           'from consume ';
      str:='where Lbxf_xfbh='''+id+''' ';
      str1:='where id='''+id+''' ';
      node:=self.suiTreeView1.Items.GetFirstNode;
      count:=node.Count;
      node:=node.getFirstChild;
      if Count>1 then
        begin
          for index:=2 to count do
            begin
              node:=node.getNextSibling;
              temp:=node.Text;
              Delete(temp,1,Pos(':',temp));
              str:=str+'or Lbxf_xfbh='''+temp+''' ';
              str1:=str1+'or id='''+temp+''' ';
            end;
        end;
      sql:=sql+str;
      sql:=sql+'order by Lbxf_xfbh,lbxf_sph';
      loginform.ExecuteSQL('select sum(deposit) from house '+str1);
      self.Label37.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[0].AsFloat);
      LoginForm.dsQuery.Close;
      LoginForm.ExecuteSQL('select sum(lbxf_xfje),sum((1-lbxf_dzbl)*lbxf_xmdj*lbxf_xfsl) from consume '+str);
      self.Label33.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[0].AsFloat);
      self.Label42.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[0].AsFloat);
      self.Label35.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[1].AsFloat);
      self.Label31.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[0].AsFloat+
                                               LoginForm.dsQuery.Fields[1].AsFloat);
      a:=self.Label37.Caption;
      b:=self.Label33.Caption;
      self.Label41.Caption:=FormatFloat('0.00',StrToFloat(a)-StrToFloat(b));
      LoginForm.dsQuery.Close;
      self.suiPanel1.Caption:='结账区内房间 消费清单 合计:'+self.Label33.Caption;
      Self.Refrush(sql);
    end;
end;

procedure TBKJZForm.suiArrowButton2Click(Sender: TObject);
var
  node:TTreeNode;
  temp:string;
  sql:string;
  index:Integer;
  count:Integer;
  str,str1:string;
  a,b:string;
begin
  node:=self.suiTreeView1.Selected;
  if node.Level=1 then
    begin
      temp:=node.Text;
      node.Delete;
      Delete(temp,1,Pos(':',temp));
      LoginForm.ExecuteSQL('select memozs,id from house where id='''+temp+'''');
      temp:=LoginForm.dsQuery.Fields[0].AsString;
      Delete(temp,1,9);
      Self.suiTreeView2.Items.BeginUpdate;
      node:=self.suiTreeView2.Items.Add(nil,Copy(temp,1,Pos(';',temp)-1)+':'+LoginForm.dsQuery.Fields[1].AsString);
      LoginForm.dsQuery.Close;
      Delete(temp,1,Pos(';',temp));
      while Pos(';',temp)>0 do
        begin
          Self.suiTreeView2.Items.AddChild(node,Copy(temp,1,Pos(';',temp)-1));
          Delete(temp,1,Pos(';',temp));
        end;
      Self.suiTreeView2.Items.EndUpdate;
      sql:='select lbxf_sph,lbxf_xfxm,lbxf_xmdj,lbxf_dzbl,lbxf_xfsl,'+
                  'lbxf_xfje,lbxf_xfbegin,lbxf_jjdw,lbxf_jzr,'+
                  '(1-lbxf_dzbl)*lbxf_xmdj*lbxf_xfsl as lbxf_yhje '+
           'from consume ';
      str:='where Lbxf_xfbh='''+id+''' ';
      str1:='where id='''+id+''' ';
      node:=self.suiTreeView1.Items.GetFirstNode;
      count:=node.Count;
      node:=node.getFirstChild;
      if Count>1 then
        begin
          for index:=2 to count do
            begin
              node:=node.getNextSibling;
              temp:=node.Text;
              Delete(temp,1,Pos(':',temp));
              str:=str+'or Lbxf_xfbh='''+temp+''' ';
              str1:=str1+'or id='''+temp+''' ';
            end;
        end;
      sql:=sql+str;
      sql:=sql+'order by Lbxf_xfbh,lbxf_sph';
      loginform.ExecuteSQL('select sum(deposit) from house '+str1);
      self.Label35.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[0].AsFloat);
      LoginForm.dsQuery.Close;
      LoginForm.ExecuteSQL('select sum(lbxf_xfje),sum((1-lbxf_dzbl)*lbxf_xmdj*lbxf_xfsl) from consume '+str);
      self.Label33.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[0].AsFloat);
      self.Label42.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[0].AsFloat);
      self.Label37.Caption:=FormatFloat('0.00',LoginForm.dsQuery.Fields[1].AsFloat);
      a:=self.Label35.Caption;
      b:=self.Label33.Caption;
      self.Label41.Caption:=FormatFloat('0.00',StrToFloat(a)-StrToFloat(b));
      LoginForm.dsQuery.Close;
      self.suiPanel1.Caption:='结账区内房间 消费清单 合计:'+self.Label33.Caption;
      Self.Refrush(sql);
    end;
end;

procedure TBKJZForm.dbgrd1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  if dbgrd1.DataSource.DataSet.RecNo mod 2 = 0 theN
    dbgrd1.Canvas.Brush.Color:=clSilver
  else
    dbgrd1.Canvas.Brush.Color:=clYellow;
  dbgrd1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;

procedure TBKJZForm.suiButton2Click(Sender: TObject);
var
  rzid:string;
  count,index:Integer;
  state:string;
  node:TTreeNode;
  temp:string;
  room:string;
  sql:string;
begin
  state:='已结账';
  if self.suiCheckBox1.Checked then
    begin
      state:=Self.suiCheckBox1.Caption;
      if self.suiCheckBox6.Checked then
        begin
          self.Label41.Caption:=FormatFloat('0.00',strtofloat(Self.Label37.Caption));
          self.Label37.Caption:='0.00';
          self.Label42.Caption:='0.00';
        end
      else
        begin
          self.Label33.Caption:=FormatFloat('0.00',strtofloat(Self.Label33.Caption)-strtofloat(Self.Label37.Caption));
          self.Label42.Caption:=self.Label37.Caption;
          self.Label37.Caption:='0.00';
          self.Label41.Caption:='0.00';
        end;
    end
  else
    if self.suiCheckBox2.Checked then
      begin
        state:=Self.suiCheckBox2.Caption;
        self.Label41.Caption:=FormatFloat('0.00',strtofloat(Self.Label37.Caption));
        Self.Label37.Caption:='0.00';
        Self.Label42.Caption:='0.00';
      end;
  rzid:=id+';';
  node:=self.suiTreeView1.Items.GetFirstNode;
  count:=node.Count;
  node:=node.getFirstChild;
  if Count>1 then
    begin
      for index:=2 to count do
        begin
          node:=node.getNextSibling;
          temp:=node.Text;
          Delete(temp,1,Pos(':',temp));
          rzid:=rzid+temp+';';
        end;
    end;
  node:=self.suiTreeView1.Items.GetFirstNode.getFirstChild;
  temp:=node.Text;
  room:=Copy(temp,1,Pos(':',temp)-1)+'/';
  node:=node.GetNext;
  while node<>nil do
    begin
      temp:=node.Text;
      room:=room+Copy(temp,1,Pos(':',temp)-1)+'/';
      node:=node.GetNext;
    end;
  loginform.ExecuteSQL('insert into bkjz '+
                       'values('''+self.Label8.Caption+''','''+rzid+''','''+guestid+''','''+self.Label33.Caption+
                               ''','''+self.Label37.Caption+''','''+self.Label35.Caption+
                               ''','''+self.Label42.Caption+''','''+self.Label41.Caption+
                               ''','''+formatdatetime('yyyy-mm-dd hh:nn:ss',now)+
                               ''','''+paymode+''','''+loginform.username+''','''+state+''')');
  sql:='update room set room_state=''清理'',room_ID=''''';
  temp:=room;
  sql:=sql+' where room_num='''+Copy(temp,1,Pos('/',temp)-1)+'''';
  Delete(temp,1,Pos('/',temp));
  while Pos('/',temp)>0 do
    begin
      sql:=sql+' or room_num='''+Copy(temp,1,Pos('/',temp)-1)+'''';
      Delete(temp,1,Pos('/',temp));
    end;
  loginform.ExecuteSQL(sql);
  Delete(room,Length(room),1);
  loginform.ExecuteSQL('insert into log '+
                       'values('''+formatdatetime('yyyy-mm-dd hh:nn:ss',now)+
                               ''','''+loginform.userid+''','''+LoginForm.username+
                               ''',''房间【'+room+'】结账成功,结账状态为【'+state+'】'')');
  MessageDlg('房间【'+room+'】结账成功,结账状态为【'+state+'】!',mtConfirmation, [mbYes], 0);
  close;
end;

procedure TBKJZForm.suiCheckBox1Click(Sender: TObject);
begin
  if suiCheckBox1.Checked then
    begin
      suiCheckBox2.Checked:=false;
      suiCheckBox6.Checked:=True;
    end;
end;

procedure TBKJZForm.suiCheckBox2Click(Sender: TObject);
begin
  if suiCheckBox2.Checked then
    begin
      suiCheckBox1.Checked:=false;
      suiCheckBox6.Checked:=True;
    end;
end;

procedure TBKJZForm.img1Click(Sender: TObject);
var
  count:Integer;
  temp:string;
  index:Integer;
  node:TTreeNode;
begin
  sql:='select * from yjgl where';
  node:=suiTreeView1.Items.GetFirstNode;
  count:=node.Count;
  node:=node.getFirstChild;
  if Count=0 then
    begin
      MessageDlg('尚无对应的押金信息!',mtConfirmation, [mbYes], 0);
      exit;
    end;
  for index:=1 to count do
    begin
      temp:=node.Text;
      Delete(temp,1,Pos(':',temp));
      sql:=sql+' yj_bh='''+temp+''' or';
      node:=node.getNextSibling;
    end;
  Delete(sql,Length(sql)-2,3);
  sql:=sql+' order by yj_bh,yj_sph';
  application.CreateForm(TYJSelectForm,YJSelectForm);
  YJSelectForm.Show;
  Enabled:=False;
end;

end.

⌨️ 快捷键说明

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