DISCOUNT - Any Item - Ask Custom Amount


#104

the 2nd one is better as with the first you can discount any amount like 1000% and it ends up giving the item a negative price

is there a way to make the 2nd one accept 1 or 2 digits so if entering 5% discount you can type 5 and not 05, is there a ? to go somewhere?


#105

BTW you need to add a constraint to prevent -price.


#106

I tried that constraint but it still lets you discount more than 100% to get item a negative value


#107

100% would not = negative.

Try

 [?Enter Discount Percentage;(\d{1})(\d{1}?);;ON]

This tutorial is not dealing with % are we talking about two different things?


#108

no if i type 1000 for example it reduces the price by 1000% into a negative value


#109

sorry ive got both discount buttons set up, the percentage one and the value one so i can discount items by percent or by a set amount

EDIT: i was trying it with the % one first before adding it to the discount by value one


#110

The constraint I showed pertained to this tutorial not the % tutorial. This is the root of our confusion. Of course it would not work for the % tutorial. You would need it to check an expression to constrain the % tutorial.


#111

I just tried it with the value option and it still discount less than price with the constraint added and as there is no decimal point you can only discount in whole number so i couldnt discount 1.45 for example


#112

So you would need to add a . in there to allow decimal since you are constraining it to just digits.

That constraint works if you put it where I showed you exactly and you have not modified anything else in the tutorial…and if it is dealing with the tutorial in this thread NOT the % tutorial.

You can not constraint it to just allow 2 numbers and then expect to be able to type 1.45… you can add a decimal into it… but it would still only allow 2 numbers… What you need is a constraint to not allow it to discount more than price. And take off the mask that restricts it to just digits and no decimal.

You are mixing 2 different discount types and talking a bout them like they are 1. This is confusing me and yourself.

The mask I showed you for restricting it to just 2 digits is good for a % off … but not good for an exact amount like this tutorial. I read between the lines and realized you were talking about % off. The same mask would obviously not work for the fixed amount discount.

Bottom line you will not be able to use the same mask for those two different discount systems. You need to figure out one you like for % off and figure out one you would like for the custom amount discount. By restricting % off to just 2 digits you effectively constrain it so it will not allow 100% off… so no need for anymore constraints…

The custom amount discount as described in this tutorial would need a constraint preventing amount from exceeding items Price. You would not need an input mask entered in this case because if they entered too large of amount it would check constraint and not allow it.


#113

I can change the number of digits i understand that bit but how do i make it so i can enter a decimal when the keypad that appears doesnt have a decimal button to press?


#114

I guess with the percentage discount if i only let it have 2 digits in the expression that should stop anything more than 99% be used? Would that work?


#115

If you really need to use only numpad then you may have to input in cents


#116

Actually, I use it.
But I have to use full keyboard because I need to input $ and .
I don’t have SampaPOS in front of me but it look like this:
0|$(masking)|(masking)%
I will fill those masking when I have computer


#118

i tried that but the . doesnt show when using the keypad and still only discount in whole numbers, i think ill just not use discount by amount and just use price change button instead?


#120

there is no where to enter the . so typing 233 deducts 233 and not 2.33

EDIT: on the keypad it shows you need to enter 4 character (3 digits plus the .) the expression doesnt but the . in when typing its expecting you to manually type the . but the keypad doesnt have a decimal point button to press


#121

Try remove white space from expression


#122

So your wanting it to auto insert the .?


#123

yes if it can please ?


#124

I could be wrong but i think to do that you would allow the up to 4 numbers and then in the rule that uses that value format Command Value to xx.xx or x.xx

I do not know if that is possible.


#125

I know why it require 4 digits.
Because of . is match a digit as well.
So, [0-9]\.[0-9][0-9] will allow you enter 999 -> 9.99 but maybe impossible to do over 9.99 because it will match first 2 digits to dollar amount first.

Or [0-9][0-9]\.[0-9][0-9] but you have to put 0999 -> 09.99. This way you can do more than 9.99.

At least you got . autofill

I think we will need full function regex to archive this. Match from start or end (^ and $) maybe @emre can improve this but I need to be able to use $ too (maybe just $).