Make different vat rates visible

This commit is contained in:
Laurent Destailleur 2017-08-29 20:40:51 +02:00
parent 2cf924ab74
commit 991a33f7b6
2 changed files with 28 additions and 13 deletions

View File

@ -3702,7 +3702,13 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
$info_bits |= 1; $info_bits |= 1;
} }
$ret=price($rate,0,'',0,0).($addpercent?'%':''); // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price()
if (! preg_match('/\//', $rate)) $ret=price($rate,0,'',0,0).($addpercent?'%':'');
else
{
// TODO Split on / and output with a price2num to have clean numbers with ton of 000.
$ret=$rate.($addpercent?'%':'');
}
if ($info_bits & 1) $ret.=' *'; if ($info_bits & 1) $ret.=' *';
$ret.=$morelabel; $ret.=$morelabel;
return $ret; return $ret;

View File

@ -32,7 +32,7 @@
* $usemargins (0 to disable all margins columns, 1 to show according to margin setup) * $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
* $object_rights->creer initialized from = $object->getRights() * $object_rights->creer initialized from = $object->getRights()
* $disableedit, $disablemove, $disableremove * $disableedit, $disablemove, $disableremove
* *
* $type, $text, $description, $line * $type, $text, $description, $line
*/ */
@ -55,7 +55,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td> <td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?> <?php } ?>
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div> <td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<?php <?php
if (($line->info_bits & 2) == 2) { if (($line->info_bits & 2) == 2) {
?> ?>
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>"> <a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
@ -83,7 +83,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
$discount->fetch($line->fk_remise_except); $discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
// Add date of deposit // Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE))
echo ' ('.dol_print_date($discount->datec).')'; echo ' ('.dol_print_date($discount->datec).')';
} }
elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0)
@ -101,11 +101,11 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
else else
{ {
$format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day';
if ($line->fk_product > 0) if ($line->fk_product > 0)
{ {
echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
// Show range // Show range
echo get_date_range($line->date_start, $line->date_end, $format); echo get_date_range($line->date_start, $line->date_end, $format);
@ -138,17 +138,26 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
</td> </td>
<?php if ($object->element == 'supplier_proposal') { ?> <?php if ($object->element == 'supplier_proposal') { ?>
<td class="linecolrefsupplier" align="right"><?php echo $line->ref_fourn; ?></td> <td class="linecolrefsupplier" align="right"><?php echo $line->ref_fourn; ?></td>
<?php } <?php }
// VAT Rate // VAT Rate
?> ?>
<td align="right" class="linecolvat nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); ?></td> <td align="right" class="linecolvat nowrap"><?php $coldisplay++; ?><?php
//var_dump($line);
$positiverates='';
if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
if (price2num($line->localtax1_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
if (price2num($line->localtax2_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx);
if (empty($positiverates)) $positiverates='0';
echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits);
//echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits);
?></td>
<td align="right" class="linecoluht nowrap"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td> <td align="right" class="linecoluht nowrap"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
<?php if (!empty($conf->multicurrency->enabled)) { ?> <?php if (!empty($conf->multicurrency->enabled)) { ?>
<td align="right" class="linecoluht_currency nowrap"><?php $coldisplay++; ?><?php echo price($line->multicurrency_subprice); ?></td> <td align="right" class="linecoluht_currency nowrap"><?php $coldisplay++; ?><?php echo price($line->multicurrency_subprice); ?></td>
<?php } ?> <?php } ?>
<?php if ($inputalsopricewithtax) { ?> <?php if ($inputalsopricewithtax) { ?>
<td align="right" class="linecoluttc nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td> <td align="right" class="linecoluttc nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td>
<?php } ?> <?php } ?>
@ -194,7 +203,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
{ {
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
?> ?>
<?php if (!empty($user->rights->margins->creer)) { ?> <?php if (!empty($user->rights->margins->creer)) { ?>
<td align="right" class="linecolmargin1 nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td> <td align="right" class="linecolmargin1 nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<?php } ?> <?php } ?>
@ -220,7 +229,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
<?php } ?> <?php } ?>
<?php <?php
if ($this->statut == 0 && ($object_rights->creer)) { ?> if ($this->statut == 0 && ($object_rights->creer)) { ?>
<td class="linecoledit" align="center"><?php $coldisplay++; ?> <td class="linecoledit" align="center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?> <?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
@ -241,7 +250,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
?> ?>
</td> </td>
<?php <?php
if ($num > 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> if ($num > 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?>
<td align="center" class="linecolmove tdlineupdown"><?php $coldisplay++; ?> <td align="center" class="linecolmove tdlineupdown"><?php $coldisplay++; ?>
<?php if ($i > 0) { ?> <?php if ($i > 0) { ?>