llx_facture_fourn_rec.sql 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. -- ===========================================================================
  2. --
  3. -- This program is free software; you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation; either version 3 of the License, or
  6. -- (at your option) any later version.
  7. --
  8. -- This program is distributed in the hope that it will be useful,
  9. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. -- GNU General Public License for more details.
  12. --
  13. -- You should have received a copy of the GNU General Public License
  14. -- along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. --
  16. -- ===========================================================================
  17. create table llx_facture_fourn_rec
  18. (
  19. rowid integer AUTO_INCREMENT PRIMARY KEY,
  20. titre varchar(200) NOT NULL,
  21. ref_supplier varchar(180) NOT NULL,
  22. entity integer DEFAULT 1 NOT NULL, -- multi company id
  23. fk_soc integer NOT NULL,
  24. datec datetime, -- date de creation
  25. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date
  26. suspended integer DEFAULT 0, -- 1=suspended
  27. libelle varchar(255),
  28. amount double(24, 8) DEFAULT 0 NOT NULL,
  29. remise real DEFAULT 0,
  30. vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
  31. localtax1 double(24,8) DEFAULT 0,
  32. localtax2 double(24,8) DEFAULT 0,
  33. total_ht double(24,8) DEFAULT 0,
  34. total_tva double(24,8) DEFAULT 0,
  35. total_ttc double(24,8) DEFAULT 0,
  36. fk_user_author integer, -- user creating
  37. fk_user_modif integer, -- user making last change
  38. fk_projet integer, -- projet auquel est associe la facture
  39. fk_account integer, -- bank account
  40. fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...)
  41. fk_mode_reglement integer, -- mode de reglement (CHQ, VIR, ...)
  42. date_lim_reglement date, -- date limite de reglement
  43. note_private text,
  44. note_public text,
  45. modelpdf varchar(255),
  46. fk_multicurrency integer,
  47. multicurrency_code varchar(3),
  48. multicurrency_tx double(24,8) DEFAULT 1,
  49. multicurrency_total_ht double(24,8) DEFAULT 0,
  50. multicurrency_total_tva double(24,8) DEFAULT 0,
  51. multicurrency_total_ttc double(24,8) DEFAULT 0,
  52. -- Fields linked to the recurring behavior
  53. usenewprice integer DEFAULT 0, -- update invoice with current price of product instead of recorded price
  54. frequency integer, -- frequency (for example: 3 for every 3 month)
  55. unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
  56. date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date)
  57. date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
  58. nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)
  59. nb_gen_max integer DEFAULT NULL, -- maximum number of generation
  60. auto_validate integer DEFAULT 0, -- 0 to create in draft, 1 to create and validate the new invoice
  61. generate_pdf integer DEFAULT 1 -- 0 disable pdf, 1 to generate pdf
  62. )ENGINE=innodb;