Merge pull request #32238 from FHenry/20_fix_CA_report_evolpercent_bookeeping_mode
fix: CA report with BOOKKEEPING do not display persent evolution
This commit is contained in:
commit
9543d00d35
3 changed files with 29 additions and 15 deletions
|
|
@ -487,22 +487,29 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
|||
//var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
|
||||
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
|
||||
if ($annee_decalage > $minyear && $case <= $casenow) {
|
||||
if (!empty($cumulative_ht[$caseprev]) && !empty($cumulative_ht[$case])) {
|
||||
$percent = (round(($cumulative_ht[$case] - $cumulative_ht[$caseprev]) / $cumulative_ht[$caseprev], 4) * 100);
|
||||
//print "X $cumulative_ht[$case] - $cumulative_ht[$caseprev] - $cumulative_ht[$caseprev] - $percent X";
|
||||
if ($modecompta=='CREANCES-DETTES') {
|
||||
$cumulative_previous_year = (!empty($cumulative_ht[$caseprev])?$cumulative_ht[$caseprev]:0);
|
||||
$cumulative_year = (!empty($cumulative_ht[$case])?$cumulative_ht[$case]:0);
|
||||
} else {
|
||||
$cumulative_previous_year = (!empty($cumulative[$caseprev])?$cumulative[$caseprev]:0);
|
||||
$cumulative_year = (!empty($cumulative[$case])?$cumulative[$case]:0);
|
||||
}
|
||||
if (!empty($cumulative_previous_year) && !empty($cumulative_year)) {
|
||||
$percent = (round(($cumulative_year - $cumulative_previous_year) / $cumulative_previous_year, 4) * 100);
|
||||
//print "X $cumulative_year - $cumulative_previous_year - $cumulative_previous_year - $percent X";
|
||||
print($percent >= 0 ? "+$percent" : "$percent").'%';
|
||||
}
|
||||
if (!empty($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) {
|
||||
if (!empty($cumulative_previous_year) && empty($cumulative_year)) {
|
||||
print '-100%';
|
||||
}
|
||||
if (empty($cumulative_ht[$caseprev]) && !empty($cumulative_ht[$case])) {
|
||||
if (empty($cumulative_previous_year) && !empty($cumulative_year)) {
|
||||
//print '<td class="right">+Inf%</td>';
|
||||
print '-';
|
||||
}
|
||||
if (isset($cumulative_ht[$caseprev]) && empty($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) {
|
||||
if (isset($cumulative_previous_year) && empty($cumulative_previous_year) && empty($cumulative_year)) {
|
||||
print '+0%';
|
||||
}
|
||||
if (!isset($cumulative_ht[$caseprev]) && empty($cumulative_ht[$case])) {
|
||||
if (!isset($cumulative_previous_year) && empty($cumulative_year)) {
|
||||
print '-';
|
||||
}
|
||||
} else {
|
||||
|
|
@ -607,7 +614,7 @@ print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td>';
|
|||
for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
// Montant total HT
|
||||
if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
|
||||
if (isset($total_ht[$annee]) || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
|
||||
print '<td class="nowrap right">';
|
||||
print(empty($total_ht[$annee]) ? '0' : price($total_ht[$annee]));
|
||||
print "</td>";
|
||||
|
|
@ -627,19 +634,26 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
|||
|
||||
// Pourcentage total
|
||||
if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
|
||||
if (!empty($total_ht[$annee - 1]) && !empty($total_ht[$annee])) {
|
||||
$percent = (round(($total_ht[$annee] - $total_ht[$annee - 1]) / $total_ht[$annee - 1], 4) * 100);
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$total_previous_year = (!empty($total_ht[$annee - 1])?$total_ht[$annee - 1]:0);
|
||||
$total_year = (!empty($total_ht[$annee])?$total_ht[$annee]:0);
|
||||
} else {
|
||||
$total_previous_year = (!empty($total[$annee - 1])?$total[$annee - 1]:0);
|
||||
$total_year = (!empty($total[$annee])?$total[$annee]:0);
|
||||
}
|
||||
if (!empty($total_previous_year) && !empty($total_year)) {
|
||||
$percent = (round(($total_year - $total_previous_year) / $total_previous_year, 4) * 100);
|
||||
print '<td class="nowrap borderrightlight right">';
|
||||
print($percent >= 0 ? "+$percent" : "$percent").'%';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($total_ht[$annee - 1]) && empty($total_ht[$annee])) {
|
||||
if (!empty($total_previous_year) && empty($total_year)) {
|
||||
print '<td class="borderrightlight right">-100%</td>';
|
||||
}
|
||||
if (empty($total_ht[$annee - 1]) && !empty($total_ht[$annee])) {
|
||||
if (empty($total_previous_year) && !empty($total_year)) {
|
||||
print '<td class="borderrightlight right">+'.$langs->trans('Inf').'%</td>';
|
||||
}
|
||||
if (empty($total_ht[$annee - 1]) && empty($total_ht[$annee])) {
|
||||
if (empty($total_previous_year) && empty($total_year)) {
|
||||
print '<td class="borderrightlight right">+0%</td>';
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
$tva_tx = $lines[$i]->tva_tx;
|
||||
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) {
|
||||
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) {
|
||||
$tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1339,7 +1339,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
$tva_tx = $lines[$i]->tva_tx;
|
||||
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) {
|
||||
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) {
|
||||
$tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue