Merge pull request #574 from simnandez/3.3

Fix: Modify Spanish localtax2 to new rate
This commit is contained in:
Laurent Destailleur 2013-01-05 03:29:54 -08:00
commit a9ff3c2be1
3 changed files with 78 additions and 31 deletions

View File

@ -237,8 +237,8 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$type = $productsupplier->type;
// Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2, $object->thirdparty);
$localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty);
$result=$object->addline(
$desc,
@ -268,8 +268,8 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$tva_tx = price2num($_POST['tva_tx']);
// Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2, $object->thirdparty);
$localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty);
if (! $_POST['dp_desc'])
{
@ -340,8 +340,8 @@ else if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer
if ($product->fetch($_POST["elrowid"]) < 0) dol_print_error($db);
}
$localtax1_tx=get_localtax($_POST['tva_tx'],1,$object->thirdparty);
$localtax2_tx=get_localtax($_POST['tva_tx'],2,$object->thirdparty);
$localtax1_tx=get_localtax($_POST['tva_tx'],1,$mysoc,$object->thirdparty);
$localtax2_tx=get_localtax($_POST['tva_tx'],2,$mysoc,$object->thirdparty);
$result = $object->updateline(
$_POST['elrowid'],
@ -1065,12 +1065,17 @@ if (! empty($object->id))
if (! empty($conf->projet->enabled)) $nbrow++;
//Local taxes
//TODO: Place into a function to control showing by country or study better option
if ($mysoc->country_code=='ES')
{
if($mysoc->localtax1_assuj=="1") $nbrow++;
if($object->thirdparty->localtax2_assuj=="1") $nbrow++;
}
else
{
if($mysoc->localtax1_assuj=="1") $nbrow++;
if($mysoc->localtax2_assuj=="1") $nbrow++;
}
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/liste.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
@ -1224,6 +1229,7 @@ if (! empty($object->id))
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option
if ($mysoc->country_code=='ES')
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
@ -1232,7 +1238,22 @@ if (! empty($object->id))
print '<td align="right">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
if ($object->thirdparty->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
}
else
{
if ($mysoc->localtax1_assuj=="1") //Localtax1
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax2).'</td>';

View File

@ -454,8 +454,8 @@ elseif ($action == 'update_line')
}
$localtax1tx= get_localtax($_POST['tauxtva'], 1, $object->thirdparty);
$localtax2tx= get_localtax($_POST['tauxtva'], 2, $object->thirdparty);
$localtax1tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
$localtax2tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
$remise_percent=GETPOST('remise_percent');
$result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent);
@ -502,8 +502,8 @@ elseif ($action == 'addline')
$tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']);
$localtax1tx= get_localtax($tvatx, 1, $object->thirdparty);
$localtax2tx= get_localtax($tvatx, 2, $object->thirdparty);
$localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty);
$localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty);
$remise_percent=GETPOST('remise_percent');
$type = $product->type;
@ -520,8 +520,8 @@ elseif ($action == 'addline')
else
{
$tauxtva = price2num($_POST['tauxtva']);
$localtax1tx= get_localtax($tauxtva, 1, $object->thirdparty);
$localtax2tx= get_localtax($tauxtva, 2, $object->thirdparty);
$localtax1tx= get_localtax($tauxtva, 1, $mysoc,$object->thirdparty);
$localtax2tx= get_localtax($tauxtva, 2, $mysoc,$object->thirdparty);
$remise_percent=GETPOST('remise_percent');
if (! $_POST['dp_desc'])
@ -1382,9 +1382,17 @@ else
// Local taxes
// TODO I use here $societe->localtax1_assuj. Before it was $mysoc->localtax1_assuj, but this is a supplier invoice, so made by supplier, so depends on supplier properties
if ($societe->localtax1_assuj=="1") $nbrows++;
if ($societe->localtax2_assuj=="1") $nbrows++;
if ($mysoc->country_code=='ES')
{
if($mysoc->localtax1_assuj=="1") $nbrows++;
if($societe->localtax2_assuj=="1") $nbrows++;
}
else
{
if ($societe->localtax1_assuj=="1") $nbrows++;
if ($societe->localtax2_assuj=="1") $nbrows++;
}
print '<td rowspan="'.$nbrows.'" valign="top">';
$sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,';
@ -1493,19 +1501,37 @@ else
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right">'.price($object->total_tva).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// Amount Local Taxes
if ($societe->localtax1_assuj=="1") //Localtax1 RE
//TODO: Place into a function to control showing by country or study better option
if ($mysoc->country_code=='ES')
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($societe->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
}
if ($societe->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
else
{
if ($societe->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($societe->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
}
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right">'.price($object->total_ttc).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// Project

View File

@ -190,10 +190,10 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (20
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1);
-- SPAIN (id country=4)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-15','1','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-15','1','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-15','1','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-15','1','VAT Rate 0',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-21','1','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-21','1','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-21','1','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-21','1','VAT Rate 0',1);
-- SWEDEN (id country=20)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (201,20, '25','0','VAT standard rate',1);