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
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156