4 Replies Latest reply on May 12, 2015 2:05 AM by RickRobbins

    Printing sub-totals on each page

    RickRobbins

      Title

      Printing sub-totals on each page

      Post

      I am creating an invoice solution for a German company and have run into an issue that I cannot solve.  Does anyone know how to create a sub-total that prints the sum of amounts of each line item that is printed on each page?  On the last page I would then print the grand total of the invoice.

        • 1. Re: Printing sub-totals on each page
          philmodjunk

          This sounds like the typical "list view from portal table context" method for printing an invoice. Are the number of lines per page consistent and predictable?

          If there are no sliding fields to vary the number of line items per page, you can use the record's record number to to determine it's page number. With a field to show that page number, you can sort records by this field and use a sub summary layout part to show the page total.

          • 2. Re: Printing sub-totals on each page
            RickRobbins

            The number of lines per page are are consistent and predictable to a certain extent.  The first page would have up to X lines, the following pages up to Y lines and the final page the rest.  I guess there is no "simple" solution.  I can determine the number of line items for the first page and the following pages and then try to determine how many are then on the final page.  Complicated but doable.  I was hoping there might be a simpler solution.

            • 3. Re: Printing sub-totals on each page
              philmodjunk

              There is a (fairly) simple calculation:

              Ceiling ( ( Get ( RecordNumber ) + (Y - X ) ) / Y )

              So if x = 30 and Y = 25

              records 1 - 25 will be page 1. 26 - 55 will be page 2 and so forth....

              You can find and sort the records to be used in printing the invoice, then use Replace Field Contents with the above calculation used to assign a page number to each record, then sort your records again in the same order as before but with page number added as the last field in the sort order.

              A sub summary layout part can then show the page based subtotals. (Make sure to include the size of your sub summary layout part when you figure out how many records will fit on each page.

              • 4. Re: Printing sub-totals on each page
                RickRobbins

                Thanks !!!!!!!!