llx_product_price.sql 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. -- To save customer prices (one price per product or several prices per segment/level)
  21. -- TODO We should introduce table llx_product_price_log to store changes and keep in this table only last current price !
  22. create table llx_product_price
  23. (
  24. rowid integer AUTO_INCREMENT PRIMARY KEY,
  25. entity integer DEFAULT 1 NOT NULL, -- Multi company id
  26. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  27. fk_product integer NOT NULL,
  28. date_price datetime NOT NULL,
  29. price_level smallint NULL DEFAULT 1,
  30. price double(24,8) DEFAULT NULL, -- price without tax
  31. price_ttc double(24,8) DEFAULT NULL, -- price inc vat (but not localtax1 nor localtax2)
  32. price_min double(24,8) default NULL,
  33. price_min_ttc double(24,8) default NULL,
  34. price_base_type varchar(3) DEFAULT 'HT',
  35. 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.
  36. tva_tx double(7,4) DEFAULT 0 NOT NULL, -- Used only when option PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on (not supported)
  37. recuperableonly integer NOT NULL DEFAULT '0',
  38. localtax1_tx double(7,4) DEFAULT 0,
  39. localtax1_type varchar(10) NOT NULL DEFAULT '0',
  40. localtax2_tx double(7,4) DEFAULT 0,
  41. localtax2_type varchar(10) NOT NULL DEFAULT '0',
  42. fk_user_author integer,
  43. tosell tinyint DEFAULT 1,
  44. price_by_qty integer NOT NULL DEFAULT 0,
  45. fk_price_expression integer, -- Link to the rule for dynamic price calculation
  46. import_key varchar(14),
  47. fk_multicurrency integer,
  48. multicurrency_code varchar(3),
  49. multicurrency_tx double(24,8) DEFAULT 1,
  50. multicurrency_price double(24,8) DEFAULT NULL,
  51. multicurrency_price_ttc double(24,8) DEFAULT NULL
  52. )ENGINE=innodb;