From ee867ed6c2446a2fab0ad0bcbe3cd825d5199060 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 27 Feb 2010 22:12:39 +0000 Subject: [PATCH] Works on enhancement of local taxes. New: Prepare database, costumer bills tables --- htdocs/install/mysql/migration/2.8.0-2.9.0.sql | 16 ++++++++++++++++ htdocs/install/mysql/tables/llx_facture.sql | 3 +++ htdocs/install/mysql/tables/llx_facture_rec.sql | 3 +++ htdocs/install/mysql/tables/llx_facturedet.sql | 5 +++++ .../install/mysql/tables/llx_facturedet_rec.sql | 5 +++++ 5 files changed, 32 insertions(+) diff --git a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql index a4962cd1631..79417b38893 100755 --- a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql +++ b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql @@ -27,3 +27,19 @@ update llx_facture_fourn set fk_statut=2 where fk_statut=1 AND paye=1; alter table llx_facture_fourn add column close_code varchar(16) after remise; alter table llx_facture_fourn add column close_note varchar(128) after close_code; + +--add local taxes to invoices +alter table llx_facture add column localtax1 double(24,8) DEFAULT 0 after tva; +alter table llx_facture add column localtax2 double(24,8) DEFAULT 0 after localtax1; +alter table llx_facturedet add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; +alter table llx_facturedet add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; +alter table llx_facturedet add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; +alter table llx_facturedet add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; + + +alter table llx_facture_rec add column localtax1 double(24,8) DEFAULT 0 after tva; +alter table llx_facture_rec add column localtax2 double(24,8) DEFAULT 0 after localtax1; +alter table llx_facturedet_rec add column localtax1_tx double(6,3) DEFAULT 0 after tva_tx; +alter table llx_facturedet_rec add column localtax2_tx double(6,3) DEFAULT 0 after localtax1_tx; +alter table llx_facturedet_rec add column total_localtax1 double(24,8) DEFAULT 0 after total_tva; +alter table llx_facturedet_rec add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1; diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 8f76ed9b16e..bd08bcbbc08 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2001-2005 Rodolphe Quiedeville -- Copyright (C) 2004-2009 Laurent Destailleur -- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2010 Juanjo Menent -- -- 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 @@ -44,6 +45,8 @@ create table llx_facture close_note varchar(128), -- Commentaire cloture sans paiement complet tva real DEFAULT 0, -- montant tva apres remise totale + localtax1 double(24,8) DEFAULT 0, -- amount localtax1 + localtax2 double(24,8) DEFAULT 0, -- amount localtax2 total real DEFAULT 0, -- montant total ht apres remise totale total_ttc real DEFAULT 0, -- montant total ttc apres remise totale diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index b1b65d14eb0..ac4e2f6c8de 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2003 Rodolphe Quiedeville -- Copyright (C) 2006 Laurent Destailleur -- Copyright (C) 2009 Regis Houssin +-- Copyright (C) 2010 Juanjo Menent -- -- 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 @@ -33,6 +34,8 @@ create table llx_facture_rec remise_percent real DEFAULT 0, remise_absolue real DEFAULT 0, tva real DEFAULT 0, + localtax1 double(24,8) DEFAULT 0, -- amount localtax1 + localtax2 double(24,8) DEFAULT 0, -- amount localtax2 total real DEFAULT 0, total_ttc real DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 6df8702dd00..ec82985fc5d 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2001-2005 Rodolphe Quiedeville -- Copyright (C) 2004-2005 Laurent Destailleur -- Copyright (C) 2005-2010 Regis Houssin +-- Copyright (C) 2010 Juanjo Menent -- -- 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 @@ -28,6 +29,8 @@ create table llx_facturedet fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits description text, tva_tx real, -- Taux tva produit/service (exemple 19.6) + localtax1_tx double(6,3) DEFAULT 0, -- tax local tax 1 + localtax2_tx double(6,3) DEFAULT 0, -- tax local tax 2 qty real, -- Quantity (exemple 2) 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) @@ -36,6 +39,8 @@ create table llx_facturedet price real, -- P.U. HT apres remise % de ligne total_ht real, -- Total HT de la ligne toute quantite et incluant remise ligne et globale total_tva real, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale + total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line + total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line total_ttc real, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale product_type integer DEFAULT 0, date_start datetime DEFAULT NULL, -- date debut si service diff --git a/htdocs/install/mysql/tables/llx_facturedet_rec.sql b/htdocs/install/mysql/tables/llx_facturedet_rec.sql index c64609beef8..e825527487a 100644 --- a/htdocs/install/mysql/tables/llx_facturedet_rec.sql +++ b/htdocs/install/mysql/tables/llx_facturedet_rec.sql @@ -1,6 +1,7 @@ -- =================================================================== -- Copyright (C) 2003 Rodolphe Quiedeville -- Copyright (C) 2009 Laurent Destailleur +-- Copyright (C) 2010 Juanjo Menent -- -- 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 @@ -27,6 +28,8 @@ create table llx_facturedet_rec product_type integer DEFAULT 0, description text, tva_tx real DEFAULT 19.6, -- taux tva + localtax1_tx double(6,3) DEFAULT 0, -- tax local tax 1 + localtax2_tx double(6,3) DEFAULT 0, -- tax local tax 2 qty real, -- quantity remise_percent real DEFAULT 0, -- pourcentage de remise remise real DEFAULT 0, -- montant de la remise @@ -34,5 +37,7 @@ create table llx_facturedet_rec price real, -- prix final total_ht real, -- Total HT de la ligne toute quantity et incluant remise ligne et globale total_tva real, -- 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 + total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line total_ttc real -- Total TTC de la ligne toute quantity et incluant remise ligne et globale )type=innodb;