web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :

How to anchor subtotals at the bottom of the last page of an invoice with Microsoft Dynamics GP 2010 SP3.

Dave Dusek Profile Picture Dave Dusek
Note: Support has found an issue with this Customization.  When printing the document as a PDF or Word document your Page Numbering can get thrown off.  Since this is a Customization and not designed for the Word Template functionality troubleshooting Page Numbering would not be Supported.
How to anchor subtotals at the bottom of the last page of an invoice.  The following steps will only work on Microsoft Dynamics GP 2010 SP3. 
1.  Start with an original unmodified SOP Blank Invoice word template and open in word.  1016.pic2.png
2.  Go down to the footer section.  Click in the top line of the footer.
3.  Click Alt-F9.
4.  Go to Insert>Quick Parts>Field. 
5.  In the Fields window, select If in the Fields list.  Click ok.  The footer section should look like the following:

7288.pic3.png

6.  Look at the top right of the template where the page number is.  You should see a formula there.  Highlight the whole formula and click CTRL-C to copy it. 

1854.pic4.png

7.  Go down to the footer section.  In the top line of the footer in the If formula that you have, highlight the /* MERGEFORMAT.  Make sure you don’t highlight the open brace, the If and the close brace. 
8.  Paste in the copied text. 
9.  Now the formula should show in the footer too. 
2642.pic5.png

10.  In the formula change the / to =.

11.  Right in front of the last closing brace, add "subtotal". 

 4338.pic6.png

12.  Click Alt-F9. 
13.  If you have the formula right, you should see the word subtotal in the bottom and that's it, nothing else.  If you see more than that, then there is a syntax problem and you will have to redo the steps from the beginning. 

4760.pic7.png

14.  In the template, highlight the subtotal section table.  Make sure you get the whole table. 

6710.pic8.png

15.  Ctrl-C (Do not cut because the end document bookmark is in this table, we can't delete the table from this section.)

16.  Alt-F9
17.  Find the word “subtotal” in the footer and highlight it. 
0820.pic9.png

 18.  Ctrl-V – You are pasting in the subtotal table instead of the word “subtotal”.

19.  Now, you have to go back to the subtotal table in the body of the invoice - the one you copied.  We can't delete the table because the bookmark is there.  Highlight each field, right click remove content control.  Then highlight the field and delete. 

20.  Do this for every field in the old table. 
21.  Now save the template and import it.  Print the new template with an invoice.  The subtotal should be on the bottom of the last page of the invoice.  This will work with multiple page invoices and multiple invoices in a batch. 
22.  If you want to add something like ****Continued on the next page**** to print when it is not the last page of the invoice, you can add an else clause to do that.  Click Alt-F9 to make sure you are seeing the formula.  Click in the field in the subtotal and click behind the last double quote.  Add a double quote, followed by the text you want to print, lastly, another double quote. 

Dave Dusek

Senior Escalation Engineer

Comments

*This post is locked for comments

  • Amanda Oertel Profile Picture Amanda Oertel
    Posted at

    I've put this into place in GP2016 and it works for the most part. It seems that the footers do not print for some invoices. I'm not sure if the report just needs more time to load or what the issue is. But for example, I have a batch of 20 invoices. The footer prints perfect on the first 11 invoices but starting with invoice 12 through 20, the footer is blank. Any thoughts or ideas?

  • Andy Sather Profile Picture Andy Sather
    Posted at

    Hello Bob - I have seen that exact issue with this customization.  I have entered a Product Suggestion to have the functionality changed.

    connect.microsoft.com/.../2904161

  • Bob Callanan Profile Picture Bob Callanan 789
    Posted at

    I know this post is old but I was successful following this on a GP 2016 installation and it works great except when the user prints a range of invoices. Here's an example. We print a range of 4 invoices. The first 2 are one page invoices, followed by 2 invoices that 2 pages. The 2 one page invoices print fine as does the first 2 page invoice. However the forth invoice does not print any footer at all. Is that the page number issue mentioned at the top of this post?  

  • Deb Landon Profile Picture Deb Landon 45
    Posted at

    Oh, BTW, I am working on GP2013

  • Deb Landon Profile Picture Deb Landon 45
    Posted at

    Hi Dave, this is excellent, thank you.  I have been able to get the footer printing at the bottom  of the page but as Neil has stated below the Subtotal values are printing as XXXXX.  I have tried to re-add the content control fields but I am unable to do this in the footer.  Am I correct in copying the table between the " mark's?  If I don't do this then the footer is blank?  Thanks  Deb

  • Nys Profile Picture Nys 15
    Posted at

    Hi Everyone,

    I got this if/then thing to work in the header of the document, but not the footer (i.e. no good). Any idea why it would work in the header but not the footer?

  • Nys Profile Picture Nys 15
    Posted at

    Hi Andy,

    Thank you so much for your reply. Yes, I do have all the bookmarks as you stipulate above. I have used GoTo to check the location of the bookmarks as well ( ][ ), and everything seems in order. I have also started from scratch a number of times just to make sure I'm seeing things correctly and have not accidentally deleted anything.

    When I look at the bookmarks at template mode (i.e. when I go to Report Maintenance, and then modify the template, toggle ALT+F9 the fields, and look at the PAGE REF bookmark text, or simply go to Links>Bookmarks) I see that the text of the bookmark name is generic - i.e. StartTemplateDocumentBookmark, for example. The bookmark is definitely there. When I look at a generated template (i.e. print an actual order to template, and when open in Word I toggle the fields ALT+F9 or refer to Links > Bookmark), I see that the text of the bookmarks that appear in PAGEREF in the Page Header PAGEREF has changed to document specific (PAGEREF ORD00455213_8_1StartDocument). But the PAGEREF in the footer, when toggled, is still generic. When un-toggled, it displays "Bookmark not Defined". But - the bookmark is still there. It still exists.

    I think.... it's probably because I'm on GP2010 SP2. I don't really have enough background knowledge to understand why a bookmark reference would behave differently in the header than it would in the footer... I always assumed headers and footers are essentially the same...just one at the top of the page, and the other at the bottom ;p Obviously there is something else at play?

  • Andy Sather Profile Picture Andy Sather
    Posted at

    Is that the actual print out of the Template?  You would need to open the Template through Report Template Maintenance and take a look at the calculation to make sure it looks like the blog for Page Number.  Next you will need to verify that you have all the bookmarks on the Template (Insert | Bookmarks).  Here are the bookmarks I have

    StartTemplateDocumentHeaderBookmark

    StartTemplateDocumentBookmark

    StartTemplateSectionRepeating

    EndTemplateDocumentBookmark

    EndTemplateDocumentFooterBookmark.

    If you haven't already done some enable bookmarks, so you can see them by going to File | Options | Advanced (check the box for Show Bookmarks under Show document Content) in Microsoft Word.  I am thinking you are getting Bookmark not defined because you are missing it on the Template.

  • Nys Profile Picture Nys 15
    Posted at

    Hi Dave,

    This is wonderful, but I'm having trouble with PAGE REF on bookmarks when I place the PAGEREF in the FOOTER, I always get "Bookmark not defined".

    When I toggle (ALT+F9) a generated template (say, an Order), I can see that the header's {PAGEREF StartTemplateDocumentBookmark}  is actually replaced by the text  {PAGEREF ORD00455213_8_1StartDocument}, as if there is some code that is running that is replacing the name of the  the beginning and end bookmarks to include the document number in question. When I toggle  {PAGEREF StartTemplateDocumentBookmark} in the footer, the text still appears as  {PAGEREF StartTemplateDocumentBookmark} - when I untoggle, I get Bookmark Not Defined.

    As a result, the solution you recommend above is not working (subtotal shows up on every page, rather than just on last page). I'm assuming this is because the basic PAGEREF bookmarks are not working in the first place.

    I'm confused - since it seems to be working perfectly for others that have responded to this post. Anyone have any ideas?

    Thx so much

  • Community Member Profile Picture Community Member
    Posted at

    Pingback from  Dynamics GP:  Avoiding the Pitfalls of Word Templates  –  TheFutureofWork