llx_contratdet.sql 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. -- ============================================================================
  2. -- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. -- Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
  4. --
  5. -- This program is free software; you can redistribute it and/or modify
  6. -- it under the terms of the GNU General Public License as published by
  7. -- the Free Software Foundation; either version 3 of the License, or
  8. -- (at your option) any later version.
  9. --
  10. -- This program is distributed in the hope that it will be useful,
  11. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. -- GNU General Public License for more details.
  14. --
  15. -- You should have received a copy of the GNU General Public License
  16. -- along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. --
  18. -- ============================================================================
  19. create table llx_contratdet
  20. (
  21. rowid integer AUTO_INCREMENT PRIMARY KEY,
  22. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  23. fk_contrat integer NOT NULL,
  24. fk_product integer NULL, -- doit pouvoir etre nul pour ligne detail sans produits
  25. statut smallint DEFAULT 0,
  26. label text, -- libelle du produit
  27. description text,
  28. fk_remise_except integer NULL, -- Lien vers table des remises fixes
  29. date_commande datetime,
  30. date_ouverture_prevue datetime,
  31. date_ouverture datetime, -- date d'ouverture du service chez le client
  32. date_fin_validite datetime,
  33. date_cloture datetime,
  34. vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
  35. tva_tx double(7,4) DEFAULT 0, -- taux tva
  36. localtax1_tx double(7,4) DEFAULT 0, -- local tax 1 rate
  37. localtax1_type varchar(10) NULL, -- localtax1 type
  38. localtax2_tx double(7,4) DEFAULT 0, -- local tax 2 rate
  39. localtax2_type varchar(10) NULL, -- localtax2 type
  40. qty real NOT NULL, -- quantity
  41. remise_percent real DEFAULT 0, -- pourcentage de remise
  42. subprice double(24,8) DEFAULT 0, -- prix unitaire
  43. price_ht real, -- prix final (obsolete)
  44. remise real DEFAULT 0, -- montant de la remise (obsolete)
  45. total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
  46. total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
  47. total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne
  48. total_localtax2 double(24,8) DEFAULT 0, -- Total Local tax 2 de la ligne
  49. total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
  50. product_type integer DEFAULT 1, -- Type of line (1=service by default)
  51. info_bits integer DEFAULT 0, -- TVA NPR ou non
  52. rang integer DEFAULT 0,
  53. buy_price_ht double(24,8) DEFAULT NULL, -- buying price
  54. fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added was created (may be used to update buy_price_ht when future invoice will be created)
  55. fk_user_author integer NOT NULL DEFAULT 0,
  56. fk_user_ouverture integer,
  57. fk_user_cloture integer,
  58. commentaire text,
  59. fk_unit integer DEFAULT NULL,
  60. fk_multicurrency integer,
  61. multicurrency_code varchar(3),
  62. multicurrency_subprice double(24,8) DEFAULT 0,
  63. multicurrency_total_ht double(24,8) DEFAULT 0,
  64. multicurrency_total_tva double(24,8) DEFAULT 0,
  65. multicurrency_total_ttc double(24,8) DEFAULT 0
  66. )ENGINE=innodb;