@QMcKay wrote:
Synopsis
This Tool is primarily used as a Bulk Product, Inventory, and Recipe importer based on data read from a CSV file.
As of this release, this Tool is compatible with the following SambaPOS versions:
5.1.50 - 5.1.59 (DB version 124) ::: dbops51x.zip (10.0 KB)
Originally developed by @JohnS for SambaPOS 3, updates to the Tool were developed by @QMcKay for compatibility with SambaPOS 4, and finally SambaPOS 5.
A few more minor "tools" are included for performing other DB operations, and there are 4 "OPS" or "operations" that you can choose from:
IMPORT Products
Imports Products, Menu Items, Inventory from CSV file.READ Products
Reads Products, Menu Items, Inventory from Database.DELETE Products
DELETES Products, Menu Items, Inventory from Database.DELETE Transactions
DELETES all Transactions (i.e. Sales) from Database.
Requirements
SQL Express Server 2008, 2012, or 2014
WampServer 2.5 (only used to run PHP script).
NOTE: If you already have a working PHP installation, you do not need to get or install WAMP.
Installation Notes
Always backup your Database files before using this Tool.
The Tool is designed for SQL Express databases only and for people who are familiar with using SQL and know how to back up their database.
Best performed on the same computer as the SQL Express Database
WARNING: If you do not understand any of the instructions then DO NOT USE THIS TOOL
Setup
Download and install WampServer 2.5 using default settings (not necessary if you already have a working PHP setup)
Unzip
dbops5xxx.zip
and place files from 'dbops
' folder intoc:\wamp\www
You will need to edit the
dbops.php
file inc:\wamp\www
to set your specific details, such as DB connection parameters.// the driver version depends on your SQL installation // SQL Express 2012 is v10 // SQL Express 2014 is v11 //$driver = "{SQL Server Native Client 10.0}"; $driver = "{SQL Server Native Client 11.0}"; // SQL Express Server Details - Set to your details from your connection string // example: data source = localhost\SSQLEXPRESS; user id=sa; password=sambapos; database=import $myServer = "localhost\SQLEXPRESS"; $myUser = "sa"; $myPass = "sambapos"; $myDB = "import"; // file containing Product Data $myImportFile = "import.csv"; // Timezone - http://php.net/manual/en/timezones.php date_default_timezone_set('Canada/Saskatchewan');
- You can also modify the "defaults" for the way the Menu Categories and Menu Item Buttons will appear. This is documented in the
dbops.php
file as well:// Menu Defaults // Colours can be by Name or by RGB Code (#AAFF00) - http://colorschemedesigner.com/ $DefaultCategoryButtonColour = "Orange"; $DefaultMenuItemButtonColour = "Green"; $CategoryButtonHeight = "45"; $SubCategoryButtonHeight = "45"; $MenuItemButonHeight = "45"; $DefaultColumnCount = "2"; $DefaultNumberPad = "1"; // 2-Large, 1-Small, 0-None $MenuButtonLength = 32; // Creates automatic Product Name wrapping on Menu Button
Using the Tool
If starting with a blank database, the Tool will attempt to start a Workperiod and create a Menu definition. If the Tool is unable to do this, it will terminate. You can manually Start a Work Period and define at least one Menu, and try again.
Products will be added to the
Menu
you specify under the CreateMenu column in theimport.csv
file.Edit
import.csv
inc:\wamp\www
and update with your products and save. NOTE: Do NOT change the order of the Columns.open a Browser and navigate to: http://localhost/dbops.php
CSV Column explanation
- CreateMenu : (text) -
YourMenuName
orN
- Create a Menu Item Button for this Product. If you list the Menu Name here, the product is added to that Menu.- CreateInventory : (text) -
Y
orN
- Create an Inventory Item & Recipe for this Product and import stock levels- GroupCode : (text) - Product Group Code, Inventory Group Code and Menu Category
- SubGroupCode : (text) - Menu Sub Category
- Barcode : (text) - Product Barcode
- ProductName : (text) - Product Name
- MenuName : (text) - Menu Item Name - If blank
ProductName
is used- InventoryName : (text) - Inventory Item Name - If blank
ProductName
is used- PortionName : (text) - Product Price Portion Name - if blank
Normal
is used- PortionMultiplier : (number) - Product Portion Price Multiplier - if blank
1
is used- SellPrice : (number) - Product Portion Price
- BaseUnit : (text) - Inventory Base Unit - if blank
Ea
is used- TransactionUnit : (text) - Inventory Transaction Unit - if blank
Ea
is used- TransactionMultiplier : - Number - Inventory Transaction Multiplier - if blank
1
is used- RecipeQty : (number) - Inventory Item Quantity per Recipe - if blank
1
is used- InventoryQty : (number) - Starting Inventory Level
- CostPrice : (number) - Inventory Item Cost Price
- Warehouse : (text) - The Warehouse the Inventory Item is added to
- CategoryButtonColour : (text) - Menu Category Button Colour - if blank
Orange
is used- MenuItemButtonColour : (text) - Menu Item Button Colour - if blank
Green
is used
Version History
******************************************************** v5.1.x (2016-05-16) QMcKay - first official version to support SambaPOS 5 - supports changes in DB up to SambaPOS 5.1.59 - Import Products and Read Products modules output much more information - ExecQueryP function added to handle prepared SQL statements - ExecQuery function removed - changed all Queries to use Prepared Statements - allows for things like single-quotes or other special characters in the CSV data - changed versioning scheme of tool to be 5.x.x - indicates this tool only tested to work with same SambaPOS version ********************************************************
Posts: 3
Participants: 2