Hi there I had a scary surprise when checking report today, half of tickets and orders had “disappeared”. I found them back in the database with a date of 2009-01-01.
These were the orders/tickets submitted with 1 terminal (puma).
I check event logs on that terminal and the date was reset on “system date” (2009-01-01) at reboot after a power failure. (CMOS battery?)
My system
SambaPOS 5.2.20
DB 152-152
4 terminals
On the forum, I saw the same problem and the @QMcKaysql query to identify all affected records. I run it, I’ve got 544 records affected. Here is the result:
For what is worth, there is a difference of 350880720 seconds between the ticket/order timestamp in the database and the ticket/order real time.
QmcKay UPDATE query is from 2016, the database design has changed, is it still valid in 2020? is it enough and sufficient to update all SambaPOS tables records that deal with date?
Is there a way to UPDATE with a command like: UPDATE [Tickets] SET [Date] = @newDate
where newDate = 2009’s date + 350880720 seconds
Finally the QMcKay query uses WHERE id is from X to Y, which I cannot use because two terminals were used simultaneously, only one had the time reset problem.
To be honest, I wouldn’t mess about with adding milliseconds. I would just set date to one date/time and settle for not correct time of day but at least in correct day.
Hate dealing with dates unless completely unavoidable.
Yes I think I will use a single date/hour
(by the way it is not milliseconds but seconds)
That’s my first question.
I never met SambaPOS database in person.
That’s why I am asking if this is enough to update the following columns (or maybe there is more to update):
Tickets
Date
LastTime
LastOrderDate
LastPaymentDate
Orders
CreatedDateTime
LastDateTime
AccountTransactionValues
Date
AccountTransactionDocuments
Date
Also concerning the where clause, I cannot use ticket ID for all tables.
On 1 ticket I can have orders sent by any terminal (waiter):
sent by puma (2009, incorrect)
sent by lobo (2020 correct)
I don’t know the database, so I can of course always imagine, but never be sure. My system is in “production” and used from 6:00 am till 3:00 am, 21 hours a day, 7 days a week. I don’t want to mess it.
UPDATE [Tickets] SET [Date] = '2020-02-14 14:47' WHERE [Id] = '124420'
Mens. 242, Nivel 16, Estado 3, Línea 1
La conversión del tipo de datos varchar en datetime produjo un valor fuera de intervalo.
Se terminó la instrucción.
Hora de finalización: 2020-02-15T19:10:44.7045750-05:00
OK
I need to put a “T” between date and time, brave windows.
UPDATE [Tickets] SET [Date] = '2020-02-14T14:47' WHERE [Id] = '124420'