reportctrl.pas

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

PAS
48
字号
unit ReportCtrl;

interface
uses
  SysUtils, forms, buttons, classes, controls, patterns;

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

implementation
uses commandlist, Pickrep;

procedure TControllerReport.DoCommand(Command: string; const args: string='');
var
  param: string;
begin
  if command = CMD_BTN_REPORT then
  begin
    with TPickRpt.Create(nil) do
    begin
      if ShowModal = mrOK then
      begin
        if preview then
          param := 'preview'
        else
          param := 'print';
        case ReportType.ItemIndex of
          0: self.SendCommand(CMD_RPT_CUSTOMER, param); //PrintCustomerReport(Preview);
          1: self.SendCommand(CMD_RPT_ORDER, param); //PrintOrderReport(Preview);
          2: self.SendCommand(CMD_RPT_INVOICE, param); //PrintInvoiceReport(Preview);
        end;
        free;
      end;
    end;
  end;
end;

initialization
  ControlCenter.RegController(TControllerReport.Create);

end.

⌨️ 快捷键说明

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