Trying to print work period report and getting error!


I cant print a work period report for last night, I am getting a error msg that says “sequence contains more than one matching element”

[General Info]

Application: SambaPOS
Version: 4.1.32 BETA
Region: en
DB: CE
Machine: SIOBHAN-PC
User: siobhan
Date: 5/4/2014
Time: 2:14 PM

User Explanation:

siobhan said “”

[Exception Info 1]

Top-level Exception
Type: System.InvalidOperationException
Message: Sequence contains more than one matching element
Source: System.Core
Stack Trace: at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at Samba.Modules.BasicReports.Reports.AmountCalculator.GetAmount(String paymentName) in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\AmountCalculator.cs:line 18
at Samba.Modules.BasicReports.Reports.AmountCalculator.GetPercent(String paymentName) in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\AmountCalculator.cs:line 24
at Samba.Modules.BasicReports.Reports.EndOfDayReport.EndDayReportViewModel.GetReport() in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\EndOfDayReport\EndDayReportViewModel.cs:line 56
at Samba.Modules.BasicReports.ReportViewModelBase.<>c__DisplayClass9.b__2(Object param0, DoWorkEventArgs param1) in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\ReportViewModelBase.cs:line 200
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)


[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.v13.2, Version=13.2.8.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
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
DevExpress.Xpf.Grid.v13.2.Core, Version=13.2.8.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
DevExpress.Xpf.Core.v13.2, Version=13.2.8.0
PropertyTools, Version=2012.4.14.1


[System Info]

Operating System
-Microsoft Windows 7 Ultimate
–CodeSet = 1252
–CSDVersion = Service Pack 1
–CurrentTimeZone = -240
–FreePhysicalMemory = 1869832
–OSArchitecture = 32-bit
–OSLanguage = 1033
–ServicePackMajorVersion = 1
–ServicePackMinorVersion = 0
–Version = 6.1.7601

Machine
-SIOBHAN-PC
–Manufacturer = Gigabyte Technology Co., Ltd.
–Model = GA-MA785GM-US2H
–TotalPhysicalMemory = 3488079872
–UserName = siobhan-PC\siobhan


There is a duplicate item name in your configuration. For example a user name might be same with a department name or something like that.

If you can PM me a zip file that contains your database backup (sdf file) I can test that.

So I have received what seems to be an identical error under the same conditions–when printing a work period report.
(Edit: actually after comparing the stack trace, the error really isn’t that similar)

A day ago I experimented with the inventory system, but I’m pretty sure I did that prior to printing yesterday’s report. However, tonight I was unable to load the work period report.
I reviewed @emre’s advice, but I don’t see any names in my inventory which would duplicate a name else where. I also deleted all inventory items, and tried again–still no report.

Can anyone offer any advice?

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

Application: SambaPOS
Version:     4.1.55
Region:      en
DB:          SQ
Machine:     SERVICE-PC
User:        Admin
Date:        12/14/2014
Time:        3:56 AM

User Explanation:

Admin said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.InvalidOperationException
Message:     Sequence contains more than one matching element
Source:      System.Core
Stack Trace: at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Samba.Domain.Models.Accounts.AccountTransactionDocument.UpdateSingletonTransactionAmount(Int32 transactionTypeId, String transactionName, Decimal amount, Decimal exchangeRate)
   at Samba.Domain.Models.Tickets.Calculation.UpdateCalculationTransaction(AccountTransactionDocument document, Decimal amount, Decimal exchangeRate)
   at Samba.Domain.Models.Tickets.Ticket.CalculateServices(IEnumerable`1 calculations, Decimal sum)
   at Samba.Domain.Models.Tickets.Ticket.GetPreTaxServicesTotal()
   at Samba.Modules.BasicReports.Reports.EndOfDayReport.EndDayAbstractReportViewModel.<CreateTicketTypeInfo>b__a9(Ticket y) in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\EndOfDayReport\EndDayReportViewModel.cs:line 449
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Sum(IEnumerable`1 source)
   at Samba.Modules.BasicReports.Reports.EndOfDayReport.EndDayAbstractReportViewModel.<CreateTicketTypeInfo>b__a8(IGrouping`2 x) in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\EndOfDayReport\EndDayReportViewModel.cs:line 445
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Samba.Modules.BasicReports.Reports.EndOfDayReport.EndDayAbstractReportViewModel.CreateTicketTypeInfo(SimpleReport report, IEnumerable`1 tickets, String header) in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\EndOfDayReport\EndDayReportViewModel.cs:line 443
   at Samba.Modules.BasicReports.Reports.EndOfDayReport.EndDayAbstractReportViewModel.GetReport() in c:\Users\Emre\Documents\GitHub\SambaPOS-Gold\Samba.Modules.BasicReports\Reports\EndOfDayReport\EndDayReportViewModel.cs:line 59
   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=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.5.0
DevExpress.Xpf.Grid.v14.1.Core, Version=14.1.5.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
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
DevExpress.Xpf.Core.v14.1, Version=14.1.5.0
PropertyTools, Version=2012.4.14.1

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

[System Info]

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

Machine
-SERVICE-PC
--Manufacturer = System76, Inc.                     
--Model = Bonobo Extreme      
--TotalPhysicalMemory = 34317299712
--UserName = SERVICE-PC\Admin

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

Have you altered Account Transaction Types or Documents?

I recently messed around with Inventory warehouse/transaction/document types, as well as recipes and inventory items.

Since my original post, I have discovered that the problem seems to be related to a single ticket. I gifted the only order on that ticket to my self. The day before I had created a recipe for that particular order item. But I deleted that recipe that same day.

If I go to the Tickets screen, and open the ticket in question, everything is fine until I select the order and try to cancel it. Then I get the error below. I don’t mind to delete relevant records in the DB for this ticket. But I don’t really want to take the time to figure out what the structure of the DB is–if someone could just tell me what to delete and with what criteria. That solution would be fine for me.

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

Application: SambaPOS
Version:     4.1.55
Region:      en
DB:          SQ
Machine:     SERVICE-PC
User:        Admin
Date:        12/20/2014
Time:        4:48 PM

User Explanation:

Admin said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.InvalidOperationException
Message:     Sequence contains no matching element
Source:      System.Core
Stack Trace: at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Samba.Domain.Models.Tickets.Ticket.Recalculate()
   at Samba.Presentation.Services.Implementations.TicketModule.TicketService.RecalculateTicket(Ticket ticket)
   at Samba.Modules.PosModule.TicketViewModel.ClearSelectedItems()
   at Samba.Modules.PosModule.TicketViewModel.OnCancelItemCommand(String obj)
   at Microsoft.Practices.Prism.Commands.DelegateCommand`1.<>c__DisplayClass6.<.ctor>b__2(Object o)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Primitives.ToggleButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(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()

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

[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.5.0
DevExpress.Xpf.Grid.v14.1.Core, Version=14.1.5.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
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
DevExpress.Xpf.Core.v14.1, Version=14.1.5.0
PropertyTools, Version=2012.4.14.1

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

[System Info]

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

Machine
-SERVICE-PC
--Manufacturer = System76, Inc.                     
--Model = Bonobo Extreme      
--TotalPhysicalMemory = 34317299712
--UserName = SERVICE-PC\Admin

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

Are you familiar with the SQL Management Studio? Here is a start. This shows the tickets and Account Documents. You would also need the relative inventory tables. The DB Structure is very simple and easy to follow.

There is also a way to just wipe all transactions. Are you live now?

So, if I delete these three records that should remove the Ticket from the DB?

Last week I only deleted the record from the first two tables. The report would then print but all of the values were zero.

This error relates with incorrectly configured calculation types. You need to create an individual account transaction type for all calculation types so check all your calculation types to ensure none of them set to use same account transaction type.

Finding related account transaction document for that ticket and correcting duplicate calculation will solve that issue.

Also please update your SambaPOS as new versions have better validation support for such configuration issues.

Edit: Your second error report seems to relate with tax configuration. Please also check that configuration too. To fix that error you can find related account transaction document and add tax transaction manually.

1 Like

Thanks for the help guys.

So it appears what happened is that a particular Account Transaction Document contained two discount Calculation lines. This was unrelated to what I thought may have been the problem in my earlier posts.