SambaPOS Forum

English Boards => Tutorials => Topic started by: fabos on November 27, 2011, 02:09:08 am

Title: Configuration backup
Post by: fabos on November 27, 2011, 02:09:08 am
hi,

I've created restaurant menus, inserted items, inventory, departments and recipes and make a lot of tests.
the problem now is that I nees to start up a fresh installation with all the configuration made but without the testing data of ticket and bills 

How can I copy only the configuration data to a fresh installation? how can I make separated backups of configuration and data?


thanks for your support

fabio
Title: Re: Configuration backup
Post by: emre on November 28, 2011, 09:54:26 am
Hello fabos.
If you didn't take a backup before adding test data you won't be able to rollback to the previous state.
Backing up or clearing transaction data is not supported in current release.

If you are familiar with SQL databases you can try clearing transaction tables (Tickets,TicketItems,Payments) manually with SQL Management Studio.
Title: Re: Configuration backup
Post by: balitaly on December 07, 2011, 10:23:56 am
hi to all,
i've the same problem, during the settings i've made many simulations of bills and purchase ingredients. now if i want start to use the software in my restaurant how can i have a clean version without lose all the settings? i could instal again the software, but make again all the settings is a very long process and also i can not remind all the settings that i did before.... i tried also to clean the data base with sql management studio, but i can not open the file.... any suggestion?
Title: Re: Configuration backup
Post by: emre on December 08, 2011, 11:05:40 am
Hello balitaly,
Normally we create backups before entering trial data and restore it before real usage.

I attached a SQL Script for you to clear all transaction data from database. If you run this script it will keep your settings but clear all tickets, work periods etc.

USE IT AT YOUR OWN RISK...
Take your backups before running this script. It will not generate backups. It will clear data without confirmation.

For SQL Server Express you can easily create backups and execute it with SQL Management Console.

If you are using SQL Compact Edition (CE) you can download a handy Management Tool from http://sqlcetoolbox.codeplex.com/ (http://sqlcetoolbox.codeplex.com/) website.

The SQL CE database file stored under MyDocuments\SambaPOS2 folder. Create a copy of SambaData2.sdf file to create a backup

After running SQL CE Toolbox application:

For security reasons we didn't implemented that feature inside sambapos application but we'll implement "Training Mode" on further releases so you'll be able to enable training mode when needed.
Title: Re: Configuration backup
Post by: JohnS on January 28, 2012, 10:58:19 pm
Emre,

Would it be possible to setup a training mode by

- Set an option in Local Settings to Copy Live Database to Training Database - with an 'Are You Sure' prompt.
- Setting a Live/Training toggle on the login screen
- When Training is selected, the Local Settings get changed to the Training Database settings.
- You login with your pin number and use the system as normal - Training Mode is either watermarked across the screen or at the top/bottom of the screen.
- When you log out, and select Live, the system changes Local Settings back to the Live database.

This means that you overwrite the Training Database as required, not automatically. Gives better control for experiments and customization. Also means that this would be a terminal by terminal setting, so you would not impact other uses on a production system while testing.
Title: Re: Configuration backup
Post by: jenem on January 29, 2012, 01:50:36 am
Hi John,

Good idea!!

Edgar
Title: Re: Configuration backup
Post by: emre on January 29, 2012, 09:01:46 am
I liked the local training idea. It will be fine for training new users on a production environment with real data. My idea was starting a "Training Work Period" from management and reverting everything back when that work period ends. What do you think about that?
Title: Re: Configuration backup
Post by: jenem on January 29, 2012, 09:41:40 am
Hi Emre,

Could a default user called trainer be created that once logged in worked on a read only copy of the data base and not the actual one?

ie real database
 training data base copy

That way the copy database would show everything that is on the main database but not write ticket or stock values to original data base

Just a thought  :)

Edgar

Title: Re: Configuration backup
Post by: JohnS on January 29, 2012, 02:24:07 pm
"Training Work Period"

I like that. But can you keep stock consumption, and tickets info separate from the live data? Wouldn't all users then be in training mode if using "Training Work Period" since you can only have one work period running?

Duplicating the database gives you full run of all data to experiment with, not only for training but development of promos, and other features. Having a single terminal logging into training mode means you can train during working hours.
Title: Re: Configuration backup
Post by: chrismint on January 29, 2012, 03:24:59 pm
Hi,

From a usability point of view either a training user that would allow you to play around without affecting trading figures, or a toggle to put a terminal in training mode temporarily would be best.

I think as there are two situations were you'd need this - training new staff and testing a system - the best solution would be as follows.
- an option to set a particular user as a training user, in which case anything they do doesn't get logged on final sales stats and any print outs are highlighted as being training only.  This would allow you to train new servers without affecting sales figures
- an option to set a terminal as being a dummy terminal.  Ideally this would allow you to test everything including opening and closing periods.  Again without affecting sales figures.  Maybe just adding a flag to each entry whilst in this mode and an option to delete any entries flagged with this?

