Delphi QuickReports:带顺序实现细节-子-子-子带?

发布于 2024-08-18 01:04:57 字数 7399 浏览 12 评论 0原文

我需要在 Delphi 5 中创建一个 QuickReport,其布局为:

+================
| Report Header
+================

+=========================================
| Detail Band (auto-stretching, repeats)
.
+=========================================
   |    Child band (fixed-size)
   +======================================
   |    Child band (Auto-stretching)
   .    
   +======================================
   |    Child band (fixed-size)
   +======================================

+=================================
| Report Footer (auto-stretching)
. 
+=================================

+==================================
| Report Footer (auto-stretching)
. 
+==================================

+=============================
| Report Footer (fixed size)
+=============================

任何人都可以想出标题、详细信息、子项、页脚、子详细信息、组页眉、组页脚带的组合 - 以及关联的父项、主项、报告,查询它们之间的链接,以便我可以制作一份像我需要的报告一样?

不要混淆我对术语“

  • 页眉带”、
  • “详细信息带”、
  • “子带”、
  • “页脚带”

的使用,以暗示任何带都必须是这些实际类型。我在概念意义上使用这些术语:

  • 整个报告开头的单个带(报告标题)
  • 由四个带组成的重复组
  • 在所有细节之后出现三个带,前两个带自动伸缩

相同的问题,只是更长

+===========================================
| Suspicious Transaction Report
|   STR No.: 12345
|      Date: 11/28/1973
|
|   Comments: as per NSL 1/13/2010
+===========================================

+===========================================
| Transaction 1 of 7
|      Buy                  Sell
|     $100.00            $16,000.00
|                        $27,000.00
|                        $12,000.00
.                            ...
+===========================================
|  Customer Information
|           Name: Shelby Lake
|        Address: 11111 S NC-HWY 111
|            DOB: 6/19/1981
|         ID No.: G123-456-789
|     Occupation: waitress
+===========================================
|  Original Transaction
|       Buy                 Sell
|      $100.00           $16,000.00
|    $3,000.00           $27,000.39
|   $64,132.69           $12,000.13
.       ...                  ...
+===========================================
|  Third Party Information
|           Name: Yugo Chavez
|        Address: 11111 S AB
|            DOB: 9/15/1934
|         ID No.: 995-1935
|     Occupation: dictator
+===========================================

...

+===========================================
| Transaction 7 of 7
.
.
+===========================================

+===========================================
| Description of Suspicious Activity
|   Customer had beedy eyes, that moved
|   rapidly from left to right. He...
.   ...
+===========================================

+===========================================
| Action Taken
|   We killed him, went through his
|   pickets, then started digging the...
. 
+===========================================





+===========================================
| 
|    Signature: _______________________
|                    Bruce Wayne
|        Title: The Batman
|  Employee ID: 1337-6669
+===========================================

我可以制作一些模仿我制作的示例的表格:

CREATE TABLE STRs (
   StrID int,
   Number text,
   Date datetime,
   Comments text,
   DescriptionOfSuspiciousActivity text,
   ActionTaken text,
   EmployeeName text,
   EmployeeTitle text,
   EmployeeNumber text )     

CREATE TABLE STRTransactions (
   STRTranasctionID int,
   STRID int,
   BuyAmount money)

CREATE TABLE STRTransactionSells (
   STRTransactionID int,
   SellAmount money)

CREATE TABLE STRTransactionPatronInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE STRTransactionThirdPartyInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE OriginalTransactions (
   STRTransactionID int,
   BuyAmount money,
   SellAmount money )

我失败的实验

我尝试创建具有以下带布局的 QuackReport:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

注意: 缩进用于帮助识别父子关系 带区实际上并未缩进 50 像素)

此设计的问题在于,至少在设计时,摘要带区出现在两个搁浅的子带区之前:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

