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

📄 jzjz.pas

📁 集成酒店桑拿食管管理的完整程序
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit jzjz;

interface

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

type
  Tjzjzform = class(TForm)
    Bevel2: TBevel;
    DBGrid1: TDBGrid;
    q1: TQuery;
    q2: TQuery;
    DataSource1: TDataSource;
    s1: TStoredProc;
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Label7: TLabel;
    GroupBox4: TGroupBox;
    man: TRadioButton;
    woman: TRadioButton;
    czy: TMaskEdit;
    begtm: TComboBox;
    xfhdno: TComboBox;
    Panel2: TPanel;
    GroupBox2: TGroupBox;
    Label20: TLabel;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Label4: TLabel;
    zk: TSpinEdit;
    ym: TMaskEdit;
    jj: TMaskEdit;
    mcs: TMaskEdit;
    jym: TMaskEdit;
    yjm: TMaskEdit;
    mm: TEdit;
    GroupBox6: TGroupBox;
    Label3: TLabel;
    gzno: TComboBox;
    mxf: TCheckBox;
    mfj: TCheckBox;
    jzfsname: TComboBox;
    jzfs: TComboBox;
    GroupBox1: TGroupBox;
    Label5: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    Label6: TLabel;
    rm: TMaskEdit;
    rcsm: TMaskEdit;
    sm: TMaskEdit;
    scsm: TMaskEdit;
    xm: TMaskEdit;
    hm: TMaskEdit;
    dhf: TMaskEdit;
    Panel3: TPanel;
    GroupBox5: TGroupBox;
    rmmx: TRadioButton;
    xfmx: TRadioButton;
    dhmx: TRadioButton;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure xfhdnoExit(Sender: TObject);
    procedure manClick(Sender: TObject);
    procedure womanClick(Sender: TObject);
    procedure begtmClick(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure rmmxClick(Sender: TObject);
    procedure xfmxClick(Sender: TObject);
    procedure mxfClick(Sender: TObject);
    procedure mfjClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button4Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure xfhdnoEnter(Sender: TObject);
    procedure jzfsnameChange(Sender: TObject);
    procedure jzfsnameKeyPress(Sender: TObject; var Key: Char);
    procedure xfhdnoChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  jzjzform: Tjzjzform;

implementation
uses dataproc;

{$R *.DFM}
var
  acc:string;

procedure listbegtime;
var
   lssex:string;
begin
with jzjzform do
  begin
  if (man.Checked =false) and (woman.Checked =false) then
     lssex:='2';
  if man.Checked =true then
     lssex:='1';
  if woman.Checked =true then
     lssex:='0';
  q1.Active :=false;
  q1.sql.clear;
  q1.sql.add('select  begtime from gznowin where (handno=:phdno) and (sex=:psex)');
  q1.ParamByName ('phdno').asstring:=trim(xfhdno.text);
  q1.ParamByName ('psex').asstring:=lssex;
  q1.Prepare;
  q1.open;
  q1.Active :=true;
  begtm.Items.Clear ;
  while not q1.eof do
     begin
     begtm.Items.add(datetimetostr(q1.fieldbyname('begtime').asdatetime));
     q1.next;
     end;
  begtm.ItemIndex :=0;
  end;
end;

procedure findacc;
var
 lssex:string;
begin
with jzjzform do
  begin
  if length(trim(begtm.Items[begtm.itemindex]))>0 then
     begin
     if (man.Checked =false) and (woman.Checked =false) then
        lssex:='2';
     if man.Checked =true then
        lssex:='1';
     if woman.Checked =true then
        lssex:='0';
     q1.Active :=false;
     q1.sql.clear;
     q1.sql.add('select accno from gznowin where (handno=:phdno) and (sex=:psex) and (begtime=:pbgtm)');
     q1.ParamByName ('phdno').asstring:=trim(xfhdno.text);
     q1.ParamByName ('psex').asstring:=lssex;
     q1.ParamByName ('pbgtm').asdatetime:=strtodatetime(trim(begtm.items[begtm.itemindex]));
     q1.Prepare;
     q1.open;
     if q1.RecordCount >0 then
        acc:=q1.fieldbyname('accno').asstring;
     q1.Active :=false;
     end;
  end;
end;

procedure Tjzjzform.xfhdnoExit(Sender: TObject);
var
  lssex:string;
  recnum:integer;
begin
   if length(trim(xfhdno.text))>0 then
      begin
      q1.Active :=false;
      q1.sql.clear;
      q1.sql.add('select distinct sex from gznowin where handno=:phdno');
      q1.ParamByName ('phdno').asstring:=trim(xfhdno.text);
      q1.Prepare;
      q1.open;
      q1.Active :=true;
      recnum:=q1.RecordCount ;
      if recnum =0 then
         begin
         q1.Active :=false;
         showmessage('手号错误');
         xfhdno.SetFocus;
         exit;
         end;
      if recnum =1 then
         begin
         lssex:=trim(q1.fieldbyname('sex').asstring);
         man.Enabled :=false;
         woman.Enabled :=false;
         if lssex='2' then
            begin
            man.Checked :=false;
            woman.Checked :=false;
            end;
         if lssex='1' then
            man.checked:=true;
         if lssex='0' then
            woman.Checked :=true;
         listbegtime;
         findacc;
         end;
      if recnum >1 then
         begin
         man.Enabled :=true;
         woman.Enabled :=true;
         man.Checked :=true;
         man.SetFocus ;
         end;
      end
   else
   if activecontrol<>Button4 then
     xfhdno.SetFocus ;
end;

procedure formini;
begin
with jzjzform do
  begin
  xfhdno.text:='';
  begtm.items.clear;
  czy.Text:=curper.name;
  mxf.Checked :=false;
  mfj.Checked :=false;
  jzfs.text:='';
  jzfsname.Text:='';
  jzfs.Text:='';
  gzno.Enabled :=false;
  rm.text:='';
  rcsm.text:='';
  sm.text:='';
  scsm.Text :='';
  xm.Text :='';
  dhf.Text :='';
  hm.Text :='';
  yjm.Text :='';
  mcs.Text :='0';
  zk.Value :=100;
  jj.Text :='0';
  mm.Text :='0';
  ym.Text :='';
  jym.Text :='';
    q1.Active :=false;
    q1.sql.clear;
    q1.sql.add('select distinct handno from gznowin ');
    q1.Prepare;
    q1.open;
    xfhdno.Items.Clear;
    while not q1.Eof do
    begin
      xfhdno.Items.Add(q1.Fields[0].asstring);
      q1.Next;
    end;
    q1.Close;
    q1.UnPrepare;
    q1.Active :=false;
    q1.sql.clear;
  end;
end;

procedure mxffjval;
begin
with jzjzform do
  begin
  if ((mxf.Checked =false) and (mfj.Checked =false)) then
     begin
     ym.text:=floattostr(strtofloat(hm.text)-strtofloat(mcs.text)-strtofloat(mm.text)-(strtofloat(rm.text))*(1-zk.value/100)+strtofloat(jj.text));
     jym.text:=floattostr(strtofloat(yjm.text)-strtofloat(ym.text));
     end;
  if ((mxf.Checked =true) and (mfj.Checked =false)) then
     begin
     ym.text:=floattostr(strtofloat(hm.text)-strtofloat(xm.text)-strtofloat(mcs.text)-strtofloat(mm.text)-(strtofloat(rm.text))*(1-zk.value/100)+strtofloat(jj.text));
     jym.text:=floattostr(strtofloat(yjm.text)-strtofloat(ym.text));
     end;
  if ((mfj.Checked =true) and (mxf.Checked =false)) then
     begin
     ym.text:=floattostr(strtofloat(xm.text)-strtofloat(mcs.text)-strtofloat(mm.text)-(strtofloat(rm.text))*(1-zk.value/100)+strtofloat(jj.text));
     jym.text:=floattostr(strtofloat(yjm.text)-strtofloat(ym.text));
     end;
  if ((mfj.Checked =true) and (mxf.Checked =true)) then
     begin
     ym.text:='0';
     jym.text:=floattostr(strtofloat(yjm.text)-strtofloat(ym.text));
     end;
  if ((mfj.Checked =true) and (mxf.Checked =true)) then
     begin
     jzfsname.Enabled :=false;
     gzno.Enabled :=false;
     jzfsname.Text:='免费';
     jzfs.text:='05';
     end
  else
     begin
     jzfsname.Enabled :=true;
     if jzfsname.Text='免费' then
      begin
       gzno.Enabled :=false;
       jzfsname.Text:='现金';
       jzfs.text:='01';
      end;
     end;
  end;
end;



procedure jjzz;
var
  room,roomcs,san,sancs,cus,yj:double;
begin
  room:=0;
  roomcs:=0;
  san:=0;
  sancs:=0;
 with jzjzform do
   begin
     // room
     q1.active:=false;
     q1.sql.clear;
     q1.sql.add('select roommoney=sum(money), roomcsmoney=sum(csmoney)    from gznowin where accno=:pacc and isbj=1 ');
     q1.parambyname('pacc').asstring:=acc;
     q1.open;
     room:=room+q1.fieldbyname('roommoney').asfloat;
     roomcs:=roomcs+q1.fieldbyname('roomcsmoney').asfloat;
     q1.active:=false;
     q1.sql.clear;
     q1.sql.add('select sum(money) as roommoney,sum(csmoney) as roomcsmoney  from gzchangeroom where accno=:pacc and isbj=1 ');
     q1.parambyname('pacc').asstring:=acc;
     q1.open;
     room:=room+q1.fieldbyname('roommoney').asfloat;
     roomcs:=roomcs+q1.fieldbyname('roomcsmoney').asfloat;
     // san
     q1.active:=false;
     q1.sql.clear;
     q1.sql.add('select sum(money) as sanmoney,sum(csmoney) as sancsmoney  from gznowin where accno=:pacc and isbj=0 ');
     q1.parambyname('pacc').asstring:=acc;
     q1.open;
     san:=san+q1.fieldbyname('sanmoney').asfloat;
     sancs:=sancs+q1.fieldbyname('sancsmoney').asfloat;
     q1.active:=false;
     q1.sql.clear;
     q1.sql.add('select sum(money) as sanmoney,sum(csmoney) as sancsmoney  from gzchangeroom where accno=:pacc and isbj=0 ');
     q1.parambyname('pacc').asstring:=acc;
     q1.open;
     san:=san+q1.fieldbyname('sanmoney').asfloat;
     sancs:=sancs+q1.fieldbyname('sancsmoney').asfloat;
     //cus
     q1.active:=false;
     q1.sql.clear;
     q1.sql.add('select sum(money) as cusmoney from gzcustom where (accno=:pacc and isxj=:pisxj and ismd=:pismd) ');
     q1.parambyname('pacc').asstring:=acc;
     q1.parambyname('pisxj').asboolean:=false;;
     q1.parambyname('pismd').asboolean:=false;;
     q1.open;
     cus:=q1.fieldbyname('cusmoney').asfloat;

{     q1.active:=false;
     q1.sql.clear;
     q1.sql.add('select sum(hjmoney) as phmoney from phonedb where roomno in (select roomno from gznowin where accno=:pacc and ismd=:pismd) ');
     q1.parambyname('pacc').asstring:=acc;
     q1.parambyname('pismd').asboolean:=false;
     q1.open;
     dhf.Text:=floattostr(q1.fieldbyname('phmoney').asfloat);
    // deposit            }
     q1.active:=false;
     q1.sql.clear;
     q1.sql.add('select deposit from gzaccount where accno=:pacc  ');
     q1.parambyname('pacc').asstring:=acc;
     q1.open;
     yj:=q1.fieldbyname('deposit').asfloat;
     q1.active:=false;
     rm.text:=floattostr(room);
     rcsm.text:=floattostr(roomcs);
     sm.text:=floattostr(san);
     scsm.text:=floattostr(sancs);
     xm.text:=floattostr(cus);
     yjm.text:=floattostr(yj);
     hm.text:=floattostr(room+roomcs+san+sancs+cus);
     mxffjval;
  end;
end;


procedure seemx;
begin
with jzjzform do
   begin
    if  rmmx.Checked =true then
        begin
           q2.Active :=false;
           q2.sql.clear;
           q2.sql.add('select handno,s.sexname,begtime,acctime,endtime,money,csmoney from gznowin,lssex s where ((accno=:paccno) and (gznowin.sex=s.sex)) ');
           q2.sql.add('union (select handno,s.sexname,begtime,acctime,endtime,money,csmoney from gzchangeroom,lssex s where ((accno=:pac) and (gzchangeroom.sex=s.sex)) )');
           q2.ParamByName ('paccno').asstring:=acc;
           q2.ParamByName ('pac').asstring:=acc;
           q2.Prepare;
           q2.Open;
           chinesegrid(dbgrid1);
           q2.active:=true;
        end;
     if   xfmx.Checked =true then
           begin
           q2.Active :=false;
           q2.sql.clear;
           q2.sql.add('select gzcustom.handno,lssex.sexname,cusitem.cusname,gzcustom.cusprice,gzcustom.cusnum,gzcustom.money,gzcustom.isxj,gzcustom.ismd,gzcustom.regtime,gzcustom.djcode');
           q2.sql.add(' from gzcustom,cusitem,lssex where ((accno=:paccno) and (gzcustom.cuscode=cusitem.cuscode) and (gzcustom.sex=lssex.sex))');
           q2.ParamByName ('paccno').asstring:=acc;
           q2.Prepare;
           q2.Open;
           chinesegrid(dbgrid1);
           q2.active:=true;
           end;
{     if   (dhmx.Checked) and (trim(dhf.Text)<>'0') and (trim(dhf.Text)<>'') then
           begin
           q2.Active :=false;
           q2.sql.clear;
           q2.sql.add('select roomno,extension,begtime,phmoney,agnomen,fwf,hjmoney,dftle,address from phonedb where roomno in (select roomno from gznowin where accno=:paccno)');

⌨️ 快捷键说明

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