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.= '"';
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
* $dateSelector
|
* $dateSelector
|
||||||
* $this (invoice, order, ...)
|
* $this (invoice, order, ...)
|
||||||
* $line defined
|
* $line defined
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
?>
|
?>
|
||||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
@ -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>
|
||||||
@ -85,7 +85,7 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
?>
|
?>
|
||||||
<td align="right"><input type="text" size="5" name="np_buying_price" value="<?php echo (isset($_POST["np_buying_price"])?$_POST["np_buying_price"]:''); ?>"></td>
|
<td align="right"><input type="text" size="5" name="np_buying_price" value="<?php echo (isset($_POST["np_buying_price"])?$_POST["np_buying_price"]:''); ?>"></td>
|
||||||
<?php
|
<?php
|
||||||
@ -99,12 +99,12 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<?php if ($conf->service->enabled && $dateSelector) {
|
<?php if ($conf->service->enabled && $dateSelector) {
|
||||||
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||||
$colspan = 10;
|
$colspan = 10;
|
||||||
else
|
else
|
||||||
$colspan = 9;
|
$colspan = 9;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
if($conf->global->DISPLAY_MARGIN_RATES)
|
||||||
$colspan++;
|
$colspan++;
|
||||||
if($conf->global->DISPLAY_MARK_RATES)
|
if($conf->global->DISPLAY_MARK_RATES)
|
||||||
|
|||||||
@ -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