Does the Show message action popup when a ticket is paid?
If the popup is being displayed then it might be the rules constraints.
There looks like your using 2 different entity names Customer & Customers. Look in Manage → Entities → Entity Types. Look to see how you have it spelled there and change the appropriate customer(s).
the show message action pops up when i settle my customers ticket and the count is updated or added correctly… its only when it comes to the receipt thats printed , the points are not being updated, i think it prints before the points are added
When situations like this arise, I look to rule’s sort order. If the print bill rule fires before the rule that updates the entity then the receipt will be off.
If you reprint the receipt manually afterwards, do the points print properly?
Wow, thank you so much i ddnt know that my rules sort order can affect my printing…so i changed my rules sort order, now its printing properly the points
that how i have arranged my rules
does that also affect the way Change amount is printed?
i have been having a problem with my printer not printing when change is due it only prints when the settled amount is same as ticket amount
eg, the ticket is R200 then i settle with same amount it prints the bill after settling…
but if the ticket is R200 then i settle the bill with an amount more than the ticket, it doesnt print the bill.
this is my rule
on my printer template Change Due: {CHANGE TOTAL}
i made a similar rule with Custom constraint Change Amount |Greater than 0
its printing when amount settled is more than the ticket amount but still the change due is showing 0:00 on the printed receipt
Hi…have been using this loyalty point tutorial for a while now and i like how it works but the problem i have seen recently is when it updates the points when the customer has paid i see that it only updates certain customers especially the ones that dont have space in it…for example ”john Michael“ ….it doesnt update if its “ john Michael “ space in the beginning and end….is there a way i can fix this for most of my customer’s names have spaces in the beginning and some at the end ……dnt know why these waiters put space in the beginning and the end of the names🫨
im using the latest sambapos , i have more than a thousand customers with those errors so i got it fixed by using Sql to fix customer names that had spaces in the beginning and at the end
Be sure to also correct the records in dbo.TicketEntities as the current entity info for the ticket is saved separate and isn’t pulled from the entities table.
Something like this should work:
UPDATE te
SET te.EntityName = e.Name
FROM dbo.TicketEntities te
INNER JOIN dbo.Entities e
ON e.Id = te.EntityId;
im not good in sql, just did this via Chatgpt…is it looking okay?
but its working correctly
UPDATE [Entities]
SET [Name] = LTRIM(RTRIM([Name]))
WHERE [EntityTypeId] = (SELECT [Id] FROM [EntityTypes] WHERE [Name] = 'Customers')
AND (LEFT([Name], 1) = ' ' OR RIGHT([Name], 1) = ' ');
Just Trim() should work. The following will update Entities and TicketEntities.
As for running the SQL, just use SSMS - it’s easier. You could also create a database task containing the SQL then run it from the management area.
DECLARE @EntityTypeName NVARCHAR(MAX) = N'Customers';
DECLARE @EntityTypeId INT;
SELECT @EntityTypeId = Id
FROM dbo.EntityTypes
WHERE Name = @EntityTypeName;
IF (@EntityTypeId IS NULL)
BEGIN
DECLARE @ErrorMessage NVARCHAR(MAX) = CONCAT('Entity Type "', @EntityTypeName, '" not found');
RAISERROR(@ErrorMessage, -15, -1);
END;
UPDATE dbo.Entities
SET Name = TRIM(Name);
UPDATE te
SET te.EntityName = e.Name
FROM dbo.TicketEntities te
INNER JOIN dbo.Entities e
ON e.Id = te.EntityId;
thank you that works great…is there a way i can make a rule to implement this sql or run it as a script so when a customer is created it checks if there is any spaces in the beginning or end of customer name and then it fixes that …the reason i want it like that its that some of my waiters always tend to create customer account and put spaces in the end or beginning of name then that creates a problem with my loyalty customers when it comes to updating the points(then it wont update if there is any spaces in the beginning or end of name)
My approach would be a trigger on the entities and table entities tables that fires on inserts and updates that updates the name if Trim(Name) <> Name.
Let me know if that solution interests you and I’ll whip up something in the coming days.
Copy the following and execute is against the db in SSMS:
/* Tuncates leading and trailing spaces for Entity name */
IF OBJECT_ID('dbo.trg_Entities_AfterInsertUpdate') IS NOT NULL
DROP TRIGGER dbo.trg_Entities_AfterInsertUpdate;
GO
CREATE TRIGGER dbo.trg_Entities_AfterInsertUpdate
ON dbo.Entities
AFTER INSERT, UPDATE
AS
BEGIN
DECLARE @Id INT;
DECLARE @EntityName NVARCHAR(MAX);
DECLARE @TrimmedName NVARCHAR(MAX);
SELECT @Id = Id,
@EntityName = Name
FROM Inserted;
SET @TrimmedName = TRIM(@EntityName);
IF (@EntityName <> @TrimmedName)
BEGIN
UPDATE dbo.Entities
SET Name = @TrimmedName
WHERE Id = @Id;
END;
END;
GO
/* Tuncates leading and trailing spaces for Ticket Entity name */
IF OBJECT_ID('dbo.trg_TicketEntities_AfterInsertUpdate') IS NOT NULL
DROP TRIGGER dbo.trg_TicketEntities_AfterInsertUpdate;
GO
CREATE TRIGGER dbo.trg_TicketEntities_AfterInsertUpdate
ON dbo.TicketEntities
AFTER INSERT, UPDATE
AS
BEGIN
DECLARE @Id INT;
DECLARE @EntityName NVARCHAR(MAX);
DECLARE @TrimmedName NVARCHAR(MAX);
SELECT @Id = Id,
@EntityName = EntityName
FROM Inserted;
SET @TrimmedName = TRIM(@EntityName);
IF (@EntityName <> @TrimmedName)
BEGIN
UPDATE dbo.TicketEntities
SET EntityName = @TrimmedName
WHERE Id = @Id;
END;
END;
GO