Chris
Title: Re: Configuration backup
Post by: emre on January 30, 2012, 04:25:14 am
Hi,

From a usability point of view either a training user that would allow you to play around without affecting trading figures, or a toggle to put a terminal in training mode temporarily would be best.

I think as there are two situations were you'd need this - training new staff and testing a system - the best solution would be as follows.
- an option to set a particular user as a training user, in which case anything they do doesn't get logged on final sales stats and any print outs are highlighted as being training only.  This would allow you to train new servers without affecting sales figures
- an option to set a terminal as being a dummy terminal.  Ideally this would allow you to test everything including opening and closing periods.  Again without affecting sales figures.  Maybe just adding a flag to each entry whilst in this mode and an option to delete any entries flagged with this?

Chris

I agree doing it locally is a great benefit. So the best solution seems doing it like John suggested. I noted that. I have to think about if we'll need enabling it for the entire network.
Title: Re: Configuration backup
Post by: JohnS on January 30, 2012, 06:25:24 am
Quick update.

I have created two batch scripts to replicate the live database to a training database, and enable and disable 'Training Mode'

Replicatedb.bat - copies the SambaPOS SQL files to a new SQL Instance called SambaPOSTrain
Sambatrain.bat - changes the SQL database settings in SambaSettings.txt to SambaPOSTrain and runs SambaPOS. When you exit, the script changes SambaSettings.txt back to SambaPOS live database.

Its means now you have three icons as follows

1. SambaPOS Production (normal SambaPOS)
2. Replicate Production Database to Training Database
3. SambaPOS Training

This is easy when its all on the same machine. I haven't tried it yet with a network server, but I can't see any reason why it will not work.

This way you can train a user on an exact copy of the live database without interrupting any other users, without any impact to the Live data, and with all restrictions (User Roles) in place for that user.


Emre,

Firstly I am not a MSSQL DB expert, but I do know MYSQL, so here's my suggestion for a solution from your side.

With SQL Express, the Table Data is located in Databases/SambaData2/Schemas/dbo/Tables.
Could we create create another 'Tables' group under 'dbo' and call it 'Tables2'. Then under Local Settings in Manage have another tab for 'Training DB' with the option to replicate the data from 'Tables' to 'Tables2' (Live to Training) to update the training database with the latest live data.
Then on the login screen have a 'Training Mode Toggle' that when a user selects training and logs in it uses the 'Tables2' data.
When finished training, Log out and log back in for the live system.

Could that work? Because we are not changing databases like my example above, it should be seamless, fast and almost fool proof.
It allows for a single terminal to be in training mode while the other terminals are trading, and it allows testing of configuration changes before you make the changes to the live system.
Title: Re: Configuration backup
Post by: emre on January 30, 2012, 12:50:23 pm
John AFAIK with SQL server we can't add another tables group. I can think three options. We can create additional database, a new schema or duplicate all tables with a prefixed name. 

In fact I have a problem with directly modifying SQL databases. On SambaPOS all tables are auto generated and I really don't know what tables we have or any detail about them. I have to do it without knowing it because on further releases I want to support more databases or different kinds of data transferring solutions. For this reason I need a solution that will work with any database. I'll try to find a solution for duplicating data to a local SDF file. I can't remember if we talked about it or not but I have plans about hosted online database solutions. We'll need something similar there but it will work in reverse direction :)
Title: Re: Configuration backup
Post by: JohnS on January 30, 2012, 09:47:44 pm
Ok, while you investigate what options may be available from a coding point, I will document how to create a training mode setup for MSSQL using batch files to manipulate the databases.

Is there an easy way to add command line options to SambaPOS ? For example add a '/t' to tell SambaPOS that this is a training session and it displays 'Training' at the top of the screen.
Or better still '/t [terminal name]' to assign a terminal name like 'Restaurant Bar' to the top of the POS screen? Have it read the terminal name from settings and if we don't define a name when launching SambaPOS then it displays the terminal name.


Title: Re: Configuration backup
Post by: JohnS on January 31, 2012, 06:16:24 am
Drum roll please.........

Welcome to SambaTrain.

This has been moved to its own post in the forum.
http://forum2.sambapos.org/index.php/topic,184.0.html (http://forum2.sambapos.org/index.php/topic,184.0.html)

What I have created is a tool to enable a Training Mode on SambaPOS.
What the tool actually does is to copy the SambaPOS Microsoft SQL Express 2005/2008 Server instance to a Microsoft Compact SQL Server database file, and change the SambaPOS data source settings automatically with the click of a single icon and once you exit SambaPOS, the data source settings are returned to the live settings.

You only need to edit two files to set your SQL Express Server name and SambaPOS database instance name (and User Id & Password if required) which you can get from SambaPOS -> Manage - > Local Settings -> Data Connection String. ie, localhost\SQLEXPRESS

