From 66571b1cbd2961101560cd3f832c7e6ca90fa915 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 11 Jan 2023 23:46:45 +1100 Subject: [PATCH] Fixes for displaying purchase order table in pdf --- app/Services/Pdf/PdfBuilder.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 8992d72133bf..d54ab6381a49 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -30,6 +30,7 @@ class PdfBuilder private CommonMarkConverter $commonmark; + private float $payment_amount_total = 0; /** * an array of sections to be injected into the template * @@ -266,6 +267,7 @@ class PdfBuilder $tbody[] = $element; + $this->payment_amount_total += $payment->pivot->amount; } } @@ -295,7 +297,8 @@ class PdfBuilder $payment = $this->service->options['payments']->first(); return [ - ['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), Number::formatMoney($this->service->options['payments']->sum('amount'), $this->service->config->client))], + // ['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), Number::formatMoney($this->service->options['payments']->sum('amount'), $this->service->config->client))], + ['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), Number::formatMoney($this->payment_amount_total, $this->client))], ]; } @@ -338,6 +341,7 @@ class PdfBuilder { $this->genericSectionBuilder() + ->getProductAndTaskTables() ->getProductTotals(); $this->mergeSections([ @@ -1100,7 +1104,7 @@ class PdfBuilder } -/** + /** * Generates the product table * * @return array