One thing I noticed looking at the SQL results is that there are tickets that are closed with RemainingAmount == 0, but not locked. Closing the ticket should flag it as locked.
Also, ticket number isn’t assigned until after the Before Ticket Closing
event and before the Ticket Closing
event. I see the ticket number on the receipt. For that to show, the ticket closing flow must have been triggered, committing the data to the db.
To echo what @JTRTech said, look into ticket logs - you can add the action to any rule.
I would also recommend adding a “Save Ticket” action to whatever rule you use to print a bill - this will stop an employee printing a bill, accepting cash payment then cancelling all orders.
If missing tickets persist, perhaps setting up some database triggers to log deletion on certain tables that should never have anything deleted might help see what’s going on.