Log Ticket Type Id in Payment Transation

Is it possible to log the Ticket Type Id with payments.

I have an issue with reports relying on the TicketTypeId to separate payments.

If I go back to an old workperiod report, and the ticket type has changed since then,the payment lists under the new ticket type and not under the ticket type at the time of the payment.

I have it automatically saving to file at end of every workperiod (reports are fine), but my accountant want’s to check back through the system itself and the reports for closed workperiods can be wrong.

Is it possible to add ticket type Id to the Description Field in the database or can we access this from within samba?

I found the Pay Ticket action has the Description Filed Enabled

I have tried to replicate the default payment types.

The payment screen does not refresh ( I could fix this with a navigate to payment screen when remaining total > 0 or close when remaining total =0) and I cannot seem to map AC buttons to where the default payment types are displayed.

Is there a reason why a description cannot be added on the payment type or would it even be able to read template tags like {TICKET TYPE}?

That tutorial demonstrates how to update payment descriptions.

Is there a variable to pull in ticket type or ticket type id?

I tried

function UpdateDescription() {
  var tickettype = Data.Get("ticketTypeName");
  Data.Set("description", tickettype);
  dlg.ShowMessage("Payment Processed\r"+tickettype);
  return 0;

Or do I need to save a setting and call that data?

Hmm there is no access to ticket type in that scope. I can give access to ticket on next update so you can read ticket type id but maybe instead of storing it in payment description storing original ticket type name as a ticket tag might be a better alternative.

I need to read the payment info via sql so i thought the payments table made more sense, seeing as payment description is already there.
I tried ticket tags but I can’t figure out how to extract the tag from the JSON format. Plus there can be multiple payments on a tickect so matching it to payment transaction could be tricky.