How to round quantité in Report

Hi All,

In quantity sales report i need to round quantity instead of 4.000 => 4, plz see below pic and code

[Journal des ventes par article:5, 2, 2,1]
@{REPORT ORDER DETAILS:O.MenuItemName,O.ExactTotal.Sum.desc:(ODI=True):{0}:,}
>{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:
(ODI=True) and O.MenuItemName="$1"}
{REPORT ORDER DETAILS:'     '+[O.PortionName],O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:
(ODI=True) and O.MenuItemName="$1":2}

Copy/paste your FULL Template here. Quantity usually does not have decimal places … this is the output from the Template snippet you gave above which has no issue…

[Journal des ventes par article:5, 2, 2,1]
@{REPORT ORDER DETAILS:O.MenuItemName,O.ExactTotal.Sum.desc:(ODI=True):{0}:,}
>{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:(ODI=True) and O.MenuItemName="$1"}
{REPORT ORDER DETAILS:'     '+[O.PortionName],O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:(ODI=True) and O.MenuItemName="$1"}

[Ventes groupées par montant:2, 1, 1]
[Ventes groupées par montant:2, 1, 1]
{REPORT ORDER DETAILS:O.ItemGroup,O.ExactTotal.Percent.desc,O.ExactTotal.Sum:(ODI=True)}
>Total|{REPORT ORDER DETAILS:O.ExactTotal.Sum:(ODI=True)}

[Ventes groupées par quanité:2, 1, 1]
{REPORT ORDER DETAILS:O.ItemGroup,O.Quantity.Percent.desc,O.Quantity.Sum:(ODI=True)}
>Total||{REPORT ORDER DETAILS:O.Quantity.Sum:(ODI=True)}

[Journal des ventes par article:5, 2, 2,1]
@{REPORT ORDER DETAILS:O.MenuItemName,O.ExactTotal.Sum.desc:(ODI=True):{0}:,}
>{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:(ODI=True) and     O.MenuItemName="$1"}
{REPORT ORDER DETAILS:'     '+[O.PortionName],O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:(ODI=True) and     O.MenuItemName="$1":2}{REPORT ORDER DETAILS:O.ItemGroup,O.ExactTotal.Percent.desc,O.ExactTotal.Sum:    (ODI=True)}
>Total|{REPORT ORDER DETAILS:O.ExactTotal.Sum:(ODI=True)}

[Ventes groupées par quanité:2, 1, 1]
{REPORT ORDER DETAILS:O.ItemGroup,O.Quantity.Percent.desc,O.Quantity.Sum:(ODI=True)}
>Total||{REPORT ORDER DETAILS:O.Quantity.Sum:(ODI=True)}

[Journal des ventes par article:5, 2, 2,1]
@{REPORT ORDER DETAILS:O.MenuItemName,O.ExactTotal.Sum.desc:(ODI=True):{0}:,}
>{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:(ODI=True) and O.MenuItemName="$1"}
{REPORT ORDER DETAILS:'     '+[O.PortionName],O.Quantity.Sum.desc,O.ExactTotal.Sum.desc:(ODI=True) and O.MenuItemName="$1":2}

Too many errors with the Template you posted, but regardless, the Quantity fields have no decimals. It is difficult to troubleshoot/reproduce what you are seeing when your Template is like this.

  • Duplicate Headers/Sections
  • format section of 2 Report Tags contain ‘:2’ which is not valid.


What is your Windows Regional Settings for Decimal Separator and Thousands Separator?


Do you have SambaPOS set to override Regional Settings?

I couldn’t resolve it

i tried with function formating inside the report like this :

[Voids Detail:1,1,1,2,1, 1]

User|Date|Heure|Art|Qte|Total
{REPORT ORDER DETAILS:O.User,O.Date,O.Time,O.MenuItemName,O.Quantity,O.TotalPrice:(OS.GStatus=Gift)}

How to Format O.Quantity to force it to be #

