Skip to content
Snippets Groups Projects
Commit 396012f7 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

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

on total for project
parent a94b7895
Branches
No related tags found
No related merge requests found
...@@ -269,6 +269,12 @@ foreach ($listofreferent as $key => $value) ...@@ -269,6 +269,12 @@ foreach ($listofreferent as $key => $value)
$element->fetch_thirdparty(); $element->fetch_thirdparty();
//print $classname; //print $classname;
$qualifiedfortotal=true;
if ($key == 'invoice')
{
if ($element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice
}
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
...@@ -290,19 +296,36 @@ foreach ($listofreferent as $key => $value) ...@@ -290,19 +296,36 @@ foreach ($listofreferent as $key => $value)
print '</td>'; print '</td>';
// Amount // 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 // 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 // Status
print '<td align="right">'.$element->getLibStatut(5).'</td>'; print '<td align="right">'.$element->getLibStatut(5).'</td>';
print '</tr>'; print '</tr>';
if ($qualifiedfortotal)
{
$total_ht = $total_ht + $element->total_ht; $total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc; $total_ttc = $total_ttc + $element->total_ttc;
} }
}
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Number").': '.$i.'</td>'; print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Number").': '.$i.'</td>';
if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>'; if (empty($value['disableamount'])) print '<td align="right" width="100">'.$langs->trans("TotalHT").' : '.price($total_ht).'</td>';
...@@ -385,10 +408,12 @@ foreach ($listofreferent as $key => $value) ...@@ -385,10 +408,12 @@ foreach ($listofreferent as $key => $value)
$element->fetch($elementarray[$i]); $element->fetch($elementarray[$i]);
$element->fetch_thirdparty(); $element->fetch_thirdparty();
//print $classname; //print $classname;
if ($qualified)
{
$total_ht = $total_ht + $element->total_ht; $total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc; $total_ttc = $total_ttc + $element->total_ttc;
} }
}
print '<tr >'; print '<tr >';
print '<td align="left" >'.$classname.'</td>'; print '<td align="left" >'.$classname.'</td>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment