How does SAMBAPOS calculate Cost of Items

I would like to know how its done, becuase I may have done something wrong at purhcases, or End of day reports, or somewhere…

Its simply not possible that a bottle of water costs R$91,84 (I sell it for R$2 and buy it for R$1)

And when I go SAMBAPOS Cost Report I get in the same product a NEGATIVE value?

Why do I ask this? well we do take a lot of desitions regarding how much money we do have invested in sitting stock.



I do not know how you setup your inventory products… but I do not think Cost is a per item number… I think its a total cost based on portions? Maybe include some screenshots of how you have your inventory product entered? and how you are purchasing them?

EDIT: It looks like you may be entering your products prices wrong when entering a purchase transaction based on how you defined your inventory items.

EDIT: Use the bottle of water as an example… pull that item up as you entered it in inventory then show a purchase report with it.

Purchase Reort

[General Info]

Application: SambaPOS
Version:     4.1.53
Region:      en
DB:          SQ
Machine:     SERVIDOR
User:        Gerlando
Date:        02/09/2014
Time:        16:33

User Explanation:

Gerlando said ""

[Exception Info 1]

Top-level Exception
Type:        System.DivideByZeroException
Message:     Attempted to divide by zero.
Source:      mscorlib
Stack Trace: at System.Decimal.FCallDivide(Decimal& d1, Decimal& d2)
   at System.Decimal.op_Division(Decimal d1, Decimal d2)
   at Samba.Modules.BasicReports.Reports.InventoryReports.PurchaseAbstractReportViewModel.GetReport() in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\InventoryReports\PurchaseReportViewModel.cs:line 72
   at Samba.Presentation.Common.Reports.AbstractReport.<>c__DisplayClass8.<RefreshReport>b__2(Object param0, DoWorkEventArgs param1)
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)


[Assembly Info]

Samba.Services, Version=
mscorlib, Version=
System, Version=
Microsoft.Practices.Prism, Version=
WindowsBase, Version=
Samba.Infrastructure, Version=
Samba.Infrastructure.Data, Version=
PresentationFramework, Version=
System.Xaml, Version=
Samba.Presentation.Services, Version=
FluentValidation, Version=
Samba.Domain, Version=
DevExpress.Xpf.Grid.v14.1, Version=
DevExpress.Xpf.Grid.v14.1.Core, Version=
PresentationCore, Version=
Stateless, Version=
System.Core, Version=
System.Drawing, Version=
System.Windows.Forms, Version=
System.ComponentModel.Composition, Version=
Samba.Localization, Version=
Microsoft.CSharp, Version=
Microsoft.Practices.ServiceLocation, Version=
Samba.Persistance, Version=
Microsoft.Practices.Prism.MefExtensions, Version=
DevExpress.Xpf.Core.v14.1, Version=
PropertyTools, Version=2012.4.14.1


[System Info]

Operating System
-Microsoft Windows 7 Professional
--CodeSet = 1252
--CSDVersion = Service Pack 1
--CurrentTimeZone = -180
--FreePhysicalMemory = 1155836
--OSArchitecture = 64-bit
--OSLanguage = 1046
--ServicePackMajorVersion = 1
--ServicePackMinorVersion = 0
--Version = 6.1.7601

--Manufacturer = LENOVO
--Model = 2522G26
--TotalPhysicalMemory = 4080709632
--UserName = SERVIDOR\Gerlando


Check your Inventory Item definition as well to be sure it is set properly…

You are entering your items wrong… if it crashes it means you tried to force a price that it didnt compute. You should not have to force a price when purchasing… you either select total and it auto fills in UNit price… or you select unit price and it auto fills in total. if you try to force them both in it will crash and means you entered it wrong.

you can do single transaction units for items you sell whole with no portions… example 1 bottle of coke… sells as 1 bottle of coke…

You would put transaction multiplier to 1…

On purchase transaction for qty you would enter total qty of bottles not cases… and you would enter Total Price not Unit price.

so Coke comes in case of 12 and 1 case = 5.00… purchase would look like

