# Custom Closing Report

Hi Everyone,

I love SambaPOS and recently purchased a v5 license. I am having some trouble with logic in reports (customized), is there a tutorial that explains syntax with math operations?

Essentially what I want to do is the following:

-Grab the total number of item sales except for in 2 categories, so let’s say the total item sale is 150
-Variable: Op Cost = (item sales) * 1.51 (ex: 226.5)
-Variable: Food Cost = (total cash sales) * 0.35 = (ex: 138)

Now I want to take the total cash sales and deduct op cost and food cost to give me an amount my closer should have left to set aside.

I just can’t seem to figure out how! Any help would be awesome.

Calculations/sums are easy, do you have the report expressions and tags for the values you need to multiply?

I do not yet, that is where I am stuck, not sure how to make that happen. I am familiar with variables and expressions in bash for example but the same logic doesn’t seem to apply.

Look here …

Thanks! That helps but I have some issues still , per the guide ,=2+2 should work as an expression but for example if I add this to my report:

`{REPORT ORDER DETAILS:O.Quantity.Sum:(ODI=True)}`

I get the right number, if I make it an expression it fails, example:

`{REPORT ORDER DETAILS:O.Quantity.Sum:(ODI=True),=2+2}`

Is my syntax wrong?

What’s ,=2+2 for? You have lost me…

It is an expression. A calculation. He wants to do math in the Report, like read a report field name value and multiply it by a number.

It must be. HINT: What made you choose to put the comma before the expression?

1 Like

I get its a calculation but I mean why would you have a report with =2+2…

Even without the comma I dont understand why you would have (ODI=True)=2+2.
Obviously am missing something somewhere…

Hello,

the 2+2 is just an example in the tutorial. In reality it is as follows:

{REPORT ORDER DETAILS:O.Quantity.Sum:(ODI=True)}

This gives me the total number of item sales. I want to multiple that by 1.51

As a test. And the test is not working, because the syntax is incorrect… the expression is in the wrong location.

Hello,

Can you point me to the correct syntax? In emri’s example the expression is trailing the statement separated by a ,= but when I do that it fails.

You can use `=2+2` in fields section of query. Expression part (eg odi = true) is used to filter results so 2+2 should not be used there. Also adding .sum to a field converts query to a group by and 2+2 won’t processed correctly as it does not have a meaning in the context of group by. Use it as it shown here and it will work fine.

``{REPORT ORDER DETAILS:O.Quantity,=2+2:(ODI=True)}``
2 Likes

Thank you. My ultimate goal is simply to modify the resulting number (85 in this case) of the Report Order Details Quantity. But I only want to include certain categories, is this possible? Also using the above login I try this but it yields no output:

{REPORT ORDER DETAILS:O.Quantity,=*1.51:(ODI=True)}

No, doesn’t look right to me, please explain what your trying to do again?
What’s X1.51 achieving?
Each comma splits the fields into columns, so your seccond column is =*1.51???

My end goal is as follows:

Get the total number of items sold in the following Category Groups: Food, Coffee then multiple that by 1.51
(This calculates my daily cost of operation to reserve in cash)

Then I also want to get the total cash sales for these category groups: Food, Coffee, Alcohol, Drinks and then get 30% of that number (this is my food cost to put aside for daily purchases).

Better yet let me rephrase this, I need to be able to use variables ,is this possible?

For example, define the results of a report tag as a variable and use it.