2003-11-03 11:16:57 +01:00
-- ===================================================================
2012-08-23 07:50:20 +02:00
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2018-10-27 14:43:12 +02:00
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
2012-08-23 07:50:20 +02:00
-- Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
2015-02-26 14:15:33 +01:00
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
2003-11-03 11:16:57 +01:00
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
-- the Free Software Foundation; either version 3 of the License, or
2003-11-03 11:16:57 +01:00
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
2003-11-03 11:16:57 +01:00
--
-- ===================================================================
create table llx_commandedet
(
2012-08-23 07:50:20 +02:00
rowid integer AUTO_INCREMENT PRIMARY KEY ,
2015-02-28 03:11:15 +01:00
fk_commande integer NOT NULL ,
fk_parent_line integer NULL ,
fk_product integer NULL ,
2012-08-23 07:50:20 +02:00
label varchar ( 255 ) DEFAULT NULL ,
description text ,
2016-10-21 14:09:11 +02:00
vat_src_code varchar ( 10 ) DEFAULT ' ' , -- Vat code used as source of vat fields. Not strict foreign key here.
2021-09-24 13:51:52 +02:00
tva_tx double ( 7 , 4 ) , -- Vat rate
localtax1_tx double ( 7 , 4 ) DEFAULT 0 , -- localtax1 rate
2017-10-29 06:56:05 +01:00
localtax1_type varchar ( 10 ) NULL , -- localtax1 type
2021-09-24 13:51:52 +02:00
localtax2_tx double ( 7 , 4 ) DEFAULT 0 , -- localtax2 rate
2013-03-09 13:12:20 +01:00
localtax2_type varchar ( 10 ) NULL , -- localtax2 type
2012-08-23 07:50:20 +02:00
qty real , -- quantity
remise_percent real DEFAULT 0 , -- pourcentage de remise
remise real DEFAULT 0 , -- montant de la remise
fk_remise_except integer NULL , -- Lien vers table des remises fixes
price real , -- prix final
2018-02-03 19:42:00 +01:00
subprice double ( 24 , 8 ) DEFAULT 0 , -- P.U. HT (exemple 100)
total_ht double ( 24 , 8 ) DEFAULT 0 , -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double ( 24 , 8 ) DEFAULT 0 , -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
total_localtax1 double ( 24 , 8 ) DEFAULT 0 , -- Total LocalTax1
total_localtax2 double ( 24 , 8 ) DEFAULT 0 , -- Total LocalTax2
total_ttc double ( 24 , 8 ) DEFAULT 0 , -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
2018-02-03 19:52:09 +01:00
product_type integer DEFAULT 0 , -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
2012-08-23 07:50:20 +02:00
date_start datetime DEFAULT NULL , -- date debut si service
date_end datetime DEFAULT NULL , -- date fin si service
info_bits integer DEFAULT 0 , -- TVA NPR ou non
2013-06-06 18:54:17 +02:00
2018-02-03 19:42:00 +01:00
buy_price_ht double ( 24 , 8 ) DEFAULT 0 , -- buying price
2013-06-06 18:54:17 +02:00
fk_product_fournisseur_price integer DEFAULT NULL , -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
2018-02-03 19:42:00 +01:00
special_code integer DEFAULT 0 , -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
2012-08-23 07:50:20 +02:00
rang integer DEFAULT 0 ,
2018-02-03 19:42:00 +01:00
fk_unit integer DEFAULT NULL , -- lien vers table des unités
2016-01-18 19:45:27 +01:00
import_key varchar ( 14 ) ,
2020-09-04 22:42:37 +02:00
ref_ext varchar ( 255 ) DEFAULT NULL ,
2016-01-18 19:45:27 +01:00
2018-02-03 19:42:00 +01:00
fk_commandefourndet integer DEFAULT NULL , -- link to detail line of commande fourn (resplenish)
2016-08-23 11:25:14 +02:00
2017-10-24 21:14:31 +02:00
fk_multicurrency integer ,
2021-11-22 03:12:40 +01:00
multicurrency_code varchar ( 3 ) ,
2017-10-29 06:56:05 +01:00
multicurrency_subprice double ( 24 , 8 ) DEFAULT 0 ,
multicurrency_total_ht double ( 24 , 8 ) DEFAULT 0 ,
multicurrency_total_tva double ( 24 , 8 ) DEFAULT 0 ,
multicurrency_total_ttc double ( 24 , 8 ) DEFAULT 0
2011-02-24 10:57:02 +01:00
) ENGINE = innodb ;
2006-12-12 17:02:41 +01:00
--
2008-10-07 22:46:33 +02:00
-- List of codes for special_code
2006-12-12 17:02:41 +01:00
--
-- 1 : frais de port
2007-09-03 17:18:06 +02:00
-- 2 : ecotaxe
2008-01-09 10:48:23 +01:00
-- 3 : produit/service propose en option
2008-10-07 22:46:33 +02:00
--