using [=F(O.Quantity,’#’)]

Something like;

{REPORT ORDER DETAILS:O.User,O.Date,O.Time,O.MenuItemName,[=F(O.Quantity,'#')],O.TotalPrice:(OS.GStatus=Gift)}

I think…

Expressions do not work in the Field Selectors for Report Tags. You might be able to use the Format section, like {0}|{1}|{2}|etc

I cannot comment or help any further without seeing a proper Report without errors in it (which I pointed out), nor without answers to the questions that I asked which have not been answered.

It dosen’t work it always show this:

I think is related to database schema Table : Orders

field Quantity is decimal (16,3)

{0} wasnt the solution if thats what you did.

Maybe show what your tried…

Something like this was the sugestion I beleive;

{REPORT ORDER DETAILS:O.User,O.Date,O.Time,O.MenuItemName,O.Quantity,O.TotalPrice:(OS.GStatus=Gift):{0}|{1}|{2}|{3}|[=F({4},'#')]|{5}}

1 Like

I wouldnt go messing with the database structure you will surely break something. Show us what you tried.

Thx for ur replay but [=F({4},'#')] return nothing see below:

When i change the language to English in Samba Pos it resolve the problem and all quantity in reports became normal.

Any one have any idea how to show quantity in french localisation without 3 decimal ?

If thats the case its reiogonal settings related…
Check here;

I did what u sad but still the same even i restarted the computer.

You still have 3 for number of digets after decimal…

Although I have 2 but QTY in item sales report is whole numbers.

Looking at the report itself on item sales it has .Sum on qty which might be a factor.

It doesn’t have relation with the SUM or the factor its regional issue. i changed decimal from 3 to 2 but still the same problem, i found in the forum this issue they solve it with N([O.Quantity]) but still not a solution for me.

You need to share more detail to help us, we dont have access to see what you see…

you screenshot shows 3 decimal places as your regional settings, changing to 2 did this change it to 2 xeros rather than 3?

Nothing to do with regional settings but when you change your regional settings to english it works??? ok, so dismiss the sugestions from the people trying to help, clearly you know better than the rest of us and thats why your here asking fo help.

FYI it was =N([O.Quantity]) not N([O.Quantity])

Enen if you did use the = and it didnt work this is eactly why your not getting anywhere very fast because your not showing what your doing so people dont know if your making simple typo mistake thats the problem or that what your saying your doing is actually what your doing and its not being confused in termonology…

OK SORRY :smile: i know guys ur helping many people on the forum but im just blocked for more than two weeks.

here is my regional config:

Please share your Report.

I changed SambaPOS from English to French, and yes, Quantity has decimals …

[Group Sales by Amount:2, 1, 1]
{REPORT ORDER DETAILS:O.ItemGroup,O.ExactTotal.Percent.desc,O.ExactTotal.Sum}
>Total||{REPORT ORDER DETAILS:O.ExactTotal.Sum}

[Group Sales by Quantity:2, 1, 1]
{REPORT ORDER DETAILS:O.ItemGroup,O.Quantity.Percent.desc,O.Quantity.Sum}
>Total||{REPORT ORDER DETAILS:O.Quantity.Sum}

[Item Sales by Amount:2, 1, 1]
{REPORT ORDER DETAILS:O.MenuItemName,O.ExactTotal.Percent.desc,O.ExactTotal.Sum}
>Total||{REPORT ORDER DETAILS:O.ExactTotal.Sum}

[Item Sales by Quantity:2, 1, 1]
{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Percent.desc,O.Quantity.Sum}
>Total||{REPORT ORDER DETAILS:O.Quantity.Sum}


#FIX using Format section, with [=F('{0}','0')]

These all work …

[=F({0},'0')]
[=F('{0}','0')]
[=F({0},'#')]
[=F('{0}','#')]

Syntax:

[=F('{<columnNumber>}','<formatSpec>')]

F() is a Format Number function
<columNumber> is the Column, starting with Column 0
<formatSpec> indicates how you want to format the output, for example:

'#,###.00' means comma grouping and 2 decimals exactly
'# ###.##' means space grouping and 2 decimals optionally
'0000.00' means no grouping, 4 digits before decimal exactly by left-padding with zero, 2 decimals exactly

[Group Sales by Amount:2, 1, 1]
{REPORT ORDER DETAILS:O.ItemGroup,O.ExactTotal.Percent.desc,O.ExactTotal.Sum}
>Total||{REPORT ORDER DETAILS:O.ExactTotal.Sum}

[Group Sales by Quantity:2, 1, 1]
{REPORT ORDER DETAILS:O.ItemGroup,O.Quantity.Percent.desc,O.Quantity.Sum::{0}|{1}|[=F('{2}','#')]}
>Total||{REPORT ORDER DETAILS:O.Quantity.Sum::[=F('{0}','#')]}

[Item Sales by Amount:2, 1, 1]
{REPORT ORDER DETAILS:O.MenuItemName,O.ExactTotal.Percent.desc,O.ExactTotal.Sum}
>Total||{REPORT ORDER DETAILS:O.ExactTotal.Sum}

[Item Sales by Quantity:2, 1, 1]
{REPORT ORDER DETAILS:O.MenuItemName,O.Quantity.Percent.desc,O.Quantity.Sum::{0}|{1}|[=F('{2}','#')]}
>Total||{REPORT ORDER DETAILS:O.Quantity.Sum::[=F('{0}','#')]}

… deleted double post …