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

📄 addpos.pas

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

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Mask, Db, DBTables, Grids, DBGrids, ExtCtrls;

type
  Taddyj = class(TForm)
    Label1: TLabel;
    hdno: TMaskEdit;
    Bevel1: TBevel;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    qu1: TQuery;
    Button2: TButton;
    Button3: TButton;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    olddeposit: TMaskEdit;
    adddeposit: TMaskEdit;
    newdeposit: TMaskEdit;
    Panel1: TPanel;
    Panel2: TPanel;
    DBGrid2: TDBGrid;
    DataSource2: TDataSource;
    hz: TQuery;
    Label5: TLabel;
    xfhj: TMaskEdit;
    Panel8: TPanel;
    man: TRadioButton;
    woman: TRadioButton;
    name: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure hdnoExit(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure hdnoEnter(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button3Click(Sender: TObject);
    procedure adddepositExit(Sender: TObject);
    procedure adddepositKeyPress(Sender: TObject; var Key: Char);
    procedure hdnoDblClick(Sender: TObject);
    procedure hdnoKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  addyj: Taddyj;

implementation
uses dataproc, newdj;

{$R *.DFM}
var
 acc,lsex,wel:string;
 recnum:integer;

procedure formini;
begin
with addyj do
   begin
   hdno.text:='';
   olddeposit.text:='0';
   adddeposit.text:='';
   newdeposit.text:='';
   xfhj.text:=''; name.Text:='';
   end
end;

procedure seeother;
var
  aa:array [0..1] of string;
begin
with addyj do
  begin
  if recnum>1 then
     begin
     aa[0]:='';                                                                 // and sex='''+trim(lsex)+''')
     getvalue(aa,'select accno,welid from nowin where handno='''+trim(hdno.text)+'''');
     acc:=aa[0];
     wel:=aa[1];
     end;
  qu1.Active :=false;
  qu1.sql.clear;
  qu1.sql.add('select sum(deposit) as totyj from deposit where accno=:paccno');
  qu1.ParamByName ('paccno').asstring:=acc;
  qu1.Prepare;
  qu1.open;
  qu1.Active :=true;
  adddeposit.text:='0';
  olddeposit.text:=floattostr(qu1.fieldbyname('totyj').asfloat);
  newdeposit.text:=olddeposit.text;
  qu1.active:=false;
  qu1.sql.clear;
  qu1.sql.add('select deposit,deposittime from deposit where accno=:paccno');
  qu1.ParamByName ('paccno').asstring:=acc;
  qu1.prepare;
  qu1.open;
  chinesegrid(dbgrid1);
  qu1.active:=true;
  hz.Active :=false;
  hz.sql.clear;
  hz.sql.add('select sum(custom.money) from custom where accno=:paccno and (custom.ismd=0) ');
  hz.ParamByName ('paccno').asstring:=acc;
  hz.Prepare;
  hz.open;
  xfhj.Text:=hz.Fields[0].asstring;
  hz.Active :=false;
  hz.sql.clear;
  hz.sql.add('select custom.handno,lssex.sexname,sum(custom.money) as hjmoney from custom,lssex where accno=:paccno and ((custom.ismd=0) and (lssex.sex=custom.sex)) group by custom.handno,lssex.sexname');
  hz.ParamByName ('paccno').asstring:=acc;
  hz.Prepare;
  hz.open;
  chinesegrid(dbgrid2);
  hz.Active :=true;
  end;
end;


procedure Taddyj.FormCreate(Sender: TObject);
begin
   formini;
end;

procedure Taddyj.hdnoExit(Sender: TObject);
begin
  if length(trim(hdno.Text))>0 then
  begin
     qu1.active:=false;
     qu1.sql.clear;
     qu1.sql.add('select accno,welid from nowin where handno=:phandno ');
    // qu1.sql.add('select accno,name from guestmx where roomno=:phandno');
     qu1.ParamByName ('phandno').asstring:=trim(hdno.text);
   {  if (Panel8.Visible) then
     begin
        if (man.Checked) then
          lsex:='1';
        if (woman.Checked) then
          lsex:='0';
     end
     else
        lsex:='2';
     qu1.ParamByName ('psex').asstring:=lsex; }
     qu1.Prepare;
     qu1.open;
     acc:=qu1.fieldbyname('accno').asstring;
     wel:=qu1.fieldbyname('welid').asstring;
    // name.Text:=
     seeother;
  end;
end;

procedure Taddyj.Button1Click(Sender: TObject);
var
  bb:array [0..1] of string;
  c:double;
begin
   if length(trim(hdno.text))=0 then
      begin
      showmessage('手号不能为空');
      hdno.SetFocus ;
      exit;
      end;
   //if strtofloat(adddeposit.text)>0 then
   if ((strtofloat(newdeposit.text)>=0) and (strtofloat(adddeposit.text)<>0)) then
      begin
      qu1.Active :=false;
      qu1.sql.clear;
      qu1.sql.add('insert into deposit values(:phdno,:psex,:paccno,:pwel,:pdeposit,:pdeposittime)');
      qu1.sql.add('insert into bjyjb values(:phdno,'''',:pdeposit,:pdeposittime,'''+curper.code+''',:paccno,:pwel)');
      qu1.ParamByName ('phdno').asstring:=trim(hdno.text);
      qu1.ParamByName ('paccno').asstring:=acc;
      if (man.Checked =false) and (woman.Checked =false) then
          qu1.ParamByName ('psex').asstring:='2';
      if man.Checked =true then
          qu1.ParamByName ('psex').asstring:='1';
      if woman.Checked =true then
          qu1.ParamByName ('psex').asstring:='0';
      qu1.ParamByName ('pwel').asstring:=trim(wel);
      qu1.ParamByName ('pdeposit').asfloat:=strtofloat(adddeposit.text);
      qu1.ParamByName ('pdeposittime').asdatetime:=now;
      qu1.Prepare;
      qu1.ExecSQL ;
      getvalue(bb,'select deposit from account where accno='''+trim(acc)+'''');
      c:=strtofloat(bb[0])+strtofloat(adddeposit.text);
      qu1.Active :=false;
      qu1.sql.clear;
      qu1.sql.add('update account set deposit=:pdeposit where accno=:paccno');
      qu1.ParamByName ('pdeposit').asfloat:=c;
      qu1.ParamByName ('paccno').asstring:=trim(acc);
      qu1.prepare;
      qu1.execsql;
      addlogo(curper.code,datetimetostr(now),trim(acc)+'交押金'+trim(hdno.text));
      showmessage('补交成功');
      formini;
      qu1.active:=false;
      end;
end;

procedure Taddyj.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=112 then
  begin
     if xt=0 then help(7);
  end;
  if key=13 then
     selectnext(activecontrol,true,true);
  if key=27 then
     addyj.Close;
end;

procedure Taddyj.hdnoEnter(Sender: TObject);
begin
  hdno.Text:='';
  formini;
  hz.Close;
  qu1.Close;
end;

procedure Taddyj.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  qu1.free;
end;



procedure Taddyj.Button3Click(Sender: TObject);
begin
  addyj.close;
end;

procedure Taddyj.adddepositExit(Sender: TObject);
var
  i:integer;
begin
   if length(trim(adddeposit.text))=0 then
      adddeposit.text:='0'
   else
      try
        i:=strtoint(trim(adddeposit.text));
      except
        showmessage('押金错误');
        adddeposit.SetFocus ;
        exit;
      end;
   newdeposit.text:=floattostr(strtofloat(olddeposit.text)+strtofloat(adddeposit.text));
end;

procedure Taddyj.adddepositKeyPress(Sender: TObject; var Key: Char);
begin
  if ((key<'0') or (key>'9')) then
     if (key<>char(8)) and (key<>'-') then
        key:=char(0);
end;

procedure Taddyj.hdnoDblClick(Sender: TObject);
begin
  Application.CreateForm(Tdjform, djform);
  djform.Panel1.Visible:=false;
  djform.rmnogrid.Visible:=false;
  djform.Button1.Enabled:=false;
  djform.Timer1.Free;
  djform.showmodal;
  hdno.Text:=copy(trim(djform.xfrmno.Text),1,6);
  if length(trim(djform.xfrmno.Text))>6 then
  begin
    Panel8.Visible:=true;
    if trim(copy(trim(djform.xfrmno.Text),7,6))='1' then
    begin
      man.Checked:=true;
      woman.Checked:=false;
    end
    else
    begin
      man.Checked:=false;
      woman.Checked:=true;
    end;
  end
  else Panel8.Visible:=false;
  djform.Free;
  activecontrol:=adddeposit;

end;

procedure Taddyj.hdnoKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;

end.

⌨️ 快捷键说明

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