diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 4636fd5fd3f..c055642803d 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -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 '
| '.$langs->trans("Currency".$conf->currency).' | '; // 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 ''.price($object->total_localtax1).' | '; print ''.$langs->trans("Currency".$conf->currency).' | '; } - if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF + if ($object->thirdparty->localtax2_assuj=="1") //Localtax2 IRPF + { + print '|
| '.$langs->transcountry("AmountLT2",$mysoc->country_code).' | '; + print ''.price($object->total_localtax2).' | '; + print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->transcountry("AmountLT1",$mysoc->country_code).' | '; + print ''.price($object->total_localtax1).' | '; + print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->transcountry("AmountLT2",$mysoc->country_code).' | '; print ''.price($object->total_localtax2).' | '; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 72bf3d36824..4b3adfe8de5 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -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 ''; $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; @@ -1493,19 +1501,37 @@ else print ' | |
| '.$langs->trans('AmountVAT').' | '.price($object->total_tva).' | '.$langs->trans('Currency'.$conf->currency).' | |
| '.$langs->transcountry("AmountLT1",$societe->country_code).' | '; - print ''.price($object->total_localtax1).' | '; - print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->transcountry("AmountLT1",$societe->country_code).' | '; + print ''.price($object->total_localtax1).' | '; + print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->transcountry("AmountLT2",$societe->country_code).' | '; + print ''.price($object->total_localtax2).' | '; + print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->transcountry("AmountLT2",$societe->country_code).' | '; - print ''.price($object->total_localtax2).' | '; - print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->transcountry("AmountLT1",$societe->country_code).' | '; + print ''.price($object->total_localtax1).' | '; + print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->transcountry("AmountLT2",$societe->country_code).' | '; + print ''.price($object->total_localtax2).' | '; + print ''.$langs->trans("Currency".$conf->currency).' | |
| '.$langs->trans('AmountTTC').' | '.price($object->total_ttc).' | '.$langs->trans('Currency'.$conf->currency).' | |