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

📄 zdwh.pas

📁 集成酒店桑拿食管管理的完整程序
💻 PAS
字号:
unit zdwh;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, Grids, ExtCtrls;

type
  TzdwhForm = class(TForm)
    GroupBox1: TGroupBox;
    StringGrid1: TStringGrid;
    add: TBitBtn;
    addall: TBitBtn;
    del: TBitBtn;
    delall: TBitBtn;
    GroupBox2: TGroupBox;
    StringGrid2: TStringGrid;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    kfh: TComboBox;
    cwsys: TComboBox;
    kfm: TComboBox;
    procedure FormShow(Sender: TObject);
    procedure StringGrid2Click(Sender: TObject);
    procedure kfmExit(Sender: TObject);
    procedure StringGrid1DblClick(Sender: TObject);
    procedure StringGrid2DblClick(Sender: TObject);
    procedure StringGrid2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure addallClick(Sender: TObject);
    procedure delallClick(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  zdwhForm: TzdwhForm;

implementation
uses dataproc;
{$R *.DFM}

procedure TzdwhForm.FormShow(Sender: TObject);
var i,j,k:integer;
begin
  StringGrid1.Cells[0,0]:='      消费类型';
  StringGrid2.Cells[0,0]:='      消费类型';
  StringGrid2.Cells[1,0]:='      存放库房';
 { fm.Query3.Active:=false;
  fm.Query3.SQL.Clear;
  fm.Query3.SQL.Add('select * from 仓库');
  fm.Query3.Open;
  kfm.Items.Clear;
  kfh.Items.Clear;
  while not fm.Query3.Eof do
  begin
    kfm.Items.Add(fm.Query3.fieldbyname('仓库名称').asstring);
    kfh.Items.Add(fm.Query3.fieldbyname('ID').asstring);
    fm.Query3.Next;
  end;
  fm.Query3.Active:=false;
  fm.Query3.SQL.Clear; }
  cwsys.Items.Clear;
  try
    cwsys.Items.LoadFromFile(curper.workpath+'\cwsys.dll');
  except
  end;
  k:=0;
  for i:=2 to cwsys.Items.Count-1 do
  begin
    StringGrid2.Cells[2,i-1]:=copy(cwsys.Items[i],1,4);
    StringGrid2.Cells[3,i-1]:=trim(copy(cwsys.Items[i],5,10));
    StringGrid2.Cells[0,i-1]:=copy(cwsys.Items[i],15,30);
    StringGrid2.Cells[1,i-1]:=trim(copy(cwsys.Items[i],45,30));
    k:=k+1;
  end;
  if k<2 then stringgrid2.RowCount:=2 else stringgrid2.RowCount:=k;
  fm.Query2.Active:=false;
  fm.Query2.SQL.Clear;                      //parentcode=''00'' or
  fm.Query2.SQL.Add('select * from custype where  parentcode=''0''');
  fm.Query2.Open;
  i:=1;
  while not fm.Query2.Eof do
  begin
    j:=1;k:=1;
    while trim(StringGrid2.Cells[2,j])<>'' do
    begin
      if trim(StringGrid2.Cells[2,j])=trim(fm.Query2.FieldByName('custype').asstring) then
        k:=0;
      j:=j+1;
    end;
    if k=1 then
    begin
      StringGrid1.Cells[2,i]:=fm.Query2.FieldByName('custype').asstring;
      StringGrid1.Cells[0,i]:=fm.Query2.FieldByName('cusname').asstring;
      i:=i+1;
    end;
    fm.Query2.Next;
  end;
  stringgrid1.RowCount:=i+stringgrid2.RowCount;
  stringgrid2.RowCount:=stringgrid1.RowCount ;
  fm.Query2.Active:=false;
  fm.Query2.SQL.Clear;
end;

procedure TzdwhForm.StringGrid2Click(Sender: TObject);
var i:integer;
begin
   if (trim(stringgrid2.Cells[0,stringgrid2.Row])<>'') and (stringgrid2.Col=1) then
   begin
     kfm.Top:=35+(StringGrid2.Row-StringGrid2.TopRow)*19;
     kfm.Visible:=true;
     if trim(stringgrid2.Cells[1,stringgrid2.Row])<>'' then
     for i:=0 to kfm.Items.Count-1 do
       if trim(stringgrid2.Cells[3,stringgrid2.Row])=trim(kfh.Items[i]) then
       begin
         kfm.text:=kfm.Items[i];
         kfm.ItemIndex:=i;
       end;
     kfm.SetFocus;
   end;
end;

procedure TzdwhForm.kfmExit(Sender: TObject);
begin
  stringgrid2.Cells[1,stringgrid2.Row]:=kfm.Text;
  if trim(kfm.Text)='' then
    stringgrid2.Cells[3,stringgrid2.Row]:='' else
    stringgrid2.Cells[3,stringgrid2.Row]:=kfh.Items[kfm.ItemIndex];
  kfm.Text:='';
  kfm.Visible:=false;
end;

procedure TzdwhForm.StringGrid1DblClick(Sender: TObject);
begin
  oldtonew(stringgrid1,stringgrid2,3);
end;

procedure TzdwhForm.StringGrid2DblClick(Sender: TObject);
begin
  stringgrid2.Cells[1,stringgrid2.Row]:='';
  stringgrid2.Cells[3,stringgrid2.Row]:='';
  oldtonew(stringgrid2,stringgrid1,3);

end;

procedure TzdwhForm.StringGrid2KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if stringgrid2.Col=1 then  StringGrid2Click(nil);
end;

procedure TzdwhForm.addallClick(Sender: TObject);
var i,j,k:integer;
begin
  i:=1 ;
  while trim(stringgrid2.Cells[0,i])<>'' do
  begin
    stringgrid2.Cells[1,i]:='';
    stringgrid2.Cells[3,i]:='';
    k:=1;
    while trim(stringgrid1.Cells[0,k])<>'' do k:=k+1;
    for j:=0 to 3 do
    begin
      stringgrid1.Cells[j,k]:=stringgrid2.Cells[j,i];
      stringgrid2.Cells[j,i]:='';
    end;
    i:=i+1;
  end;
end;

procedure TzdwhForm.delallClick(Sender: TObject);
var i,j,k:integer;
begin
  i:=1 ;
  while trim(stringgrid1.Cells[0,i])<>'' do
  begin
    k:=1;
    while trim(stringgrid2.Cells[0,k])<>'' do k:=k+1;
    for j:=0 to 3 do
    begin
      stringgrid2.Cells[j,k]:=stringgrid1.Cells[j,i];
      stringgrid1.Cells[j,i]:='';
    end;
    i:=i+1;
  end;
end;

procedure TzdwhForm.BitBtn3Click(Sender: TObject);
begin
  close;
end;

procedure TzdwhForm.BitBtn1Click(Sender: TObject);
var i:integer; ls:string;
begin
  ls:=cwsys.Items[0];
  cwsys.Items.Clear;
  cwsys.Items.Add(ls);
  cwsys.Items.Add('库存商品设置');
  ls:='                              ';
  i:=1;
{  while trim(stringgrid2.Cells[0,i])<>'' do
  begin
    if trim(stringgrid2.Cells[1,i])='' then
    begin
      if messagedlg(trim(stringgrid2.Cells[0,i])+'的仓库是否能为空?',mtInformation, [mbYes, mbNo], 0) = mrno then
     // showmessage(trim(stringgrid2.Cells[0,i])+'仓库不能为空') ;
      exit;
    end;
      i:=i+1;
  end; }
  i:=1;
  while trim(stringgrid2.Cells[0,i])<>'' do
  begin
    cwsys.Items.Add(copy(trim(stringgrid2.Cells[2,i])+'    ',1,4)+copy(trim(stringgrid2.Cells[3,i])+'          ',1,10)+copy(trim(stringgrid2.Cells[0,i])+ls,1,30)+copy(trim(stringgrid2.Cells[1,i])+ls,1,30));
    i:=i+1;
  end;
    cwsys.Items.SaveToFile(curper.workpath+'\cwsys.dll');
    showmessage('ok,设置成功!');
    close;
end;

end.

⌨️ 快捷键说明

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