In this post I will explain how to use Acumatica’s Audit feature help to keep count of how many times a invoice report was printed and then with a little bit of Acumatica Report Designer knowledge, you can indicate on the report if it is a copy/duplicate. The objective in this example is to print a invoice with a header “Tax Invoice” and when it is printed a second time to show “Copy of Tax Invoice”.
First you have to setup an Audit of the [ARInvoice.Printed] field on the AR301000 screen:
On Invoice and Memos screen (AR301000), the checkbox field below is updated to a true value every time the report is executed and this will create the Audit log.
Report Schema and Joins
Now to explain how to configure your invoice report, you have to add the AuditHistory DAC/Table to your Scema Builder in Report Designer.
And now Joins for the table.
Note the Child Formula I am using to link the two tables. This is basically to get the invoice number from the CombinedKey field value. As the name of the field states, CombinedKey, it is the combination of the keys in the document. [ARInvoice.DocType] and [ARInvoice.RefNbr]. In this example the length of the invoice number is 8.
The other link condition is to filter “Printed” in the ModifiedFields.
Note the LessOrEqual link condition. This one allows you to see only the line that is printed for the second time.
Now you can use this formula in your report text box to build you logic.
=IIF(Count([PrintRecords.BatchID])>1, 'Copy of Tax Invoice', 'Tax Invoice')
Once the invoice is released the document can be printed once with a “Tax Invoice” header, and thereafter it will display “Copy of Tax Invoice”.
This sample were tested by printing from the Invoice and Memo’s screen only. But here you can see the results:
Keeping count of prints could be simplified even more by creating a custom DAC dependant on [AuditHistory] DAC. This will result in a much easier approach when designing any report that you want to keep print counts for.
You can take it even further by counting the number of prints per user if there will ever be such a request.
Another way you can solve this is by creating another Automation Step for the screen with the condition Printed = true and on this Actions you call a copy of the report with a different header name.
Have a lekker time report designing.