Database Error regarding redundant data in the table

Dear Mr. Emre,
I would like to first thank you for the wonderful software you have developed and offered as freeware,
My name is Mehran, I am currently using your software in Broadway Cafe and Bistro. we are using sambapos v.4 along with an independent ms sql software. we have set up a wifi network with multiple stations for the waiters. Now we are having a database error, and I have no idea how to solve it. the scenario is as follows: a waiter inserts a discount from the saloon station, and the cashier insert another discount for the same ticket from the cashier station. as a result, there is a redundant information in some tables in the sql server which creates a serious error, preventing us from closing that specific table, and consequently we cannot close the work time period and also reach reports in daily report section. each time we try to close that table, Sambapos shuts down with an error message. we don’t know how to erase this redundant data from the tables.
I would be really grateful if you can do sth about this, maybe compose a string code to erase this data or fix this somehow. I am pasting the details of the error message here and also will post the problem to the forums.

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

Application: SambaPOS
Version:     4.1.54
Region:      en
DB:          SQ
Machine:     BROADWAY-SERVER
User:        Broadway
Date:        12/1/2014
Time:        6:11 PM

User Explanation:

Broadway 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 Ultimate
--CodeSet = 1252
--CSDVersion = Service Pack 1
--CurrentTimeZone = 120
--FreePhysicalMemory = 2685944
--OSArchitecture = 64-bit
--OSLanguage = 1033
--ServicePackMajorVersion = 1
--ServicePackMinorVersion = 0
--Version = 6.1.7601

Machine
-BROADWAY-SERVER
--Manufacturer = System manufacturer
--Model = System Product Name
--TotalPhysicalMemory = 4024557568
--UserName = Broadway-Server\Broadway

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

Thank you very much for your concern and attention.

Can you give some details about how did you configured it? Normally there can be only one discount if no additional calculation types configured.

dear Mr. Emre,
we have a server which is also our cashier computer, on which we have sql server. I have configured sql to work with multiple connections simultaneously. we have another computer in the saloon, which is a client. and connects to the same sql server on cashier. there was a problem with message server, which caused it not to connect at times. so the waiter has entered a discount for a certain table using saloon computer. The cashier could not see that discount on her screen due to message server dis-connectivity most probably, and has entered discount again. this has lead to the crash of the system, because this discount thing has been entered twice.
now, we are unable to settle, or delete, or do anything else with that table. when we click on that table there is an error message that I sent to you and the system crashes.
if we could erase the data regarding that table or that particular ticket completely, it would be great. I can send a back up file of our server data if you are interested in replicating a problem. can you write a script to delete all data regarding a certain ticket possibly???
thanks for all your time and attention, dear sir.

OK. I understand the issue. All tickets generates a transaction document under Accounts > Transactions section. Find corresponding transaction document, remove one of the duplicated calculation transaction and correct other calculation (discount) amount manually. You’ll be able to close ticket after doing that. For next version I’ll improve validation code to handle that case.