Skip to content

Commit

Permalink
WIP Add column subprice with tax for future use
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 6, 2024
1 parent b03684c commit f2c89f6
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 30 deletions.
21 changes: 21 additions & 0 deletions htdocs/install/mysql/migration/20.0.0-21.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,24 @@ ALTER TABLE llx_facture ADD COLUMN payment_reference varchar(25) AFTER date_lim_
ALTER TABLE llx_societe ADD COLUMN tp_payment_reference varchar(25) AFTER code_fournisseur;

ALTER TABLE llx_actioncomm ADD COLUMN fk_task integer;

ALTER TABLE llx_commande_fournisseurdet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_commandedet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_commandedet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_contratdet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_contratdet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_deliverydet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_expensereport_det ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_expensereport_det ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_facture_fourn_det ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_facture_fourn_det_rec ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_facturedet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_facturedet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_facturedet_rec ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_facturedet_rec ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_fichinterdet_rec ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_propaldet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_propaldet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN subprice_ttc double(24,8) DEFAULT 0 after subprice;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN multicurrency_subprice_ttc double(24,8) DEFAULT 0 after multicurrency_subprice;
6 changes: 4 additions & 2 deletions htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ create table llx_commande_fournisseurdet
qty real, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
remise real DEFAULT 0, -- montant de la remise
subprice double(24,8) DEFAULT 0, -- prix unitaire
subprice double(24,8) DEFAULT 0, -- unit price
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
total_localtax1 double(24,8) DEFAULT 0, -- Total Local Tax 1
Expand All @@ -51,10 +52,11 @@ create table llx_commande_fournisseurdet
rang integer DEFAULT 0,
import_key varchar(14),
fk_unit integer DEFAULT NULL,

fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
Expand Down
14 changes: 8 additions & 6 deletions htdocs/install/mysql/tables/llx_commandedet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ create table llx_commandedet
remise real DEFAULT 0, -- montant de la remise
fk_remise_except integer NULL, -- Lien vers table des remises fixes
price real, -- prix final
subprice double(24,8) DEFAULT 0, -- P.U. HT (exemple 100)
subprice double(24,8) DEFAULT 0, -- unit price HT (exemple 100)
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1
total_localtax2 double(24,8) DEFAULT 0, -- Total LocalTax2
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
Expand All @@ -52,24 +53,25 @@ create table llx_commandedet

buy_price_ht double(24,8) DEFAULT 0, -- buying price
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)

special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0,
fk_unit integer DEFAULT NULL, -- lien vers table des unités
import_key varchar(14),
ref_ext varchar(255) DEFAULT NULL,

fk_commandefourndet integer DEFAULT NULL, -- link to detail line of commande fourn (resplenish)

fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
)ENGINE=innodb;

--
--
-- List of codes for special_code
--
-- 1 : frais de port
Expand Down
6 changes: 4 additions & 2 deletions htdocs/install/mysql/tables/llx_contratdet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ create table llx_contratdet
localtax2_type varchar(10) NULL, -- localtax2 type
qty real NOT NULL, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
subprice double(24,8) DEFAULT 0, -- prix unitaire
subprice double(24,8) DEFAULT 0, -- unit price
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
price_ht real, -- prix final (obsolete)
remise real DEFAULT 0, -- montant de la remise (obsolete)
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
Expand All @@ -69,7 +70,8 @@ create table llx_contratdet
fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
multicurrency_total_ttc double(24,8) DEFAULT 0
)ENGINE=innodb;
3 changes: 2 additions & 1 deletion htdocs/install/mysql/tables/llx_deliverydet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ create table llx_deliverydet
fk_product integer,
description text,
qty real, -- quantity
subprice double(24,8) DEFAULT 0, -- prix unitaire
subprice double(24,8) DEFAULT 0, -- unit price
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite
rang integer DEFAULT 0
)ENGINE=innodb;
6 changes: 4 additions & 2 deletions htdocs/install/mysql/tables/llx_expensereport_det.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ CREATE TABLE llx_expensereport_det
comments text NOT NULL,
product_type integer DEFAULT -1,
qty real NOT NULL,
subprice double(24,8) DEFAULT 0 NOT NULL, -- P.U. HT (example 100)
subprice double(24,8) DEFAULT 0 NOT NULL, -- unit price HT (example 100)
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120)
remise_percent real,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
Expand All @@ -47,11 +48,12 @@ CREATE TABLE llx_expensereport_det
fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0,
fk_facture integer DEFAULT 0, -- ID of customer invoice line if expense is rebilled to a customer
fk_ecm_files integer DEFAULT NULL, -- ID of ECM file that is source document of expense report
fk_ecm_files integer DEFAULT NULL, -- ID of ECM file that is source document of expense report
fk_code_ventilation integer DEFAULT 0,
rang integer DEFAULT 0, -- position of line
import_key varchar(14),
Expand Down
1 change: 1 addition & 0 deletions htdocs/install/mysql/tables/llx_facture_fourn_det.sql
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ create table llx_facture_fourn_det
fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
Expand Down
3 changes: 2 additions & 1 deletion htdocs/install/mysql/tables/llx_facture_fourn_det_rec.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ create table llx_facture_fourn_det_rec

fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
Expand Down
9 changes: 5 additions & 4 deletions htdocs/install/mysql/tables/llx_facturedet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ create table llx_facturedet
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (exemple 20)
fk_remise_except integer NULL, -- Lien vers table des remises fixes
subprice double(24,8), -- P.U. HT (exemple 100)
subprice double(24,8), -- unit price HT (exemple 100)
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
price double(24,8), -- Deprecated (Do not use)
total_ht double(24,8), -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double(24,8), -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
Expand All @@ -57,15 +58,15 @@ create table llx_facturedet

batch varchar(128) NULL, -- To store the batch to consume in stock when using a POS module
fk_warehouse integer NULL, -- To store the warehouse where to consume stock when using a POS module

special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0, -- position of line
fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines
fk_unit integer DEFAULT NULL, -- id of the unit code
import_key varchar(14),

fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line

situation_percent real DEFAULT 100, -- % progression of lines invoicing
fk_prev_id integer, -- id of the line in the previous situation

Expand All @@ -75,9 +76,9 @@ create table llx_facturedet
fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0,
ref_ext varchar(255) DEFAULT NULL
)ENGINE=innodb;

14 changes: 8 additions & 6 deletions htdocs/install/mysql/tables/llx_facturedet_rec.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ create table llx_facturedet_rec
qty real, -- quantity
remise_percent real DEFAULT 0, -- pourcentage de remise
remise real DEFAULT 0, -- montant de la remise
subprice double(24,8), -- prix avant remise
price double(24,8), -- prix final
subprice double(24,8) DEFAULT 0 NOT NULL, -- unit price HT (example 100)
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
price double(24,8), -- prix final (deprecated)
total_ht double(24,8), -- Total HT de la ligne toute quantity et incluant remise ligne et globale
total_tva double(24,8), -- Total TVA de la ligne toute quantity et incluant remise ligne et globale
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
Expand All @@ -51,19 +52,20 @@ create table llx_facturedet_rec

buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it).
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)

special_code integer UNSIGNED DEFAULT 0, -- code for special lines
rang integer DEFAULT 0, -- ordre d'affichage
fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines
fk_unit integer DEFAULT NULL,
import_key varchar(14),

fk_user_author integer, -- user making creation
fk_user_modif integer, -- user making last change

fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
Expand Down
5 changes: 3 additions & 2 deletions htdocs/install/mysql/tables/llx_fichinterdet_rec.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ create table llx_fichinterdet_rec
duree integer, -- duree de la ligne d'intervention
rang integer DEFAULT 0, -- ordre affichage sur la fiche
total_ht DOUBLE(24, 8) NULL DEFAULT NULL,
subprice DOUBLE(24, 8) NULL DEFAULT NULL,
subprice DOUBLE(24, 8) NULL DEFAULT NULL, -- unit price without tax
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
fk_parent_line integer NULL DEFAULT NULL,
fk_product integer NULL DEFAULT NULL,
label varchar(255) NULL DEFAULT NULL,
Expand All @@ -55,7 +56,7 @@ create table llx_fichinterdet_rec
fk_product_fournisseur_price integer NULL DEFAULT NULL,
fk_code_ventilation integer NOT NULL DEFAULT 0,
special_code integer UNSIGNED NULL DEFAULT 0,
fk_unit integer NULL DEFAULT NULL,
fk_unit integer NULL DEFAULT NULL,
import_key varchar(14) NULL DEFAULT NULL

)ENGINE=innodb;
6 changes: 4 additions & 2 deletions htdocs/install/mysql/tables/llx_propaldet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ create table llx_propaldet
remise_percent real DEFAULT 0, -- discount percentage
remise real DEFAULT 0, -- discount amount (obsolete)
price real, -- final price (obsolete)
subprice double(24,8) DEFAULT 0, -- unit price article
subprice double(24,8) DEFAULT 0, -- unit price without tax
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
total_ht double(24,8) DEFAULT 0, -- Total excluding VAT of the line all quantities and including line and global discount
total_tva double(24,8) DEFAULT 0, -- Total VAT of the line any quantity and including discount line and global
total_localtax1 double(24,8) DEFAULT 0, -- Total localtax1
Expand All @@ -60,14 +61,15 @@ create table llx_propaldet
fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0,

import_key varchar(14)
)ENGINE=innodb;

--
--
-- List of codes for special_code
--
-- 1 : shipping costs
Expand Down
6 changes: 4 additions & 2 deletions htdocs/install/mysql/tables/llx_supplier_proposaldet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ CREATE TABLE llx_supplier_proposaldet (
remise_percent double DEFAULT '0',
remise double DEFAULT '0',
price double DEFAULT NULL,
subprice double(24,8) DEFAULT 0,
subprice double(24,8) DEFAULT 0, -- unit price without tax
subprice_ttc double(24,8) DEFAULT 0, -- unit price if price was entered including tax
total_ht double(24,8) DEFAULT 0,
total_tva double(24,8) DEFAULT 0,
total_localtax1 double(24,8) DEFAULT 0,
Expand All @@ -50,7 +51,8 @@ CREATE TABLE llx_supplier_proposaldet (
ref_fourn varchar(128) DEFAULT NULL,
fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice double(24,8) DEFAULT 0,
multicurrency_subprice_ttc double(24,8) DEFAULT 0,
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0,
Expand Down

0 comments on commit f2c89f6

Please sign in to comment.