custrpt.pas

来自「Delphi利用MVC开发的典型例子」· PAS 代码 · 共 64 行

PAS
64
字号
unit CustRpt;

interface

uses SysUtils, Windows, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, Quickrpt, QRCtrls, patterns;

type
  TCustomerByInvoiceReport = class(TQuickRep)
    procedure QRDBText1Print(sender: TObject; var Value: string);
  private

  public

  end;

  TControllerInvoiceReport = class(TController)
  protected
    procedure DoCommand(Command: string; const args: string=''); override;
  public
  end;

var
  CustomerByInvoiceReport: TCustomerByInvoiceReport;

implementation

{$R *.DFM}

uses DataMod, commandlist;

procedure TCustomerByInvoiceReport.QRDBText1Print(sender: TObject;
  var Value: string);
begin
  with TMastData.getInstance do
    Value := DateToStr(CustByLastInvQueryLastInvoiceDate.Value);
end;

procedure TControllerInvoiceReport.DoCommand(Command: string; const args: string='');
begin
  if Command = CMD_RPT_CUSTOMER then
  begin
    with TMastData.GetInstance.CustByLastInvQuery do
    begin
      Open;
      if lowercase(args) = 'preview' then
        CustomerByInvoiceReport.Preview
      else
        CustomerByInvoiceReport.Print;
      Close;
    end;
  end;
end;

{//quick report is not available in D7

initialization
  ControlCenter.RegController(TControllerInvoiceReport.Create);
  CustomerByInvoiceReport := TCustomerByInvoiceReport.create(application);
}

end.

⌨️ 快捷键说明

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