edit %USERPROFILE%\My Documents\SambaPOS5\Layout\TicketExplorer.xml and look for the following block:
<property name="Item2" isnull="true" iskey="true">
<property name="GridRow">0</property>
<property name="FieldName">Id</property>
<property name="UnboundType">Integer</property>
<property name="Name">TicketExplorer_2_Ticket_Id</property>
<property name="Header" type="System.String">Ticket Id</property>
<property name="Visible">false</property>
<property name="VisibleIndex">1</property>
<property name="Width">84</property>
<property name="ActualWidth">84</property>
</property>
change
<property name="Visible">false</property>
to
<property name="Visible">true</property>
to hide the ticket number column change the same property to false in the following block:
<property name="Item1" isnull="true" iskey="true">
<property name="GridRow">0</property>
<property name="FieldName">TicketNumber</property>
<property name="UnboundType">String</property>
<property name="Name">TicketExplorer_1_Number</property>
<property name="Header" type="System.String">Number</property>
<property name="Visible">false</property>
<property name="VisibleIndex">0</property>
<property name="Width">82</property>
<property name="ActualWidth">82</property>
</property>
Repeating and adding to what Posflow said about uniqueness: table primary key’s are guaranteed to be unique and that’s it. Ticker numbers are guaranteed to be sequential but not necessarily without gaps.
SQL Server will, from time to time, bump an integer primary key sequence by 1000 if there was a dirty shutdown thus causing a gap.
SambaPOS assigns ticket numbers after the Before Ticket Closing event and before the Ticket Closing event. The db is queried for the current sequence value for the numerator, incremented in the db, assigned to the ticket in memory/client side, then eventually persisted to the db. If the last part is interrupted for some reason, then there would be a gap in the ticket number sequence. But this really shouldn’t be happening under normal circumstances.
If you’re seeing a lot of gaps in ticket numbers there may be something else going on.
Here’s a SQL query to run against the db to show the gaps.
WITH Tkts
AS (
SELECT CAST(TicketNumber AS INT) AS TicketNr,
Date AS TicketDate,
LEAD(CAST(TicketNumber AS INT)) OVER (ORDER BY CAST(TicketNumber AS INT)) AS NextTicketNr,
LEAD(Date) OVER (ORDER BY CAST(TicketNumber AS INT)) AS NextTicketDate
FROM dbo.Tickets
)
SELECT TicketDate AS GapStartDate,
NextTicketDate AS GapEndDate,
TicketNr AS GapStart,
NextTicketNr AS GapEnd,
NextTicketNr - TicketNr - 1 AS Cnt
FROM Tkts
WHERE NextTicketNr - TicketNr > 1
ORDER BY GapStart;