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

📄 ub_yyrb.pas

📁 恒邦餐饮管理源码。将源码放到C:hbjdcyzy 登陆:1001/1001
💻 PAS
字号:
unit ub_yyrb;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin, Db, DBTables;

type
  Tb_yyrb = class(TForm)
    Panel2: TPanel;
    Panel1: TPanel;
    Label3: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label17: TLabel;
    Bevel3: TBevel;
    Label18: TLabel;
    Label19: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Bevel1: TBevel;
    xj: TLabel;
    zp: TLabel;
    xyk: TLabel;
    qd: TLabel;
    md: TLabel;
    qt: TLabel;
    xssr: TLabel;
    lc: TLabel;
    rc: TLabel;
    mdd: TLabel;
    js: TLabel;
    qtt: TLabel;
    fwf: TLabel;
    zkf: TLabel;
    tcje: TLabel;
    zcje: TLabel;
    jcje: TLabel;
    krs: TLabel;
    ze: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    rq: TLabel;
    sj: TLabel;
    Shape2: TShape;
    Label20: TLabel;
    Label21: TLabel;
    fdmc: TLabel;
    BitBtn3: TBitBtn;
    szl: TLabel;
    Label1: TLabel;
    BitBtn2: TBitBtn;
    BitBtn4: TBitBtn;
    Label26: TLabel;
    hzrq: TLabel;
    Panel3: TPanel;
    SpeedButton1: TSpeedButton;
    Label16: TLabel;
    SpeedButton2: TSpeedButton;
    Image1: TImage;
    Bevel2: TBevel;
    Bevel4: TBevel;
    Label29: TLabel;
    ds: TLabel;
    dtp: TDateTimePicker;
    Bevel5: TBevel;
    Bevel6: TBevel;
    Label27: TLabel;
    qdjz: TLabel;
    Label30: TLabel;
    qdxj: TLabel;
    Label31: TLabel;
    qdzp: TLabel;
    qdqt: TLabel;
    Label33: TLabel;
    qdxyk: TLabel;
    Label32: TLabel;
    Label38: TLabel;
    qdwj: TLabel;
    d_tai: TDataSource;
    tai: TTable;
    taiTH: TStringField;
    taiTHT: TStringField;
    taiFDBH: TStringField;
    taiZWS: TIntegerField;
    taiFWFL: TFloatField;
    taiDZL: TFloatField;
    taiSfbz: TFloatField;
    taiZdxf: TFloatField;
    taiFWYH: TStringField;
    taiFwym: TStringField;
    taiSfbj: TStringField;
    taiZT: TStringField;
    procedure FormShow(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure FormClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Panel1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
    function r_sum(s_sql:string):currency;
    function r_count(s_sql:string):integer;
  end;

var
  b_yyrb: Tb_yyrb;
  d_rq:Tdate;

implementation

uses u_main, uxtxx, ubp;

{$R *.DFM}

function Tb_yyrb.r_sum(s_sql:string):currency;
begin
 with main.query1 do
  begin
   active:=false;
   sql.Clear;
   sql.add(s_sql);
   ParamByName('rq').asdate:=d_rq;
   active:=true;
   r_sum:=fieldbyname('hj').ascurrency;
  end;
end;
function Tb_yyrb.r_count(s_sql:string):integer;
begin
 with main.query1 do
  begin
   active:=false;
   sql.Clear;
   sql.add(s_sql);
   ParamByName('rq').asdate:=d_rq;
   active:=true;
   r_count:=fieldbyname('hj').asinteger;
  end;
end;

procedure Tb_yyrb.FormShow(Sender: TObject);
var
  f_szl:currency;
  s_mess1,s_mess2:string;
begin
  g_xtxx.show;
  g_xtxx.Update;
  rq.caption:=formatdatetime('yyyy.mm.dd',dtp.date);
  d_rq:=dtp.date;
  hzrq.caption:=formatdatetime('yyyy.mm.dd',date());
  sj.caption:=formatdatetime('hh:mm',time());
  fdmc.caption:=s_fdmc;
  try
  g_xtxx.ProgressBar1.StepBy(2);
  s_mess1:='系统正在计算汇总 "';
  s_mess2:='总收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj  FROM cd1 where ycrq=:rq';
  ze.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(3);
  s_mess2:='单数';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select count(cdbh) as hj  FROM cd1 where ycrq=:rq';
  ds.caption:=floattostr(r_count(s_sql));

  g_xtxx.ProgressBar1.StepBy(2);
  s_mess2:='现金结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="1"';
  xj.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(2);
  s_mess2:='支票结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="2"';
  zp.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='信用卡结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="3"';
  xyk.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='签单结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="4"';
  qd.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='免单结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="5"';
  md.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='其它结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj  FROM cd1 where ycrq=:rq and jzfs="6"';
  qt.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='菜肴销售总额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj FROM cd1,cdmx1 where cd1.cdbh=cdmx1.cdbh and ycrq=:rq';
  xssr.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='凉菜销售总额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj  FROM cd1,cdmx1 where cd1.cdbh=cdmx1.cdbh and ycrq=:rq and lbh="1"';
  lc.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(2);
  s_mess2:='热菜销售总额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj  FROM cd1,cdmx1 where cd1.cdbh=cdmx1.cdbh and ycrq=:rq and lbh="2"';
  rc.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(3);
  s_mess2:='面点销售总额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj  FROM cd1,cdmx1 where cd1.cdbh=cdmx1.cdbh and ycrq=:rq and lbh="3"';
  mdd.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(2);
  s_mess2:='酒水销售总额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj  FROM cd1,cdmx1 where cd1.cdbh=cdmx1.cdbh and ycrq=:rq and lbh="4"';
  js.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(2);
  s_mess2:='其它销售总额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj  FROM cd1,cdmx1 where cd1.cdbh=cdmx1.cdbh and ycrq=:rq and lbh="5"';
  qtt.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(3);
  s_mess2:='服务费';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(fwf) as hj  FROM cd1 where ycrq=:rq';
  fwf.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(3);
  s_mess2:='折扣费';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zkf) as hj  FROM cd1 where ycrq=:rq';
  zkf.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='退菜金额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj FROM cd1,cdmx1 where cdmx1.cz="1" and cd1.cdbh=cdmx1.cdbh and ycrq=:rq';
  tcje.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(3);
  s_mess2:='增菜金额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj FROM cd1,cdmx1 where cdmx1.cz="2" and cd1.cdbh=cdmx1.cdbh and ycrq=:rq';
  zcje.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(2);
  s_mess2:='加菜金额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(hj) as hj FROM cd1,cdmx1 where cdmx1.cz="3" and cd1.cdbh=cdmx1.cdbh and ycrq=:rq';
  jcje.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(3);
  s_mess2:='客人总数';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'",请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(krs) as hj FROM cd1 where ycrq=:rq';
  krs.caption:=floattostr(r_sum(s_sql));

  g_xtxx.ProgressBar1.StepBy(2);
  s_mess2:='客人上座率';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'",请稍侯...';
  g_xtxx.Update;
  f_szl:=strtoint(krs.caption)/tai.recordcount;
  szl.caption:=Format('%*.*f', [5, 2,f_szl*100])+'%';

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='签单结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="4" and qdjz is not NULL';
  qdjz.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='签单现金结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="4" and qdjz="1"';
  qdxj.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='签单支票结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="4" and qdjz="2"';
  qdzp.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='签单信用卡结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="4" and qdjz="3"';
  qdxyk.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='签单其它结帐收入';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="4" and qdjz="6"';
  qdqt.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);

  g_xtxx.ProgressBar1.StepBy(5);
  s_mess2:='签单未结帐金额';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(zj) as hj FROM cd1 where ycrq=:rq and jzfs="4" and qdjz is NULL';
  qdwj.caption:=Format('%*.*f', [8, 2,r_sum(s_sql)]);
