For countries using the 2nd or 3rd tax, we force

MAIN_NO_INPUT_PRICE_WITH_TAX to disable input/edit of lines using the
price including tax (because 2nb and 3rd tax not yet taken into
account).
Work In Progress to support all taxes into unit price entry when
MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES is set.
This commit is contained in:
Laurent Destailleur 2023-03-11 20:25:27 +01:00
parent 81d2618b59
commit 5ec52548ab
5 changed files with 22 additions and 2 deletions

View File

@ -923,6 +923,8 @@ if (empty($reshook)) {
$price_ttc = '';
$price_ttc_devise = '';
// TODO Implement if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES'))
if (GETPOST('price_ht') !== '') {
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
}

View File

@ -865,6 +865,8 @@ class Propal extends CommonObject
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// TODO Implement if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) ?
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];

View File

@ -225,7 +225,11 @@ $coldisplay++;
if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
$coldisplay++;
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(GETPOSTISSET('price_ttc') ? GETPOST('price_ttc') : (isset($line->pu_ttc) ? price($line->pu_ttc, 0, '', 0) : '')).'"';
$upinctax = isset($line->pu_ttc) ? $line->pu_ttc : null;
if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) {
$upinctax = price2num($line->total_ttc / $line->qty, 'MU');
}
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(GETPOSTISSET('price_ttc') ? GETPOST('price_ttc') : (isset($upinctax) ? price($upinctax, 0, '', 0) : '')).'"';
if ($line->fk_prev_id != null) {
print ' readonly';
}

View File

@ -326,7 +326,13 @@ print $tooltiponpriceend;
<?php }
if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
<td class="linecoluttc nowraponall right"><?php $coldisplay++; ?><?php print (isset($line->pu_ttc) ? price($sign * $line->pu_ttc) : price($sign * $line->subprice)); ?></td>
<td class="linecoluttc nowraponall right"><?php $coldisplay++; ?><?php
$upinctax = isset($line->pu_ttc) ? $line->pu_ttc : null;
if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) {
$upinctax = price2num($line->total_ttc / $line->qty, 'MU');
}
print (isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice));
?></td>
<?php } ?>
<td class="linecolqty nowraponall right"><?php $coldisplay++; ?>

View File

@ -218,6 +218,12 @@ if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) {
// For FR, default value of option to show profid SIRET is on by default
$conf->global->MAIN_PROFID1_IN_ADDRESS = 1;
}
if ($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) {
// For countries using the 2nd or 3rd tax, we disable input/edit of lines using the price including tax (because 2nb and 3rd tax not yet taken into account).
// Work In Progress to support all taxes into unit price entry when MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES is set.
$conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1;
}
}