Merge pull request #6735 from defrance/patch-6
NEW Add option SITUATION_DISPLAY_DIFF_ON_PDF to display progress or difference for situation invoices
This commit is contained in:
commit
e096974b2c
@ -1809,7 +1809,16 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
|
|||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($object->lines[$i]->special_code == 3) return '';
|
if ($object->lines[$i]->special_code == 3) return '';
|
||||||
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->situation_percent . '%';
|
if (empty($hidedetails) || $hidedetails > 1)
|
||||||
|
{
|
||||||
|
if($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
|
||||||
|
{
|
||||||
|
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||||
|
$result = ( $object->lines[$i]->situation_percent - $prev_progress) . '%';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$result = $object->lines[$i]->situation_percent . '%';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -1852,6 +1861,13 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
if (empty($hidedetails) || $hidedetails > 1)
|
if (empty($hidedetails) || $hidedetails > 1)
|
||||||
{
|
{
|
||||||
$total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
|
$total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
|
||||||
|
if ($object->lines[$i]->situation_percent > 0 )
|
||||||
|
{
|
||||||
|
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||||
|
$progress = ( $object->lines[$i]->situation_percent - $prev_progress) /100;
|
||||||
|
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
|
||||||
|
}
|
||||||
|
else
|
||||||
$result.=price($sign * $total_ht, 0, $outputlangs);
|
$result.=price($sign * $total_ht, 0, $outputlangs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user