Arbitrary Counter

I dont know if anyone has ever implemented this, but here is the concept/situation:

  • Every ticket has an associated bill.
  • Some customers request a tax invoice as well, so we print that for them on request.
  • Every TAX invoice needs to have a serial number.
  • Since not every bill is associated with a TAX invoice, the number of bills will be different from the number of tax invoices.
  • So is there a way to run a counter on the TAX Invoices printed so that they have a valid count?

I was thinking of defining an Entity for this, and insert a new row everytime a new tax invoice is printed.
But to do that, how do i define an auto-increment custom field? And, how do i get the new entity created and add that to my ticket ?

You could use the Action of Update Program Setting with Is Local set to false. Then the value is stored in the Database.

When you print a Tax Invoice, you increment the Program Setting.

Then if you want to create an Entity use:

Create Entity Action

Then if you want to add the Entity to the Ticket, use:

Change Ticket Entity Action. You can add an Entity with that instead of changing an Entity.

So in the end, you might have an Automation Command to print the Tax Invoice. When that is clicked:

Increment the Program Setting.
Create Entity
Add Entity to Ticket
Print the Invoice

1 Like

Kool! that makes sense!
How do i retrieve the value of this program setting to actually print this number on my Invoice?

Like this, using this tag:


So if you have a Program Setting that you called Tax Invoice Number, you would use this in your Template:

{SETTING:Tax Invoice Number}

In the case assigning an Entity, of for example an Entity Type called Tax Invoice Numbers, this would work better, since the Entity will have been attached to the Ticket:

{ENTITY NAME:Tax Invoice Numbers}

That assumes the Name of the Entity is the Invoice Number.

1 Like

This was perfect!
dont even need to declare an entity or anything… i just needed a running number on my tax invoices. and the {SETTING; TAX INV NUMBER} did the whole trick.