diff --git a/database/3.0.2_to_3.1.0.sql b/database/3.0.2_to_3.1.0.sql index 0da482c47..5bc301684 100644 --- a/database/3.0.2_to_3.1.0.sql +++ b/database/3.0.2_to_3.1.0.sql @@ -10,7 +10,6 @@ ALTER TABLE `ospos_item_kits` ADD COLUMN `price_option` TINYINT(2) NOT NULL DEFAULT 0, ADD COLUMN `print_option` TINYINT(2) NOT NULL DEFAULT 0; - ALTER TABLE `ospos_item_kit_items` ADD COLUMN `kit_sequence` INT(3) NOT NULL DEFAULT 0; @@ -44,6 +43,7 @@ INSERT INTO `ospos_dinner_tables` (`dinner_table_id`, `name`, `status`, `deleted (2, 'Take Away', 0, 0); -- alter ospos_sales table + ALTER TABLE `ospos_sales` ADD COLUMN `dinner_table_id` int(11) NULL AFTER `invoice_number`; @@ -52,6 +52,7 @@ ALTER TABLE `ospos_sales` ADD CONSTRAINT `ospos_sales_ibfk_3` FOREIGN KEY (`dinner_table_id`) REFERENCES `ospos_dinner_tables` (`dinner_table_id`); -- alter ospos_sales_suspended table + ALTER TABLE `ospos_sales_suspended` ADD COLUMN `dinner_table_id` int(11) NULL AFTER `quote_number`; @@ -60,6 +61,7 @@ ALTER TABLE `ospos_sales_suspended` ADD CONSTRAINT `ospos_sales_suspended_ibfk_3` FOREIGN KEY (`dinner_table_id`) REFERENCES `ospos_dinner_tables` (`dinner_table_id`); -- add enabled dinner tables key into config + INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('date_or_time_format', ''), ('sales_quote_format', 'Q%y{QSEQ:6}'), @@ -120,10 +122,13 @@ ADD COLUMN `package_id` int(11) DEFAULT NULL AFTER `discount_percent`, ADD COLUMN `points` int(11) DEFAULT NULL AFTER `package_id`; -- add enabled reward points key into config + INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('customer_reward_enable',''); -/* The following changes are in support of customer sales tax changes */ +-- +-- The following changes are in support of customer sales tax changes +-- CREATE TABLE IF NOT EXISTS `ospos_tax_codes` ( `tax_code` varchar(32) NOT NULL, @@ -197,10 +202,12 @@ INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_i INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES ('taxes', 'taxes'); -/* End of customer sales tax changes */ +-- add support for cash rounding into config -/* Start of support for cash rounding */ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('cash_decimals', '2'); -/* End of support for cash rounding */ +-- alter people table (create email index) + +ALTER TABLE `ospos_people` + ADD INDEX `email` (`email`); diff --git a/database/database.sql b/database/database.sql index d513c70db..531f8f1e7 100644 --- a/database/database.sql +++ b/database/database.sql @@ -96,7 +96,6 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('cash_decimals', '2'); - -- -------------------------------------------------------- -- @@ -161,7 +160,7 @@ CREATE TABLE `ospos_giftcards` ( PRIMARY KEY (`giftcard_id`), UNIQUE KEY `giftcard_number` (`giftcard_number`), KEY `person_id` (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_giftcards` @@ -186,7 +185,7 @@ CREATE TABLE `ospos_inventory` ( KEY `trans_items` (`trans_items`), KEY `trans_user` (`trans_user`), KEY `trans_location` (`trans_location`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_inventory` @@ -230,7 +229,7 @@ CREATE TABLE `ospos_items` ( PRIMARY KEY (`item_id`), UNIQUE KEY `item_number` (`item_number`), KEY `supplier_id` (`supplier_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_items` @@ -270,7 +269,7 @@ CREATE TABLE `ospos_item_kits` ( `print_option` TINYINT(2) NOT NULL DEFAULT 0, `description` varchar(255) NOT NULL, PRIMARY KEY (`item_kit_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_item_kits` @@ -309,7 +308,7 @@ CREATE TABLE IF NOT EXISTS `ospos_item_quantities` ( PRIMARY KEY (`item_id`,`location_id`), KEY `item_id` (`item_id`), KEY `location_id` (`location_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -365,8 +364,9 @@ CREATE TABLE `ospos_people` ( `country` varchar(255) NOT NULL, `comments` text NOT NULL, `person_id` int(10) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; + PRIMARY KEY (`person_id`), + KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_people` @@ -465,7 +465,8 @@ INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES ('items_stock', 1), ('sales_stock', 1), ('receivings_stock', 1), -('suppliers', 1); +('suppliers', 1), +('taxes', 1); -- -- Table structure for table `ospos_receivings` @@ -483,7 +484,7 @@ CREATE TABLE `ospos_receivings` ( KEY `supplier_id` (`supplier_id`), KEY `employee_id` (`employee_id`), KEY `reference` (`reference`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_receivings` @@ -539,7 +540,7 @@ CREATE TABLE `ospos_sales` ( KEY `sale_time` (`sale_time`), KEY `dinner_table_id` (`dinner_table_id`), UNIQUE KEY `invoice_number` (`invoice_number`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_sales` @@ -620,6 +621,7 @@ CREATE TABLE `ospos_sales_payments` ( -- Dumping data for table `ospos_sales_payments` -- + -- -------------------------------------------------------- -- @@ -641,13 +643,11 @@ CREATE TABLE `ospos_sales_taxes` ( KEY `print_sequence` (`sale_id`,`print_sequence`,`tax_type`,`tax_group`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- -- Dumping data for table `ospos_sales_taxes` -- - -- -------------------------------------------------------- -- @@ -667,7 +667,7 @@ CREATE TABLE `ospos_sales_suspended` ( KEY `customer_id` (`customer_id`), KEY `employee_id` (`employee_id`), KEY `dinner_table_id` (`dinner_table_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_sales_suspended` @@ -759,6 +759,7 @@ CREATE TABLE `ospos_sessions` ( -- Dumping data for table `ospos_sessions` -- + -- -------------------------------------------------------- -- @@ -770,7 +771,7 @@ CREATE TABLE `ospos_stock_locations` ( `location_name` varchar(255) DEFAULT NULL, `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`location_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_stock_locations` @@ -778,7 +779,9 @@ CREATE TABLE `ospos_stock_locations` ( INSERT INTO `ospos_stock_locations` ( `deleted`, `location_name` ) VALUES ('0', 'stock'); + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_suppliers` -- @@ -793,7 +796,9 @@ CREATE TABLE `ospos_suppliers` ( KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_tax_categories` -- @@ -814,7 +819,9 @@ INSERT INTO `ospos_tax_categories` ( `tax_category_id`,`tax_category`, `tax_grou (1, 'Service', 12), (2, 'Alcohol', 11); + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_tax_codes` -- @@ -834,6 +841,26 @@ CREATE TABLE IF NOT EXISTS `ospos_tax_codes` ( -- -------------------------------------------------------- + +-- +-- Table structure for table `ospos_tax_code_rates` +-- + +CREATE TABLE IF NOT EXISTS `ospos_tax_code_rates` ( + `rate_tax_code` varchar(32) NOT NULL, + `rate_tax_category_id` int(10) NOT NULL, + `tax_rate` decimal(15,4) NOT NULL DEFAULT 0.0000, + `rounding_code` tinyint(2) NOT NULL DEFAULT 0, + PRIMARY KEY (`rate_tax_code`,`rate_tax_category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `ospos_tax_code_rates` +-- + + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_dinner_tables` -- @@ -854,6 +881,9 @@ INSERT INTO `ospos_dinner_tables` (`dinner_table_id`, `name`, `status`, `deleted (1, 'Delivery', 0, 0), (2, 'Take Away', 0, 0); + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_customer_packages` -- @@ -864,7 +894,7 @@ CREATE TABLE IF NOT EXISTS `ospos_customers_packages` ( `points_percent` float NOT NULL DEFAULT '0', `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`package_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; INSERT INTO `ospos_customers_packages` (`package_id`, `package_name`, `points_percent`, `deleted`) VALUES (1, 'Default', 0, 0), @@ -873,6 +903,9 @@ INSERT INTO `ospos_customers_packages` (`package_id`, `package_name`, `points_pe (4, 'Gold', 30, 0), (5, 'Premium', 50, 0); + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_customer_points` -- @@ -884,7 +917,10 @@ CREATE TABLE IF NOT EXISTS `ospos_customers_points` ( `sale_id` int(11) NOT NULL, `points_earned` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + + +-- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_reward_points` @@ -896,24 +932,10 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_reward_points` ( `earned` float NOT NULL, `used` float NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + -- -------------------------------------------------------- --- --- Table structure for table `ospos_tax_code_rates` --- - -CREATE TABLE IF NOT EXISTS `ospos_tax_code_rates` ( - `rate_tax_code` varchar(32) NOT NULL, - `rate_tax_category_id` int(10) NOT NULL, - `tax_rate` decimal(15,4) NOT NULL DEFAULT 0.0000, - `rounding_code` tinyint(2) NOT NULL DEFAULT 0, - PRIMARY KEY (`rate_tax_code`,`rate_tax_category_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `ospos_tax_code_rates` --- -- -- Constraints for dumped tables diff --git a/database/migrate_phppos_dist.sql b/database/migrate_phppos_dist.sql index 001b9f92c..440959a16 100644 --- a/database/migrate_phppos_dist.sql +++ b/database/migrate_phppos_dist.sql @@ -96,7 +96,6 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('cash_decimals', '2'); - -- -------------------------------------------------------- -- @@ -161,7 +160,7 @@ CREATE TABLE `ospos_giftcards` ( PRIMARY KEY (`giftcard_id`), UNIQUE KEY `giftcard_number` (`giftcard_number`), KEY `person_id` (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_giftcards` @@ -186,7 +185,7 @@ CREATE TABLE `ospos_inventory` ( KEY `trans_items` (`trans_items`), KEY `trans_user` (`trans_user`), KEY `trans_location` (`trans_location`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_inventory` @@ -230,7 +229,7 @@ CREATE TABLE `ospos_items` ( PRIMARY KEY (`item_id`), UNIQUE KEY `item_number` (`item_number`), KEY `supplier_id` (`supplier_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_items` @@ -270,7 +269,7 @@ CREATE TABLE `ospos_item_kits` ( `print_option` TINYINT(2) NOT NULL DEFAULT 0, `description` varchar(255) NOT NULL, PRIMARY KEY (`item_kit_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_item_kits` @@ -309,7 +308,7 @@ CREATE TABLE IF NOT EXISTS `ospos_item_quantities` ( PRIMARY KEY (`item_id`,`location_id`), KEY `item_id` (`item_id`), KEY `location_id` (`location_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -365,8 +364,9 @@ CREATE TABLE `ospos_people` ( `country` varchar(255) NOT NULL, `comments` text NOT NULL, `person_id` int(10) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; + PRIMARY KEY (`person_id`), + KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_people` @@ -465,7 +465,8 @@ INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES ('items_stock', 1), ('sales_stock', 1), ('receivings_stock', 1), -('suppliers', 1); +('suppliers', 1), +('taxes', 1); -- -- Table structure for table `ospos_receivings` @@ -483,7 +484,7 @@ CREATE TABLE `ospos_receivings` ( KEY `supplier_id` (`supplier_id`), KEY `employee_id` (`employee_id`), KEY `reference` (`reference`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_receivings` @@ -539,7 +540,7 @@ CREATE TABLE `ospos_sales` ( KEY `sale_time` (`sale_time`), KEY `dinner_table_id` (`dinner_table_id`), UNIQUE KEY `invoice_number` (`invoice_number`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_sales` @@ -620,6 +621,7 @@ CREATE TABLE `ospos_sales_payments` ( -- Dumping data for table `ospos_sales_payments` -- + -- -------------------------------------------------------- -- @@ -641,13 +643,11 @@ CREATE TABLE `ospos_sales_taxes` ( KEY `print_sequence` (`sale_id`,`print_sequence`,`tax_type`,`tax_group`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- -- Dumping data for table `ospos_sales_taxes` -- - -- -------------------------------------------------------- -- @@ -667,7 +667,7 @@ CREATE TABLE `ospos_sales_suspended` ( KEY `customer_id` (`customer_id`), KEY `employee_id` (`employee_id`), KEY `dinner_table_id` (`dinner_table_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_sales_suspended` @@ -759,6 +759,7 @@ CREATE TABLE `ospos_sessions` ( -- Dumping data for table `ospos_sessions` -- + -- -------------------------------------------------------- -- @@ -770,7 +771,7 @@ CREATE TABLE `ospos_stock_locations` ( `location_name` varchar(255) DEFAULT NULL, `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`location_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_stock_locations` @@ -778,7 +779,9 @@ CREATE TABLE `ospos_stock_locations` ( INSERT INTO `ospos_stock_locations` ( `deleted`, `location_name` ) VALUES ('0', 'stock'); + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_suppliers` -- @@ -793,7 +796,9 @@ CREATE TABLE `ospos_suppliers` ( KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_tax_categories` -- @@ -814,7 +819,9 @@ INSERT INTO `ospos_tax_categories` ( `tax_category_id`,`tax_category`, `tax_grou (1, 'Service', 12), (2, 'Alcohol', 11); + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_tax_codes` -- @@ -834,6 +841,26 @@ CREATE TABLE IF NOT EXISTS `ospos_tax_codes` ( -- -------------------------------------------------------- + +-- +-- Table structure for table `ospos_tax_code_rates` +-- + +CREATE TABLE IF NOT EXISTS `ospos_tax_code_rates` ( + `rate_tax_code` varchar(32) NOT NULL, + `rate_tax_category_id` int(10) NOT NULL, + `tax_rate` decimal(15,4) NOT NULL DEFAULT 0.0000, + `rounding_code` tinyint(2) NOT NULL DEFAULT 0, + PRIMARY KEY (`rate_tax_code`,`rate_tax_category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `ospos_tax_code_rates` +-- + + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_dinner_tables` -- @@ -854,6 +881,9 @@ INSERT INTO `ospos_dinner_tables` (`dinner_table_id`, `name`, `status`, `deleted (1, 'Delivery', 0, 0), (2, 'Take Away', 0, 0); + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_customer_packages` -- @@ -864,7 +894,7 @@ CREATE TABLE IF NOT EXISTS `ospos_customers_packages` ( `points_percent` float NOT NULL DEFAULT '0', `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`package_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; INSERT INTO `ospos_customers_packages` (`package_id`, `package_name`, `points_percent`, `deleted`) VALUES (1, 'Default', 0, 0), @@ -873,6 +903,9 @@ INSERT INTO `ospos_customers_packages` (`package_id`, `package_name`, `points_pe (4, 'Gold', 30, 0), (5, 'Premium', 50, 0); + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_customer_points` -- @@ -884,7 +917,10 @@ CREATE TABLE IF NOT EXISTS `ospos_customers_points` ( `sale_id` int(11) NOT NULL, `points_earned` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + + +-- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_reward_points` @@ -896,24 +932,10 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_reward_points` ( `earned` float NOT NULL, `used` float NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + -- -------------------------------------------------------- --- --- Table structure for table `ospos_tax_code_rates` --- - -CREATE TABLE IF NOT EXISTS `ospos_tax_code_rates` ( - `rate_tax_code` varchar(32) NOT NULL, - `rate_tax_category_id` int(10) NOT NULL, - `tax_rate` decimal(15,4) NOT NULL DEFAULT 0.0000, - `rounding_code` tinyint(2) NOT NULL DEFAULT 0, - PRIMARY KEY (`rate_tax_code`,`rate_tax_category_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `ospos_tax_code_rates` --- -- -- This migration script should be run after creating tables with the regular database script and before applying the constraints. diff --git a/database/tables.sql b/database/tables.sql index 872734f38..97b79b163 100644 --- a/database/tables.sql +++ b/database/tables.sql @@ -96,7 +96,6 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('cash_decimals', '2'); - -- -------------------------------------------------------- -- @@ -161,7 +160,7 @@ CREATE TABLE `ospos_giftcards` ( PRIMARY KEY (`giftcard_id`), UNIQUE KEY `giftcard_number` (`giftcard_number`), KEY `person_id` (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_giftcards` @@ -186,7 +185,7 @@ CREATE TABLE `ospos_inventory` ( KEY `trans_items` (`trans_items`), KEY `trans_user` (`trans_user`), KEY `trans_location` (`trans_location`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_inventory` @@ -230,7 +229,7 @@ CREATE TABLE `ospos_items` ( PRIMARY KEY (`item_id`), UNIQUE KEY `item_number` (`item_number`), KEY `supplier_id` (`supplier_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_items` @@ -270,7 +269,7 @@ CREATE TABLE `ospos_item_kits` ( `print_option` TINYINT(2) NOT NULL DEFAULT 0, `description` varchar(255) NOT NULL, PRIMARY KEY (`item_kit_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_item_kits` @@ -309,7 +308,7 @@ CREATE TABLE IF NOT EXISTS `ospos_item_quantities` ( PRIMARY KEY (`item_id`,`location_id`), KEY `item_id` (`item_id`), KEY `location_id` (`location_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- @@ -365,8 +364,9 @@ CREATE TABLE `ospos_people` ( `country` varchar(255) NOT NULL, `comments` text NOT NULL, `person_id` int(10) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; + PRIMARY KEY (`person_id`), + KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_people` @@ -465,7 +465,8 @@ INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES ('items_stock', 1), ('sales_stock', 1), ('receivings_stock', 1), -('suppliers', 1); +('suppliers', 1), +('taxes', 1); -- -- Table structure for table `ospos_receivings` @@ -483,7 +484,7 @@ CREATE TABLE `ospos_receivings` ( KEY `supplier_id` (`supplier_id`), KEY `employee_id` (`employee_id`), KEY `reference` (`reference`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_receivings` @@ -539,7 +540,7 @@ CREATE TABLE `ospos_sales` ( KEY `sale_time` (`sale_time`), KEY `dinner_table_id` (`dinner_table_id`), UNIQUE KEY `invoice_number` (`invoice_number`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_sales` @@ -620,6 +621,7 @@ CREATE TABLE `ospos_sales_payments` ( -- Dumping data for table `ospos_sales_payments` -- + -- -------------------------------------------------------- -- @@ -641,13 +643,11 @@ CREATE TABLE `ospos_sales_taxes` ( KEY `print_sequence` (`sale_id`,`print_sequence`,`tax_type`,`tax_group`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- -- Dumping data for table `ospos_sales_taxes` -- - -- -------------------------------------------------------- -- @@ -667,7 +667,7 @@ CREATE TABLE `ospos_sales_suspended` ( KEY `customer_id` (`customer_id`), KEY `employee_id` (`employee_id`), KEY `dinner_table_id` (`dinner_table_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_sales_suspended` @@ -759,6 +759,7 @@ CREATE TABLE `ospos_sessions` ( -- Dumping data for table `ospos_sessions` -- + -- -------------------------------------------------------- -- @@ -770,7 +771,7 @@ CREATE TABLE `ospos_stock_locations` ( `location_name` varchar(255) DEFAULT NULL, `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`location_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `ospos_stock_locations` @@ -778,7 +779,9 @@ CREATE TABLE `ospos_stock_locations` ( INSERT INTO `ospos_stock_locations` ( `deleted`, `location_name` ) VALUES ('0', 'stock'); + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_suppliers` -- @@ -793,7 +796,9 @@ CREATE TABLE `ospos_suppliers` ( KEY `person_id` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_tax_categories` -- @@ -814,7 +819,9 @@ INSERT INTO `ospos_tax_categories` ( `tax_category_id`,`tax_category`, `tax_grou (1, 'Service', 12), (2, 'Alcohol', 11); + -- -------------------------------------------------------- + -- -- Table structure for table `ospos_tax_codes` -- @@ -834,6 +841,26 @@ CREATE TABLE IF NOT EXISTS `ospos_tax_codes` ( -- -------------------------------------------------------- + +-- +-- Table structure for table `ospos_tax_code_rates` +-- + +CREATE TABLE IF NOT EXISTS `ospos_tax_code_rates` ( + `rate_tax_code` varchar(32) NOT NULL, + `rate_tax_category_id` int(10) NOT NULL, + `tax_rate` decimal(15,4) NOT NULL DEFAULT 0.0000, + `rounding_code` tinyint(2) NOT NULL DEFAULT 0, + PRIMARY KEY (`rate_tax_code`,`rate_tax_category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `ospos_tax_code_rates` +-- + + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_dinner_tables` -- @@ -854,6 +881,9 @@ INSERT INTO `ospos_dinner_tables` (`dinner_table_id`, `name`, `status`, `deleted (1, 'Delivery', 0, 0), (2, 'Take Away', 0, 0); + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_customer_packages` -- @@ -864,7 +894,7 @@ CREATE TABLE IF NOT EXISTS `ospos_customers_packages` ( `points_percent` float NOT NULL DEFAULT '0', `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`package_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; INSERT INTO `ospos_customers_packages` (`package_id`, `package_name`, `points_percent`, `deleted`) VALUES (1, 'Default', 0, 0), @@ -873,6 +903,9 @@ INSERT INTO `ospos_customers_packages` (`package_id`, `package_name`, `points_pe (4, 'Gold', 30, 0), (5, 'Premium', 50, 0); + +-- -------------------------------------------------------- + -- -- Table structure for table `ospos_customer_points` -- @@ -884,7 +917,10 @@ CREATE TABLE IF NOT EXISTS `ospos_customers_points` ( `sale_id` int(11) NOT NULL, `points_earned` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + + +-- -------------------------------------------------------- -- -- Table structure for table `ospos_sales_reward_points` @@ -896,21 +932,7 @@ CREATE TABLE IF NOT EXISTS `ospos_sales_reward_points` ( `earned` float NOT NULL, `used` float NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; + -- -------------------------------------------------------- --- --- Table structure for table `ospos_tax_code_rates` --- - -CREATE TABLE IF NOT EXISTS `ospos_tax_code_rates` ( - `rate_tax_code` varchar(32) NOT NULL, - `rate_tax_category_id` int(10) NOT NULL, - `tax_rate` decimal(15,4) NOT NULL DEFAULT 0.0000, - `rounding_code` tinyint(2) NOT NULL DEFAULT 0, - PRIMARY KEY (`rate_tax_code`,`rate_tax_category_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `ospos_tax_code_rates` ---