This commit is contained in:
Laurent Destailleur 2017-10-06 15:48:48 +02:00
parent d07ec07896
commit d808add499
2 changed files with 32 additions and 18 deletions

View File

@ -53,6 +53,7 @@ UseDateWithoutHourOnFichinter=Hides hours and minutes off the date field for int
InterventionStatistics=Statistics of interventions
NbOfinterventions=Nb of intervention cards
NumberOfInterventionsByMonth=Nb of intervention cards by month (date of validation)
AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit. Add option PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT to 1 into home-setup-other to include them.
##### Exports #####
InterId=Intervention id
InterRef=Intervention ref.

View File

@ -610,23 +610,31 @@ foreach ($listofreferent as $key => $value)
if ($qualifiedfortotal) $total_ttc = $total_ttc + $total_ttc_by_line;
}
// Calculate margin
if ($margin=="add")
{
$balance_ht+= $total_ht;
$balance_ttc+= $total_ttc;
}
else
{
$balance_ht-= $total_ht;
$balance_ttc-= $total_ttc;
}
// Each element with at least one line is output
$qualifiedforfinalprofit=true;
if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) $qualifiedforfinalprofit=false;
//var_dump($key);
// Show $total_ht & $total_ttc -- add a minus when necessary
if ($margin!="add")
// Calculate margin
if ($qualifiedforfinalprofit)
{
$total_ht = -$total_ht;
$total_ttc = -$total_ttc;
if ($margin=="add")
{
$balance_ht+= $total_ht;
$balance_ttc+= $total_ttc;
}
else
{
$balance_ht-= $total_ht;
$balance_ttc-= $total_ttc;
}
// Show $total_ht & $total_ttc -- add a minus when necessary
if ($margin!="add")
{
$total_ht = -$total_ht;
$total_ttc = -$total_ttc;
}
}
/*switch ($classname) {
@ -655,16 +663,21 @@ foreach ($listofreferent as $key => $value)
$newclassname = $classname;
}*/
$var = ! $var;
print '<tr class="oddeven">';
// Module
print '<td align="left">'.$name.'</td>';
// Nb
print '<td align="right">'.$i.'</td>';
// Amount HT
print '<td align="right">'.price($total_ht).'</td>';
print '<td align="right">';
if (! $qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
else print price($total_ht);
print '</td>';
// Amount TTC
print '<td align="right">'.price($total_ttc).'</td>';
print '<td align="right">';
if (! $qualifiedforfinalprofit) print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).'</span>';
else print price($total_ttc);
print '</td>';
print '</tr>';
}
}