URGENT Error / corrupt data

Hi,

Using SambaPOS v4.1.82 with MSSQL Server 2012 DB. This morning when launching SambaPOS it couldn’t connect to DB. On investigation, the database had went into Suspect mode. I managed to repair the DB using [this method][1], which put the DB back online and SambaPOS would start. Everything seemed ok, until going into the reports - the work period and item sales reports are throwing an error message when I select either today or yesterday’s work period. Previous work periods work fine, and if I close and start a new work period, that one is also working fine.

Unfortunately last backup was on 10th August.

My main concerns is I appear to have lost data, but also possibly something else could be corrupt in this DB which may cause future problems Going back to 10th August isn’t idea, the business is busy and also using inventory, 100% relying on SambaPOS for reporting. Definitely backups should have been done, but I need help with the situation at hand.

Error message:

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

Application: SambaPOS
Version:     4.1.82
Region:      en
DB:          SQ
Machine:     MARK-PC
User:        Mark
Date:        19/08/2015
Time:        13:07

User Explanation:

Mark said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.NullReferenceException
Message:     Object reference not set to an instance of an object.
Source:      Samba.Domain
Stack Trace: at Samba.Domain.Models.Tickets.Calculation.UpdateCalculationTransaction(AccountTransactionDocument document, Decimal amount, Decimal exchangeRate, IEnumerable`1 accountDataList)
   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.<RefreshReport>b__2()

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

[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 8.1 Pro
--CodeSet = 1252
--CSDVersion = 
--CurrentTimeZone = 480
--FreePhysicalMemory = 2288640
--OSArchitecture = 64-bit
--OSLanguage = 2057
--ServicePackMajorVersion = 0
--ServicePackMinorVersion = 0
--Version = 6.3.9600

Machine
-MARK-PC
--Manufacturer = Gigabyte Technology Co., Ltd.
--Model = To be filled by O.E.M.
--TotalPhysicalMemory = 8478597120
--UserName = Mark-PC\MARK-PC\Mark

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

If @emre or someone else wants to have a look at the DB, I can send a copy but cannot make public.

Really appreciate any help as I am not sure what else to do or if the business should continue using that DB.

Thanks ! :smiley:
[1]: https://support.managed.com/kb/a398/how-to-repair-a-suspect-database-in-mssql.aspx

@markjw I’m sorry to hear that. PM me the backup.

I found some missing transaction documents. Run this SQL script to regenerate them. I hope it is a lucky day for you and it helps.

SET IDENTITY_INSERT AccountTransactionDocuments ON
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45145,0,'20150818','Ticket Transaction Fix [16105]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45146,0,'20150818','Ticket Transaction Fix [16107]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45147,0,'20150818','Ticket Transaction Fix [16106]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45148,0,'20150818','Ticket Transaction Fix [16108]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45149,0,'20150818','Ticket Transaction Fix [16109]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45150,0,'20150818','Ticket Transaction Fix [16110]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45151,0,'20150818','Ticket Transaction Fix [16111]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45152,0,'20150818','Ticket Transaction Fix [16112]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45153,0,'20150818','Ticket Transaction Fix [16113]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45154,0,'20150818','Ticket Transaction Fix [16114]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45155,0,'20150818','Ticket Transaction Fix [16115]')
go
INSERT INTO AccountTransactionDocuments (Id,DocumentTypeId,[Date],Name) VALUES (45156,0,'20150818','Ticket Transaction Fix [16116]')
go
SET IDENTITY_INSERT AccountTransactionDocuments OFF
go
3 Likes

Use Database backup module and set it to backup on WP close. You can also automate hourly backups. This way you don’t have to remember to backup.

Hope Emre fix works for you.

2 Likes

Thanks @emre that appears to have worked! :smile:

I just want to say the support you provide to your users is far better than I have had from companies where I have paid for a product. Your fast response and help with a specific issue is really very appreciated. :smiley: It’s been a really good choice we decided to invest our time and effort into using SambaPOS!

1 Like

Yeah, I will be upgrading this installation to V5 in next day or so then will enable that feature.

Be sure to follow my tutorial in the welcome message of beta. It shows you how to create a new database and copy your current one into it using database backup module.

1 Like