Fix use of currency accuracy
This commit is contained in:
parent
63b9656468
commit
0b73cdb7cc
@ -243,8 +243,6 @@ if (!empty($line->remise_percent) && $line->special_code != 3) {
|
|||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
|
||||||
|
|
||||||
// Fields for situation invoices
|
// Fields for situation invoices
|
||||||
if ($this->situation_cycle_ref)
|
if ($this->situation_cycle_ref)
|
||||||
{
|
{
|
||||||
@ -263,10 +261,10 @@ if ($usemargins && ! empty($conf->margin->enabled) && empty($user->socid))
|
|||||||
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
|
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?>
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?>
|
||||||
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
|
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price(price2num($line->marge_tx, 'MT')).'%'); ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
|
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
|
||||||
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td>
|
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price(price2num($line->marque_tx, 'MT')).'%'; ?></td>
|
||||||
<?php }
|
<?php }
|
||||||
}
|
}
|
||||||
if ($line->special_code == 3) { ?>
|
if ($line->special_code == 3) { ?>
|
||||||
|
|||||||
@ -188,7 +188,6 @@ if ($id > 0 || !empty($ref))
|
|||||||
$cumul_achat = 0;
|
$cumul_achat = 0;
|
||||||
$cumul_vente = 0;
|
$cumul_vente = 0;
|
||||||
$cumul_qty = 0;
|
$cumul_qty = 0;
|
||||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
|
||||||
|
|
||||||
if ($num > 0) {
|
if ($num > 0) {
|
||||||
while ($i < $num /*&& $i < $conf->liste_limit*/) {
|
while ($i < $num /*&& $i < $conf->liste_limit*/) {
|
||||||
@ -207,14 +206,14 @@ if ($id > 0 || !empty($ref))
|
|||||||
print "<td>".$objp->code_client."</td>\n";
|
print "<td>".$objp->code_client."</td>\n";
|
||||||
print "<td class=\"center\">";
|
print "<td class=\"center\">";
|
||||||
print dol_print_date($db->jdate($objp->datef), 'day')."</td>";
|
print dol_print_date($db->jdate($objp->datef), 'day')."</td>";
|
||||||
print "<td class=\"right\">".price($objp->selling_price, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($objp->selling_price, 'MT'))."</td>\n";
|
||||||
print "<td class=\"right\">".price($objp->buying_price, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($objp->buying_price, 'MT'))."</td>\n";
|
||||||
print "<td class=\"right\">".price($objp->qty, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($objp->qty, 'MT'))."</td>\n";
|
||||||
print "<td class=\"right\">".price($objp->marge, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($objp->marge, 'MT'))."</td>\n";
|
||||||
if (!empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (!empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td class=\"right\">".(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print "<td class=\"right\">".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."</td>\n";
|
||||||
if (!empty($conf->global->DISPLAY_MARK_RATES))
|
if (!empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
|
||||||
print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'</td>';
|
print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
@ -239,14 +238,14 @@ if ($id > 0 || !empty($ref))
|
|||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td colspan=4>'.$langs->trans('TotalMargin')."</td>";
|
print '<td colspan=4>'.$langs->trans('TotalMargin')."</td>";
|
||||||
print '<td class="right">'.price($cumul_vente, null, null, null, null, $rounding)."</td>\n";
|
print '<td class="right">'.price(price2num($cumul_vente, 'MT'))."</td>\n";
|
||||||
print '<td class="right">'.price($cumul_achat, null, null, null, null, $rounding)."</td>\n";
|
print '<td class="right">'.price(price2num($cumul_achat, 'MT'))."</td>\n";
|
||||||
print '<td class="right">'.price($cumul_qty, null, null, null, null, $rounding)."</td>\n";
|
print '<td class="right">'.price(price2num($cumul_qty, 'MT'))."</td>\n";
|
||||||
print '<td class="right">'.price($totalMargin, null, null, null, null, $rounding)."</td>\n";
|
print '<td class="right">'.price(price2num($totalMargin, 'MT'))."</td>\n";
|
||||||
if (!empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (!empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print '<td class="right">'.(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print '<td class="right">'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."</td>\n";
|
||||||
if (!empty($conf->global->DISPLAY_MARK_RATES))
|
if (!empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print "<td class=\"right\">".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."</td>\n";
|
||||||
print '<td class="right"> </td>';
|
print '<td class="right"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
@ -264,9 +263,9 @@ if ($id > 0 || !empty($ref))
|
|||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#totalMargin").html("'. price($totalMargin, null, null, null, null, $rounding).'");
|
$("#totalMargin").html("'. price(price2num($totalMargin, 'MT')).'");
|
||||||
$("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price($marginRate, null, null, null, null, $rounding)."%").'");
|
$("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
|
||||||
$("#markRate").html("'.(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%").'");
|
$("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
';
|
';
|
||||||
|
|||||||
@ -192,8 +192,6 @@ if ($socid > 0)
|
|||||||
$cumul_achat = 0;
|
$cumul_achat = 0;
|
||||||
$cumul_vente = 0;
|
$cumul_vente = 0;
|
||||||
|
|
||||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
while ($i < $num /*&& $i < $conf->liste_limit*/)
|
||||||
@ -216,13 +214,13 @@ if ($socid > 0)
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "<td class=\"center\">";
|
print "<td class=\"center\">";
|
||||||
print dol_print_date($db->jdate($objp->datef), 'day')."</td>";
|
print dol_print_date($db->jdate($objp->datef), 'day')."</td>";
|
||||||
print "<td class=\"right\">".price($objp->selling_price, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($objp->selling_price, 'MT'))."</td>\n";
|
||||||
print "<td class=\"right\">".price(($objp->type == 2 ? -1 : 1) * $objp->buying_price, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num(($objp->type == 2 ? -1 : 1) * $objp->buying_price, 'MT'))."</td>\n";
|
||||||
print "<td class=\"right\">".$sign.price($objp->marge, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".$sign.price(price2num($objp->marge, 'MT'))."</td>\n";
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td class=\"right\">".(($marginRate === '')?'n/a':$sign.price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print "<td class=\"right\">".(($marginRate === '')?'n/a':$sign.price(price2num($marginRate, 'MT'))."%")."</td>\n";
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td class=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print "<td class=\"right\">".(($markRate === '')?'n/a':price(price2num($markRate, 'MT'))."%")."</td>\n";
|
||||||
print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'</td>';
|
print '<td class="right">'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
@ -248,13 +246,13 @@ if ($socid > 0)
|
|||||||
// Total
|
// Total
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td colspan=2>'.$langs->trans('TotalMargin')."</td>";
|
print '<td colspan=2>'.$langs->trans('TotalMargin')."</td>";
|
||||||
print "<td class=\"right\">".price($cumul_vente, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($cumul_vente, 'MT'))."</td>\n";
|
||||||
print "<td class=\"right\">".price($cumul_achat, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($cumul_achat, 'MT'))."</td>\n";
|
||||||
print "<td class=\"right\">".price($totalMargin, null, null, null, null, $rounding)."</td>\n";
|
print "<td class=\"right\">".price(price2num($totalMargin, 'MT'))."</td>\n";
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
print "<td class=\"right\">".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print "<td class=\"right\">".(($marginRate === '')?'n/a':price(price2num($marginRate, 'MT'))."%")."</td>\n";
|
||||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
print "<td class=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
|
print "<td class=\"right\">".(($markRate === '')?'n/a':price(price2num($markRate, 'MT'))."%")."</td>\n";
|
||||||
print '<td class="right"> </td>';
|
print '<td class="right"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
@ -277,9 +275,9 @@ else
|
|||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#totalMargin").html("'. price($totalMargin, null, null, null, null, $rounding).'");
|
$("#totalMargin").html("'. price(price2num($totalMargin, 'MT')).'");
|
||||||
$("#marginRate").html("'.(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%").'");
|
$("#marginRate").html("'.(($marginRate === '')?'n/a':price(price2num($marginRate, 'MT'))."%").'");
|
||||||
$("#markRate").html("'.(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%").'");
|
$("#markRate").html("'.(($markRate === '')?'n/a':price(price2num($markRate, 'MT'))."%").'");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
';
|
';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user