[Resolved] Urgent Help! Problem with live setup

Hi! Please. see the attached two screenshots. I can’t close the work period because one of the tickets is apparently still open - whereas i’ve already paid for it and closed it. Is there any way to rectify this?

When i open the particular ticket in question, i get the following error - is there any way to hard delete this order from the database?

Did you change your state flow? It shows that the orders were never submitted and it has not been paid.

Full error report in Detail panel would help.

I agree with @Jesse, something got messed up with the States on this Ticket, not submitted, not paid.

You could delete it using SQL, but there might be other ways around it, like add an item to the Ticket, then remove it, then Settle it again… worth a shot.

Otherwise, this is not a simple task, since an Order is linked to a Ticket, which is linked to an Account Transaction Document, which is linked to Account Transactions, which is linked to Account Transaction Values. Proper deletion is not simply deleting a record from the Ticket Table, but in addition, all records from every linked DB Table.

This query returns all the associated record IDs that will need deleting…

:warning: I do NOT recommend this approach, since it is too easy to mess up your Database.

use [SambaPOS4]
 o.[Id] as [OrderId]
,t.[TransactionDocument_Id] as [docId]
,d.[Name] as [docName]
,tx.[Id] as [txId]
,v.[Id] as [vId]
FROM [Orders] o
left join [Tickets] t on t.[Id]=o.[TicketId]
left join [AccountTransactionDocuments] d on d.[Id]=t.[TransactionDocument_Id]
left join [AccountTransactions] tx on tx.[AccountTransactionDocumentId]=d.[Id]
left join [AccountTransactionValues] v on v.[AccountTransactionId]=tx.[Id]
WHERE t.[TicketNumber]=4225

--DELETE FROM [AccountTransactionValues] WHERE [Id] in (25341,25342,25343,25344,25345,25346,25379,25380,25381,25382)
--DELETE FROM [AccountTransactions] WHERE [Id] in (12671,12672,12673,12690,12691)
--DELETE FROM [AccountTransactionDocuments] WHERE [Id]=4454
--DELETE FROM [Orders] where [Id] in (8596,8597,8598)
--DELETE FROM [Tickets] where [Id]=3993

The query returns 30 records in this case, containing all the IDs which would require deletion. The IDs will be different in your Database, so you would need to run the SELECT statement first to pick out the proper IDs, then alter the DELETE statements accordingly.

:warning: I do NOT recommend this approach, since it is too easy to mess up your Database.

The DELETE statements remove records from the following tables:


… and I may have missed some linked tables …

1 Like

Thank you so much! I backed up to a previous database, that did not include that particular order - so things have been running smoothly. I’ll make sure, that in the future, i’ll the technique that you’ve described :smile: