Fix: bad default vat calculation
This commit is contained in:
parent
cd9a6942ce
commit
c7e7b67433
@ -3096,20 +3096,10 @@ class Form
|
|||||||
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
|
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabled if customer is not subject to VAT
|
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
$disabled=false;
|
|
||||||
if (is_object($societe_acheteuse) && ! empty($societe_acheteuse->id)
|
|
||||||
&& $societe_acheteuse->tva_assuj == "0") {
|
|
||||||
$disabled=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').'>';
|
|
||||||
|
|
||||||
foreach ($this->cache_vatrates as $rate)
|
foreach ($this->cache_vatrates as $rate)
|
||||||
{
|
{
|
||||||
// Force 0 if customer is not subject to VAT
|
|
||||||
if ($disabled && $rate['txtva'] != 0) continue;
|
|
||||||
|
|
||||||
$return.= '<option value="'.$rate['txtva'];
|
$return.= '<option value="'.$rate['txtva'];
|
||||||
$return.= $rate['nprtva'] ? '*': '';
|
$return.= $rate['nprtva'] ? '*': '';
|
||||||
$return.= '"';
|
$return.= '"';
|
||||||
|
|||||||
@ -76,7 +76,7 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
|
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<?php
|
<?php
|
||||||
if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||||
else echo $form->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer);
|
else echo $form->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -146,7 +146,8 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
|
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<?php
|
<?php
|
||||||
echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer);
|
if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" value="0">0';
|
||||||
|
else echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer);
|
||||||
?>
|
?>
|
||||||
<input type="hidden" id="origin_tva_tx_cache" name="origin_tva_tx_cache" value="" />
|
<input type="hidden" id="origin_tva_tx_cache" name="origin_tva_tx_cache" value="" />
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user