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

📄 xiaoanlyes.pas

📁 小管理程序主要管理的小咖啡厅我是从网上下的经测试可用
💻 PAS
字号:
unit xiaoanlyes;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FR_Class, ComCtrls, Buttons, StdCtrls, ExtCtrls, TeeProcs,
  TeEngine, Chart, DbChart, Series, DB, ADODB, FR_DSet, FR_DBSet;

type
  TFrmxiaoanlyes = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    SpeedButton1: TSpeedButton;
    startdate: TDateTimePicker;
    enddate: TDateTimePicker;
    DBChart1: TDBChart;
    SpeedButton2: TSpeedButton;
    ADOQuery1: TADOQuery;
    Series1: TBarSeries;
    frReport1: TfrReport;
    frDBDataSet1: TfrDBDataSet;
    procedure SpeedButton1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure SpeedButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frmxiaoanlyes: TFrmxiaoanlyes;

implementation
    uses dbmodule;
{$R *.dfm}

procedure TFrmxiaoanlyes.SpeedButton1Click(Sender: TObject);
begin
  if adoquery1.Active then
    adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('select currdate,sum(yingshou) as totalsale,sum(guestcount) as totalcount,sum(yingshou)/sum(guestcount) as pingjun');
  adoquery1.SQL.Add(' from q_custpay');
  adoquery1.SQL.Add(' where currdate between #'+datetostr(startdate.Date)+'# and #'+datetostr(enddate.Date)+'#');
  adoquery1.SQL.Add(' and guestcount>0');
  adoquery1.SQL.Add(' group by currdate');
  adoquery1.Open;
end;

procedure TFrmxiaoanlyes.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if adoquery1.Active then
    adoquery1.Close;
end;

procedure TFrmxiaoanlyes.SpeedButton2Click(Sender: TObject);
var
 reportpath:string;
begin
  if adoquery1.Active then
    adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('select currdate,sum(yingshou) as totalsale,sum(guestcount) as totalcount,sum(yingshou)/sum(guestcount) as pingjun');
  adoquery1.SQL.Add(' from q_custpay');
  adoquery1.SQL.Add(' where currdate between #'+datetostr(startdate.Date)+'# and #'+datetostr(enddate.Date)+'#');
  adoquery1.SQL.Add(' and guestcount>0');
  adoquery1.SQL.Add(' group by currdate');
  adoquery1.Open;
  frVariables['startdate'] :=datetostr(startdate.Date);
  frVariables['enddate'] := datetostr(enddate.Date);
  reportpath:=ExtractFilePath(application.ExeName);
  reportpath:=reportpath+'report\xiaoanlyes.frf';
  if FileExists(reportpath) then
    begin
      frreport1.Clear;
      frreport1.LoadFromFile(reportpath);
      frreport1.PrepareReport;
      frreport1.ShowReport;
    end
  else
    begin
      application.MessageBox('报表文件丢失!','提示',mb_ok);
    end ; 

end;

end.

⌨️ 快捷键说明

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