Guys I really need this fixed

I know I have a broken database, but I need a solution, a quick one…

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

Application: SambaPOS
Version:     4.1.82
Region:      en
DB:          SQ
Machine:     CUISINACLIENT
User:        Cuisina
Date:        8/17/2015
Time:        1:22 PM

User Explanation:

Cuisina 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.Services.Implementations.CacheService.GetCurrencySymbol(Int32 currencyId)
   at Samba.Services.Implementations.AccountModule.AccountRowBuilder.<>c__DisplayClass12.<GetAccountScreenRows>b__2(KeyValuePair`2 x)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Samba.Services.Implementations.AccountModule.AccountRowBuilder.GetAccountScreenRows(AccountScreen accountScreen, WorkPeriod currentWorkPeriod)
   at Samba.Services.Implementations.AccountModule.AccountService.GetAccountScreenRows(AccountScreen accountScreen, WorkPeriod currentWorkPeriod)
   at Samba.Modules.AccountModule.AccountSelectorViewModel.UpdateAccountScreen(AccountScreen accountScreen)
   at Samba.Modules.AccountModule.AccountSelectorViewModel.Refresh()
   at Samba.Modules.AccountModule.AccountModule.OnNavigate(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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, 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.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.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 10 Pro
--CodeSet = 1252
--CSDVersion = 
--CurrentTimeZone = 240
--FreePhysicalMemory = 1835864
--OSArchitecture = 64-bit
--OSLanguage = 1033
--ServicePackMajorVersion = 0
--ServicePackMinorVersion = 0
--Version = 10.0.10240

Machine
-CUISINACLIENT
--Manufacturer = Hewlett-Packard
--Model = HP Compaq 8200 Elite SFF PC
--TotalPhysicalMemory = 4177526784
--UserName = CuisinaClient\Cuisina

I know fixing this will be dangerous to the security of my system, but I need to use my accounts panel, leaving it like this is not a solution, neither going through 2500+ transactions one by one… Whatever it takes

I’m not sure how fixing a configuration mistake would be a security risk. It looks like you may have a mistake with a currency. Can you explain what you did when this error came up.

I used a new currency on a transaction, then deleted the currency, then starting getting an error opening accounts screen and making a new transaction for this particular customer.
Deleting the customer account didn’t help, the transaction is messed up I guess.

Remake the currency. You shouldn’t delete currencies after making transactions.

1 Like

How can I know what was the currency?

Easy way is to just remember it. Or you can look for the transaction in the database.

Only you will know the answer to this question.

Start with this… open SSMS (SQL Server Management Studio), select the SambaPOS DB, then click New Query. Paste this in and click Execute (or hit F5):

SELECT [Id]
      ,[AccountTransactionDocumentId]
      ,[Amount]
      ,[ExchangeRate]
      ,[AccountTransactionTypeId]
      ,[SourceAccountTypeId]
      ,[TargetAccountTypeId]
      ,[IsReversed]
      ,[Reversable]
      ,[Name]
  FROM [AccountTransactions]
  where [ExchangeRate] != 1

This should show transactions that used a different currency. Let us know your results, or paste a portion of those results here.

1 Like

It’s blank… I can trust you on the database if you want to see what’s wrong with it, any other way? or any other error explanation?

How did you delete the currency?

Simply click on it then Delete it… I’m not sure it’s the currency error anymore…

You might have renamed it if you followed previous advice from a similar issue you had a month or so ago. Is this the same issue?

Yeah I just left it for a while because I wasn’t using customer accounts

What if that currency had the rate of 1? that code will not work… any other way?

There is no point in defining a Foreign Currency with a rate of 1.

What does this return:

SELECT [Id]
      ,[AccountTypeId]
      ,[ForeignCurrencyId]
      ,[Name]
  FROM [Accounts]
  WHERE [ForeignCurrencyId] != 0

and how about this:

SELECT [Id]
      ,[AccountTransactionId]
      ,[AccountTransactionDocumentId]
      ,[AccountTypeId]
      ,[AccountId]
      ,[Date]
      ,[Debit]
      ,[Credit]
      ,[Exchange]
      ,[AccountTransactionTypeId]
      ,[Name]
  FROM [dbo].[AccountTransactionValues]
WHERE ([Debit] != 0 and [Debit] != [Exchange])
   or ([Credit] != 0 and [Credit] != [Exchange]*-1)

I love you. <3 first one worked, I just changed the currencyId and tada! :smiley:

@Jesse V4 allows deleting Foreign Currencies even they’ve used. I’ve fixed it on V5.

2 Likes

Yey! :smiley: cheers!