From 2ce140f6d3e1dd453ce82b20a057ea65b5a6fd91 Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 19 Aug 2014 19:55:30 +0000 Subject: [PATCH] Added empty check in stock_locations config Rework database script (contains stock_locations + item_quantities tables) git-svn-id: svn+ssh://svn.code.sf.net/p/opensourcepos/code/@117 c3eb156b-1dc0-44e1-88ae-e38439141b53 --- ...{Item_quantitys.php => item_quantitys.php} | 0 application/models/stock_locations.php | 9 +- database/database.sql | 308 ++++++++---------- 3 files changed, 139 insertions(+), 178 deletions(-) rename application/models/{Item_quantitys.php => item_quantitys.php} (100%) diff --git a/application/models/Item_quantitys.php b/application/models/item_quantitys.php similarity index 100% rename from application/models/Item_quantitys.php rename to application/models/item_quantitys.php diff --git a/application/models/stock_locations.php b/application/models/stock_locations.php index 20e485b5a..4df2d8058 100644 --- a/application/models/stock_locations.php +++ b/application/models/stock_locations.php @@ -45,9 +45,12 @@ class Stock_locations extends CI_Model { array_push($location_ids,$db['location_id']); } - $this->db->where_in('location_id', $location_ids); - $this->db->update('stock_locations',array('deleted'=>1)); - $this->db->trans_complete(); + if (sizeof($location_ids) > 0) + { + $this->db->where_in('location_id', $location_ids); + $this->db->update('stock_locations',array('deleted'=>1)); + $this->db->trans_complete(); + } $location_db = $this->get_all()->result_array(); //Update the stock location diff --git a/database/database.sql b/database/database.sql index 5594c39a6..74c837f21 100644 --- a/database/database.sql +++ b/database/database.sql @@ -1,23 +1,14 @@ -- phpMyAdmin SQL Dump --- version 4.0.9 +-- version 3.3.9 -- http://www.phpmyadmin.net -- --- Host: 127.0.0.1 --- Generation Time: Jul 02, 2014 at 06:13 AM --- Server version: 5.5.34 --- PHP Version: 5.4.22 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +-- Host: localhost +-- Generation Time: Apr 08, 2011 at 04:27 PM +-- Server version: 5.1.54 +-- PHP Version: 5.3.3 -- --- Database: `ospos_stock_db` +-- Database: `pos` -- -- -------------------------------------------------------- @@ -26,7 +17,7 @@ SET time_zone = "+00:00"; -- Table structure for table `ospos_app_config` -- -CREATE TABLE IF NOT EXISTS `ospos_app_config` ( +CREATE TABLE `ospos_app_config` ( `key` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, PRIMARY KEY (`key`) @@ -39,28 +30,10 @@ CREATE TABLE IF NOT EXISTS `ospos_app_config` ( INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('address', '123 Nowhere street'), ('company', 'Open Source Point of Sale'), -('currency_side', '0'), -('currency_symbol', ''), -('custom10_name', ''), -('custom1_name', ''), -('custom2_name', ''), -('custom3_name', ''), -('custom4_name', ''), -('custom5_name', ''), -('custom6_name', ''), -('custom7_name', ''), -('custom8_name', ''), -('custom9_name', ''), -('default_tax_1_name', 'Sales Tax'), -('default_tax_1_rate', ''), -('default_tax_2_name', 'Sales Tax 2'), -('default_tax_2_rate', ''), ('default_tax_rate', '8'), ('email', 'admin@pappastech.com'), ('fax', ''), -('language', 'en'), ('phone', '555-555-5555'), -('print_after_sale', '0'), ('return_policy', 'Test'), ('stock_location', 'stockD,stockE,stockA'), ('timezone', 'America/New_York'), @@ -72,7 +45,7 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES -- Table structure for table `ospos_customers` -- -CREATE TABLE IF NOT EXISTS `ospos_customers` ( +CREATE TABLE `ospos_customers` ( `person_id` int(10) NOT NULL, `account_number` varchar(255) DEFAULT NULL, `taxable` int(1) NOT NULL DEFAULT '1', @@ -81,13 +54,18 @@ CREATE TABLE IF NOT EXISTS `ospos_customers` ( KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Dumping data for table `ospos_customers` +-- + + -- -------------------------------------------------------- -- -- Table structure for table `ospos_employees` -- -CREATE TABLE IF NOT EXISTS `ospos_employees` ( +CREATE TABLE `ospos_employees` ( `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `person_id` int(10) NOT NULL, @@ -109,15 +87,20 @@ INSERT INTO `ospos_employees` (`username`, `password`, `person_id`, `deleted`) V -- Table structure for table `ospos_giftcards` -- -CREATE TABLE IF NOT EXISTS `ospos_giftcards` ( +CREATE TABLE `ospos_giftcards` ( `giftcard_id` int(11) NOT NULL AUTO_INCREMENT, `giftcard_number` varchar(25) COLLATE utf8_unicode_ci NOT NULL, `value` decimal(15,2) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', - `person_id` int(11) NOT NULL, + `person_id` INT NOT NULL, PRIMARY KEY (`giftcard_id`), UNIQUE KEY `giftcard_number` (`giftcard_number`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=48 ; + +-- +-- Dumping data for table `ospos_giftcards` +-- + -- -------------------------------------------------------- @@ -125,43 +108,22 @@ CREATE TABLE IF NOT EXISTS `ospos_giftcards` ( -- Table structure for table `ospos_inventory` -- -CREATE TABLE IF NOT EXISTS `ospos_inventory` ( +CREATE TABLE `ospos_inventory` ( `trans_id` int(11) NOT NULL AUTO_INCREMENT, `trans_items` int(11) NOT NULL DEFAULT '0', `trans_user` int(11) NOT NULL DEFAULT '0', - `location_id` int(11) NOT NULL, `trans_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `trans_comment` text NOT NULL, `trans_inventory` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`trans_id`), KEY `ospos_inventory_ibfk_1` (`trans_items`), KEY `ospos_inventory_ibfk_2` (`trans_user`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=152 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `ospos_inventory` -- -INSERT INTO `ospos_inventory` (`trans_id`, `trans_items`, `trans_user`, `location_id`, `trans_date`, `trans_comment`, `trans_inventory`) VALUES -(133, 1, 1, 4, '2014-06-25 13:36:39', 'Manual Edit of Quantity', 0), -(134, 1, 1, 6, '2014-06-25 13:36:39', 'Manual Edit of Quantity', 0), -(135, 1, 1, 7, '2014-06-25 13:36:39', 'Manual Edit of Quantity', 0), -(136, 1, 1, 4, '2014-06-25 13:37:33', '', -3), -(137, 1, 1, 4, '2014-06-25 13:41:20', 'POS 24', -2), -(138, 1, 1, 4, '2014-07-01 04:42:02', 'Manual Edit of Quantity', 0), -(139, 1, 1, 6, '2014-07-01 04:42:02', 'Manual Edit of Quantity', 0), -(140, 1, 1, 7, '2014-07-01 04:42:02', 'Manual Edit of Quantity', 0), -(141, 1, 1, 4, '2014-07-01 05:58:00', 'Manual Edit of Quantity', 0), -(142, 1, 1, 6, '2014-07-01 05:58:00', 'Manual Edit of Quantity', 0), -(143, 1, 1, 7, '2014-07-01 05:58:01', 'Manual Edit of Quantity', 0), -(144, 13, 1, 4, '2014-07-01 17:08:41', 'Manual Edit of Quantity', 10), -(145, 13, 1, 6, '2014-07-01 17:08:41', 'Manual Edit of Quantity', 20), -(146, 13, 1, 7, '2014-07-01 17:08:41', 'Manual Edit of Quantity', 30), -(147, 15, 1, 4, '2014-07-01 17:09:00', 'Manual Edit of Quantity', 40), -(148, 15, 1, 6, '2014-07-01 17:09:00', 'Manual Edit of Quantity', 50), -(149, 15, 1, 7, '2014-07-01 17:09:00', 'Manual Edit of Quantity', 60), -(150, 13, 1, 6, '2014-07-01 17:10:02', 'POS 25', -1), -(151, 1, 1, 6, '2014-07-01 17:10:02', 'POS 25', -2); -- -------------------------------------------------------- @@ -169,7 +131,7 @@ INSERT INTO `ospos_inventory` (`trans_id`, `trans_items`, `trans_user`, `locatio -- Table structure for table `ospos_items` -- -CREATE TABLE IF NOT EXISTS `ospos_items` ( +CREATE TABLE `ospos_items` ( `name` varchar(255) NOT NULL, `category` varchar(255) NOT NULL, `supplier_id` int(11) DEFAULT NULL, @@ -185,35 +147,25 @@ CREATE TABLE IF NOT EXISTS `ospos_items` ( `is_serialized` tinyint(1) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', `stock_type` enum('sale_stock','warehouse') NOT NULL DEFAULT 'warehouse', - `custom1` varchar(25) NOT NULL, - `custom2` varchar(25) NOT NULL, - `custom3` varchar(25) NOT NULL, - `custom4` varchar(25) NOT NULL, - `custom5` varchar(25) NOT NULL, - `custom6` varchar(25) NOT NULL, - `custom7` varchar(25) NOT NULL, - `custom8` varchar(25) NOT NULL, - `custom9` varchar(25) NOT NULL, - `custom10` varchar(25) NOT NULL, + `custom1` VARCHAR(25) NOT NULL, + `custom2` VARCHAR(25) NOT NULL, + `custom3` VARCHAR(25) NOT NULL, + `custom4` VARCHAR(25) NOT NULL, + `custom5` VARCHAR(25) NOT NULL, + `custom6` VARCHAR(25) NOT NULL, + `custom7` VARCHAR(25) NOT NULL, + `custom8` VARCHAR(25) NOT NULL, + `custom9` VARCHAR(25) NOT NULL, + `custom10` VARCHAR(25) NOT NULL, PRIMARY KEY (`item_id`), - UNIQUE KEY `item_id` (`item_id`), - UNIQUE KEY `item_id_2` (`item_id`), - UNIQUE KEY `item_number_4` (`item_id`), + UNIQUE KEY `item_number` (`item_number`), KEY `ospos_items_ibfk_1` (`supplier_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `ospos_items` -- -INSERT INTO `ospos_items` (`name`, `category`, `supplier_id`, `item_number`, `description`, `cost_price`, `unit_price`, `reorder_level`, `location`, `item_id`, `allow_alt_description`, `is_serialized`, `deleted`, `stock_type`, `custom1`, `custom2`, `custom3`, `custom4`, `custom5`, `custom6`, `custom7`, `custom8`, `custom9`, `custom10`) VALUES -('Chang beer', 'Drinking', NULL, '01', '', 50.00, 55.00, 5.00, '', 1, 0, 0, 0, 'warehouse', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'), -('(Pack) Chang beer', 'Drinking', NULL, '02', '', 6000.00, 6500.00, 1.00, '', 2, 0, 0, 1, 'warehouse', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'), -('Chang beer', 'Drinking', NULL, '01', '', 50.00, 60.00, 1.00, '', 12, 0, 0, 1, 'sale_stock', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'), -('Sing Ha', 'Drinking', NULL, '04', '', 60.00, 65.00, 1.00, '', 13, 0, 0, 0, 'warehouse', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'), -('Tiger beer', 'Drinking', NULL, '05', '', 50.00, 55.00, 1.00, '', 14, 0, 0, 1, 'warehouse', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'), -('Tiger beer', 'Drinking', NULL, '05', '', 50.00, 55.00, 1.00, '', 15, 0, 0, 0, 'warehouse', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'), -('test', 'Drinking', NULL, '06', '', 100.00, 100.00, 2.00, '', 16, 0, 0, 0, 'warehouse', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); -- -------------------------------------------------------- @@ -221,32 +173,35 @@ INSERT INTO `ospos_items` (`name`, `category`, `supplier_id`, `item_number`, `de -- Table structure for table `ospos_items_taxes` -- -CREATE TABLE IF NOT EXISTS `ospos_items_taxes` ( +CREATE TABLE `ospos_items_taxes` ( `item_id` int(10) NOT NULL, `name` varchar(255) NOT NULL, `percent` decimal(15,2) NOT NULL, PRIMARY KEY (`item_id`,`name`,`percent`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Dumping data for table `ospos_items_taxes` +-- + + -- -------------------------------------------------------- -- -- Table structure for table `ospos_item_kits` -- -CREATE TABLE IF NOT EXISTS `ospos_item_kits` ( +CREATE TABLE `ospos_item_kits` ( `item_kit_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` varchar(255) NOT NULL, PRIMARY KEY (`item_kit_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `ospos_item_kits` -- -INSERT INTO `ospos_item_kits` (`item_kit_id`, `name`, `description`) VALUES -(1, '(Pack) Chang beer', '12 bottles of beer'); -- -------------------------------------------------------- @@ -254,7 +209,7 @@ INSERT INTO `ospos_item_kits` (`item_kit_id`, `name`, `description`) VALUES -- Table structure for table `ospos_item_kit_items` -- -CREATE TABLE IF NOT EXISTS `ospos_item_kit_items` ( +CREATE TABLE `ospos_item_kit_items` ( `item_kit_id` int(11) NOT NULL, `item_id` int(11) NOT NULL, `quantity` decimal(15,2) NOT NULL, @@ -266,13 +221,31 @@ CREATE TABLE IF NOT EXISTS `ospos_item_kit_items` ( -- Dumping data for table `ospos_item_kit_items` -- +<<<<<<< HEAD -- ------------------------------------------------------ +======= +-- -------------------------------------------------------- + +-- +-- Table structure for table `ospos_item_quantitys` +-- + +CREATE TABLE IF NOT EXISTS `ospos_item_quantitys` ( + `item_quantity_id` int(11) NOT NULL AUTO_INCREMENT, + `item_id` int(11) NOT NULL, + `location_id` int(11) NOT NULL, + `quantity` int(11) NOT NULL, + PRIMARY KEY (`item_quantity_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=69 ; + +-- -------------------------------------------------------- +>>>>>>> Added empty check in stock_locations config -- -- Table structure for table `ospos_modules` -- -CREATE TABLE IF NOT EXISTS `ospos_modules` ( +CREATE TABLE `ospos_modules` ( `name_lang_key` varchar(255) NOT NULL, `desc_lang_key` varchar(255) NOT NULL, `sort` int(10) NOT NULL, @@ -304,7 +277,7 @@ INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_i -- Table structure for table `ospos_people` -- -CREATE TABLE IF NOT EXISTS `ospos_people` ( +CREATE TABLE `ospos_people` ( `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, `phone_number` varchar(255) NOT NULL, @@ -333,7 +306,7 @@ INSERT INTO `ospos_people` (`first_name`, `last_name`, `phone_number`, `email`, -- Table structure for table `ospos_permissions` -- -CREATE TABLE IF NOT EXISTS `ospos_permissions` ( +CREATE TABLE `ospos_permissions` ( `module_id` varchar(255) NOT NULL, `person_id` int(10) NOT NULL, PRIMARY KEY (`module_id`,`person_id`), @@ -362,7 +335,7 @@ INSERT INTO `ospos_permissions` (`module_id`, `person_id`) VALUES -- Table structure for table `ospos_receivings` -- -CREATE TABLE IF NOT EXISTS `ospos_receivings` ( +CREATE TABLE `ospos_receivings` ( `receiving_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `supplier_id` int(10) DEFAULT NULL, `employee_id` int(10) NOT NULL DEFAULT '0', @@ -372,25 +345,12 @@ CREATE TABLE IF NOT EXISTS `ospos_receivings` ( PRIMARY KEY (`receiving_id`), KEY `supplier_id` (`supplier_id`), KEY `employee_id` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=15 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `ospos_receivings` -- -INSERT INTO `ospos_receivings` (`receiving_time`, `supplier_id`, `employee_id`, `comment`, `receiving_id`, `payment_type`) VALUES -('2014-06-17 17:09:02', NULL, 1, '', 1, 'Cash'), -('2014-06-17 17:10:40', NULL, 1, '', 2, 'Cash'), -('2014-06-22 09:57:57', NULL, 1, '', 3, 'Cash'), -('2014-06-22 09:59:54', NULL, 1, '', 4, 'Cash'), -('2014-06-22 11:20:34', NULL, 1, '', 7, 'Cash'), -('2014-06-22 11:22:28', NULL, 1, '', 8, 'Cash'), -('2014-06-22 11:24:33', NULL, 1, '', 9, 'Cash'), -('2014-06-23 17:18:55', NULL, 1, '', 10, 'Cash'), -('2014-06-23 17:19:52', NULL, 1, '', 11, 'Cash'), -('2014-06-23 17:23:01', NULL, 1, '', 12, 'Cash'), -('2014-06-23 17:26:49', NULL, 1, '', 13, 'Cash'), -('2014-06-23 17:27:31', NULL, 1, '', 14, 'Cash'); -- -------------------------------------------------------- @@ -398,7 +358,7 @@ INSERT INTO `ospos_receivings` (`receiving_time`, `supplier_id`, `employee_id`, -- Table structure for table `ospos_receivings_items` -- -CREATE TABLE IF NOT EXISTS `ospos_receivings_items` ( +CREATE TABLE `ospos_receivings_items` ( `receiving_id` int(10) NOT NULL DEFAULT '0', `item_id` int(10) NOT NULL DEFAULT '0', `description` varchar(30) DEFAULT NULL, @@ -416,6 +376,7 @@ CREATE TABLE IF NOT EXISTS `ospos_receivings_items` ( -- Dumping data for table `ospos_receivings_items` -- +<<<<<<< HEAD -- -------------------------------------------------------- @@ -445,6 +406,8 @@ INSERT INTO `ospos_requisitions_items` (`requisition_id`, `item_id`, `line`, `re (8, 2, 1, 1, 12, 12, 12), (9, 1, 1, 4, 12, 1, 4), (10, 1, 1, 1, 12, 1, 1); +======= +>>>>>>> Added empty check in stock_locations config -- -------------------------------------------------------- @@ -452,7 +415,7 @@ INSERT INTO `ospos_requisitions_items` (`requisition_id`, `item_id`, `line`, `re -- Table structure for table `ospos_sales` -- -CREATE TABLE IF NOT EXISTS `ospos_sales` ( +CREATE TABLE `ospos_sales` ( `sale_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `customer_id` int(10) DEFAULT NULL, `employee_id` int(10) NOT NULL DEFAULT '0', @@ -462,30 +425,12 @@ CREATE TABLE IF NOT EXISTS `ospos_sales` ( PRIMARY KEY (`sale_id`), KEY `customer_id` (`customer_id`), KEY `employee_id` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=26 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -- Dumping data for table `ospos_sales` -- -INSERT INTO `ospos_sales` (`sale_time`, `customer_id`, `employee_id`, `comment`, `sale_id`, `payment_type`) VALUES -('2014-06-22 06:18:43', NULL, 1, '0', 1, 'Cash: $480.00
'), -('2014-06-22 06:46:30', NULL, 1, '0', 2, 'Cash: $480.00
'), -('2014-06-22 06:54:07', NULL, 1, '0', 3, 'Cash: $480.00
'), -('2014-06-22 06:56:13', NULL, 1, '0', 4, 'Cash: $55.00
'), -('2014-06-22 13:21:14', NULL, 1, '0', 5, 'Cash: $480.00
'), -('2014-06-22 13:31:30', NULL, 1, '0', 6, 'Cash: $480.00
'), -('2014-06-22 14:05:37', NULL, 1, '0', 7, 'Cash: $480.00
'), -('2014-06-22 14:07:33', NULL, 1, '0', 8, 'Cash: $260.00
'), -('2014-06-23 03:57:39', NULL, 1, '0', 9, 'Cash: $285.00
'), -('2014-06-23 04:00:37', NULL, 1, '0', 10, 'Cash: $65.00
'), -('2014-06-23 04:04:30', NULL, 1, '0', 13, 'Cash: $55.00
'), -('2014-06-23 04:16:29', NULL, 1, '0', 14, 'Cash: -$55.00
'), -('2014-06-23 04:18:18', NULL, 1, '0', 15, 'Cash: $55.00
'), -('2014-06-23 05:34:09', NULL, 1, '0', 16, 'Cash: $55.00
'), -('2014-06-25 03:00:07', NULL, 1, '0', 23, 'Cash: $2750.00
'), -('2014-06-25 13:41:20', NULL, 1, '0', 24, 'Cash: $110.00
'), -('2014-07-01 17:10:02', NULL, 1, '0', 25, 'Cash: $175.00
'); -- -------------------------------------------------------- @@ -493,7 +438,7 @@ INSERT INTO `ospos_sales` (`sale_time`, `customer_id`, `employee_id`, `comment`, -- Table structure for table `ospos_sales_items` -- -CREATE TABLE IF NOT EXISTS `ospos_sales_items` ( +CREATE TABLE `ospos_sales_items` ( `sale_id` int(10) NOT NULL DEFAULT '0', `item_id` int(10) NOT NULL DEFAULT '0', `description` varchar(30) DEFAULT NULL, @@ -511,13 +456,17 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_items` ( -- Dumping data for table `ospos_sales_items` -- +<<<<<<< HEAD +======= + +>>>>>>> Added empty check in stock_locations config -- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_items_taxes` -- -CREATE TABLE IF NOT EXISTS `ospos_sales_items_taxes` ( +CREATE TABLE `ospos_sales_items_taxes` ( `sale_id` int(10) NOT NULL, `item_id` int(10) NOT NULL, `line` int(3) NOT NULL DEFAULT '0', @@ -527,13 +476,18 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_items_taxes` ( KEY `item_id` (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Dumping data for table `ospos_sales_items_taxes` +-- + + -- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_payments` -- -CREATE TABLE IF NOT EXISTS `ospos_sales_payments` ( +CREATE TABLE `ospos_sales_payments` ( `sale_id` int(10) NOT NULL, `payment_type` varchar(40) NOT NULL, `payment_amount` decimal(15,2) NOT NULL, @@ -544,24 +498,6 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_payments` ( -- Dumping data for table `ospos_sales_payments` -- -INSERT INTO `ospos_sales_payments` (`sale_id`, `payment_type`, `payment_amount`) VALUES -(1, 'Cash', '480.00'), -(2, 'Cash', '480.00'), -(3, 'Cash', '480.00'), -(4, 'Cash', '55.00'), -(5, 'Cash', '480.00'), -(6, 'Cash', '480.00'), -(7, 'Cash', '480.00'), -(8, 'Cash', '260.00'), -(9, 'Cash', '285.00'), -(10, 'Cash', '65.00'), -(13, 'Cash', '55.00'), -(14, 'Cash', '-55.00'), -(15, 'Cash', '55.00'), -(16, 'Cash', '55.00'), -(23, 'Cash', '2750.00'), -(24, 'Cash', '110.00'), -(25, 'Cash', '175.00'); -- -------------------------------------------------------- @@ -569,7 +505,7 @@ INSERT INTO `ospos_sales_payments` (`sale_id`, `payment_type`, `payment_amount`) -- Table structure for table `ospos_sales_suspended` -- -CREATE TABLE IF NOT EXISTS `ospos_sales_suspended` ( +CREATE TABLE `ospos_sales_suspended` ( `sale_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `customer_id` int(10) DEFAULT NULL, `employee_id` int(10) NOT NULL DEFAULT '0', @@ -581,13 +517,18 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_suspended` ( KEY `employee_id` (`employee_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +-- +-- Dumping data for table `ospos_sales_suspended` +-- + + -- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_suspended_items` -- -CREATE TABLE IF NOT EXISTS `ospos_sales_suspended_items` ( +CREATE TABLE `ospos_sales_suspended_items` ( `sale_id` int(10) NOT NULL DEFAULT '0', `item_id` int(10) NOT NULL DEFAULT '0', `description` varchar(30) DEFAULT NULL, @@ -601,13 +542,18 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_suspended_items` ( KEY `item_id` (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Dumping data for table `ospos_sales_suspended_items` +-- + + -- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_suspended_items_taxes` -- -CREATE TABLE IF NOT EXISTS `ospos_sales_suspended_items_taxes` ( +CREATE TABLE `ospos_sales_suspended_items_taxes` ( `sale_id` int(10) NOT NULL, `item_id` int(10) NOT NULL, `line` int(3) NOT NULL DEFAULT '0', @@ -617,26 +563,36 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_suspended_items_taxes` ( KEY `item_id` (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Dumping data for table `ospos_sales_suspended_items_taxes` +-- + + -- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_suspended_payments` -- -CREATE TABLE IF NOT EXISTS `ospos_sales_suspended_payments` ( +CREATE TABLE `ospos_sales_suspended_payments` ( `sale_id` int(10) NOT NULL, `payment_type` varchar(40) NOT NULL, `payment_amount` decimal(15,2) NOT NULL, PRIMARY KEY (`sale_id`,`payment_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Dumping data for table `ospos_sales_suspended_payments` +-- + + -- -------------------------------------------------------- -- -- Table structure for table `ospos_sessions` -- -CREATE TABLE IF NOT EXISTS `ospos_sessions` ( +CREATE TABLE `ospos_sessions` ( `session_id` varchar(40) NOT NULL DEFAULT '0', `ip_address` varchar(45) NOT NULL DEFAULT '0', `user_agent` varchar(120) NOT NULL, @@ -656,12 +612,16 @@ CREATE TABLE IF NOT EXISTS `ospos_sessions` ( -- Table structure for table `ospos_stock_locations` -- -CREATE TABLE IF NOT EXISTS `ospos_stock_locations` ( +CREATE TABLE `ospos_stock_locations` ( `location_id` int(11) NOT NULL AUTO_INCREMENT, `location_name` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`location_id`) +<<<<<<< HEAD ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; +======= +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8; +>>>>>>> Added empty check in stock_locations config -- -------------------------------------------------------- @@ -669,7 +629,7 @@ CREATE TABLE IF NOT EXISTS `ospos_stock_locations` ( -- Table structure for table `ospos_suppliers` -- -CREATE TABLE IF NOT EXISTS `ospos_suppliers` ( +CREATE TABLE `ospos_suppliers` ( `person_id` int(10) NOT NULL, `company_name` varchar(255) NOT NULL, `account_number` varchar(255) DEFAULT NULL, @@ -678,6 +638,11 @@ CREATE TABLE IF NOT EXISTS `ospos_suppliers` ( KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Dumping data for table `ospos_suppliers` +-- + + -- -- Constraints for dumped tables -- @@ -718,7 +683,11 @@ ALTER TABLE `ospos_items_taxes` -- ALTER TABLE `ospos_item_kit_items` ADD CONSTRAINT `ospos_item_kit_items_ibfk_1` FOREIGN KEY (`item_kit_id`) REFERENCES `ospos_item_kits` (`item_kit_id`) ON DELETE CASCADE, +<<<<<<< HEAD ADD CONSTRAINT `ospos_item_kit_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ON DELETE CASCADE; +======= + ADD CONSTRAINT `ospos_item_kit_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`) ON DELETE CASCADE; +>>>>>>> Added empty check in stock_locations config -- -- Constraints for table `ospos_permissions` @@ -741,13 +710,6 @@ ALTER TABLE `ospos_receivings_items` ADD CONSTRAINT `ospos_receivings_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), ADD CONSTRAINT `ospos_receivings_items_ibfk_2` FOREIGN KEY (`receiving_id`) REFERENCES `ospos_receivings` (`receiving_id`); --- --- Constraints for table `ospos_requisitions_items` --- -ALTER TABLE `ospos_requisitions_items` - ADD CONSTRAINT `ospos_requisitions_items_ibfk_1` FOREIGN KEY (`requisition_id`) REFERENCES `ospos_requisitions` (`requisition_id`) ON DELETE CASCADE, - ADD CONSTRAINT `ospos_requisitions_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`); - -- -- Constraints for table `ospos_sales` -- @@ -760,20 +722,20 @@ ALTER TABLE `ospos_sales` -- ALTER TABLE `ospos_sales_items` ADD CONSTRAINT `ospos_sales_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), - ADD CONSTRAINT `ospos_sales_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`) ON DELETE CASCADE; + ADD CONSTRAINT `ospos_sales_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`); -- -- Constraints for table `ospos_sales_items_taxes` -- ALTER TABLE `ospos_sales_items_taxes` - ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_items` (`sale_id`) ON DELETE CASCADE, + ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_items` (`sale_id`), ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`); -- -- Constraints for table `ospos_sales_payments` -- ALTER TABLE `ospos_sales_payments` - ADD CONSTRAINT `ospos_sales_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`) ON DELETE CASCADE; + ADD CONSTRAINT `ospos_sales_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`); -- -- Constraints for table `ospos_sales_suspended` @@ -787,27 +749,23 @@ ALTER TABLE `ospos_sales_suspended` -- ALTER TABLE `ospos_sales_suspended_items` ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`), - ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`) ON DELETE CASCADE; + ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`); -- -- Constraints for table `ospos_sales_suspended_items_taxes` -- ALTER TABLE `ospos_sales_suspended_items_taxes` - ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended_items` (`sale_id`) ON DELETE CASCADE, + ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended_items` (`sale_id`), ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`); -- -- Constraints for table `ospos_sales_suspended_payments` -- ALTER TABLE `ospos_sales_suspended_payments` - ADD CONSTRAINT `ospos_sales_suspended_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`) ON DELETE CASCADE; + ADD CONSTRAINT `ospos_sales_suspended_payments_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`); -- -- Constraints for table `ospos_suppliers` -- ALTER TABLE `ospos_suppliers` ADD CONSTRAINT `ospos_suppliers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`); - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;