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

📄 uprint.pas

📁 这是一个门禁系统的应用程序,用 delphi编写,希望与大家交流.
💻 PAS
字号:
unit uprint;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, FR_Class, FR_Desgn, DB, ADODB, FR_DSet,
  FR_DBSet;

type
  TfrmPrint = class(TForm)
    cbInfo: TCheckBox;
    cbEx: TCheckBox;
    cbFami: TCheckBox;
    cbAP: TCheckBox;
    cbTrain: TCheckBox;
    Label1: TLabel;
    btnPrint: TButton;
    btnClose: TBitBtn;
    cbTrs: TCheckBox;
    fdsFami: TfrDBDataSet;
    fdsSinfo: TfrDBDataSet;
    fdsAP: TfrDBDataSet;
    fdsExper: TfrDBDataSet;
    fdsTrain: TfrDBDataSet;
    btnPre: TButton;
    btnNext: TButton;
    frPer: TfrReport;
    procedure cbTrsClick(Sender: TObject);
    procedure btnPrintClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure frPerBeforePrint(Memo: TStringList; View: TfrView);
    procedure btnNextClick(Sender: TObject);
    procedure btnPreClick(Sender: TObject);
  private
    { Private declarations }
    procedure DataInit;
  public
    { Public declarations }
  end;

var
  frmPrint: TfrmPrint;

implementation

uses udata, ustainfo, uglobal;

{$R *.dfm}

procedure TfrmPrint.DataInit;
begin
  dmPer.OpenStaf(IntToStr(Psid(frmStainfo.tvPer.Selected.Data)^.ID));
  dmPer.OpenExperf(IntToStr(frmStainfo.ID));
  dmPer.OpenFamif(IntToStr(frmStainfo.ID));
  dmPer.OpenAPf(IntToStr(frmStainfo.ID));
  dmPer.OpenTrainf(IntToStr(frmStainfo.ID));
  fdsSinfo.DataSet := dmPer.aqStaf;
  fdsExper.DataSet := dmPer.aqExperf;
  fdsFami.DataSet := dmPer.aqFamif;
  fdsAP.DataSet := dmPer.aqAPf;
  fdsTrain.DataSet := dmPer.aqTrainf;
end;

procedure TfrmPrint.cbTrsClick(Sender: TObject);
begin
  if cbTrs.Checked = true then
  begin
    self.AlphaBlend := true;
    self.AlphaBlendValue := 125;
  end
  else
    self.AlphaBlend := false;
end;

procedure TfrmPrint.FormShow(Sender: TObject);
begin
  DataInit;
end;

procedure TfrmPrint.btnPrintClick(Sender: TObject);
begin
  if (cbInfo.Checked = false) and (cbEx.Checked = false) and (cbFami.Checked = false)
     and (cbAP.Checked = false) and (cbTrain.Checked = false) then
  begin
    MessageBox(self.Handle, '请选择要打印的内容!', '提示', mb_IconInformation + mb_Ok);
    cbInfo.Checked := true;
  end
  else
  begin
    DataInit;
    frPer.LoadFromFile(sPath + 'frPer.frf');
    TFrBandView(frPer.FindObject('mhInfo')).Visible := true;
    TFrBandView(frPer.FindObject('mdInfo')).Visible := true;
    TFrBandView(frPer.FindObject('mhEx')).Visible := true;
    TFrBandView(frPer.FindObject('mdEx')).Visible := true;
    TFrBandView(frPer.FindObject('mhFami')).Visible := true;
    TFrBandView(frPer.FindObject('mdFami')).Visible := true;
    TFrBandView(frPer.FindObject('mhAP')).Visible := true;
    TFrBandView(frPer.FindObject('mdAP')).Visible := true;
    TFrBandView(frPer.FindObject('mhTrain')).Visible := true;
    TFrBandView(frPer.FindObject('mdTrain')).Visible := true;

    if cbInfo.Checked = false then
    begin
      TFrBandView(frPer.FindObject('mhInfo')).Visible := false;
      TFrBandView(frPer.FindObject('mdInfo')).Visible := false;
    end;
    if cbEx.Checked = false then
    begin
      TFrBandView(frPer.FindObject('mhEx')).Visible := false;
      TFrBandView(frPer.FindObject('mdEx')).Visible := false;
    end;
    if cbFami.Checked = false then
    begin
      TFrBandView(frPer.FindObject('mhFami')).Visible := false;
      TFrBandView(frPer.FindObject('mdFami')).Visible := false;
    end;
    if cbAP.Checked = false then
    begin
      TFrBandView(frPer.FindObject('mhAP')).Visible := false;
      TFrBandView(frPer.FindObject('mdAP')).Visible := false;
    end;
    if cbTrain.Checked = false then
    begin
      TFrBandView(frPer.FindObject('mhTrain')).Visible := false;
      TFrBandView(frPer.FindObject('mdTrain')).Visible := false;
    end;

    frPer.ShowReport;
  end;
end;

procedure TfrmPrint.frPerBeforePrint(Memo: TStringList; View: TfrView);
var
  path: string;
begin
  path := sPath + 'images\';
  if FileExists(path + dmPer.aqStaf.FieldByName('image').AsString) then
    TFrPictureView(frPer.FindObject('imgPer')).Picture.LoadFromFile(path + dmPer.aqStaf.FieldByName('image').AsString);
end;

procedure TfrmPrint.btnPreClick(Sender: TObject);
begin
  frmStainfo.btnPriorClick(nil);
end;

procedure TfrmPrint.btnNextClick(Sender: TObject);
begin
  frmStainfo.btnNextClick(nil);
end;         

end.

⌨️ 快捷键说明

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