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

📄 ub_ctxs.pas

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

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ImgList, Menus, DBTables, Db, ComCtrls, StdCtrls, ExtCtrls, ToolWin,
  Grids, DBGrids;

type
  Tb_ctxs = class(TForm)
    DBGrid1: TDBGrid;
    CoolBar2: TCoolBar;
    Panel1: TPanel;
    Label1: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    px: TComboBox;
    tp1: TDateTimePicker;
    tp2: TDateTimePicker;
    CoolBar1: TCoolBar;
    ToolBar2: TToolBar;
    zx: TToolButton;
    yl: TToolButton;
    dy: TToolButton;
    bz: TToolButton;
    tc: TToolButton;
    sb: TStatusBar;
    ctxs: TQuery;
    d_cyxs: TDataSource;
    t: TTable;
    MainMenu1: TMainMenu;
    MenuItem11: TMenuItem;
    MenuItem18: TMenuItem;
    P1: TMenuItem;
    MenuItem19: TMenuItem;
    MenuItem20: TMenuItem;
    MenuItem73: TMenuItem;
    MenuItem74: TMenuItem;
    MenuItem75: TMenuItem;
    MenuItem76: TMenuItem;
    PrinterSetup: TPrinterSetupDialog;
    ImageList1: TImageList;
    ctxsth: TStringField;
    ctxszj: TFloatField;
    ctxsxj: TFloatField;
    ctxsfwf: TFloatField;
    ctxszkf: TFloatField;
    ctxszsje: TFloatField;
    ctxsxh: TIntegerField;
    tTH: TStringField;
    tFDBH: TStringField;
    tTM: TStringField;
    tSfbj: TStringField;
    ctxstm: TStringField;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    N1: TMenuItem;
    N2: TMenuItem;
    procedure ctxsCalcFields(DataSet: TDataSet);
    procedure FormShow(Sender: TObject);
    procedure pxChange(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure tcClick(Sender: TObject);
    procedure zxClick(Sender: TObject);
    procedure MenuItem18Click(Sender: TObject);
    procedure bzClick(Sender: TObject);
    procedure ylClick(Sender: TObject);
    procedure dyClick(Sender: TObject);
    procedure MenuItem76Click(Sender: TObject);
    procedure MenuItem74Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure sb_sz;
  end;

var
  b_ctxs: Tb_ctxs;

implementation

uses ug_wait, ubp_1, uabout;

{$R *.DFM}
procedure Tb_ctxs.sb_sz;
var
 c_zj,c_xj,c_fwf,c_zkf,c_zsje:currency;
begin
 c_zj:=0;c_xj:=0;c_fwf:=0;c_zkf:=0;c_zsje:=0;
 with ctxs do
  begin
   active:=false;
   ParamByName('p_rq1').asdate:=tp1.date;
   ParamByName('p_rq2').asdate:=tp2.date;
   active:=true;
   DisableControls;
   first;
   while not eof do
    begin
     c_zj:=c_zj+fieldbyname('zj').ascurrency;
     c_xj:=c_xj+fieldbyname('xj').ascurrency;
     c_fwf:=c_fwf+fieldbyname('fwf').ascurrency;
     c_zkf:=c_zkf+fieldbyname('zkf').ascurrency;
     c_zsje:=c_zsje+fieldbyname('zsje').ascurrency;
     next;
    end;
   EnableControls;
   sb.panels[2].text:=Format('%*.*f', [9, 2,c_zj]);
   sb.panels[4].text:=Format('%*.*f', [10, 4,c_xj]);
   sb.panels[6].text:=Format('%*.*f', [10, 4,c_fwf]);
   sb.panels[8].text:=Format('%*.*f', [10, 4,c_zkf]);
   sb.panels[10].text:=Format('%*.*f', [10, 4,c_zsje]);
  end;
end;

procedure Tb_ctxs.ctxsCalcFields(DataSet: TDataSet);
begin
 with ctxs do
  begin
   fieldbyname('xh').value:=RecNo;
  end;
end;

procedure Tb_ctxs.FormShow(Sender: TObject);
begin
 if not t.Active then t.Active:=true;
 if not ctxs.Active then ctxs.Active:=true;
 if bp_1=NIL then bp_1:=Tbp_1.Create(self);
 tp1.Date:=date();
 tp2.Date:=date();
 sb_sz;
 g_wait.close;
end;

procedure Tb_ctxs.pxChange(Sender: TObject);
begin
 with ctxs do
  begin
   DisableControls;
   active:=false;
   sql.Clear;
   case px.ItemIndex of
    0:sql.add('select th,sum(zj) as zj,sum(xj) as xj,sum(fwf) as fwf,sum(zkf) as zkf,sum(zsje) as zsje from cd1 where ycrq>=:p_rq1 and ycrq<=:p_rq2 group by th order by zj');
    1:sql.add('select th,sum(zj) as zj,sum(xj) as xj,sum(fwf) as fwf,sum(zkf) as zkf,sum(zsje) as zsje from cd1 where ycrq>=:p_rq1 and ycrq<=:p_rq2 group by th order by xj');
    2:sql.add('select th,sum(zj) as zj,sum(xj) as xj,sum(fwf) as fwf,sum(zkf) as zkf,sum(zsje) as zsje from cd1 where ycrq>=:p_rq1 and ycrq<=:p_rq2 group by th order by fwf');
    3:sql.add('select th,sum(zj) as zj,sum(xj) as xj,sum(fwf) as fwf,sum(zkf) as zkf,sum(zsje) as zsje from cd1 where ycrq>=:p_rq1 and ycrq<=:p_rq2 group by th order by zkf');
    4:sql.add('select th,sum(zj) as zj,sum(xj) as xj,sum(fwf) as fwf,sum(zkf) as zkf,sum(zsje) as zsje from cd1 where ycrq>=:p_rq1 and ycrq<=:p_rq2 group by th order by zsje');
   end;
   ParamByName('p_rq1').asdate:=tp1.date;
   ParamByName('p_rq2').asdate:=tp2.date;
   active:=true;
   EnableControls;
  end;
end;

procedure Tb_ctxs.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 Release;
 b_ctxs:=NIL;
 bp_1.Release;
 bp_1:=NIL;
end;

procedure Tb_ctxs.tcClick(Sender: TObject);
begin
 close;
end;

procedure Tb_ctxs.zxClick(Sender: TObject);
begin
 if tp1.date>tp2.date then
  begin
    messagebox(handle,'系统不能按所设的时间段设置进行查询!','系统提示信息',MB_OK+MB_ICONWARNING);
    exit;
  end;
 sb_sz;
 px.ItemIndex:=0;
end;

procedure Tb_ctxs.MenuItem18Click(Sender: TObject);
begin
  PrinterSetup.Execute;
end;

procedure Tb_ctxs.bzClick(Sender: TObject);
begin
  Application.HelpFile:='\hbjd\cyzy\help\hbcy.hlp';
  Application.HelpJump('ptctpm');
end;

procedure Tb_ctxs.ylClick(Sender: TObject);
begin
 bp_1.ct_rq1.caption:=datetostr(tp1.date);
 bp_1.ct_rq2.caption:=datetostr(tp2.date);
 bp_1.QuickRep1.preview;
end;

procedure Tb_ctxs.dyClick(Sender: TObject);
begin
 bp_1.ct_rq1.caption:=datetostr(tp1.date);
 bp_1.ct_rq2.caption:=datetostr(tp2.date);
 bp_1.QuickRep1.print;
end;

procedure Tb_ctxs.MenuItem76Click(Sender: TObject);
begin
 if about=NIL then about:=Tabout.Create(self);
 about.showmodal;
end;

procedure Tb_ctxs.MenuItem74Click(Sender: TObject);
begin
  Application.HelpFile:='\hbjd\cyzy\help\hbcy.hlp';
  Application.HelpCommand(Help_Finder,0);
end;

procedure Tb_ctxs.N2Click(Sender: TObject);
begin
  Application.HelpFile:='\hbjd\cyzy\help\hbcy.hlp';
  Application.HelpCommand(Help_PartialKey,0);
end;

end.

⌨️ 快捷键说明

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