关系(即 运行(在运行时),两个搁浅的子带甚至不打印:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

验证码:quackreports

i need to create a QuickReport in Delphi 5 that is laid out as:

+================
| Report Header
+================

+=========================================
| Detail Band (auto-stretching, repeats)
.
+=========================================
   |    Child band (fixed-size)
   +======================================
   |    Child band (Auto-stretching)
   .    
   +======================================
   |    Child band (fixed-size)
   +======================================

+=================================
| Report Footer (auto-stretching)
. 
+=================================

+==================================
| Report Footer (auto-stretching)
. 
+==================================

+=============================
| Report Footer (fixed size)
+=============================

Can anyone come up with with a combination of header, detail, child, footer, sub-detail, group header, group footer bands - and the associated Parent, Master, Report, Query links between them, so that i can make a report like i need it to look?

Don't confuse my use of the terms

  • header band
  • detail band
  • child band
  • footer band

to imply that any of the bands have to be of those actual types. i use those terms in the conceptual sense:

  • a single band at the start of the entire report (report header)
  • a repeating group of four bands
  • three bands that appear after all the detail, the first two being auto-stretchy

Same question, only longer

+===========================================
| Suspicious Transaction Report
|   STR No.: 12345
|      Date: 11/28/1973
|
|   Comments: as per NSL 1/13/2010
+===========================================

+===========================================
| Transaction 1 of 7
|      Buy                  Sell
|     $100.00            $16,000.00
|                        $27,000.00
|                        $12,000.00
.                            ...
+===========================================
|  Customer Information
|           Name: Shelby Lake
|        Address: 11111 S NC-HWY 111
|            DOB: 6/19/1981
|         ID No.: G123-456-789
|     Occupation: waitress
+===========================================
|  Original Transaction
|       Buy                 Sell
|      $100.00           $16,000.00
|    $3,000.00           $27,000.39
|   $64,132.69           $12,000.13
.       ...                  ...
+===========================================
|  Third Party Information
|           Name: Yugo Chavez
|        Address: 11111 S AB
|            DOB: 9/15/1934
|         ID No.: 995-1935
|     Occupation: dictator
+===========================================

...

+===========================================
| Transaction 7 of 7
.
.
+===========================================

+===========================================
| Description of Suspicious Activity
|   Customer had beedy eyes, that moved
|   rapidly from left to right. He...
.   ...
+===========================================

+===========================================
| Action Taken
|   We killed him, went through his
|   pickets, then started digging the...
. 
+===========================================





+===========================================
| 
|    Signature: _______________________
|                    Bruce Wayne
|        Title: The Batman
|  Employee ID: 1337-6669
+===========================================

i can make up some tables that mimic the example i made up:

CREATE TABLE STRs (
   StrID int,
   Number text,
   Date datetime,
   Comments text,
   DescriptionOfSuspiciousActivity text,
   ActionTaken text,
   EmployeeName text,
   EmployeeTitle text,
   EmployeeNumber text )     

CREATE TABLE STRTransactions (
   STRTranasctionID int,
   STRID int,
   BuyAmount money)

CREATE TABLE STRTransactionSells (
   STRTransactionID int,
   SellAmount money)

CREATE TABLE STRTransactionPatronInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE STRTransactionThirdPartyInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE OriginalTransactions (
   STRTransactionID int,
   BuyAmount money,
   SellAmount money )

My failed experiment

i've tried to create a QuackReport with the following band layout:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

Note: The indenting is used to help identify parent-child relationships (i.e. the band isn't actually indended 50 pixels)

The problem with this design is that, at design time at leat, the Summary band appear before the two stranded child bands:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

And when the report is run (at runtime), the two stranded child bands don't even print:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

Captcha: quackreports

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋意浓 2024-08-25 01:04:57

(请记住,我不再可以使用 QuickReports,所以这全都是凭记忆)

好的...我以前遇到过这个问题...
为您提供完整的编码示例将需要很长时间(我根本没有时间),但我将尝试描述我的解决方案,以便您可以理解它。

不要使用 TQRChildBand,而是使用所有 DetailBand。然后,您可以挂钩每个乐队的 BeforePrint 事件。

您可以在 BeforePrint 事件中使用类似的内容:

printband := FPrintSubBandA;

使用一组通用变量(或报表表单上的私有成员)来定义报表上显示的给定记录应显示哪些区域以及不应显示哪些区域... . 所有布尔类型(注意:您可以使用一组枚举,但布尔值更容易/更快地实现恕我直言

在您的 NeedData 事件中,您将推断出哪些范围给定记录需要这些变量,并相应地设置这些变量(当然是布尔值)。

整个解决方案是很多肮脏的黑客,但很重要,因为 QuickReports 对选择性记录上的嵌套子带的支持基本上不存在。

如果这还不够,请告诉我,我将仔细浏览我的代码档案,看看是否能找到执行此操作的一个示例。
本质上,这个问题就是我改用 RaveReports 的原因。

编辑:
我想您很可能已经尝试在运行时设置每个子带的 ParentBand 值...如果您还没有,请不要浪费时间!这样做会导致更多异常结果(我什至遇到过尝试这样做的访问冲突

(please keep in mind I no longer have QuickReports available to me, so this is all from memory)

Okay... I've run into this problem before...
To give you a full coded example would take a very long time (time I simply don't have) but I'll try to describe my solution so you can relate to it.

Instead of using TQRChildBand, use all DetailBand instead. You then hook each of those bands' BeforePrint event.

You would use something like this in the BeforePrint event:

printband := FPrintSubBandA;

Use a set of universally available variables (or private members on your report's form) to define what bands should be displayed and shouldn't be for a given record showing on your report.... all of type Boolean (NOTE: You could use a SET of enums, but Booleans are easier/quicker to implement imho)

In your NeedData event, you will extrapolate which bands are required for a given record, and set those variables (Boolean values, of course) accordingly.

The entire solution is a lot of a dirty hack, but essential since QuickReports' support for nested sub-bands on selective records is essentially non-existent.

If this isn't enough information, let me know and I'll trawl through my code archives to see if I can find the one example I have of doing this.
Essentially, this exact problem is the reason I switched to RaveReports instead.

EDIT:
I presume you've most likely already tried setting each child band's ParentBand value at runtime... if you haven't, don't waste your time! Doing this causes even more anomalous results (I've even had Access Violations attempting this)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文