2
0
forked from Wavyzz/dolibarr

Fix: When an invoice is replaced with another, amount must not appears

on total for project
This commit is contained in:
Laurent Destailleur
2014-06-24 15:37:10 +02:00
parent a94b78958f
commit 1db9514fed

View File

@@ -246,7 +246,7 @@ foreach ($listofreferent as $key => $value)
print '</form>';
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Ref").'</td>';
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
@@ -269,6 +269,12 @@ foreach ($listofreferent as $key => $value)
$element->fetch_thirdparty();
//print $classname;
$qualifiedfortotal=true;
if ($key == 'invoice')
{
if ($element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice
}
$var=!$var;
print "<tr ".$bc[$var].">";
@@ -290,18 +296,35 @@ foreach ($listofreferent as $key => $value)
print '</td>';
// Amount
if (empty($value['disableamount'])) print '<td align="right">'.(isset($element->total_ht)?price($element->total_ht):'&nbsp;').'</td>';
if (empty($value['disableamount']))
{
print '<td align="right">';
if (! $qualifiedfortotal) print '<strike>';
print (isset($element->total_ht)?price($element->total_ht):'&nbsp;');
if (! $qualifiedfortotal) print '</strike>';
print '</td>';
}
// Amount
if (empty($value['disableamount'])) print '<td align="right">'.(isset($element->total_ttc)?price($element->total_ttc):'&nbsp;').'</td>';
if (empty($value['disableamount']))
{
print '<td align="right">';
if (! $qualifiedfortotal) print '<strike>';
print (isset($element->total_ttc)?price($element->total_ttc):'&nbsp;');
if (! $qualifiedfortotal) print '</strike>';
print '</td>';
}
// Status
print '<td align="right">'.$element->getLibStatut(5).'</td>';
print '</tr>';
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
if ($qualifiedfortotal)
{
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
}
}
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Number").': '.$i.'</td>';
@@ -385,9 +408,11 @@ foreach ($listofreferent as $key => $value)
$element->fetch($elementarray[$i]);
$element->fetch_thirdparty();
//print $classname;
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
if ($qualified)
{
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
}
}
print '<tr >';