Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

NUMBERED PAGES FOR INVOICES?

Posted on by 60

Hello,

We print an individual SOP Blank Invoice  for each item, due to the nature of the item. All these item are put into a date batch to print out. We are manually having to compile these. Is there a setting to attach numbered pages that will reference the customer ID rather the whole batch? IE if John's tractor is has 5 invoices for that day, in a batch that has 500 other invoices, How can I get John's to say 1of 5, 2 of 5 etc. rather than 1 of 500. Thanks.

 

*This post is locked for comments

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,917 Most Valuable Professional on at
    RE: NUMBERED PAGES FOR INVOICES?

    Hi Laura

    The Dynamics Report writer is a single pass report writer, which basically means it would have already printed all the pages in a report before it can tell you how many pages it printed.

    Therefore it is not possible for it to print information like page X of Y or Invoice X of Y.

    However, I think you might be able to achieve what you want using a customised report with some Visual Basic for Applications (VBA) code.

    Assuming that the invoices for each customer in the batch are printing in customer number order.

    You can use a VBA variable to store the last Customer ID so that you know when the Customer ID changes.

    When the Customer ID changes you can reset a variable for the Invoice Number back to 0. It can be incremented each time a new invoice is started. Use the Report Header section.

    That takes care of the X number.

    To get the Y number you could use a SQL Select statement via ADO (ActiveX Data Objects). For example you can base the statement one of the following, depending on whether you are passing the customer and batch IDs or the Transaction Type and Number.

    select count(*) as [COUNT] from SOP10100

    group by BACHNUMB, CUSTNMBR

    having BACHNUMB = 'TEST' and CUSTNMBR = 'AARONFIT0001'

    select count(*) as [COUNT] from SOP10100

    group by BACHNUMB, CUSTNMBR

    having BACHNUMB = (select BACHNUMB from SOP10100 where SOPTYPE = 3 and SOPNUMBE = 'STDINV2262')

    and CUSTNMBR = (select CUSTNMBR from SOP10100 where SOPTYPE = 3 and SOPNUMBE = 'STDINV2262')

    Then you have the Y number and can pass the string back to the report writer into a blank calculated string field as "X of Y".

    The following blog article I wrote will help with techniques:

    blogs.msdn.com/.../using-ado-with-vba-with-report-writer.aspx

    Good luck

    David

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans