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

📄 checkprinter.pas

📁 1、系统环境要求:WindowsXP/2000 2、DELPHI7.0企业版 3、如果数据库为SQL Server数据库
💻 PAS
字号:
unit checkprinter;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, baseform, StdCtrls, ExtCtrls, DB, Grids, DBGrids, RpCon,
  RpConDS, RpDefine, RpRave;

type
  Tf_checkprinter = class(Tf_baseform)
    Label1: TLabel;
    Grid1: TDBGrid;
    Source1: TDataSource;
    Panel1: TPanel;
    Counter: TComboBox;
    Radio1: TRadioButton;
    Radio2: TRadioButton;
    Depot: TComboBox;
    Query: TButton;
    Print: TButton;
    Quit: TButton;
    Project1: TRvProject;
    CheckConnection: TRvDataSetConnection;
    procedure QuitClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure QueryClick(Sender: TObject);
    procedure PrintClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_checkprinter: Tf_checkprinter;
  Isdepot: Boolean = True;
implementation
  uses data;
{$R *.dfm}

procedure Tf_checkprinter.QuitClick(Sender: TObject);
begin
  inherited;
  Close;
end;

procedure Tf_checkprinter.FormShow(Sender: TObject);
begin
  inherited;
  With t_data.Query1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select depotname from tb_depotinfo');
    Open;
  end;
  while not t_data.Query1.Eof do
  begin
    Depot.Items.Add(Trim(t_data.Query1.Fields[0].Value));
    t_data.Query1.Next;
  end;
  With t_data.Query1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select counter from tb_counter');
    Open;
  end;
  while not t_data.Query1.Eof do
  begin
    Counter.Items.Add(Trim(t_data.Query1.Fields[0].Value));
    t_data.Query1.Next;
  end;
end;

procedure Tf_checkprinter.QueryClick(Sender: TObject);
begin
  inherited;
  if Radio1.Checked then
  begin
    if Trim(Depot.Text)<>'' then
    begin
      With t_data.Check do
      begin
        Close;
        SQL.Clear;
        SQL.Add('select * from v_bookdepotinfo where depot = :depot');
        Parameters.ParamByName('depot').Value := Trim(Depot.Text);
        Open;
      end;
      if t_data.Check.RecordCount>0 then
      begin
        Source1.DataSet :=t_data.Check;
        Isdepot := True;
      end
      else
      begin
        t_data.Check.Close;
        Source1.DataSet := Nil;
        Application.MessageBox('没有找到符合条件的记录.','提示',64);
      end;
    end;
  end
  else
  begin
    if Trim(Counter.Text)<>'' then
    begin
      With t_data.Check do
      begin
        Close;
        SQL.Clear;
        SQL.Add('select * from v_bookcounterinfo where counter = :counter');
        Parameters.ParamByName('counter').Value := Trim(Counter.Text);
        Open;
      end;
      if t_data.Check.RecordCount>0 then
      begin
        Source1.DataSet :=t_data.Check;
        Isdepot := False;
      end
      else
      begin
        t_data.Check.Close;
        Source1.DataSet := Nil;
        Application.MessageBox('没有找到符合条件的记录.','提示',64);
      end;
    end;
  end;
end;

procedure Tf_checkprinter.PrintClick(Sender: TObject);
begin
  inherited;
  if t_data.Check.Active then
  begin
    if Isdepot = True then
    begin
      if FileExists(ExtractFilePath(Application.ExeName)+'project2.rav') then
      begin
        Project1.ProjectFile := 'project2.rav';
        Project1.Execute;
        Project1.Close;
      end
      else
        Application.MessageBox('报表文件不存在.','提示',64);
    end
    else
    begin
      if FileExists(ExtractFilePath(Application.ExeName)+'project1.rav') then
      begin
        Project1.ProjectFile := 'project1.rav';
        Project1.Execute;
        Project1.Close;
      end
      else
        Application.MessageBox('报表文件不存在.','提示',64);
    end;
  end
  else
    Application.MessageBox('当前没有可打印的信息.','提示',64);
end;

end.

⌨️ 快捷键说明

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