1-- ============================================================================ 2-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> 4-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> 5-- 6-- This program is free software; you can redistribute it and/or modify 7-- it under the terms of the GNU General Public License as published by 8-- the Free Software Foundation; either version 3 of the License, or 9-- (at your option) any later version. 10-- 11-- This program is distributed in the hope that it will be useful, 12-- but WITHOUT ANY WARRANTY; without even the implied warranty of 13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14-- GNU General Public License for more details. 15-- 16-- You should have received a copy of the GNU General Public License 17-- along with this program. If not, see <https://www.gnu.org/licenses/>. 18-- 19-- ============================================================================ 20 21-- To save customer prices (one price per product or several prices per segment/level) 22-- TODO We should introduce table llx_product_price_log to store changes and keep in this table only last current price ! 23 24create table llx_product_price 25( 26 rowid integer AUTO_INCREMENT PRIMARY KEY, 27 entity integer DEFAULT 1 NOT NULL, -- Multi company id 28 tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 29 fk_product integer NOT NULL, 30 date_price datetime NOT NULL, 31 price_level smallint NULL DEFAULT 1, 32 price double(24,8) DEFAULT NULL, 33 price_ttc double(24,8) DEFAULT NULL, 34 price_min double(24,8) default NULL, 35 price_min_ttc double(24,8) default NULL, 36 price_base_type varchar(3) DEFAULT 'HT', 37 default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product. 38 tva_tx double(6,3) DEFAULT 0 NOT NULL, -- Used only when option PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on (not supported) 39 recuperableonly integer NOT NULL DEFAULT '0', 40 localtax1_tx double(6,3) DEFAULT 0, 41 localtax1_type varchar(10) NOT NULL DEFAULT '0', 42 localtax2_tx double(6,3) DEFAULT 0, 43 localtax2_type varchar(10) NOT NULL DEFAULT '0', 44 fk_user_author integer, 45 tosell tinyint DEFAULT 1, 46 price_by_qty integer NOT NULL DEFAULT 0, 47 fk_price_expression integer, -- Link to the rule for dynamic price calculation 48 import_key varchar(14), 49 50 fk_multicurrency integer, 51 multicurrency_code varchar(255), 52 multicurrency_tx double(24,8) DEFAULT 1, 53 multicurrency_price double(24,8) DEFAULT NULL, 54 multicurrency_price_ttc double(24,8) DEFAULT NULL 55 56)ENGINE=innodb; 57 58