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

📄 ub_sdbb.pas

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

interface

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

type
  Tb_sdbb = class(TForm)
    Image1: TImage;
    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;
    cyje: TLabel;
    cylc: TLabel;
    cyrc: TLabel;
    cymd: TLabel;
    cyjs: TLabel;
    cyqt: TLabel;
    fwf: TLabel;
    zkf: TLabel;
    tcje: TLabel;
    zcje: TLabel;
    jcje: TLabel;
    krzs: TLabel;
    srze: TLabel;
    Label4: TLabel;
    sdrq1: TLabel;
    sj: TLabel;
    Shape2: TShape;
    Label20: TLabel;
    Label21: TLabel;
    fdmc: TLabel;
    Label26: TLabel;
    hzrq: TLabel;
    Bevel2: TBevel;
    Bevel4: TBevel;
    Label29: TLabel;
    jzds: TLabel;
    BitBtn3: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn4: TBitBtn;
    Panel3: TPanel;
    SpeedButton1: TSpeedButton;
    Label16: TLabel;
    SpeedButton2: TSpeedButton;
    dtp1: TDateTimePicker;
    sdrq2: TLabel;
    Label27: TLabel;
    Bevel5: TBevel;
    Label1: TLabel;
    qdjz: TLabel;
    Label30: TLabel;
    Label31: TLabel;
    Label32: TLabel;
    Label33: TLabel;
    qdqt: TLabel;
    qdxyk: TLabel;
    qdzp: TLabel;
    qdxj: TLabel;
    Label38: TLabel;
    qdwj: TLabel;
    dtp2: TDateTimePicker;
    Label28: TLabel;
    Label34: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure FormClick(Sender: TObject);
    procedure Panel1Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormShow(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;
    procedure zx;
  end;

var
  b_sdbb: Tb_sdbb;
  d_rq1,d_rq2:Tdate;
implementation

uses uxtxx, ubp;

{$R *.DFM}
function Tb_sdbb.r_sum(s_sql:string):currency;
begin
 with main.query1 do
  begin
   active:=false;
   sql.Clear;
   sql.add(s_sql);
   ParamByName('rq1').asdate:=d_rq1;
   ParamByName('rq2').asdate:=d_rq2;
   active:=true;
   r_sum:=fieldbyname('hj').ascurrency;
  end;
end;
function Tb_sdbb.r_count(s_sql:string):integer;
begin
 with main.query1 do
  begin
   active:=false;
   sql.Clear;
   sql.add(s_sql);
   ParamByName('rq1').asdate:=d_rq1;
   ParamByName('rq2').asdate:=d_rq2;
   active:=true;
   r_count:=fieldbyname('hj').asinteger;
  end;
end;
procedure Tb_sdbb.zx;
var
  s_mess1,s_mess2:string;
begin
  if dtp1.date>dtp2.date then
   begin
    messagebox(handle,'请重新设置时间段','系统提示信息',MB_OK+MB_ICONWARNING);
    exit;
   end;
  g_xtxx.show;
  g_xtxx.Update;
  sdrq1.caption:=formatdatetime('yyyy.mm.dd',dtp1.date);
  sdrq2.caption:=formatdatetime('yyyy.mm.dd',dtp2.date);
  d_rq1:=dtp1.date;
  d_rq2:=dtp2.date;
  hzrq.caption:=formatdatetime('yyyy.mm.dd',date());
  sj.caption:=formatdatetime('hh:mm',time());
  fdmc.caption:=s_fdmc;
  try
  g_xtxx.ProgressBar1.StepBy(3);
  s_mess1:='系统正在计算汇总 "';
  s_mess2:='结帐单数';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select count(cdbh) as hj  FROM cd1 where ycrq>=:rq1 and ycrq<=:rq2';
  jzds.caption:=inttostr(r_count(s_sql));

  g_xtxx.ProgressBar1.StepBy(3);
  s_mess1:='系统正在计算汇总 "';
  s_mess2:='客人总数';
  g_xtxx.m1.caption:=s_mess1+s_mess2+'", 请稍侯...';
  g_xtxx.Update;
  s_sql:='select sum(krs) as hj  FROM cd1 where ycrq>=:rq1 and ycrq<=:rq2';
  krzs.caption:=floattostr(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>=:rq1 and ycrq<=:rq2';
  srze.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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2';
  cyje.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>=:rq1 and ycrq<=:rq2 and lbh="1"';
  cylc.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>=:rq1 and ycrq<=:rq2 and lbh="2"';
  cyrc.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>=:rq1 and ycrq<=:rq2 and lbh="3"';
  cymd.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>=:rq1 and ycrq<=:rq2 and lbh="4"';
  cyjs.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>=:rq1 and ycrq<=:rq2 and lbh="5"';
  cyqt.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>=:rq1 and ycrq<=:rq2';
  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>=:rq1 and ycrq<=:rq2';
  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>=:rq1 and ycrq<=:rq2';
  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>=:rq1 and ycrq<=:rq2';
  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>=:rq1 and ycrq<=:rq2';
  jcje.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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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>=:rq1 and ycrq<=:rq2 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_sdbb.FormCreate(Sender: TObject);
begin
 dtp1.date:=date()-1;
 dtp2.date:=date();
end;

procedure Tb_sdbb.SpeedButton1Click(Sender: TObject);
begin
 zx; 
 Panel3.Visible:=false;
end;

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

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

procedure Tb_sdbb.BitBtn3Click(Sender: TObject);
begin
 if bp=NIL then bp:=Tbp.Create(self);
 Panel3.Visible:=false;
 bp.fdmc1.caption:=fdmc.Caption;
 bp.rq1.caption:=sdrq1.Caption;
 bp.rq2.caption:=sdrq2.Caption;

 bp.jzds.caption:=jzds.Caption;
 bp.krzs.caption:=krzs.Caption;

 bp.ze1.caption:=srze.Caption;
 bp.xj1.caption:=xj.Caption;
 bp.qd1.caption:=qd.Caption;
 bp.zp1.caption:=zp.Caption;
 bp.md1.caption:=md.Caption;
 bp.xyk1.caption:=xyk.Caption;
 bp.qt1.caption:=qt.Caption;

 bp.cyzj1.caption:=cyje.Caption;
 bp.clc1.caption:=cylc.Caption;
 bp.crc1.caption:=cyrc.Caption;
 bp.cmd1.caption:=cymd.Caption;
 bp.cjs1.caption:=cyjs.Caption;
 bp.cqt1.caption:=cyqt.Caption;

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

 bp.zcje1.caption:=zcje.Caption;
 bp.tcje1.caption:=tcje.Caption;
 bp.jcje1.caption:=jcje.Caption;

 bp.qdjz1.caption:=qdjz.Caption;
 bp.qxj1.caption:=qdxj.Caption;
 bp.qzp1.caption:=qdzp.Caption;
 bp.qxyk1.caption:=qdxyk.Caption;
 bp.qqt1.caption:=qdqt.Caption;
 bp.qdwj1.caption:=qdwj.Caption;

 bp.hzrq1.caption:=hzrq.Caption;
 bp.hzsj1.caption:=sj.Caption;
 bp.yybb.Print;
 bp.Release;
 bp:=NIL;
end;

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

procedure Tb_sdbb.BitBtn4Click(Sender: TObject);
begin
  Panel3.Visible:=true;
end;

procedure Tb_sdbb.BitBtn2Click(Sender: TObject);
begin
 close;
end;

procedure Tb_sdbb.FormShow(Sender: TObject);
begin
 dtp1.Date:=date();
 dtp2.Date:=date();
 zx;
end;

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

end.

⌨️ 快捷键说明

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