VFP 8.0报表总页数可以通过数据分组重置吗?

发布于 2024-08-26 18:23:39 字数 115 浏览 10 评论 0原文

我有一份报告(使用 VFP 8.0),其中数据按发票编号分组,我需要通过更改发票编号来重置总页数。

我没有这样做,因为 _pagetotal 将始终返回所有选定发票的总页数。

请指教。

I have a report (using VFP 8.0) with a data grouping by Invoice Number, i need to reset the total of pages by changing of invoice number.

I failed to do so, as the _pagetotal will always return total pages of all selected invoice.

Please advice.

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

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

发布评论

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

评论(1

一百个冬季 2024-09-02 18:23:39

根据描述,您想要的似乎是我之前的评论...每张发票都有自己的第 X 页(共 Y 页)上下文,其中某些“组”比其他“组”拥有更多页面。要执行您想要的操作,通常需要生成两次报告。运行一次并捕获每组末尾有多少页。第二个实例是“最终”实例。以下是有关如何执行此操作的简单示例。

创建查询结果,但将附加列“OfPages”(或任何您想要表示每个“组”页面计数的列)添加到读写游标中。

SELECT YourIDGroup, OtherColumns, 000 as OfPages;
    FROM YourTable;
    ORDER BY 1;
    INTO CURSOR C_YourReportCursor readwrite


REPORT FORM TmpPages

REPORT FORM TmpPages preview  (or to printer)

接下来,在您的程序中,有一个函数可以“捕获”组页脚处的页码,无论您当前的 ID 是什么。

FUNCTION CatchOfPages
   LPARAMETERS CurrentID, LastPg

   UPDATE DBF( "C_YourReportCursor" );
      SET OfPages = LastPg;
      WHERE YourIDGroup = CurrentID

   */ Return empty space so nothing is actually printed in the report
   RETURN ""
ENDFUNC 

现在,诀窍。在您的报告中,包含基于发票 ID 的数据组。在组标题中,您将使用 _pageno 和光标的“ofPages”列,而不是使用 _pageno 和 _pagetotal 执行第 x 页,共 y 页...因为第一遍将通过上面的函数调用更新其正确的值,第一次生成报告时设置,但没有输出窗口或打印机,只是在后台运行。

现在,在 FOOTER 组的底部,添加一个文本框控件(就像任何其他数据字段输出一样),并设置其 Expression = 使用相应参数的函数调用...例如:

CatchOfPages( YourIDGroup, _PageNo )

它将更新临时游标(或您的结果表)及其最后一页的实际页码是什么,并更新关联发票 ID 组的所有记录,因此即使第 1 页也知道其 OfPages = 2、3、4 或其他内容。

要隐藏/屏蔽报表的第一个实例,使其不被看到,请将其隐藏在另一个窗口中,例如

DEFINE WINDOW WinTempReport FROM 0, 0 TO 1, 1
REPORT FORM YourReport IN WINDOW WinTempReport
RELEASE WINDOWS WinTempReport

然后将报表进行正常输出。

Based on the description, it appears what you want is per my earlier comment... Each invoice has its OWN Page X of Y context where some "groups" have more pages than others. To do what you want typically requires the report to be generated TWICE. Once to run and capture the how many pages at the end of each group. The second instance is the "FINAL". The following is a simple sample on how to do such.

Create your query results, but add an additional column "OfPages" (or whatever you want to represent the per "group" Of Pages count) into a readwrite cursor.

SELECT YourIDGroup, OtherColumns, 000 as OfPages;
    FROM YourTable;
    ORDER BY 1;
    INTO CURSOR C_YourReportCursor readwrite


REPORT FORM TmpPages

REPORT FORM TmpPages preview  (or to printer)

Next, in your program, have a function to "catch" the page number at the group footer for whatever your current ID is.

FUNCTION CatchOfPages
   LPARAMETERS CurrentID, LastPg

   UPDATE DBF( "C_YourReportCursor" );
      SET OfPages = LastPg;
      WHERE YourIDGroup = CurrentID

   */ Return empty space so nothing is actually printed in the report
   RETURN ""
ENDFUNC 

Now, the trick. In your report, have your data group based on the ID of the invoice. In the group header, instead of doing page x of y using _pageno and _pagetotal, you will be using _pageno and the column "ofPages" of the cursor... As the first pass will get its proper value updated via the function call above and is set the first time the report is generated but to no output window or printer, just run in the background.

Now, in the group FOOTER, at the bottom, add a textbox control (just as if any other data field output), and set its Expression = the function call with the respectible parameters... ex:

CatchOfPages( YourIDGroup, _PageNo )

It will do the update to the temp cursor (or your result table) with whatever its actual page number is for that final page to the group, and update all records for the associated invoice ID Group, so even page 1 knows its OfPages = 2, 3, 4, or whatever.

To hide / mask the first instance of the report from being seen, hide it in ANOTHER Window, such as

DEFINE WINDOW WinTempReport FROM 0, 0 TO 1, 1
REPORT FORM YourReport IN WINDOW WinTempReport
RELEASE WINDOWS WinTempReport

THEN do your report to normal output.

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