//  qdwj.caption:=Format('%*.*f', [8, 2,strtocurr(qd.caption)-strtocurr(qdjz.caption)]);
  except
   g_xtxx.close;
   s_mess:='"'+s_mess2+'"计算汇总失败!';
   messagebox(handle,pchar(s_mess),'系统提示信息',MB_OK+MB_ICONWARNING);
   exit;
 end;
 g_xtxx.hide;
 g_xtxx.close;
 Panel3.Visible:=false;
end;
procedure Tb_yyrb.BitBtn2Click(Sender: TObject);
begin
 close;
end;
procedure Tb_yyrb.BitBtn4Click(Sender: TObject);
begin
 Panel3.Visible:=true;
end;

procedure Tb_yyrb.SpeedButton1Click(Sender: TObject);
begin
 b_yyrb.FormShow(Sender); 
 Panel3.Visible:=false;
end;

procedure Tb_yyrb.BitBtn3Click(Sender: TObject);
begin
 if bp=NIL then bp:=Tbp.Create(self);
 Panel3.Visible:=false;
 bp.fdmc.caption:=fdmc.Caption;
 bp.rq.caption:=rq.Caption;
 bp.ds.caption:=ds.Caption;

 bp.ze.caption:=ze.Caption;
 bp.xj.caption:=xj.Caption;
 bp.qd.caption:=qd.Caption;
 bp.zp.caption:=zp.Caption;
 bp.md.caption:=md.Caption;
 bp.xyk.caption:=xyk.Caption;
 bp.qt.caption:=qt.Caption;

 bp.cyzj.caption:=xssr.Caption;
 bp.clc.caption:=lc.Caption;
 bp.crc.caption:=rc.Caption;
 bp.cmd.caption:=mdd.Caption;
 bp.cjs.caption:=js.Caption;
 bp.cqt.caption:=qtt.Caption;

 bp.fwf.caption:=fwf.Caption;
 bp.zkf.caption:=zkf.Caption;

 bp.zcje.caption:=zcje.Caption;
 bp.tcje.caption:=tcje.Caption;
 bp.jcje.caption:=jcje.Caption;

 bp.qdjz.caption:=qdjz.Caption;
 bp.qxj.caption:=qdxj.Caption;
 bp.qzp.caption:=qdzp.Caption;
 bp.qxyk.caption:=qdxyk.Caption;
 bp.qqt.caption:=qdqt.Caption;
 bp.qdwj.caption:=qdwj.Caption;

 bp.krs.caption:=krs.Caption;
 bp.szl.caption:=szl.Caption;

 bp.hzrq.caption:=hzrq.Caption;
 bp.hzsj.caption:=sj.Caption;
 bp.yyrb.Print;
 bp.Release;
 bp:=NIL;

end;

procedure Tb_yyrb.SpeedButton2Click(Sender: TObject);
begin
  Panel3.Visible:=false;
end;

procedure Tb_yyrb.FormClick(Sender: TObject);
begin
  Panel3.Visible:=false;
end;

procedure Tb_yyrb.FormCreate(Sender: TObject);
begin
 dtp.date:=date()-1;
end;

procedure Tb_yyrb.Panel1Click(Sender: TObject);
begin
  Panel3.Visible:=false;
end;

procedure Tb_yyrb.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 Release;
 b_yyrb:=NIL;
end;

end.

⌨️ 快捷键说明

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