llx_expensereport_det.sql 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_det
  19. (
  20. rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
  21. fk_expensereport integer NOT NULL,
  22. docnumber varchar(128), -- To store a ref of a accounting doc (piece)
  23. fk_c_type_fees integer NOT NULL, -- Type of expense
  24. fk_c_exp_tax_cat integer,
  25. fk_projet integer, -- Id of project
  26. comments text NOT NULL,
  27. product_type integer DEFAULT -1,
  28. qty real NOT NULL,
  29. subprice double(24,8) DEFAULT 0 NOT NULL, -- P.U. HT (example 100)
  30. value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120)
  31. remise_percent real,
  32. vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
  33. tva_tx double(7,4), -- Vat rate
  34. localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
  35. localtax1_type varchar(10) NULL, -- localtax1 type
  36. localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
  37. localtax2_type varchar(10) NULL, -- localtax2 type
  38. total_ht double(24,8) DEFAULT 0 NOT NULL,
  39. total_tva double(24,8) DEFAULT 0 NOT NULL,
  40. total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
  41. total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line
  42. total_ttc double(24,8) DEFAULT 0 NOT NULL,
  43. date date NOT NULL,
  44. info_bits integer DEFAULT 0, -- TVA NPR ou non
  45. special_code integer DEFAULT 0, -- code for special lines
  46. fk_multicurrency integer,
  47. multicurrency_code varchar(3),
  48. multicurrency_subprice double(24,8) DEFAULT 0,
  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. fk_facture integer DEFAULT 0, -- ID of customer invoice line if expense is rebilled to a customer
  53. fk_ecm_files integer DEFAULT NULL, -- ID of ECM file that is source document of expense report
  54. fk_code_ventilation integer DEFAULT 0,
  55. rang integer DEFAULT 0, -- position of line
  56. import_key varchar(14),
  57. rule_warning_message text
  58. ) ENGINE=innodb;