Merge pull request #497 from simnandez/develop

[ task #204 ] Manage canadian, spain and other country double VAT with a generic system. Add spanish tests
This commit is contained in:
Laurent Destailleur 2012-11-27 11:01:25 -08:00
commit 85c702423e
3 changed files with 19 additions and 9 deletions

View File

@ -2703,9 +2703,8 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
// Some test to guess with no need to make database access
if ($mysoc->country_code == 'ES') // For spain, localtaxes are qualified if both supplier and seller use local taxe
{
if ($local == 1 && (! $thirdparty_seller->localtax1_assuj || ! $thirdparty_buyer->localtax1_assuj)) return 0;
if ($local == 2 && (! $thirdparty_seller->localtax2_assuj || ! $thirdparty_buyer->localtax2_assuj)) return 0;
if ($local == 1 && ! $thirdparty_buyer->localtax1_assuj) return 0;
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
}
else
{
@ -2995,18 +2994,27 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod)
*/
function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0)
{
global $mysoc;
if (!is_object($thirdparty_seller)) return -1;
if (!is_object($thirdparty_buyer)) return -1;
if ($local==1) //RE
if ($local==1) // Localtax 1
{
// Si vendeur non assujeti a RE, localtax1 par default=0
if (is_numeric($thirdparty_seller->localtax1_assuj) && ! $thirdparty_seller->localtax1_assuj) return 0;
if (! is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj=='localtax1off') return 0;
if ($mysoc->country_code == 'ES')
{
if (is_numeric($thirdparty_buyer->localtax1_assuj) && ! $thirdparty_buyer->localtax1_assuj) return 0;
}
else
{
// Si vendeur non assujeti a Localtax1, localtax1 par default=0
if (is_numeric($thirdparty_seller->localtax1_assuj) && ! $thirdparty_seller->localtax1_assuj) return 0;
if (! is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj=='localtax1off') return 0;
}
}
elseif ($local==2) //IRPF
elseif ($local==2) //I Localtax 2
{
// Si vendeur non assujeti a IRPF, localtax2 par default=0
// Si vendeur non assujeti a Localtax2, localtax2 par default=0
if (is_numeric($thirdparty_seller->localtax2_assuj) && ! $thirdparty_seller->localtax2_assuj) return 0;
if (! is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj=='localtax2off') return 0;
}

View File

@ -12,6 +12,7 @@ Language_en_AU=Anglès (Australia)
Language_en_GB=Anglès (Regne Unit)
Language_en_IN=Anglès (Índia)
Language_en_NZ=Anglais (Nova Zelanda)
Language_en_SA=Inglés (Aràbia Saudita)
Language_en_US=Anglès (Estats Units)
Language_es_ES=Espanyol
Language_es_AR=Espanyol (Argentina)

View File

@ -14,6 +14,7 @@ Language_en_AU=Inglés (Australia)
Language_en_GB=Inglés (Reino Unido)
Language_en_IN=Inglés (India)
Language_en_NZ=Inglés (Nueva Zelanda)
Language_en_SA=Inglés (Arabia Saudita)
Language_en_US=Inglés (Estados Unidos)
Language_es_ES=Español
Language_es_AR=Español (Argentina)