Barcode scanned product shows price decimal .00 by default instaed of correct decimal values

I have created products with barcode 00290 value, my bracode setting is just like this post

Everything works fine only decimal values show .00 and does not display the correct value
Please can anyone guide ehat is going wrong with decimal values?

Can you show a sample of your barcode and screenshots of your actions and rules.

Hi, please see all the screen shots which are related. I am not sure what is going worng.
Even I use kep pad m






essage pop-up do not show up and any calculation example 02000920014335 shows on 14.00 in decimal. Even I use barcode scanner and it does same value display 14.00

I am not sure what is going worng.
Even I use key pad message pop-up do not show up and any calculation example 02000920014335 shows on 14.00 in decimal. Even I use barcode scanner and it does same value display 14.00

Thank you for posting the information.

Can you breakdown your barcode what each section is:


I just want to make sure I understand your barcode correctly.

please ignore that number as typo error, actual input example 0200920014756 based on the meat related post in the forum I had used.

Again, can you show a sample of your barcode?
And can you explain what parts of your barcode are what?

If I (or anybody else) can come up with a solution, I/we would rather have to do it only once. Instead of coming up with a solution then you coming back with it does not work. Then providing more information and having to redoing the solution. The more information you can provide the easier it is for use to come up with a solution the first time.

I am using this online generated barcode, Whatever price I use for price code, the decimal part comes as .00 It does not show correct value in decimal part 12.76 BUT it shows 12.00
Even when I use keypad and type the whole barcode it show same problem.(12.00) as price

1st part of the price works fine that is “12” but decimal value is the issue here.

JavaScript’s substring() takes two integers: start index and end index (not start index and length like other languages).

To get “02785” from the sample barcode image one would use str.substring(7, 12) (start at 7th position until the 12th) which should return “02785”, then divide by 100 to get the decimal price value.

Instead of nesting expressions ([=]), I’d recommend using the built-in script handler.


function getPriceFromBarcode(barcode) {
  return barcode.substring(7, 12) / 100;
}

Where you need the price use {CALL:bc.getPriceFromBarcode('[:NumberPadValue]')} (where bc is whatever handler name you specify).

Hi Memo, please guide with some screen shot …where and how should I add this code.
Many Thanks

But everything works for Faisal and QMckay in Meat Scale post

then why my decimal get auto round up to .00?


I added that code, tried it but nothing works. Its still the same result. Decimal values automatically shows .00. Even i type the whole barcode value or scan it which barcode scanner, result is still the same it does not show 12.76 BUT it shows 12.00

Only the “12” showing means something is being discarded.

Familiarise yourself with the Show Message action and use that to debug and see what values are being returned. You should be able to pinpoint where the failure is.

As for where to place the call to the script, it would be for “settingValue” in the image below. Once the script is saved, restart SambaPOS to reload scripts.

I also noticed the underscore on that action which is default when copying items. If it is a copy, one can reuse actions - no need to create a new one for every use.

Hi Guys, I am been trying things since 3 days but nothing seems to work please help, all I ask how to get the right decimal value and not .00 be default. What must be going wrong here, I tried everything as per your suggesstions but no result.


I’d be interested in what the value is here:

Copy the settingValue into the show message action and see what pops up.

hi memo,
I not even getting message popups please see the attached actions and rules here, what am I doing wrong please guide. barcode or keypad type barcode result same as decimal 12.00



FYI this is barcode setting here

I suggest opening notepad and use your barcode scanner to ensure that the value is what’s expected: starts with 02 and has a length of 13. I’ve set the same constraints as you’ve specified and the rule fires without issue.

Also, try removing the constraints specified and see if you see a popup with the entered value.

2025-03-12_17;59_1741823983_Samba.Presentation

@Memo Did you try setting the Barcode Prefix in the barcode settings? I tried with the 02 settings and could not get the show message to fire, even with no constraints. When I removed the prefix values, then it worked for me.

husain, After looking at this situation, I think the problem is Samba is looking for a quantity, not a price. Which would make sense, because that is how you would keep track of inventory. The quantity can be in decimal format.

Nope, I haven’t played with the barcode settings. I didn’t even know they existed.

I suggest OP reach out to SambaPOS directly for assistance as I don’t think this feature is not widely used so I doubt there will be many users here who could assist. For me, I was just approaching it from a how-to-parse-the-input-point-of-view.