How To: Count number of prints in Acumatica

Hi All

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”.

Audit Feature

First you have to setup an Audit of the [ARInvoice.Printed] field on the AR301000 screen:

Acumatica Audit

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.

Acumatica Printed Settings

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.

Acumatica Report Designer Tables

And now Joins for the table.

Join 1:

Acumatica Report Designer Join Conditions

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.

Join 2:

Acumatica Report Designer Join Conditions 2

Note the LessOrEqual link condition. This one allows you to see only the line that is printed for the second time.

Report Fields

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”.

Usage

This sample were tested by printing from the Invoice and Memo’s screen only. But here you can see the results:

First Print:

Acumatica First Print

Second Print:

Acumatica Second Print

Future Steps

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.

4 Replies to “How To: Count number of prints in Acumatica”

  1. Hi Ben

    The “RecordsWhenPrinted” and “PrintRecords” Child Alias will always create one record after 1 print. More than one print will create more records in the “PrintRecords”, but the “RecordsWhenPrinted” will always give you one record. Your count should be based on the [PrintRecords.BaseID]. Above method was based on Invoice & Memo screen and AR Invoice print, but I am sure it should work in your case. If you don’t succeed, send me a link to download the report, and I will be happy to assist you.

    1. Thanks, Johan. I got this to work, with a few modifications.

      1) A new row is added to `AuditHistory` for each subsequent printing, but only the first row has the value “PrintListPrinted” in the `ModifiedFields` column. Subsequent rows have an empty value for `ModifiedFields`. (If you audit other columns on the same screen and need an accurate print count, you may need a different strategy. If you simply want to know if the form has been printed at least once, it should work fine as is.)

      2) Due to the nature of the self-referential join of `AuditHistory` (“RecordsWhenPrinted” and “PrintRecords”), I ended up with a grouping/duplicate row issue for the SOShipLine detail records. You can set up a new group using `RecordsWhenPrinted.BatchID`, or create a sub-report (where AuditHistory records are joined) for the “COPY OF/REPRINT” slug. Creating a new sub-report was easier for my use case.

  2. Hello, I’m trying to use this same technique for printing Pick Lists from Shipments. I want to output “Duplicate” on the printed version of the Pick List if/when it has been printed more than once.

    I have created the Audit successfully using the steps described above. However, when I look at the raw data in the DB, only the very first printing is logged is the `AuditHistory` table. With the first printing, `PickListPrinted` is recorded as a value in the `ModifiedFields` column.

    Subsequent rows are logged, but there is no value being saved in the `ModifiedFields` column. Likely because the `PickListPrinted` value is already true, so there is no change occurring.

    When joining the tables as described above, this results in Count([PrintRecords.BatchID]) always being equal to ‘1’, so “Copy of” is never printed.

    Any ideas how I could get this to work for printed Pick Lists from Shipments?

Leave a Reply

Your email address will not be published. Required fields are marked *