You can have the database refresh each time you run Training Mode, or to refresh on-demand if you are developing new features, or expanding the POS system.


Consult the Read Me file for more info.
Title: Re: Configuration backup
Post by: emre on January 31, 2012, 06:43:09 am
Ta taam... Great job John!!!
Our support team will love this. I have to translate it to Turkish asap.
Title: Re: Configuration backup
Post by: jenem on January 31, 2012, 09:09:06 am
Hi John,

Great Job !!

Can I ask is it only for a networked database or can you use it for training on a local MSQL database?

Edgar
Title: Re: Configuration backup
Post by: JohnS on January 31, 2012, 09:44:53 am
Edgar,

The script is setup for a local MSSQL database. If you need to connect to a remote database you will need to edit the MigrateDB.bat file and replace the following line

Export2sqlce "Data Source=%mssql%;Initial Catalog=SambaData2;Integrated Security=True" SambaData2.sqlce
with
Export2sqlce "Data Source=%mssql%;Initial Catalog=SambaData2;Integrated Security=False;User Id=sa;Password=sambapos;" SambaData2.sqlce

Making sure you enter the MSSQL User Id & Password you set when installing the MSSQL Instance.

Then you need to edit the SambaTrain.bat file and add the User Id & Password to the MSSQL connection string.

set mssql=D620-PC\SAMBAPOS; user id=sa; password=sambapos;


If you are running a domain controller or if all your PC's (including the MSSQL Server) have the same logins, and passwords, then you shouldn't have to change any of this. But then again it is MSSQL  ::)

** Just updated the files to reflect these notes **
Title: Re: Configuration backup
Post by: JohnS on January 31, 2012, 10:20:12 am
Is there an easy way to add command line options to SambaPOS ? For example add a '/t' to tell SambaPOS that this is a training session and it displays 'Training' at the top of the screen.
Or better still '/t [terminal name]' to assign a terminal name like 'Restaurant Bar' to the top of the POS screen? Have it read the terminal name from settings and if we don't define a name when launching SambaPOS then it displays the terminal name.

OK Emre, now its your turn.

I would really like to see the above idea in action.
Title: Re: Configuration backup
Post by: emre on January 31, 2012, 02:24:15 pm
So what will you think about implementing an action for updating the title text? We can use it for different purposes...

I can add an additional feature to "Application Started" rule for testing command line parameters.

Maybe at a later time we can implement "start process" action for starting bat files, or executing scripts.

I don't know where we are going to :)
Title: Re: Configuration backup
Post by: JohnS on January 31, 2012, 03:36:46 pm
If we can update the title text and read the command line parameters, then I think it gives us many possibilities in the future. And right now it would give us a Training Mode Warning prompt/notification to visually identify a terminal mode.

Quote
I don't know where we are going to :)
But getting there is the fun part. Its all the little ideas, 'what ifs' that make it interesting and lead to unexpected new features.
Title: Re: Configuration backup
Post by: emre on February 09, 2012, 01:33:00 pm
So what will you think about implementing an action for updating the title text? We can use it for different purposes...

I can add an additional feature to "Application Started" rule for testing command line parameters.


I forgot to mention this is also implemented on 2.86. We can test the existence of /training switch on Application Started event and execute Update Sub Title action.
Title: Re: Configuration backup
Post by: joe on June 11, 2012, 05:04:06 pm
Hello balitaly,
Normally we create backups before entering trial data and restore it before real usage.

I attached a SQL Script for you to clear all transaction data from database. If you run this script it will keep your settings but clear all tickets, work periods etc.

USE IT AT YOUR OWN RISK...
Take your backups before running this script. It will not generate backups. It will clear data without confirmation.


For SQL Server Express you can easily create backups and execute it with SQL Management Console.

If you are using SQL Compact Edition (CE) you can download a handy Management Tool from http://sqlcetoolbox.codeplex.com/ (http://sqlcetoolbox.codeplex.com/) website.

The SQL CE database file stored under MyDocuments\SambaPOS2 folder. Create a copy of SambaData2.sdf file to create a backup

After running SQL CE Toolbox application:
  • Right click on "No SQL Connections found .... etc" title on the right and click "Add .. Connection" (First item). A popup window will appear.
  • Click [Browse] button, locate SambaData2.sdf file.
  • Click [Close] button at the bottom of the screen.
  • Popup window should disappear and you should see your database file listed under connections list.
  • Right click on the file name and click "Open SQL Editor". This will display an editor screen on the right.
  • Click "Open" from toolbar and locate script file (dtran.sqlce).
  • Click Execute...

For security reasons we didn't implemented that feature inside sambapos application but we'll implement "Training Mode" on further releases so you'll be able to enable training mode when needed.


hi there, im reading over and over again but still dont understand....
i had already backup the SambaData2.sdf  file....
but i dont know what it mean "After running SQL CE Toolbox application"
where to find this application?