Clear Transaction Data

How would one set about doing this through automation?

I tried to create a SQL configuration task but it throws an error.

Easy if we don’t ask, but one client has asked for till to be reset daily so I’m creating a Z button.

If workperiod open it tells to close work period first
if work period is closed it prompts a question asking if ‘are you sure you want to run a Z read’

I’m just not managing t get the correct action/script.

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

Matt

The only reason I can imagine for wanting to do this is to evade taxes, personally I would just avoid getting involved in this and tell the customer it’s not possible. If they want to use POS software and expect it to make all transactions disappear every day, it’s really no point to use POS software and they should just use a pen and paper… :wink:

2 Likes

Like I said. Nothing to do with me… I don’t ask questions

maybe they where testing… LOL!!!

Nope lol they wernt .

Ok lets just pretend I want to run some SQL in samba… could be anything, how do I go about doing that :slight_smile:

There is also an action to execute those tasks. Or you can use the SQL Helper. Or you can use {CALL:X}

Paste the SQL code into a new Script. Name the handler using double @ prefix:

@@clearTx

Create another script that will use JScript, and use the sql.X helper to execute the SQL Handler:

sql.ExecSql('@@clearTx');
... or ...
sql.Exec('@@clearTx');

3 Likes

how could we insert a user input into the script?
i could set a rule that can ask a user to input something, i want the value of that input inserted into the field where once executed it would do what the script is commanded to do, based on user input.

e.g. like a query, the sql script would be a query like
SELECT column_name,column_name FROM table_name WHERE column_name operator value; <— This would be where the insert input would go to, and then once it has it, it would fire that sql command

Check the Topic about creating a User using JScript and SQL. It shows how to do this…

check the long discussion we had last night about adding users, pretty sure that’ll get you on the right track? lots of code in there

@QMcKay beat me to it lol

2 Likes