Skip to content

Commit

Permalink
Fix: When an invoice is replaced with another, amount must not appears
Browse files Browse the repository at this point in the history
on total for project
  • Loading branch information
eldy committed Jun 24, 2014
1 parent a94b789 commit 396012f
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions htdocs/projet/element.php
Expand Up @@ -246,7 +246,7 @@
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>';
Expand All @@ -269,6 +269,12 @@
$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].">";

Expand All @@ -290,18 +296,35 @@
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>';
Expand Down Expand Up @@ -385,9 +408,11 @@
$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 >';
Expand Down

0 comments on commit 396012f

Please sign in to comment.