QTY=12 Unit Price =blank Total Price = 5.00 It will auto fill in the Unit price for you.

For food items that are impossible to know EXACT inventory… like tomato’s etc. Basically stuff you sell portions of…

You would enter the Case qty you buy it at for transaction multiplier so lets use that coke as example again

Case qty =12 and its 5.00 per case if you have your transaction multiplier at 12 a purchase would look like

Qty = 1 Unit price = 5.00 Total=blank It would auto fill in total price for you.

For Tracking Purposes:
By defining your products this way on inventory reports it will show exact bottles of coke sold for first example and it will show %case sold for second example

1st example = per bottle cost
2nd example = per portion of case cost

I find my inventory is much more accurate when I follow this practice.
I track items I can sell to exact number: Bottled Drinks, Candy Bars, etc I track individually. The items that are impossible to track exact number: tomato, bread, milk, fountain syrup I track by case.

I dont do that…



I dont think my definitions are a problem, but I think that at one point some , or . is messing arround…


Just out of curiosity can you post a sshot of the bottle of water… how you defined it… and then post a purchase report of how you purchased it

I think, that maybe my poblem is that sometimes we do purchases with CERO price…

I know exactly what the problem is…

purchases with CERO price or negative quantities…

that messes up everything.


Why are you doing a - purchase? Are you doing that as a supplier buy back? Or a return to supplier but no $ return like a claim?

I see some possible issues there. your water… your buying 1 pack at 7.68 but total price is 7.68… Show your definition for the water please? It may not be an issue but wouldnt hurt to check

EDIT: Sorry you are right - purchase would throw it all out of whack.

Still kind of curious why you would do a - purchase. If its what I am thinking… its something I was planning to account for as well and was going to look at how to implement it.

1 Like
  1. In fact negative quantity is the cause if this. As SambaPOS calculate 0 purchases it generates divide by zero error. I’ll update reports to mute that message but I’m not sure if we should handle it like that.

  2. Calculating reliable cost is not possible when transactions contains 0 priced items. I know there are cases where we don’t know the exact purchase price while we’re adding items to inventory but to be able to calculate cost we need to know the purchase price.

Wouldnt a better practice be vs adding 0 price orders… just to go and append the end of day and change your inventory? I know that wouldnt record anything for book keeping… so really I am not sure how you would account for that. Maybe a description field we could write a note on the purchase line item so we could write something like Not Exact Purchase Price or something along those lines.

Could it be possible to IGNORE 0 priced items and negative purchases when you calculate the COST of an item?

That would be really helpfull in cases in wich I return a pack of water (negative purchase) and when in a pack of 12 cans one comes broken (in this case i will be receiving one in replacement or the amount in credit in the next purchase).



Possibly create a 2nd Transaction type called Credit Transactions to support supplier credits/returns.

I am putting togheter a report including purchases, so I can follow besides how much I bought, but how much I returned and how much I should receive as credit or new ones…
As handlers here are really NOT very soda pack friendly, they throw the cans literally inside the truck and when the download what you bought they dont care if the can is broken, or smashed… but I do look at that, becuase that is a lost can…



I was looking at something like this as well. But I couldnt figure out how to implement it with current inventory system. If we had a way to record credit transactions it might work.

I have one… but that involves negative numbers…



Does that work? I have not tried it yet. It makes sense that source would be local warehouse and target would be supplier.
But you could leave target blank

Hmm it seems to work… I can even record price for the return… and it calculates cost accurately.

The only thing I dont like is that it adds it as a consumption… ideally I wouldnt want it to be a consumption just because I sourced it out of the warehouse… i would want consumption to only track from sales.

I would prefer to have a 2nd category alongside consumption… if its sourced out of warehouse via inventory transaction it should have a category Claims or Supplier Buybacks something along that line So sales still track inside Consumption and Inventory Transactions would track via Supplier Buybacks or whatever we call that column.

In reports it shows correctly however :stuck_out_tongue:

Its not a consumption… its a negative purchase… does have nothing to do with sales…

I dont use source since I dont defined warehouses either… maybe in the future i will regret that…