1-- ===================================================================
2-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3-- Copyright (C) 2009 Laurent Destailleur  <eldy@users.sourceforge.net>
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
21create table llx_facture_fourn_det
22(
23  rowid             integer AUTO_INCREMENT PRIMARY KEY,
24  fk_facture_fourn  integer NOT NULL,
25  fk_parent_line    integer NULL,
26  fk_product        integer NULL,
27  ref               varchar(50),   -- supplier product ref
28  label             varchar(255),  -- product label
29  description       text,
30  pu_ht             double(24,8), -- unit price excluding tax
31  pu_ttc            double(24,8), -- unit price with tax
32  qty               real,         -- quantity of product/service
33  remise_percent	real       DEFAULT 0,				-- % de la remise ligne (exemple 20%)
34  fk_remise_except	integer    NULL,					-- Lien vers table des remises fixes
35  vat_src_code		varchar(10)  DEFAULT '',			-- Vat code used as source of vat fields. Not strict foreign key here.
36  tva_tx            double(6,3),  -- TVA taux product/service
37  localtax1_tx      double(6,3)  DEFAULT 0,    -- localtax1 rate
38  localtax1_type	varchar(10)	  NULL, 		-- localtax1 type
39  localtax2_tx      double(6,3)  DEFAULT 0,    -- localtax2 rate
40  localtax2_type	varchar(10)	  NULL, 		-- localtax2 type
41  total_ht          double(24,8), -- Total line price of product excluding tax
42  tva               double(24,8), -- Total TVA of line
43  total_localtax1   double(24,8) DEFAULT 0,	-- Total LocalTax1 for total quantity of line
44  total_localtax2   double(24,8) DEFAULT 0,	-- total LocalTax2 for total quantity of line
45  total_ttc         double(24,8), -- Total line with tax
46  product_type	    integer      DEFAULT 0,
47  date_start        datetime   DEFAULT NULL,       -- date debut si service
48  date_end          datetime   DEFAULT NULL,       -- date fin si service
49  info_bits						integer    DEFAULT 0,				-- TVA NPR ou non
50  fk_code_ventilation integer DEFAULT 0 NOT NULL,
51  special_code				 integer      DEFAULT 0,      -- code for special lines
52  rang						 integer      DEFAULT 0,
53  import_key        varchar(14),
54  fk_unit         integer    DEFAULT NULL,
55
56  fk_multicurrency		integer,
57  multicurrency_code			varchar(255),
58  multicurrency_subprice		double(24,8) DEFAULT 0,
59  multicurrency_total_ht		double(24,8) DEFAULT 0,
60  multicurrency_total_tva	double(24,8) DEFAULT 0,
61  multicurrency_total_ttc	double(24,8) DEFAULT 0
62)ENGINE=innodb;
63