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 InterventionStatistics=Statistics of interventions
NbOfinterventions=Nb of intervention cards NbOfinterventions=Nb of intervention cards
NumberOfInterventionsByMonth=Nb of intervention cards by month (date of validation) 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 ##### ##### Exports #####
InterId=Intervention id InterId=Intervention id
InterRef=Intervention ref. InterRef=Intervention ref.

View File

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