llx_facture.sql 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. -- ===========================================================================
  2. -- Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. -- Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. -- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. -- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  6. -- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
  7. -- Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
  8. --
  9. -- This program is free software; you can redistribute it and/or modify
  10. -- it under the terms of the GNU General Public License as published by
  11. -- the Free Software Foundation; either version 3 of the License, or
  12. -- (at your option) any later version.
  13. --
  14. -- This program is distributed in the hope that it will be useful,
  15. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. -- GNU General Public License for more details.
  18. --
  19. -- You should have received a copy of the GNU General Public License
  20. -- along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. --
  22. -- ===========================================================================
  23. create table llx_facture
  24. (
  25. rowid integer AUTO_INCREMENT PRIMARY KEY,
  26. ref varchar(30) NOT NULL, -- invoice reference number
  27. entity integer DEFAULT 1 NOT NULL, -- multi company id
  28. ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
  29. ref_client varchar(255), -- reference for customer
  30. type smallint DEFAULT 0 NOT NULL, -- type of invoice
  31. fk_soc integer NOT NULL,
  32. datec datetime, -- date de creation de la facture
  33. datef date, -- date invoice
  34. date_pointoftax date DEFAULT NULL, -- date point of tax (for GB)
  35. date_valid date, -- date validation
  36. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date
  37. date_closing datetime, -- date de cloture
  38. paye smallint DEFAULT 0 NOT NULL,
  39. remise_percent real DEFAULT 0, -- remise relative
  40. remise_absolue real DEFAULT 0, -- remise absolue
  41. remise real DEFAULT 0, -- remise totale calculee
  42. close_code varchar(16), -- Code motif cloture sans paiement complet
  43. close_missing_amount double(24,8), -- Amount missing when closing with a not complete payment
  44. close_note varchar(128), -- Commentaire cloture sans paiement complet
  45. total_tva double(24,8) DEFAULT 0, -- amount total tva apres remise totale
  46. localtax1 double(24,8) DEFAULT 0, -- amount total localtax1
  47. localtax2 double(24,8) DEFAULT 0, -- amount total localtax2
  48. revenuestamp double(24,8) DEFAULT 0, -- amount total revenuestamp
  49. total_ht double(24,8) DEFAULT 0, -- amount total ht apres remise totale
  50. total_ttc double(24,8) DEFAULT 0, -- amount total ttc apres remise totale
  51. fk_statut smallint DEFAULT 0 NOT NULL,
  52. fk_user_author integer, -- user making creation
  53. fk_user_modif integer, -- user making last change
  54. fk_user_valid integer, -- user validating
  55. fk_user_closing integer, -- user closing
  56. module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...)
  57. 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.
  58. fk_fac_rec_source integer, -- facture rec source
  59. fk_facture_source integer, -- facture origin if credit notes or replacement invoice
  60. fk_projet integer DEFAULT NULL, -- project invoice is linked to
  61. increment varchar(10), -- Numero of generation if generated from recurring template invoice
  62. fk_account integer, -- bank account
  63. fk_currency varchar(3), -- currency code
  64. fk_cond_reglement integer DEFAULT 1 NOT NULL, -- payment term (30 days, end of month...)
  65. fk_mode_reglement integer, -- payment mode (Virement, Prelevement)
  66. date_lim_reglement date, -- due date
  67. note_private text,
  68. note_public text,
  69. model_pdf varchar(255),
  70. last_main_doc varchar(255), -- relative filepath+filename of last main generated document
  71. fk_incoterms integer, -- for incoterms
  72. location_incoterms varchar(255), -- for incoterms
  73. fk_transport_mode integer, -- for intracomm report
  74. situation_cycle_ref smallint, -- situation cycle reference. A key that is similar for all the serie.
  75. situation_counter smallint, -- situation counter. The number into the serie: 1, 2, ...
  76. situation_final smallint, -- 0 by default, 1 it if is the final invoice.
  77. retained_warranty real DEFAULT NULL, -- % of retained warranty
  78. retained_warranty_date_limit date DEFAULT NULL,
  79. retained_warranty_fk_cond_reglement integer DEFAULT NULL, -- payment condition of retained warranty
  80. import_key varchar(14),
  81. extraparams varchar(255), -- for other parameters with json format
  82. fk_multicurrency integer,
  83. multicurrency_code varchar(3),
  84. multicurrency_tx double(24,8) DEFAULT 1,
  85. multicurrency_total_ht double(24,8) DEFAULT 0,
  86. multicurrency_total_tva double(24,8) DEFAULT 0,
  87. multicurrency_total_ttc double(24,8) DEFAULT 0
  88. )ENGINE=innodb;