Browse Source

Display progress proprely on situation invoices

Mathieu Moulin 1 year ago
parent
commit
276d958b28

+ 13 - 6
htdocs/core/modules/facture/doc/pdf_sponge.modules.php

@@ -800,9 +800,11 @@ class pdf_sponge extends ModelePDFFactures
 					// Situation progress
 					if ($this->getColumnStatus('progress')) {
 						$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
-						// MMI Hack
-						if (!empty($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) && $progress != ' ' && $object->lines[$i]->situation_percent>0) {
-							$progress2 = $progress;
+						// MMI Hack : Hooks does not permit to retrieve infos
+						if ($conf->mmidocuments->enabled && !empty($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) && $progress != ' ' && $object->lines[$i]->situation_percent>0) {
+							if ($progress>0) {
+								$progress = '+'.$progress;
+							}
 							$progress = $progress.'<br />('.$object->lines[$i]->situation_percent.'%)';
 						}
 						$this->printStdColumnContent($pdf, $curY, 'progress', $progress);
@@ -826,9 +828,14 @@ class pdf_sponge extends ModelePDFFactures
 					// Total excl tax line (HT)
 					if ($this->getColumnStatus('totalexcltax')) {
 						$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
-						// MMI Hack
-						if (!empty($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) && $total_excl_tax != ' ' && $object->lines[$i]->situation_percent>0) {
-							$total_excl_tax = $total_excl_tax.'<br />('.round($qty*$up_excl_tax*$object->lines[$i]->situation_percent/100, 2).'€)';
+						// MMI Hack : Hooks does not permit to retrieve infos
+						if ($conf->mmidocuments->enabled && $total_excl_tax != ' ' && $object->lines[$i]->situation_percent>0) {
+							if (!empty($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)) {
+								$total_excl_tax = $total_excl_tax.'<br />('.number_format(round(str_replace(',', '.', $qty)*str_replace([' ', ','], ['', '.'], $up_excl_tax)*str_replace(',', '.', $object->lines[$i]->situation_percent)/100, 2), 2, ',', ' ').')';
+							}
+							else {
+								$total_excl_tax = number_format(round($object->lines[$i]->total_ht, 2), 2, ',', ' ');
+							}
 						}
 						$this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax);
 						$nexY = max($pdf->GetY(), $nexY);

+ 1 - 1
htdocs/custom/mmicommon

@@ -1 +1 @@
-Subproject commit b49998c189483795d1be19de9f5d6289f33c3abc
+Subproject commit 5427f84bd6d665b38dd2d1eae8deaff812b24512

+ 1 - 1
htdocs/custom/mmidocuments

@@ -1 +1 @@
-Subproject commit faf0c84bb8a257d7d07e1dc88d15f3ad8835a26d
+Subproject commit d44fbc091ebb28b4d4dbf1207afb783c5ea1b59d