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'];
|
||||
}
|
||||
|
||||
// Disabled if customer is not subject to VAT
|
||||
$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"':'').'>';
|
||||
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
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.= $rate['nprtva'] ? '*': '';
|
||||
$return.= '"';
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* $dateSelector
|
||||
* $this (invoice, order, ...)
|
||||
* $line defined
|
||||
*/
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||
@ -35,7 +35,7 @@
|
||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||
<?php
|
||||
$colspan = 4;
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
?>
|
||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
||||
<?php
|
||||
@ -76,7 +76,7 @@ if (! empty($conf->margin->enabled)) {
|
||||
|
||||
<td align="right">
|
||||
<?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);
|
||||
?>
|
||||
</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>
|
||||
<?php
|
||||
$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>
|
||||
<?php
|
||||
@ -99,12 +99,12 @@ if (! empty($conf->margin->enabled)) {
|
||||
</tr>
|
||||
|
||||
|
||||
<?php if ($conf->service->enabled && $dateSelector) {
|
||||
<?php if ($conf->service->enabled && $dateSelector) {
|
||||
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
$colspan = 10;
|
||||
else
|
||||
$colspan = 9;
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
||||
$colspan++;
|
||||
if($conf->global->DISPLAY_MARK_RATES)
|
||||
|
||||
@ -146,7 +146,8 @@ if (! empty($conf->margin->enabled)) {
|
||||
|
||||
<td align="right">
|
||||
<?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="" />
|
||||
</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user