llx_expensereport.sql 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. -- ============================================================================
  2. -- Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
  3. --
  4. -- This program is free software; you can redistribute it and/or modify
  5. -- it under the terms of the GNU General Public License as published by
  6. -- the Free Software Foundation; either version 3 of the License, or
  7. -- (at your option) any later version.
  8. --
  9. -- This program is distributed in the hope that it will be useful,
  10. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. -- GNU General Public License for more details.
  13. --
  14. -- You should have received a copy of the GNU General Public License
  15. -- along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. --
  17. -- ============================================================================
  18. CREATE TABLE llx_expensereport (
  19. rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
  20. ref varchar(50) NOT NULL,
  21. entity integer DEFAULT 1 NOT NULL, -- multi company id
  22. ref_number_int integer DEFAULT NULL,
  23. ref_ext integer,
  24. total_ht double(24,8) DEFAULT 0,
  25. total_tva double(24,8) DEFAULT 0,
  26. localtax1 double(24,8) DEFAULT 0, -- amount total localtax1
  27. localtax2 double(24,8) DEFAULT 0, -- amount total localtax2
  28. total_ttc double(24,8) DEFAULT 0,
  29. date_debut date NOT NULL,
  30. date_fin date NOT NULL,
  31. date_create datetime NOT NULL,
  32. date_valid datetime,
  33. date_approve datetime,
  34. date_refuse datetime,
  35. date_cancel datetime,
  36. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  37. fk_user_author integer NOT NULL, -- not the user author but the user the expense report is for
  38. fk_user_creat integer DEFAULT NULL, -- the use author
  39. fk_user_modif integer DEFAULT NULL,
  40. fk_user_valid integer DEFAULT NULL,
  41. fk_user_validator integer DEFAULT NULL,
  42. fk_user_approve integer DEFAULT NULL,
  43. fk_user_refuse integer DEFAULT NULL,
  44. fk_user_cancel integer DEFAULT NULL,
  45. fk_statut integer NOT NULL, -- 1=brouillon, 2=validated (waiting approval), 4=canceled, 5=approved, 6=paid, 99=refused
  46. fk_c_paiement integer DEFAULT NULL, -- deprecated
  47. paid smallint default 0 NOT NULL, -- deprecated (status is used instead)
  48. note_public text,
  49. note_private text,
  50. detail_refuse varchar(255) DEFAULT NULL,
  51. detail_cancel varchar(255) DEFAULT NULL,
  52. integration_compta integer DEFAULT NULL, -- not used
  53. fk_bank_account integer DEFAULT NULL,
  54. model_pdf varchar(50) DEFAULT NULL,
  55. last_main_doc varchar(255), -- relative filepath+filename of last main generated document
  56. fk_multicurrency integer,
  57. multicurrency_code varchar(3),
  58. multicurrency_tx double(24,8) DEFAULT 1,
  59. multicurrency_total_ht double(24,8) DEFAULT 0,
  60. multicurrency_total_tva double(24,8) DEFAULT 0,
  61. multicurrency_total_ttc double(24,8) DEFAULT 0,
  62. import_key varchar(14),
  63. extraparams varchar(255) -- for other parameters with json format
  64. ) ENGINE=innodb;