From 5152a060ccdb8bdc27be3d831a20fa0de3f05136 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 14 Feb 2022 04:06:25 +0100 Subject: [PATCH 01/16] NEW Asset module - New structure --- .../install/mysql/migration/15.0.0-16.0.0.sql | 215 ++++++++++++++++++ .../mysql/tables/llx_asset-asset.key.sql | 17 +- .../install/mysql/tables/llx_asset-asset.sql | 61 +++-- ...t_accountancy_codes_economic-asset.key.sql | 24 ++ ...asset_accountancy_codes_economic-asset.sql | 33 +++ ...set_accountancy_codes_fiscal-asset.key.sql | 24 ++ ...x_asset_accountancy_codes_fiscal-asset.sql | 29 +++ .../llx_asset_depreciation-asset.key.sql | 25 ++ .../tables/llx_asset_depreciation-asset.sql | 34 +++ ...epreciation_options_economic-asset.key.sql | 24 ++ ...et_depreciation_options_economic-asset.sql | 35 +++ ..._depreciation_options_fiscal-asset.key.sql | 24 ++ ...sset_depreciation_options_fiscal-asset.sql | 34 +++ .../llx_asset_extrafields-asset.key.sql | 1 - .../tables/llx_asset_extrafields-asset.sql | 3 +- .../tables/llx_asset_model-asset.key.sql | 25 ++ .../mysql/tables/llx_asset_model-asset.sql | 33 +++ ... llx_asset_model_extrafield-asset.key.sql} | 6 +- ...l => llx_asset_model_extrafield-asset.sql} | 15 +- .../mysql/tables/llx_asset_type-asset.sql | 26 --- .../llx_asset_type_extrafields-asset.key.sql | 17 -- .../llx_c_asset_disposal_type-asset.key.sql | 18 ++ .../llx_c_asset_disposal_type-asset.sql | 25 ++ 23 files changed, 668 insertions(+), 80 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_depreciation-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_model-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_asset_model-asset.sql rename htdocs/install/mysql/tables/{llx_asset_type-asset.key.sql => llx_asset_model_extrafield-asset.key.sql} (67%) rename htdocs/install/mysql/tables/{llx_asset_type_extrafields-asset.sql => llx_asset_model_extrafield-asset.sql} (54%) delete mode 100644 htdocs/install/mysql/tables/llx_asset_type-asset.sql delete mode 100644 htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.key.sql create mode 100644 htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index b78e53bd287..40ecda6c3fe 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -237,4 +237,219 @@ ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); +-- Assets - New module +ALTER TABLE llx_asset DROP FOREIGN KEY fk_asset_asset_type; +ALTER TABLE llx_asset DROP INDEX idx_asset_fk_asset_type; + +ALTER TABLE llx_asset CHANGE COLUMN amount_ht acquisition_value_ht double(24,8) NOT NULL; +ALTER TABLE llx_asset CHANGE COLUMN amount_vat recovered_vat double(24,8); + +DELETE FROM llx_asset WHERE fk_asset_type IS NOT NULL; + +ALTER TABLE llx_asset DROP COLUMN fk_asset_type; +ALTER TABLE llx_asset DROP COLUMN description; + +ALTER TABLE llx_asset ADD COLUMN fk_asset_model integer AFTER label; +ALTER TABLE llx_asset ADD COLUMN reversal_amount_ht double(24,8) AFTER fk_asset_model; +ALTER TABLE llx_asset ADD COLUMN reversal_date date AFTER recovered_vat; +ALTER TABLE llx_asset ADD COLUMN date_acquisition date NOT NULL AFTER reversal_date; +ALTER TABLE llx_asset ADD COLUMN date_start date NOT NULL AFTER date_acquisition; +ALTER TABLE llx_asset ADD COLUMN qty real DEFAULT 1 NOT NULL AFTER date_start; +ALTER TABLE llx_asset ADD COLUMN acquisition_type smallint DEFAULT 0 NOT NULL AFTER qty; +ALTER TABLE llx_asset ADD COLUMN asset_type smallint DEFAULT 0 NOT NULL AFTER acquisition_type; +ALTER TABLE llx_asset ADD COLUMN not_depreciated integer(1) DEFAULT 0 AFTER asset_type; +ALTER TABLE llx_asset ADD COLUMN disposal_date date AFTER not_depreciated; +ALTER TABLE llx_asset ADD COLUMN disposal_amount_ht double(24,8) AFTER disposal_date; +ALTER TABLE llx_asset ADD COLUMN fk_disposal_type integer AFTER disposal_amount_ht; +ALTER TABLE llx_asset ADD COLUMN disposal_depreciated integer(1) DEFAULT 0 AFTER fk_disposal_type; +ALTER TABLE llx_asset ADD COLUMN disposal_subject_to_vat integer(1) DEFAULT 0 AFTER disposal_depreciated; +ALTER TABLE llx_asset ADD COLUMN last_main_doc varchar(255) AFTER fk_user_modif; +ALTER TABLE llx_asset ADD COLUMN model_pdf varchar(255) AFTER import_key; + +DROP TABLE llx_asset_type; + +CREATE TABLE llx_c_asset_disposal_type +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + code varchar(16) NOT NULL, + label varchar(50) NOT NULL, + active integer DEFAULT 1 NOT NULL +)ENGINE=innodb; + +CREATE TABLE llx_asset_accountancy_codes_economic( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + asset varchar(32), + depreciation_asset varchar(32), + depreciation_expense varchar(32), + value_asset_sold varchar(32), + receivable_on_assignment varchar(32), + proceeds_from_sales varchar(32), + vat_collected varchar(32), + vat_deductible varchar(32), + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; + +CREATE TABLE llx_asset_accountancy_codes_fiscal( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + accelerated_depreciation varchar(32), + endowment_accelerated_depreciation varchar(32), + provision_accelerated_depreciation varchar(32), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; + +CREATE TABLE llx_asset_depreciation_options_economic( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional + accelerated_depreciation_option integer(1), -- activate accelerated depreciation mode (fiscal) + + degressive_coefficient double(24,8), + duration smallint NOT NULL, + duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily + + amount_base_depreciation_ht double(24,8), + amount_base_deductible_ht double(24,8), + total_amount_last_depreciation_ht double(24,8), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; + +CREATE TABLE llx_asset_depreciation_options_fiscal( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional + + degressive_coefficient double(24,8), + duration smallint NOT NULL, + duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily + + amount_base_depreciation_ht double(24,8), + amount_base_deductible_ht double(24,8), + total_amount_last_depreciation_ht double(24,8), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; + +CREATE TABLE llx_asset_depreciation( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + + fk_asset integer NOT NULL, + depreciation_mode varchar(255) NOT NULL, -- (economic, fiscal or other) + + ref varchar(255) NOT NULL, + depreciation_date datetime NOT NULL, + depreciation_ht double(24,8) NOT NULL, + cumulative_depreciation_ht double(24,8) NOT NULL, + + accountancy_code_debit varchar(32), + accountancy_code_credit varchar(32), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; + +CREATE TABLE llx_asset_model( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + ref varchar(128) NOT NULL, + label varchar(255) NOT NULL, + + asset_type smallint NOT NULL, + fk_pays integer DEFAULT 0, + + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status smallint NOT NULL +) ENGINE=innodb; + +CREATE TABLE llx_asset_model_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_c_asset_disposal_type ADD UNIQUE INDEX uk_c_asset_disposal_type(code, entity); + +ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_model (fk_asset_model); +ALTER TABLE llx_asset ADD INDEX idx_asset_fk_disposal_type (fk_disposal_type); + +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_disposal_type FOREIGN KEY (fk_disposal_type) REFERENCES llx_c_asset_disposal_type (rowid); +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); + +ALTER TABLE llx_asset_accountancy_codes_economic ADD INDEX idx_asset_ace_rowid (rowid); +ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset (fk_asset); +ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); + +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD INDEX idx_asset_acf_rowid (rowid); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset (fk_asset); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); + +ALTER TABLE llx_asset_depreciation_options_economic ADD INDEX idx_asset_doe_rowid (rowid); +ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset (fk_asset); +ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); + +ALTER TABLE llx_asset_depreciation_options_fiscal ADD INDEX idx_asset_dof_rowid (rowid); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset (fk_asset); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); + +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_rowid (rowid); +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_fk_asset (fk_asset); +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_depreciation_mode (depreciation_mode); +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_ref (ref); +ALTER TABLE llx_asset_depreciation ADD UNIQUE uk_asset_depreciation_fk_asset (fk_asset, depreciation_mode, ref); + +ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); + +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_rowid (rowid); +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_ref (ref); +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_pays (fk_pays); +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_entity (entity); +ALTER TABLE llx_asset_model ADD UNIQUE INDEX uk_asset_model (entity, ref); + +ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); +ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); + +ALTER TABLE llx_asset_model_extrafields ADD INDEX idx_asset_model_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_asset-asset.key.sql b/htdocs/install/mysql/tables/llx_asset-asset.key.sql index a82f29ee58b..6175ed8a2b7 100644 --- a/htdocs/install/mysql/tables/llx_asset-asset.key.sql +++ b/htdocs/install/mysql/tables/llx_asset-asset.key.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Alexandre Spangaro +-- ======================================================================== +-- Copyright (C) 2018-2022 OpenDSI -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -12,12 +13,12 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== +ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_model (fk_asset_model); +ALTER TABLE llx_asset ADD INDEX idx_asset_fk_disposal_type (fk_disposal_type); -ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid); -ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref); -ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity); - -ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type); -ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid); - +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_disposal_type FOREIGN KEY (fk_disposal_type) REFERENCES llx_c_asset_disposal_type (rowid); +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); +ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_asset-asset.sql b/htdocs/install/mysql/tables/llx_asset-asset.sql index 52eeda3ba58..0366c306ac8 100644 --- a/htdocs/install/mysql/tables/llx_asset-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset-asset.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Alexandre Spangaro +-- ======================================================================== +-- Copyright (C) 2018-2022 OpenDSI -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -12,23 +13,47 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. - +-- ======================================================================== CREATE TABLE llx_asset( - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - ref varchar(128) NOT NULL, - entity integer DEFAULT 1 NOT NULL, - label varchar(255), - amount_ht double(24,8) DEFAULT NULL, - amount_vat double(24,8) DEFAULT NULL, - fk_asset_type integer NOT NULL, - description text, - note_public text, - note_private text, - date_creation datetime NOT NULL, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_user_creat integer NOT NULL, - fk_user_modif integer, - import_key varchar(14), - status integer NOT NULL + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) NOT NULL, + entity integer DEFAULT 1 NOT NULL, + label varchar(255), + + fk_asset_model integer, + + reversal_amount_ht double(24,8), + acquisition_value_ht double(24,8) DEFAULT NULL, + recovered_vat double(24,8), + + reversal_date date, + + date_acquisition date NOT NULL, + date_start date NOT NULL, + + qty real DEFAULT 1 NOT NULL, + + acquisition_type smallint DEFAULT 0 NOT NULL, + asset_type smallint DEFAULT 0 NOT NULL, + + not_depreciated integer DEFAULT 0, + + disposal_date date, + disposal_amount_ht double(24,8), + fk_disposal_type integer, + disposal_depreciated integer DEFAULT 0, + disposal_subject_to_vat integer DEFAULT 0, + + note_public text, + note_private text, + + date_creation datetime NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + last_main_doc varchar(255), + import_key varchar(14), + model_pdf varchar(255), + status integer NOT NULL ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.key.sql new file mode 100644 index 00000000000..69bc6754f65 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.key.sql @@ -0,0 +1,24 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +ALTER TABLE llx_asset_accountancy_codes_economic ADD INDEX idx_asset_ace_rowid (rowid); +ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset (fk_asset); +ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql new file mode 100644 index 00000000000..013b70ef1e9 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql @@ -0,0 +1,33 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +CREATE TABLE llx_asset_accountancy_codes_economic( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + asset varchar(32), + depreciation_asset varchar(32), + depreciation_expense varchar(32), + value_asset_sold varchar(32), + receivable_on_assignment varchar(32), + proceeds_from_sales varchar(32), + vat_collected varchar(32), + vat_deductible varchar(32), + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.key.sql new file mode 100644 index 00000000000..f7a4109b9fa --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.key.sql @@ -0,0 +1,24 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD INDEX idx_asset_acf_rowid (rowid); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset (fk_asset); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql new file mode 100644 index 00000000000..9ab80facab0 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql @@ -0,0 +1,29 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +CREATE TABLE llx_asset_accountancy_codes_fiscal( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + accelerated_depreciation varchar(32), + endowment_accelerated_depreciation varchar(32), + provision_accelerated_depreciation varchar(32), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.key.sql new file mode 100644 index 00000000000..531f88d72ba --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.key.sql @@ -0,0 +1,25 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_rowid (rowid); +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_fk_asset (fk_asset); +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_depreciation_mode (depreciation_mode); +ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_ref (ref); +ALTER TABLE llx_asset_depreciation ADD UNIQUE uk_asset_depreciation_fk_asset (fk_asset, depreciation_mode, ref); + +ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql new file mode 100644 index 00000000000..5171f3ca6f2 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql @@ -0,0 +1,34 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +CREATE TABLE llx_asset_depreciation( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + + fk_asset integer NOT NULL, + depreciation_mode varchar(255) NOT NULL, -- (economic, fiscal or other) + + ref varchar(255) NOT NULL, + depreciation_date datetime NOT NULL, + depreciation_ht double(24,8) NOT NULL, + cumulative_depreciation_ht double(24,8) NOT NULL, + + accountancy_code_debit varchar(32), + accountancy_code_credit varchar(32), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.key.sql new file mode 100644 index 00000000000..569e4f286a2 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.key.sql @@ -0,0 +1,24 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +ALTER TABLE llx_asset_depreciation_options_economic ADD INDEX idx_asset_doe_rowid (rowid); +ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset (fk_asset); +ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql new file mode 100644 index 00000000000..1e0028ebaf2 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql @@ -0,0 +1,35 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +CREATE TABLE llx_asset_depreciation_options_economic( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional + accelerated_depreciation_option integer(1), -- activate accelerated depreciation mode (fiscal) + degressive_coefficient double(24,8), + duration smallint NOT NULL, + duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily + + amount_base_depreciation_ht double(24,8), + amount_base_deductible_ht double(24,8), + total_amount_last_depreciation_ht double(24,8), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.key.sql new file mode 100644 index 00000000000..1fb678696d1 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.key.sql @@ -0,0 +1,24 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +ALTER TABLE llx_asset_depreciation_options_fiscal ADD INDEX idx_asset_dof_rowid (rowid); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset (fk_asset); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset_model (fk_asset_model); + +ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid); +ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql new file mode 100644 index 00000000000..ef2346ace5e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql @@ -0,0 +1,34 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +CREATE TABLE llx_asset_depreciation_options_fiscal( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_asset integer, + fk_asset_model integer, + + depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional + degressive_coefficient double(24,8), + duration smallint NOT NULL, + duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily + + amount_base_depreciation_ht double(24,8), + amount_base_deductible_ht double(24,8), + total_amount_last_depreciation_ht double(24,8), + + tms timestamp, + fk_user_modif integer +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql index fe6bb053ed6..5671e2a5b9f 100644 --- a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql +++ b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql @@ -16,5 +16,4 @@ -- -- =================================================================== - ALTER TABLE llx_asset_extrafields ADD INDEX idx_asset_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql index c93fac7b20a..1b111d89ca0 100644 --- a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql @@ -1,3 +1,4 @@ +-- =================================================================== -- Copyright (C) 2018 Alexandre Spangaro -- -- This program is free software; you can redistribute it and/or modify @@ -12,6 +13,7 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. +-- =================================================================== create table llx_asset_extrafields ( @@ -20,4 +22,3 @@ create table llx_asset_extrafields fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; - diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.key.sql new file mode 100644 index 00000000000..5c301e5c147 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_model-asset.key.sql @@ -0,0 +1,25 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- ======================================================================== + +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_rowid (rowid); +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_entity (entity); +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_ref (ref); +ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_pays (fk_pays); +ALTER TABLE llx_asset_model ADD UNIQUE INDEX uk_asset_model (entity, ref); + +ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); +ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.sql new file mode 100644 index 00000000000..576d794f54a --- /dev/null +++ b/htdocs/install/mysql/tables/llx_asset_model-asset.sql @@ -0,0 +1,33 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- ======================================================================== + +CREATE TABLE llx_asset_model( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + ref varchar(128) NOT NULL, + label varchar(255) NOT NULL, + asset_type smallint NOT NULL, + fk_pays integer DEFAULT 0, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status smallint NOT NULL +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_type-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.key.sql similarity index 67% rename from htdocs/install/mysql/tables/llx_asset_type-asset.key.sql rename to htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.key.sql index 4a7c4cb1145..22a6ee89196 100644 --- a/htdocs/install/mysql/tables/llx_asset_type-asset.key.sql +++ b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.key.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Alexandre Spangaro +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -12,5 +13,6 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +-- ======================================================================== -ALTER TABLE llx_asset_type ADD UNIQUE INDEX uk_asset_type_label (label, entity); +ALTER TABLE llx_asset_model_extrafields ADD INDEX idx_asset_model_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.sql b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql similarity index 54% rename from htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.sql rename to htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql index 7ff09176216..007f4fa76ec 100644 --- a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Alexandre Spangaro +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -12,12 +13,12 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +-- ======================================================================== -create table llx_asset_type_extrafields +CREATE TABLE llx_asset_model_extrafields ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_object integer NOT NULL, - import_key varchar(14) -- import key + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key ) ENGINE=innodb; - diff --git a/htdocs/install/mysql/tables/llx_asset_type-asset.sql b/htdocs/install/mysql/tables/llx_asset_type-asset.sql deleted file mode 100644 index 1205acb959b..00000000000 --- a/htdocs/install/mysql/tables/llx_asset_type-asset.sql +++ /dev/null @@ -1,26 +0,0 @@ --- Copyright (C) 2018 Alexandre Spangaro --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . - -create table llx_asset_type -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - label varchar(50) NOT NULL, - accountancy_code_asset varchar(32), - accountancy_code_depreciation_asset varchar(32), - accountancy_code_depreciation_expense varchar(32), - note text -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.key.sql deleted file mode 100644 index ec0b4b28619..00000000000 --- a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.key.sql +++ /dev/null @@ -1,17 +0,0 @@ --- Copyright (C) 2018 Alexandre Spangaro --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . - - -ALTER TABLE llx_asset_type_extrafields ADD INDEX idx_asset_type_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.key.sql b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.key.sql new file mode 100644 index 00000000000..3f588dc506d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.key.sql @@ -0,0 +1,18 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +ALTER TABLE llx_c_asset_disposal_type ADD UNIQUE INDEX uk_c_asset_disposal_type(code, entity); diff --git a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql new file mode 100644 index 00000000000..c3c103850b3 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql @@ -0,0 +1,25 @@ +-- ======================================================================== +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- ======================================================================== + +CREATE TABLE llx_c_asset_disposal_type +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer NOT NULL DEFAULT 1, + code varchar(16) NOT NULL, + label varchar(50) NOT NULL, + active integer DEFAULT 1 NOT NULL +)ENGINE=innodb; From 636a01725ee9feff5ac2286671087c19ee955ed1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 14 Feb 2022 04:11:11 +0100 Subject: [PATCH 02/16] Remove integer(1) --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 8 ++++---- .../llx_asset_depreciation_options_economic-asset.sql | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 40ecda6c3fe..8182cc44d39 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -257,12 +257,12 @@ ALTER TABLE llx_asset ADD COLUMN date_start date NOT NULL AFTER date_acquisition ALTER TABLE llx_asset ADD COLUMN qty real DEFAULT 1 NOT NULL AFTER date_start; ALTER TABLE llx_asset ADD COLUMN acquisition_type smallint DEFAULT 0 NOT NULL AFTER qty; ALTER TABLE llx_asset ADD COLUMN asset_type smallint DEFAULT 0 NOT NULL AFTER acquisition_type; -ALTER TABLE llx_asset ADD COLUMN not_depreciated integer(1) DEFAULT 0 AFTER asset_type; +ALTER TABLE llx_asset ADD COLUMN not_depreciated integer DEFAULT 0 AFTER asset_type; ALTER TABLE llx_asset ADD COLUMN disposal_date date AFTER not_depreciated; ALTER TABLE llx_asset ADD COLUMN disposal_amount_ht double(24,8) AFTER disposal_date; ALTER TABLE llx_asset ADD COLUMN fk_disposal_type integer AFTER disposal_amount_ht; -ALTER TABLE llx_asset ADD COLUMN disposal_depreciated integer(1) DEFAULT 0 AFTER fk_disposal_type; -ALTER TABLE llx_asset ADD COLUMN disposal_subject_to_vat integer(1) DEFAULT 0 AFTER disposal_depreciated; +ALTER TABLE llx_asset ADD COLUMN disposal_depreciated integer DEFAULT 0 AFTER fk_disposal_type; +ALTER TABLE llx_asset ADD COLUMN disposal_subject_to_vat integer DEFAULT 0 AFTER disposal_depreciated; ALTER TABLE llx_asset ADD COLUMN last_main_doc varchar(255) AFTER fk_user_modif; ALTER TABLE llx_asset ADD COLUMN model_pdf varchar(255) AFTER import_key; @@ -313,7 +313,7 @@ CREATE TABLE llx_asset_depreciation_options_economic( fk_asset_model integer, depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional - accelerated_depreciation_option integer(1), -- activate accelerated depreciation mode (fiscal) + accelerated_depreciation_option integer, -- activate accelerated depreciation mode (fiscal) degressive_coefficient double(24,8), duration smallint NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql index 1e0028ebaf2..37dd9c24402 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_asset_depreciation_options_economic( fk_asset_model integer, depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional - accelerated_depreciation_option integer(1), -- activate accelerated depreciation mode (fiscal) + accelerated_depreciation_option integer, -- activate accelerated depreciation mode (fiscal) degressive_coefficient double(24,8), duration smallint NOT NULL, duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily From b7b3a25abacf54c20435b1b7da7d6422fd88cde7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 14 Feb 2022 11:23:03 +0100 Subject: [PATCH 03/16] Fix tms --- .../tables/llx_asset_accountancy_codes_economic-asset.sql | 2 +- .../tables/llx_asset_accountancy_codes_fiscal-asset.sql | 2 +- .../install/mysql/tables/llx_asset_depreciation-asset.sql | 2 +- .../llx_asset_depreciation_options_economic-asset.sql | 2 +- .../llx_asset_depreciation_options_fiscal-asset.sql | 2 +- .../install/mysql/tables/llx_asset_extrafields-asset.sql | 8 ++++---- htdocs/install/mysql/tables/llx_asset_model-asset.sql | 2 +- .../mysql/tables/llx_asset_model_extrafield-asset.sql | 8 ++++---- .../mysql/tables/llx_c_asset_disposal_type-asset.sql | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql index 013b70ef1e9..3cbb8eb175b 100644 --- a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql @@ -28,6 +28,6 @@ CREATE TABLE llx_asset_accountancy_codes_economic( proceeds_from_sales varchar(32), vat_collected varchar(32), vat_deductible varchar(32), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql index 9ab80facab0..db87b2fac3e 100644 --- a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql @@ -24,6 +24,6 @@ CREATE TABLE llx_asset_accountancy_codes_fiscal( endowment_accelerated_depreciation varchar(32), provision_accelerated_depreciation varchar(32), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql index 5171f3ca6f2..bb994f883fb 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql @@ -29,6 +29,6 @@ CREATE TABLE llx_asset_depreciation( accountancy_code_debit varchar(32), accountancy_code_credit varchar(32), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql index 37dd9c24402..88e90fa097f 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql @@ -30,6 +30,6 @@ CREATE TABLE llx_asset_depreciation_options_economic( amount_base_deductible_ht double(24,8), total_amount_last_depreciation_ht double(24,8), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql index ef2346ace5e..7463e448db4 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql @@ -29,6 +29,6 @@ CREATE TABLE llx_asset_depreciation_options_fiscal( amount_base_deductible_ht double(24,8), total_amount_last_depreciation_ht double(24,8), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql index 1b111d89ca0..57406ca5a6c 100644 --- a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql @@ -17,8 +17,8 @@ create table llx_asset_extrafields ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_object integer NOT NULL, - import_key varchar(14) -- import key + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.sql index 576d794f54a..5ddee8a0dc6 100644 --- a/htdocs/install/mysql/tables/llx_asset_model-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_model-asset.sql @@ -25,7 +25,7 @@ CREATE TABLE llx_asset_model( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), diff --git a/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql index 007f4fa76ec..18d13b89f72 100644 --- a/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql @@ -17,8 +17,8 @@ CREATE TABLE llx_asset_model_extrafields ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_object integer NOT NULL, - import_key varchar(14) -- import key + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql index c3c103850b3..ebcaef02ac9 100644 --- a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql +++ b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql @@ -18,8 +18,8 @@ CREATE TABLE llx_c_asset_disposal_type ( rowid integer AUTO_INCREMENT PRIMARY KEY, - entity integer NOT NULL DEFAULT 1, + entity integer NOT NULL DEFAULT 1, code varchar(16) NOT NULL, label varchar(50) NOT NULL, - active integer DEFAULT 1 NOT NULL + active integer DEFAULT 1 NOT NULL )ENGINE=innodb; From 4985b98bd52dc1b98b0d8632f29b0f703976659a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 14 Feb 2022 12:02:50 +0100 Subject: [PATCH 04/16] Fix tms --- .../install/mysql/migration/15.0.0-16.0.0.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 8182cc44d39..1574281908d 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -290,7 +290,7 @@ CREATE TABLE llx_asset_accountancy_codes_economic( proceeds_from_sales varchar(32), vat_collected varchar(32), vat_deductible varchar(32), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; @@ -303,7 +303,7 @@ CREATE TABLE llx_asset_accountancy_codes_fiscal( endowment_accelerated_depreciation varchar(32), provision_accelerated_depreciation varchar(32), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; @@ -323,7 +323,7 @@ CREATE TABLE llx_asset_depreciation_options_economic( amount_base_deductible_ht double(24,8), total_amount_last_depreciation_ht double(24,8), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; @@ -342,7 +342,7 @@ CREATE TABLE llx_asset_depreciation_options_fiscal( amount_base_deductible_ht double(24,8), total_amount_last_depreciation_ht double(24,8), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; @@ -360,7 +360,7 @@ CREATE TABLE llx_asset_depreciation( accountancy_code_debit varchar(32), accountancy_code_credit varchar(32), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; @@ -376,7 +376,7 @@ CREATE TABLE llx_asset_model( note_public text, note_private text, date_creation datetime NOT NULL, - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer NOT NULL, fk_user_modif integer, import_key varchar(14), @@ -385,9 +385,9 @@ CREATE TABLE llx_asset_model( CREATE TABLE llx_asset_model_extrafields ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_object integer NOT NULL, + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, import_key varchar(14) -- import key ) ENGINE=innodb; From 84900ceab7769f6b9e9d3c7533e837512707d3e6 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 21 May 2022 07:55:48 +0200 Subject: [PATCH 05/16] Add documentation and data example on table --- .../install/mysql/tables/llx_asset-asset.sql | 6 ++ ...asset_accountancy_codes_economic-asset.sql | 6 ++ ...x_asset_accountancy_codes_fiscal-asset.sql | 6 ++ .../tables/llx_asset_depreciation-asset.sql | 68 ++++++++++++++++++- ...et_depreciation_options_economic-asset.sql | 6 ++ ...sset_depreciation_options_fiscal-asset.sql | 6 ++ .../tables/llx_asset_extrafields-asset.sql | 3 + .../mysql/tables/llx_asset_model-asset.sql | 6 ++ .../llx_asset_model_extrafield-asset.sql | 3 + .../llx_c_asset_disposal_type-asset.sql | 2 + 10 files changed, 111 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_asset-asset.sql b/htdocs/install/mysql/tables/llx_asset-asset.sql index 0366c306ac8..97ceaf2a686 100644 --- a/htdocs/install/mysql/tables/llx_asset-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset-asset.sql @@ -14,6 +14,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -- ======================================================================== +-- +-- Table for fixed asset +-- +-- Data example: +-- INSERT INTO `llx_asset` (`rowid`, `ref`, `entity`, `label`, `fk_asset_model`, `reversal_amount_ht`, `acquisition_value_ht`, `recovered_vat`, `reversal_date`, `date_acquisition`, `date_start`, `qty`, `acquisition_type`, `asset_type`, `not_depreciated`, `disposal_date`, `disposal_amount_ht`, `fk_disposal_type`, `disposal_depreciated`, `disposal_subject_to_vat`, `note_public`, `note_private`, `date_creation`, `tms`, `fk_user_creat`, `fk_user_modif`, `last_main_doc`, `import_key`, `model_pdf`, `status`) VALUES +-- (1, 'LAPTOP', 1, 'LAPTOP xxx for accountancy department', 1, NULL, 1000.00000000, NULL, NULL, '2022-01-18', '2022-01-20', 0, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2022-01-18 14:31:21', '2022-03-09 14:09:46', 1, 1, NULL, NULL, NULL, 0); CREATE TABLE llx_asset( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql index 3cbb8eb175b..fc799154421 100644 --- a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql @@ -14,6 +14,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -- ======================================================================== +-- +-- Table to store the configuration of the accounting accounts of a fixed asset for economic status +-- +-- Data example: +-- INSERT INTO `llx_asset_accountancy_codes_economic` (`rowid`, `fk_asset`, `fk_asset_model`, `asset`, `depreciation_asset`, `depreciation_expense`, `value_asset_sold`, `receivable_on_assignment`, `proceeds_from_sales`, `vat_collected`, `vat_deductible`, `tms`, `fk_user_modif`) VALUES +-- (2, 1, NULL, '2183', '2818', '68112', '675', '465', '775', '44571', '44562', '2022-01-18 14:20:20', 1); CREATE TABLE llx_asset_accountancy_codes_economic( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql index db87b2fac3e..d8229184077 100644 --- a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql @@ -14,6 +14,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -- ======================================================================== +-- +-- Table to store the configuration of the accounting accounts of a fixed asset for fiscal status +-- +-- Data example: +-- INSERT INTO `llx_asset_accountancy_codes_fiscal` (`rowid`, `fk_asset`, `fk_asset_model`, `accelerated_depreciation`, `endowment_accelerated_depreciation`, `provision_accelerated_depreciation`, `tms`, `fk_user_modif`) VALUES +-- (2, 1, NULL, NULL, NULL, NULL, '2022-01-18 14:20:20', 1); CREATE TABLE llx_asset_accountancy_codes_fiscal( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql index bb994f883fb..f58b2c8cc5c 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql @@ -13,7 +13,73 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. --- ======================================================================== +-- ========================================================================. +-- +-- Table to store depreciation of a fixed asset +-- +-- Data example: +-- INSERT INTO `llx_asset_depreciation` (`rowid`, `fk_asset`, `depreciation_mode`, `ref`, `depreciation_date`, `depreciation_ht`, `cumulative_depreciation_ht`, `accountancy_code_debit`, `accountancy_code_credit`, `tms`, `fk_user_modif`) VALUES +-- (194, 1, 'economic', '2022-01', '2022-01-31 23:59:59', 2.00000000, 2.00000000, '2818', '68112', '2022-03-09 14:10:29', NULL), +-- (195, 1, 'economic', '2022-02', '2022-02-28 23:59:59', 5.00000000, 7.00000000, '2818', '68112', '2022-03-09 14:10:29', NULL), +-- (314, 1, 'economic', '2022-03', '2022-03-31 23:59:59', 8.33000000, 15.33000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (315, 1, 'economic', '2022-04', '2022-04-30 23:59:59', 8.33000000, 23.66000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (316, 1, 'economic', '2022-05', '2022-05-31 23:59:59', 8.33000000, 31.99000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (317, 1, 'economic', '2022-06', '2022-06-30 23:59:59', 8.33000000, 40.32000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (318, 1, 'economic', '2022-07', '2022-07-31 23:59:59', 8.33000000, 48.65000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (319, 1, 'economic', '2022-08', '2022-08-31 23:59:59', 8.33000000, 56.98000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (320, 1, 'economic', '2022-09', '2022-09-30 23:59:59', 8.33000000, 65.31000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (321, 1, 'economic', '2022-10', '2022-10-31 23:59:59', 8.33000000, 73.64000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (322, 1, 'economic', '2022-11', '2022-11-30 23:59:59', 8.33000000, 81.97000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (323, 1, 'economic', '2022-12', '2022-12-31 23:59:59', 8.33000000, 90.30000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (324, 1, 'economic', '2023-01', '2023-01-31 23:59:59', 8.33000000, 98.63000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (325, 1, 'economic', '2023-02', '2023-02-28 23:59:59', 8.33000000, 106.96000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (326, 1, 'economic', '2023-03', '2023-03-31 23:59:59', 8.33000000, 115.29000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (327, 1, 'economic', '2023-04', '2023-04-30 23:59:59', 8.33000000, 123.62000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (328, 1, 'economic', '2023-05', '2023-05-31 23:59:59', 8.33000000, 131.95000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (329, 1, 'economic', '2023-06', '2023-06-30 23:59:59', 8.33000000, 140.28000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (330, 1, 'economic', '2023-07', '2023-07-31 23:59:59', 8.33000000, 148.61000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (331, 1, 'economic', '2023-08', '2023-08-31 23:59:59', 8.33000000, 156.94000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (332, 1, 'economic', '2023-09', '2023-09-30 23:59:59', 8.33000000, 165.27000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (333, 1, 'economic', '2023-10', '2023-10-31 23:59:59', 8.33000000, 173.60000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (334, 1, 'economic', '2023-11', '2023-11-30 23:59:59', 8.33000000, 181.93000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (335, 1, 'economic', '2023-12', '2023-12-31 23:59:59', 8.33000000, 190.26000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (336, 1, 'economic', '2024-01', '2024-01-31 23:59:59', 8.33000000, 198.59000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (337, 1, 'economic', '2024-02', '2024-02-29 23:59:59', 8.33000000, 206.92000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (338, 1, 'economic', '2024-03', '2024-03-31 23:59:59', 8.33000000, 215.25000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (339, 1, 'economic', '2024-04', '2024-04-30 23:59:59', 8.33000000, 223.58000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (340, 1, 'economic', '2024-05', '2024-05-31 23:59:59', 8.33000000, 231.91000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (341, 1, 'economic', '2024-06', '2024-06-30 23:59:59', 8.33000000, 240.24000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (342, 1, 'economic', '2024-07', '2024-07-31 23:59:59', 8.33000000, 248.57000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (343, 1, 'economic', '2024-08', '2024-08-31 23:59:59', 8.33000000, 256.90000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (344, 1, 'economic', '2024-09', '2024-09-30 23:59:59', 8.33000000, 265.23000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (345, 1, 'economic', '2024-10', '2024-10-31 23:59:59', 8.33000000, 273.56000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (346, 1, 'economic', '2024-11', '2024-11-30 23:59:59', 8.33000000, 281.89000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (347, 1, 'economic', '2024-12', '2024-12-31 23:59:59', 8.33000000, 290.22000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (348, 1, 'economic', '2025-01', '2025-01-31 23:59:59', 8.33000000, 298.55000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (349, 1, 'economic', '2025-02', '2025-02-28 23:59:59', 8.33000000, 306.88000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (350, 1, 'economic', '2025-03', '2025-03-31 23:59:59', 8.33000000, 315.21000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (351, 1, 'economic', '2025-04', '2025-04-30 23:59:59', 8.33000000, 323.54000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (352, 1, 'economic', '2025-05', '2025-05-31 23:59:59', 8.33000000, 331.87000000, '2818', '68112', '2022-03-09 14:15:48', NULL), +-- (353, 1, 'economic', '2025-06', '2025-06-30 23:59:59', 8.33000000, 340.20000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (354, 1, 'economic', '2025-07', '2025-07-31 23:59:59', 8.33000000, 348.53000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (355, 1, 'economic', '2025-08', '2025-08-31 23:59:59', 8.33000000, 356.86000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (356, 1, 'economic', '2025-09', '2025-09-30 23:59:59', 8.33000000, 365.19000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (357, 1, 'economic', '2025-10', '2025-10-31 23:59:59', 8.33000000, 373.52000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (358, 1, 'economic', '2025-11', '2025-11-30 23:59:59', 8.33000000, 381.85000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (359, 1, 'economic', '2025-12', '2025-12-31 23:59:59', 8.33000000, 390.18000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (360, 1, 'economic', '2026-01', '2026-01-31 23:59:59', 8.33000000, 398.51000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (361, 1, 'economic', '2026-02', '2026-02-28 23:59:59', 8.33000000, 406.84000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (362, 1, 'economic', '2026-03', '2026-03-31 23:59:59', 8.33000000, 415.17000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (363, 1, 'economic', '2026-04', '2026-04-30 23:59:59', 8.33000000, 423.50000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (364, 1, 'economic', '2026-05', '2026-05-31 23:59:59', 8.33000000, 431.83000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (365, 1, 'economic', '2026-06', '2026-06-30 23:59:59', 8.33000000, 440.16000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (366, 1, 'economic', '2026-07', '2026-07-31 23:59:59', 8.33000000, 448.49000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (367, 1, 'economic', '2026-08', '2026-08-31 23:59:59', 8.33000000, 456.82000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (368, 1, 'economic', '2026-09', '2026-09-30 23:59:59', 8.33000000, 465.15000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (369, 1, 'economic', '2026-10', '2026-10-31 23:59:59', 8.33000000, 473.48000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (370, 1, 'economic', '2026-11', '2026-11-30 23:59:59', 8.33000000, 481.81000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (371, 1, 'economic', '2026-12', '2026-12-31 23:59:59', 8.33000000, 490.14000000, '2818', '68112', '2022-03-09 14:15:49', NULL), +-- (372, 1, 'economic', '2027-01', '2027-01-31 23:59:59', 9.86000000, 500.00000000, '2818', '68112', '2022-03-09 14:15:49', NULL); CREATE TABLE llx_asset_depreciation( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql index 88e90fa097f..c34fca1b043 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql @@ -14,6 +14,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -- ======================================================================== +-- +-- Table to store economical depreciation of a fixed asset +-- +-- Data example: +-- INSERT INTO `llx_asset_depreciation_options_economic` (`rowid`, `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 +-- (11, 1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1); CREATE TABLE llx_asset_depreciation_options_economic( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql index 7463e448db4..0a52c26eaaa 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql @@ -14,6 +14,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -- ======================================================================== +-- +-- Table to store fiscal depreciation of a fixed asset +-- +-- Data example: +-- INSERT INTO `llx_asset_depreciation_options_fiscal` (`rowid`, `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 +-- (1, 1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1); CREATE TABLE llx_asset_depreciation_options_fiscal( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql index 57406ca5a6c..95cae4315da 100644 --- a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql @@ -14,6 +14,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -- =================================================================== +-- +-- Table for extrafields of fixed asset +-- create table llx_asset_extrafields ( diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.sql index 5ddee8a0dc6..059bbb92ace 100644 --- a/htdocs/install/mysql/tables/llx_asset_model-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_model-asset.sql @@ -14,6 +14,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- ======================================================================== +-- +-- Table for fixed asset model +-- +-- Data example: +-- INSERT INTO `llx_asset_model` (`rowid`, `entity`, `ref`, `label`, `asset_type`, `note_public`, `note_private`, `date_creation`, `tms`, `fk_user_creat`, `fk_user_modif`, `import_key`, `status`) VALUES +-- (1, 1, 'LAPTOP', 'Laptop', 1, NULL, NULL, '2022-01-18 14:27:09', '2022-01-24 09:31:49', 1, 1, NULL, 1); CREATE TABLE llx_asset_model( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql index 18d13b89f72..1f42d83fc57 100644 --- a/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql @@ -14,6 +14,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- ======================================================================== +-- +-- Table for extrafields of fixed asset model +-- CREATE TABLE llx_asset_model_extrafields ( diff --git a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql index ebcaef02ac9..6eba1e75f14 100644 --- a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql +++ b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql @@ -14,6 +14,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -- ======================================================================== +-- +-- Table to store disposal type for a fixed asset CREATE TABLE llx_c_asset_disposal_type ( From f25041f577428ff9c92801331b75a4d56600b4fb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 21 May 2022 18:31:05 +0200 Subject: [PATCH 06/16] Add disposal type data --- .../mysql/data/llx_c_asset_disposal_type.sql | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 htdocs/install/mysql/data/llx_c_asset_disposal_type.sql diff --git a/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql new file mode 100644 index 00000000000..4dc90a701d5 --- /dev/null +++ b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql @@ -0,0 +1,25 @@ +-- Copyright (C) 2022 OpenDSI +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- + +-- +-- Do not include comments at end of line, this file is parsed during install and string '--' are removed. +-- + +INSERT INTO `llx_c_asset_disposal_type` (`rowid`, `entity`, `code`, `label`, `active`) VALUES +(1, 1, 'C', 'Vente', 1), +(2, 1, 'HS', 'Mise hors service', 1), +(3, 1, 'D', 'Destruction', 1); From 1be9375b96c9fd254147c7c2f8122be3ae3143d8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 21 May 2022 18:45:10 +0200 Subject: [PATCH 07/16] In english --- htdocs/install/mysql/data/llx_c_asset_disposal_type.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql index 4dc90a701d5..5ca253c476e 100644 --- a/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql +++ b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql @@ -20,6 +20,6 @@ -- INSERT INTO `llx_c_asset_disposal_type` (`rowid`, `entity`, `code`, `label`, `active`) VALUES -(1, 1, 'C', 'Vente', 1), -(2, 1, 'HS', 'Mise hors service', 1), +(1, 1, 'C', 'Sale', 1), +(2, 1, 'HS', 'Putting out of service', 1), (3, 1, 'D', 'Destruction', 1); From 512441bbf4f47452c102a5e393a6d4c6358f053f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 19 Jun 2022 06:07:03 +0200 Subject: [PATCH 08/16] Review structure data on dictionary c_asset_disposal_type --- htdocs/install/mysql/data/llx_c_asset_disposal_type.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql index 5ca253c476e..4951b9df198 100644 --- a/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql +++ b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql @@ -19,7 +19,6 @@ -- Do not include comments at end of line, this file is parsed during install and string '--' are removed. -- -INSERT INTO `llx_c_asset_disposal_type` (`rowid`, `entity`, `code`, `label`, `active`) VALUES -(1, 1, 'C', 'Sale', 1), -(2, 1, 'HS', 'Putting out of service', 1), -(3, 1, 'D', 'Destruction', 1); +INSERT INTO llx_c_asset_disposal_type (rowid, entity, code, label, active) VALUES (1, 1, 'C', 'Sale', 1); +INSERT INTO llx_c_asset_disposal_type (rowid, entity, code, label, active) VALUES (2, 1, 'HS', 'Putting out of service', 1); +INSERT INTO llx_c_asset_disposal_type (rowid, entity, code, label, active) VALUES (3, 1, 'D', 'Destruction', 1); From 1e1d78037e149576990572617710bb4c44ebbba5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 19 Jun 2022 06:10:04 +0200 Subject: [PATCH 09/16] Change comment on llx_asset_accountancy_codes_economic-asset.sql --- .../tables/llx_asset_accountancy_codes_economic-asset.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql index fc799154421..e81b9d60c7f 100644 --- a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql @@ -15,7 +15,8 @@ -- along with this program. If not, see https://www.gnu.org/licenses/. -- ======================================================================== -- --- Table to store the configuration of the accounting accounts of a fixed asset for economic status +-- Table to store the configuration of the accounting accounts of a fixed asset for economic status (fk_asset will be filled and fk_asset_model will be null) +-- or to store the configuration of the accounting accounts for templates of asset (fk_asset_model will be filled and fk_asset will be null) -- -- Data example: -- INSERT INTO `llx_asset_accountancy_codes_economic` (`rowid`, `fk_asset`, `fk_asset_model`, `asset`, `depreciation_asset`, `depreciation_expense`, `value_asset_sold`, `receivable_on_assignment`, `proceeds_from_sales`, `vat_collected`, `vat_deductible`, `tms`, `fk_user_modif`) VALUES From 3f43ba0bc0e1dc2ca8f34370d1d8a7565ed9a5b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jun 2022 17:17:31 +0200 Subject: [PATCH 10/16] Update llx_asset-asset.sql --- .../install/mysql/tables/llx_asset-asset.sql | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset-asset.sql b/htdocs/install/mysql/tables/llx_asset-asset.sql index 97ceaf2a686..2eed188bc14 100644 --- a/htdocs/install/mysql/tables/llx_asset-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset-asset.sql @@ -18,20 +18,20 @@ -- Table for fixed asset -- -- Data example: --- INSERT INTO `llx_asset` (`rowid`, `ref`, `entity`, `label`, `fk_asset_model`, `reversal_amount_ht`, `acquisition_value_ht`, `recovered_vat`, `reversal_date`, `date_acquisition`, `date_start`, `qty`, `acquisition_type`, `asset_type`, `not_depreciated`, `disposal_date`, `disposal_amount_ht`, `fk_disposal_type`, `disposal_depreciated`, `disposal_subject_to_vat`, `note_public`, `note_private`, `date_creation`, `tms`, `fk_user_creat`, `fk_user_modif`, `last_main_doc`, `import_key`, `model_pdf`, `status`) VALUES --- (1, 'LAPTOP', 1, 'LAPTOP xxx for accountancy department', 1, NULL, 1000.00000000, NULL, NULL, '2022-01-18', '2022-01-20', 0, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2022-01-18 14:31:21', '2022-03-09 14:09:46', 1, 1, NULL, NULL, NULL, 0); +-- INSERT INTO llx_asset (ref, entity, label, fk_asset_model, reversal_amount_ht, acquisition_value_ht, recovered_vat, reversal_date, date_acquisition, date_start, qty, acquisition_type, asset_type, not_depreciated, disposal_date, disposal_amount_ht, fk_disposal_type, disposal_depreciated, disposal_subject_to_vat, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status) VALUES +-- ('LAPTOP', 1, 'LAPTOP xxx for accountancy department', 1, NULL, 1000.00000000, NULL, NULL, '2022-01-18', '2022-01-20', 0, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2022-01-18 14:31:21', '2022-03-09 14:09:46', 1, 1, NULL, NULL, NULL, 0); CREATE TABLE llx_asset( - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - ref varchar(128) NOT NULL, - entity integer DEFAULT 1 NOT NULL, - label varchar(255), + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) NOT NULL, + entity integer DEFAULT 1 NOT NULL, + label varchar(255), fk_asset_model integer, reversal_amount_ht double(24,8), acquisition_value_ht double(24,8) DEFAULT NULL, - recovered_vat double(24,8), + recovered_vat double(24,8), reversal_date date, @@ -51,15 +51,15 @@ CREATE TABLE llx_asset( disposal_depreciated integer DEFAULT 0, disposal_subject_to_vat integer DEFAULT 0, - note_public text, - note_private text, + note_public text, + note_private text, - date_creation datetime NOT NULL, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_user_creat integer NOT NULL, - fk_user_modif integer, - last_main_doc varchar(255), - import_key varchar(14), - model_pdf varchar(255), - status integer NOT NULL + date_creation datetime NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + last_main_doc varchar(255), + import_key varchar(14), + model_pdf varchar(255), + status integer NOT NULL ) ENGINE=innodb; From d9bd1638befa9248e199dbfd81154f28aecb8ea3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jun 2022 17:19:43 +0200 Subject: [PATCH 11/16] Update llx_asset_accountancy_codes_economic-asset.sql --- .../tables/llx_asset_accountancy_codes_economic-asset.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql index e81b9d60c7f..30969e59916 100644 --- a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql @@ -19,8 +19,8 @@ -- or to store the configuration of the accounting accounts for templates of asset (fk_asset_model will be filled and fk_asset will be null) -- -- Data example: --- INSERT INTO `llx_asset_accountancy_codes_economic` (`rowid`, `fk_asset`, `fk_asset_model`, `asset`, `depreciation_asset`, `depreciation_expense`, `value_asset_sold`, `receivable_on_assignment`, `proceeds_from_sales`, `vat_collected`, `vat_deductible`, `tms`, `fk_user_modif`) VALUES --- (2, 1, NULL, '2183', '2818', '68112', '675', '465', '775', '44571', '44562', '2022-01-18 14:20:20', 1); +-- INSERT INTO llx_asset_accountancy_codes_economic (fk_asset, fk_asset_model, asset, depreciation_asset, depreciation_expense, value_asset_sold, receivable_on_assignment, proceeds_from_sales, vat_collected, vat_deductible, tms, fk_user_modif) VALUES +-- (1, NULL, '2183', '2818', '68112', '675', '465', '775', '44571', '44562', '2022-01-18 14:20:20', 1); CREATE TABLE llx_asset_accountancy_codes_economic( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, From 16c9c7f54a432ad35115792125ecf81e2cb7523d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jun 2022 17:20:44 +0200 Subject: [PATCH 12/16] Update llx_asset_accountancy_codes_fiscal-asset.sql --- .../mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql index d8229184077..9c005727f81 100644 --- a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql @@ -18,8 +18,8 @@ -- Table to store the configuration of the accounting accounts of a fixed asset for fiscal status -- -- Data example: --- INSERT INTO `llx_asset_accountancy_codes_fiscal` (`rowid`, `fk_asset`, `fk_asset_model`, `accelerated_depreciation`, `endowment_accelerated_depreciation`, `provision_accelerated_depreciation`, `tms`, `fk_user_modif`) VALUES --- (2, 1, NULL, NULL, NULL, NULL, '2022-01-18 14:20:20', 1); +-- INSERT INTO llx_asset_accountancy_codes_fiscal (fk_asset, fk_asset_model, accelerated_depreciation, endowment_accelerated_depreciation, provision_accelerated_depreciation, tms, fk_user_modif) VALUES +-- (1, NULL, NULL, NULL, NULL, '2022-01-18 14:20:20', 1); CREATE TABLE llx_asset_accountancy_codes_fiscal( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, From bc9159e3c89037fd7cc64f258a7de1bf1d26be4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jun 2022 17:21:54 +0200 Subject: [PATCH 13/16] Update llx_asset_depreciation-asset.sql --- htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql index f58b2c8cc5c..0347e8d112d 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql @@ -18,7 +18,7 @@ -- Table to store depreciation of a fixed asset -- -- Data example: --- INSERT INTO `llx_asset_depreciation` (`rowid`, `fk_asset`, `depreciation_mode`, `ref`, `depreciation_date`, `depreciation_ht`, `cumulative_depreciation_ht`, `accountancy_code_debit`, `accountancy_code_credit`, `tms`, `fk_user_modif`) VALUES +-- INSERT INTO llx_asset_depreciation (rowid, fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit, tms, fk_user_modif) VALUES -- (194, 1, 'economic', '2022-01', '2022-01-31 23:59:59', 2.00000000, 2.00000000, '2818', '68112', '2022-03-09 14:10:29', NULL), -- (195, 1, 'economic', '2022-02', '2022-02-28 23:59:59', 5.00000000, 7.00000000, '2818', '68112', '2022-03-09 14:10:29', NULL), -- (314, 1, 'economic', '2022-03', '2022-03-31 23:59:59', 8.33000000, 15.33000000, '2818', '68112', '2022-03-09 14:15:48', NULL), @@ -95,6 +95,6 @@ CREATE TABLE llx_asset_depreciation( accountancy_code_debit varchar(32), accountancy_code_credit varchar(32), - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_modif integer ) ENGINE=innodb; From 06023b913963e3f755ce1d509864cab0aa582c77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jun 2022 17:22:59 +0200 Subject: [PATCH 14/16] Update llx_asset_depreciation_options_economic-asset.sql --- .../tables/llx_asset_depreciation_options_economic-asset.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql index c34fca1b043..e23a2ed1414 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql @@ -18,8 +18,8 @@ -- Table to store economical depreciation of a fixed asset -- -- Data example: --- INSERT INTO `llx_asset_depreciation_options_economic` (`rowid`, `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 --- (11, 1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1); +-- 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 +-- (1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1); CREATE TABLE llx_asset_depreciation_options_economic( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, From e0149f3f033bb0249a4e3eca347d9cc9917edcb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jun 2022 17:24:00 +0200 Subject: [PATCH 15/16] Update llx_asset_depreciation_options_fiscal-asset.sql --- .../tables/llx_asset_depreciation_options_fiscal-asset.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql index 0a52c26eaaa..3d9d5e9d091 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql @@ -18,8 +18,8 @@ -- Table to store fiscal depreciation of a fixed asset -- -- Data example: --- INSERT INTO `llx_asset_depreciation_options_fiscal` (`rowid`, `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 --- (1, 1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1); +-- INSERT INTO llx_asset_depreciation_options_fiscal (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 +-- (1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1); CREATE TABLE llx_asset_depreciation_options_fiscal( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, From f24099a13f7dae519f71079849113eb48c96d32d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jun 2022 17:25:16 +0200 Subject: [PATCH 16/16] Update llx_asset_model-asset.sql --- htdocs/install/mysql/tables/llx_asset_model-asset.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.sql index 059bbb92ace..8c285515986 100644 --- a/htdocs/install/mysql/tables/llx_asset_model-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_model-asset.sql @@ -18,8 +18,8 @@ -- Table for fixed asset model -- -- Data example: --- INSERT INTO `llx_asset_model` (`rowid`, `entity`, `ref`, `label`, `asset_type`, `note_public`, `note_private`, `date_creation`, `tms`, `fk_user_creat`, `fk_user_modif`, `import_key`, `status`) VALUES --- (1, 1, 'LAPTOP', 'Laptop', 1, NULL, NULL, '2022-01-18 14:27:09', '2022-01-24 09:31:49', 1, 1, NULL, 1); +-- INSERT INTO llx_asset_model (entity, ref, label, asset_type, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, import_key, status) VALUES +-- (1, 'LAPTOP', 'Laptop', 1, NULL, NULL, '2022-01-18 14:27:09', '2022-01-24 09:31:49', 1, 1, NULL, 1); CREATE TABLE llx_asset_model( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,