-- Copyright (C) ---Put here your own copyright and developer email---
--
-- 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
-- the Free Software Foundation, either version 3 of the License, or
-- (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
-- along with this program.  If not, see https://www.gnu.org/licenses/.


CREATE TABLE llx_livraison (
  rowid int(11) NOT NULL AUTO_INCREMENT,
  ref varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  entity int(11) NOT NULL DEFAULT 1,
  ref_ext varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  ref_int varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  ref_client varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  fk_soc int(11) NOT NULL,
  fk_projet int(11) DEFAULT NULL,
  tms timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  date_creation datetime DEFAULT NULL,
  date_valid datetime DEFAULT NULL,
  date_cloture datetime DEFAULT NULL,
  fk_user_author int(11) DEFAULT NULL,
  fk_user_modif int(11) DEFAULT NULL,
  fk_user_valid int(11) DEFAULT NULL,
  fk_user_cloture int(11) DEFAULT NULL,
  source smallint(6) DEFAULT NULL,
  fk_statut smallint(6) DEFAULT 0,
  amount_ht double(24,8) DEFAULT 0.00000000,
  remise_percent double DEFAULT 0,
  remise_absolue double DEFAULT 0,
  remise double DEFAULT 0,
  total_tva double(24,8) DEFAULT 0.00000000,
  localtax1 double(24,8) DEFAULT 0.00000000,
  localtax2 double(24,8) DEFAULT 0.00000000,
  total_ht double(24,8) DEFAULT 0.00000000,
  total_ttc double(24,8) DEFAULT 0.00000000,
  note_private text COLLATE utf8_unicode_ci DEFAULT NULL,
  note_public text COLLATE utf8_unicode_ci DEFAULT NULL,
  model_pdf varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  last_main_doc varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  module_source varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  pos_source varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  facture tinyint(4) DEFAULT 0,
  fk_account int(11) DEFAULT NULL,
  fk_currency varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
  fk_cond_reglement int(11) DEFAULT NULL,
  fk_mode_reglement int(11) DEFAULT NULL,
  fk_shipping_method int(11) DEFAULT NULL,
  fk_warehouse int(11) DEFAULT NULL,
  fk_availability int(11) DEFAULT NULL,
  fk_input_reason int(11) DEFAULT NULL,
  fk_delivery_address int(11) DEFAULT NULL,
  fk_incoterms int(11) DEFAULT NULL,
  location_incoterms varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  import_key varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL,
  extraparams varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  fk_multicurrency int(11) DEFAULT NULL,
  multicurrency_code varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  multicurrency_tx double(24,8) DEFAULT 1.00000000,
  multicurrency_total_ht double(24,8) DEFAULT 0.00000000,
  multicurrency_total_tva double(24,8) DEFAULT 0.00000000,
  multicurrency_total_ttc double(24,8) DEFAULT 0.00000000,
  PRIMARY KEY (rowid)
) ENGINE=InnoDB;
