SQL Error help and samba crashes

Hello, I have a 4 departments, Dine in,To go, delivery & bar. The entity “to go” is in 2 departments Dine in and togo. i get a sql error on togo department when i’m selecting a product. bun the same entity in Dine in works just fine and both are the same. I notice is just some products at “Desayunos” in my menu. once the error happens samba crashes.

Menu: desayuno
product: arepa & huevos

Thank you for your help.

down is the error I get.

-----------------------------
[General Info]

Application: SambaPOS
Version:     4.1.82
Region:      en
DB:          SQ
Machine:     S1
User:        POS
Date:        8/27/2015
Time:        10:17 PM

User Explanation:

POS said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.Reflection.TargetInvocationException
Message:     Exception has been thrown by the target of an invocation.
Source:      mscorlib
Stack Trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at Samba.Presentation.App.Main()

Inner Exception 1
Type:        System.DivideByZeroException
Message:     Attempted to divide by zero.
Source:      mscorlib
Stack Trace: at System.Decimal.FCallDivide(Decimal& d1, Decimal& d2)
   at Samba.Domain.Models.Tickets.TaxValue.GetTaxAmount(Boolean taxIncluded, Decimal price, Decimal totalRate, Decimal plainSum, Decimal preTaxServices)
   at Samba.Domain.Models.Tickets.Order.<>c__DisplayClass54.<GetTotalTaxAmount>b__52(TaxValue x)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.Sum(IEnumerable`1 source)
   at Samba.Domain.Models.Tickets.Order.GetTotalTaxAmount(Boolean taxIncluded, Decimal plainSum, Decimal preTaxServices, Int32 taxTemplateAccountTransactionTypeId)
   at Samba.Domain.Models.Tickets.Ticket.<>c__DisplayClassbb.<GetTaxTotal>b__ba(Order x)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.Sum(IEnumerable`1 source)
   at Samba.Domain.Models.Tickets.Ticket.Recalculate()
   at Samba.Presentation.Services.Implementations.TicketModule.TicketService.RecalculateTicket(Ticket ticket, Boolean forceRecalculation)
   at Samba.Presentation.Services.Implementations.TicketModule.TicketService.AddOrder(Ticket ticket, Int32 menuItemId, Nullable`1 quantity, String portionName, String orderState)
   at Samba.Modules.PosModule.TicketOrdersViewModel.AddOrder(Int32 menuItemId, Nullable`1 quantity, String portionName)
   at Samba.Modules.PosModule.TicketOrdersViewModel.AddOrder(ScreenMenuItemData data)
   at Samba.Modules.PosModule.PosViewModel.OnMenuItemSelected(EventParameters`1 obj)
   at Microsoft.Practices.Prism.Events.EventSubscription`1.InvokeAction(Action`1 action, TPayload argument)
   at Microsoft.Practices.Prism.Events.EventSubscription`1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments)
   at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments)
   at Microsoft.Practices.Prism.Events.CompositePresentationEvent`1.Publish(TPayload payload)
   at Samba.Presentation.Services.Common.ExtensionMethods.Publish[TEventsubject](TEventsubject eventArgs, String eventTopic, Action expectedAction)

-----------------------------

[Assembly Info]

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

-----------------------------

[System Info]

Operating System
-Microsoft Windows Server 2012 Standard
--CodeSet = 1252
--CSDVersion = 
--CurrentTimeZone = -240
--FreePhysicalMemory = 6595432
--OSArchitecture = 64-bit
--OSLanguage = 1033
--ServicePackMajorVersion = 0
--ServicePackMinorVersion = 0
--Version = 6.2.9200

Machine
-S1
--Manufacturer = Dell Inc.
--Model = PowerEdge T300
--TotalPhysicalMemory = 8583901184
--UserName = S1\POS

-----------------------------

As the error states it has something to do with taxes. It is attempting to divide by zero. This means its probably a calculation or tax template issue.

1 Like

Look at that show us some screenshots of portions and your calculations/tax templates.

It could also be inventory setup.

I have an auto calculation for togo $0.50

So that item Arepa show its settings, show portion, recipe, and inventory item for it.

I don’t use inventory. I do have order tags

OK it is like I thought. You are adding .50 service fee to ticket before items added. Your item has 0 price portion so as soon as you add that item its trying to add tax to 0 price.

Two options to fix this: (2nd one is my favorate)

Set a base price for product and then adjust order tags so it equals out how you want.

Or change how your service charge is added to ticket… instead do not use the calculation selector and use the Ticket Total Changed rule and Add Calculation action.

1 Like

Thank you very much Kendash. I used the first option as a quick fix. I will work on the second option with time.

1 Like

Best practice is not to use 0 price portions. Set a base price and use order tags to manipulate that price if needed.