mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-08 08:57:50 -04:00
Fixed sale suspending / unsuspending (adapt db scripts)
Cleanup old code More code review Update item_quantities database model (composite pk)
This commit is contained in:
@@ -146,7 +146,6 @@ CREATE TABLE `ospos_items` (
|
||||
`allow_alt_description` tinyint(1) NOT NULL,
|
||||
`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,
|
||||
@@ -228,11 +227,10 @@ CREATE TABLE `ospos_item_kit_items` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ospos_item_quantities` (
|
||||
`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`),
|
||||
PRIMARY KEY (`item_id`,`location_id`),
|
||||
KEY `item_id` (`item_id`),
|
||||
KEY `location_id` (`location_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
|
||||
@@ -365,6 +363,7 @@ CREATE TABLE `ospos_receivings_items` (
|
||||
`quantity_purchased` decimal(15,2) NOT NULL DEFAULT '0',
|
||||
`item_cost_price` decimal(15,2) NOT NULL,
|
||||
`item_unit_price` decimal(15,2) NOT NULL,
|
||||
`item_location` int(11) NOT NULL,
|
||||
`discount_percent` decimal(15,2) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`receiving_id`,`item_id`,`line`),
|
||||
KEY `item_id` (`item_id`)
|
||||
@@ -413,9 +412,12 @@ CREATE TABLE `ospos_sales_items` (
|
||||
`quantity_purchased` decimal(15,2) NOT NULL DEFAULT '0.00',
|
||||
`item_cost_price` decimal(15,2) NOT NULL,
|
||||
`item_unit_price` decimal(15,2) NOT NULL,
|
||||
`item_location` int(11) NOT NULL,
|
||||
`discount_percent` decimal(15,2) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`sale_id`,`item_id`,`line`),
|
||||
KEY `item_id` (`item_id`)
|
||||
KEY `sale_id` (`sale_id`),
|
||||
KEY `item_id` (`item_id`),
|
||||
KEY `item_location` (`item_location`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
@@ -436,6 +438,7 @@ CREATE TABLE `ospos_sales_items_taxes` (
|
||||
`name` varchar(255) NOT NULL,
|
||||
`percent` decimal(15,2) NOT NULL,
|
||||
PRIMARY KEY (`sale_id`,`item_id`,`line`,`name`,`percent`),
|
||||
KEY `sale_id` (`sale_id`),
|
||||
KEY `item_id` (`item_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -454,7 +457,8 @@ CREATE TABLE `ospos_sales_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`)
|
||||
PRIMARY KEY (`sale_id`,`payment_type`),
|
||||
KEY `sale_id` (`sale_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
@@ -500,8 +504,10 @@ CREATE TABLE `ospos_sales_suspended_items` (
|
||||
`quantity_purchased` decimal(15,2) NOT NULL DEFAULT '0.00',
|
||||
`item_cost_price` decimal(15,2) NOT NULL,
|
||||
`item_unit_price` decimal(15,2) NOT NULL,
|
||||
`item_location` int(11) NOT NULL,
|
||||
`discount_percent` decimal(15,2) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`sale_id`,`item_id`,`line`),
|
||||
KEY `sale_id` (`sale_id`),
|
||||
KEY `item_id` (`item_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -683,7 +689,8 @@ 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`);
|
||||
ADD CONSTRAINT `ospos_sales_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales` (`sale_id`),
|
||||
ADD CONSTRAINT `ospos_sales_items_ibfk_3` FOREIGN KEY (`item_location`) REFERENCES `ospos_stock_locations` (`location_id`);
|
||||
|
||||
--
|
||||
-- Constraints for table `ospos_sales_items_taxes`
|
||||
@@ -710,7 +717,8 @@ 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`);
|
||||
ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_2` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended` (`sale_id`),
|
||||
ADD CONSTRAINT `ospos_sales_suspended_items_ibfk_3` FOREIGN KEY (`item_location`) REFERENCES `ospos_stock_locations` (`location_id`);
|
||||
|
||||
--
|
||||
-- Constraints for table `ospos_sales_suspended_items_taxes`
|
||||
|
||||
Reference in New Issue
Block a user