From a59aca5b8c4f5d69a84a1fd390f558b4fcd9cb2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Mar 2008 02:08:43 +0000 Subject: [PATCH] Fix: vat rate for supplier order or invoice if supplier is in europe but country differ from user. --- htdocs/comm/fiche.php | 10 +++++++--- htdocs/comm/prospect/fiche.php | 6 +++++- htdocs/compta/fiche.php | 6 +++++- htdocs/fourn/fiche.php | 10 ++++++++-- htdocs/langs/en_US/companies.lang | 1 + htdocs/langs/fr_FR/companies.lang | 1 + htdocs/soc.php | 6 ++++-- mysql/data/data.sql | 14 +------------- 8 files changed, 32 insertions(+), 22 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 4bb68f18c9e..e9059de22ab 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -129,6 +129,8 @@ llxHeader('',$langs->trans('CustomerCard')); $contactstatic = new Contact($db); $userstatic=new User($db); +$form = new Form($db); + if ($socid > 0) { // On recupere les donnees societes par l'objet @@ -178,9 +180,11 @@ if ($socid > 0) print ''.$langs->trans('Zip').''.$objsoc->cp.""; print ''.$langs->trans('Town').''.$objsoc->ville.""; - if ($objsoc->pays) { - print ''.$langs->trans('Country').''.$objsoc->pays.''; - } + + // Country + print ''.$langs->trans("Country").''; + if ($objsoc->isInEEC()) print $form->textwithhelp($objsoc->pays,$langs->trans("CountryIsInEEC"),1,0); + print ''; // Phone print ''.$langs->trans('Phone').''.dolibarr_print_phone($objsoc->tel,$objsoc->pays_code).''; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 64b7ae17b28..0d79a403da7 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -99,7 +99,11 @@ if ($socid > 0) print ''.$langs->trans("Address").''.nl2br($societe->adresse).""; print ''.$langs->trans('Zip').' / '.$langs->trans('Town').''.$societe->cp." ".$societe->ville.''; - print ''.$langs->trans('Country').''.$societe->pays.''; + + // Country + print ''.$langs->trans("Country").''; + if ($societe->isInEEC()) print $form->textwithhelp($societe->pays,$langs->trans("CountryIsInEEC"),1,0); + print ''; print ''.$langs->trans("Phone").''.dolibarr_print_phone($societe->tel,$societe->pays_code).'Fax'.dolibarr_print_phone($societe->fax,$societe->pays_code).''; print ''.$langs->trans("Web")."url\">$societe->url"; diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index cfea8a348fb..5ad22a3fbd0 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -78,6 +78,7 @@ llxHeader(); $facturestatic=new Facture($db); $contactstatic = new Contact($db); +$form = new Form($db); if ($socid > 0) { @@ -133,7 +134,10 @@ if ($socid > 0) print ''.$langs->trans('Zip').''.$societe->cp.''; print ''.$langs->trans('Town').''.$societe->ville.''; - print ''.$langs->trans('Country').''.$societe->pays.''; + // Country + print ''.$langs->trans('Country').''; + if ($societe->isInEEC()) print $form->textwithhelp($societe->pays,$langs->trans("CountryIsInEEC"),1,0); + print ''; print ''.$langs->trans("Phone").''.dolibarr_print_phone($societe->tel,$societe->pays_code).' '.$langs->trans("Fax").''.dolibarr_print_phone($societe->fax,$societe->pays_code).' '; print ''.$langs->trans("Web")."url\" target=\"_blank\">$societe->url "; diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 6b5f8cae547..cff30d1a23c 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -44,10 +44,11 @@ $result = restrictedArea($user, 'societe',$socid,''); /* - * Mode fiche + * View */ $societe = new Fournisseur($db); $contactstatic = new Contact($db); +$form = new Form($db); if ( $societe->fetch($socid) ) { @@ -85,7 +86,12 @@ if ( $societe->fetch($socid) ) print ''.$langs->trans("Zip").''.$societe->cp.''; print ''.$langs->trans("Town").''.$societe->ville.''; - print ''.$langs->trans("Country").''.$societe->pays.''; + + // Country + print ''.$langs->trans("Country").''; + if ($societe->isInEEC()) print $form->textwithhelp($societe->pays,$langs->trans("CountryIsInEEC"),1,0); + print ''; + print ''.$langs->trans("Phone").''.dolibarr_print_phone($societe->tel,$societe->pays_code).' '.$langs->trans("Fax").''.dolibarr_print_phone($societe->fax,$societe->pays_code).' '; print ''.$langs->trans("Web")."url\">$societe->url "; diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 583c410c48d..32bc1876890 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -23,6 +23,7 @@ IdContact=Contact Id Company=Company CompanyName=Company name Companies=Companies +CountryIsInEEC=Country is inside European Economic Community ThirdParty=Third party ThirdParties=Third parties ThirdPartyAll=Third parties (all) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index cce5335fc48..222460702fc 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -23,6 +23,7 @@ IdContact=Id contact Company=Société CompanyName=Raison sociale Companies=Sociétés +CountryIsInEEC=Pays de la Communauté Economique Européenne ThirdParty=Tiers ThirdParties=Tiers ThirdPartyAll=Tiers (tous) diff --git a/htdocs/soc.php b/htdocs/soc.php index a6c38c236e3..57cac32347c 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -962,8 +962,10 @@ else print ''.$langs->trans('Zip').''.$soc->cp.""; print ''.$langs->trans('Town').''.$soc->ville.""; - print ''.$langs->trans('Country').''.$soc->pays.''; - print ''; + // Country + print ''.$langs->trans("Country").''; + if ($soc->isInEEC()) print $form->textwithhelp($soc->pays,$langs->trans("CountryIsInEEC"),1,0); + print ''; print ''.$langs->trans('State').''.$soc->departement.''; diff --git a/mysql/data/data.sql b/mysql/data/data.sql index 18c3b5a7dee..e44c37146c9 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -1248,19 +1248,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (10 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (105,10, '15','0','TVA 12% Majoré à 25% (15%)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1); - --- GUADELOUPE (id 105) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 111, 105, '8.5','0','VAT Rate 8.5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 112, 105, '8.5','1','VAT Rate 8.5 non perçu par le vendeur mais récupérable par l\'acheteur',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 113, 105, '0','0','VAT Rate 0 ou non applicable',1); --- MARTINIQUE (id 150) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 121, 150, '8.5','0','VAT Rate 8.5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 122, 150, '8.5','1','VAT Rate 8.5 non perçu par le vendeur mais récupérable par l\'acheteur',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 123, 150, '0','0','VAT Rate 0 ou non applicable',1); --- REUNION (id 187) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 131, 187, '8.5','0','VAT Rate 8.5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 132, 187, '8.5','1','VAT Rate 8.5 non perçu par le vendeur mais récupérable par l\'acheteur',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 133, 187, '0','0','VAT Rate 0 ou non applicable',1); +-- Pour les DOM-TOM, il faut utiliser le pays FRANCE (Sinon pb avec regles de TVA et autres regles propres aux pays et europe) --