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

📄 ugraderep.pas

📁 可实现学生成绩管理系统的各种功能,无需登陆,直接查询学生的各种信息
💻 PAS
字号:
{ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :: QuickReport 3.0 for Delphi 3.0/4.0/5.0                  ::
  ::                                                         ::
  :: Master/Detail report with some extra code               ::
  ::                                                         ::
  :: Copyright (c) 1995-1999 QuSoft AS                       ::
  :: All Rights Reserved                                     ::
  ::                                                         ::
  :: web: http://www.qusoft.com  fax: +47 22 41 74 91        ::
  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
unit uGradeRep;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  QuickRpt, Qrctrls, Db, DBTables, ExtCtrls, ADODB;

type
  TfrmGradeRep = class(TForm)
    QuickRep1: TQuickRep;
    DetailBand1: TQRBand;
    DsStuGr: TDataSource;
    PageHeaderBand1: TQRBand;
    QRDBText2: TQRDBText;
    QRDBText1: TQRDBText;
    DSDirNo: TDataSource;
    QRTitle1: TQRLabel;
    ADOQryStuGr: TADOQuery;
    ADOQryDirNo: TADOQuery;
    QRBand1: TQRBand;
    QRLabel4: TQRLabel;
    QRBand2: TQRBand;
    QRExpr1: TQRExpr;
    QRExpr2: TQRExpr;
    QRShape1: TQRShape;
    QRLabel5: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRShapeGray: TQRShape;
    QRDBText5: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText7: TQRDBText;
    QRDBText8: TQRDBText;
    QRDBText9: TQRDBText;
    ADOTable1: TADOTable;
    QRLabel7: TQRLabel;

    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);

//    procedure QRSNOBeforePrint(Sender: TQRCustomBand;
//      var PrintBand: Boolean);
//    procedure QRGRADEBeforePrint(Sender: TQRCustomBand;
//      var PrintBand: Boolean);
    procedure QRGroupSdeptBeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
//    procedure QRGRADEAfterPrint(Sender: TQRCustomBand;
//      BandPrinted: Boolean);
    procedure PageHeaderBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmGradeRep: TfrmGradeRep;

implementation

  uses uDm ;

{$R *.DFM}

procedure TfrmGradeRep.FormCreate(Sender: TObject);
begin
  if not ADOQryStuGr.Active then
    ADOQryStuGr.Active := True ;
//  if not ADOQryDirNo.Active then
//    ADOQryDirNo.Active := True  ;
//  if not ADOQryDirItem.Active then
//    ADOQryDirItem.Active := True  ;
end;

procedure TfrmGradeRep.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if ADOQryStuGr.Active then
    ADOQryStuGr.Close ;
//  if ADOQryDirNo.Active then
//    ADOQryDirNo.Close ;
//  if ADOQryDirItem.Active then
//    ADOQryDirItem.Close ;
end;

procedure TfrmGradeRep.PageHeaderBand1BeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  // Re-enable the order fields on the item subdetail so that the order
  // information will be repeated after a page break
  ADOQryStuGr.Enabled := true;
  ADOQryStuGr.Enabled := ADOQryStuGr.Enabled;
end;

procedure TfrmGradeRep.DetailBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  // If there are no subdetails, then we print this band.  Otherwise we
  // let the group header print the controls from this band.  Group bands
  // can be reprinted on page breaks, which detail and subdetails can't do.
  ADOQryStuGr.First;
  PrintBand := ADOQryStuGr.EOF;

  // If it's our turn to print and the group band has our controls, then
  // we take them back.
  if PrintBand and (Sender.ControlCount = 0) then
    with DetailBand1 do
      while ControlCount > 0 do
        Controls[0].Parent := Sender;
end;

procedure TfrmGradeRep.QRGroupSdeptBeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  // We grab the detail band fields right from under it.
  if Sender.ControlCount = 0 then
    with DetailBand1 do
      While ControlCount > 0 do
        Controls[0].Parent := Sender;
end;

{procedure TfrmGradeRep.QRSNOBeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  // We are print the order information on the first item subdetail
  // record.  If there are no item records, then we print the subdetail

  // Enable the order fields on the item subdetail band.  After they are
  // printed once, they will be disabled until the next order/item set
  QRDBText8.Enabled := true;
  QRDBText9.Enabled := QRDBText8.Enabled;

  // Only allow this band to print if there are no subdetails
  ADOQryStuGr.First;
  PrintBand := ADOQryStuGr.EOF;
end;

procedure TfrmGradeRep.QRGRADEBeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  // toggle the item background so that we can have alternating colors
  // like the greenbar paper we all know and love.
  with QRShapeGray.Brush do
    if Color = $00F0F0F0 then
      Color := $00E0E0E0
    else
      Color := $00F0F0F0;
end;

procedure TfrmGradeRep.QRGRADEAfterPrint(
  Sender: TQRCustomBand; BandPrinted: Boolean);
begin
  // After we print it once, we disable the controls
//  ADOQryStuGr.Enabled := false;
//  ADOQryStuGr.Enabled := ADOQryStuGr.Enabled;
end;

 }

end.

⌨️ 快捷键说明

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