llx_asset_depreciation_options_economic-asset.sql 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. -- ========================================================================
  2. -- Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
  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. -- Table to store economical depreciation of a fixed asset
  19. --
  20. -- Data example:
  21. -- INSERT INTO llx_asset_depreciation_options_economic (fk_asset, fk_asset_model, depreciation_type, accelerated_depreciation_option, degressive_coefficient, duration, duration_type, amount_base_depreciation_ht, amount_base_deductible_ht, total_amount_last_depreciation_ht, tms, fk_user_modif) VALUES
  22. -- (1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1);
  23. CREATE TABLE llx_asset_depreciation_options_economic(
  24. rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
  25. fk_asset integer,
  26. fk_asset_model integer,
  27. depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional
  28. accelerated_depreciation_option integer, -- activate accelerated depreciation mode (fiscal)
  29. degressive_coefficient double(24,8),
  30. duration smallint NOT NULL,
  31. duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily
  32. amount_base_depreciation_ht double(24,8),
  33. amount_base_deductible_ht double(24,8),
  34. total_amount_last_depreciation_ht double(24,8),
  35. tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  36. fk_user_modif integer
  37. ) ENGINE=innodb;