New: Gestion des taux de tva en base dans llx_c_tva
This commit is contained in:
parent
f35237c426
commit
71acc25736
@ -50,7 +50,7 @@ $active = 1;
|
||||
// Mettre ici tous les caractéristiques des dictionnaires
|
||||
|
||||
// Ordres d'affichage des dictionnaires (0 pour espace)
|
||||
$taborder=array(4,3,2,0,9,0,1,8,0,5,0,6,0,7);
|
||||
$taborder=array(4,3,2,0,9,0,1,8,0,5,0,6,0,7,0,10);
|
||||
|
||||
// Nom des tables des dictionnaires
|
||||
$tabname[1] = MAIN_DB_PREFIX."c_forme_juridique";
|
||||
@ -62,6 +62,7 @@ $tabname[6] = MAIN_DB_PREFIX."c_actioncomm";
|
||||
$tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
|
||||
$tabname[8] = MAIN_DB_PREFIX."c_typent";
|
||||
$tabname[9] = MAIN_DB_PREFIX."c_currencies";
|
||||
$tabname[10]= MAIN_DB_PREFIX."c_tva";
|
||||
|
||||
// Libellé des dictionnaires
|
||||
$tablib[1] = $langs->trans("DictionnaryCompanyJuridicalType");
|
||||
@ -73,6 +74,7 @@ $tablib[6] = $langs->trans("DictionnaryActions");
|
||||
$tablib[7] = $langs->trans("DictionnarySocialContributions");
|
||||
$tablib[8] = $langs->trans("DictionnaryCompanyType");
|
||||
$tablib[9] = $langs->trans("DictionnaryCurrency");
|
||||
$tablib[10]= $langs->trans("DictionnaryVAT");
|
||||
|
||||
// Requete pour extraction des données des dictionnaires
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.libelle as pays, f.active FROM llx_c_forme_juridique as f, llx_c_pays as p WHERE f.fk_pays=p.rowid";
|
||||
@ -84,17 +86,19 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.id as code, a.libelle AS libelle, a.deductible, a.active FROM llx_c_chargesociales AS a";
|
||||
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM llx_c_typent";
|
||||
$tabsql[9] = "SELECT code as rowid, code, code_iso, label as libelle, active FROM llx_c_currencies";
|
||||
$tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, t.recuperableonly, t.note, t.active FROM llx_c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
|
||||
|
||||
// Tri par defaut
|
||||
$tabsqlsort[1]="pays, code ASC";
|
||||
$tabsqlsort[2]="pays, code ASC";
|
||||
$tabsqlsort[3]="pays, code ASC";
|
||||
$tabsqlsort[4]="libelle ASC";
|
||||
$tabsqlsort[5]="libelle ASC";
|
||||
$tabsqlsort[6]="a.type ASC, a.code ASC";
|
||||
$tabsqlsort[7]="a.libelle ASC";
|
||||
$tabsqlsort[8]="libelle ASC";
|
||||
$tabsqlsort[9]="code ASC";
|
||||
$tabsqlsort[1] ="pays, code ASC";
|
||||
$tabsqlsort[2] ="pays, code ASC";
|
||||
$tabsqlsort[3] ="pays, code ASC";
|
||||
$tabsqlsort[4] ="libelle ASC";
|
||||
$tabsqlsort[5] ="libelle ASC";
|
||||
$tabsqlsort[6] ="a.type ASC, a.code ASC";
|
||||
$tabsqlsort[7] ="a.libelle ASC";
|
||||
$tabsqlsort[8] ="libelle ASC";
|
||||
$tabsqlsort[9] ="code ASC";
|
||||
$tabsqlsort[10]="pays ASC, taux ASC, recuperableonly ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield[1] = "code,libelle,pays";
|
||||
@ -106,6 +110,7 @@ $tabfield[6] = "code,libelle,type";
|
||||
$tabfield[7] = "libelle,deductible";
|
||||
$tabfield[8] = "code,libelle";
|
||||
$tabfield[9] = "code,code_iso,libelle";
|
||||
$tabfield[10]= "pays,taux,recuperableonly,note";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert[1] = "code,libelle,fk_pays";
|
||||
@ -117,6 +122,7 @@ $tabfieldinsert[6] = "code,libelle,type";
|
||||
$tabfieldinsert[7] = "libelle,deductible";
|
||||
$tabfieldinsert[8] = "code,libelle";
|
||||
$tabfieldinsert[9] = "code,code_iso,libelle";
|
||||
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,note";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrément
|
||||
$tabrowid[1] = "";
|
||||
@ -128,6 +134,7 @@ $tabrowid[6] = "id";
|
||||
$tabrowid[7] = "id";
|
||||
$tabrowid[8] = "id";
|
||||
$tabrowid[9] = "code";
|
||||
$tabrowid[10]= "";
|
||||
|
||||
|
||||
$msg='';
|
||||
@ -138,8 +145,8 @@ $sortfield=$_GET["sortfield"];
|
||||
/*
|
||||
* Actions ajout d'une entrée dans un dictionnaire de donnée
|
||||
*/
|
||||
if ($_POST["actionadd"]) {
|
||||
|
||||
if ($_POST["actionadd"])
|
||||
{
|
||||
$listfield=split(',',$tabfield[$_POST["id"]]);
|
||||
|
||||
// Verifie que tous les champs sont renseignés
|
||||
@ -205,6 +212,7 @@ if ($_POST["actionadd"]) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($msg) $msg='<div class="error">'.$msg.'</div>';
|
||||
$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
@ -297,7 +305,9 @@ if ($_GET["id"])
|
||||
|
||||
// Ligne d'ajout
|
||||
if ($tabname[$_GET["id"]]) {
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
|
||||
$fieldlist=split(',',$tabfield[$_GET["id"]]);
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -310,14 +320,17 @@ if ($_GET["id"])
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de données
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language");
|
||||
if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type");
|
||||
if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code");
|
||||
if ($fieldlist[$field]=='libelle') $valuetoshow=$langs->trans("Label")."*";
|
||||
if ($fieldlist[$field]=='pays') $valuetoshow=$langs->trans("Country");
|
||||
if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language");
|
||||
if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type");
|
||||
if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code");
|
||||
if ($fieldlist[$field]=='libelle') $valuetoshow=$langs->trans("Label")."*";
|
||||
if ($fieldlist[$field]=='pays') $valuetoshow=$langs->trans("Country");
|
||||
if ($fieldlist[$field]=='recuperableonly') $valuetoshow=$langs->trans("VATReceivedOnly");
|
||||
print '<td>';
|
||||
print $valuetoshow;
|
||||
print '</td>';
|
||||
|
||||
if ($fieldlist[$field]=='libelle') $alabelisused=1;
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
@ -347,6 +360,11 @@ if ($_GET["id"])
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly') {
|
||||
print '<td>';
|
||||
$html->selectyesno('recuperableonly','',1);
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td><input type="text" class="flat" value="" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
@ -354,7 +372,10 @@ if ($_GET["id"])
|
||||
print '<td colspan=3><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>';
|
||||
print "</tr>";
|
||||
|
||||
print '<tr><td colspan="'.(count($fieldlist)+2).'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
||||
if ($alabelisused) // Si un des champs est un libellé
|
||||
{
|
||||
print '<tr><td colspan="'.(count($fieldlist)+2).'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
||||
}
|
||||
print '<tr><td colspan="'.(count($fieldlist)+2).'"> </td></tr>';
|
||||
|
||||
print '</form>';
|
||||
@ -379,6 +400,7 @@ if ($_GET["id"])
|
||||
if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code");
|
||||
if ($fieldlist[$field]=='libelle') $valuetoshow=$langs->trans("Label")."*";
|
||||
if ($fieldlist[$field]=='pays') $valuetoshow=$langs->trans("Country");
|
||||
if ($fieldlist[$field]=='recuperableonly') $valuetoshow=$langs->trans("VATReceivedOnly");
|
||||
// Affiche nom du champ
|
||||
print_liste_field_titre($valuetoshow,"dict.php",$fieldlist[$field],"&id=".$_GET["id"],"","",$sortfield);
|
||||
}
|
||||
@ -399,6 +421,9 @@ if ($_GET["id"])
|
||||
if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
}
|
||||
if ($fieldlist[$field]=='recuperableonly') {
|
||||
$valuetoshow=yn($valuetoshow);
|
||||
}
|
||||
print '<td>'.$valuetoshow.'</td>';
|
||||
|
||||
}
|
||||
|
||||
@ -884,40 +884,59 @@ class Form
|
||||
*/
|
||||
function select_tva($name='tauxtva', $defaulttx='', $default=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$file = DOL_DOCUMENT_ROOT . "/conf/tva.local.php";
|
||||
if (is_readable($file))
|
||||
global $langs,$conf;
|
||||
|
||||
if (! $conf->global->MAIN_INFO_SOCIETE_PAYS)
|
||||
{
|
||||
include $file;
|
||||
print '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</div>';
|
||||
}
|
||||
|
||||
$sql = "SELECT t.taux,t.recuperableonly";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva AS t";
|
||||
$sql .= " WHERE t.fk_pays = '".$conf->global->MAIN_INFO_SOCIETE_PAYS."'";
|
||||
$sql .= " AND t.active = 1";
|
||||
$sql .= " ORDER BY t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
$txtva[ $i ] = $obj->taux;
|
||||
$libtva[ $i ] = $obj->taux.'%'.($obj->recuperableonly ? ' *':'');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$txtva[0] = '19.6';
|
||||
$libtva[0] = '';
|
||||
$txtva[1] = '5.5';
|
||||
$libtva[1] = '';
|
||||
$txtva[2] = '0';
|
||||
$libtva[2] = '';
|
||||
}
|
||||
|
||||
|
||||
if ($defaulttx == '')
|
||||
{
|
||||
$defaulttx = $txtva[0];
|
||||
}
|
||||
|
||||
|
||||
$taille = sizeof($txtva);
|
||||
|
||||
|
||||
print '<select class="flat" name="'.$name.'">';
|
||||
if ($default) print '<option value="0">'.$langs->trans("Default").'</option>';
|
||||
|
||||
|
||||
for ($i = 0 ; $i < $taille ; $i++)
|
||||
{
|
||||
print '<option value="'.$txtva[$i].'"';
|
||||
if ($txtva[$i] == $defaulttx)
|
||||
{
|
||||
print ' selected>'.$txtva[$i].'%</option>';
|
||||
print ' selected>'.$libtva[$i].'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '>'.$txtva[$i].'%</option>';
|
||||
print '>'.$libtva[$i].'</option>';
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
|
||||
@ -197,6 +197,8 @@ DictionnaryCurrency=Currencies
|
||||
DictionnaryCivility=Civility title
|
||||
DictionnaryActions=Actions list
|
||||
DictionnarySocialContributions=Social contributions types
|
||||
DictionnaryVAT=VAT Rates
|
||||
VATReceivedOnly=Special rate not billed
|
||||
LabelUsedByDefault=Label used by default if no translation can be found for code
|
||||
AlwaysActive=Always active
|
||||
UpdateRequired=Your system need to be updated. For this click on <a href="%s">Update now</a>.
|
||||
|
||||
@ -18,6 +18,7 @@ ErrorFileNotUploaded=File was not uploaded
|
||||
ErrorInternalErrorDetected=Internal error detected
|
||||
ErrorNoRequestRan=No request ran
|
||||
ErrorWrongHostParameter=Wrong host parameter
|
||||
ErrorYourCountryIsNotDefined=Your country is not defined. Go to Home-Setup-Edit and post again the form.
|
||||
HomeArea=Home area
|
||||
LastAccess=Last access
|
||||
RequestedUrl=Requested Url
|
||||
|
||||
@ -197,6 +197,8 @@ DictionnaryCurrency=Monnaies
|
||||
DictionnaryCivility=Titres de civilité
|
||||
DictionnaryActions=Liste des actions
|
||||
DictionnarySocialContributions=Types de charges sociales
|
||||
DictionnaryVAT=Taux de TVA
|
||||
VATReceivedOnly=Taux special non facturé
|
||||
LabelUsedByDefault=Libellé qui sera utilisé si aucune traduction n'est trouvé pour ce code
|
||||
AlwaysActive=Toujours actif
|
||||
UpdateRequired=Votre système nécessite une mise à jour. Pour cela cliquez sur <a href="%s">Mettre à jour</a>.
|
||||
|
||||
@ -18,6 +18,7 @@ ErrorFileNotUploaded=Le fichier n'a pas
|
||||
ErrorInternalErrorDetected=Erreur interne détectée
|
||||
ErrorNoRequestRan=Aucune requête exécutée
|
||||
ErrorWrongHostParameter=Mauvais paramètre Serveur
|
||||
ErrorYourCountryIsNotDefined=Votre pays n'est pas défini. Aller dans Configuration-Général-Editer et resoumettez le formulaire.
|
||||
HomeArea=Espace accueil
|
||||
LastAccess=Dernière connexion
|
||||
RequestedUrl=Url sollicitée
|
||||
|
||||
@ -686,3 +686,16 @@ insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LT', 'L
|
||||
insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'RU', 'SUR', 1, 'Rouble');
|
||||
insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'FH', 'HUF', 1, 'Forint hongrois');
|
||||
insert into llx_c_currencies ( code, code_iso, active, label ) values ( 'LK', 'LKR', 1, 'Roupie sri lanka');
|
||||
|
||||
--
|
||||
-- Taux TVA
|
||||
--
|
||||
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1,1, '0','0','Taux TVA non applicable (France, TOM)',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2,1, '5.5','0','Taux à 5.5 (France hors DOMTOM)',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (3,1, '8.5','0','Taux à 8.5 (DOM sauf Guyane et Saint-Martin)',0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (4,1, '8.5','1','Taux à 8.5 (DOM sauf Guyane et Saint-Martin), récupérable uniquement, non facturé',0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (5,1,'19.6','0','Taux à 19.6 (France hors DOMTOM)',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (6,2, '0','0','Taux TVA non applicable',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (7,2, '6','0','Taux à 6',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (8,2, '21','0','Taux à 21',1);
|
||||
|
||||
@ -6,6 +6,29 @@
|
||||
-- ;
|
||||
|
||||
|
||||
drop table if exists llx_c_tva;
|
||||
|
||||
create table llx_c_tva
|
||||
(
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_pays integer NOT NULL,
|
||||
taux double NOT NULL,
|
||||
recuperableonly integer DEFAULT 0,
|
||||
note varchar(128),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
|
||||
)type=innodb;
|
||||
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1,1, '0','0','Taux TVA non applicable (France, TOM)',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2,1, '5.5','0','Taux à 5.5 (France hors DOMTOM)',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (3,1, '8.5','0','Taux à 8.5 (DOM sauf Guyane et Saint-Martin)',0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (4,1, '8.5','1','Taux à 8.5 (DOM sauf Guyane et Saint-Martin), récupérable uniquement, non facturé',0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (5,1,'19.6','0','Taux à 19.6 (France hors DOMTOM)',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (6,2, '0','0','Taux TVA non applicable',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (7,2, '6','0','Taux à 6',1);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (8,2, '21','0','Taux à 21',1);
|
||||
|
||||
|
||||
create table llx_user_clicktodial
|
||||
(
|
||||
fk_user integer PRIMARY KEY,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user