diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0e647baeb55..0b1595dfac1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2793,7 +2793,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") if (empty($thirdparty_seller) || ! is_object($thirdparty_seller)) $thirdparty_seller=$mysoc; - dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')." thirdparty_seller id=".$thirdparty_seller->id); + dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')."/country_code=".(is_object($thirdparty_buyer)?$thirdparty_buyer->country_code:'')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj); // Some test to guess with no need to make database access if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe @@ -2819,16 +2819,18 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") } //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); - $code_country=$thirdparty_seller->country_code; + // Do not enabled this. We want localtax that match the vat rate. + // If we forced a vat, we must also force local tax + /* if (is_object($thirdparty_buyer)) { - if ($code_country != $thirdparty_buyer->country_code) return 0; - } + if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0; + }*/ // Search local taxes $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$code_country."'"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; $sql .= " AND t.taux = ".$tva." AND t.active = 1"; dol_syslog("get_localtax sql=".$sql); diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index c3af3e2e973..5b4fbee52ff 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -79,7 +79,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $seller=$mysoc; // If sell is done to a customer, $seller is not provided, we use $mysoc //var_dump($seller->country_id);exit; } - + // Too verbose. Enable for debug only + //dol_syslog("calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate); + $countryid=$seller->country_id; if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj; if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj; @@ -91,7 +93,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv"; $sql.= " WHERE cv.taux = ".$txtva; $sql.= " AND cv.fk_pays = ".$countryid; - dol_syslog("search vat information sql=".$sql); + dol_syslog("calcul_price_total search vat information sql=".$sql); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/langs/fr_CA/admin.lang b/htdocs/langs/fr_CA/admin.lang new file mode 100644 index 00000000000..69e2630bc9c --- /dev/null +++ b/htdocs/langs/fr_CA/admin.lang @@ -0,0 +1,18 @@ +# Dolibarr language file - Source file is en_US - admin +CHARSET=UTF-8 +VATManagement=Gestion TPS +VATIsUsedDesc=Le taux de TPS proposé par défaut lors de la création de proposition commerciale, facture, commande, etc... répond à la règle standard suivante :
Si vendeur non assujetti à TPS, TPS par défaut=0. Fin de règle.
Si le (pays vendeur= pays acheteur) alors TPS par défaut=TPS du produit vendu. Fin de règle.
Si vendeur et acheteur dans Communauté européenne et bien vendu= moyen de transport neuf (auto, bateau, avion), TPS par défaut=0 (La TPS doit être payée par acheteur au centre d'impôts de son pays et non au vendeur). Fin de règle.
Si vendeur et acheteur dans Communauté européenne et acheteur= particulier alors TPS par défaut=TPS du produit vendu. Fin de règle.
Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TPS par défaut=0. Fin de règle.
Sinon TPS proposée par défaut=0. Fin de règle.
+VATIsNotUsedDesc=Le taux de TPS proposé par défaut est 0. C'est le cas d'associations, particuliers ou certaines petites sociétés. +VATIsUsedExampleFR=En France, il s'agit des sociétés ou organismes ayant choisi un régime fiscale réel (Réel simplifié ou Réel normal), régime dans lequel la TVA est déclarée. +VATIsNotUsedExampleFR=En France, il s'agit des associations ne déclarant pas de TVA ou sociétés, organismes ou professions libérales ayant choisi le régime fiscal micro entreprise (TVA en franchise) et payant une TVA en franchise sans faire de déclaration de TVA. Ce choix fait de plus apparaître la mention "TVA non applicable - art-293B du CGI" sur les factures. +##### Local Taxes ##### +LocalTax1IsUsed=Assujeti +LocalTax1IsNotUsed=Non assujeti +LocalTax1IsUsedDesc=Utilisation de 2ème type taxe (TVQ) +LocalTax1IsNotUsedDesc=Pas d'utilisation de 2ème type taxe (TVQ) +LocalTax1Management=Gestion TVQ +LocalTax1ManagementCA= Gestion TVQ +LocalTax1IsUsedDescCA= +LocalTax1IsNotUsedDescCA= +LocalTax1IsUsedExampleCA= +LocalTax1IsNotUsedExampleCA= diff --git a/htdocs/langs/fr_CA/companies.lang b/htdocs/langs/fr_CA/companies.lang new file mode 100644 index 00000000000..b3028ccfe5a --- /dev/null +++ b/htdocs/langs/fr_CA/companies.lang @@ -0,0 +1,7 @@ +# Dolibarr language file - en_US - companies +CHARSET=UTF-8 +VATIsUsed=Assujetti à la TPS +VATIsNotUsed=Non assujetti à la TPS +##### Local Taxes ##### +LocalTax1IsUsedES= Assujetti à TVQ +LocalTax1IsNotUsedES= Non assujetti à TVQ \ No newline at end of file diff --git a/htdocs/langs/fr_CA/main.lang b/htdocs/langs/fr_CA/main.lang index f888e0ca873..f6dcaec5379 100644 --- a/htdocs/langs/fr_CA/main.lang +++ b/htdocs/langs/fr_CA/main.lang @@ -19,8 +19,8 @@ AmountLT1=Montant TVQ TotalVAT=Total TPS TotalLT1=Total TVQ IncludedVAT=Dont TPS -VAT=TVQ -LT1CA=TPS +VAT=TPS +LT1CA=TVQ VATRate=Taux TPS ErrorNoVATRateDefinedForSellerCountry=Erreur, aucun taux de taxe défini pour le pays '%s'.