I have a calculation type “Disc %” that uses “Discount % Transaction” and calculation method of “Rate from ticket amount”.
The problem is when using POS, I can only enter specific numbers for discount percentage: 10, 15, 20, 25, 50. I can’t enter custom percentages.
My settings for the calculation type are as following:
Rate or Amount: 0.000
Max Amount: 0.000 (I also tried 100.00)
Rounding: 0.000
Checked boxes: Decrease Amount, Toggle Calculation
I couldn’t find anywhere specifying fixed percentages. Would appreciate your assistance.
If you use this: [?Discount Rate;;;OCN;] this will give you a numeric keyboard instead of the alapha/numeric keyboard.
If you want to get really fancy you could use [?Discount Rate;\d{1,2};;OCN;] This will restrict the input to numbers only (prevents accidental physical keyboard inputs) and a maximum of 2 digits.
Thank you so much!
Would you mind explaining the Syntax for me or guide me through a tutorial for regex used by samba as I couldn’t find one? more specifically on the meaning of the many ;
He has a Discount Reason in there thats why I didnt force numeric keyboard, + SambaPOS will do internal check whether Discount is int or string.
You can find many tutorials online, Id recommend to look for JavaScript tutorials
Character classes
. any character except newline
\w\d\s word, digit, whitespace
\W\D\S not word, digit, whitespace
[abc] any of a, b, or c
[^abc] not a, b, or c
[a-g] character between a & g
Anchors
^abc$ start / end of the string
\b\B word, not-word boundary
Escaped characters
\.\*\\ escaped special characters
\t\n\r tab, linefeed, carriage return
Groups & Lookaround
(abc) capture group
\1 backreference to group #1
(?:abc) non-capturing group
(?=abc) positive lookahead
(?!abc) negative lookahead
Quantifiers & Alternation
a*a+a? 0 or more, 1 or more, 0 or 1
a{5}a{2,} exactly five, two or more
a{1,3} between one & three
a+?a{2,}? match as few as possible
ab|cd match ab or cd