New: Add table, dictionnary and option to enable "revenue stamp".

This commit is contained in:
Laurent Destailleur 2013-03-06 16:09:00 +01:00
parent 0bfa968a3f
commit d92fd0eaed
6 changed files with 115 additions and 15 deletions

View File

@ -71,6 +71,7 @@ $hookmanager->initHooks(array('admin'));
// Sort order to show dictionnary (0 is space). All other dictionnaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,23);
if (! empty($conf->global->MAIN_USE_REVENUESTAMP)) $taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,25,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,23);
// Name of SQL tables of dictionnaries
$tabname=array();
@ -98,6 +99,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability";
$tabname[22]= MAIN_DB_PREFIX."c_input_reason";
$tabname[23]= MAIN_DB_PREFIX."accountingaccount";
$tabname[24]= MAIN_DB_PREFIX."accounting_system";
$tabname[25]= MAIN_DB_PREFIX."c_revenuestamp";
// Dictionary labels
$tablib=array();
@ -124,7 +126,8 @@ $tablib[20]= "DictionnaryOrderMethods";
$tablib[21]= "DictionnaryAvailability";
$tablib[22]= "DictionnarySource";
$tablib[23]= "DictionnaryAccountancyplan";
$tablib[24]= "DictionnaryAccountancysystem";
$tablib[24]= "DictionnaryAccountancysystem";
$tablib[25]= "DictionnaryRevenueStamp";
// Requete pour extraction des donnees des dictionnaires
$tabsql=array();
@ -151,7 +154,8 @@ $tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREF
$tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23]= "SELECT rowid as rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number as accountancy_code, account_parent, label, active FROM ".MAIN_DB_PREFIX."accountingaccount";
$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.code as country_code, p.libelle as pays, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_pays as p WHERE s.fk_pays=p.rowid and p.active=1";
$tabsql[24]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, p.code as country_code, p.libelle as pays, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_pays as p WHERE s.fk_pays=p.rowid and p.active=1";
$tabsql[25]= "SELECT t.rowid, t.taux, p.libelle as country, p.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
// Critere de tri du dictionnaire
$tabsqlsort=array();
@ -178,7 +182,8 @@ $tabsqlsort[20]="code ASC, libelle ASC";
$tabsqlsort[21]="code ASC, label ASC";
$tabsqlsort[22]="code ASC, label ASC";
$tabsqlsort[23]="fk_pcg_version ASC, accountancy_code ASC";
$tabsqlsort[24]="pcg_version ASC";
$tabsqlsort[24]="pcg_version ASC";
$tabsqlsort[25]="country ASC, taux ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@ -205,7 +210,8 @@ $tabfield[20]= "code,libelle";
$tabfield[21]= "code,label";
$tabfield[22]= "code,label";
$tabfield[23]= "fk_pcg_version,accountancy_code,account_parent,pcg_type,pcg_subtype,label";
$tabfield[24]= "pcg_version,country_id,country,label";
$tabfield[24]= "pcg_version,country_id,country,label";
$tabfield[25]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@ -232,7 +238,8 @@ $tabfieldvalue[20]= "code,libelle";
$tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "fk_pcg_version,accountancy_code,account_parent,pcg_type,pcg_subtype,label";
$tabfieldvalue[24]= "pcg_version,country,label";
$tabfieldvalue[24]= "pcg_version,country,label";
$tabfieldvalue[25]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@ -259,7 +266,8 @@ $tabfieldinsert[20]= "code,libelle";
$tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pcg_version,account_number,account_parent,pcg_type,pcg_subtype,label";
$tabfieldinsert[24]= "pcg_version,fk_pays,label";
$tabfieldinsert[24]= "pcg_version,fk_pays,label";
$tabfieldinsert[25]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@ -288,7 +296,8 @@ $tabrowid[20]= "";
$tabrowid[21]= "rowid";
$tabrowid[22]= "rowid";
$tabrowid[23]= "";
$tabrowid[24]= "";
$tabrowid[24]= "";
$tabrowid[25]= "";
// Condition to show dictionnary in setup page
$tabcond=array();
@ -315,7 +324,8 @@ $tabcond[20]= ! empty($conf->fournisseur->enabled);
$tabcond[21]= ! empty($conf->propal->enabled);
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
$tabcond[23]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy plan should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor.
$tabcond[24]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor.
$tabcond[24]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor.
$tabcond[25]= (! empty($conf->global->MAIN_USE_REVENUESTAMP)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor.
// List of help for fields
$tabhelp=array();
@ -342,7 +352,8 @@ $tabhelp[20] = array();
$tabhelp[21] = array();
$tabhelp[22] = array();
$tabhelp[23] = array();
$tabhelp[24] = array();
$tabhelp[24] = array();
$tabhelp[25] = array();
// Complete all arrays with entries found into modules
complete_dictionnary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp);
@ -717,7 +728,11 @@ if ($id)
$align="left";
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
if ($fieldlist[$field]=='taux') { $valuetoshow=$langs->trans("Rate"); }
if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
else $valuetoshow=$langs->trans("Amount");
$align='right';
}
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";}
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
@ -834,7 +849,11 @@ if ($id)
$valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
if ($fieldlist[$field]=='taux') { $valuetoshow=$langs->trans("Rate"); }
if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
else $valuetoshow=$langs->trans("Amount");
$align='right';
}
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }

