llx_facture_rec.sql 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. -- ===========================================================================
  2. -- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. -- Copyright (C) 2012-2014 Laurent Destailleur <eldy@users.sourceforge.net>
  4. -- Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
  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_facture_rec
  22. (
  23. rowid integer AUTO_INCREMENT PRIMARY KEY,
  24. titre varchar(200) NOT NULL,
  25. entity integer DEFAULT 1 NOT NULL, -- multi company id
  26. fk_soc integer NOT NULL,
  27. datec datetime, -- date de creation
  28. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date
  29. suspended integer DEFAULT 0, -- 1=suspended
  30. amount double(24,8) DEFAULT 0 NOT NULL,
  31. remise real DEFAULT 0,
  32. remise_percent real DEFAULT 0,
  33. remise_absolue real DEFAULT 0,
  34. vat_src_code varchar(10) DEFAULT '', -- TODO Remove this. Field is inside the table of lines
  35. total_tva double(24,8) DEFAULT 0,
  36. localtax1 double(24,8) DEFAULT 0, -- amount localtax1
  37. localtax2 double(24,8) DEFAULT 0, -- amount localtax2
  38. revenuestamp double(24,8) DEFAULT 0, -- amount total revenuestamp
  39. total_ht double(24,8) DEFAULT 0,
  40. total_ttc double(24,8) DEFAULT 0,
  41. fk_user_author integer, -- user creating
  42. fk_user_modif integer, -- user making last change
  43. fk_projet integer, -- projet auquel est associe la facture
  44. fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement
  45. fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prelevement)
  46. date_lim_reglement date, -- date limite de reglement
  47. fk_account integer, -- bank account id
  48. note_private text,
  49. note_public text,
  50. modelpdf varchar(255),
  51. fk_multicurrency integer,
  52. multicurrency_code varchar(3),
  53. multicurrency_tx double(24,8) DEFAULT 1,
  54. multicurrency_total_ht double(24,8) DEFAULT 0,
  55. multicurrency_total_tva double(24,8) DEFAULT 0,
  56. multicurrency_total_ttc double(24,8) DEFAULT 0,
  57. usenewprice integer DEFAULT 0, -- update invoice with current price of product instead of recorded price
  58. frequency integer, -- frequency (for example: 3 for every 3 month)
  59. unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
  60. date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date)
  61. date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
  62. nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)
  63. nb_gen_max integer DEFAULT NULL, -- maximum number of generation
  64. auto_validate integer DEFAULT 0, -- 0 to create in draft, 1 to create and validate the new invoice
  65. generate_pdf integer DEFAULT 1 -- 0 disable pdf, 1 to generate pdf
  66. )ENGINE=innodb;