llx_commande.sql 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. -- ===================================================================
  2. -- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. -- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  4. -- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
  5. -- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  6. --
  7. -- This program is free software; you can redistribute it and/or modify
  8. -- it under the terms of the GNU General Public License as published by
  9. -- the Free Software Foundation; either version 3 of the License, or
  10. -- (at your option) any later version.
  11. --
  12. -- This program is distributed in the hope that it will be useful,
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. -- GNU General Public License for more details.
  16. --
  17. -- You should have received a copy of the GNU General Public License
  18. -- along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. --
  20. -- ===================================================================
  21. create table llx_commande
  22. (
  23. rowid integer AUTO_INCREMENT PRIMARY KEY,
  24. ref varchar(30) NOT NULL, -- order reference number
  25. entity integer DEFAULT 1 NOT NULL, -- multi company id
  26. ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
  27. ref_client varchar(255), -- reference for customer
  28. fk_soc integer NOT NULL,
  29. fk_projet integer DEFAULT NULL, -- projet auquel est rattache la commande
  30. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  31. date_creation datetime, -- date de creation
  32. date_valid datetime, -- date de validation
  33. date_cloture datetime, -- date de cloture
  34. date_commande date, -- date de la commande
  35. fk_user_author integer, -- user making creation
  36. fk_user_modif integer, -- user making last change
  37. fk_user_valid integer, -- user validating
  38. fk_user_cloture integer, -- user closing
  39. source smallint, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ?
  40. fk_statut smallint default 0,
  41. amount_ht double(24,8) default 0,
  42. remise_percent real default 0,
  43. remise_absolue real default 0,
  44. remise real default 0,
  45. total_tva double(24,8) default 0,
  46. localtax1 double(24,8) default 0, -- total localtax1
  47. localtax2 double(24,8) default 0, -- total localtax2
  48. revenuestamp double(24,8) DEFAULT 0, -- amount total revenuestamp (usefull for proforma that must match invoice)
  49. total_ht double(24,8) default 0,
  50. total_ttc double(24,8) default 0,
  51. note_private text,
  52. note_public text,
  53. model_pdf varchar(255),
  54. last_main_doc varchar(255), -- relative filepath+filename of last main generated document
  55. module_source varchar(32), -- name of module when order generated by a dedicated module (POS, ...)
  56. pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket.
  57. facture tinyint default 0,
  58. fk_account integer, -- bank account
  59. fk_currency varchar(3), -- currency code
  60. fk_cond_reglement integer, -- condition de reglement
  61. deposit_percent varchar(63) DEFAULT NULL, -- default deposit % if payment term needs it
  62. fk_mode_reglement integer, -- mode de reglement
  63. date_livraison datetime default NULL,
  64. fk_shipping_method integer, -- shipping method id
  65. fk_warehouse integer default NULL,
  66. fk_availability integer NULL,
  67. fk_input_reason integer, -- id coming from c_input_reason, '0' if no defined
  68. fk_delivery_address integer, -- delivery address (deprecated)
  69. fk_incoterms integer, -- for incoterms
  70. location_incoterms varchar(255), -- for incoterms
  71. import_key varchar(14),
  72. extraparams varchar(255), -- to save other parameters with json format
  73. fk_multicurrency integer,
  74. multicurrency_code varchar(3),
  75. multicurrency_tx double(24,8) DEFAULT 1,
  76. multicurrency_total_ht double(24,8) DEFAULT 0,
  77. multicurrency_total_tva double(24,8) DEFAULT 0,
  78. multicurrency_total_ttc double(24,8) DEFAULT 0
  79. )ENGINE=innodb;