Custom dynamic data to generate a ticket's invoice

Invoices are a legal statement for tax deduction in our country.

We need these values to generate and print invoices:

  1. Next Invoice Number
  2. Authorization Number
  3. Expiration Date

These three values impose 3 different problems that we are not sure how to solve with SambaPOS yet:

  1. Next Invoice Number should increase every time we issue an invoice (once the invoice is printed)
  2. Authorization Number is fixed and should be displayed in the invoice
  3. Expiration Date should be checked daily. When the current date is close to the Expiration Date the manager should be warned about it to collect a new set of these three values from the Tax Office.

Not all tickets will have a corresponding invoice. It would be great if we can filter and search tickets where users did requested an invoice and query these values (at least the Authorization Number and Invoice Number). We already have a button to print an invoice for a ticket when desired.

We have tried to understand the concepts behind Entities, Ticket Tags, Ticket Logs, Actions and Rules to see how we can tackle this problem. We still don’t see how.

So far we believe that we should create an Entity Type Dosage with the three values so that the manager can add a new Dosage Entity every time the last one expires. We also believe that we could add these values to a ticket tag when required.

Can anyone please help us?

You can store Next Invoice Number and Expiration Date as Global Settings.

This tutorial may give an idea about how to maintain external counters.
https://forum2.sambapos.org/index.php?topic=97.msg671#msg671

This tutorial can also give an idea about how to create date constraints.

Authorization Number can also be a Global Setting but if it does not change you can hardcode it in printer template.

As you’ve stated you can query and store these values on tickets as ticket tags. Having a ticket state that updates on invoice print can also help not to increase invoice number on multiple prints.

1 Like