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  vat_src_code		varchar(10)  DEFAULT '',			-- Vat code used as source of vat fields. Not strict foreign key here.
35  tva_tx            double(6,3),  -- TVA taux product/service
36  localtax1_tx      double(6,3)  DEFAULT 0,    -- localtax1 rate
37  localtax1_type	varchar(10)	  NULL, 		-- localtax1 type
38  localtax2_tx      double(6,3)  DEFAULT 0,    -- localtax2 rate
39  localtax2_type	varchar(10)	  NULL, 		-- localtax2 type
40  total_ht          double(24,8), -- Total line price of product excluding tax
41  tva               double(24,8), -- Total TVA of line
42  total_localtax1   double(24,8) DEFAULT 0,	-- Total LocalTax1 for total quantity of line
43  total_localtax2   double(24,8) DEFAULT 0,	-- total LocalTax2 for total quantity of line
44  total_ttc         double(24,8), -- Total line with tax
45  product_type	    integer      DEFAULT 0,
46  date_start        datetime   DEFAULT NULL,       -- date debut si service
47  date_end          datetime   DEFAULT NULL,       -- date fin si service
48  info_bits						integer    DEFAULT 0,				-- TVA NPR ou non
49  fk_code_ventilation integer DEFAULT 0 NOT NULL,
50  special_code				 integer      DEFAULT 0,      -- code for special lines
51  rang						 integer      DEFAULT 0,
52  import_key        varchar(14),
53  fk_unit         integer    DEFAULT NULL,
54
55  fk_multicurrency		integer,
56  multicurrency_code			varchar(255),
57  multicurrency_subprice		double(24,8) DEFAULT 0,
58  multicurrency_total_ht		double(24,8) DEFAULT 0,
59  multicurrency_total_tva	double(24,8) DEFAULT 0,
60  multicurrency_total_ttc	double(24,8) DEFAULT 0
61)ENGINE=innodb;
62