FIX Do not show total of balance if currencies differs
This commit is contained in:
parent
c6293db23c
commit
372f50bbde
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
@ -237,6 +237,12 @@ if ($user->rights->banque->supprimer) $arrayofmassactions['delete']=$langs->tran
|
|||||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
|
$newcardbutton='';
|
||||||
|
if ($user->rights->banque->configurer)
|
||||||
|
{
|
||||||
|
$newcardbutton.='<a class="butAction" href="card.php?action=create">'.$langs->trans("NewFinancialAccount").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Lines of title fields
|
// Lines of title fields
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -248,7 +254,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||||
|
|
||||||
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1);
|
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,$newcardbutton,'',$limit, 1);
|
||||||
|
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
@ -415,10 +421,12 @@ print '</tr>';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$total = array(); $found = 0; $i=0;
|
$total = array(); $found = 0; $i=0; $lastcurrencycode='';
|
||||||
$var=true;
|
$var=true;
|
||||||
foreach ($accounts as $key=>$type)
|
foreach ($accounts as $key=>$type)
|
||||||
{
|
{
|
||||||
|
if ($i >= $limit) break;
|
||||||
|
|
||||||
$found++;
|
$found++;
|
||||||
|
|
||||||
$acc = new Account($db);
|
$acc = new Account($db);
|
||||||
@ -427,6 +435,15 @@ foreach ($accounts as $key=>$type)
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
$solde = $acc->solde(1);
|
$solde = $acc->solde(1);
|
||||||
|
|
||||||
|
if (! empty($lastcurrencycode) && $lastcurrencycode != $acc->currency_code)
|
||||||
|
{
|
||||||
|
$lastcurrencycode='various'; // We found several different currencies
|
||||||
|
}
|
||||||
|
if ($lastcurrencycode != 'various')
|
||||||
|
{
|
||||||
|
$lastcurrencycode=$acc->currency_code;
|
||||||
|
}
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -486,7 +503,6 @@ foreach ($accounts as $key=>$type)
|
|||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
@ -565,7 +581,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="'.$totalarray['nbfield'].'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
if (! $found) print '<tr '.$bc[$var].'><td colspan="'.$totalarray['nbfield'].'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
|
|
||||||
// Show total line
|
// Show total line
|
||||||
if (isset($totalarray['totalbalancefield']))
|
if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before
|
||||||
{
|
{
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -577,7 +593,7 @@ if (isset($totalarray['totalbalancefield']))
|
|||||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
}
|
}
|
||||||
elseif ($totalarray['totalbalancefield'] == $i) print '<td align="right">'.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $key).'</td>';
|
elseif ($totalarray['totalbalancefield'] == $i) print '<td align="right">'.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).'</td>';
|
||||||
else print '<td></td>';
|
else print '<td></td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -589,18 +605,6 @@ print "</div>";
|
|||||||
print "</form>";
|
print "</form>";
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Buttons actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '<div class="tabsAction">'."\n";
|
|
||||||
if ($user->rights->banque->configurer)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="card.php?action=create">'.$langs->trans("NewFinancialAccount").'</a>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user