I try to increment a counter but I am new to variable and cannot find my way.
I create an new Entity Type where i defined a field as Sunat Number. (Btw I have just 1 entity, it’s maybe not a good practice to create a new entity type for just 1 entity. I have just discovered Ticket tag and I think it would be more appropriate, no?)
In Action, I defined a variable:
[:QUANTITY]
In Rule I try to increment it
+{QUANTITY}
But the result is:
Entity data old value: 115
Entity data new value: +{QUANTITY} instead of 116
Finally I abandonned the Entity way and I went for the Ticket Tag way as explained in here and it works.
However I don’t understand everything I’ve done.
New Action - Update Program Setting
Setting Name: SerialNumber ??
Setting Value: 1
Update Type:Increase
IsLocal = False
What did I do ? Did I create a program variable named “SerialNumber” ?
New Action - “Update Ticket Tag”
Tag Name: SunatNumber ??
Tag Value: {:SerialNumber}
What did I do? Did I create a TICKET TAG name “SunatNumber”? (I did not add SunatNumber manually with “Add Ticket TAG”.)
I add these 2 actions on the Print Bill rule and now I have a number which is incremented everytime I print a ticket. I know it’s a bit weird but that’s the way the SUNAT wants to see the bills printed, avoiding the Zero Tickets (Merge table, VOID table, …)
By using Update Program Setting action you can store such values. If IsLocal is True it will be available only for that terminal and value lost when you close SambaPOS. If IsLocal is False that value will be stored in database and all terminals can access latest value.
You can create, delete ticket tags by using Update Ticket Tag action without the need of configuring tags. That tag configuration is useful to display buttons and if you don’t need buttons you don’t need to configure tags. You can delete tags by setting empty tag value.
Instead of adding incrementation to Print Bill rule you can;
clone print bill rule and remove existing actions from cloned rule
add incrementation and update tag action like
add a constraint to only increment if ticket tag is empty.
Sort rules to execute this rule before print bill rule.
So multiple prints of same ticket won’t increase sunat number.