View File

@ -37,14 +37,14 @@ insert into llx_c_pays (rowid,code,libelle) values (2, 'BE', 'Belgium' )
insert into llx_c_pays (rowid,code,libelle) values (3, 'IT', 'Italy' );
insert into llx_c_pays (rowid,code,libelle) values (4, 'ES', 'Spain' );
insert into llx_c_pays (rowid,code,libelle) values (5, 'DE', 'Germany' );
insert into llx_c_pays (rowid,code,libelle) values (6, 'CH', 'Suisse' );
insert into llx_c_pays (rowid,code,libelle) values (6, 'CH', 'Switzerland' );
insert into llx_c_pays (rowid,code,libelle) values (7, 'GB', 'United Kingdom' );
insert into llx_c_pays (rowid,code,libelle) values (8, 'IE', 'Irland' );
insert into llx_c_pays (rowid,code,libelle) values (9, 'CN', 'China' );
insert into llx_c_pays (rowid,code,libelle) values (10, 'TN', 'Tunisie' );
insert into llx_c_pays (rowid,code,libelle) values (10, 'TN', 'Tunisia' );
insert into llx_c_pays (rowid,code,libelle) values (11, 'US', 'United States' );
insert into llx_c_pays (rowid,code,libelle) values (12, 'MA', 'Maroc' );
insert into llx_c_pays (rowid,code,libelle) values (13, 'DZ', 'Algérie' );
insert into llx_c_pays (rowid,code,libelle) values (13, 'DZ', 'Algeria' );
insert into llx_c_pays (rowid,code,libelle) values (14, 'CA', 'Canada' );
insert into llx_c_pays (rowid,code,libelle) values (15, 'TG', 'Togo' );
insert into llx_c_pays (rowid,code,libelle) values (16, 'GA', 'Gabon' );

View File

@ -0,0 +1,39 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de>
-- Copyright (C) 2012 Ricardo Schluter <info@ripasch.nl>
--
-- 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 <http://www.gnu.org/licenses/>.
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
--
-- Valeur des timbres fiscaux
-- Source des taux: ...
--
delete from llx_c_revenuestamp;
-- TUNISIA --
insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1);

View File

@ -84,3 +84,16 @@ ALTER TABLE llx_c_shipment_mode MODIFY COLUMN rowid INT(11) NOT NULL AUTO_INCREM
ALTER TABLE llx_stock_mouvement MODIFY COLUMN value real;
ALTER TABLE llx_facture ADD COLUMN revenuestamp double(24,8) DEFAULT 0 AFTER localtax2;
CREATE TABLE llx_c_revenuestamp
(
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
fk_pays integer NOT NULL,
taux double NOT NULL,
note varchar(128),
active tinyint DEFAULT 1 NOT NULL,
accountancy_code_sell varchar(15) DEFAULT NULL,
accountancy_code_buy varchar(15) DEFAULT NULL
) ENGINE=innodb;
insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1);

View File

@ -0,0 +1,29 @@
-- ========================================================================
-- Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_c_revenuestamp
(
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
fk_pays integer NOT NULL,
taux double NOT NULL,
note varchar(128),
active tinyint DEFAULT 1 NOT NULL,
accountancy_code_sell varchar(15) DEFAULT NULL,
accountancy_code_buy varchar(15) DEFAULT NULL
)ENGINE=innodb;

View File

@ -702,7 +702,7 @@ DictionnaryCurrency= Monnaies
DictionnaryCivility= Titres de civilité
DictionnaryActions= Liste des types d'événements de l'agenda
DictionnarySocialContributions= Types de charges sociales
DictionnaryVAT= Taux de TVA (ou de taxes de ventes US)
DictionnaryVAT= Taux de TVA ou de Taxes de Ventes
DictionnaryPaymentConditions= Conditions de règlement
DictionnaryPaymentModes= Modes de paiements
DictionnaryTypeContact= Types de contacts/adresses