Transfer values from footer band to header band
Hi i am trying to create a report for my application, the report include:
- A title (header band)
- The values of a database (master band)
- Subtotal of page (footer band)
But when the report is more than one page, I need the subtotal of the footer band, transferring to the header band or otherwise to appear at the top of the report
Example
Sorry for the bad english and i hope you can help me
- A title (header band)
- The values of a database (master band)
- Subtotal of page (footer band)
But when the report is more than one page, I need the subtotal of the footer band, transferring to the header band or otherwise to appear at the top of the report
Example
[P??gina 1------------------------------------------------]
  ID        FECHA      PROVEEDOR      NUMERO      TOTAL
?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·
  1      16/06/2009    Proveedor1          1    $ 100.50
  2      25/06/2009    Proveedor1          15    $  50.00
  3      26/06/2009    Proveedor1          20    $  40.25
?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·
                                      Total  $      190.75
[P??gina 2------------------------------------------------]
  ID        FECHA      PROVEEDOR      NUMERO      TOTAL
?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·
                                Transporte  $      190.75          <---------
----------------------------------------------------------
  4      28/06/2009    Proveedor1          30    $  60.00
  5      29/06/2009    Proveedor1          35    $  35.00
  6      29/06/2009    Proveedor1          36    $  15.25
?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·?·
                                      Total  $      301.00
Sorry for the bad english and i hope you can help me
Comments
At the OnBeforePrint of the memo where you currently print the total in the masterdata you must acumulate the value, like this:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->var
lCurrentTotal: integer;
procedure Memo1OnBeforePrint(sender...);
begin
lCurrentTotal:= currentTotal + Memo1.Value;
end;
<!--fontc--></span><!--/fontc-->
Then in the header beforeprint you have the 2 memoviews, one for 'Transporte $' and another one that will print the subtotal, let's say it's name is Memo2.
What you need is to make the header visible only if the subtotal is >0, and the value/text of Memo2 to call a function to return the subtotal accumulated:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->procedure Header1OnBeforePrint(sender...);
begin
Header1.visible := lCurrentTotal>0;
end;<!--fontc--></span><!--/fontc-->
Create your custom function, anywhere in the script:
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
function MySubTotal: string;
begin
result := inttostr(lCurrentTotal);
end;<!--fontc--></span><!--/fontc-->
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
begin // main code
lCurrentTotal := 0;
end. <!--fontc--></span><!--/fontc-->
And make Memo2.text property in the object designer like this: [MySubTotal]
Facil.