I have been configuring my SambaPOS and testing it. To do a final test, I would like to be able to clear out all the transaction I created so I can start fresh.
Can someone help me on how to do this?
Thanks,
Dan
I have been configuring my SambaPOS and testing it. To do a final test, I would like to be able to clear out all the transaction I created so I can start fresh.
Can someone help me on how to do this?
Thanks,
Dan
Go to settings database tools then use the clear database transactions
I was going to respond with the same but mine no longer shows âClear Transactionsâ?
If done correctly it should take you back to login screen. Once logged in you shouldnt see any previous work periods and no tickets. Then to ensure its working, once you open new work period,
Check your reports and date back to other days to ensure thereâs no values. Accounts should also have no values there.
Hey Mate - thanks for that I forgot about creating the tasks, must of removed mine at some stageâŠ
You can add your own tasks as well. Iâll show you how. Those tasks are SQL script files. You can write your own SQL script files and name them with appropriate name and they will show up there.
I was going to ask @Jesse and can make it another topic, but is this how you handle âEnd of Financial Yearâ for a Location?
Most Companies I have dealt with have a EOFY reporting season, so they would want to see Sales reset to '$0.00". Customer Balances obviously carried forward, but the interesting Accounts would be âDiscountsâ alike as these I think would need to go to â$0.00â as well?
I would really like to know how to include my own SQL scripts, so if you can point me in the right direction, that would be create.
In your Documents folder on C drive go to SambaPOS5/Database Tasks folder. Insert your SQL Scripts there.
Name them [CBL]scriptname.sql
you can create them in Notepad then just save them as format i just showed.
Here in this example I dropped a new script called Test SQL Script
We even have an action to execute these tasks and you can use rule events to automate it to whatever you want.
Not so sure how useful it is considering we can execute SQL with jscript support now.
There are a couple lines in the SQL script that should execute before another - the order is a bit incorrect. It should be like this:
DELETE FROM [TicketEntities]
GO
DELETE FROM [Tickets]
GO
DELETE FROM [CostItems]
GO
DELETE FROM [InventoryTransactionDocuments]
GO
DELETE FROM [InventoryTransactions]
GO
DELETE FROM [AccountTransactionDocuments]
GO
DELETE FROM [AccountTransactions]
GO
DELETE FROM [AccountTransactionValues]
GO
DELETE FROM [Calculations]
GO
DELETE FROM [Orders]
GO
DELETE FROM [PaidItems]
GO
DELETE FROM [PeriodicConsumptionItems]
GO
DELETE FROM [PeriodicConsumptions]
GO
DELETE FROM [ProductTimerValues]
GO
DELETE FROM [Payments]
GO
DELETE FROM [WarehouseConsumptions]
GO
DELETE FROM [WorkPeriods]
GO
UPDATE [Numerators] SET Number = 0
GO
UPDATE [EntityStateValues] SET EntityStates = '[{"S":"Available","SN":"Status"}]' Where EntityStates like '%Status%'
GO
i copy and past it and works very well. thank you
Thanks @QMcKay⊠This really helped in 2019
i used this query and it completes with errors.
In the end I deleted all the transactions but in the Settings> account> transactions panel I still see them all as a list.
I need to clear the database of all transactions because I have changed companies and cannot keep old receipts in the database.
thanks for help and sorry my english
What error did you get? If it was a timeout run again as if clearing allot of data it can timeout. I once cleared 2 years worth and had to run a few times before it cleared everything out.
Failing that run the script directly in sql manager.
(12168 righe interessate)
Messaggio 547, livello 16, stato 0, riga 3
The DELETE statement conflicted with the REFERENCE constraint âFK_dbo.Orders_dbo.Tickets_TicketIdâ. The conflict occurred in database âSambaPOS5â, table âdbo.Ordersâ, column âTicketIdâ.
The statement has been terminated.
(1 riga interessata)
(0 righe interessate)
Messaggio 547, livello 16, stato 0, riga 7
The DELETE statement conflicted with the REFERENCE constraint âFK_dbo.InventoryTransactions_dbo.InventoryTransactionDocuments_InventoryTransactionDocumentIdâ. The conflict occurred in database âSambaPOS5â, table âdbo.InventoryTransactionsâ, column âInventoryTransactionDocumentIdâ.
The statement has been terminated.
(1 riga interessata)
(1 riga interessata)
Messaggio 547, livello 16, stato 0, riga 11
The DELETE statement conflicted with the REFERENCE constraint âFK_dbo.AccountTransactions_dbo.AccountTransactionDocuments_AccountTransactionDocumentIdâ. The conflict occurred in database âSambaPOS5â, table âdbo.AccountTransactionsâ, column âAccountTransactionDocumentIdâ.
The statement has been terminated.
Messaggio 547, livello 16, stato 0, riga 13
The DELETE statement conflicted with the REFERENCE constraint âFK_dbo.AccountTransactionValues_dbo.AccountTransactions_AccountTransactionId_AccountTransactionDocumentIdâ. The conflict occurred in database âSambaPOS5â, table âdbo.AccountTransactionValuesâ.
The statement has been terminated.
nel pannello Impostazioni> account> transazioni le vedo ancora tutte come un elenco.
in the Settings> account> transactions panel I still see them all as a list.
The script is trying to delete a record that is referencing or is referenced by another record in the database.
While Qâs script contains the same as the one I have, the order of operations is different. Please try this one (I know for sure it works on current Builds (5.2.x+):
DELETE FROM [TicketEntities]
GO
DELETE FROM [Tickets]
GO
DELETE FROM [AccountTransactionDocuments]
GO
DELETE FROM [AccountTransactions]
GO
DELETE FROM [AccountTransactionValues]
GO
DELETE FROM [Calculations]
GO
DELETE FROM [CostItems]
GO
DELETE FROM [InventoryTransactionDocuments]
GO
DELETE FROM [InventoryTransactions]
GO
DELETE FROM [Orders]
GO
DELETE FROM [PaidItems]
GO
DELETE FROM [PeriodicConsumptionItems]
GO
DELETE FROM [PeriodicConsumptions]
GO
DELETE FROM [ProductTimerValues]
GO
DELETE FROM [Payments]
GO
DELETE FROM [WarehouseConsumptions]
GO
DELETE FROM [WorkPeriods]
GO
UPDATE [Numerators] SET Number = 0
GO
UPDATE [EntityStateValues] SET EntityStates = '[{"S":"Available","SN":"Status"}]' Where EntityStates like '%Status%'
GO
You can paste this into a new query in Microsoft SQL Server Management Studio, or save it as [CBL]Clear Database Transactions.sql
and place in Documents\SambaPOS5\Database Tasks